Re-organization

This commit is contained in:
Ben Word
2012-05-09 00:55:09 -06:00
parent d4ec36331b
commit 7d2b3c1e07
17 changed files with 95 additions and 90 deletions

27
inc/util.php Normal file
View File

@@ -0,0 +1,27 @@
<?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);
}
}