- New roots-utils.php file for base functions - Defined useful constants for dealing with common paths - Refactored rewrites and clean URLs to be more flexible for non standard setups - Custom scripts handler now deals with plugin scripts correctly - Fixes #204, #270, #278
29 lines
554 B
PHP
29 lines
554 B
PHP
<?
|
|
|
|
// returns WordPress subdirectory if applicable
|
|
function wp_base_dir() {
|
|
preg_match('!(https?://[^/|"]+)([^"]+)?!', site_url(), $matches);
|
|
if (count($matches) === 3) {
|
|
return end($matches);
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
// opposite of built in WP functions for trailing slashes
|
|
function leadingslashit($string) {
|
|
return '/' . unleadingslashit($string);
|
|
}
|
|
|
|
function unleadingslashit($string) {
|
|
return ltrim($string, '/');
|
|
}
|
|
|
|
function add_filters($tags, $function) {
|
|
foreach($tags as $tag) {
|
|
add_filter($tag, $function);
|
|
}
|
|
}
|
|
|
|
?>
|