コード例 #1
0
ファイル: NotificationsAdmin.php プロジェクト: yszar/linuxwp
    /**
     * Edge Mode popup notification
     */
    public function edge_nag()
    {
        $edge_reminder = $this->_config_admin->get_integer('evaluation.reminder') != 0 && $this->_config_admin->get_integer('evaluation.reminder') < time() && !w3tc_edge_mode();
        if ($edge_reminder || w3tc_show_notification('edge_mode_popup')) {
            ?>
            <script type="text/javascript">/*<![CDATA[*/
                jQuery(function() {
                    w3tc_lightbox_use_edge_mode('<?php 
            echo wp_create_nonce('w3tc');
            ?>
');
                });
                /*]]>*/</script>
            <?php 
            $delay = get_option('w3tc_edge_remainder_period');
            if ($delay <= 7 * 24 * 60 * 60) {
                $delay = 30 * 24 * 60 * 60;
            } else {
                if ($delay <= 30 * 24 * 60 * 60) {
                    $delay = 60 * 24 * 60 * 60;
                } else {
                    $delay = 90 * 24 * 60 * 60;
                }
            }
            update_option('w3tc_edge_remainder_period', $delay);
            try {
                $this->_config_admin->set('evaluation.reminder', time() + $delay);
                $this->_config_admin->save();
            } catch (Exception $ex) {
            }
        }
    }
コード例 #2
0
ファイル: Minify.php プロジェクト: easinewe/Avec2016
 /**
  * Handle minify error
  *
  * @param string $error
  * @return void
  */
 function _handle_error($error)
 {
     $notification = $this->_config_admin->get_string('minify.error.notification');
     if ($notification) {
         $file = W3_Request::get_string('file');
         if ($file) {
             $this->_config_admin->set('minify.error.file', $file);
         }
         if (stristr($notification, 'admin') !== false) {
             $this->_config_admin->set('minify.error.last', $error);
             $this->_config_admin->set('notes.minify_error', true);
         }
         if (stristr($notification, 'email') !== false) {
             $last = $this->_config_admin->get_integer('minify.error.notification.last');
             /**
              * Prevent email flood: send email every 5 min
              */
             if (time() - $last > 300) {
                 $this->_config_admin->set('minify.error.notification.last', time());
                 $this->_send_notification();
             }
         }
         $this->_config_admin->save();
     }
 }
コード例 #3
0
 /**
  * Load action
  *
  * @return void
  */
 function load()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $this->_page = W3_Request::get_string('page');
     switch (true) {
         case $this->_page == 'w3tc_dashboard':
         case $this->_page == 'w3tc_general':
         case $this->_page == 'w3tc_pgcache':
         case $this->_page == 'w3tc_minify':
         case $this->_page == 'w3tc_dbcache':
         case $this->_page == 'w3tc_objectcache':
         case $this->_page == 'w3tc_fragmentcache':
         case $this->_page == 'w3tc_browsercache':
         case $this->_page == 'w3tc_mobile':
         case $this->_page == 'w3tc_referrer':
         case $this->_page == 'w3tc_cdn':
         case $this->_page == 'w3tc_monitoring':
         case $this->_page == 'w3tc_install':
         case $this->_page == 'w3tc_faq':
         case $this->_page == 'w3tc_about':
         case $this->_page == 'w3tc_support':
             break;
         default:
             $this->_page = 'w3tc_dashboard';
     }
     $this->_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');
     /**
      * Run plugin action
      */
     $action = false;
     foreach ($_REQUEST as $key => $value) {
         if (strpos($key, 'w3tc_') === 0) {
             $action = 'action_' . substr($key, 5);
             break;
         }
     }
     $flush = false;
     $cdn = false;
     $support = false;
     $action_handler = w3_instance('W3_AdminActions_ActionHandler');
     $action_handler->set_default($this);
     $action_handler->set_current_page($this->_page);
     if ($action && $action_handler->exists($action)) {
         if (strpos($action, 'view') !== false) {
             if (!wp_verify_nonce(W3_Request::get_string('_wpnonce'), 'w3tc')) {
                 wp_nonce_ays('w3tc');
             } else {
                 check_admin_referer('w3tc');
             }
         }
         try {
             $action_handler->execute($action);
         } catch (Exception $e) {
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
             w3_admin_redirect_with_custom_messages(array(), array($e->getMessage()));
         }
         exit;
     }
 }
コード例 #4
0
ファイル: CdnNotes.php プロジェクト: easinewe/Avec2016
 /**
  * @param W3_Config $config
  * @param W3_ConfigAdmin|null $config_admin
  * @return array
  */
 function notifications($config, $config_admin)
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $page = W3_Request::get_string('page');
     $notes = array();
     if (!w3_is_cdn_mirror($config->get_string('cdn.engine'))) {
         /**
          * Show notification after theme change
          */
         if ($config->get_boolean('notes.theme_changed')) {
             $notes[] = sprintf(__('The active theme has changed, please %s now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup(__('upload active theme files', 'w3-total-cache'), 'cdn_export', 'cdn_export_type=theme'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'theme_changed'));
         }
         /**
          * Show notification after WP upgrade
          */
         if ($config->get_boolean('notes.wp_upgraded')) {
             $notes[] = sprintf(__('Upgraded WordPress? Please %s files now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_upgraded'));
         }
         /**
          * Show notification after CDN enable
          */
         if ($config->get_boolean('notes.cdn_upload') || $config->get_boolean('notes.cdn_reupload')) {
             $cdn_upload_buttons = array();
             if ($config->get_boolean('cdn.includes.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
             }
             if ($config->get_boolean('cdn.theme.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
             }
             if ($config->get_boolean('minify.enabled') && $config->get_boolean('cdn.minify.enable') && !$config->get_boolean('minify.auto')) {
                 $cdn_upload_buttons[] = w3_button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
             }
             if ($config->get_boolean('cdn.custom.enable')) {
                 $cdn_upload_buttons[] = w3_button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
             }
             if ($config->get_boolean('notes.cdn_upload')) {
                 $notes[] = sprintf(__('Make sure to %s and upload the %s, files to the <acronym title="Content Delivery Network">CDN</acronym> to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note('Hide this message', 'cdn_upload'));
             }
             if ($config->get_boolean('notes.cdn_reupload')) {
                 $notes[] = sprintf(__('Settings that affect Browser Cache settings for files hosted by the CDN have been changed. To apply the new settings %s and %s. %s', 'w3-total-cache'), w3_button_popup(__('export the media library', 'w3-total-cache'), 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'cdn_reupload'));
             }
         }
     }
     if (in_array($config->get_string('cdn.engine'), array('netdna', 'maxcdn')) && $config_admin->get_boolean('notes.maxcdn_whitelist_ip') && $config_admin->get_integer('track.maxcdn_authorize') == 0 && $config->get_string('cdn.' . $config->get_string('cdn.engine') . '.authorization_key')) {
         $notes[] = sprintf(__('Make sure to whitelist your servers IPs. Follow the instructions on %s. The IP for this server is %s. %s', 'w3-total-cache'), '<a href="http://support.maxcdn.com/tutorials/how-to-whitelist-your-server-ip-to-use-the-api/">MaxCDN</a>', $_SERVER['SERVER_ADDR'], w3_button_hide_note('Hide this message', 'maxcdn_whitelist_ip', '', true));
     }
     return $notes;
 }