scossdl_off_rewriter()
Rewriter of URLs, used as replace-callback.
Called by #scossdl_off_filter.
No Hooks.
Returns
null. Nothing (null).
Usage
scossdl_off_rewriter( $match );
- $match(required)
- .
scossdl_off_rewriter() scossdl off rewriter code WPSCache 3.1.0
function scossdl_off_rewriter( $match ) {
global $ossdl_off_blog_url, $ossdl_https, $ossdl_off_excludes, $ossdl_arr_of_cnames;
static $count_cnames = null, $include_dirs = null;
// Set up static variables. Run once only.
if ( ! isset( $count_cnames ) ) {
$count_cnames = count( $ossdl_arr_of_cnames );
$include_dirs = scossdl_off_additional_directories();
}
if ( $ossdl_https && str_starts_with( $match[0], 'https' ) ) {
return $match[0];
}
if ( scossdl_off_exclude_match( $match[0], $ossdl_off_excludes ) ) {
return $match[0];
}
if ( preg_match( '`(' . $include_dirs . ')`', $match[0] ) ) {
$offset = scossdl_string_mod( $match[1], $count_cnames );
return str_replace( $ossdl_off_blog_url, $ossdl_arr_of_cnames[ $offset ], $match[0] );
}
return $match[0];
}