scossdl_off_filter()
Output filter which runs the actual plugin logic.
Hooks from the function
Return
String
. The rewritten content.
Usage
scossdl_off_filter( $content );
- $content(string) (required)
- The content of the output buffer.
scossdl_off_filter() scossdl off filter code WPSCache 1.12.4
function scossdl_off_filter( $content ) { global $ossdl_off_blog_url, $ossdl_off_cdn_url; global $ossdl_off_include_dirs, $ossdl_off_excludes, $ossdl_arr_of_cnames; if ( empty( $content ) || empty( $ossdl_off_cdn_url ) || $ossdl_off_blog_url === $ossdl_off_cdn_url ) { return $content; // no rewrite needed. } if ( empty( $ossdl_off_include_dirs ) || ! is_array( $ossdl_off_include_dirs ) ) { $ossdl_off_include_dirs = scossdl_off_default_inc_dirs(); } if ( empty( $ossdl_off_excludes ) || ! is_array( $ossdl_off_excludes ) ) { $ossdl_off_excludes = array(); } if ( ! in_array( $ossdl_off_cdn_url, (array) $ossdl_arr_of_cnames, true ) ) { $ossdl_arr_of_cnames = array_merge( array( $ossdl_off_cdn_url ), (array) $ossdl_arr_of_cnames ); } $ossdl_arr_of_cnames = apply_filters( 'wpsc_cdn_urls', $ossdl_arr_of_cnames ); $dirs = scossdl_off_additional_directories(); $regex = '`(?<=[(\"\'])' . preg_quote( $ossdl_off_blog_url, '`' ) . '/(?:((?:' . $dirs . ')[^\"\')]+)|([^/\"\']+\.[^/\"\')]+))(?=[\"\')])`'; return preg_replace_callback( $regex, 'scossdl_off_rewriter', $content ); }