<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16114] trunk/wp-includes: use get_queried_object() wrappers throughout.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16114">16114</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-10-31 11:02:17 +0000 (Sun, 31 Oct 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>use get_queried_object() wrappers throughout. See <a href="http://trac.wordpress.org/ticket/14015">#14015</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
<li><a href="#trunkwpincludescategorytemplatephp">trunk/wp-includes/category-template.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
<li><a href="#trunkwpincludeslinktemplatephp">trunk/wp-includes/link-template.php</a></li>
<li><a href="#trunkwpincludesthemephp">trunk/wp-includes/theme.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/admin-bar.php (16113 => 16114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php        2010-10-31 09:37:15 UTC (rev 16113)
+++ trunk/wp-includes/admin-bar.php        2010-10-31 11:02:17 UTC (rev 16114)
</span><span class="lines">@@ -173,9 +173,9 @@
</span><span class="cx"> * @since 3.1.0
</span><span class="cx"> */
</span><span class="cx"> function wp_admin_bar_edit_menu () {
</span><del>-        global $wp_admin_bar, $wp_query;
</del><ins>+        global $wp_admin_bar;
</ins><span class="cx">
</span><del>-        $current_object = $wp_query->get_queried_object();
</del><ins>+        $current_object = get_queried_object();
</ins><span class="cx">
</span><span class="cx">         if ( empty($current_object) )
</span><span class="cx">                 return;
</span></span></pre></div>
<a id="trunkwpincludescategorytemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/category-template.php (16113 => 16114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/category-template.php        2010-10-31 09:37:15 UTC (rev 16113)
+++ trunk/wp-includes/category-template.php        2010-10-31 11:02:17 UTC (rev 16114)
</span><span class="lines">@@ -465,8 +465,6 @@
</span><span class="cx">                                 $output .= $show_option_none;
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><del>-                global $wp_query;
-
</del><span class="cx">                 if( !empty( $show_option_all ) )
</span><span class="cx">                         if ( 'list' == $style )
</span><span class="cx">                                 $output .= '<li><a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a></li>';
</span><span class="lines">@@ -474,7 +472,7 @@
</span><span class="cx">                                 $output .= '<a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>';
</span><span class="cx">
</span><span class="cx">                 if ( empty( $r['current_category'] ) && ( is_category() || is_tax() ) )
</span><del>-                        $r['current_category'] = $wp_query->get_queried_object_id();
</del><ins>+                        $r['current_category'] = get_queried_object_id();
</ins><span class="cx">
</span><span class="cx">                 if ( $hierarchical )
</span><span class="cx">                         $depth = $r['depth'];
</span><span class="lines">@@ -1025,8 +1023,7 @@
</span><span class="cx"> */
</span><span class="cx"> function term_description( $term = 0, $taxonomy = 'post_tag' ) {
</span><span class="cx">         if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
</span><del>-                global $wp_query;
-                $term = $wp_query->get_queried_object();
</del><ins>+                $term = get_queried_object();
</ins><span class="cx">                 $taxonomy = $term->taxonomy;
</span><span class="cx">                 $term = $term->term_id;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (16113 => 16114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-10-31 09:37:15 UTC (rev 16113)
+++ trunk/wp-includes/general-template.php        2010-10-31 11:02:17 UTC (rev 16114)
</span><span class="lines">@@ -526,7 +526,7 @@
</span><span class="cx"> * @return string|null String on retrieve, null when displaying.
</span><span class="cx"> */
</span><span class="cx"> function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
</span><del>-        global $wpdb, $wp_locale, $wp_query;
</del><ins>+        global $wpdb, $wp_locale;
</ins><span class="cx">
</span><span class="cx">         $m = get_query_var('m');
</span><span class="cx">         $year = get_query_var('year');
</span><span class="lines">@@ -555,7 +555,7 @@
</span><span class="cx">
</span><span class="cx">         // If there's an author
</span><span class="cx">         if ( is_author() ) {
</span><del>-                $author = $wp_query->get_queried_object();
</del><ins>+                $author = get_queried_object();
</ins><span class="cx">                 $title = $author->display_name;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -633,10 +633,10 @@
</span><span class="cx"> * @return string|null Title when retrieving, null when displaying or failure.
</span><span class="cx"> */
</span><span class="cx"> function single_post_title($prefix = '', $display = true) {
</span><del>-        global $wp_query, $post;
</del><ins>+        global $post;
</ins><span class="cx">
</span><span class="cx">         if ( ! $post )
</span><del>-                $_post = $wp_query->get_queried_object();
</del><ins>+                $_post = get_queried_object();
</ins><span class="cx">         else
</span><span class="cx">                 $_post = $post;
</span><span class="cx">
</span><span class="lines">@@ -736,10 +736,8 @@
</span><span class="cx"> * @return string|null Title when retrieving, null when displaying or failure.
</span><span class="cx"> */
</span><span class="cx"> function single_term_title( $prefix = '', $display = true ) {
</span><del>-        global $wp_query;
</del><ins>+        $term = get_queried_object();
</ins><span class="cx">
</span><del>-        $term = $wp_query->get_queried_object();
-
</del><span class="cx">         if ( !$term )
</span><span class="cx">                 return;
</span><span class="cx">
</span><span class="lines">@@ -1630,8 +1628,6 @@
</span><span class="cx"> * @param array $args Optional arguments.
</span><span class="cx"> */
</span><span class="cx"> function feed_links_extra( $args = array() ) {
</span><del>-        global $wp_query;
-
</del><span class="cx">         $defaults = array(
</span><span class="cx">                 /* translators: Separator between blog name and feed type in feed links */
</span><span class="cx">                 'separator' => _x('&raquo;', 'feed link'),
</span><span class="lines">@@ -1657,12 +1653,12 @@
</span><span class="cx">                         $href = get_post_comments_feed_link( $post->ID );
</span><span class="cx">                 }
</span><span class="cx">         } elseif ( is_category() ) {
</span><del>-                $term = $wp_query->get_queried_object();
</del><ins>+                $term = get_queried_object();
</ins><span class="cx">
</span><span class="cx">                 $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ));
</span><span class="cx">                 $href = get_category_feed_link( $term->term_id );
</span><span class="cx">         } elseif ( is_tag() ) {
</span><del>-                $term = $wp_query->get_queried_object();
</del><ins>+                $term = get_queried_object();
</ins><span class="cx">
</span><span class="cx">                 $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ));
</span><span class="cx">                 $href = get_tag_feed_link( $term->term_id );
</span></span></pre></div>
<a id="trunkwpincludeslinktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/link-template.php (16113 => 16114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/link-template.php        2010-10-31 09:37:15 UTC (rev 16113)
+++ trunk/wp-includes/link-template.php        2010-10-31 11:02:17 UTC (rev 16114)
</span><span class="lines">@@ -716,8 +716,7 @@
</span><span class="cx"> */
</span><span class="cx"> function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
</span><span class="cx">         if ( is_null( $term ) ) {
</span><del>-                global $wp_query;
-                $term = $wp_query->get_queried_object();
</del><ins>+                $term = get_queried_object();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $tax = get_taxonomy( $term->taxonomy );
</span></span></pre></div>
<a id="trunkwpincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/theme.php (16113 => 16114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/theme.php        2010-10-31 09:37:15 UTC (rev 16113)
+++ trunk/wp-includes/theme.php        2010-10-31 11:02:17 UTC (rev 16114)
</span><span class="lines">@@ -855,9 +855,7 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_tag_template() {
</span><del>-        global $wp_query;
-
-        $tag = $wp_query->get_queried_object();
</del><ins>+        $tag = get_queried_object();
</ins><span class="cx">         $tag_name = $tag->slug;
</span><span class="cx">         $tag_id = $tag->term_id;
</span><span class="cx">
</span><span class="lines">@@ -961,15 +959,13 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_page_template() {
</span><del>-        global $wp_query;
-
-        $id = (int) $wp_query->get_queried_object_id();
</del><ins>+        $id = get_queried_object_id();
</ins><span class="cx">         $template = get_post_meta($id, '_wp_page_template', true);
</span><span class="cx">         $pagename = get_query_var('pagename');
</span><span class="cx">
</span><span class="cx">         if ( !$pagename && $id > 0 ) {
</span><span class="cx">                 // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
</span><del>-                $post = $wp_query->get_queried_object();
</del><ins>+                $post = get_queried_object();
</ins><span class="cx">                 $pagename = $post->post_name;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -1018,9 +1014,7 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_single_template() {
</span><del>-        global $wp_query;
-
-        $object = $wp_query->get_queried_object();
</del><ins>+        $object = get_queried_object();
</ins><span class="cx">         $templates = array('single-' . $object->post_type . '.php', 'single.php');
</span><span class="cx">
</span><span class="cx">         return get_query_template( 'single', $templates );
</span></span></pre>
</div>
</div>
</body>
</html>