Wordpress cirip plugin launched

Filed Under (wordpress) by The Chef on 05-07-2009

Tagged Under : , , , , ,

Today I’ve launched the plugin that passes your blog posts to cirip.ro, the micro-blogging platform.
More details: http://ezbitz.com/wp-cirip/
Enjoy

How to make an Wordpress plugin from scratch

Filed Under (php, wordpress) by The Chef on 03-07-2009

Tagged Under : , , ,

<?php
/*
Plugin Name: My-plugin
Plugin URI: http://ezbitz.com/
Description: Remove all links from comments
Version: 1.0
Author: The Chef
Author URI: http://ezbitz.com
*/

function clean_comments($text)
{
	return preg_replace ( '%<a[^>]*>(.*?)</a>%si', '$1', preg_replace ( '/\b(https?)(:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i', 'hxxp$2', $text ) );
}

add_filter ( 'comment_text', 'clean_comments' );

?>

Create an empty php file. First of all we need to fill some plugin details that will appear on the plugins page: plugin name, description, author, version etc.
For this example I’ve decided to make a small plugin that removes the links from comments. For this, we need to hook the wordpress function that displays comments from the database. For an in-depth analisys of a plugin writing, go to http://codex.wordpress.org/Writing_a_Plugin. Let’s go back to our hooks: the hook that deals with the comments retrival is “comment_text”, so we set the hook on this function. In other words, after the comment content is retrieved from the database and before it is sent to browser, our function is called, here

function clean_comments($text)

Inside this function we use 2 cascaded regex in order to remove link tag and replace http with hxxp. This take only one line of code. I know this isn’t so elegant but for the artistic effect it works:) .
And that’s our plugin.
Make a directory inside wp-content/plugins and copy php file there. Go to plugin administration panel and whatch your plugin there !

Quick tip: All-in-One Gestures on Firefox 3.5

Filed Under (Tips & Tricks) by The Chef on 30-06-2009

Tagged Under : , , ,

Today the new Firefox 3.5 has arrived. But after installing it the addons nightmare begins: incompatible versions. I can live without some of them but no TabMixPlus and All-in-One Gestures. I found a TMP version for Firefox 3.5b but there was no gestures and instinctively the contextual menu was popping around. After some research I managed to trick the old version to work on the new Firefox 3.5. Here is how:

  1. Go to the plugin page: All-in-One Gestures
  2. Right click on the “add to firefox” button and save link as
  3. You will get a .xpi file which is a zip archive
  4. Rename the .xpi adding .zip to the end
  5. Open it and extract install.rdf
  6. Open install.rdf with a text editor and look forĀ  <em:maxVersion>3.0.*</em:maxVersion>
  7. Change it to <em:maxVersion>4.0.*</em:maxVersion>
  8. Copy the new install.rdf into the zip
  9. Remove the .zip extension
  10. Drag the .xpi to firefox

Enjoy !

Page 1 of 1012345»...Last »