Add generate_rewrite_rule().

git-svn-id: http://svn.automattic.com/wordpress/trunk@1973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-12-18 19:40:02 +00:00
parent 71e989b683
commit b3a3894b2a
1 changed files with 9 additions and 1 deletions

View File

@ -922,7 +922,11 @@ class WP_Rewrite {
$structure = str_replace($front, '', $structure);
}
$structure = trim($structure, '/');
$dirs = explode('/', $structure);
if ($walk_dirs) {
$dirs = explode('/', $structure);
} else {
$dirs[] = $structure;
}
$num_dirs = count($dirs);
$front = preg_replace('|^/+|', '', $front);
@ -983,6 +987,10 @@ class WP_Rewrite {
return $post_rewrite;
}
function generate_rewrite_rule($permalink_structure, $walk_dirs = false) {
return $this->generate_rewrite_rules($permalink_structure, false, false, false, $walk_dirs);
}
/* rewrite_rules
* Construct rewrite matches and queries from permalink structure.
* Returns an associate array of matches and queries.