Skip to content

Notable – Another WordPress plugin

Dear Reader,

Grab your hip-waders and don your helmets boys, we are going in. Yep, I’ve released yet another plugin in my series. This one puts a bar of icons at the bottom of each post allowing your readers to submit your posts to several different social networking and bookmarking sites. (del.icio.us, digg, fark, etc.)

As with most of my plugins, this isn’t a unique idea, just my implementaion of it. Many thanks to Kirk Montgomery for the graphics.

The project page and installation instructions can be found here.

Or if you are already suited up and ready to go, grab the tarball here and head on in.

As always questions and comments are always welcome.

Until next time,
(l)(k)(bunny)

=C=

WordPress Plugin Update Checker

Dear Reader,

A quick one here for those writing WordPress plugins. I’m experimenting with something here and thought I’d share. One thing that bugs me about writing plugins is when I make a new version, I have to go to several places and announce that there’s an update available. So I’m toying with the idea of having the plugin check every x days to see of there has been an update.

The way I do this is in the plugin’s option page (the only place I would ever do this) I put the following code at the bottom of this post.

Currently, this one is hard coded to check every 7 days. I’m thinking about changing that to like 3 and maybe making it an option so the user can set it to 0 and never have it execute.

I’m throwing it out here for others to review. My question is, it is ok to have a plug in ‘phone home’? I know I’m not collecting any stats but this could easily get out of hand if some reasonable guidelines aren’t set.

Until next time,
(l)(k)(bunny)

=C=

CODE:

<?PHP
/*
* Version Check code.
* This is a bit verbose. I'd like to cut it down a bit. I know this works
* in almost all cases. Some places may not have curl installed. I could do
* it in AJAX calling the plugin itself with a parameter and firing off a
* call but that's basically the same as what I'm doing here. So why bother.
*/
if (($notable_settings['last_version_check']+(86400*7))<mktime()) {
$elements = parse_url('https://blog.calevans.com/
plugin_version_checker.php?plugin=wp-notable');
$current_version = 0.00;
$line = '';

if ($fp = @fsockopen($elements['host'],80)) {
fputs($fp, sprintf("GET %s HTTP/1.0\r\n" . "Host: %s\r\n\r\n", $elements['path'] .
(isset ($elements['query']) ? '?'. $elements['query'] : ''), $elements['host']));
while (!feof($fp)) $line .= fgets($fp, 4096);
fclose($fp);

$line = urldecode(trim(strtr($line,"\n\r\t\0"," ")));
$work_array = explode(" ",$line);
/*
* This does not allow for any additional messages to be passed. It
* assumes that the last time coming in is the version #.
*/
$current_version = $work_array[count($work_array)-1];
update_option('notable_last_version_check',mktime());
} // if ($fp)
if ($version!=$current_version) {
?>
<div class="wrap" style="border:solid 1px red;">This is version <?=$version;?>. The current version
of the plugin is <?=$current_version;?>. Click <a href="http://www.calevans.com/view.php/page/notable"
target="_NEW" title="Opens a new window.">here</a> to go to the project page to find out more.
<?PHP
} else {
?>
<div class="wrap">This is plugin is up to date.<br />
<?PHP
} // if ($version!=$current_version)
} else {
?>
<div class="wrap" >
<?PHP
} // if ($notable_settings['last_version_check']!=(mktime()+(86400*7)))
?>
</div>

UPDATE: AIM Online Stats for WP.

Dear Reader,

In keeping with my current trend, I’m recycling yet another old piece of code. This time, however, I didn’t plan on it. Thanks to Fred, I found yet another bug in what I thought was a very simple piece of code.

Click here to view the Project Page

The current version is now 1.0.3. If you use this plugin, please update. (Just untar over the top of your existing one.)

If you don’t use this plugin then you obviously have no interest in updating but thank you for reading this post anyhow.

If you blog, have an AIM account and want all your blog readers (Blog-sta-teers?) to know when you are available for chatting, this is the plugin you’ve been waiting for. Pop over to the project page and get your copy today. There’s no better way to signal to total strangers that you are willing to have your day interrupted.

=C=

Fade Anything Technique Extended Edition 2.0

Dear Reader,

Ok, it’s finally done. Sorry it took so long but life intervenes. Here is my take on the wonderful code to fade things. You may have seen this technique in my previous blog entries. Or in some of the lesser known places like basecamp (who inspired the original author) or the original author’s page. No matter where you saw it, here is the WordPress plugin to let you use and abuse this effect in your blog.

A sample of the effects that can be used to annoy can be found here. The official project page can be found here. You can download the tar file here.

To install:

  1. Download the tarball to your wp-content directory.
  2. Untar. This will place wp-fatter.php in your plugins directory and fatter2.js in your wp-content directory.
  3. Move fatter2.js into your javascript directory. (Or wherever you keep your javascript files.)
  4. Activate the plugin
  5. From the Admin section of WordPress go to Options->FATtER. Check the options listed making sure they have the values you want. Pay careful attention to the location of the script. If this isn’t right, the effect won’t work. Once everything is correct, Click Update to commit the values to the database.
  6. Start using the effect. There are several examples in the .js file of how to call it, the easiest is to wrap a piece of text in a span tag with a unique ID (anything as long as it’s unique for the PAGE) and a class of “fade”.

I hope you enjoy using this as much as I did creating it. For those curious, I originaly wrote this because when I would encode secret messages of undying love into blogs for wife v1.22 – the lovely and talented Kathy – she sometimes didn’t see them. So I had to make them a little less secret and a little more obvious.Until next time,

(l)(k)(bunny)

=C=