当前位置: 首页>>代码示例>>PHP>>正文


PHP W3_Config::save方法代码示例

本文整理汇总了PHP中W3_Config::save方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config::save方法的具体用法?PHP W3_Config::save怎么用?PHP W3_Config::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在W3_Config的用法示例。


在下文中一共展示了W3_Config::save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sprintf

 /**
  * Hide note action
  *
  * @return void
  */
 function action_default_hide_note()
 {
     $note = W3_Request::get_string('note');
     $admin = W3_Request::get_boolean('admin');
     $setting = sprintf('notes.%s', $note);
     if ($admin) {
         $this->_config_admin->set($setting, false);
         $this->_config_admin->save();
     } else {
         $this->_config->set($setting, false);
         $this->_config->save();
     }
     w3_admin_redirect(array(), true);
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:19,代码来源:DefaultActionsAdmin.php

示例2: update_ip_ranges

 /**
  * Check
  * @throws FilesystemOperationException
  * @throws FileOperationException
  */
 public function update_ip_ranges()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     $ip4_diff = $ip6_diff = false;
     $response = w3_http_get(W3TC_CLOUDFLARE_IP4_URL);
     $extensions_settings = $this->_config->get_array('extensions.settings', array());
     if (!is_wp_error($response)) {
         $ip4_data = $response['body'];
         $ip4_data = explode("\n", $ip4_data);
         $ip4_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip4', $this->_config, array());
         if ($ip4_diff = array_diff($ip4_data, $ip4_data_old)) {
             $extensions_settings['cloudflare']['ips.ip4'] = $ip4_data;
             $this->_config->set('extensions.settings', $extensions_settings);
         }
     }
     $response = w3_http_get(W3TC_CLOUDFLARE_IP6_URL);
     if (!is_wp_error($response)) {
         $ip6_data = $response['body'];
         $ip6_data = explode("\n", $ip6_data);
         $ip6_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip6', $this->_config, array());
         if ($ip6_diff = array_diff($ip6_data, $ip6_data_old)) {
             $extensions_settings['cloudflare']['ips.ip6'] = $ip6_data;
             $this->_config->set('extensions.settings', $extensions_settings);
         }
     }
     if ($ip4_diff || $ip6_diff) {
         try {
             $this->_config->save();
             $this->_config->refresh_cache();
         } catch (Exception $ex) {
         }
     }
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:38,代码来源:CloudFlareAPI.php

示例3: time

 /**
  * Flush browsers cache
  */
 function flush_browser_cache()
 {
     if ($this->_config->get_boolean('browsercache.enabled')) {
         $this->_config->set('browsercache.timestamp', time());
         $this->_config->save();
     }
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:10,代码来源:FlushActionsAdmin.php

示例4: catch

 /**
  * @throws Exception
  */
 function action_aws_sns_subscribe()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $topic_arn = W3_Request::get_string('cluster_messagebus_sns_topic_arn_subscribe');
     /**
      * @var W3_Enterprise_SnsClient $sns_client
      */
     $sns_client = w3_instance('W3_Enterprise_SnsClient');
     $sns_client->subscribe(plugins_url('pub/sns.php', W3TC_FILE), $topic_arn);
     try {
         $this->_config->set('cluster.messagebus.sns.topic_arn', $topic_arn);
         $this->_config->save();
     } catch (Exception $ex) {
         throw new Exception('<strong>Can\'t change configuration</strong>: ' . $ex->getMessage());
     }
     w3_admin_redirect(array('w3tc_note' => 'sns_subscribed'));
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:20,代码来源:AwsActionsAdmin.php

示例5:

 /**
  * Save support us action
  *
  * @return void
  */
 function action_config_save_support_us()
 {
     $support = W3_Request::get_string('support');
     $tweeted = W3_Request::get_boolean('tweeted');
     $this->_config->set('common.support', $support);
     $this->_config->set('common.tweeted', $tweeted);
     $this->_config->save();
     w3_instance('W3_AdminLinks')->link_update($this->_config);
     w3_admin_redirect(array('w3tc_note' => 'config_save'));
 }
开发者ID:Supreme007,项目名称:bestilblomster,代码行数:15,代码来源:ConfigActionsAdmin.php

示例6: catch

 function action_cdn_save_activate()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     try {
         $this->_config->set('cdn.enabled', true);
         $this->_config->save();
     } catch (Exception $ex) {
     }
     w3_redirect(w3_admin_url(sprintf('admin.php?page=w3tc_cdn#configuration')));
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:10,代码来源:CdnActionsAdmin.php

示例7: time

 /**
  * Handle minify error
  *
  * @return void
  */
 function _handle_error()
 {
     $notification = $this->_config->get_string('minify.error.notification');
     if ($notification) {
         if (stristr($notification, 'admin') !== false) {
             $this->_config->set('notes.minify_error', true);
         }
         if (stristr($notification, 'email') !== false) {
             $last = $this->_config->get_integer('minify.error.notification.last');
             /**
              * Prevent email flood: send email every 5 min
              */
             if (time() - $last > 300) {
                 $this->_config->set('minify.error.notification.last', time());
                 $this->_send_notification();
             }
         }
         $this->_config->save();
     }
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:25,代码来源:Minify.php

示例8: elseif

 /**
  * Save support us action
  *
  * @return void
  */
 function action_config_save_support_us()
 {
     $support = W3_Request::get_string('support');
     $tweeted = W3_Request::get_boolean('tweeted');
     $signmeup = W3_Request::get_boolean('signmeup');
     $this->_config->set('common.support', $support);
     $this->_config->set('common.tweeted', $tweeted);
     if ($signmeup) {
         if (w3_is_pro($this->_config)) {
             $license = 'pro';
         } elseif (w3_is_enterprise()) {
             $license = 'enterprise';
         } else {
             $license = 'community';
         }
         $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
         wp_remote_post(W3TC_MAILLINGLIST_SIGNUP_URL, array('body' => array('email' => $email, 'license' => $license)));
     }
     $this->_config->save();
     w3_instance('W3_AdminLinks')->link_update($this->_config);
     w3_admin_redirect(array('w3tc_note' => 'config_save'));
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:27,代码来源:ConfigActionsAdmin.php

示例9: explode

 /**
  * Create NetDNA/MaxCDN pullzone
  */
 function action_cdn_create_netdna_maxcdn_pull_zone()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $type = W3_Request::get_string('type');
     $name = W3_Request::get_string('name');
     $label = W3_Request::get_string('label');
     w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
     $cdn_engine = $this->_config->get_string('cdn.engine');
     $authorization_key = $this->_config->get_string("cdn.{$cdn_engine}.authorization_key");
     $alias = $consumerkey = $consumersecret = '';
     if ($authorization_key) {
         $keys = explode('+', $authorization_key);
         if (sizeof($keys) == 3) {
             list($alias, $consumerkey, $consumersecret) = $keys;
         }
     }
     $api = new NetDNA($alias, $consumerkey, $consumersecret);
     $url = w3_get_home_url();
     $zone = array();
     $zone['name'] = $name;
     $zone['label'] = $label;
     $zone['url'] = $url;
     try {
         $response = $api->create_pull_zone($zone);
         try {
             $this->_config->set('cdn.enabled', true);
             if (!$this->_config->get_array("cdn.{$cdn_engine}.domain")) {
                 $this->_config->set("cdn.{$cdn_engine}.domain", array("{$name}.{$alias}.netdna-cdn.com"));
             }
             $this->_config->save();
         } catch (Exception $ex) {
         }
         echo json_encode(array('status' => 'success', 'message' => 'Pull Zone created.', 'temporary_url' => "{$name}.{$alias}.netdna-cdn.com", 'data' => $response));
     } catch (Exception $ex) {
         echo json_encode(array('status' => 'error', 'message' => $ex->getMessage()));
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:40,代码来源:CdnActionsAdmin.php

示例10: w3tc_deactivate_extension

/**
 * @param $extension
 * @param W3_Config $config
 * @param bool $dont_save_config
 * @return bool
 */
function w3tc_deactivate_extension($extension, $config, $dont_save_config = false)
{
    $extensions = $config->get_array('extensions.active');
    if (array_key_exists($extension, $extensions)) {
        unset($extensions[$extension]);
        ksort($extensions, SORT_STRING);
        $config->set('extensions.active', $extensions);
        try {
            if (!$dont_save_config) {
                $config->save();
            }
            do_action("w3tc_deactivate_extension-{$extension}");
            return true;
        } catch (Exception $ex) {
        }
    }
    return false;
}
开发者ID:CarterNelms,项目名称:www.engineeredcomfort.net,代码行数:24,代码来源:extensions.php

示例11: array

 /**
  * Save config action
  *
  * Do some actions on config keys update
  * Used in several places such as:
  *
  * 1. common config save
  * 2. import settings
  * 3. enable/disable preview mode
  *
  * @param W3_Config $old_config
  * @param W3_Config $new_config
  * @param boolean $preview
  * @return void
  */
 function config_save(&$old_config, &$new_config, $preview = null)
 {
     $browsercache_dependencies = array();
     if ($new_config->get_boolean('browsercache.enabled')) {
         $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.replace', 'browsercache.html.replace', 'browsercache.other.replace'));
         if ($new_config->get_boolean('browsercache.cssjs.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.compression', 'browsercache.cssjs.expires', 'browsercache.cssjs.lifetime', 'browsercache.cssjs.cache.control', 'browsercache.cssjs.cache.policy', 'browsercache.cssjs.etag', 'browsercache.cssjs.w3tc'));
         }
         if ($new_config->get_boolean('browsercache.html.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.html.compression', 'browsercache.html.expires', 'browsercache.html.lifetime', 'browsercache.html.cache.control', 'browsercache.html.cache.policy', 'browsercache.html.etag', 'browsercache.html.w3tc'));
         }
         if ($new_config->get_boolean('browsercache.other.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.other.compression', 'browsercache.other.expires', 'browsercache.other.lifetime', 'browsercache.other.cache.control', 'browsercache.other.cache.policy', 'browsercache.other.etag', 'browsercache.other.w3tc'));
         }
     }
     /**
      * Show need empty page cache notification
      */
     if ($new_config->get_boolean('pgcache.enabled')) {
         $pgcache_dependencies = array_merge($browsercache_dependencies, array('pgcache.debug', 'dbcache.enabled', 'objectcache.enabled', 'minify.enabled', 'cdn.enabled', 'mobile.enabled', 'referrer.enabled'));
         if ($new_config->get_boolean('dbcache.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('dbcache.debug'));
         }
         if ($new_config->get_boolean('objectcache.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('objectcache.debug'));
         }
         if ($new_config->get_boolean('minify.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('minify.auto', 'minify.debug', 'minify.rewrite', 'minify.html.enable', 'minify.html.engine', 'minify.html.inline.css', 'minify.html.inline.js', 'minify.html.strip.crlf', 'minify.html.comments.ignore', 'minify.css.enable', 'minify.css.groups', 'minify.js.enable', 'minify.js.groups', 'minify.htmltidy.options.clean', 'minify.htmltidy.options.hide-comments', 'minify.htmltidy.options.wrap', 'minify.reject.logged', 'minify.reject.ua', 'minify.reject.uri'));
         }
         if ($new_config->get_boolean('cdn.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('cdn.debug', 'cdn.engine', 'cdn.uploads.enable', 'cdn.includes.enable', 'cdn.includes.files', 'cdn.theme.enable', 'cdn.theme.files', 'cdn.minify.enable', 'cdn.custom.enable', 'cdn.custom.files', 'cdn.mirror.domain', 'cdn.mirror.ssl', 'cdn.netdna.domain', 'cdn.netdna.ssl', 'cdn.cotendo.domain', 'cdn.cotendo.ssl', 'cdn.ftp.domain', 'cdn.ftp.ssl', 'cdn.s3.cname', 'cdn.s3.ssl', 'cdn.cf.cname', 'cdn.cf.ssl', 'cdn.cf2.cname', 'cdn.cf2.ssl', 'cdn.rscf.cname', 'cdn.rscf.ssl', 'cdn.azure.cname', 'cdn.azure.ssl', 'cdn.reject.admins', 'cdn.reject.ua', 'cdn.reject.uri', 'cdn.reject.files'));
         }
         if ($new_config->get_boolean('mobile.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('mobile.rgroups'));
         }
         if ($new_config->get_boolean('referrer.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('referrer.rgroups'));
         }
         $old_pgcache_dependencies_values = array();
         $new_pgcache_dependencies_values = array();
         foreach ($pgcache_dependencies as $pgcache_dependency) {
             $old_pgcache_dependencies_values[] = $old_config->get($pgcache_dependency);
             $new_pgcache_dependencies_values[] = $new_config->get($pgcache_dependency);
         }
         if (serialize($old_pgcache_dependencies_values) != serialize($new_pgcache_dependencies_values)) {
             $new_config->set('notes.need_empty_pgcache', true);
         }
     }
     /**
      * Show need empty minify notification
      */
     if ($new_config->get_boolean('minify.enabled') && ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups'))) || $new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups'))))) {
         $minify_dependencies = array_merge($browsercache_dependencies, array('minify.auto', 'minify.debug', 'minify.options', 'minify.symlinks', 'minify.css.enable', 'minify.js.enable'));
         if ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups')))) {
             $minify_dependencies = array_merge($minify_dependencies, array('minify.css.engine', 'minify.css.combine', 'minify.css.strip.comments', 'minify.css.strip.crlf', 'minify.css.imports', 'minify.css.groups', 'minify.yuicss.path.java', 'minify.yuicss.path.jar', 'minify.yuicss.options.line-break', 'minify.csstidy.options.remove_bslash', 'minify.csstidy.options.compress_colors', 'minify.csstidy.options.compress_font-weight', 'minify.csstidy.options.lowercase_s', 'minify.csstidy.options.optimise_shorthands', 'minify.csstidy.options.remove_last_;', 'minify.csstidy.options.case_properties', 'minify.csstidy.options.sort_properties', 'minify.csstidy.options.sort_selectors', 'minify.csstidy.options.merge_selectors', 'minify.csstidy.options.discard_invalid_properties', 'minify.csstidy.options.css_level', 'minify.csstidy.options.preserve_css', 'minify.csstidy.options.timestamp', 'minify.csstidy.options.template'));
         }
         if ($new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups')))) {
             $minify_dependencies = array_merge($minify_dependencies, array('minify.js.engine', 'minify.js.combine.header', 'minify.js.combine.body', 'minify.js.combine.footer', 'minify.js.strip.comments', 'minify.js.strip.crlf', 'minify.js.groups', 'minify.yuijs.path.java', 'minify.yuijs.path.jar', 'minify.yuijs.options.line-break', 'minify.yuijs.options.nomunge', 'minify.yuijs.options.preserve-semi', 'minify.yuijs.options.disable-optimizations', 'minify.ccjs.path.java', 'minify.ccjs.path.jar', 'minify.ccjs.options.compilation_level', 'minify.ccjs.options.formatting'));
         }
         $old_minify_dependencies_values = array();
         $new_minify_dependencies_values = array();
         foreach ($minify_dependencies as $minify_dependency) {
             $old_minify_dependencies_values[] = $old_config->get($minify_dependency);
             $new_minify_dependencies_values[] = $new_config->get($minify_dependency);
         }
         if (serialize($old_minify_dependencies_values) != serialize($new_minify_dependencies_values)) {
             $new_config->set('notes.need_empty_minify', true);
         }
     }
     if ($new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) {
         /**
          * Show notification when CDN enabled
          */
         if (!$old_config->get_boolean('cdn.enabled')) {
             $new_config->set('notes.cdn_upload', true);
         }
         /**
          * Show notification when Browser Cache settings changes
          */
         $cdn_dependencies = array('browsercache.enabled');
         if ($new_config->get_boolean('cdn.enabled')) {
             $cdn_dependencies = array('browsercache.cssjs.compression', 'browsercache.cssjs.expires', 'browsercache.cssjs.lifetime', 'browsercache.cssjs.cache.control', 'browsercache.cssjs.cache.policy', 'browsercache.cssjs.etag', 'browsercache.cssjs.w3tc', 'browsercache.html.compression', 'browsercache.html.expires', 'browsercache.html.lifetime', 'browsercache.html.cache.control', 'browsercache.html.cache.policy', 'browsercache.html.etag', 'browsercache.html.w3tc', 'browsercache.other.compression', 'browsercache.other.expires', 'browsercache.other.lifetime', 'browsercache.other.cache.control', 'browsercache.other.cache.policy', 'browsercache.other.etag', 'browsercache.other.w3tc');
         }
         $old_cdn_dependencies_values = array();
         $new_cdn_dependencies_values = array();
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:TotalCache.php

示例12: fopen


//.........这里部分代码省略.........
             if (preg_match('/objectcache\\.engine\' => \'file\'/', $line)) {
                 $objectcache_method = "disk";
                 continue;
             }
             if (preg_match('/objectcache\\.engine\' => \'apc\'/', $line)) {
                 $objectcache_method = "apc";
                 continue;
             }
             if (preg_match('/fragmentcache\\.enabled\' => true/', $line)) {
                 $fragmentcache = true;
                 continue;
             }
             if (preg_match('/fragmentcache\\.engine\' => \'file\'/', $line)) {
                 $fragmentcache_method = "disk";
                 continue;
             }
             if (preg_match('/fragmentcache\\.engine\' => \'apc\'/', $line)) {
                 $fragmentcache_method = "apc";
                 continue;
             }
             if (preg_match('/browsercache\\.enabled\' => true/', $line)) {
                 $browsercache = true;
                 continue;
             }
             if (preg_match('/cdn\\.enabled\' => true/', $line)) {
                 $cdn = true;
                 continue;
             }
         }
         fclose($file);
         echo "[1;34mW3 Total Cache " . $w3tc_version . " (" . (file_exists("/var/run/apache2.pid") || file_exists("/run/apache2/apache2.pid") ? "apache+nginx" : "nginx+php5-fpm") . ")[0m\n";
         echo "\n[34mPage Cache:[0m " . (isset($pgcache) ? "enabled (" . $pgcache_method . ")" : "-");
         echo "\n[34mMinify:[0m " . (isset($minify) ? "enabled" : "-");
         echo "\n[34mDatabase Cache:[0m " . (isset($dbcache) ? "enabled" : "-");
         echo "\n[34mObject Cache:[0m " . (isset($objectcache) ? "enabled (" . $objectcache_method . ")" : "-");
         echo "\n[34mFragment Cache:[0m " . (isset($fragmentcache) ? "enabled (" . $fragmentcache_method . ")" : "-");
         echo "\n[34mBrowser Cache:[0m " . (isset($browsercache) ? "enabled" : "-");
         echo "\n[34mCDN:[0m " . (isset($cdn) ? "enabled" : "-") . "\n";
     } else {
         if (isset($assoc_args['default-settings'])) {
             $siteurl = preg_replace("/https?:\\/\\/(www.)?/", "", home_url());
             if (strlen($siteurl) == 0 || !is_dir("/var/www/" . $siteurl)) {
                 WP_CLI::error("Unable to find site root. Skipping.");
                 return;
             }
             if (!is_writable("/var/www/" . $siteurl)) {
                 WP_CLI::error("Site root is not writable. Please check the permissions. Skipping.");
                 return;
             }
             $config = file_exists("/var/run/apache2.pid") || file_exists("/run/apache2/apache2.pid") ? "master_apache" : "master_nginx";
             if (file_exists("/tmp/" . $config)) {
                 WP_CLI::launch("rm /tmp/" . $config);
             }
             if (file_exists("/tmp/cdn_settings")) {
                 WP_CLI::launch("rm /tmp/cdn_settings");
             }
             $url = "https://tiagohillebrandt.eti.br/w3tc/" . $w3tc_version . "/" . $config;
             WP_CLI::launch("wget -q " . $url . " -P /tmp/ || echo -n");
             if (!file_exists("/tmp/" . $config)) {
                 WP_CLI::warning("W3TC version not compatible or server not available at this moment. Please import the settings manually.");
                 exit;
             }
             $old_config = null;
             if (isset($assoc_args['preserve-cdn'])) {
                 require_once W3TC_LIB_W3_DIR . "/ConfigData.php";
                 $cdn_url = "https://tiagohillebrandt.eti.br/w3tc/" . $w3tc_version . "/cdn_settings";
                 WP_CLI::launch("wget -q " . $cdn_url . " -P /tmp/ || echo -n");
                 if (!file_exists("/tmp/cdn_settings")) {
                     WP_CLI::warning("Not able to preserve the CDN settings. Skipping.");
                     exit;
                 }
                 $old_config = W3_ConfigData::get_array_from_file($w3tc_master);
             }
             $backup_file = preg_replace("/https?:\\/\\/(www.)?/", "", home_url());
             $backup_file = $backup_file . ".master.php";
             $backup_file = preg_replace("/\\//", "_", $backup_file);
             WP_CLI::launch("mv " . $w3tc_master . " /var/www/" . $siteurl . "/." . $backup_file);
             WP_CLI::line("Current settings backup: /var/www/" . $siteurl . "/." . $backup_file);
             WP_CLI::launch("rm " . WP_CONTENT_DIR . "/advanced-cache.php 2> /dev/null || echo -n");
             WP_CLI::launch("rm " . WP_CONTENT_DIR . "/db.php 2> /dev/null || echo -n");
             WP_CLI::launch("rm " . WP_CONTENT_DIR . "/object-cache.php 2> /dev/null || echo -n");
             WP_CLI::launch("rm -r " . WP_CONTENT_DIR . "/cache/* 2> /dev/null || echo -n");
             WP_CLI::launch("rm -r " . WP_CONTENT_DIR . "/w3tc/* 2> /dev/null || echo -n");
             WP_CLI::launch("mv /tmp/" . $config . " " . $w3tc_master);
             WP_CLI::launch("chown -R \$(stat -c %U " . WP_CONTENT_DIR . "):\$(stat -c %U " . WP_CONTENT_DIR . ") " . $w3tc_master);
             if (!is_null($old_config)) {
                 require_once W3TC_LIB_W3_DIR . "/Config.php";
                 $config = new W3_Config();
                 $cdn = fopen("/tmp/cdn_settings", "r");
                 while (!feof($cdn)) {
                     $property = trim(fgets($cdn));
                     $config->set($property, $old_config[$property]);
                 }
                 fclose($cdn);
                 $config->save();
             }
             WP_CLI::success("W3TC recommended settings have been imported.");
         }
     }
 }
开发者ID:Vatia13,项目名称:tofido,代码行数:101,代码来源:synth-ops.php

示例13: update_ip_ranges

 /**
  * Check
  * @throws FilesystemOperationException
  * @throws FileOperationException
  */
 public function update_ip_ranges()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     $ip4_diff = $ip6_diff = false;
     $config_master = new W3_Config(true);
     $response = w3_http_get(W3TC_CLOUDFLARE_IP4_URL);
     if (!is_wp_error($response)) {
         $ip4_data = $response['body'];
         $ip4_data = explode("\n", $ip4_data);
         $ip4_data_old = $this->_config->get_array('cloudflare.ips.ip4');
         if ($ip4_diff = array_diff($ip4_data, $ip4_data_old)) {
             $config_master->set('cloudflare.ips.ip4', $ip4_data);
         }
     }
     $response = w3_http_get(W3TC_CLOUDFLARE_IP6_URL);
     if (!is_wp_error($response)) {
         $ip6_data = $response['body'];
         $ip6_data = explode("\n", $ip6_data);
         $ip6_data_old = $this->_config->get_array('cloudflare.ips.ip6');
         if ($ip6_diff = array_diff($ip6_data, $ip6_data_old)) {
             $config_master->set('cloudflare.ips.ip6', $ip6_data);
         }
     }
     if ($ip4_diff || $ip6_diff) {
         $config_master->save();
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:32,代码来源:CloudFlare.php

示例14: array

 /**
  * Save config, can't decline save process. (difference from action_save)
  *
  * Do some actions on config keys update
  * Used in several places such as:
  *
  * 1. common config save
  * 2. import settings
  *
  * @param W3_Config $new_config
  * @param W3_Config $new_config_admin
  * @return bool
  * @throws Exception
  */
 function config_save($new_config, $new_config_admin)
 {
     $master_config = $new_config->is_master() ? $new_config : new W3_Config(true);
     if ($master_config->get_integer('common.instance_id', 0) == 0) {
         $master_config->set('common.instance_id', mt_rand());
         if (!$new_config->is_master()) {
             $master_config->save();
         }
     }
     $old_config = new W3_Config();
     $browsercache_dependencies = array();
     if ($new_config->get_boolean('browsercache.enabled')) {
         $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.replace', 'browsercache.html.replace', 'browsercache.other.replace'));
         if ($new_config->get_boolean('browsercache.cssjs.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.compression', 'browsercache.cssjs.expires', 'browsercache.cssjs.lifetime', 'browsercache.cssjs.cache.control', 'browsercache.cssjs.cache.policy', 'browsercache.cssjs.etag', 'browsercache.cssjs.w3tc'));
         }
         if ($new_config->get_boolean('browsercache.html.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.html.compression', 'browsercache.html.expires', 'browsercache.html.lifetime', 'browsercache.html.cache.control', 'browsercache.html.cache.policy', 'browsercache.html.etag', 'browsercache.html.w3tc'));
         }
         if ($new_config->get_boolean('browsercache.other.replace')) {
             $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.other.compression', 'browsercache.other.expires', 'browsercache.other.lifetime', 'browsercache.other.cache.control', 'browsercache.other.cache.policy', 'browsercache.other.etag', 'browsercache.other.w3tc'));
         }
     }
     /**
      * Show need empty page cache notification
      */
     if ($new_config->get_boolean('pgcache.enabled')) {
         $pgcache_dependencies = array_merge($browsercache_dependencies, array('pgcache.debug', 'dbcache.enabled', 'objectcache.enabled', 'minify.enabled', 'cdn.enabled', 'mobile.enabled', 'referrer.enabled'));
         if ($new_config->get_boolean('dbcache.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('dbcache.debug'));
         }
         if ($new_config->get_boolean('objectcache.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('objectcache.debug'));
         }
         if ($new_config->get_boolean('minify.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('minify.auto', 'minify.debug', 'minify.rewrite', 'minify.html.enable', 'minify.html.engine', 'minify.html.inline.css', 'minify.html.inline.js', 'minify.html.strip.crlf', 'minify.html.comments.ignore', 'minify.css.enable', 'minify.css.engine', 'minify.css.groups', 'minify.js.enable', 'minify.js.engine', 'minify.js.groups', 'minify.htmltidy.options.clean', 'minify.htmltidy.options.hide-comments', 'minify.htmltidy.options.wrap', 'minify.reject.logged', 'minify.reject.ua', 'minify.reject.uri'));
         }
         if ($new_config->get_boolean('cdn.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('cdn.debug', 'cdn.engine', 'cdn.uploads.enable', 'cdn.includes.enable', 'cdn.includes.files', 'cdn.theme.enable', 'cdn.theme.files', 'cdn.minify.enable', 'cdn.custom.enable', 'cdn.custom.files', 'cdn.ftp.domain', 'cdn.ftp.ssl', 'cdn.s3.cname', 'cdn.s3.ssl', 'cdn.cf.cname', 'cdn.cf.ssl', 'cdn.cf2.cname', 'cdn.cf2.ssl', 'cdn.rscf.cname', 'cdn.rscf.ssl', 'cdn.azure.cname', 'cdn.azure.ssl', 'cdn.mirror.domain', 'cdn.mirror.ssl', 'cdn.netdna.domain', 'cdn.netdna.ssl', 'cdn.cotendo.domain', 'cdn.cotendo.ssl', 'cdn.edgecast.domain', 'cdn.edgecast.ssl', 'cdn.att.domain', 'cdn.att.ssl', 'cdn.reject.logged_roles', 'cdn.reject.roles', 'cdn.reject.ua', 'cdn.reject.uri', 'cdn.reject.files'));
         }
         if ($new_config->get_boolean('mobile.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('mobile.rgroups'));
         }
         if ($new_config->get_boolean('referrer.enabled')) {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('referrer.rgroups'));
         }
         if ($new_config->get_boolean('browsercache.enabled') && $new_config->get_string('pgcache.engine') == 'file_generic') {
             $pgcache_dependencies = array_merge($pgcache_dependencies, array('browsercache.html.last_modified', 'browsercache.other.last_modified'));
         }
         $old_pgcache_dependencies_values = array();
         $new_pgcache_dependencies_values = array();
         foreach ($pgcache_dependencies as $pgcache_dependency) {
             $old_pgcache_dependencies_values[] = $old_config->get($pgcache_dependency);
             $new_pgcache_dependencies_values[] = $new_config->get($pgcache_dependency);
         }
         if (serialize($old_pgcache_dependencies_values) != serialize($new_pgcache_dependencies_values)) {
             $new_config->set('notes.need_empty_pgcache', true);
         }
     }
     /**
      * Show need empty minify notification
      */
     if ($new_config->get_boolean('minify.enabled') && ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups'))) || $new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups'))))) {
         $minify_dependencies = array_merge($browsercache_dependencies, array('minify.auto', 'minify.debug', 'minify.options', 'minify.symlinks', 'minify.css.enable', 'minify.js.enable', 'cdn.enabled'));
         if ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups')))) {
             $minify_dependencies = array_merge($minify_dependencies, array('minify.css.engine', 'minify.css.combine', 'minify.css.strip.comments', 'minify.css.strip.crlf', 'minify.css.imports', 'minify.css.groups', 'minify.yuicss.path.java', 'minify.yuicss.path.jar', 'minify.yuicss.options.line-break', 'minify.csstidy.options.remove_bslash', 'minify.csstidy.options.compress_colors', 'minify.csstidy.options.compress_font-weight', 'minify.csstidy.options.lowercase_s', 'minify.csstidy.options.optimise_shorthands', 'minify.csstidy.options.remove_last_;', 'minify.csstidy.options.case_properties', 'minify.csstidy.options.sort_properties', 'minify.csstidy.options.sort_selectors', 'minify.csstidy.options.merge_selectors', 'minify.csstidy.options.discard_invalid_properties', 'minify.csstidy.options.css_level', 'minify.csstidy.options.preserve_css', 'minify.csstidy.options.timestamp', 'minify.csstidy.options.template'));
         }
         if ($new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups')))) {
             $minify_dependencies = array_merge($minify_dependencies, array('minify.js.engine', 'minify.js.combine.header', 'minify.js.combine.body', 'minify.js.combine.footer', 'minify.js.strip.comments', 'minify.js.strip.crlf', 'minify.js.groups', 'minify.yuijs.path.java', 'minify.yuijs.path.jar', 'minify.yuijs.options.line-break', 'minify.yuijs.options.nomunge', 'minify.yuijs.options.preserve-semi', 'minify.yuijs.options.disable-optimizations', 'minify.ccjs.path.java', 'minify.ccjs.path.jar', 'minify.ccjs.options.compilation_level', 'minify.ccjs.options.formatting'));
         }
         if ($new_config->get_boolean('cdn.enabled')) {
             $minify_dependencies = array_merge($minify_dependencies, array('cdn.engine'));
         }
         $old_minify_dependencies_values = array();
         $new_minify_dependencies_values = array();
         foreach ($minify_dependencies as $minify_dependency) {
             $old_minify_dependencies_values[] = $old_config->get($minify_dependency);
             $new_minify_dependencies_values[] = $new_config->get($minify_dependency);
         }
         if (serialize($old_minify_dependencies_values) != serialize($new_minify_dependencies_values)) {
             $new_config->set('notes.need_empty_minify', true);
         }
     }
     if ($new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) {
         /**
          * Show notification when CDN enabled
//.........这里部分代码省略.........
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:101,代码来源:TotalCacheAdmin.php


注:本文中的W3_Config::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。