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

PHP w3_get_site_root函数代码示例

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

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



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

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


示例2: w3_normalize_file

/**
 * Normalizes file name
 *
 * Relative to site root!
 *
 * @param string $file
 * @return string
 */
function w3_normalize_file($file)
{
    if (w3_is_url($file)) {
        if (strstr($file, '?') === false) {
            $home_url_regexp = '~' . w3_get_home_url_regexp() . '~i';
            $file = preg_replace($home_url_regexp, '', $file);
        }
    }
    if (!w3_is_url($file)) {
        $file = w3_path($file);
        $file = str_replace(w3_get_site_root(), '', $file);
        $file = ltrim($file, '/');
    }
    return $file;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:23,代码来源:define.php


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


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


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


示例6: w3_disable_maintenance_mode

/**
 * Deletes maintenance mode file
 */
function w3_disable_maintenance_mode()
{
    w3_wp_delete_file(w3_get_site_root() . '/.maintenance');
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:7,代码来源:activation.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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