Completely rewritten using PHP 5 objects. This doesn’t change much for you if you use it as a widget as far as appearance goes, although it should run more efficiently now (i.e. faster). From a developer’s perspective, it’s now going to be MUCH easier to use in template files, or to reference it from another plugin.
If you aren’t using PHP 5, do not upgrade to v3.0 of the plugin. Stick with v2.3.4 at most. Version 3.0 of the plugin will not work if you aren’t using PHP 5.
Note that further development will occur exclusively within the v3+ branch of the plugin. So if you aren’t using PHP 5, why not upgrade now? Your system will only get more obsolete over time…
Dazzled? Confused? Disagree? Write a comment »
There have been 12 comments so far.
12 Comments
Hi Adam,
I appreciate your making and sharing this plugin. It works fine for me, but I have one annoyance with it. Everytime I do anything to any widget in the Wordpress > Presentation > Widgets admin screen, your widget puts:
It happened TIME_SINCE ago. It will happen in TIME_UNTIL.BARGRAPH
back in. In other words, everytime I make any changes to any widget, I have to go to yours to take out this line, or I’ll get it below my China trip countdown.
Is there any way to block the default from coming back?
Thanks,
Scott
Scott,
That shouldn’t happen, must be a bug. But I’m away from my regular computer and will be for a while, so it will probably be a couple weeks until I can look into it–sorry.
Scott, What version of WP, PHP, etc are you using?
Hi Adam,
I’m using: WP 2.2.1 and PHP 4.4.6 I don’t know what else you need.
I set up WP on bluehost.com, using fantastico, if that helps.
Thanks for your attention,
Scott
I have found a little bug in your plug-in…
If one of the message for the widget starts with one of the keyword (like BARGRAPH), the bar was not displayed. This is because strpos (in the function “needed” of your plug-in) returns 0, which is the same value as FALSE.
There is a trick that work with PHP 4 and above, it is to use the operator === or !==. So the code for needed should be:
[Adam's note: this code was lengthy; removed for length]
Nice plug-in anyway :)
Oops, of course remove the “echo” I have added, they were for debugging… ;-)
??!!?? I do not understand why one of my comment did not appear…
:-(
So I was telling that you had a bug in the use of strpos in the function “needed”.
Basically if the message starts with one of the keyword, strpos will report 0. With the test in the function, this will evaluate as FALSE.
Thus, if you have a message equal to “BARGRAPH” (without the double quotes), nothing will be displayed by the widget.
PHP (since release 4) offers the === !== operators to test that the returned has the same type or not.
So if strpos returns FALSE, and you use === FALSE, the test will be OK. If strpos returns 0 and you use === FALSE, it will consider 0 and FALSE different.
I have thus corrected your function, see below:
[Thanks Huygens. I cut out the rest because it was quite long.]
Huygens-
Your first try was picked up by Akismet for some reason and marked as spam. Thanks for catching my typo. The current version of the plugin is a complete rewrite–I converted the whole plugin to an object-oriented framework, so I’m sure that there are still other small bugs like this in there that will turn up. I’ll update the source code soon.
Scott-
from a quick glance at your website, I think I know what the problem is. You are using only the widget title, not the body. The plugin checks for body text and inserts the default text if it is blank. I’ll need to update the code to check both the title and the body, and insert the default only if BOTH are blank. Sorry about the bug. It may be a couple days until I make the change.
Scott and Huygens: Fixed and uploaded to wordpress.org.
That did it! Thanks a lot, Adam.
Hi :) nice work! I have tried a few of your plugins and they all work great but when I set up a countdown on my site and for some reason the progress bar isn’t working. any thoughts? WP2.2.2 Thanks
anji:
If you’re getting a broken image, then go into the plugin and tell it where the image file is (there’s a setting near the top). The plugin tries to find the image file itself, but sometimes it doesn’t.
If you’re not seeing anything, then make sure you have both a start and an end date, and we are currently between them.