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


PHP w3_is_xml函数代码示例

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


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

示例1: ob_callback

 /**
  * Output buffer callback
  *
  * @param string $buffer
  * @return mixed
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         $domain_url_regexp = w3_get_domain_url_regexp();
         $buffer = preg_replace_callback('~(href|src|action|extsrc|asyncsrc|w3tc_load_js\\()=?[\'"]((' . $domain_url_regexp . ')?(/[^\'"]*\\.([a-z-_]+)(\\?[^\'"]*)?))[\'"]~Ui', array(&$this, 'link_replace_callback'), $buffer);
     }
     return $buffer;
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:14,代码来源:BrowserCache.php

示例2: ob_callback

 /**
  * OB callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         if ($this->can_minify2($buffer)) {
             /**
              * Replace script and style tags
              */
             if (function_exists('is_feed') && !is_feed()) {
                 w3_require_once(W3TC_INC_DIR . '/functions/extract.php');
                 $head_prepend = '';
                 $body_prepend = '';
                 $body_append = '';
                 $embed_extsrcjs = false;
                 if ($this->_config->get_boolean('minify.auto')) {
                     if ($this->_config->get_boolean('minify.js.enable')) {
                         $ignore_js_files = $this->_config->get_array('minify.reject.files.js');
                         $embed_type = $this->_config->get_string('minify.js.header.embed_type');
                         $embed_type = $embed_type == 'extsrc' || $embed_type == 'asyncsrc' ? 'blocking' : $embed_type;
                         $embed_pos = strpos($buffer, '<!-- W3TC-include-js-head -->');
                         $buffer = str_replace('<!-- W3TC-include-js-head -->', '', $buffer);
                         if ($embed_pos === false) {
                             preg_match('~<head(\\s+[^<>]+)*>~Ui', $buffer, $match, PREG_OFFSET_CAPTURE);
                             $embed_pos = strlen($match[0][0]) + $match[0][1];
                         }
                         $ignore_js_files = array_map('w3_normalize_file', $ignore_js_files);
                         $files_to_minify = array();
                         $handled_scripts = array();
                         $script_tags = w3_extract_js2($buffer);
                         $previous_file_was_ignored = false;
                         foreach ($script_tags as $script_tag) {
                             $tag_pos = strpos($buffer, $script_tag);
                             $match = array();
                             preg_match('~<script\\s+[^<>]*src=["\']?([^"\']+)["\']?[^<>]*>\\s*</script>~is', $script_tag, $match);
                             $file = $match[1];
                             $file = w3_normalize_file_minify2($file);
                             $script_len = strlen($script_tag);
                             if (!$this->_filter_files($file) || in_array($file, $handled_scripts)) {
                                 continue;
                             }
                             $handled_scripts[] = $file;
                             $this->replaced_scripts[] = $file;
                             if (in_array($file, $ignore_js_files)) {
                                 if ($tag_pos > $embed_pos) {
                                     if ($files_to_minify) {
                                         $script = $this->get_script_custom($files_to_minify, $embed_type);
                                         $buffer = substr_replace($buffer, $script, $embed_pos, 0);
                                         $files_to_minify = array();
                                         $script_len = $script_len + strlen($script);
                                     }
                                     $embed_pos = $embed_pos + $script_len;
                                     $previous_file_was_ignored = true;
                                 }
                             } else {
                                 $buffer = substr_replace($buffer, '', $tag_pos, $script_len);
                                 if ($embed_pos > $tag_pos) {
                                     $embed_pos -= $script_len;
                                 } elseif ($previous_file_was_ignored) {
                                     $embed_pos = $tag_pos;
                                 }
                                 $files_to_minify[] = $file;
                             }
                         }
                         $script = $this->get_script_custom($files_to_minify, $embed_type);
                         $buffer = substr_replace($buffer, $script, $embed_pos, 0);
                     }
                     if ($this->_config->get_boolean('minify.css.enable')) {
                         $ignore_css_files = $this->_config->get_array('minify.reject.files.css');
                         $files_to_minify = array();
                         $embed_pos = strpos($buffer, '<!-- W3TC-include-css -->');
                         $buffer = str_replace('<!-- W3TC-include-css -->', '', $buffer);
                         if ($embed_pos === false) {
                             preg_match('~<head(\\s+[^<>]+)*>~Ui', $buffer, $match, PREG_OFFSET_CAPTURE);
                             $embed_pos = strlen($match[0][0]) + $match[0][1];
                         }
                         $ignore_css_files = array_map('w3_normalize_file', $ignore_css_files);
                         $handled_styles = array();
                         $style_tags = w3_extract_css2($buffer);
                         $previous_file_was_ignored = false;
                         foreach ($style_tags as $style_tag_tuple) {
                             $style_tag = $style_tag_tuple[0];
                             $tag_pos = strpos($buffer, $style_tag);
                             $match = array();
                             $file = $style_tag_tuple[1];
                             $file = w3_normalize_file_minify2($file);
                             $style_len = strlen($style_tag);
                             if (!$this->_filter_files($file) || in_array($file, $handled_styles)) {
                                 continue;
                             }
                             $handled_styles[] = $file;
                             $this->replaced_styles[] = $file;
                             if (in_array($file, $ignore_css_files)) {
                                 if ($tag_pos > $embed_pos) {
                                     if ($files_to_minify) {
                                         $style = $this->get_style_custom($files_to_minify);
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:Minify.php

示例3: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     if ($buffer != '') {
         if (w3_is_xml($buffer) && $this->_can_cache2()) {
             $compression = $this->_get_compression();
             $compressions = $this->_get_compressions();
             if ($this->_enhanced_mode) {
                 $is_404 = false;
                 $headers = array();
             } else {
                 $is_404 = function_exists('is_404') ? is_404() : false;
                 $headers = $this->_get_cached_headers();
             }
             $time = time();
             $cache =& $this->_get_cache();
             foreach ($compressions as $_compression) {
                 $_page_key = $this->_get_page_key($_SERVER['REQUEST_URI'], $_compression);
                 /**
                  * Encode content
                  */
                 switch ($_compression) {
                     case false:
                         $_content = $buffer;
                         break;
                     case 'gzip':
                         $_content = gzencode($buffer);
                         break;
                     case 'deflate':
                         $_content = gzdeflate($buffer);
                         break;
                 }
                 /**
                  * Store cache data
                  */
                 if ($this->_enhanced_mode) {
                     $cache->set($_page_key, $_content);
                 } else {
                     $_data = array('404' => $is_404, 'headers' => $headers, 'time' => $time, 'content' => $_content);
                     $cache->set($_page_key, $_data, $this->_lifetime);
                 }
                 if ($compression == $_compression) {
                     $page_key = $_page_key;
                     $buffer = $_content;
                 }
             }
             /**
              * Calculate content etag
              */
             $etag = md5($buffer);
             /**
              * Send headers
              */
             $this->_send_headers($is_404, $time, $etag, $compression, $headers);
             /**
              * Append debug info
              */
             if ($this->_debug) {
                 $time_total = w3_microtime() - $this->_time_start;
                 $debug_info = $this->_get_debug_info($page_key, true, '', false, $time_total);
                 $this->_append_content($buffer, "\r\n\r\n" . $debug_info, $compression);
             }
         } elseif ($this->_debug) {
             /**
              * Append debug info
              */
             $page_key = $this->_get_page_key($_SERVER['REQUEST_URI'], false);
             $time_total = w3_microtime() - $this->_time_start;
             $debug_info = $this->_get_debug_info($page_key, false, $this->cache_reject_reason, false, $time_total);
             $this->_append_content($buffer, "\r\n\r\n" . $debug_info, false);
         }
     }
     return $buffer;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:79,代码来源:PgCache.php

示例4: ob_callback

 /**
  * OB callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         if ($this->can_minify2($buffer)) {
             /**
              * Replace script and style tags
              */
             if (function_exists('is_feed') && !is_feed()) {
                 $head_prepend = '';
                 $body_prepend = '';
                 $body_append = '';
                 if ($this->_config->get_boolean('minify.auto')) {
                     if ($this->_config->get_boolean('minify.css.enable')) {
                         $files_css = $this->get_files_css($buffer);
                         $style = $this->get_style_custom($files_css);
                         if ($style) {
                             $head_prepend .= $style;
                             $this->remove_styles($buffer, $files_css);
                         }
                     }
                     if ($this->_config->get_boolean('minify.js.enable')) {
                         $files_js = $this->get_files_js($buffer);
                         $script = $this->get_script_custom($files_js);
                         if ($script) {
                             $head_prepend .= $script;
                             $this->remove_scripts($buffer, $files_js);
                         }
                     }
                 } else {
                     if ($this->_config->get_boolean('minify.css.enable') && !in_array('include', $this->printed_styles)) {
                         $style = $this->get_style_group('include');
                         if ($style) {
                             $head_prepend .= $style;
                             $this->remove_styles_group($buffer, 'include');
                         }
                     }
                     if ($this->_config->get_boolean('minify.js.enable')) {
                         if (!in_array('include', $this->printed_scripts)) {
                             $script = $this->get_script_group('include');
                             if ($script) {
                                 $head_prepend .= $script;
                                 $this->remove_scripts_group($buffer, 'include');
                             }
                         }
                         if (!in_array('include-nb', $this->printed_scripts)) {
                             $script = $this->get_script_group('include-nb');
                             if ($script) {
                                 $head_prepend .= $script;
                                 $this->remove_scripts_group($buffer, 'include-nb');
                             }
                         }
                         if (!in_array('include-body', $this->printed_scripts)) {
                             $script = $this->get_script_group('include-body');
                             if ($script) {
                                 $body_prepend .= $script;
                                 $this->remove_scripts_group($buffer, 'include-body');
                             }
                         }
                         if (!in_array('include-body-nb', $this->printed_scripts)) {
                             $script = $this->get_script_group('include-body-nb');
                             if ($script) {
                                 $body_prepend .= $script;
                                 $this->remove_scripts_group($buffer, 'include-body-nb');
                             }
                         }
                         if (!in_array('include-footer', $this->printed_scripts)) {
                             $script = $this->get_script_group('include-footer');
                             if ($script) {
                                 $body_append .= $script;
                                 $this->remove_scripts_group($buffer, 'include-footer');
                             }
                         }
                         if (!in_array('include-footer-nb', $this->printed_scripts)) {
                             $script = $this->get_script_group('include-footer-nb');
                             if ($script) {
                                 $body_append .= $script;
                                 $this->remove_scripts_group($buffer, 'include-footer-nb');
                             }
                         }
                     }
                 }
                 if ($head_prepend != '') {
                     $buffer = preg_replace('~<head(\\s+[^<>]+)*>~Ui', '\\0' . $head_prepend, $buffer, 1);
                 }
                 if ($body_prepend != '') {
                     $buffer = preg_replace('~<body(\\s+[^<>]+)*>~Ui', '\\0' . $body_prepend, $buffer, 1);
                 }
                 if ($body_append != '') {
                     $buffer = preg_replace('~<\\/body>~', $body_append . '\\0', $buffer, 1);
                 }
             }
             /**
              * Minify HTML/Feed
              */
//.........这里部分代码省略.........
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:101,代码来源:Minify.php

示例5: ob_callback

 /**
  * OB Callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         if ($this->can_cdn2($buffer)) {
             $regexps = array();
             $site_path = w3_get_site_path();
             $domain_url_regexp = w3_get_domain_url_regexp();
             if ($this->_config->get_boolean('cdn.uploads.enable')) {
                 require_once W3TC_INC_DIR . '/functions/http.php';
                 $upload_info = w3_upload_info();
                 if ($upload_info) {
                     if (preg_match('~' . $domain_url_regexp . '~i', $upload_info['baseurl'])) {
                         $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\'>]+)))~';
                     } else {
                         $regexps[] = '~(["\'])((' . w3_preg_quote($upload_info['baseurl']) . ')(([^"\'>]+)))~';
                     }
                 }
             }
             if ($this->_config->get_boolean('cdn.includes.enable')) {
                 $mask = $this->_config->get_string('cdn.includes.files');
                 if ($mask != '') {
                     $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
                 }
             }
             if ($this->_config->get_boolean('cdn.theme.enable')) {
                 $theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
                 $mask = $this->_config->get_string('cdn.theme.files');
                 if ($mask != '') {
                     $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
                 }
             }
             if ($this->_config->get_boolean('cdn.minify.enable')) {
                 if ($this->_config->get_boolean('minify.auto')) {
                     $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . W3TC_CONTENT_MINIFY_DIR_NAME) . '/[a-f0-9]+\\.[a-f0-9]+\\.(css|js)))~U';
                 } else {
                     $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . W3TC_CONTENT_MINIFY_DIR_NAME) . '/[a-f0-9]+/.+\\.include(-(footer|body))?(-nb)?\\.[a-f0-9]+\\.(css|js)))~U';
                 }
             }
             if ($this->_config->get_boolean('cdn.custom.enable')) {
                 $masks = $this->_config->get_array('cdn.custom.files');
                 $masks = array_map('w3_parse_path', $masks);
                 if (count($masks)) {
                     $mask_regexps = array();
                     foreach ($masks as $mask) {
                         if ($mask != '') {
                             $mask = w3_normalize_file($mask);
                             $mask_regexps[] = $this->get_regexp_by_mask($mask);
                         }
                     }
                     $regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
                 }
             }
             foreach ($regexps as $regexp) {
                 $buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
             }
         }
         if ($this->_config->get_boolean('cdn.debug')) {
             $buffer .= "\r\n\r\n" . $this->get_debug_info();
         }
     }
     return $buffer;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:68,代码来源:Cdn.php

示例6: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         $buffer .= "\r\n\r\n" . $this->_get_debug_info();
     }
     return $buffer;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:13,代码来源:Db.php

示例7: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     global $wpdb;
     if ($buffer != '' && w3_is_xml($buffer)) {
         if (w3_is_database_error($buffer)) {
             @header('HTTP/1.1 503 Service Unavailable');
         } else {
             /**
              * Replace links for preview mode
              */
             if (w3_is_preview_mode() && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] != W3TC_POWERED_BY) {
                 $domain_url_regexp = w3_get_domain_url_regexp();
                 $buffer = preg_replace_callback('~(href|src|action)=([\'"])(' . $domain_url_regexp . ')?(/[^\'"]*)~', array(&$this, 'link_replace_callback'), $buffer);
             }
             /**
              * Add footer comment
              */
             $date = date_i18n('Y-m-d H:i:s');
             $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
             if ($this->is_supported()) {
                 $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date);
             } else {
                 $strings = array();
                 if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
                     $w3_plugin_minify =& W3_Plugin_Minify::instance();
                     $strings[] = sprintf("Minified using %s%s", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/PgCache.php';
                     $w3_pgcache =& W3_PgCache::instance();
                     $strings[] = sprintf("Page Caching using %s%s", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug') && is_a($wpdb, 'W3_Db')) {
                     $append = is_user_logged_in() ? ' (user is logged in)' : '';
                     if ($wpdb->query_hits) {
                         $strings[] = sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     } else {
                         $strings[] = sprintf("Database Caching using %s%s", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     }
                 }
                 if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/ObjectCache.php';
                     $w3_objectcache =& W3_ObjectCache::instance();
                     $strings[] = sprintf("Object Caching %d/%d objects using %s", $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine')));
                 }
                 if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
                     $w3_plugin_cdn =& W3_Plugin_Cdn::instance();
                     $cdn =& $w3_plugin_cdn->get_cdn();
                     $via = $cdn->get_via();
                     $strings[] = sprintf("Content Delivery Network via %s%s", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : '');
                 }
                 $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n";
                 if (count($strings)) {
                     $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n";
                 }
                 $buffer .= sprintf("\r\nServed from: %s @ %s -->", w3_escape_comment($host), $date);
             }
         }
     }
     return $buffer;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:69,代码来源:TotalCache.php

示例8: w3_can_print_comment

/**
 * If content can handle HTML comments, can disable printout per request using filter 'w3tc_can_print_comment'
 * @param $buffer
 * @return bool
 */
function w3_can_print_comment(&$buffer)
{
    if (function_exists('apply_filters')) {
        return apply_filters('w3tc_can_print_comment', w3_is_xml($buffer) && !defined('DOING_AJAX'));
    }
    return w3_is_xml($buffer) && !defined('DOING_AJAX');
}
开发者ID:jcastilloa,项目名称:w3tc-transparentcdn,代码行数:12,代码来源:define.php

示例9: ob_callback

 /**
  * OB Callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         if ($this->can_cdn2($buffer)) {
             $regexps = array();
             $site_path = w3_get_site_path();
             $domain_url_regexp = w3_get_domain_url_regexp();
             if ($this->_config->get_boolean('cdn.uploads.enable')) {
                 w3_require_once(W3TC_INC_DIR . '/functions/http.php');
                 $upload_info = w3_upload_info();
                 if ($upload_info) {
                     if (preg_match('~' . $domain_url_regexp . '~i', $upload_info['baseurl'])) {
                         $regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\')>]+)))~';
                     } else {
                         $parsed = @parse_url($upload_info['baseurl']);
                         $upload_url_domain_regexp = isset($parsed['host']) ? w3_get_url_regexp($parsed['scheme'] . '://' . $parsed['host']) : '';
                         $baseurlpath = isset($parsed['path']) ? rtrim($parsed['path'], '/') : '';
                         if ($baseurlpath) {
                             $regexps[] = '~(["\'])\\s*((' . $upload_url_domain_regexp . ')?(' . w3_preg_quote($baseurlpath) . '([^"\'>]+)))~';
                         } else {
                             $regexps[] = '~(["\'])\\s*((' . $upload_url_domain_regexp . ')([^"\'>]+))~';
                         }
                     }
                 }
             }
             if ($this->_config->get_boolean('cdn.includes.enable')) {
                 $mask = $this->_config->get_string('cdn.includes.files');
                 if ($mask != '') {
                     $regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
                 }
             }
             if ($this->_config->get_boolean('cdn.theme.enable')) {
                 $theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
                 $mask = $this->_config->get_string('cdn.theme.files');
                 if ($mask != '') {
                     $regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
                 }
             }
             if ($this->_config->get_boolean('cdn.custom.enable')) {
                 $masks = $this->_config->get_array('cdn.custom.files');
                 $masks = array_map('w3_parse_path', $masks);
                 if (count($masks)) {
                     $mask_regexps = array();
                     foreach ($masks as $mask) {
                         if ($mask != '') {
                             $mask = w3_normalize_file($mask);
                             $mask_regexps[] = $this->get_regexp_by_mask($mask);
                         }
                     }
                     $regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
                 }
             }
             foreach ($regexps as $regexp) {
                 $buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
             }
             if ($this->_config->get_boolean('cdn.minify.enable')) {
                 if ($this->_config->get_boolean('minify.auto')) {
                     $regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-zA-Z0-9-_]+\\.(css|js)') . '~U';
                     if (w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
                         $processor = 'link_replace_callback';
                     } else {
                         $processor = 'minify_auto_pushcdn_link_replace_callback';
                     }
                 } else {
                     $regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-z0-9]+/.+\\.include(-(footer|body))?(-nb)?\\.[a-f0-9]+\\.(css|js)') . '~U';
                     $processor = 'link_replace_callback';
                 }
                 $buffer = preg_replace_callback($regexp, array(&$this, $processor), $buffer);
             }
         }
         if ($this->_config->get_boolean('cdn.debug')) {
             $buffer .= "\r\n\r\n" . $this->get_debug_info();
         }
     }
     return $buffer;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:82,代码来源:Cdn.php

示例10: ob_callback

 /**
  * OB callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer) && $this->can_minify2()) {
         $head_prepend = '';
         $body_append = '';
         if ($this->_config->get_boolean('minify.css.enable') && !in_array('include', $this->printed_styles)) {
             $head_prepend .= $this->get_styles('include');
         }
         if ($this->_config->get_boolean('minify.js.enable')) {
             if (!in_array('include', $this->printed_scripts)) {
                 $head_prepend .= $this->get_scripts('include');
             }
             if (!in_array('include-nb', $this->printed_scripts)) {
                 $head_prepend .= $this->get_scripts('include-nb');
             }
             if (!in_array('include-footer', $this->printed_scripts)) {
                 $body_append .= $this->get_scripts('include-footer');
             }
             if (!in_array('include-footer-nb', $this->printed_scripts)) {
                 $body_append .= $this->get_scripts('include-footer-nb');
             }
         }
         if ($head_prepend != '') {
             $buffer = preg_replace('~<head(\\s+[^<>]+)*>~Ui', '\\0' . $head_prepend, $buffer, 1);
         }
         if ($body_append != '') {
             $buffer = preg_replace('~<\\/body>~', $body_append . '\\0', $buffer, 1);
         }
         $buffer = $this->clean($buffer);
         if ($this->_config->get_boolean('minify.debug')) {
             $buffer .= "\r\n\r\n" . $this->get_debug_info();
         }
     }
     return $buffer;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:41,代码来源:Minify.php

示例11: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         $compression = false;
         $has_dynamic = $this->_has_dynamic($buffer);
         $can_cache = $this->_can_cache2($buffer);
         if ($can_cache) {
             $mobile_group = $this->_get_mobile_group();
             $referrer_group = $this->_get_referrer_group();
             $encryption = $this->_get_encryption();
             $compression = $this->_get_compression();
             /**
              * Don't use compression for debug mode or dynamic tags
              * because we need to modify buffer before send it to client
              */
             $raw = $this->_debug || $has_dynamic;
             if ($raw) {
                 $compressions = array(false);
             } else {
                 $compressions = $this->_get_compressions();
             }
             if ($this->_enhanced_mode) {
                 $is_404 = false;
                 $headers = array();
             } else {
                 $is_404 = function_exists('is_404') ? is_404() : false;
                 $headers = $this->_get_cached_headers();
             }
             $time = time();
             $cache =& $this->_get_cache();
             /**
              * Store different versions of cache
              */
             $buffers = array();
             foreach ($compressions as $_compression) {
                 $_page_key = $this->_get_page_key($this->_request_uri, $mobile_group, $referrer_group, $encryption, $_compression);
                 /**
                  * Compress content
                  */
                 $buffers[$_compression] = $buffer;
                 $this->_compress($buffers[$_compression], $_compression);
                 /**
                  * Store cache data
                  */
                 if ($this->_enhanced_mode) {
                     $cache->set($_page_key, $buffers[$_compression]);
                 } else {
                     $_data = array('404' => $is_404, 'headers' => $headers, 'time' => $time, 'content' => &$buffers[$_compression]);
                     $cache->set($_page_key, $_data, $this->_lifetime);
                 }
             }
             /**
              * Change buffer if using compression
              */
             if ($compression && isset($buffers[$compression])) {
                 $buffer =& $buffers[$compression];
             }
             /**
              * Calculate content etag
              */
             $etag = md5($buffer);
             /**
              * Send headers
              */
             $this->_send_headers($is_404, $time, $etag, $compression, $headers);
             if ($raw) {
                 if ($this->_debug) {
                     /**
                      * Set page key for debug
                      */
                     $this->_page_key = $this->_get_page_key($this->_request_uri, $mobile_group, $referrer_group, $encryption, $compression);
                     /**
                      * Append debug info
                      */
                     $time_total = w3_microtime() - $this->_time_start;
                     $debug_info = $this->_get_debug_info(true, '', false, $time_total);
                     $buffer .= "\r\n\r\n" . $debug_info;
                 }
                 /**
                  * Don't use shutdown function below
                  */
                 if (!$has_dynamic) {
                     $this->_compress($buffer, $compression);
                 }
             }
         } elseif ($this->_debug) {
             $mobile_group = $this->_get_mobile_group();
             $referrer_group = $this->_get_referrer_group();
             $encryption = $this->_get_encryption();
             /**
              * Set page key for debug
              */
             $this->_page_key = $this->_get_page_key($this->_request_uri, $mobile_group, $referrer_group, $encryption, $compression);
             /**
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:PgCache.php

示例12: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     global $wpdb;
     if ($buffer != '' && w3_is_xml($buffer)) {
         if (w3_is_database_error($buffer)) {
             status_header(503);
         } else {
             /**
              * Replace links for preview mode
              */
             if (w3_is_preview_mode() && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] != W3TC_POWERED_BY) {
                 $domain_url_regexp = w3_get_domain_url_regexp();
                 $buffer = preg_replace_callback('~(href|src|action)=([\'"])(' . $domain_url_regexp . ')?(/[^\'"]*)~', array(&$this, 'link_replace_callback'), $buffer);
             }
             /**
              * Add footer comment
              */
             $date = date_i18n('Y-m-d H:i:s');
             $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
             if ($this->_config->get_string('common.support') != '' || $this->_config->get_boolean('common.tweeted')) {
                 $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date);
             } else {
                 $strings = array();
                 if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) {
                     $w3_plugin_minify = w3_instance('W3_Plugin_Minify');
                     $strings[] = sprintf("Minified using %s%s", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) {
                     $w3_pgcache = w3_instance('W3_PgCache');
                     $strings[] = sprintf("Page Caching using %s%s", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug')) {
                     $db = w3_instance('W3_DbCache');
                     $append = !is_null($db->cache_reject_reason) ? sprintf(' (%s)', $db->cache_reject_reason) : '';
                     if ($db->query_hits) {
                         $strings[] = sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s", $db->query_hits, $db->query_total, $db->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     } else {
                         $strings[] = sprintf("Database Caching using %s%s", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     }
                 }
                 if (w3_is_dbcluster()) {
                     $db_cluster = w3_instance('W3_Enterprise_DbCluster');
                     $strings[] = $db_cluster->status_message();
                 }
                 if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) {
                     $w3_objectcache = w3_instance('W3_ObjectCache');
                     $append = $w3_objectcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_objectcache->cache_reject_reason) : '';
                     $strings[] = sprintf("Object Caching %d/%d objects using %s%s", $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine')), $append);
                 }
                 if ($this->_config->get_boolean('fragmentcache.enabled') && !$this->_config->get_boolean('fragmentcache.debug')) {
                     $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache');
                     $append = $w3_fragmentcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_fragmentcache->cache_reject_reason) : '';
                     $strings[] = sprintf("Fragment Caching %d/%d fragments using %s%s", $w3_fragmentcache->cache_hits, $w3_fragmentcache->cache_total, w3_get_engine_name($this->_config->get_string('fragmentcache.engine')), $append);
                 }
                 if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) {
                     $w3_plugin_cdn = w3_instance('W3_Plugin_Cdn');
                     $w3_plugin_cdncommon = w3_instance('W3_Plugin_CdnCommon');
                     $cdn =& $w3_plugin_cdncommon->get_cdn();
                     $via = $cdn->get_via();
                     $strings[] = sprintf("Content Delivery Network via %s%s", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('newrelic.enabled')) {
                     $w3_newrelic = w3_instance('W3_Plugin_NewRelic');
                     $append = $w3_newrelic->newrelic_reject_reason != '' ? sprintf(' (%s)', $w3_newrelic->newrelic_reject_reason) : '';
                     $strings[] = sprintf(__("Application Monitoring using New Relic%s", 'w3-total-cache'), $append);
                 }
                 $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n";
                 if (count($strings)) {
                     $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n";
                 }
                 $buffer .= sprintf("\r\n Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date);
             }
             if ($this->is_debugging()) {
                 if ($this->_config->get_boolean('dbcache.enabled') && $this->_config->get_boolean('dbcache.debug')) {
                     $db = w3_instance('W3_DbCache');
                     $buffer .= "\r\n\r\n" . $db->_get_debug_info();
                 }
                 if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get_boolean('objectcache.debug')) {
                     $w3_objectcache = w3_instance('W3_ObjectCache');
                     $buffer .= "\r\n\r\n" . $w3_objectcache->_get_debug_info();
                 }
                 if ($this->_config->get_boolean('fragmentcache.enabled') && $this->_config->get_boolean('fragmentcache.debug')) {
                     $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache');
                     $buffer .= "\r\n\r\n" . $w3_fragmentcache->_get_debug_info();
                 }
             }
         }
     }
     return $buffer;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:96,代码来源:TotalCache.php

示例13: ob_callback

 /**
  * OB Callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         $regexps = array();
         $upload_info = w3_upload_info();
         $site_url_regexp = w3_get_site_url_regexp();
         if ($upload_info) {
             $regexps[] = '~(["\'])((' . $site_url_regexp . ')?/?(' . w3_preg_quote($upload_info['upload_url']) . '[^"\'>]+))~';
         }
         if ($this->_config->get_boolean('cdn.includes.enable')) {
             $mask = $this->_config->get_string('cdn.includes.files');
             if ($mask != '') {
                 $regexps[] = '~(["\'])((' . $site_url_regexp . ')?/?(' . w3_preg_quote(WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
             }
         }
         if ($this->_config->get_boolean('cdn.theme.enable')) {
             $theme_dir = preg_replace('~' . $site_url_regexp . '~i', '', get_stylesheet_directory_uri());
             $mask = $this->_config->get_string('cdn.theme.files');
             if ($mask != '') {
                 $regexps[] = '~(["\'])((' . $site_url_regexp . ')?/?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
             }
         }
         if ($this->_config->get_boolean('cdn.minify.enable')) {
             $regexps[] = '~(["\'])((' . $site_url_regexp . ')?/?(' . w3_preg_quote(W3TC_CONTENT_MINIFY_DIR_NAME) . '/[a-z0-9-_]+\\.include(-footer)?(-nb)?\\.(css|js)))~';
         }
         if ($this->_config->get_boolean('cdn.custom.enable')) {
             $masks = $this->_config->get_array('cdn.custom.files');
             if (count($masks)) {
                 $mask_regexps = array();
                 foreach ($masks as $mask) {
                     if ($mask != '') {
                         $mask = w3_normalize_file($mask);
                         $mask_regexps[] = $this->get_regexp_by_mask($mask);
                     }
                 }
                 $regexps[] = '~(["\'])((' . $site_url_regexp . ')?/?(' . implode('|', $mask_regexps) . '))~i';
             }
         }
         foreach ($regexps as $regexp) {
             $buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
         }
         if ($this->_config->get_boolean('cdn.debug')) {
             $buffer .= "\r\n\r\n" . $this->get_debug_info();
         }
     }
     return $buffer;
 }
开发者ID:alx,项目名称:SBek-Arak,代码行数:53,代码来源:Cdn.php

示例14: ob_callback

 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     global $wpdb;
     if ($buffer != '' && w3_is_xml($buffer)) {
         $date = date('Y-m-d H:i:s');
         $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
         if ($this->is_supported()) {
             $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", $host, $date);
         } else {
             $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n\r\n";
             if ($this->_config->get_boolean('minify.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
                 $w3_plugin_minify =& W3_Plugin_Minify::instance();
                 $buffer .= sprintf("Minified using %s%s\r\n", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : '');
             }
             if ($this->_config->get_boolean('pgcache.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/PgCache.php';
                 $w3_pgcache =& W3_PgCache::instance();
                 $buffer .= sprintf("Page Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : '');
             }
             if ($this->_config->get_boolean('dbcache.enabled') && is_a($wpdb, 'W3_Db')) {
                 $append = is_user_logged_in() ? ' (user is logged in)' : '';
                 if ($wpdb->query_hits) {
                     $buffer .= sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s\r\n", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                 } else {
                     $buffer .= sprintf("Database Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                 }
             }
             if ($this->_config->get_boolean('cdn.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
                 $w3_plugin_cdn =& W3_Plugin_Cdn::instance();
                 $cdn =& $w3_plugin_cdn->get_cdn();
                 $via = $cdn->get_via();
                 $buffer .= sprintf("Content Delivery Network via %s%s\r\n", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : '');
             }
             $buffer .= sprintf("\r\nServed from: %s @ %s -->", $host, $date);
         }
     }
     return $buffer;
 }
开发者ID:alx,项目名称:SBek-Arak,代码行数:46,代码来源:TotalCache.php

示例15: ob_callback

 /**
  * OB callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     if ($buffer != '' && w3_is_xml($buffer)) {
         $head_prepend = '';
         if ($this->_config->get_boolean('minify.css.enable')) {
             $head_prepend .= $this->get_styles('include');
         }
         if ($this->_config->get_boolean('minify.js.enable')) {
             $head_prepend .= $this->get_scripts('include') . $this->get_scripts('include-nb');
         }
         if (!empty($head_prepend)) {
             $buffer = preg_replace('~<head(\\s+[^<>]+)*>~Ui', '\\0' . $head_prepend, $buffer, 1);
         }
         $buffer = $this->clean($buffer);
         if ($this->_config->get_boolean('minify.debug')) {
             $buffer .= "\r\n\r\n" . $this->get_debug_info();
         }
     }
     return $buffer;
 }
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:26,代码来源:Minify.php


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