. */ $Fortynuggets_minimalRequiredPhpVersion = '5.0'; /** * Check the PHP version and give a useful error message if the user's version is less than the required version * @return boolean true if version check passed. If false, triggers an error which WP will handle, by displaying * an error message on the Admin page */ function Fortynuggets_noticePhpVersionWrong() { global $Fortynuggets_minimalRequiredPhpVersion; echo '
' . __('Error: plugin "FortyNuggets" requires a newer version of PHP to be running.', '40Nuggets'). '
' . __('Minimal version of PHP required: ', '40Nuggets') . '' . $Fortynuggets_minimalRequiredPhpVersion . '' . '
' . __('Your server\'s PHP version: ', '40Nuggets') . '' . phpversion() . '' . '
'; } function Fortynuggets_PhpVersionCheck() { global $Fortynuggets_minimalRequiredPhpVersion; if (version_compare(phpversion(), $Fortynuggets_minimalRequiredPhpVersion) < 0) { add_action('admin_notices', 'Fortynuggets_noticePhpVersionWrong'); return false; } return true; } /** * Initialize internationalization (i18n) for this plugin. * References: * http://codex.wordpress.org/I18n_for_WordPress_Developers * http://www.wdmac.com/how-to-create-a-po-language-translation#more-631 * @return void */ function Fortynuggets_i18n_init() { $pluginDir = dirname(plugin_basename(__FILE__)); load_plugin_textdomain('40Nuggets', false, $pluginDir . '/languages/'); } ////////////////////////////////// // Run initialization ///////////////////////////////// // First initialize i18n Fortynuggets_i18n_init(); // Next, run the version check. // If it is successful, continue with initialization for this plugin if (Fortynuggets_PhpVersionCheck()) { // Only load and run the init function if we know PHP version can parse it include_once('fortynuggets_init.php'); Fortynuggets_init(__FILE__); }