diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
| commit | 3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch) | |
| tree | 2a06e5261263c68d8afd95a6328879dc289cb909 /wp-includes/classes.php | |
| parent | b83c34a7010faee0223f6037025c350da12e05e6 (diff) | |
| download | wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip | |
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/classes.php')
| -rw-r--r-- | wp-includes/classes.php | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php index dd05256..6e55c45 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -1,9 +1,9 @@ <?php class WP { - var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots'); + var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots'); - var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type'); + var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id'); var $extra_query_vars = array(); var $query_vars; @@ -17,6 +17,10 @@ class WP { $this->public_query_vars[] = $qv; } + function set_query_var($key, $value) { + $this->query_vars[$key] = $value; + } + function parse_request($extra_query_vars = '') { global $wp_rewrite; @@ -176,9 +180,9 @@ class WP { status_header( 404 ); if ( !is_user_logged_in() ) nocache_headers(); - @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); + @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); } else if ( empty($this->query_vars['feed']) ) { - @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); + @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); } else { // We're showing a feed, so WP is indeed the only thing that last changed if ( $this->query_vars['withcomments'] @@ -507,10 +511,10 @@ class Walker_Page extends Walker { if ( $depth ) $indent = str_repeat("\t", $depth); extract($args, EXTR_SKIP); - $css_class = 'page_item'; + $css_class = 'page_item page-item-'.$page->ID; $_current_page = get_page( $current_page ); if ( $page->ID == $current_page ) - $css_class .= ' current_page_item'; + $css_class .= ' current_page_item '; elseif ( $_current_page && $page->ID == $_current_page->post_parent ) $css_class .= ' current_page_parent'; @@ -557,7 +561,7 @@ class Walker_PageDropdown extends Walker { class Walker_Category extends Walker { var $tree_type = 'category'; - var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this + var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this function start_lvl($output, $depth, $args) { if ( 'list' != $args['style'] ) @@ -580,13 +584,13 @@ class Walker_Category extends Walker { function start_el($output, $category, $depth, $args) { extract($args); - $cat_name = attribute_escape( $category->cat_name); + $cat_name = attribute_escape( $category->name); $cat_name = apply_filters( 'list_cats', $cat_name, $category ); - $link = '<a href="' . get_category_link( $category->cat_ID ) . '" '; - if ( $use_desc_for_title == 0 || empty($category->category_description) ) + $link = '<a href="' . get_category_link( $category->term_id ) . '" '; + if ( $use_desc_for_title == 0 || empty($category->description) ) $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"'; else - $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->category_description, $category )) . '"'; + $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"'; $link .= '>'; $link .= $cat_name . '</a>'; @@ -596,7 +600,7 @@ class Walker_Category extends Walker { if ( empty($feed_image) ) $link .= '('; - $link .= '<a href="' . get_category_rss_link( 0, $category->cat_ID, $category->category_nicename ) . '"'; + $link .= '<a href="' . get_category_rss_link( 0, $category->term_id, $category->slug ) . '"'; if ( empty($feed) ) $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"'; @@ -619,7 +623,7 @@ class Walker_Category extends Walker { } if ( isset($show_count) && $show_count ) - $link .= ' (' . intval($category->category_count) . ')'; + $link .= ' (' . intval($category->count) . ')'; if ( isset($show_date) && $show_date ) { $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); @@ -630,10 +634,12 @@ class Walker_Category extends Walker { if ( 'list' == $args['style'] ) { $output .= "\t<li"; - if ( $current_category && ($category->cat_ID == $current_category) ) - $output .= ' class="current-cat"'; - elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) ) - $output .= ' class="current-cat-parent"'; + $class = 'cat-item cat-item-'.$category->term_id; + if ( $current_category && ($category->term_id == $current_category) ) + $class .= ' current-cat'; + elseif ( $_current_category && ($category->term_id == $_current_category->parent) ) + $class .= ' current-cat-parent'; + $output .= ' class="'.$class.'"'; $output .= ">$link\n"; } else { $output .= "\t$link<br />\n"; @@ -654,19 +660,19 @@ class Walker_Category extends Walker { class Walker_CategoryDropdown extends Walker { var $tree_type = 'category'; - var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this + var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this function start_el($output, $category, $depth, $args) { $pad = str_repeat(' ', $depth * 3); - $cat_name = apply_filters('list_cats', $category->cat_name, $category); - $output .= "\t<option value=\"".$category->cat_ID."\""; - if ( $category->cat_ID == $args['selected'] ) + $cat_name = apply_filters('list_cats', $category->name, $category); + $output .= "\t<option value=\"".$category->term_id."\""; + if ( $category->term_id == $args['selected'] ) $output .= ' selected="selected"'; $output .= '>'; $output .= $pad.$cat_name; if ( $args['show_count'] ) - $output .= ' ('. $category->category_count .')'; + $output .= ' ('. $category->count .')'; if ( $args['show_last_update'] ) { $format = 'Y-m-d'; $output .= ' ' . gmdate($format, $category->last_update_timestamp); @@ -687,16 +693,14 @@ class WP_Ajax_Response { // a WP_Error object can be passed in 'id' or 'data' function add( $args = '' ) { - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, - 'data' => '', 'supplemental' => array()); + $defaults = array( + 'what' => 'object', 'action' => false, + 'id' => '0', 'old_id' => false, + 'data' => '', 'supplemental' => array() + ); - $r = array_merge($defaults, $r); - extract($r, EXTR_SKIP); + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); if ( is_wp_error($id) ) { $data = $id; @@ -731,7 +735,7 @@ class WP_Ajax_Response { } function send() { - header('Content-type: text/xml'); + header('Content-Type: text/xml'); echo "<?xml version='1.0' standalone='yes'?><wp_ajax>"; foreach ( $this->responses as $response ) echo $response; |
