[wp-hackers] looking for opinions on php5-only plugins

Otto otto at ottodestruct.com
Wed Oct 7 17:49:50 UTC 2009


Version number checking is a bad idea. It's simply not accurate enough
and doesn't tell you what you need to know.

Checking for extensions, or functions provided by extensions (using
function_exists or class_exists, etc) is much more accurate and sure
to work. That's what I check for in the activation checks, whenever a
plugin depends on something that somebody might not have.

-Otto
Sent from Memphis, TN, United States


On Wed, Oct 7, 2009 at 12:41 PM, Thomas Scholz <info at toscho.de> wrote:
> Otto:
>
>> I have example code in the Automatic Timezone plugin (
>> http://wordpress.org/extend/plugins/automatic-timezone/ ) which
>> demonstrates how to prevent a plugin from being activated.
>
> I’ll steal this. :)
>
>> Using this method, you could make your plugin check for the necessary
>> support (like PHP 5, or whatever), and pop a message back to the user
>> when they try to activate it on a PHP 4 setup.
>
> It would be nice to automate this. Maybe two new fields for plugin headers?
>
> Example for a plugin that requires at least PHP 5.2, bzip2, imagick and
> iconv or mbstring:
> /*
> Plugin Name: example
> Plugin URI: http://example.com/
> Description: Bla
> Version: 0.2
> Author: Somebody
> PHP Version: 5.2
> PHP Extensions: bzip2, (iconv|mbstring), imagick
> */
>
> This would help to sort out plugins in the repository, and the error
> messages could be unified and translated by the I18n people.
>
> Thomas
>
> --
> Redaktion, Druck- und Webdesign
> http://toscho.de · 0160/1764727
> Twitter: @toscho
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list