KB Plugins

The best Wordpress plugins are free

Print this post

KB Countdown v3.0

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…

Download here .

12 comments »

1
Scott says
at 1:25 am on July 12, 2007 #

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

2
Thus saith Adam
at 12:10 pm on July 14, 2007 #

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.

3
Thus saith Adam
at 8:22 am on July 26, 2007 #

Scott, What version of WP, PHP, etc are you using?

4
Scott remarks
at 5:44 am on July 28, 2007 #

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

5
Huygens thinks
at 11:40 am on July 29, 2007 #

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 :)

6
Huygens opines
at 11:41 am on July 29, 2007 #

Oops, of course remove the “echo” I have added, they were for debugging… ;-)

7
Huygens opines
at 12:44 pm on July 29, 2007 #

??!!?? 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.]

8
Thus saith Adam
at 8:41 pm on July 29, 2007 #

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.

9
Thus saith Adam
at 11:12 am on July 30, 2007 #

Scott and Huygens: Fixed and uploaded to wordpress.org.

10
Scott adds
at 7:48 pm on August 1, 2007 #

That did it! Thanks a lot, Adam.

11
anji comments
at 10:21 pm on September 21, 2007 #

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

12
Thus saith Adam
at 9:46 am on September 22, 2007 #

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.

Leave a comment

Comment Guidelines
  • Yes, your comments will be visible to everybody. (Unless you use the private contact form.)
  • Allowed HTML: <a> <b> <blockquote> <cite> <code> <em> <i> <strong>
  • Code: Put code in `backticks` (above your "Tab" key) or it won't display well
  • Gravatars: To override the default image by your comment, use a gravatar
  • Links: If you include more than one link, your comment will go into the spam queue

Please read before commenting: Because I am now employed and not just a student, I provide only minimal support for my plugins. Sorry.

If you have a bug report, feature request, or other general feedback about a plugin, please leave a comment—but do not expect an immediate response. If you are requesting help, though, please check the plugin's documentation thoroughly rather than ask your question as a comment.

Thank you for your understanding.