芝麻web文件管理V1.00
编辑当前文件:/home/paymbalq/www/wp-content/plugins/w3-total-cache/Minify_AutoJs.php
config = $config; $this->debug = $config->get_boolean( 'minify.debug' ); $this->buffer = $buffer; $this->minify_helpers = $minify_helpers; // ignored files. $this->ignore_js_files = $this->config->get_array( 'minify.reject.files.js' ); $this->ignore_js_files = array_map( array( '\W3TC\Util_Environment', 'normalize_file' ), $this->ignore_js_files ); // define embed type. $this->embed_type = array( 'head' => $this->config->get_string( 'minify.js.header.embed_type' ), 'body' => $this->config->get_string( 'minify.js.body.embed_type' ), ); } /** * Executes the minification process on the current buffer. * * @return string The modified HTML buffer after processing. */ public function execute() { // find all script tags. $buffer_nocomments = preg_replace( '~\s*~s', '', $this->buffer ); $matches = null; // end of means another group of scripts, cannt be combined. if ( ! preg_match_all( '~(|)~is', $buffer_nocomments, $matches ) ) { $matches = null; } if ( is_null( $matches ) ) { return $this->buffer; } $script_tags = $matches[1]; $script_tags = apply_filters( 'w3tc_minify_js_script_tags', $script_tags ); // pass scripts. $this->files_to_minify = array( 'sync' => array( 'embed_pos' => 0, 'files' => array(), ), 'async' => array( 'embed_pos' => 0, 'files' => array(), ), 'defer' => array( 'embed_pos' => 0, 'files' => array(), ), ); $count = count( $script_tags ); for ( $n = 0; $n < $count; $n++ ) { $this->process_script_tag( $script_tags[ $n ], $n ); } $this->flush_collected( 'sync', '' ); $this->flush_collected( 'async', '' ); $this->flush_collected( 'defer', '' ); return $this->buffer; } /** * Retrieves the list of debug URLs for the minified files. * * @return array List of URLs for debug purposes. */ public function get_debug_minified_urls() { return $this->debug_minified_urls; } /** * Processes a single script tag in the buffer. * * @param string $script_tag The HTML script tag to process. * @param int $script_tag_number The index of the script tag being processed. * * @return void */ private function process_script_tag( $script_tag, $script_tag_number ) { if ( $this->debug ) { Minify_Core::log( 'processing tag ' . substr( $script_tag, 0, 150 ) ); } $tag_pos = strpos( $this->buffer, $script_tag ); if ( false === $tag_pos ) { // script is external but not found, skip processing it. if ( $this->debug ) { Minify_Core::log( 'script not found:' . $script_tag ); } return; } $match = null; if ( ! preg_match( '~