[wp-hackers] readme.txt: "Requires PHP 5 tag"

Joost de Valk joost at yoast.com
Tue Jul 14 20:43:49 UTC 2009


Is there a page somewhere on a "big, authoritative" website, that 
explains why PHP5 is cool and required etc. that people can link to?

Best,
Joost

Otto wrote:
> Don't rely on users, they're invariably idiots. ;)
>
> Make your plugin smarter instead.
>
> /**
>   * plugin_activation_check()
>   *
>   * Replace "plugin" with the name of your plugin
>   */
> function plugin_activation_check(){
> 	if (version_compare(PHP_VERSION, '5.0.0', '<')) {
> 		deactivate_plugins(basename(__FILE__)); // Deactivate ourself
> 		wp_die("Sorry, but you can't run this plugin, it requires PHP 5 or higher.");
> 	}
> }
> register_activation_hook(__FILE__, 'plugin_activation_check');
>
>
>
> -Otto
>
>
>
> On Tue, Jul 14, 2009 at 12:31 PM, Lutz Schröer<latz at elektroelch.de>  wrote:
>    
>> I've decided to use exclusively PHP5 in my new plugin version since it was
>> much easier to code it using the PHP5 features. Unfortunately many users
>> seem to have no access to webspace with PHP5 (five years after PHP5 was
>> released!).
>>
>> I have prevented people from updating through the backend programmatically
>> but those who are downloading the plugin from wordpress.org and installing
>> it manually often do not read the readme.txt and wonder about a "Parse
>> error: syntax error, unexpected T_CLASS".
>>
>> How about adding a "Requires PHP version x.xx" tag to the readme.txt that
>> will be displayed on the extend pages? And maybe the backend could evaluate
>> this tag, too, and disable the update if the installed version does not fit.
>>
>>
>> ... and even if this topic has been discussed a thousand times: Let's drop
>> the PHP4 support!
>>
>> Latz
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>      
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>    

-- 
*Joost de Valk*
SEO & Web Development (Magento & WordPress)
OrangeValley <http://www.orangevalley.nl> & Yoast <http://yoast.com>
E: joost at orangevalley.nl <mailto:joost at orangevalley.nl> - 
joost at yoast.com <mailto:joost at yoast.com>
T: +31624555808 | @yoast <http://twitter.com/yoast> on Twitter
W: http://yoast.com/


More information about the wp-hackers mailing list