curreX: AJAX Based Currency Converter Widget for WordPress

A brief intro…

Past few weeks I’ve been extremely busy designing a Property Investment site for a client. The primary requirement was a custom CMS (Content Management System) – which I had to build from scratch. While it drove me over the edge at times overall it was a thoroughly curreX Screenshotenjoyable as well as an educational journey for me. Since this is a site that caters to foreign investors, one of the requirements was a Currency Conversion Calculator which could be embedded in any of the articles thus providing the visitors an opportunity to get an idea of the property prices in their native currencies, without having to leave the page. At first I sought the easy way out – i.e. I searched far & wide for a currency calculator service that’d allow me to convert between almost any of the world currencies. Unfortunately the free ones out there are really pathetic and the my client wasn’t willing to shell out any $$ for a paid service. That got me down to designing one on my own. I’ve been dabbling in AJAX for a while now and find the whole idea of RIA (Rich Internet Application) really attractive. So I decided to walk the AJAX way and came up with this cool-tool. Once done with the main project, I was so satisfied with the result that I thought it’d be a really good idea to convert it into a sidebar widget for WordPress. So here I am, with curreX – the Ajax based Currency Converter for WordPress.

Current Version

  • 0.9

Features

  • The widget is very simple and does exactly what it’s supposed to do. It accepts a currency value (integer or decimal) and a source & destination currency and gives you the converted rate once you hit the Convert button.
  • It employs an AJAX back-end, i.e. the conversions are performed without having to refresh the whole page, making the tool really lightweight & fast. Looks cool too.
  • Performs client-side validation of the amount entered – thus cutting out chances of entering an erroneous value and crashing the calc. midway while performing a conversion.

Requirements

Download

[download id=”3″]

Installation

Installation couldn’t get any easier. Once downloaded, simply…

  1. Unzip the archive.
  2. Copy the extracted folder named curreX into your WordPress plug-ins folder.
  3. Activate the plug-in from the Plug-in Manager in WordPress.
  4. Visit the Sidebar Widgets page under Presentation menu to drag & drop the widget onto any sidebar you desire.

That’s it…

For those who’re using curreX with non-widget-enabled themes, you should insert the function
< ? show_currex( default_from, default_to, decimal_places, type, title ); ?>
in an appropriate place. For further details on this function & it’s parameters, refer to the FAQs section of the readme.txt bundled in the distribution.

Demonstration

A live demonstration of this can be found under the Coding section of my blog. Though the implementation of the demo is slightly different (it’s hard-coded into in a page), it should give you an idea on what the widget can do.

Showcase (the widget in action)

  • GoBackpacking
  • Hua-Hin Live – A customised version of the plug-in can be seen in action in the property list pages, once you’ve searched for properties

Subversion Repository

Change Log

  • Version 0.9 (2008-06-22)
    • Added Flash based Widget support. Now one has the option of choosing between the HTML/JavaScript version or the Flash version from the widget configuration panel of WordPress.
    • The structure of the show_currex() function (for non widget-enabled themes) has changed slightly too – to support embedding of the flash widget.
  • Version 0.8 (2008-06-19)
    • While releasing version 0.7 I had made some changes in the path structure (reference to any additional files that were loaded in the background) – and I messed up a bit there. As a result, the core javascript module that fetched the conversion rates and performed the calculations wasn’t loading properly.
    • Fixed some minor CSS issues. Now the look & feel of the widget can be modified in its entirety through the accompanying CSS file.
  • Version 0.7 (2008-05-16)
    • Added the functionality to display curreX in non-widget-enabled themes too (by popular demand). Till version 0.6, this plug-in could only be used in the form of a widget with widget-enabled themes.
  • Version 0.6 (2008-05-11)
    • This is a complete port to jQuery. Decided to finalise on one ajax library and jQuery emerged the winner. No more Protoculous for me.
    • Split out the styling into a separate CSS file. Anyone with even a bit of CSS knowledge, can now easily alter the looks of the widget without having to touch the core code file(s).
    • Implemented BlockUI – a jQuery plugin that blocks the widget interface while performing a currency conversion routine (ajax based).
    • Included a HELP option, that leads directly to the Chaos-Lab Forums (curreX Subforum)
  • Version 0.5 (2007-09-21)
    • Minor fix – but at the same time a major one from the perspective of functionality. The back-end URL for fetching conversion data from Yahoo! Finance had changed from finance.yahoo.com to download.finance.yahoo.com. This caused the plug-in to generate a message saying “Error contacting Yahoo! Finance” and not work at all. Thanks to Lia Johnston for pointing me to the correct URL.
  • Version 0.4 (2007-03-15)
    • Fixed a minor bug that caused incorrect version reporting in WordPress plug-ins management panel.
  • Version 0.3 (2007-03-15)
    • Bundled prototype.js library along with the distribution instead of relying on a theme to have it. This way the latest version of prototype can always be bundled along with.
    • Made some minor changes in the layout for smoother functionality & improvement of looks.
    • Renamed a bunch of plug-in related variables to avoid name collision with other plug-ins.
  • Version 0.2 (2007-03-05)
    • Fine tuned the widget. Now the currency unit values are written off an array instead of the ungainly manual approach that was being used earlier on. This reduced the file-size of the main plug-in considerably despite adding new code.
    • Added the configuration section. One can now set the default currency units to be displayed when the widget loads (from & to).
    • Added a Decimal Place option, which defines the number of decimal places to show in the converted result.

Please Note

I offer support for my plug-ins via the Chaos Laboratory Support Forum only. I will NOT respond to support queries left in the comment section below and, in most cases, will also not publish them. Of course, if you’d like to say something nice or helpful, then feel free to leave a comment!

If you find this plug-in useful, please consider making a donation towards further development of this useful little utility.


Alternatively, you can help me by reviewing this post by clicking on the following link. Believe it or not, this will help us both earn some cash from PayPerPost.

WordPress 2.1 is born…

WordPress LogoThe long wait is finally over. WordPress “Ella” 2.1, named after the famed jazz vocalist Ella Fitzgerald has been announced publicly just a couple of hours back.

This was certainly a very nice way to start the day. I’d just sat down with a steaming cup of tea and fired up my browser, when my news aggregator (FeedReader) popped up a message from one of my acquaintance’s blog regarding a post that outlined the upgrade process to WordPress 2.1. I was so totally taken aback !!! To be honest I wasn’t expecting it anytime before the month-end and in light of the last few security patches, I had even begun doubting whether it would be on schedule. Nevertheless, this came as a very pleasant surprise.

Going through the upgrade story I figured that most of the old plug-ins are still compatible with it and shouldn’t present any problems. I plan to perform the upgrade ASAP. Meanwhile, here’s a list of the goodies that comes bundled with the new version.

  • Autosave makes sure you never lose a post again.
  • New tabbed editor allows you to switch between WYSIWYG and code editing instantly while writing a post.
  • The lossless XML import and export makes it easy for you to move your content between WordPress blogs.
  • Completely redone visual editor also now includes spell checking.
  • New search engine privacy option allows you take you to indicate your blog shouldn’t ping or be indexed by search engines like Google.
  • You can set any “page” to be the front page of your site, and put the latest posts somewhere else, making it much easier to use WordPress as a content management system.
  • Much more efficient database code, faster than previous versions. Domas Mituzas from MySQL went over all the queries with a fine-toothed comb.
  • Links in your blogroll now support sub-categories and you can add categories on the fly.
  • Redesigned login screen from the Shuttle project.
  • More AJAX to make custom fields, moderation, deletions, and more all faster. The comments page now lets you approve or unapprove things instantly.
  • Pages can now be drafts, or private.
  • Admin has been refreshed to load faster and be more visually consistent.
  • The dashboard now instantly and brings RSS feeds asynchronously in the background.
  • Comment feeds now include all the comments, not just the last 10.
  • Better internationalization and support for right-to-left languages.
  • The upload manager lets you easily manage all your uploads pictures, video, and audio.
  • A new version of the Akismet plugin is bundled.

There you go.. 🙂 Terrific work from the guys at WordPress. Keep it up, yo !!

What are you waiting for ?? Go grab it

Handy Cheat Sheets for WordPress Plug-in & Theme Developers

WordPress API Cheat SheetA quick-tip for all the aspiring plug-in or theme developers for WordPress – I dug up two very handy cheat sheets (references) that contain summarised information on the Theme & Plug-in (WordPress 2.x) API hooks. Both are in 1280×1024 pixels PNG format and can be found at the 480x blog.

I couldn’t figure out the name of creator from his blog – but the guy’s probably a U.S. marine and has been posted in places like Iraq, Korea & Japan. Whoever he is, thanks to him for these great pieces of work.

Here are the direct links to those cheat sheets:

You can get them for free and they’re are worth every bit of it !!

WordPress v2.0.7 released within 10 days of v2.0.6 – new security fixes

WordPress LogoWordPress v2.0.7 was released just a couple of hours back with a bunch of new security fixes. This release comes within 10 days of the last one (v2.0.6) – which addressed some other vulnerabilities. This is a much smaller update requiring you to replace only a couple of files. However, WordPress stresses on the importance of undergoing this upgrade…

we think it’s important enough for your blog to be secure to do it, and hopefully only having to change a few files will make the upgrade easier than normal.

The updated files are:

  • wp-admin/inline-uploading.php
  • wp-admin/post.php
  • wp-includes/classes.php
  • wp-includes/functions.php
  • wp-settings.php
  • wp-includes/version.php

Here are the list of fixes…

  • Security fix for wp_unregister_GLOBALS() to work around the zend_hash_del_key_or_index bug in PHP 4 versions less than 4.4.3 and PHP 5 versions less than 5.1.4 with register_globals set to “On.”
  • Feeds now properly serve 304 Not Modified headers instead of mismatched 200/304 headers (a.k.a. the FeedBurner bug).
  • Backport of another 304 Not Modified fix from WordPress 2.1
  • Deleting WordPress Pages no longer gives an “Are You Sure?” prompt.
  • After deleting a WordPress Page, you are now properly redirected to the Edit Pages screen.
  • Sending an image at original size in Internet Explorer no longer adds an incorrect “height” attribute.

It is highly recommended that you perform this upgrade. Installation instructions can be found here.

Incidentally, WordPress 2.1 – the next major version it scheduled to be released sometime around the month-end.

Previous release coverage: WordPress 2.0.6 released with security fixes

Cool Free Eye-candy Web 2.0 Logos by Utom

Here are a couple of really cool Web 2.0 logos designed by Utom.

Web 2.0 Logos by Utom

They can be downloaded from his blog Utombox in both PNG and ICO formats and are distributed free. Thanks to Utom for the RSS icon which I’m using on my site now.

He’s even got a bunch of great WordPress themes enlisted as free downloads at his site.

On Creating an OpenSearch Plug-in for WordPress (for Firefox & IE7)

In my earlier tutorial titled Creating OpenSearch Plugins for Firefox (adds to the QuickSearch bar) I taught you how to write a basic OpenSearch XML format plug-in that can be used with both Firefox 2.x and IE7. The demonstrated example consisted of creating a plug-in that searches through Invision Power Boards.

As an afterthought, I felt like coming up with another quick tutorial on creating the same for WordPress. I won’t spend any time on explaining the components of the plug-in and hence you’re advised to go through the tutorial first before continuing with this. This post is merely an example of how-to modify the code shown earlier on to perform searches on WordPress.

If you ever notice the URL in the address bar when you perform searches using the internal search engine of WordPress, you’ll find the the index.php page is being called along with a variable called “s“, which contains the keywords. Say for instance, you are searching for the term “Firefox” .. the syntax will be …

http://www.domain.com/index.php?s=Firefox

If you refer to the tutorial you’ll see that we can pass on variable-value combinations to a URL using the Param tags. That’s the only parameter you need to pass for WordPress searches. I’ll cite the XML code of my site’s plug-in as an example. It should be self-explanatory.


	ChaosLab
	Chaos Laboratory: Blog Search
	miCRoSCoPiC^eaRthLinG
	microscopic.earthling@gmail.com
	open
	false
	en-us
	UTF-8
	UTF-8
	
	http://www.chaos-laboratory.com/favicon.ico
	
		
	
	http://www.chaos-laboratory.com/index.php

Notice, how I’m passing the keywords in the form of the dynamic variable {searchTerms}.

Any questions ??

WordPress 2.0.6 released with security fixes

WordPress version 2.0.6 was released a couple of hours back. It consists of quite a few security updates and an upgrade is recommend on the double.

What’s new:

  • The aforementioned security fixes
  • HTML quicktags now work in Safari browsers
  • Comments are filtered to prevent them from messing up your blog layout
  • Compatibility with PHP/FastCGI setups

This version offers a new anti-XSS function called attribute_escape() and a new & really powerful filter called “query” which allows you filter any SQL at runtime.

This is supposed to be the last major release prior to WordPress v2.1. Upgradation details can be found at the Codex Pages.

Download the latest release …

WordPress: Google AdSense Referral Rotator Plug-in

Preamble:

Google AdSense Referrals are pretty cool in a way as they contribute well in topping up on your daily AdSense earnings. Moreover, they’re quite unobtrusive and can be placed anywhere on the page without interfering with the content much. According to me they’re best placed in the side-bar and since I’m using a widget enabled theme I got down to searching for a widget plug-in that would let me to do just that.

If you don’t know how a AdSense Referral looks like, here’s a snapshot…

AdSense Referral Button

Anyway, I found plenty of AdSense widget plug-ins that allow you to display the text-ads anywhere on the side-bars. None of the plug-ins I found were cut-out for Referral Ads only, but with some minor modifications one could use the available ones to show referrals too.

Google provides you with 4 different kinds of referrals at the moment and my idea was to keep rotating between all of them randomly, thus presenting your visitors with a wider range of choice to pick from. Unfortunately, I couldn’t find a single one in this category and hence with whatever limited knowledge of WordPress I have, I got down to writing one of my own. The idea was to use the mt_rand function of PHP which …

uses a random number generator with known characteristics using the Mersenne Twister, which will produce random numbers four times faster than what the average libc rand().” provides.

… and generate a number between 1 & 4 and use that number as a key to an array holding the google_cpa_choice code for the four different referrals. Pretty easy, eh ? Every time a visitor loads the page containing this widget in the sidebar, a new random number is generated, thus showing a different referral (most of the time). I say most of the time here, since occasionally the generated random numbers might overlap showing the same referral consecutively for a couple of times.

When it came to the implementing the idea part, I was at a total loss as I’d no clue about writing sidebar widgets. However, I’m extremely adept at making meaning out of existing code and modifying it to suit my purposes. I acquired half my PHP knowledge that way. So even here, I picked a AdSense widget plug-in that seemed the easiest to decipher and recode. The plug-in I chose was Google AdSense Widget written by Mike Smullin. It took me about half-an-hour to read through the code and another one hour to get it to do what I wanted. The result was GARR or Google AdSense Referral Rotator, which I’m sharing with you here.

Current Version

  • 0.1

Requirements

Download

[download id=”5″]

Installation

  1. Installation is really easy. Unzip the file and upload the contents to your /wp-content/plugins/ directory.
  2. In the Administrative Control Panel, go to the Plugins tab and Activate the widget.
  3. It will now show up in the Sidebar Widgets screen under the Presentation menu. It’ll be located in the spare widget tray. You can simply drag and drop it on to any sidebar you wish.
  4. Once placed in a sidebar you’ll notice a small icon next to the widget title. Click on that to open the configuration panel. Here’s a screenshot of the panel…AdSense Referral Rotator Configuration Screenshot
  5. Enter your AdSense client ID (google_ad_client) here.The default referral ad size (google_ad_width x google_ad_height) is set to a small button 120 x 60 pixels. You’re free to modify it any of the other standard sizes supported by Google.Make sure you modify the google_ad_format too in case you change the width and height. The available referral ad formats can be viewed by logging into your own AdSense account and visiting this page.
  6. You’ll notice a separate section below the general parameters with four fields titled Referral#1, Referral#2 and so on… they contain the ad code for the four different referral types available through AdSense at the moment.If there are further referrals added in future, I’ll upgrade the plug-in to reflect that. In fact I’ll try to modify the widget to enable users to add as many referrals as they want.
  7. Once done with your settings, click on the close (X) button and Save the settings…and you’re done.

Now your widget will show up in the sidebar and display different referrals on every page load.

Showcase

  • Empty

Comments & Feedbacks are more than welcome… 🙂

Please Note

I offer support for my plug-ins via the Chaos Laboratory Support Forum only. I will NOT respond to support queries left in the comment section below and, in most cases, will also not publish them. Of course, if you’d like to say something nice or helpful, then feel free to leave a comment!

UPDATE (2011-03-25)

Since Google Adsense Referrals have been retired for a while now, this plug-in is of no further use and is discontinued.