當前位置: 首頁>>代碼示例>>PHP>>正文


PHP w3_is_subdomain_install函數代碼示例

本文整理匯總了PHP中w3_is_subdomain_install函數的典型用法代碼示例。如果您正苦於以下問題:PHP w3_is_subdomain_install函數的具體用法?PHP w3_is_subdomain_install怎麽用?PHP w3_is_subdomain_install使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了w3_is_subdomain_install函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_imported_legacy_config_keys

 /**
  * Reads legacy config file
  * @param int $blog_id
  * @param bool $force_master
  * @return array
  */
 public function get_imported_legacy_config_keys($blog_id, $force_master = false)
 {
     $suffix = '';
     if ($force_master) {
     } else {
         if ($blog_id > 0) {
             if (w3_is_network()) {
                 if (w3_is_subdomain_install()) {
                     $suffix = '-' . w3_get_domain(w3_get_host());
                 } else {
                     // try subdir blog
                     $request_uri = rtrim($_SERVER['REQUEST_URI'], '/');
                     $site_home_uri = w3_get_base_path();
                     if (substr($request_uri, 0, strlen($site_home_uri)) == $site_home_uri) {
                         $request_path_in_wp = '/' . substr($request_uri, strlen($site_home_uri));
                         $n = strpos($request_path_in_wp, '/', 1);
                         if ($n === false) {
                             $blog_path_in_wp = substr($request_path_in_wp, 1);
                         } else {
                             $blog_path_in_wp = substr($request_path_in_wp, 1, $n - 1);
                         }
                         $suffix = '-' . ($blog_path_in_wp != 'wp-admin' ? $blog_path_in_wp . '.' : '') . w3_get_domain(w3_get_host());
                     }
                 }
             }
         }
     }
     $filename = WP_CONTENT_DIR . '/w3-total-cache-config' . $suffix . '.php';
     $legacy_config = W3_ConfigData::get_array_from_file($filename);
     if (is_array($legacy_config) && isset($legacy_config['pgcache.engine']) && $legacy_config['pgcache.engine'] == 'file_pgcache') {
         $legacy_config['pgcache.engine'] = 'file_generic';
     }
     return $legacy_config;
 }
開發者ID:easinewe,項目名稱:Avec2016,代碼行數:40,代碼來源:ConfigCompatibility.php

示例2: flush

 /**
  * Flush varnish cache
  */
 function flush()
 {
     if (!is_network_admin()) {
         $this->_purge(w3_get_home_url() . '/.*');
     } else {
         global $wpdb;
         $protocall = w3_is_https() ? 'https://' : 'http://';
         // If WPMU Domain Mapping plugin is installed and active
         if (defined('SUNRISE_LOADED') && SUNRISE_LOADED && isset($wpdb->dmtable) && !empty($wpdb->dmtable)) {
             $blogs = $wpdb->get_results("SELECT {$wpdb->blogs}.domain, {$wpdb->blogs}.path, {$wpdb->dmtable}.domain AS mapped_domain\n                                    FROM {$wpdb->dmtable}\n                                    RIGHT JOIN {$wpdb->blogs} ON {$wpdb->dmtable}.blog_id = {$wpdb->blogs}.blog_id\n                                    WHERE site_id = {$wpdb->siteid}\n                                    AND spam = 0\n                                    AND deleted = 0\n                                    AND archived = '0'\n                                   ");
             foreach ($blogs as $blog) {
                 if (!isset($blog->mapped_domain)) {
                     $url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
                 } else {
                     $url = $protocall . $blog->mapped_domain . '/.*';
                 }
                 $this->_purge($url);
             }
         } else {
             if (!w3_is_subdomain_install()) {
                 $this->_purge(w3_get_home_url() . '/.*');
             } else {
                 $blogs = $wpdb->get_results("\n                                        SELECT domain, path\n                                        FROM {$wpdb->blogs}\n                                        WHERE site_id = '{$wpdb->siteid}'\n                                        AND spam = 0\n                                        AND deleted = 0\n                                        AND archived = '0'\n                                    ");
                 foreach ($blogs as $blog) {
                     $url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
                     $this->_purge($url);
                 }
             }
         }
     }
 }
開發者ID:marqui678,項目名稱:finalchance.Panopta,代碼行數:34,代碼來源:VarnishFlush.php

示例3: fix_on_wpadmin_request

 public function fix_on_wpadmin_request($config, $force_all_checks)
 {
     $exs = new SelfTestExceptions();
     $this->fix_folders($config, $exs);
     /**
      * @var W3_Config $config
      */
     if ($config->get_boolean('config.check') || $force_all_checks) {
         if ($config->get_boolean('minify.enabled') && $config->get_boolean('minify.rewrite')) {
             $this->rules_core_add($config, $exs);
         } else {
             $this->rules_core_remove($exs);
         }
         if ((w3_is_apache() || w3_is_litespeed()) && w3_is_network() && !w3_is_subdomain_install()) {
             if ($config->get_boolean('minify.enabled') && $config->get_boolean('minify.rewrite')) {
                 $this->rules_wpmu_subfolder_add($config, $exs);
             } else {
                 $this->rules_wpmu_subfolder_remove($exs);
             }
         }
         if ($config->get_boolean('minify.enabled') && $config->get_string('minify.engine') == 'file') {
             $this->rules_cache_add($config, $exs);
         } else {
             $this->rules_cache_remove($exs);
         }
     }
     // if no errors so far - check if rewrite actually works
     if (count($exs->exceptions()) <= 0 || true) {
         try {
             if ($config->get_boolean('minify.enabled') && $config->get_string('minify.engine') == 'file' && $config->get_boolean('minify.debug')) {
                 $this->verify_rewrite_working();
             }
         } catch (Exception $ex) {
             $exs->push($ex);
         }
         if ($config->get_boolean('minify.enabled')) {
             $this->verify_engine_working($config, $exs);
         }
     }
     if (count($exs->exceptions()) > 0) {
         throw $exs;
     }
 }
開發者ID:novichkovv,項目名稱:candoweightloss,代碼行數:43,代碼來源:MinifyAdminEnvironment.php

示例4: _flush_based_on_regex

 /**
  * Flush cache based on regex
  * @param string $regex
  */
 private function _flush_based_on_regex($regex)
 {
     if (w3_is_multisite() && !w3_is_subdomain_install()) {
         $domain = w3_get_home_url();
         $parsed = parse_url($domain);
         $host = $parsed['host'];
         $path = trim($parsed['path'], '/');
         $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . $host . '/' . $path;
     } else {
         $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
     }
     $dir = @opendir($flush_dir);
     if ($dir) {
         while (($entry = @readdir($dir)) !== false) {
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             if (preg_match('/' . $regex . '/', basename($entry))) {
                 w3_rmdir($flush_dir . DIRECTORY_SEPARATOR . $entry);
             }
         }
         @closedir($dir);
     }
 }
開發者ID:marqui678,項目名稱:finalchance.Panopta,代碼行數:28,代碼來源:Generic.php

示例5: remove_scripts

 /**
  * Remove script tags from the source
  *
  * @param string $content
  * @param array $files
  * @return void
  */
 function remove_scripts(&$content, $files)
 {
     $regexps = array();
     $home_url_regexp = w3_get_home_url_regexp();
     $path = '';
     if (w3_is_network() && !w3_is_subdomain_install()) {
         $path = ltrim(w3_get_home_path(), '/');
     }
     foreach ($files as $file) {
         if ($path && strpos($file, $path) === 0) {
             $file = substr($file, strlen($path));
         }
         $this->replaced_scripts[] = $file;
         if (w3_is_url($file) && !preg_match('~' . $home_url_regexp . '~i', $file)) {
             // external JS files
             $regexps[] = w3_preg_quote($file);
         } else {
             // local JS files
             $file = ltrim($file, '/');
             if (ltrim(w3_get_site_path(), '/') && strpos($file, ltrim(w3_get_site_path(), '/')) === 0) {
                 $file = str_replace(ltrim(w3_get_site_path(), '/'), '', $file);
             }
             $file = ltrim(preg_replace('~' . $home_url_regexp . '~i', '', $file), '/\\');
             $regexps[] = '(' . $home_url_regexp . ')?/?' . w3_preg_quote($file);
         }
     }
     foreach ($regexps as $regexp) {
         $content = preg_replace('~<script\\s+[^<>]*src=["\']?' . $regexp . '["\']?[^<>]*>\\s*</script>~Uis', '', $content);
     }
 }
開發者ID:novichkovv,項目名稱:candoweightloss,代碼行數:37,代碼來源:Minify.php

示例6: w3_get_blogname

/**
 * Detect WPMU blogname
 *
 * @return string
 */
function w3_get_blogname()
{
    static $blogname = null;
    if ($blogname === null) {
        if (w3_is_network()) {
            $host = w3_get_host();
            $domain = w3_get_domain($host);
            if (w3_is_subdomain_install()) {
                $blogname = $domain;
            } else {
                $uri = $_SERVER['REQUEST_URI'];
                $base_path = w3_get_base_path();
                if ($base_path != '' && strpos($uri, $base_path) === 0) {
                    $uri = substr_replace($uri, '/', 0, strlen($base_path));
                }
                $blogname = w3_get_blogname_from_uri($uri);
                if ($blogname != '') {
                    $blogname = $blogname . '.' . $domain;
                } else {
                    $blogname = $domain;
                }
            }
        } else {
            $blogname = '';
        }
    }
    return $blogname;
}
開發者ID:nuevomediagroup,項目名稱:nmg-code,代碼行數:33,代碼來源:define.php

示例7: activate

 /**
  * Activate plugin action
  *
  * @return void
  */
 function activate()
 {
     require_once W3TC_INC_DIR . '/functions/activation.php';
     /**
      * Disable buggy sitewide activation in WPMU and WP 3.0
      */
     if (w3_is_wpmu() && isset($_GET['sitewide']) || w3_is_multisite() && isset($_GET['networkwide'])) {
         w3_network_activate_error();
     }
     /**
      * Check installation files
      */
     $files = array(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_INSTALL_FILE_DB, W3TC_INSTALL_FILE_OBJECT_CACHE);
     $nonexistent_files = array();
     foreach ($files as $file) {
         if (!file_exists($file)) {
             $nonexistent_files[] = $file;
         }
     }
     if (count($nonexistent_files)) {
         $error = sprintf('Unfortunately core file(s): (<strong>%s</strong>) are missing, so activation will fail. Please re-start the installation process from the beginning.', implode(', ', $nonexistent_files));
         w3_activate_error($error);
     }
     if (!@is_dir(W3TC_CONTENT_DIR) && !@mkdir(W3TC_CONTENT_DIR)) {
         w3_writable_error(W3TC_CONTENT_DIR);
     }
     if (!@is_dir(W3TC_CACHE_FILE_DBCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_DBCACHE_DIR)) {
         w3_writable_error(W3TC_CACHE_FILE_DBCACHE_DIR);
     }
     if (!@is_dir(W3TC_CACHE_FILE_OBJECTCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_OBJECTCACHE_DIR)) {
         w3_writable_error(W3TC_CACHE_FILE_OBJECTCACHE_DIR);
     }
     if (!@is_dir(W3TC_CACHE_FILE_PGCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_PGCACHE_DIR)) {
         w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR);
     }
     if (!@is_dir(W3TC_CACHE_FILE_MINIFY_DIR) && !@mkdir(W3TC_CACHE_FILE_MINIFY_DIR)) {
         w3_writable_error(W3TC_CACHE_FILE_MINIFY_DIR);
     }
     if (!@is_dir(W3TC_LOG_DIR) && !@mkdir(W3TC_LOG_DIR)) {
         w3_writable_error(W3TC_LOG_DIR);
     }
     if (!@is_dir(W3TC_TMP_DIR) && !@mkdir(W3TC_TMP_DIR)) {
         w3_writable_error(W3TC_TMP_DIR);
     }
     if (w3_is_network() && file_exists(W3TC_CONFIG_MASTER_PATH)) {
         /**
          * For multisite load master config
          */
         $this->_config->load_master();
         if (!$this->_config->save(false)) {
             w3_writable_error(W3TC_CONFIG_PATH);
         }
     } elseif (!file_exists(W3TC_CONFIG_PATH)) {
         /**
          * Set default settings
          */
         $this->_config->set_defaults();
         /**
          * If config doesn't exist enable preview mode
          */
         if (!$this->_config->save(true)) {
             w3_writable_error(W3TC_CONFIG_PREVIEW_PATH);
         }
     }
     /**
      * Save blognames into file
      */
     if (w3_is_network() && !w3_is_subdomain_install()) {
         if (!w3_save_blognames()) {
             w3_writable_error(W3TC_BLOGNAMES_PATH);
         }
     }
     delete_option('w3tc_request_data');
     add_option('w3tc_request_data', '', null, 'no');
 }
開發者ID:nuevomediagroup,項目名稱:nmg-code,代碼行數:80,代碼來源:TotalCacheActivation.php

示例8: init

 /**
  * Init action
  *
  * @return void
  */
 function init()
 {
     // Load plugin text domain
     load_plugin_textdomain(W3TC_TEXT_DOMAIN, null, plugin_basename(W3TC_DIR) . '/languages/');
     if (is_multisite()) {
         global $w3_current_blog_id, $current_blog;
         if ($w3_current_blog_id != $current_blog->blog_id && !isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
             $url = w3_get_host() . $_SERVER['REQUEST_URI'];
             $pos = strpos($url, '?');
             if ($pos !== false) {
                 $url = substr($url, 0, $pos);
             }
             $GLOBALS['w3tc_blogmap_register_new_item'] = $url;
         }
     }
     if (isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
         $do_redirect = false;
         // true value is a sign to just generate config cache
         if ($GLOBALS['w3tc_blogmap_register_new_item'] != 'cache_options') {
             if (w3_is_subdomain_install()) {
                 $blog_home_url = $GLOBALS['w3tc_blogmap_register_new_item'];
             } else {
                 $home_url = rtrim(get_home_url(), '/');
                 if (substr($home_url, 0, 7) == 'http://') {
                     $home_url = substr($home_url, 7);
                 } else {
                     if (substr($home_url, 0, 8) == 'https://') {
                         $home_url = substr($home_url, 8);
                     }
                 }
                 if (substr($GLOBALS['w3tc_blogmap_register_new_item'], 0, strlen($home_url)) == $home_url) {
                     $blog_home_url = $home_url;
                 } else {
                     $blog_home_url = $GLOBALS['w3tc_blogmap_register_new_item'];
                 }
             }
             w3_require_once(W3TC_INC_DIR . '/functions/multisite.php');
             $do_redirect = w3_blogmap_register_new_item($blog_home_url, $this->_config);
             // reset cache of blog_id
             global $w3_current_blog_id;
             $w3_current_blog_id = null;
             // change config to actual blog, it was master before
             $this->_config = new W3_Config();
         }
         $do_redirect |= $this->_config->fill_missing_cache_options_and_save();
         // need to repeat request processing, since we was not able to realize
         // blog_id before so we are running with master config now.
         // redirect to the same url causes "redirect loop" error in browser,
         // so need to redirect to something a bit different
         if ($do_redirect) {
             if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
                 w3_redirect_temp($_SERVER['REQUEST_URI'] . '?repeat=w3tc');
             } else {
                 if (strpos($_SERVER['REQUEST_URI'], 'repeat=w3tc') === false) {
                     w3_redirect_temp($_SERVER['REQUEST_URI'] . '&repeat=w3tc');
                 }
             }
         }
     }
     /**
      * Check request and handle w3tc_request_data requests
      */
     $pos = strpos($_SERVER['REQUEST_URI'], '/w3tc_request_data/');
     if ($pos !== false) {
         $hash = substr($_SERVER['REQUEST_URI'], $pos + 19, 32);
         if (strlen($hash) == 32) {
             $request_data = (array) get_option('w3tc_request_data');
             if (isset($request_data[$hash])) {
                 echo '<pre>';
                 foreach ($request_data[$hash] as $key => $value) {
                     printf("%s: %s\n", $key, $value);
                 }
                 echo '</pre>';
                 unset($request_data[$hash]);
                 update_option('w3tc_request_data', $request_data);
             } else {
                 echo 'Requested hash expired or invalid';
             }
             exit;
         }
     }
     /**
      * Check for rewrite test request
      */
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $rewrite_test = W3_Request::get_boolean('w3tc_rewrite_test');
     if ($rewrite_test) {
         echo 'OK';
         exit;
     }
     $admin_bar = false;
     if (function_exists('is_admin_bar_showing')) {
         $admin_bar = is_admin_bar_showing();
     }
     if (current_user_can('manage_options') && $admin_bar) {
//.........這裏部分代碼省略.........
開發者ID:NerdyDillinger,項目名稱:ovrride,代碼行數:101,代碼來源:TotalCache.php

示例9: generate_rules_core_nginx

 /**
  * Generates rules for WP dir
  *
  * @return string
  */
 function generate_rules_core_nginx()
 {
     $is_network = w3_is_network();
     $is_vhost = w3_is_subdomain_install();
     $base_path = w3_get_base_path();
     $cache_dir = w3_path(W3TC_CACHE_FILE_PGCACHE_DIR);
     $permalink_structure = get_option('permalink_structure');
     /**
      * Auto reject cookies
      */
     $reject_cookies = array('comment_author', 'wp-postpass');
     /**
      * Auto reject URIs
      */
     $reject_uris = array('\\/wp-admin\\/', '\\/xmlrpc.php', '\\/wp-(app|cron|login|register|mail)\\.php');
     /**
      * Reject cache for logged in users
      */
     if ($this->_config->get_boolean('pgcache.reject.logged')) {
         $reject_cookies = array_merge($reject_cookies, array('wordpress_[a-f0-9]+', 'wordpress_logged_in'));
     }
     /**
      * Reject cache for home page
      */
     if (!$this->_config->get_boolean('pgcache.cache.home')) {
         $reject_uris[] = '^(\\/|\\/index.php)$';
     }
     /**
      * Reject cache for feeds
      */
     if (!$this->_config->get_boolean('pgcache.cache.feed')) {
         $reject_uris[] = '\\/feed\\/';
     }
     /**
      * Custom config
      */
     $reject_cookies = array_merge($reject_cookies, $this->_config->get_array('pgcache.reject.cookie'));
     $reject_uris = array_merge($reject_uris, $this->_config->get_array('pgcache.reject.uri'));
     $reject_uris = array_map('w3_parse_path', $reject_uris);
     $reject_user_agents = array_merge(array(W3TC_POWERED_BY), $this->_config->get_array('pgcache.reject.ua'));
     $accept_uris = $this->_config->get_array('pgcache.accept.uri');
     $accept_files = $this->_config->get_array('pgcache.accept.files');
     /**
      * Generate rules
      */
     $rules = '';
     $rules .= W3TC_MARKER_BEGIN_PGCACHE_CORE . "\n";
     $rules .= "rewrite ^(.*\\/)?w3tc_rewrite_test\$ \$1?w3tc_rewrite_test=1 last;\n";
     /**
      * Check for mobile redirect
      */
     if ($this->_config->get_boolean('mobile.enabled')) {
         $mobile_groups = $this->_config->get_array('mobile.rgroups');
         foreach ($mobile_groups as $mobile_group => $mobile_config) {
             $mobile_enabled = isset($mobile_config['enabled']) ? (bool) $mobile_config['enabled'] : false;
             $mobile_agents = isset($mobile_config['agents']) ? (array) $mobile_config['agents'] : '';
             $mobile_redirect = isset($mobile_config['redirect']) ? $mobile_config['redirect'] : '';
             if ($mobile_enabled && count($mobile_agents) && $mobile_redirect) {
                 $rules .= "if (\$http_user_agent ~* \"(" . implode('|', $mobile_agents) . ")\") {\n";
                 $rules .= "    rewrite .* " . $mobile_redirect . " last;\n";
                 $rules .= "}\n";
             }
         }
     }
     /**
      * Check for referrer redirect
      */
     if ($this->_config->get_boolean('referrer.enabled')) {
         $referrer_groups = $this->_config->get_array('referrer.rgroups');
         foreach ($referrer_groups as $referrer_group => $referrer_config) {
             $referrer_enabled = isset($referrer_config['enabled']) ? (bool) $referrer_config['enabled'] : false;
             $referrer_referrers = isset($referrer_config['referrers']) ? (array) $referrer_config['referrers'] : '';
             $referrer_redirect = isset($referrer_config['redirect']) ? $referrer_config['redirect'] : '';
             if ($referrer_enabled && count($referrer_referrers) && $referrer_redirect) {
                 $rules .= "if (\$http_cookie ~* \"w3tc_referrer=.*(" . implode('|', $referrer_referrers) . ")\") {\n";
                 $rules .= "    rewrite .* " . $referrer_redirect . " last;\n";
                 $rules .= "}\n";
             }
         }
     }
     /**
      * Don't accept POSTs
      */
     $rules .= "set \$w3tc_rewrite 1;\n";
     $rules .= "if (\$request_method = POST) {\n";
     $rules .= "    set \$w3tc_rewrite 0;\n";
     $rules .= "}\n";
     /**
      * Query string should be empty
      */
     $rules .= "if (\$query_string != \"\") {\n";
     $rules .= "    set \$w3tc_rewrite 0;\n";
     $rules .= "}\n";
     /**
      * Check hostname
//.........這裏部分代碼省略.........
開發者ID:nuevomediagroup,項目名稱:nmg-code,代碼行數:101,代碼來源:PgCacheAdmin.php

示例10: _get_multisite_url_identifier

 /**
  * Returns the sitepath for multisite subfolder or subdomain path for multisite subdomain
  * @return string
  */
 private function _get_multisite_url_identifier()
 {
     if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
         $parsedUrl = parse_url(w3_get_site_url());
         return $parsedUrl['host'];
     } elseif (w3_is_subdomain_install()) {
         $parsedUrl = parse_url(w3_get_domain_url());
         $urlparts = explode('.', $parsedUrl['host']);
         if (sizeof($urlparts) > 2) {
             $subdomain = array_shift($urlparts);
             return trim($subdomain, '/');
         }
     }
     return trim(w3_get_site_path(), '/');
 }
開發者ID:gumbysgoo,項目名稱:bestilblomster,代碼行數:19,代碼來源:CdnCommon.php

示例11: w3_is_subdomain_install

            <code>Disabled</code>
            <?php 
}
?>

        </li>

        <li>
            Network mode:
            <?php 
if (w3_is_network()) {
    ?>

            <code>Yes (<?php 
    echo w3_is_subdomain_install() ? 'subdomain' : 'subdir';
    ?>
)</code>
            <?php 
} else {
    ?>

            <code>No</code>
            <?php 
}
?>

        </li>
    </ul>
</div>
開發者ID:nuevomediagroup,項目名稱:nmg-code,代碼行數:29,代碼來源:self_test.php

示例12: w3_blogmap_get_blog_data

/**
 * Returns blog_id by home url
 * If database not initialized yet - returns 0
 *
 * @return integer
 */
function w3_blogmap_get_blog_data()
{
    $host = w3_get_host();
    // subdomain
    if (w3_is_subdomain_install()) {
        $blog_data = w3_blogmap_try_get_blog_data($host);
        if (is_null($blog_data)) {
            $GLOBALS['w3tc_blogmap_register_new_item'] = $host;
        }
        return $blog_data;
    } else {
        // try subdir blog
        $url = $host . $_SERVER['REQUEST_URI'];
        $pos = strpos($url, '?');
        if ($pos !== false) {
            $url = substr($url, 0, $pos);
        }
        $url = rtrim($url, '/');
        $start_url = $url;
        for (;;) {
            $blog_data = w3_blogmap_try_get_blog_data($url);
            if (!is_null($blog_data)) {
                return $blog_data;
            }
            $pos = strrpos($url, '/');
            if ($pos === false) {
                break;
            }
            $url = rtrim(substr($url, 0, $pos), '/');
        }
        $GLOBALS['w3tc_blogmap_register_new_item'] = $start_url;
        return null;
    }
}
開發者ID:jcastilloa,項目名稱:w3tc-transparentcdn,代碼行數:40,代碼來源:define.php

示例13: config_save


//.........這裏部分代碼省略.........
          * Write page cache rewrite rules
          */
         if ($new_config->get_boolean('pgcache.enabled') && $new_config->get_string('pgcache.engine') == 'file_generic') {
             if (w3_can_modify_rules(w3_get_pgcache_rules_core_path())) {
                 $w3_plugin_pgcache->write_rules_core();
             }
             if (w3_can_modify_rules(w3_get_pgcache_rules_cache_path())) {
                 $w3_plugin_pgcache->write_rules_cache();
             }
         } else {
             if (w3_can_modify_rules(w3_get_pgcache_rules_core_path())) {
                 $w3_plugin_pgcache->remove_rules_core();
             }
             if (w3_can_modify_rules(w3_get_pgcache_rules_cache_path())) {
                 $w3_plugin_pgcache->remove_rules_cache();
             }
         }
         /**
          * Write browsercache rules
          */
         if ($new_config->get_boolean('browsercache.enabled')) {
             if (w3_can_modify_rules(w3_get_browsercache_rules_cache_path())) {
                 $w3_plugin_browsercache->write_rules_cache();
             }
             if ($new_config->get_boolean('browsercache.no404wp')) {
                 if (w3_can_modify_rules(w3_get_browsercache_rules_no404wp_path())) {
                     $w3_plugin_browsercache->write_rules_no404wp();
                 }
             } else {
                 if (w3_can_modify_rules(w3_get_browsercache_rules_no404wp_path())) {
                     $w3_plugin_browsercache->remove_rules_no404wp();
                 }
             }
         } else {
             if (w3_can_modify_rules(w3_get_browsercache_rules_cache_path())) {
                 $w3_plugin_browsercache->remove_rules_cache();
             }
             if (w3_can_modify_rules(w3_get_browsercache_rules_no404wp_path())) {
                 $w3_plugin_browsercache->remove_rules_no404wp();
             }
         }
         /**
          * Write minify rewrite rules
          */
         if (W3TC_PHP5) {
             if ($new_config->get_boolean('minify.enabled') && $new_config->get_boolean('minify.rewrite')) {
                 if (w3_can_modify_rules(w3_get_minify_rules_core_path())) {
                     $w3_plugin_minify->write_rules_core();
                 }
                 if ($this->_config->get_string('minify.engine') == 'file') {
                     if (w3_can_modify_rules(w3_get_minify_rules_cache_path())) {
                         $w3_plugin_minify->write_rules_cache();
                     }
                 } else {
                     if (w3_can_modify_rules(w3_get_minify_rules_cache_path())) {
                         $w3_plugin_minify->remove_rules_cache();
                     }
                 }
             } else {
                 if (w3_can_modify_rules(w3_get_minify_rules_core_path())) {
                     $w3_plugin_minify->remove_rules_core();
                 }
                 if (w3_can_modify_rules(w3_get_minify_rules_cache_path())) {
                     $w3_plugin_minify->remove_rules_cache();
                 }
             }
         }
         /**
          * Auto upload minify files to CDN
          */
         if ($new_config->get_boolean('minify.enabled') && $new_config->get_boolean('minify.upload') && $new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) {
             $this->cdn_upload_minify();
         }
         /**
          * Auto upload browsercache files to CDN
          */
         if ($new_config->get_boolean('cdn.enabled') && $new_config->get_string('cdn.engine') == 'ftp') {
             $this->cdn_delete_browsercache();
             if ($new_config->get_boolean('browsercache.enabled')) {
                 $this->cdn_upload_browsercache();
             }
         }
         /**
          * Update CloudFront CNAMEs
          */
         if ($update_cf_cnames) {
             $error = null;
             $cdn = $w3_plugin_cdn->get_cdn();
             $cdn->update_cnames($error);
         }
         /**
          * Save blognames into file
          */
         if (w3_is_network() && !w3_is_subdomain_install()) {
             w3_save_blognames();
         }
         return true;
     }
     return false;
 }
開發者ID:niko-lgdcom,項目名稱:archives,代碼行數:101,代碼來源:TotalCache.php

示例14: _import_legacy_config

 /**
  * Reads legacy config file
  *
  * @param object $compiled_config
  * @return array
  */
 private function _import_legacy_config($compiled_config)
 {
     $suffix = '';
     if ($this->_blog_id > 0) {
         if (w3_is_network()) {
             if (w3_is_subdomain_install()) {
                 $suffix = '-' . w3_get_domain(w3_get_host());
             } else {
                 // try subdir blog
                 $request_uri = rtrim($_SERVER['REQUEST_URI'], '/');
                 $site_home_uri = w3_get_base_path();
                 if (substr($request_uri, 0, strlen($site_home_uri)) == $site_home_uri) {
                     $request_path_in_wp = '/' . substr($request_uri, strlen($site_home_uri));
                     $n = strpos($request_path_in_wp, '/', 1);
                     if ($n === false) {
                         $blog_path_in_wp = substr($request_path_in_wp, 1);
                     } else {
                         $blog_path_in_wp = substr($request_path_in_wp, 1, $n - 1);
                     }
                     $suffix = '-' . ($blog_path_in_wp != 'wp-admin' ? $blog_path_in_wp . '.' : '') . w3_get_domain(w3_get_host());
                 }
             }
         }
     }
     $filename = WP_CONTENT_DIR . '/w3-total-cache-config' . $suffix . '.php';
     return $compiled_config->get_array_from_file($filename);
 }
開發者ID:marqui678,項目名稱:finalchance.Panopta,代碼行數:33,代碼來源:ConfigWriter.php

示例15: options


//.........這裏部分代碼省略.........
     /**
      * Check for minify availability
      */
     if ($this->_config->get_boolean('minify.enabled')) {
         $minify_rule_error = '';
         if ($this->_config->get_boolean('minify.rewrite') && $this->_config->get_boolean('config.check') && w3_can_check_rules()) {
             $w3_plugin_minify = w3_instance('W3_Plugin_MinifyAdmin');
             if ($w3_plugin_minify->check_rules_core()) {
                 if (!$this->test_rewrite_minify() && (!w3_is_multisite() || w3_is_multisite() && w3_get_blog_id() != 0)) {
                     $this->_errors[] = 'It appears Minify <acronym title="Uniform Resource Locator">URL</acronym> rewriting is not working. If using apache, verify that the server configuration allows .htaccess. Or if using nginx verify all configuration files are included in the main configuration fail (and that you have reloaded / restarted nginx).';
                 }
                 if ($w3_plugin_minify->check_rules_has_legacy()) {
                     $this->_rule_errors[] = array(sprintf('Edit the configuration file (<strong>%s</strong>) and ' . 'remove all lines between and including <strong>%s</strong> and ' . '<strong>%s</strong> markers inclusive.', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY), 'minify_remove_rules_legacy');
                 }
             } else {
                 if ($w3_plugin_minify->check_rules_has_core()) {
                     $minify_rule_error = sprintf('replace the content of ' . 'the server configuration file <strong>%s</strong> between %s and ' . '%s markers inclusive', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_CORE, W3TC_MARKER_END_MINIFY_CORE);
                 } elseif ($w3_plugin_minify->check_rules_has_legacy()) {
                     $minify_rule_error = sprintf('replace the content of ' . 'the server configuration file <strong>%s</strong> between %s and ' . '%s markers inclusive', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY);
                 } else {
                     $minify_rule_error = sprintf('add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the site', w3_get_minify_rules_core_path());
                 }
                 $minify_rule_content = $w3_plugin_minify->generate_rules_core();
             }
             if ($this->_config->get_string('minify.engine') == 'file' && !$w3_plugin_minify->check_rules_cache()) {
                 if ($minify_rule_error == '') {
                     $minify_rule_error = sprintf('add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the ' . 'site', w3_get_minify_rules_cache_path());
                 }
                 $minify_rule_content .= $w3_plugin_minify->generate_rules_cache();
             }
             if ($minify_rule_error != '' && w3_get_blog_id() == 0) {
                 $this->_rule_errors[] = array(sprintf('To enable Minify, ' . $minify_rule_error . ' %s <textarea class="w3tc-rules" cols="120" rows="10" ' . 'readonly="readonly">%s</textarea>.', $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($minify_rule_content)), 'minify_write_rules');
             }
             if ((w3_is_apache() || w3_is_litespeed()) && w3_is_network() && !w3_is_subdomain_install() && !$w3_plugin_minify->check_multisite_subfolder_test_rules_cache_apache()) {
                 $minify_rule_test = sprintf('To enable Minify Rewrite Test, add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the ' . 'site', w3_get_document_root() . '/.htaccess');
                 $minify_test_rule_content = $w3_plugin_minify->generate_multisite_subfolder_rewrite_test_rules_apache();
                 $this->_rule_errors[] = array(sprintf($minify_rule_test . ' %s <textarea class="w3tc-rules" cols="120" rows="10" ' . 'readonly="readonly">%s</textarea>.', $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($minify_test_rule_content)), 'minify_write_test_rules');
             }
         }
         /**
          * Minifiers availability error handling
          */
         $minifiers_errors = array();
         if ($this->_config->get_string('minify.js.engine') == 'yuijs') {
             $path_java = $this->_config->get_string('minify.yuijs.path.java');
             $path_jar = $this->_config->get_string('minify.yuijs.path.jar');
             if (!file_exists($path_java)) {
                 $minifiers_errors[] = sprintf('YUI Compressor (JS): JAVA executable path was not found. The default minifier JSMin will be used instead.');
             } elseif (!file_exists($path_jar)) {
                 $minifiers_errors[] = sprintf('YUI Compressor (JS): JAR file path was not found. The default minifier JSMin will be used instead.');
             }
         }
         if ($this->_config->get_string('minify.css.engine') == 'yuicss') {
             $path_java = $this->_config->get_string('minify.yuicss.path.java');
             $path_jar = $this->_config->get_string('minify.yuicss.path.jar');
             if (!file_exists($path_java)) {
                 $minifiers_errors[] = sprintf('YUI Compressor (CSS): JAVA executable path was not found. The default CSS minifier will be used instead.');
             } elseif (!file_exists($path_jar)) {
                 $minifiers_errors[] = sprintf('YUI Compressor (CSS): JAR file path was not found. The default CSS minifier will be used instead.');
             }
         }
         if ($this->_config->get_string('minify.js.engine') == 'ccjs') {
             $path_java = $this->_config->get_string('minify.ccjs.path.java');
             $path_jar = $this->_config->get_string('minify.ccjs.path.jar');
             if (!file_exists($path_java)) {
                 $minifiers_errors[] = sprintf('Closure Compiler: JAVA executable path was not found. The default minifier JSMin will be used instead.');
開發者ID:marqui678,項目名稱:finalchance.Panopta,代碼行數:67,代碼來源:TotalCacheAdmin.php


注:本文中的w3_is_subdomain_install函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。