Files
sage/inc/roots-utils.php
Scott Walkinshaw db09a64d94 Better rewrite/clean URL handling
- 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
2012-02-20 16:13:35 -05:00

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);
}
}
?>