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

PHP w3_cache_blog_dir函数代码示例

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

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



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

示例1: __construct

 /**
  * Constructor
  *
  * @param array $config
  */
 function __construct($config = array())
 {
     parent::__construct($config);
     if (isset($config['cache_dir'])) {
         $this->_cache_dir = trim($config['cache_dir']);
     } else {
         $this->_cache_dir = w3_cache_blog_dir($config['section'], $config['blog_id']);
     }
     $this->_exclude = isset($config['exclude']) ? (array) $config['exclude'] : array();
     $this->_flush_timelimit = isset($config['flush_timelimit']) ? (int) $config['flush_timelimit'] : 180;
     $this->_locking = isset($config['locking']) ? (bool) $config['locking'] : false;
     if (isset($config['flush_dir'])) {
         $this->_flush_dir = $config['flush_dir'];
     } else {
         if ($config['blog_id'] <= 0) {
             // clear whole section if we operate on master cache
             $this->_flush_dir = w3_cache_dir($config['section']);
         } else {
             $this->_flush_dir = $this->_cache_dir;
         }
     }
     if (isset($config['use_wp_hash']) && $config['use_wp_hash'] && function_exists('wp_hash')) {
         $this->_use_wp_hash = true;
     }
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:30,代码来源:File.php


示例2: cleanup

 function cleanup()
 {
     $engine = $this->_config->get_string('fragmentcache.engine');
     switch ($engine) {
         case 'file':
             w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner.php');
             $w3_cache_file_cleaner = new W3_Cache_File_Cleaner(array('cache_dir' => w3_cache_blog_dir('fragment'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner->clean();
             break;
     }
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:11,代码来源:FragmentCacheAdmin.php


示例3: on_cdn_file_upload

 /**
  * Called on successful file upload to CDN
  * 
  * @param $file_name
  */
 function on_cdn_file_upload($file_name)
 {
     if ($this->_minify_enabled) {
         $minify_document_root = w3_cache_blog_dir('minify') . '/';
         if (!substr($file_name, 0, strlen($minify_document_root)) == $minify_document_root) {
             // unexpected file name
             return;
         }
         $short_file_name = substr($file_name, strlen($minify_document_root));
         $this->_get_minify()->set_file_custom_data($short_file_name, array('cdn.status' => 'uploaded'));
     }
 }
开发者ID:Supreme007,项目名称:bestilblomster,代码行数:17,代码来源:Dispatcher.php


示例4: print_script

    function print_script()
    {
        ?>
        <script type="text/javascript">
            function w3tc_start_minify_try_solve() {
                var testUrl = '<?php 
        echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/');
        ?>
';
                w3tc_filename_auto_solve(testUrl);
            }
        </script>
        <?php 
    }
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:14,代码来源:MinifyAdmin.php


示例5: w3tc_file_log

/**
 * Write log entry
 *
 * @param string message
 * @param string $file
 * @return bool|int
 */
function w3tc_file_log($message, $file)
{
    if (defined('W3_SUPPORT_DEBUG') && W3_SUPPORT_DEBUG) {
        w3_require_once(W3TC_INC_DIR . '/functions/file.php');
        $data = sprintf("[%s] %s %s\n", date('r'), $message, $file);
        if (get_site_option('w3tc_support_request')) {
            $blog_id = 0;
        } else {
            $blog_id = null;
        }
        $filename = w3_cache_blog_dir('log', $blog_id) . '/file-sender.log';
        if (!is_dir(dirname($filename))) {
            w3_mkdir_from(dirname($filename), W3TC_CACHE_DIR);
        }
        @file_put_contents($filename, $data, FILE_APPEND);
    }
}
开发者ID:jcastilloa,项目名称:w3tc-transparentcdn,代码行数:24,代码来源:files.php


示例6: cleanup_local

 function cleanup_local()
 {
     $engine = $this->_config->get_string('pgcache.engine');
     switch ($engine) {
         case 'file':
             w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner.php');
             $w3_cache_file_cleaner = new W3_Cache_File_Cleaner(array('cache_dir' => w3_cache_blog_dir('page'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner->clean();
             break;
         case 'file_generic':
             w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner/Generic.php');
             if (w3_get_blog_id() == 0) {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
             } else {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
             }
             $w3_cache_file_cleaner_generic = new W3_Cache_File_Cleaner_Generic(array('exclude' => array('.htaccess'), 'cache_dir' => $flush_dir, 'expire' => $this->_config->get_integer('browsercache.html.lifetime'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner_generic->clean();
             break;
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:21,代码来源:PgCacheAdmin.php


示例7: get_minify_urls_for_files

 /**
  * Formats custom URL
  *
  * @param array $files
  * @param string $type
  * @return array
  */
 function get_minify_urls_for_files($files, $type)
 {
     $w3_minify = w3_instance('W3_Minify');
     $url = array();
     $minify_filenames = $w3_minify->compress_minify_files($files, $type);
     foreach ($minify_filenames as $minify_filename) {
         $filename = w3_cache_blog_dir('minify') . '/' . $minify_filename;
         if ($this->_config->get_boolean('minify.rewrite')) {
             $url[] = w3_filename_to_url($filename);
         } else {
             $url[] = plugins_url('pub/minify.php?file=' . $minify_filename, W3TC_FILE);
         }
     }
     return $url;
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:22,代码来源:Minify.php


示例8: compress_minify_files

 /**
  * Compresses an array of files into a filename containing all files.
  * If filename length exceeds 246 characters or value defined in minify.auto.filename_length when gzcompress/gzdeflate is available
  * multiple compressed filenames will be returned
  * @param $files
  * @param $type
  * @return array
  */
 function compress_minify_files($files, $type)
 {
     $optimized = array();
     foreach ($files as $file) {
         // from PHP.net
         $pattern = '/\\w+\\/\\.\\.\\//';
         while (preg_match($pattern, $file)) {
             $file = preg_replace($pattern, '', $file);
         }
         if (!w3_is_url($file)) {
             $optimized[] = dirname($file) . '/' . basename($file, '.' . $type);
         } else {
             $optimized[] = $file;
         }
     }
     $input = array();
     $replace = $this->_minify_path_replacements();
     $replaced = false;
     foreach ($optimized as $file) {
         foreach ($replace as $key => $path) {
             if (strpos($file, $path) === 0) {
                 $input[] = str_replace($path, $key, $file);
                 $replaced = true;
                 break;
             }
         }
         if ($replaced) {
             $replaced = false;
         } else {
             $input[] = $file;
         }
     }
     $minify_filename = array();
     $imploded = implode(',', $input);
     $config = w3_instance('W3_Config');
     if (!W3TC_WIN) {
         $fn_length = $config->get_integer('minify.auto.filename_length', 246);
         $fn_length = $fn_length > 246 ? 246 : $fn_length;
     } else {
         $dir = w3_cache_blog_dir('minify');
         $fn_length = 246 - strlen($dir);
     }
     $compressed = $this->_compress($imploded);
     if (strlen($compressed) >= $fn_length) {
         $arr_chunks = $this->_combine_and_check_filenames($input, $fn_length);
         foreach ($arr_chunks as $part) {
             $part_imploded = implode(',', $part);
             $base = rtrim(strtr(base64_encode($this->_compress($part_imploded)), '+/', '-_'), '=');
             $minify_filename[] = $base . '.' . $type;
         }
     } else {
         $base = rtrim(strtr(base64_encode($compressed), '+/', '-_'), '=');
         $minify_filename[] = $base . '.' . $type;
     }
     return $minify_filename;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:64,代码来源:Minify.php


示例9: cleanup

 /**
  * Does disk cache cleanup
  *
  * @return void
  */
 function cleanup()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner.php');
     $w3_cache_file_cleaner = new W3_Cache_File_Cleaner(array('cache_dir' => w3_cache_blog_dir('object'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
     $w3_cache_file_cleaner->clean();
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:11,代码来源:ObjectCache.php


示例10: cleanup

 /**
  * Does disk cache cleanup
  *
  * @return void
  */
 function cleanup()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner/Generic.php');
     $w3_cache_file_cleaner_generic = new W3_Cache_File_Cleaner_Generic(array('exclude' => array('*.files', '.htaccess', 'index.php'), 'cache_dir' => w3_cache_blog_dir('minify'), 'expire' => $this->_config->get_integer('minify.file.gc'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
     $w3_cache_file_cleaner_generic->clean();
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:11,代码来源:MinifyAdmin.php


示例11: action_support_request

 /**
  * Send support request action
  *
  * @return void
  */
 function action_support_request()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $request_type = W3_Request::get_string('request_type');
     $payment = W3_Request::get_boolean('payment');
     $request_id = W3_Request::get_string('request_id');
     $url = W3_Request::get_string('url');
     $name = W3_Request::get_string('name');
     $email = W3_Request::get_string('email');
     $twitter = W3_Request::get_string('twitter');
     $phone = W3_Request::get_string('phone');
     $subject = W3_Request::get_string('subject');
     $description = W3_Request::get_string('description');
     $templates = W3_Request::get_array('templates');
     $forum_url = W3_Request::get_string('forum_url');
     $wp_login = W3_Request::get_string('wp_login');
     $wp_password = W3_Request::get_string('wp_password');
     $ftp_host = W3_Request::get_string('ftp_host');
     $ftp_login = W3_Request::get_string('ftp_login');
     $ftp_password = W3_Request::get_string('ftp_password');
     $subscribe_releases = W3_Request::get_string('subscribe_releases');
     $subscribe_customer = W3_Request::get_string('subscribe_customer');
     $params = array('request_type' => $request_type, 'payment' => $payment, 'url' => $url, 'name' => $name, 'email' => $email, 'twitter' => $twitter, 'phone' => $phone, 'subject' => $subject, 'description' => $description, 'forum_url' => $forum_url, 'wp_login' => $wp_login, 'wp_password' => $wp_password, 'ftp_host' => $ftp_host, 'ftp_login' => $ftp_login, 'ftp_password' => $ftp_password, 'subscribe_releases' => $subscribe_releases, 'subscribe_customer' => $subscribe_customer);
     $post = $params;
     foreach ($templates as $template_index => $template) {
         $template_key = sprintf('templates[%d]', $template_index);
         $params[$template_key] = $template;
     }
     if (!isset($this->_request_types[$request_type])) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_type')), false);
     }
     $required = array('bug_report' => 'url,name,email,subject,description', 'new_feature' => 'url,name,email,subject,description', 'email_support' => 'url,name,email,subject,description', 'phone_support' => 'url,name,email,subject,description,phone', 'plugin_config' => 'url,name,email,subject,description,wp_login,wp_password', 'theme_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password', 'linux_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password');
     if (strstr($required[$request_type], 'url') !== false && $url == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_url')), false);
     }
     if (strstr($required[$request_type], 'name') !== false && $name == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_name')), false);
     }
     if (strstr($required[$request_type], 'email') !== false && !preg_match('~^[a-z0-9_\\-\\.]+@[a-z0-9-\\.]+\\.[a-z]{2,5}$~', $email)) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_email')), false);
     }
     if (strstr($required[$request_type], 'phone') !== false && !preg_match('~^[0-9\\-\\.\\ \\(\\)\\+]+$~', $phone)) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_phone')), false);
     }
     if (strstr($required[$request_type], 'subject') !== false && $subject == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_subject')), false);
     }
     if (strstr($required[$request_type], 'description') !== false && $description == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_description')), false);
     }
     if (strstr($required[$request_type], 'wp_login') !== false && $wp_login == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_login')), false);
     }
     if (strstr($required[$request_type], 'wp_password') !== false && $wp_password == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_password')), false);
     }
     if (strstr($required[$request_type], 'ftp_host') !== false && $ftp_host == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_host')), false);
     }
     if (strstr($required[$request_type], 'ftp_login') !== false && $ftp_login == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_login')), false);
     }
     if (strstr($required[$request_type], 'ftp_password') !== false && $ftp_password == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_password')), false);
     }
     /**
      * Add attachments
      */
     $attachments = array();
     $attach_files = array(w3_get_wp_config_path(), w3_cache_blog_dir('log') . '/minify.log', w3_get_pgcache_rules_core_path(), w3_get_pgcache_rules_cache_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404wp_path(), w3_get_minify_rules_core_path(), w3_get_minify_rules_cache_path());
     /**
      * Attach config files
      */
     if ($handle = opendir(W3TC_CONFIG_DIR)) {
         while (($entry = @readdir($handle)) !== false) {
             if ($entry == '.' || $entry == '..' || $entry == 'index.html') {
                 continue;
             }
             $attachments[] = W3TC_CONFIG_DIR . '/' . $entry;
         }
         closedir($handle);
     }
     foreach ($attach_files as $attach_file) {
         if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) {
             $attachments[] = $attach_file;
         }
     }
     /**
      * Attach server info
      */
     $server_info = print_r($this->get_server_info(), true);
     $server_info = str_replace("\n", "\r\n", $server_info);
     $server_info_path = W3TC_CACHE_TMP_DIR . '/server_info.txt';
     if (@file_put_contents($server_info_path, $server_info)) {
         $attachments[] = $server_info_path;
//.........这里部分代码省略.........
开发者ID:easinewe,项目名称:Avec2016,代码行数:101,代码来源:SupportActionsAdmin.php


示例12: verify_rewrite_working

 private function verify_rewrite_working()
 {
     $url = w3_filename_to_url(w3_cache_blog_dir('minify') . '/w3tc_rewrite_test');
     if (!$this->test_rewrite($url)) {
         $key = sprintf('w3tc_rewrite_test_result_%s', substr(md5($url), 0, 16));
         $result = get_transient($key);
         $home_url = w3_get_home_url();
         $tech_message = (w3_is_nginx() ? 'nginx configuration file' : '.htaccess file') . ' contains rules to rewrite url ' . $url . '. If handled by ' . 'plugin, it returns "OK" message.<br/>';
         $tech_message .= 'The plugin made a request to ' . $url . ' but received: <br />' . $result . '<br />';
         $tech_message .= 'instead of "OK" response. <br />';
         $error = '<strong>W3 Total Cache error:</strong>It appears Minify ' . '<acronym title="Uniform Resource Locator">URL</acronym> ' . 'rewriting is not working. ';
         if (w3_is_nginx()) {
             $error .= 'Please verify that all configuration files are ' . 'included in the configuration file ' . '(and that you have reloaded / restarted nginx).';
         } else {
             $error .= 'Please verify that the server configuration ' . 'allows .htaccess';
         }
         $error .= '<br />Unfortunately minification will ' . 'not function without custom rewrite rules. ' . 'Please ask your server administrator for assistance. ' . 'Also refer to <a href="' . admin_url('admin.php?page=w3tc_install') . '">the install page</a>  for the rules for your server.';
         throw new SelfTestFailedException($error, $tech_message);
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:20,代码来源:MinifyAdminEnvironment.php


示例13: print_script

    function print_script()
    {
        ?>

        <script type="text/javascript">
            var w3_use_network_link = <?php 
        echo w3_force_master() ? 'true' : 'false';
        ?>
;
            function w3tc_start_minify_try_solve() {
                var testUrl = '<?php 
        echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/');
        ?>
';
                w3tc_filename_auto_solve(testUrl);
            }
        </script>
        <?php 
    }
开发者ID:rongandat,项目名称:sallumeh,代码行数:19,代码来源:MinifyAdmin.php


示例14: 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')))) {
         w3_require_once(W3TC_INC_DIR . '/functions/http.php');
         $minify = w3_instance('W3_Plugin_Minify');
         $document_root = w3_get_document_root();
         $minify_root = w3_cache_blog_dir('minify');
         $minify_path = ltrim(str_replace($document_root, '', $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:marqui678,项目名称:finalchance.Panopta,代码行数:40,代码来源:Cdn.php


示例15: print_script

    function print_script()
    {
        ?>
        <script type="text/javascript">
            var w3_use_network_link = <?php 
        echo is_network_admin() || w3_is_multisite() && w3_force_master() ? 'true' : 'false';
        ?>
;
            function w3tc_start_minify_try_solve() {
                var testUrl = '<?php 
        echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/', w3_get_domain(w3_get_home_url()) != w3_get_domain(w3_get_site_url()));
        ?>
';
                w3tc_filename_auto_solve(testUrl);
            }
        </script>
        <?php 
    }
开发者ID:easinewe,项目名称:Avec2016,代码行数:18,代码来源:MinifyAdmin.php


示例16: test_rewrite_minify

 /**
  * Perform minify rules rewrite test
  *
  * @return bool
  */
 function test_rewrite_minify()
 {
     $url = w3_filename_to_url(w3_cache_blog_dir('minify') . '/w3tc_rewrite_test');
     return $this->test_rewrite($url);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:10,代码来源:TotalCacheAdmin.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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