예제 #1
0
 /**
  * Setup notices actions
  */
 function admin_init()
 {
     if (current_user_can('manage_options')) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
         if (is_admin() && is_w3tc_admin_page()) {
             /**
              * Only admin can see W3TC notices and errors
              */
             if (!w3_is_multisite()) {
                 add_action('admin_notices', array(&$this, 'admin_notices'));
             }
             add_action('network_admin_notices', array(&$this, 'admin_notices'));
         }
     }
 }
예제 #2
0
 public function run()
 {
     $this->_config = w3_instance('W3_Config');
     $this->_config_admin = w3_instance('W3_ConfigAdmin');
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
     $this->_page = w3tc_get_current_page();
     if (is_network_admin() || !w3_is_multisite()) {
         $this->edge_notification();
     }
     if (is_w3tc_admin_page()) {
         add_action('admin_head', array($this, 'admin_head'));
         add_action('w3tc_hide_button_custom-edge_mode', array($this, 'hide_edge_mode_notification'));
         $support_reminder = $this->_config->get_boolean('notes.support_us') && $this->_config_admin->get_integer('common.install') < time() - W3TC_SUPPORT_US_TIMEOUT && $this->_config->get_string('common.support') == '' && !$this->_config->get_boolean('common.tweeted');
         if ($support_reminder || w3tc_show_notification('support_us_popup')) {
             add_action('w3tc-dashboard-head', array($this, 'support_us_nag'));
         }
         add_action('w3tc-dashboard-head', array($this, 'edge_nag'));
     }
 }
예제 #3
0
 public function run()
 {
     add_filter('w3tc_menu', array($this, 'menu'));
     add_action('w3tc_menu-w3tc_extensions', array($this, 'options'));
     add_action('after_setup_theme', array($this, 'maybe_deactivate_unsupported_extensions'));
     add_action('w3tc_saved_options', array($this, 'on_saved_options'), 10, 2);
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
     if (is_w3tc_admin_page()) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/extensions.php');
         w3_extensions_admin_init();
         if (isset($_GET['extension']) && isset($_GET['action'])) {
             if (in_array($_GET['action'], array('activate', 'deactivate'))) {
                 add_action('init', array($this, 'change_extension_status'));
             }
         } elseif (isset($_POST['checked'])) {
             add_action('init', array($this, 'change_extensions_status'));
         }
     }
     add_action('w3tc_hide_button_custom-hide-extension-notification', array($this, 'hide_notification'));
 }
예제 #4
0
 /**
  * Setups actions
  */
 public function admin_init()
 {
     if (current_user_can('manage_options')) {
         /**
          * @var W3_ConfigCompatibility $config_comp
          */
         $config_comp = w3_instance('W3_ConfigCompatibility');
         if ($config_comp->get_old_version() && isset($_GET['page'])) {
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
             if (is_w3tc_admin_page() || isset($GLOBALS['pagenow']) && 'plugins.php' === $GLOBALS['pagenow']) {
                 if (!w3_is_multisite() || !w3_force_master()) {
                     add_action('admin_notices', array($this, 'admin_notices'));
                 } else {
                     add_action('network_admin_notices', array($this, 'admin_notices'));
                 }
             }
             $config_comp->setup_settings();
         }
     }
 }