m_cache = $cache; $this->toggle_filter($status); add_filter('admin_head', array(&$this, 'filter_admin_head')); } function toggle_filter($status) { if ($status == ExecPhp_STATUS_OKAY) add_filter('admin_menu', array(&$this, 'filter_admin_menu_option')); else remove_filter('admin_menu', array(&$this, 'filter_admin_menu_option')); if ($status == ExecPhp_STATUS_PLUGIN_VERSION_MISMATCH) add_filter('admin_footer', array(&$this, 'filter_admin_footer_plugin_version')); else remove_filter('admin_footer', array(&$this, 'filter_admin_footer_plugin_version')); if ($status != ExecPhp_STATUS_OKAY && $status != ExecPhp_STATUS_PLUGIN_VERSION_MISMATCH) add_filter('admin_footer', array(&$this, 'filter_admin_footer_unknown')); else remove_filter('admin_footer', array(&$this, 'filter_admin_footer_unknown')); } function filter_admin_menu_option() { // delay initialization until the WP framework is loaded add_submenu_page('options-general.php', __('Exec-PHP Options', ExecPhp_PLUGIN_ID), __('Exec-PHP', ExecPhp_PLUGIN_ID), ExecPhp_CAPABILITY_MANAGE, __FILE__, array(&$this, 'submenu_page_option_general')); } function filter_admin_head() { wp_print_scripts(array('sack')); ?> m_cache->get_option(); $heading = __('Exec-PHP plugin is not active.', ExecPhp_PLUGIN_ID); $text = sprintf(__('For security reasons the Exec-PHP plugin functionality was turned off because no necessary upgrade of the plugin could be performed. All PHP code may be viewable to your blog readers. This is plugin version %1$s, previously there was version %2$s installed. Downgrading from a newer version to an older version of the plugin is not supported.', ExecPhp_PLUGIN_ID) , ExecPhp_VERSION, $option->get_version()); $this->print_admin_message($heading, $text); } function filter_admin_footer_unknown() { $option =& $this->m_cache->get_option(); $heading = __('Exec-PHP plugin is not active.', ExecPhp_PLUGIN_ID); $text = sprintf(__('For security reasons the Exec-PHP plugin functionality was turned off because an unknown error (%s) occured. All PHP code may be viewable to your blog readers. This error should never happen if you use the plugin with a compatible WordPress version and installed it as described in the documentation.', ExecPhp_PLUGIN_ID) , $option->get_status()); $this->print_admin_message($heading, $text); } // --------------------------------------------------------------------------- // tools // --------------------------------------------------------------------------- function print_admin_message($heading, $text) { ?>
m_cache->get_option(); if (isset($_POST[ExecPhp_ACTION_UPDATE_OPTIONS])) { check_admin_referer(ExecPhp_ACTION_UPDATE_OPTIONS); $option->set_from_POST(); $option->save(); echo ''. __('Options saved.', ExecPhp_PLUGIN_ID) . "
<?php ?> code in your posts, pages and text widgets. See the local documentation for further information. The latest version of the plugin, documentation and information will be found on the official plugin homepage.', ExecPhp_PLUGIN_ID), get_option('siteurl'). '/'. ExecPhp_DIR. '/docs/readme.html'); ?>