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


PHP w3_get_site_path函数代码示例

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


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


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