Often I hear people complain about PHP and WordPress, having developed my first hodge-podge WordPress plugin, I feel a bit wiser and wanted to share what I liked about the experience. In particular areas I think we should try to emulate:
###1 file/folder = 1 plugin
To install a WordPress plugin manually, all you need to do is copy a single file into the plugins directory and you are done.
This file is highly portable, it contains metadata at the top in a nice comment.
This comment is consumed by WordPress and allows it to extract version information, author name, home page and more.
If a plugin is composed of multiple files its distributed as a zip file, the zip file can be extracted into the plugin directory, shared by email, hacked on etc.
No dependency on Ruby Gems, no need to learn voodoo about packaging, anyone can get started trivially by hacking on a single file.
###No need to restart when hacking on a plugin
You can hack all you will on these plugin files, as soon as you save them and refresh the browser your changes are live.
There is a WordPress controlled central registry of plugins and extensions, this allow WordPress to control what plugins they will make available to the public and strip out ones that are big security problems and so on.
Its fantastic to be able to use the admin interface to find and update plugins.
Almost all operations in WordPress can be intercepted and amended. Don’t like the way it renders comments, you can register your own filter that overrides the way WordPress renders comments. There are 100s of filters you can override, there are 100s of actions you can be notified on.
A simple Ruby’ish example to demonstrate the power … imagine if you could add a single file somewhere with this contents:
Discourse.filter('update.topic.title') do |old| old.gsub(/!+/, "!") end
Kaboom you are done, titles can no longer contain more than one ! mark.
###Plugin activation and de-activation
All plugins can easily be activated and de-activated from the admin interface, this makes it really easy to troubleshoot and experiment
I am quite fond of the GetText and the more modern ICU Message Format, already discussed here:
I know it is early days for us, nonetheless I think there is a lot I would like us to emulate.
There is also plenty of crazy, we can skip emulating that.