WordPress Countdown Widget

Today is my birthday. Woo! So that means, I'm not doing anything fancy, so without further ado

Number 4 in Widget-A-Day is a countdown widget.

It'll display the amount of time until a certain event, or if it passed, how long ago it was. Lame? Yes. Do I care? Not really. Is there Javascript? No. Was there supposed to be? Yes. Why not? Because I'm lazy.

Update: By request, added a new version

Download countdown.zip (countdown.tar.gz)

Default display:
countdown1cropped.png

Admin panel:
countdown2cropped.png

Requirements

Installation

  1. Download countdown.zip (gz)
  2. Extract and upload countdown.php to the plugins/ directory
  3. Enable Countdown Widget in the Plugin admin panel
  4. In widget admin panel, place Countdown in the sidebar, and edit it to enter your the time and name

Download countdown.zip (countdown.tar.gz)

WordPress Google Reader Widget

Number 3 in Widget-A-Day is a Google Reader widget.

This widget will display your latest shared stories. You can change the amount of stories to display and how to display them.

Download googlereader.zip

Default display:
googreader1cropped.png

Admin panel:
googreader2cropped.png

Download googlereader.zip

SVN Checkout
svn co http://svn.wp-plugins.org/google-reader-widget/trunk

Requirements

Installation

  1. Download googlereader.zip
  2. Extract and upload googlereader.php to the plugins/ directory
  3. Enable Google Reader in the Plugin admin panel
  4. In widget admin panel, place Google Reader in the sidebar, and edit it to enter your user id

Features

  • Displays your latest shared items from Google Reader
  • Completely customizable display
  • Caching for large traffic sites


User ID

In order to get your shares, you need to know your user id according to Google Reader. This can be found by going to the 'Shared Items' link, and copying the 20 digit number at the end of your shared items link.

So something like:
http://www.google.com/reader/shared/02774557510273097991
Where 02774557510273097991 would be my user id.

Formatting

There are 3 parts needed to format the output.

The first part, called items start in the admin panel, is the first part of the widget after the title. For the default formatting, this is just <ul>.

The second part, called items end, is the ending of the widget. By default, this is:
</ul>
<a href="%googlereader%" style="float:right;">Shared Items</a>

The third part is what is called for each item. By default, this is:
<li style="list-style-type: none;"><a href="%link%">%title%</a></li>

The premise of calling each value is this:

  1. start
  2. item
  3. item
  4. item
  5. end

The formatting for items is:

  • %link% – Link to the item
  • %title% – Title of the item
  • %site% – The title of the site the item is from
  • %sitelink% – The link to the site the item is from
  • %number% – The number of the current item
  • %comment% – The comment (note) made when sharing an item

The formatting for start and end is:

  • %googlereader% – Link to your Google Reader shared page
  • %count% – Number of items shown

Download googlereader.zip

WordPress Last.fm Widget Widget

Number 2 in Widget-A-Day is a widget for the last.fm widgets.

It can show the chart of your recent tracks, top tracks, and top artists (weekly tracks and artists don't work currently since the value varies throughout). You can also choose between red, blue, black, and green.

Download lastfm.zip (lastfm.tar.gz)

Here is the default view:
lastfm1cropped.png

Here is the admin panel:
lastfm2cropped.png

Requirements

Installation

  1. Download lastfm.zip (gz)
  2. Extract and upload lastfm.php to the plugins/ directory
  3. Enable Last.fm Widget – New Style in the Plugin admin panel
  4. In widget admin panel, place Last.fm in the sidebar, and edit it to enter your username

Download lastfm.zip (lastfm.tar.gz)

Compete WordPress Widget

Compete released it's API today, so I decided to make a widget for WordPress using it.

Download compete.zip

SVN Checkout
svn co http://svn.wp-plugins.org/compete-widget/trunk

This adds a link, your current rank, the amount of visitors, and your rank image to the sidebar.

By default, it looks like:
wpcompetecropped1.png

In the widget admin panel, you can completely edit the title, your api key, your host (by default, it's the current host), the amount of time before the cache expires, and the ability to completely edit the display (see below)

wpcompetewidcropped1.png

Requirements

Installation

  1. Download compete.zip
  2. Extract and upload compete.php to the plugins/ directory
  3. Enable Compete Rankings in the Plugin admin panel
  4. In widget admin panel, place Compete in the sidebar, and edit it to enter your API Key

Features

  • Displays data about your site or any site you choose
  • Edit nearly all aspects of it via widget admin
  • Caching for large traffic sites

Editting display

You can edit 'Widget Formatting' to change how the info is displayed. To access the variables, use this formatting:

  • %rank% – Rank of the site
  • %icon% – The icon relating to your traffic rank (large or small depending on options)
  • %count% – People count
  • %host% – Hostname used in lookup
  • %link% – Link to the compete page for the host
  • %compete% – The compete link – Compete.com

The default formatting is:

<span style="float:right;"><img src="%icon%" alt="%rank%" /></span>
<a href="%link%">%host%</a><br />

Ranking: %rank%<br />
People: %count%<br />
%compete%

Download compete.zip

WordPress Widget-A-Day

I've been wanting to do a 'Something-A-Some-amount-of-time', and since I just made a WordPress Widget, which is pretty easy, and with WordPress 2.2, widget support is available by default, I decided to do a 'WordPress Widget-A-Day'.

Over the next week, though I'll probably start today, so I guess it'll have 4 extra or maybe just 1 depending on my motivation, I'll make and release a widget for WordPress everyday. These might not be fancy, they might not even be original, though I'm going to try to not make ones that already exist with the same functionality, but they'll be widgets.

If you have any ideas or suggestions, comment or contact me.

View posts about Widget-A-Day or subscribe to the Widget-A-Day feed

Hopefully, I won't fail at this.

New Paintball Classifieds Site

I just finished making a new paintball classified site that takes feeds from various paintball sites across the web, and brings them into one easy to use place.

Paintball Classifieds – Find Paintball Gear to Buy, Sell, or Trade

Here's how the front end works:

First, you go to the site, and are presented with the 20 latest posts from around the web.

You can then choose to only browse a certain category

You can then view the contents of the post on the current site.

If you are interested in the item, you can then view the original post on the original site, and contact the seller.

You can also search all the posts from the site. This just uses LIKE. I was going to use FULLTEXT, but for compatibility and size reasons, decided against it.

On the back end, you set up a cron job to run a certain php file every 15 minutes (this can be less or more depending on your taste). It then runs through the feed table find ones that need to be updated (this is based on an update frequency value you set for each feed).

It then requests that feed and inserts the items into the rss items table. The link is a UNIQUE key, meaning it won't insert duplicate items.

After inserting the items, it updates the last update time for that feed, and waits for the next time. Some feeds are updated every hour, while others are updated every 6 hours depending on the feed site's traffic.

Features:

  • Fully automated – Add a cron job, and it's off to the races
  • Monetized via ads or eBay affiliation
  • Pretty URLs

Requirements:

  • PHP 4/5
  • MySQL Database
  • mod_rewrite (or lighttpd)

Note: First plan was to sell this, but I'm just going to open source it.

Simple XML is Simpler!

Genius!

Sucks that it isn't for PHP 4. For this site, at the moment, I'm forced to use PHP4, since PHP5 breaks permalinks for WordPress for some reason. It's not WordPress's fault, though. Just the crappiness that is this shared hosting.

Anyways, I've used SimpleXML for most of XML parsing in PHP. Mainly for the reason that I'm lazy. This time, I wanted the site to run on here under PHP4, so I didn't have that success. But PHP's XML Parser shouldn't be too bad, right?

Here's how to go through all the <item> tags in an RSS feed via SimpleXML and placing them into an associative array:

$sxml = new SimpleXMLElement($xml);
 
foreach($sxml->channel->item as $item) {
	$items[$i]['title'] = $item->$item_title;
	$items[$i]['link'] = $item->$item_link;
	$items[$i]['desc'] = $item->$item_desc;
	$items[$i]['date'] = $item->$item_date;
}

Now in XML Parser:

$parser = xml_parser_create('UTF-8');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $xml, $vals, $index);
xml_parser_free($parser);
 
$feed = array();
$items = array();
 
$length = ($item_title == $title) ? count($index[$item_title]) - 1 : count($index[$item_title]);
 
$titleoffset = ($item_title == $title) ? 1 : 0;
$linkoffset = ($item_link == $link) ? 1 : 0;
$descoffset = ($item_desc == $desc) ? 1 : 0;
$dateoffset = ($item_date == $date) ? 1 : 0;
 
for($i=0;$i<$length;$i++) {
	$items[$i]['title'] = $vals[$index[$item_title][$i+$titleoffset]]['value'];
	$items[$i]['link'] = $vals[$index[$item_link][$i+$linkoffset]]['value'];
	$items[$i]['desc'] = $vals[$index[$item_desc][$i+$descoffset]]['value'];
	$items[$i]['date'] = $vals[$index[$item_date][$i+$dateoffset]]['value'];
}

Only about 10 more lines and ridiculous looking arrays.

This also doesn't show that you have to run strtoupper($tagname) on all of the tags you want.

One thing that SimpleXML couldn't do is parse elements with a colon in them. Like <dc:creator> or <content:encoded>. A simple fix was just to run str_replace("<dc:creator>","<creator>",$xml)

Uggh. At least the annoying part is finally out of the way, I hope.

Update- Haha. That doesn't even work. It's nowhere near the correct order. But I totally forgot about MagpieRSS. I'm using that instead.

Haha, Sputtr

Sputtr, come on. You're just about as bad as SimpleWeather.

Sputtr is a site that allows you to search multiple search engines from one page. Woo hoo! It also looks to be done in PHP, for some reason. Why PHP? Who know, since a static HTML file is more than enough.

Want proof? Here's a nice sputtr clone I whipped up:

SearchFastr

1 static HTML file. Small amount of Javascript. No PHP or other dynamic scripting language. No copy and pasting code from some site.

Want the source, just go to View Source. That's it.

Search quicker, better, cleaner. SearchFastr

Way to Go Meebo!

You invented IRC!

So Meebo's new Meebo Rooms feature launched last night, and it's a totally spectacular, original idea. It's like a chat room, but instead of just having a boring chat room, you can watch a video next to it. No more of that link and having to click-through shit for us. I mean, that shit was so complicated. And don't worry that the video will be really small, since everybody wants their videos to become smaller and smaller.

They also give you the spectacular feature of being able to style your room. Totally revolutionary. It's totally not like someone setting up their own ajax chat room and styling the page themselves. I guess that's just too complicated.

And wait, it's still better. You can still use all the IM features too, in separate windows that are still part of the same window, since having separate windows is just too hard nowadays. Everyone wants their windows inside of different windows inside of different windows. It'll be a recursive paradise!

And what's the icing on the cake? It's all done in AJAX. None of that flash crap for us. We like the soft, cuddly, memory leaking, high cpu usage features that only ridiculous AJAX can bring. Why use something like persistent connections, when we can just make a new HTTP request every time. That's using your noggin!

All of Google's Toolbar Functionality, Without the Toolbar

I don't like Google's Toolbar, or really toolbars in general. Maybe it's because it brings back memories of horrible IE interfaces with way too many, or that the logos are just bright and don't fit in at all, or maybe it's just that I like to see as much page as possible. But for whatever the reason, it's got to go.

But I run into a problem, I like some of the features, mainly Web History and showing the current PageRank. Finding out about unread gmail messages. And even though I still mainly use regular old bookmarking, I guess the ability to bookmark the page might be useful. Thankfully, there are alternatives to them all.

First, Web History and PageRank can easily be fixed by the Search Status plugin. This shows the PageRank and Alexa rank for the current page/site. What's good about this, Google records the Web History by using the PageRank lookup, meaning that we don't need anything else for us to use the Web History app.

Download Search Status

Next, getting unread count of Gmail messages. There are a few plugins that do this, but the best one, imo, is Gmail Manager. This allows you to check multiple accounts (better than the toolbar), set the refresh rate, and won't take up valuable toolbar space, since it sits at the bottom of the browser.

Download Gmail Manager

Finally, the bookmarking. There are quite a few extensions out there, but I didn't like any of them, so I wrote my own Greasemonkey script. You'll still need something to view the bookmarks, but bookmarking a page is as simple as a key press. Hit the Pause/Break button and the current page will be saved to Google Bookmarks. Nothing else. You need Greasemonkey to use this.

Download Google Bookmarks via Key Press User Script

And now I don't need the Google Toolbar anymore. Yay!