Developing Plugins For WordPress

I spoke about Developing Plugins For WordPress on Wednesday, 18th June 2008 at the Singapore PHP User Group, June 2008 meetup.

This is the second time I am speaking at the user group. The first time was in December 2007 meetup where I spoke about the same topic WorPress Plugin Development With PHP.

I think this time my pace was slightly better.

By embedding this video, it breaks my site XHTML validation!

Powerpoint Slides and Source Code can be downloaded here.

1 Star2 Stars3 Stars4 Stars5 Stars (29 votes, average: 3.59 out of 5)

My Plugins With WordPress 2.6 Beta

I have downloaded WordPress 2.6 Beta 1 and installed it. Not much difference from WordPress 2.5 in terms of the layout.

Now on the extreme top menu on the extreme right, there is a link called “Speed up!” which links to Google Gears.

In the Dashboard, right under “Right Now”, there is a comment break down added to it. Here is an example: “You have 1 post, 1 page, contained within 1 category and 0 tags. Current comment break down: 1 total, 1 approved, 0 spam and 0 awaiting moderation.”

When you write a page or post, underneath the “Save” and “Published” button, there is a word count indicator.

The display of themes under “Available Themes” has also changed a little.

Now back to serious business.

I am still deciding whether or not to maintain WordPress 2.5 compatibility for the next wave of updates for my plugins as WordPress 2.6 introduces a lot of constants like “WP_PLUGIN_URL”, “WP_PLUGIN_DIR”
“WP_CONTENT_DIR”, “WP_CONTENT_URL”, etc.

2 potential issues that would break my plugin in WordPress 2.6 and I will be unable to fix it unless I find another way to do the AJAX, “Allow wp-config.php to exist one level up from WordPress root directory
and “Allow wp-content directory to exist in a custom location (not relative to ABSPATH)“.

Argh! WordPress 2.5 has the shortest development cycle!

1 Star2 Stars3 Stars4 Stars5 Stars (54 votes, average: 3.72 out of 5)

WordPress 2.6 Beta 1

Ryan has announced the availability of WordPress 2.6 Beta 1. The final release of WordPress 2.6 should happen between 7th July 2008 to 14th July 2008 according to WordPress Trac’s Roadmap.

WordPress 2.6 is not a big release compared to WordPress 2.5, but hopefully it will not break any plugins as I just updated my plugins for WordPress 2.5.

I still think that WordPress should slow down their pace of development if not it will be hard for plugin authors to keep up with it as everytime a major version of WordPress comes out, plugins always breaks.

Here are the features of WordPress 2.6:

  • Post Revisioning
  • A “Press This” bookmarklet for tumblelog style quick posting
  • Caching of static files with Gears for faster Admin page loads
  • A new and improved image editing dialog that offers lots of control over the images in your posts
  • Theme previewing as seen on WordPress.com
  • Built-in word counting in the post editor
  • The ability to disable remote publishing for the security conscious
  • XML-RPC API for changing blog options
  • Better SSL support for the Admin
  • Hierarchy-aware paging in the Manage Pages and Manage Categories admin pages.
  • The ability to relocate your content directory
  • The ability to move wp-config.php out of your web root
  • Drag-and-drop sortable galleries
  • Customizable default avatars
  • Bulk delete, activate, and deactivate for plugins
  • Check box range selection with shift-click
  • TinyMCE 3.1.0.1 with lots of bug fixes
  • jQuery 1.2.6 with some nice performance improvements
  • jQuery UI 1.5
  • Lots of bug fixes and performance improvements

Finally the feature of activating/deactivating plugins in bulk is here!

1 Star2 Stars3 Stars4 Stars5 Stars (25 votes, average: 3.16 out of 5)

WP-PostRatings 1.31 Beta 1

WP-PostRatings is my only plugin left which still uses an external Javascript file in .php instead of .js.

Finally, I have gotten rid of .php and now the only two Javascript files in WP-PostRatings are in .js and best of all, they are packed using Dean Edward’s Packer. This will not only reduce the size of the Javascript file but also lessen the load on the server as .js files can be served as static files which requires no overhead in processing.

Changelog:

NEW: Renamed postratings-admin-js.php To postratings-admin-js.js and Move The Dynamic Javascript Variables To The PHP Pages
NEW: Renamed postratings-js.php To postratings-js.js and Move The Dynamic Javascript Variables To The PHP Pages
NEW: Uses postratings-js-packed.js And postratings-admin-js-packed.js

I need you guys to help me test WP-PostRatings 1.31 to ensure that it is working like normal as before.

Upgrading from WP-PostRatings 1.30 to WP-PostRatings 1.31 Beta 1 is very easy, just overwrite all the files will do. You do not need to run anything.

Thank You

PS: I have upgraded this site to WP-PostRatings 1.31 Beta 1, if there is any bug in the rating systems do let me know.

1 Star2 Stars3 Stars4 Stars5 Stars (168 votes, average: 3.93 out of 5)

Warning: cannot yet handle MBCS in html_entity_decode

If you are using PHP 4 and using some of my plugins, the error message “Warning: cannot yet handle MBCS in html_entity_decode” will get displayed on your page. This is not a bug in my plugin but a bug in PHP 4 itself.

My recommendation would definitely be asking you to upgrade to PHP 5. PHP group has announced the end of life for PHP 4 on the 13th July 2007.

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

As you can see, there would not be any more PHP 4 updates and security fixes will be available till 8th August 2008 which is only 2 more months. If you want to upgrade to PHP 5, this is the best time to do it.

If for some reasons you are not able to upgrade to PHP 5, the only thing you can do is to turn off error message display. You can refer to this thread for more information. This is definitely not an elegant solution.

If you host supports PHP 5 but you are on PHP 4, you can take a look at the solution posted by Thomas Arie Setiawan.

Softwares like MediaWiki which powered Wikipedia requires your server to be running PHP 5, and vBulletin has beginning asking customers to upgrade to PHP 5. It would be a matter of time before WordPress requires a minimum of PHP 5 to be running.

1 Star2 Stars3 Stars4 Stars5 Stars (79 votes, average: 3.73 out of 5)