芝麻web文件管理V1.00
编辑当前文件:/home/paymbalq/www/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator_Unmutable.php
placeholder_base = 'w3tc_lazyload_' . md5( isset( $_SERVER['REQUEST_TIME'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_TIME'] ) ) : '' ) . '_'; } /** * Replaces unmutable content (e.g., scripts and styles) in the provided buffer with placeholders. * * This method identifies `~is', array( $this, 'placeholder' ), $buffer ); // styles. $buffer = preg_replace_callback( '~\s*~is', array( $this, 'placeholder' ), $buffer ); return $buffer; } /** * Restores unmutable content in the provided buffer by replacing placeholders with their original content. * * This method replaces previously added placeholders with their associated content stored in `$placeholders`. * * @param string $buffer The HTML content buffer containing placeholders. * * @return string The restored buffer with original unmutable content. */ public function restore_unmutable( $buffer ) { return str_replace( array_keys( $this->placeholders ), array_values( $this->placeholders ), $buffer ); } /** * Generates a unique placeholder for a matched piece of unmutable content and stores it. * * This method is called internally by `remove_unmutable` to replace matches (e.g., scripts and styles) * with unique placeholders. The original content is stored in `$placeholders`. * * @param array $matches The matches found by the `preg_replace_callback` function, * where the full match is at index 0. * * @return string The generated placeholder key. */ public function placeholder( $matches ) { $key = '{' . $this->placeholder_base . count( $this->placeholders ) . '}'; $this->placeholders[ $key ] = $matches[0]; return $key; } }