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


PHP w3_path函数代码示例

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


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

示例1: w3_realpath

/**
 * Returns real path of given path
 *
 * @param string $path
 * @return string
 */
function w3_realpath($path)
{
    $path = w3_path($path);
    $parts = explode('/', $path);
    $absolutes = array();
    foreach ($parts as $part) {
        if ('.' == $part) {
            continue;
        }
        if ('..' == $part) {
            array_pop($absolutes);
        } else {
            $absolutes[] = $part;
        }
    }
    return implode('/', $absolutes);
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:23,代码来源:define.php

示例2: _minify_path_replacements

 /**
  * Paths used to minify minifyfile paths
  * @return array
  */
 private function _minify_path_replacements()
 {
     $theme = get_theme_root();
     return array(ltrim(str_replace(w3_get_document_root(), '', w3_path($theme)), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WP_PLUGIN_DIR)), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WPMU_PLUGIN_DIR)), '/'), WPINC . '/js/jquery', WPINC . '/js', WPINC . '/css', WPINC);
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:9,代码来源:Minify.php

示例3: import_library


//.........这里部分代码省略.........
                                     $check_src = substr($check_src, 0, $qpos);
                                 }
                             }
                             if (preg_match($regexp, $check_src)) {
                                 /**
                                  * Check for already uploaded attachment
                                  */
                                 if (isset($attachments[$src])) {
                                     list($dst, $dst_url) = $attachments[$src];
                                     $result = true;
                                 } else {
                                     if ($uploads_use_yearmonth_folders) {
                                         $upload_subdir = date('Y/m', strtotime($post->post_date));
                                         $upload_dir = sprintf('%s/%s', $upload_info['basedir'], $upload_subdir);
                                         $upload_url = sprintf('%s/%s', $upload_info['baseurl'], $upload_subdir);
                                     } else {
                                         $upload_subdir = '';
                                         $upload_dir = $upload_info['basedir'];
                                         $upload_url = $upload_info['baseurl'];
                                     }
                                     $src_filename = pathinfo($src, PATHINFO_FILENAME);
                                     $src_extension = pathinfo($src, PATHINFO_EXTENSION);
                                     /**
                                      * Get available filename
                                      */
                                     for ($i = 0;; $i++) {
                                         $dst = sprintf('%s/%s%s%s', $upload_dir, $src_filename, $i ? $i : '', $src_extension ? '.' . $src_extension : '');
                                         if (!file_exists($dst)) {
                                             break;
                                         }
                                     }
                                     $dst_basename = basename($dst);
                                     $dst_url = sprintf('%s/%s', $upload_url, $dst_basename);
                                     $dst_path = ltrim(str_replace($document_root, '', w3_path($dst)), '/');
                                     if ($upload_subdir) {
                                         w3_mkdir($upload_subdir, 0777, $upload_info['basedir']);
                                     }
                                     $download_result = false;
                                     /**
                                      * Check if file is remote URL
                                      */
                                     if (w3_is_url($src)) {
                                         /**
                                          * Download file
                                          */
                                         if ($import_external) {
                                             $download_result = w3_download($src, $dst);
                                             if (!$download_result) {
                                                 $error = 'Unable to download file';
                                             }
                                         } else {
                                             $error = 'External file import is disabled';
                                         }
                                     } else {
                                         /**
                                          * Otherwise copy file from local path
                                          */
                                         $src_path = $document_root . '/' . urldecode($src);
                                         if (file_exists($src_path)) {
                                             $download_result = @copy($src_path, $dst);
                                             if (!$download_result) {
                                                 $error = 'Unable to copy file';
                                             }
                                         } else {
                                             $error = 'Source file doesn\'t exists';
                                         }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:67,代码来源:CdnAdmin.php

示例4: rules_cache_generate_nginx

 /**
  * Generates directives for file cache dir
  *
  * @param W3_Config $config
  * @return string
  */
 private function rules_cache_generate_nginx($config)
 {
     $cache_root = w3_path(W3TC_CACHE_PAGE_ENHANCED_DIR);
     $cache_dir = rtrim(str_replace(w3_get_document_root(), '', $cache_root), '/');
     if (w3_is_network()) {
         $cache_dir = preg_replace('~/w3tc.*?/~', '/w3tc.*?/', $cache_dir, 1);
     }
     $browsercache = $config->get_boolean('browsercache.enabled');
     $compression = $browsercache && $config->get_boolean('browsercache.html.compression');
     $expires = $browsercache && $config->get_boolean('browsercache.html.expires');
     $lifetime = $browsercache ? $config->get_integer('browsercache.html.lifetime') : 0;
     $cache_control = $browsercache && $config->get_boolean('browsercache.html.cache.control');
     $w3tc = $browsercache && $config->get_integer('browsercache.html.w3tc');
     $common_rules = '';
     if ($expires) {
         $common_rules .= "    expires modified " . $lifetime . "s;\n";
     }
     if ($w3tc) {
         $common_rules .= "    add_header X-Powered-By \"" . W3TC_POWERED_BY . "\";\n";
     }
     if ($compression) {
         $common_rules .= "    add_header Vary \"Accept-Encoding, Cookie\";\n";
     } else {
         $common_rules .= "    add_header Vary Cookie;\n";
     }
     if ($cache_control) {
         $cache_policy = $config->get_string('browsercache.html.cache.policy');
         switch ($cache_policy) {
             case 'cache':
                 $common_rules .= "    add_header Pragma \"public\";\n";
                 $common_rules .= "    add_header Cache-Control \"public\";\n";
                 break;
             case 'cache_public_maxage':
                 $common_rules .= "    add_header Pragma \"public\";\n";
                 $common_rules .= "    add_header Cache-Control \"max-age=" . $lifetime . ", public\";\n";
                 break;
             case 'cache_validation':
                 $common_rules .= "    add_header Pragma \"public\";\n";
                 $common_rules .= "    add_header Cache-Control \"public, must-revalidate, proxy-revalidate\";\n";
                 break;
             case 'cache_noproxy':
                 $common_rules .= "    add_header Pragma \"public\";\n";
                 $common_rules .= "    add_header Cache-Control \"private, must-revalidate\";\n";
                 break;
             case 'cache_maxage':
                 $common_rules .= "    add_header Pragma \"public\";\n";
                 $common_rules .= "    add_header Cache-Control \"max-age=" . $lifetime . ", public, must-revalidate, proxy-revalidate\";\n";
                 break;
             case 'no_cache':
                 $common_rules .= "    add_header Pragma \"no-cache\";\n";
                 $common_rules .= "    add_header Cache-Control \"max-age=0, private, no-store, no-cache, must-revalidate\";\n";
                 break;
         }
     }
     $rules = '';
     $rules .= W3TC_MARKER_BEGIN_PGCACHE_CACHE . "\n";
     $rules .= "location ~ " . $cache_dir . ".*html\$ {\n";
     $rules .= $common_rules;
     $rules .= "}\n";
     if ($compression) {
         $rules .= "location ~ " . $cache_dir . ".*gzip\$ {\n";
         $rules .= "    gzip off;\n";
         $rules .= "    types {}\n";
         $rules .= "    default_type text/html;\n";
         $rules .= $common_rules;
         $rules .= "    add_header Content-Encoding gzip;\n";
         $rules .= "}\n";
     }
     $rules .= W3TC_MARKER_END_PGCACHE_CACHE . "\n";
     return $rules;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:77,代码来源:PgCacheAdminEnvironment.php

示例5: w3_normalize_file_minify

 function w3_normalize_file_minify($file)
 {
     global $wp_rewrite;
     $hmwp = new HideMyWP();
     $hmwp->init();
     $hmwp->add_rewrite_rules($wp_rewrite);
     $file = $hmwp->reverse_partial_filter($file);
     if (w3_is_url($file)) {
         if (strstr($file, '?') === false) {
             $domain_url_regexp = '~' . w3_get_domain_url_regexp() . '~i';
             $file = preg_replace($domain_url_regexp, '', $file);
         }
     }
     if (!w3_is_url($file)) {
         $file = w3_path($file);
         $file = str_replace(w3_get_document_root(), '', $file);
         $file = ltrim($file, '/');
     }
     return $file;
 }
开发者ID:roycocup,项目名称:enclothed,代码行数:20,代码来源:hide-my-wp.php

示例6: w3_path

            ?>

            <?php 
        }
        ?>

        </li>
        <?php 
    }
}
?>


        <li>
            <?php 
echo w3_path(WP_CONTENT_DIR);
?>
:
            <?php 
if (w3_is_writable_dir(WP_CONTENT_DIR)) {
    ?>

            <code>OK</code>
            <?php 
} else {
    ?>

            <code>Not write-able</code>
            <?php 
}
?>
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:31,代码来源:self_test.php

示例7: _minify_path_replacements

 /**
  * Paths used to minify minifyfile paths
  * @return array
  */
 private function _minify_path_replacements()
 {
     if (w3_is_network()) {
         $theme = get_theme_root();
     } else {
         $theme = get_stylesheet_directory();
     }
     return array(ltrim(str_replace(w3_get_document_root(), '', w3_path($theme)), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WP_PLUGIN_DIR)), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WPMU_PLUGIN_DIR)), '/'), WPINC . '/js/jquery', WPINC . '/js', WPINC . '/css', WPINC);
 }
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:13,代码来源:Minify.php

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

示例9: get_files_theme

 /**
  * Exports theme to CDN
  *
  * @return array
  */
 function get_files_theme()
 {
     /**
      * If mobile or referrer support enabled
      * we should upload whole themes directory
      */
     if ($this->_config->get_boolean('mobile.enabled') || $this->_config->get_boolean('referrer.enabled')) {
         $themes_root = get_theme_root();
     } else {
         $themes_root = get_stylesheet_directory();
     }
     $themes_root = w3_path($themes_root);
     $site_root = w3_get_document_root();
     $themes_path = ltrim(str_replace($site_root, '', $themes_root), '/');
     $files = $this->search_files($themes_root, $themes_path, $this->_config->get_string('cdn.theme.files'));
     return $files;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:22,代码来源:Cdn.php

示例10: w3_normalize_file

/**
 * Converts file path to relative 
 * 
 * @param string $file
 * @return string
 */
function w3_normalize_file($file)
{
    if (w3_is_url($file)) {
        if (strstr($file, '?') === false) {
            $domain_url_regexp = '~' . w3_get_domain_url_regexp() . '~i';
            $file = preg_replace($domain_url_regexp, '', $file);
        }
    } else {
        $abspath = w3_path(ABSPATH);
        $file = w3_path($file);
        $file = str_replace($abspath, '', $file);
    }
    $file = ltrim($file, '/');
    return $file;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:21,代码来源:define.php

示例11: w3_path

                <code>Not write-able</code>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
        </li>
        <?php 
    }
}
?>

        <li>
            <?php 
echo w3_path(nxt_CONTENT_DIR);
?>
:
            <?php 
if (w3_is_writable_dir(nxt_CONTENT_DIR)) {
    ?>
            <code>OK</code>
            <?php 
} else {
    ?>
            <code>Not write-able</code>
            <?php 
}
?>
        </li>
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:30,代码来源:self_test.php

示例12: generate_rules_core


//.........这里部分代码省略.........
      */
     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";
             $rules .= "    RewriteCond %{ENV:BLOGNAME} !-f\n";
             $rules .= "    RewriteCond %{ENV:BLOGNAME} !-d\n";
             $replacement = '/w3tc-%{ENV:BLOGNAME}.%{ENV:DOMAIN}/';
         }
         $cache_dir = preg_replace('~/w3tc.*/~U', $replacement, W3TC_CACHE_FILE_PGCACHE_DIR, 1);
     } else {
         $cache_dir = W3TC_CACHE_FILE_PGCACHE_DIR;
     }
     $rules .= "    RewriteCond " . w3_path($cache_dir) . "/\$1/_default_.html%{ENV:APPEND_EXT} -f\n";
     $rules .= "    RewriteRule (.*) " . str_replace(ABSPATH, '', $cache_dir) . "/\$1/_default_.html%{ENV:APPEND_EXT} [L]\n";
     $rules .= "</IfModule>\n";
     $rules .= "# END W3 Total Cache\n\n";
     if (!$this->check_rules_wp()) {
         $rules .= "# BEGIN WordPress\n";
         $rules .= "<IfModule mod_rewrite.c>\n";
         $rules .= "    RewriteEngine On\n";
         $rules .= "    RewriteCond %{REQUEST_FILENAME} !-f\n";
         $rules .= "    RewriteCond %{REQUEST_FILENAME} !-d\n";
         $rules .= "    RewriteRule .* index.php [L]\n";
         $rules .= "</IfModule>\n";
         $rules .= "# END WordPress\n\n";
     }
     return $rules;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:101,代码来源:PgCache.php

示例13: _minify_path_replacements

 /**
  * Paths used to minify minifyfile paths
  * @return array
  */
 private function _minify_path_replacements()
 {
     return array(ltrim(str_replace(w3_get_document_root(), '', w3_path(get_stylesheet_directory())), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WP_PLUGIN_DIR)), '/'), ltrim(str_replace(w3_get_document_root(), '', w3_path(WPMU_PLUGIN_DIR)), '/'), WPINC . '/js/jquery', WPINC . '/js', WPINC . '/css', WPINC);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:8,代码来源:Minify.php


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