* @copyright Copyright (c) 2009, Stephen Ingram */ class jp_advancedrss { /** * Constructor adds action hook. */ function jp_advancedrss() { add_action('after_plugin_row', array($this, 'action_after_plugin_row'), 10, 4); } /** * Singleton Getter & Initializer * * @return jp_advancedrss */ function &get_instance() { /** * @var jp_advancedrss */ static $instance; if ($instance === null) $instance = new jp_advancedrss(); return $instance; } /** * Activate Action * * @return void */ function action_activate() { } /** * After the plugin's row in the plugins table display an error message. * * @return void Echoes output */ function action_after_plugin_row($plugin_file, $plugin_data, $context) { if ($plugin_file == JP_ADVANCEDRSS) echo '

Critical

' . $this->get_error() . '

Please contact your server\'s administrator with this error message for more information.

'; return; } /** * Get friendly error messages telling the user why they can't use the * plugin. * * @return string HTML error message. */ function get_error() { if (version_compare(PHP_VERSION, '5.2.0') < 0) return '

This plugin will only work on a server with a PHP version of at least 5.2.0. Your server is running PHP version ' . phpversion() . '

'; $errors = ''; /** * Check for fopen_wrappers */ if (!ini_get('allow_url_fopen')) $errors .= '

Your server\'s PHP enviroment must support fopen_wrappers to use this plugin.

'; /** * Check for DOM library */ if (!class_exists('DOMDocument')) $errors .= '

Your server\'s PHP enviroment must have the DOM extention installed.

'; /** * Check for XSL library */ if (!class_exists('XSLTProcessor')) $errors .= '

Your server\'s PHP enviroment must have the XSL extention installed.

'; return $errors; } }