• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP w3_is_subdomain_install函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP w3_is_url函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_is_pro函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap