/** * Initialize the plugin by adding a settings page and menu. * * @since 1.0.0 */ private function __construct() { $this->plugin_slug = WP_Fragment_Cache::get_instance()->get_plugin_slug(); $this->it_meets_the_requirements = WP_Fragment_Cache::get_instance()->it_meets_the_requirements; // Add the options page and menu item. add_action('admin_menu', array($this, 'add_plugin_admin_menu')); // Add an action link pointing to the options page. $plugin_basename = plugin_basename(plugin_dir_path(realpath(dirname(__FILE__))) . $this->plugin_slug . '.php'); add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links')); if ($this->it_meets_the_requirements) { // Intercept option save add_filter('pre_update_option_wp_fragment_cache_is_enabled', array($this, 'on_is_enabled_option_update'), 10, 2); } }
/** * Static wrapper for _store() * @see _store() * * @since 1.0.0 */ static function store() { $instance = WP_Fragment_Cache::get_instance(); if ($instance->is_enabled) { $instance->_store(); } }