diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-24 17:00:10 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-24 17:00:10 +0000 |
| commit | 631c9bb4d60d242432052f56c00768392f42a392 (patch) | |
| tree | 50d41b0248d5c5fb156c6d52020675208b77a3e6 /wp-includes/post.php | |
| parent | a1fbe4e0694a66d7351e2f6280ab84568681e8e0 (diff) | |
| download | wordpress-mu-631c9bb4d60d242432052f56c00768392f42a392.tar.gz wordpress-mu-631c9bb4d60d242432052f56c00768392f42a392.tar.xz wordpress-mu-631c9bb4d60d242432052f56c00768392f42a392.zip | |
WP Merge to revision 8180
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1336 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/post.php')
| -rw-r--r-- | wp-includes/post.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/wp-includes/post.php b/wp-includes/post.php index c054b8d..d7605cd 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1,6 +1,10 @@ <?php /** - * Post functions and post utility function + * Post functions and post utility function. + * + * Warning: The inline documentation for the functions contained + * in this file might be inaccurate, so the documentation is not + * authoritative at the moment. * * @package WordPress * @subpackage Post @@ -166,6 +170,8 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') { $post = (int) $post; if ( ! $_post = wp_cache_get($post, 'posts') ) { $_post = & $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post)); + if ( ! $_post ) + return $null; _get_post_ancestors($_post); wp_cache_add($_post->ID, $_post, 'posts'); } @@ -750,16 +756,26 @@ function sanitize_post_field($field, $value, $post_id, $context) { } /** - * wp_count_posts() - Count number of posts with a given type + * Count number of posts of a post type and is permissible. * - * {@internal Missing Long Description}} + * This function provides an efficient method of finding the amount + * of post's type a blog has. Another method is to count the amount + * of items in get_posts(), but that method has a lot of overhead + * with doing so. Therefore, when developing for 2.5+, use this + * function instead. + * + * The $perm parameter checks for 'readable' value and if the user + * can read private posts, it will display that for the user that + * is signed in. * * @package WordPress * @subpackage Post * @since 2.5 + * @link http://codex.wordpress.org/Template_Tags/wp_count_posts * - * @param string $type Post type - * @return array Number of posts for each status + * @param string $type Optional. Post type to retrieve count + * @param string $perm Optional. 'readable' or empty. + * @return object Number of posts for each status */ function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; @@ -1813,7 +1829,7 @@ function get_page_hierarchy($posts, $parent = 0) { */ function get_page_uri($page_id) { $page = get_page($page_id); - $uri = urldecode($page->post_name); + $uri = $page->post_name; // A page cannot be it's own parent. if ( $page->post_parent == $page->ID ) @@ -1821,7 +1837,7 @@ function get_page_uri($page_id) { while ($page->post_parent != 0) { $page = get_page($page->post_parent); - $uri = urldecode($page->post_name) . "/" . $uri; + $uri = $page->post_name . "/" . $uri; } return $uri; |
