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

PHP w3_get_site_path函数代码示例

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

本文整理汇总了PHP中w3_get_site_path函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_get_site_path函数的具体用法?PHP w3_get_site_path怎么用?PHP w3_get_site_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get_wordpress_appname

 /**
  * @param W3_Config $config
  * @param W3_Config $config_master
  * @param bool $do_merge if to merge with network main site
  * @return string
  */
 public static function get_wordpress_appname($config, $config_master, $do_merge = true)
 {
     if (w3_is_network()) {
         if ($config_master->get_boolean('newrelic.use_network_wide_id')) {
             $appname = $config_master->get_string('newrelic.appname');
         } else {
             $merge = $config->get_boolean('newrelic.merge_with_network');
             $merge_name = '';
             if ($do_merge && $merge && w3_get_blog_id() != 0) {
                 $merge_name = ';' . $config_master->get_string('newrelic.appname');
             }
             if (w3_get_blog_id() != 0 && !$config->get_boolean('common.force_master')) {
                 $appname = $config->get_string('newrelic.appname', '');
                 if (empty($appname)) {
                     $prefix = $config->get_string('newrelic.appname_prefix');
                     $appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
                 }
             } else {
                 if (w3_get_blog_id() != 0) {
                     $prefix = $config->get_string('newrelic.appname_prefix');
                     $appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
                 } else {
                     $appname = $config->get_string('newrelic.appname');
                 }
             }
             $appname = $appname . $merge_name;
         }
     } else {
         $appname = $config->get_string('newrelic.appname');
     }
     return $appname;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:38,代码来源:NewRelicWrapper.php


示例2: get_frontpage_urls

 /**
  * Returns full urls for frontpage including older pages
  * @param int $limit_post_pages default is 10
  * @return array
  */
 function get_frontpage_urls($limit_post_pages = 10)
 {
     if (!isset($this->frontpage_urls[$limit_post_pages])) {
         $front_page = get_option('show_on_front');
         $full_urls = array();
         $home_path = w3_get_home_path();
         $site_path = w3_get_site_path();
         $full_urls[] = $this->home_url . '/';
         if ($site_path != $home_path) {
             $full_urls[] = w3_get_site_url() . '/';
         }
         if ($front_page == 'posts') {
             $full_urls = array_merge($full_urls, $this->get_older_pages($home_path, $limit_post_pages));
         }
         $this->frontpage_urls[$limit_post_pages] = $full_urls;
     }
     return $this->frontpage_urls[$limit_post_pages];
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:23,代码来源:PageUrls.php


示例3: w3_translate_file

/**
 * Translates remote file to local file
 *
 * @param string $file
 * @return string
 */
function w3_translate_file($file)
{
    if (!w3_is_url($file)) {
        $file = '/' . ltrim($file, '/');
        $regexp = '~^' . w3_preg_quote(w3_get_site_path()) . '~';
        $file = preg_replace($regexp, w3_get_base_path(), $file);
        $file = ltrim($file, '/');
    }
    return $file;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:16,代码来源:define.php


示例4: _get_page_key

 /**
  * Returns page key
  *
  * @param string $request_uri
  * @param string $compression
  * @return string
  */
 function _get_page_key($request_uri, $compression)
 {
     if ($this->_config->get_string('pgcache.engine') == 'file_pgcache') {
         $key = preg_replace('~[/\\\\]+~', '/', $key);
         $key = preg_replace('~\\?.*$~', '', $request_uri);
         $key = str_replace(w3_get_site_path(), '/', $key);
         $key = str_replace('/index.php', '/', $key);
         if ($key == '') {
             $key = '/';
         }
         if (substr($key, -1) == '/') {
             $key .= '_default_.html';
         }
         $key = ltrim($key, '/');
         if (!empty($compression)) {
             $key .= '.' . $compression;
         }
     } else {
         $blogname = w3_get_blogname();
         if ($blogname == '') {
             $blogname = $_SERVER['HTTP_HOST'];
         }
         $key = sprintf('w3tc_%s_page_%s', md5($blogname), md5($request_uri));
         if (!empty($compression)) {
             $key .= '_' . $compression;
         }
     }
     return $key;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:36,代码来源:PgCache.php


示例5: get_server_info

 /**
  * Returns server info
  *
  * @return array
  */
 function get_server_info()
 {
     global $wp_version, $wp_db_version, $wpdb;
     $wordpress_plugins = get_plugins();
     $wordpress_plugins_active = array();
     foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
         if (is_plugin_active($wordpress_plugin_file)) {
             $wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
         }
     }
     $mysql_version = $wpdb->get_var('SELECT VERSION()');
     $mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
     $mysql_variables = array();
     foreach ($mysql_variables_result as $mysql_variables_row) {
         $mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
     }
     $server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => w3_get_blog_id(), 'document_root' => w3_get_document_root(), 'home_root' => w3_get_home_root(), 'site_root' => w3_get_site_root(), 'base_path' => w3_get_base_path(), 'home_path' => w3_get_home_path(), 'site_path' => w3_get_site_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) w3_upload_info(), 'theme' => w3tc_get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
     return $server_info;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:24,代码来源:SupportActionsAdmin.php


示例6: _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


示例7: get_groups

 /**
  * Returns minify groups
  * @param string $group
  * @param string $type
  * @return array
  */
 function get_groups($group, $type)
 {
     $result = array();
     switch ($type) {
         case 'css':
             $groups = $this->_config->get_array('minify.css.groups');
             break;
         case 'js':
             $groups = $this->_config->get_array('minify.js.groups');
             break;
         default:
             return $result;
     }
     if (isset($groups['default'])) {
         $locations = (array) $groups['default'];
     } else {
         $locations = array();
     }
     if ($group != 'default' && isset($groups[$group])) {
         $locations = array_merge_recursive($locations, (array) $groups[$group]);
     }
     foreach ($locations as $location => $config) {
         if (!empty($config['files'])) {
             foreach ((array) $config['files'] as $file) {
                 if (w3_is_url($file)) {
                     if ($precached_file = $this->_precache_file($file, $type)) {
                         $result[$location][$file] = $precached_file;
                     }
                 } else {
                     if (w3_get_blog_id()) {
                         // for WPMU we have to remove blog path
                         $file = str_replace(w3_get_site_path(), '', $file);
                     }
                     $result[$location][$file] = '//' . $file;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:46,代码来源:Minify.php


示例8: get_groups

 /**
  * Returns minify groups
  *
  * @param string $theme
  * @param string $template
  * @param string $type
  * @return array
  */
 function get_groups($theme, $template, $type)
 {
     $result = array();
     switch ($type) {
         case 'css':
             $groups = $this->_config->get_array('minify.css.groups');
             break;
         case 'js':
             $groups = $this->_config->get_array('minify.js.groups');
             break;
         default:
             return $result;
     }
     if (isset($groups[$theme]['default'])) {
         $locations = (array) $groups[$theme]['default'];
     } else {
         $locations = array();
     }
     if ($template != 'default' && isset($groups[$theme][$template])) {
         $locations = array_merge_recursive($locations, (array) $groups[$theme][$template]);
     }
     foreach ($locations as $location => $config) {
         if (!empty($config['files'])) {
             foreach ((array) $config['files'] as $file) {
                 $file = w3_normalize_file_minify2($file);
                 if (w3_is_url($file)) {
                     $precached_file = $this->_precache_file($file, $type);
                     if ($precached_file) {
                         $result[$location][$file] = $precached_file;
                     } else {
                         $this->error(sprintf('Unable to cache remote file: "%s"', $file));
                     }
                 } else {
                     if (!w3_is_multisite() && strpos(trailingslashit(WP_CONTENT_DIR), trailingslashit(w3_get_site_root())) !== false) {
                         $file = ltrim(w3_get_site_path(), '/') . str_replace(ltrim(w3_get_site_path(), '/'), '', $file);
                     }
                     $path = w3_get_document_root() . '/' . $file;
                     if (file_exists($path)) {
                         $result[$location][$file] = '//' . $file;
                     } else {
                         $this->error(sprintf('File "%s" doesn\'t exist', $path));
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:56,代码来源:Minify.php


示例9: w3tc_loader_file_data

 public function w3tc_loader_file_data()
 {
     $filename = W3TC_WP_LOADER;
     $data = "\n<?php\n    if (W3TC_WP_LOADING)\n        require_once '" . w3_get_document_root() . '/' . trim(w3_get_site_path(), "/") . "/wp-load.php';\n";
     return array('filename' => $filename, 'data' => $data);
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:6,代码来源:Setup.php


示例10: get_files_custom

 /**
  * Exports custom files to CDN
  *
  * @return array
  */
 function get_files_custom()
 {
     $files = array();
     $document_root = w3_get_document_root();
     $custom_files = $this->_config->get_array('cdn.custom.files');
     $custom_files = array_map('w3_parse_path', $custom_files);
     $site_root = w3_get_site_root();
     $path = w3_get_site_path();
     if (strstr(WP_CONTENT_DIR, w3_get_site_root()) === false) {
         $site_root = w3_get_document_root();
         $path = '';
     }
     $content_path = trim(substr(WP_CONTENT_DIR, strlen($site_root)), '/\\');
     $wp_content_folder = basename(WP_CONTENT_DIR);
     foreach ($custom_files as $custom_file) {
         if ($custom_file != '') {
             $custom_file = w3_normalize_file($custom_file);
             if (!w3_is_multisite()) {
                 $dir = trim(dirname($path . $custom_file), '/\\');
                 $rel_path = trim(dirname($custom_file), '/\\');
             } else {
                 $rel_path = $dir = trim(dirname($custom_file), '/\\');
             }
             if (strpos($dir, '<currentblog>') != false) {
                 $rel_path = $dir = str_replace('<currentblog>', 'blogs.dir/' . w3_get_blog_id(), $dir);
             }
             if ($content_path && $content_path != $wp_content_folder) {
                 $dir = str_replace($wp_content_folder, $content_path, $dir);
                 $rel_path = str_replace($wp_content_folder, $content_path, $rel_path);
             }
             if ($dir == '.') {
                 $rel_path = $dir = '';
             }
             $mask = basename($custom_file);
             $files = array_merge($files, $this->search_files($document_root . '/' . $dir, $rel_path, $mask));
         }
     }
     return $files;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:44,代码来源:Cdn.php


示例11: wpseo_cdn_filter

 /**
  * Hook into WordPress SEO sitemap image filter.
  * @param $uri
  * @return string
  */
 function wpseo_cdn_filter($uri)
 {
     $site_path = w3_get_site_path();
     $domain_url_regexp = w3_get_domain_url_regexp();
     $cdn = $this->_get_common()->get_cdn();
     $parsed = parse_url($uri);
     $path = $parsed['path'];
     $remote_path = $this->_get_common()->uri_to_cdn_uri($path);
     $new_url = $cdn->format_url($remote_path);
     return $new_url;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:16,代码来源:Cdn.php


示例12: w3_translate_file

/**
 * Translates URL to local path
 * @param string $url
 * @return string
 */
function w3_translate_file($url)
{
    if (!w3_is_url($url)) {
        $url = w3_get_domain_url() . '/' . ltrim($url, '/\\');
    }
    $site_url_regexp = '~' . w3_get_site_url_regexp() . '~i';
    if (preg_match($site_url_regexp, $url) && strstr($url, '?') === false) {
        $url = preg_replace($site_url_regexp, '', $url);
        $url = w3_get_site_path() . ltrim($url, '/\\');
    }
    $url = ltrim($url, '/');
    return $url;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:18,代码来源:define.php


示例13: should_create_wp_loader_file

 /**
  * Verify that WordPress install folder is part of WP_CONTENT_DIR path
  * @return bool
  */
 public function should_create_wp_loader_file()
 {
     if (defined('DONOTVERIFY_WP_LOADER') && DONOTVERIFY_WP_LOADER) {
         return false;
     }
     if (w3_get_site_path() != '/' && strpos(WP_PLUGIN_DIR, w3_get_site_path()) === false) {
         return true;
     }
     return false;
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:14,代码来源:FileVerification.php


示例14: generate_rules_core

 /**
  * Generates rules for WP dir
  *
  * @return string
  */
 function generate_rules_core()
 {
     global $w3_reserved_blognames;
     /**
      * 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).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_user_agents = $this->_config->get_array('pgcache.reject.ua');
     $accept_files = $this->_config->get_array('pgcache.accept.files');
     /**
      * WPMU support
      */
     $is_wpmu = w3_is_wpmu();
     $is_vhost = w3_is_vhost();
     /**
      * Generate directives
      */
     $rules = '';
     $rules .= "# BEGIN W3 Total Cache\n";
     $setenvif_rules = '';
     if ($is_wpmu) {
         $setenvif_rules .= "    SetEnvIfNoCase Host ^(www\\.)?([a-z0-9\\-\\.]+\\.[a-z]+)\\.?(:[0-9]+)?\$ DOMAIN=\$2\n";
         if (!$is_vhost) {
             $setenvif_rules .= "    SetEnvIfNoCase Request_URI ^" . w3_get_site_path() . "([a-z0-9\\-]+)/ BLOGNAME=\$1\n";
         }
     }
     $compression = $this->_config->get_string('pgcache.compression');
     if ($compression != '') {
         $compressions = array();
         if (stristr($compression, 'gzip') !== false) {
             $compressions[] = 'gzip';
         }
         if (stristr($compression, 'deflate') !== false) {
             $compressions[] = 'deflate';
         }
         if (count($compressions)) {
             $setenvif_rules .= "    SetEnvIfNoCase Accept-Encoding (" . implode('|', $compressions) . ") APPEND_EXT=.\$1\n";
         }
     }
     if ($setenvif_rules != '') {
         $rules .= "<IfModule mod_setenvif.c>\n" . ($setenvif_rules .= "</IfModule>\n");
     }
     $rules .= "<IfModule mod_rewrite.c>\n";
     $rules .= "    RewriteEngine On\n";
     $mobile_redirect = $this->_config->get_string('pgcache.mobile.redirect');
     if ($mobile_redirect != '') {
         $mobile_agents = $this->_config->get_array('pgcache.mobile.agents');
         $rules .= "    RewriteCond %{HTTP_USER_AGENT} (" . implode('|', array_map('w3_preg_quote', $mobile_agents)) . ") [NC]\n";
         $rules .= "    RewriteRule .* " . $mobile_redirect . " [R,L]\n";
     }
     $rules .= "    RewriteCond %{REQUEST_URI} \\/\$\n";
     $rules .= "    RewriteCond %{REQUEST_URI} !(" . implode('|', $reject_uris) . ")";
     if (count($accept_files)) {
         $rules .= " [OR]\n    RewriteCond %{REQUEST_URI} (" . implode('|', array_map('w3_preg_quote', $accept_files)) . ") [NC]\n";
     } else {
         $rules .= "\n";
     }
     $rules .= "    RewriteCond %{REQUEST_METHOD} !=POST\n";
     $rules .= "    RewriteCond %{QUERY_STRING} =\"\"\n";
     $rules .= "    RewriteCond %{HTTP_COOKIE} !(" . implode('|', array_map('w3_preg_quote', $reject_cookies)) . ") [NC]\n";
     if (count($reject_user_agents)) {
         $rules .= "    RewriteCond %{HTTP_USER_AGENT} !(" . implode('|', array_map('w3_preg_quote', $reject_user_agents)) . ") [NC]\n";
     }
     if ($is_wpmu) {
         if ($is_vhost) {
             $replacement = '/w3tc-%{ENV:DOMAIN}/';
         } else {
             $rules .= "    RewriteCond %{ENV:BLOGNAME} !^(" . implode('|', $w3_reserved_blognames) . ")\$\n";
//.........这里部分代码省略.........
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:101,代码来源:PgCache.php


示例15: link_replace_callback

 /**
  * Link replace callback
  *
  * @param array $matches
  * @return string
  */
 function link_replace_callback($matches)
 {
     global $wpdb;
     static $queue = null, $reject_files = null;
     if (in_array($matches[2], $this->replaced_urls)) {
         return $matches[0];
     }
     if ($queue === null) {
         $sql = sprintf('SELECT remote_path FROM %s', $wpdb->prefix . W3TC_CDN_TABLE_QUEUE);
         $queue = $wpdb->get_col($sql);
     }
     if ($reject_files === null) {
         $reject_files = $this->_config->get_array('cdn.reject.files');
     }
     /**
      * Don't replace links that are in the queue
      */
     if (in_array(ltrim($matches[4], '/'), $queue)) {
         return $matches[0];
     }
     /**
      * Don't replace link for rejected files
      */
     foreach ($reject_files as $reject_file) {
         if ($reject_file != '') {
             $reject_file = w3_normalize_file($reject_file);
             $reject_file_regexp = '~^' . $this->get_regexp_by_mask($reject_file) . '$~i';
             if (preg_match($reject_file_regexp, $matches[4])) {
                 return $matches[0];
             }
         }
     }
     /**
      * Do replacement
      */
     $path = '/' . w3_get_site_path() . $matches[4];
     $cdn =& $this->get_cdn();
     $url = $cdn->format_url($path);
     if (!$url) {
         return $matches[0];
     }
     $this->replaced_urls[] = $matches[2];
     $replacement = sprintf('%s%s', $matches[1], $url);
     return $replacement;
 }
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:51,代码来源:Cdn.php


示例16: flush_post

 /**
  * Flushes post cache
  *
  * @param integer $post_id
  * @return boolean
  */
 function flush_post($post_id = null)
 {
     if (!$post_id) {
         $post_id = $this->_detect_post_id();
     }
     if ($post_id) {
         $uris = array();
         $domain_url = w3_get_domain_url();
         $feeds = $this->_config->get_array('pgcache.purge.feed.types');
         if ($this->_config->get_boolean('pgcache.purge.terms') || $this->_config->get_boolean('pgcache.purge.feed.terms')) {
             $taxonomies = get_post_taxonomies($post_id);
             $terms = nxt_get_post_terms($post_id, $taxonomies);
         }
         switch (true) {
             case $this->_config->get_boolean('pgcache.purge.author'):
             case $this->_config->get_boolean('pgcache.purge.archive.daily'):
             case $this->_config->get_boolean('pgcache.purge.archive.monthly'):
             case $this->_config->get_boolean('pgcache.purge.archive.yearly'):
             case $this->_config->get_boolean('pgcache.purge.feed.author'):
                 $post = get_post($post_id);
         }
         /**
          * Home URL
          */
         if ($this->_config->get_boolean('pgcache.purge.home')) {
             $home_path = w3_get_home_path();
             $site_path = w3_get_site_path();
             $uris[] = $home_path;
             if ($site_path != $home_path) {
                 $uris[] = $site_path;
             }
         }
         /**
          * Post URL
          */
         if ($this->_config->get_boolean('pgcache.purge.post')) {
             $post_link = post_permalink($post_id);
             $post_uri = str_replace($domain_url, '', $post_link);
             $uris[] = $post_uri;
         }
         /**
          * Post comments URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.comments') && function_exists('get_comments_pagenum_link')) {
             $comments_number = get_comments_number($post_id);
             $comments_per_page = get_option('comments_per_page');
             $comments_pages_number = @ceil($comments_number / $comments_per_page);
             for ($pagenum = 1; $pagenum <= $comments_pages_number; $pagenum++) {
                 $comments_pagenum_link = $this->_get_comments_pagenum_link($post_id, $pagenum);
                 $comments_pagenum_uri = str_replace($domain_url, '', $comments_pagenum_link);
                 $uris[] = $comments_pagenum_uri;
             }
         }
         /**
          * Post author URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.author') && $post) {
             $posts_number = count_user_posts($post->post_author);
             $posts_per_page = get_option('posts_per_page');
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $author_link = get_author_link(false, $post->post_author);
             $author_uri = str_replace($domain_url, '', $author_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $author_pagenum_link = $this->_get_pagenum_link($author_uri, $pagenum);
                 $author_pagenum_uri = str_replace($domain_url, '', $author_pagenum_link);
                 $uris[] = $author_pagenum_uri;
             }
         }
         /**
          * Post terms URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.terms')) {
             $posts_per_page = get_option('posts_per_page');
             foreach ($terms as $term) {
                 $term_link = get_term_link($term, $term->taxonomy);
                 $term_uri = str_replace($domain_url, '', $term_link);
                 $posts_pages_number = @ceil($term->count / $posts_per_page);
                 for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                     $term_pagenum_link = $this->_get_pagenum_link($term_uri, $pagenum);
                     $term_pagenum_uri = str_replace($domain_url, '', $term_pagenum_link);
                     $uris[] = $term_pagenum_uri;
                 }
             }
         }
         /**
          * Daily archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.daily') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $post_month = gmdate('m', $post_date);
             $post_day = gmdate('d', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year, $post_month, $post_day);
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass,代码行数:101,代码来源:PgCacheFlush.php


示例17: _rewriteRelative

 /**
  * Rewrite a file relative URI as root relative
  *
  * <code>
  * Minify_CSS_UriRewriter::rewriteRelative(
  *       '../img/hello.gif'
  *     , '/home/user/www/css'  // path of CSS file
  *     , '/home/user/www'      // doc root
  * );
  * // returns '/img/hello.gif'
  *
  * // example where static files are stored in a symlinked directory
  * Minify_CSS_UriRewriter::rewriteRelative(
  *       'hello.gif'
  *     , '/var/staticFiles/theme'
  *     , '/home/user/www'
  *     , array('/home/user/www/static' => '/var/staticFiles')
  * );
  * // returns '/static/theme/hello.gif'
  * </code>
  *
  * @param string $uri file relative URI
  *
  * @param string $realCurrentDir realpath of the current file's directory.
  *
  * @param string $realDocRoot realpath of the site document root.
  *
  * @param array $symlinks (default = array()) If the file is stored in
  * a symlink-ed directory, provide an array of link paths to
  * real target paths, where the link paths "appear" to be within the document
  * root. E.g.:
  * <code>
  * array('/home/foo/www/not/real/path' => '/real/target/path') // unix
  * array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path')  // Windows
  * </code>
  *
  * @return string
  */
 private static function _rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array())
 {
     if ('/' === $uri[0]) {
         // root-relative
         return $uri;
     }
     // prepend path with current dir separator (OS-independent)
     $path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR);
     self::$debugText .= "file-relative URI  : {$uri}\n" . "path prepended     : {$path}\n";
     // "unresolve" a symlink back to doc root
     foreach ($symlinks as $link => $target) {
         if (0 === strpos($path, $target)) {
             // replace $target with $link
             $path = $link . substr($path, strlen($target));
             self::$debugText .= "symlink unresolved : {$path}\n";
             break;
         }
     }
     // strip doc root
     $path = substr($path, strlen($realDocRoot));
     self::$debugText .= "docroot stripped   : {$path}\n";
     // fix to root-relative URI
     $uri = strtr($path, '/\\', '//');
     // remove /./ and /../ where possible
     $uri = str_replace('/./', '/', $uri);
     // inspired by patch from Oleg Cherniy
     do {
         $uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed);
     } while ($changed);
     self::$debugText .= "traversals removed : {$uri}\n\n";
     $uri = preg_replace('~^' . w3_preg_quote(w3_get_base_path()) . '~', w3_get_site_path(), $uri);
     return $uri;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:71,代码来源:UriRewriter.php


示例18: get_files_minify

 /**
  * Exports min files to CDN
  *
  * @return array
  */
 function get_files_minify()
 {
     $files = array();
     if (W3TC_PHP5 && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')))) {
         require_once W3TC_INC_DIR . '/functions/http.php';
         $minify =& w3_instance('W3_Plugin_Minify');
         $document_root = w3_get_document_root();
         $site_root = w3_get_site_root();
         $minify_root = w3_path(W3TC_CACHE_FILE_MINIFY_DIR);
         $minify_path = ltrim(str_replace($site_root, rtrim(w3_get_site_path(), '/'), $minify_root), '/');
         $urls = $minify->get_urls();
         if ($this->_config->get_string('minify.engine') == 'file') {
             foreach ($urls as $url) {
                 w3_http_get($url);
             }
             $files = $this->search_files($minify_root, $minify_path, '*.css;*.js');
         } else {
             foreach ($urls as $url) {
                 $file = w3_normalize_file_minify($url);
                 $file = w3_translate_file($file);
                 if (!w3_is_url($file)) {
                     $file = $document_root . '/' . $file;
                     $file = ltrim(str_replace($minify_root, '', $file), '/');
                     $dir = dirname($file);
                     if ($dir) {
                         w3_mkdir($dir, 0777, $minify_root);
                     }
                     if (w3_download($url, $minify_root . '/' . $file) !== false) {
                         $files[] = $minify_path . '/' . $file;
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:41,代码来源:Cdn.php


示例19: 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


示例20: _replace_folder_placeholders

 private function _replace_folder_placeholders($file)
 {
     static $content_dir, $plugin_dir, $upload_dir;
     if (empty($content_dir)) {
         $content_dir = str_replace(w3_get_document_root(), '', WP_CONTENT_DIR);
         $content_dir = substr($content_dir, strlen(w3_get_site_path()));
         $content_dir = trim($content_dir, '/');
         if (defined('WP_PLUGIN_DIR')) {
             $plugin_dir = str_replace(w3_get_document_root(), '', WP_PLUGIN_DIR);
             $plugin_dir = trim($plugin_dir, '/');
         } else {
             $plugin_dir = str_replace(w3_get_document_root(), '', WP_CONTENT_DIR . '/plugins');
             $plugin_dir = trim($plugin_dir, '/');
         }
         $upload_dir = wp_upload_dir();
         $upload_dir = str_replace(w3_get_document_root(), '', $upload_dir['basedir']);
         $upload_dir = trim($upload_dir, '/');
     }
     $file = str_replace('{wp_content_dir}', $content_dir, $file);
     $file = str_replace('{plugins_dir}', $plugin_dir, $file);
     $file = str_replace('{uploads_dir}', $upload_dir, $file);
     return $file;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:23,代码来源:Cdn.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP w3_get_site_root函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_get_pgcache_rules_core_path函数代码示例发布时间: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