Use the full page hierarchy when matching page URIs. Props David House. fixes #1964

git-svn-id: https://develop.svn.wordpress.org/trunk@3229 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2005-11-29 01:43:32 +00:00
parent a2e0b5f3cc
commit 5e34745dc9
3 changed files with 52 additions and 5 deletions
+30
View File
@@ -585,6 +585,20 @@ function &get_post(&$post, $output = OBJECT) {
}
}
function set_page_path($page) {
$page->fullpath = '/' . $page->post_name;
$path = $page->fullpath;
$curpage = $page;
while ($curpage->post_parent != 0) {
$curpage = get_page($curpage->post_parent);
$path = '/' . $curpage->post_name . $path;
}
$page->fullpath = $path;
return $page;
}
// Retrieves page data given a page ID or page object.
// Handles page caching.
function &get_page(&$page, $output = OBJECT) {
@@ -612,6 +626,11 @@ function &get_page(&$page, $output = OBJECT) {
wp_cache_add($_page->ID, $_page, 'pages');
}
}
if (!isset($_page->fullpath)) {
$_page = set_page_path($_page);
wp_cache_replace($_page->cat_ID, $_page, 'pages');
}
if ( $output == OBJECT ) {
return $_page;
@@ -720,6 +739,17 @@ function get_all_category_ids() {
return $cat_ids;
}
function get_all_page_ids() {
global $wpdb;
if ( ! $page_ids = wp_cache_get('all_page_ids', 'posts') ) {
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_status='static'");
wp_cache_add('all_page_ids', $page_ids, 'pages');
}
return $page_ids;
}
function gzip_compression() {
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) return false;
if ( !get_settings('gzipcompression') ) return false;