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

PHP w3_clean_rules函数代码示例

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

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



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

示例1: create

 /**
  * @throws FilesystemWriteException
  * @throws FilesystemWriteException
  */
 public function create()
 {
     $path = trim(w3_get_wp_sitepath(), "/");
     if ($path) {
         $path .= '/';
     }
     $file_data = "\n<?php\n    if (W3TC_WP_LOADING)\n        require_once '" . w3_get_document_root() . '/' . $path . "wp-load.php';\n";
     $filename = W3TC_WP_LOADER;
     $data = $file_data;
     w3_require_once(W3TC_INC_DIR . '/functions/rule.php');
     $current_data = @file_get_contents($filename);
     if (strstr(w3_clean_rules($current_data), w3_clean_rules($data)) !== false) {
         return;
     }
     w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
     w3_wp_write_to_file($filename, $data, '', $_SERVER['REQUEST_URI']);
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:21,代码来源:WpLoader.php


示例2: check_rules_no404wp

 /**
  * Check no404wp rules
  *
  * @return boolean
  */
 function check_rules_no404wp()
 {
     $path = w3_get_browsercache_rules_no404wp_path();
     $search = $this->generate_rules_no404wp();
     return ($data = @file_get_contents($path)) && strstr(w3_clean_rules($data), w3_clean_rules($search)) !== false;
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:11,代码来源:BrowserCacheAdmin.php


示例3: check_multisite_subfolder_test_rules_cache_apache

 /**
  * Checks if the subfolder rewrite test rules exists.
  * @return bool
  */
 function check_multisite_subfolder_test_rules_cache_apache()
 {
     $path = w3_get_home_root() . '/.htaccess';
     $search = $this->generate_multisite_subfolder_rewrite_test_rules_apache();
     return ($data = @file_get_contents($path)) && strstr(w3_clean_rules($data), w3_clean_rules($search)) !== false;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:10,代码来源:MinifyAdmin.php


示例4: rules_core_add

 /**
  * Writes directives to WP .htaccess
  *
  * @param W3_Config $config
  * @param SelfTestExceptions $exs
  * @throws FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
  * @throws FileOperationException
  */
 private function rules_core_add($config, $exs)
 {
     $path = w3_get_pgcache_rules_core_path();
     if ($path === false) {
         return;
     }
     $original_data = @file_get_contents($path);
     if ($original_data === false) {
         $original_data = '';
     }
     $data = $original_data;
     $new_data = w3_erase_rules($data, W3TC_MARKER_BEGIN_PGCACHE_LEGACY, W3TC_MARKER_END_PGCACHE_LEGACY);
     $has_legacy = strlen($new_data) < strlen($data);
     $data = $new_data;
     $new_data = w3_erase_rules($data, W3TC_MARKER_BEGIN_PGCACHE_WPSC, W3TC_MARKER_END_PGCACHE_WPSC);
     $has_wpsc = strlen($new_data) < strlen($data);
     $data = $new_data;
     $rules = $this->rules_core_generate($config);
     $rules_missing = strstr(w3_clean_rules($data), w3_clean_rules($rules)) === false;
     if (!$has_legacy && !$has_wpsc && !$rules_missing) {
         return;
     }
     // modification of file not required
     $replace_start = strpos($data, W3TC_MARKER_BEGIN_PGCACHE_CORE);
     $replace_end = strpos($data, W3TC_MARKER_END_PGCACHE_CORE);
     if ($replace_start !== false && $replace_end !== false && $replace_start < $replace_end) {
         $replace_length = $replace_end - $replace_start + strlen(W3TC_MARKER_END_PGCACHE_CORE) + 1;
     } else {
         $replace_start = false;
         $replace_length = 0;
         $search = array(W3TC_MARKER_BEGIN_BROWSERCACHE_NO404WP => 0, W3TC_MARKER_BEGIN_WORDPRESS => 0, W3TC_MARKER_END_MINIFY_CORE => strlen(W3TC_MARKER_END_MINIFY_CORE) + 1, W3TC_MARKER_END_BROWSERCACHE_CACHE => strlen(W3TC_MARKER_END_BROWSERCACHE_CACHE) + 1, W3TC_MARKER_END_PGCACHE_CACHE => strlen(W3TC_MARKER_END_PGCACHE_CACHE) + 1, W3TC_MARKER_END_MINIFY_CACHE => strlen(W3TC_MARKER_END_MINIFY_CACHE) + 1);
         foreach ($search as $string => $length) {
             $replace_start = strpos($data, $string);
             if ($replace_start !== false) {
                 $replace_start += $length;
                 break;
             }
         }
     }
     if ($replace_start !== false) {
         $data = w3_trim_rules(substr_replace($data, $rules, $replace_start, $replace_length));
     } else {
         $data = w3_trim_rules($data . $rules);
     }
     try {
         w3_wp_write_to_file($path, $data);
     } catch (FilesystemOperationException $ex) {
         if ($has_legacy) {
             $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and remove all lines between and including <strong>
                             %s</strong> and <strong>%s</strong> markers.', 'w3-total-cache'), $path, W3TC_MARKER_BEGIN_PGCACHE_LEGACY, W3TC_MARKER_END_PGCACHE_LEGACY), $path));
         }
         if ($has_wpsc) {
             $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and remove all lines between and including
                             <strong>%s</strong> and <strong>%s</strong> markers.', 'w3-total-cache'), $path, W3TC_MARKER_BEGIN_PGCACHE_WPSC, W3TC_MARKER_END_PGCACHE_WPSC), $path));
         }
         if ($rules_missing) {
             if ($replace_start !== false) {
                 $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and replace all lines between and including
                                 <strong>%s</strong> and <strong>%s</strong> markers with:', 'w3-total-cache'), $path, W3TC_MARKER_BEGIN_PGCACHE_CORE, W3TC_MARKER_END_PGCACHE_CORE), $path, $rules));
             } else {
                 $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and add the following rules above the WordPress
                                 directives:'), $path), $path, $rules));
             }
         }
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:74,代码来源:PgCacheAdminEnvironment.php


示例5: check_rules_wpsc

 /**
  * Check if WPSC rules exists
  *
  * @return boolean
  */
 function check_rules_wpsc()
 {
     $path = w3_get_pgcache_rules_core_path();
     return ($data = @file_get_contents($path)) && w3_has_rules(w3_clean_rules($data), W3TC_MARKER_BEGIN_PGCACHE_WPSC, W3TC_MARKER_END_PGCACHE_WPSC);
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:10,代码来源:PgCacheAdmin.php


示例6: check_rules_legacy

 /**
  * Check if legacy rules exists
  *
  * @return boolean
  */
 function check_rules_legacy()
 {
     $path = w3_get_minify_rules_core_path();
     return ($data = @file_get_contents($path)) && w3_has_rules(w3_clean_rules($data), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY);
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:10,代码来源:MinifyAdmin.php


示例7: w3_add_rules

/**
 * @param SelfTestExceptions $exs
 * @param string $path
 * @param string $rules
 * @param string $start
 * @param string $end
 * @param array $order
 */
function w3_add_rules($exs, $path, $rules, $start, $end, $order)
{
    $data = @file_get_contents($path);
    if ($data === false) {
        $data = '';
    }
    $rules_missing = !empty($rules) && strstr(w3_clean_rules($data), w3_clean_rules($rules)) === false;
    if (!$rules_missing) {
        return;
    }
    $replace_start = strpos($data, $start);
    $replace_end = strpos($data, $end);
    if ($replace_start !== false && $replace_end !== false && $replace_start < $replace_end) {
        $replace_length = $replace_end - $replace_start + strlen($end) + 1;
    } else {
        $replace_start = false;
        $replace_length = 0;
        $search = $order;
        foreach ($search as $string => $length) {
            $replace_start = strpos($data, $string);
            if ($replace_start !== false) {
                $replace_start += $length;
                break;
            }
        }
    }
    if ($replace_start !== false) {
        $data = w3_trim_rules(substr_replace($data, $rules, $replace_start, $replace_length));
    } else {
        $data = w3_trim_rules($data . $rules);
    }
    if (strpos($path, W3TC_CACHE_DIR) === false || w3_is_nginx()) {
        try {
            w3_wp_write_to_file($path, $data);
        } catch (FilesystemOperationException $ex) {
            if ($replace_start !== false) {
                $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s
                        </strong> and replace all lines between and including <strong>%s</strong> and
                        <strong>%s</strong> markers with:', 'w3-total-caceh'), $path, $start, $end), $path, $rules));
            } else {
                $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and add the following rules
                                above the WordPress directives:', 'w3-total-cache'), $path), $path, $rules));
            }
        }
    } else {
        if (!@file_exists(dirname($path))) {
            w3_mkdir_from(dirname($path), W3TC_CACHE_DIR);
        }
        if (!@file_put_contents($path, $data)) {
            try {
                w3_wp_delete_folder(dirname($path), '', $_SERVER['REQUEST_URI']);
            } catch (FilesystemOperationException $ex) {
                $exs->push($ex);
            }
        }
    }
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:65,代码来源:rule.php


示例8: try_create_wp_loader

 /**
  * @throws TryException
  * @throws W3TCErrorException
  * @return bool
  */
 public function try_create_wp_loader()
 {
     $file_data = $this->w3tc_loader_file_data();
     $filename = $file_data['filename'];
     $data = $file_data['data'];
     w3_require_once(W3TC_INC_DIR . '/functions/rule.php');
     if (($current_data = @file_get_contents($filename)) && strstr(w3_clean_rules($current_data), w3_clean_rules($data)) !== false) {
         return true;
     }
     $url = w3_is_network() ? network_admin_url('admin.php?page=w3tc_general') : admin_url('admin.php?page=w3tc_general');
     try {
         w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
         $result = w3_wp_write_to_file($filename, $data, $url);
     } catch (Exception $ex) {
         if ($ex instanceof FilesystemCredentialException) {
             throw new TryException('Could not create file', array($filename), $ex->ftp_form());
         } else {
             throw new W3TCErrorException(sprintf('<strong>W3 Total Cache Error:</strong>Could not create file <strong>%s</strong>
                 with content: <pre>%s</pre><br />You need to do this manually.', $filename, esc_textarea($data)));
         }
     }
     return true;
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:28,代码来源:Setup.php


示例9: check_rules

 /**
  * Checks rules
  *
  * @return boolean
  */
 function check_rules()
 {
     $path = W3TC_CACHE_FILE_MINIFY_DIR . '/.htaccess';
     $search = $this->generate_rules();
     return ($data = @file_get_contents($path)) && strstr(w3_clean_rules($data), w3_clean_rules($search)) !== false;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:11,代码来源:Minify.php


示例10: check_rules_has_core

 /**
  * Check if core rules exists
  *
  * @return boolean
  */
 function check_rules_has_core()
 {
     $path = w3_get_new_relic_rules_core_path();
     return ($data = @file_get_contents($path)) && w3_has_rules(w3_clean_rules($data), W3TC_MARKER_BEGIN_NEW_RELIC_CORE, W3TC_MARKER_END_NEW_RELIC_CORE);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:10,代码来源:NewRelicAdmin.php


示例11: check_rules_wp

 /**
  * Checks WP directives
  *
  * @return boolean
  */
 function check_rules_wp()
 {
     if (function_exists('is_site_admin')) {
         return true;
     }
     $path = ABSPATH . '/.htaccess';
     return ($data = @file_get_contents($path)) && preg_match('~# BEGIN WordPress.*# END WordPress~s', w3_clean_rules($data));
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:13,代码来源:PgCache.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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