nofollow, php, and Jaguar

Google, Yahoo and MSN have the blogsphere abuzz with the news that they will ignore links containing rel=”nofollow” when calculating page ranks. The hope is that (when used on links in blog comments) this will diminish the incentive for comment spam. I’m not terribly optimistic, but it is worth a shot.

New WordPress plugin – old PHP

Clint Ecker dissected the MovableType plugin and re-implemented it as a WordPress plugin. I downloaded it, activated it and received this error:

Warning: Wrong parameter count for preg_grep() in /srv/www/siriux.net/html-data/wp-content/plugins/wpNofollow.php on line 29<br />
Warning: Bad arguments to join() in /srv/www/siriux.net/html-data/wp-content/plugins/wpNofollow.php on line 30

It turns out that the plugin requires PHP 4.2 or greater, unfortunately the box that hosts this blog is running Jaguar (Mac OS X 10.2.x) and it’s version of PHP is hopelessly obsolete. I’ve been meaning to update but haven’t quite got around to it, this seemed like as good a time as any.

Upgrading is easy! 😐

I found clear instructions for upgrading PHP to 4.3 here. I grabbed the PHP 4.3.10 archive from php.net and commenced with the install. Sadly, make died on the Zend/zend_strtod.c file. A little searching showed that PHP 4.3.10 cannot be built on OS X, instead I had to grab the latest stable snapshot from the CVS.

Still needs tweaking…

I’ve tested the WordPress plugin, and it seems to work, but it will only recognize URL’s in the body of the comment (without hacking the wp-comment file) and only if the link is fully formated: <a href=”www.url.domain”>like this<a> and it ignores unadorned links: http://www.url.domain or www.url.domain. Though, I’m sure the last issue will be addressed soon.

Update:

Clint posts: “Hey I just found out the solution, I think I can lower the priority of the filter so that it gets applied last. A priority of 10 should accomplish that.”

So, change the last two lines in wpNofollow.php to:

add_filter('comment_text', 'nofollowfy', 10);
add_filter('comment_excerpt', 'nofollowfy',10);