<!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" />
<title>[21735] trunk: Use get_post() instead of global $post.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21735">21735</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2012-09-04 16:29:28 +0000 (Tue, 04 Sep 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.
Props nacin
see <a href="http://core.trac.wordpress.org/ticket/21309">#21309</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpcommentslisttablephp">trunk/wp-admin/includes/class-wp-comments-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswpmedialisttablephp">trunk/wp-admin/includes/class-wp-media-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswppostslisttablephp">trunk/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunkwpadminincludesexportphp">trunk/wp-admin/includes/export.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
<li><a href="#trunkwpincludesauthortemplatephp">trunk/wp-includes/author-template.php</a></li>
<li><a href="#trunkwpincludescategorytemplatephp">trunk/wp-includes/category-template.php</a></li>
<li><a href="#trunkwpincludesclasswpatomserverphp">trunk/wp-includes/class-wp-atom-server.php</a></li>
<li><a href="#trunkwpincludesclasswpeditorphp">trunk/wp-includes/class-wp-editor.php</a></li>
<li><a href="#trunkwpincludescommenttemplatephp">trunk/wp-includes/comment-template.php</a></li>
<li><a href="#trunkwpincludesdeprecatedphp">trunk/wp-includes/deprecated.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="#trunkwpincludesmediaphp">trunk/wp-includes/media.php</a></li>
<li><a href="#trunkwpincludesposttemplatephp">trunk/wp-includes/post-template.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpcommentslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-comments-list-table.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-comments-list-table.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/class-wp-comments-list-table.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -302,7 +302,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function single_row( $a_comment ) {
</span><del>-                global $post, $comment;
</del><ins>+                global $comment;
+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 $comment = $a_comment;
</span><span class="cx">                 $the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );
</span><span class="lines">@@ -325,7 +326,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function column_comment( $comment ) {
</span><del>-                global $post, $comment_status;
</del><ins>+                global $comment_status;
+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 $user_can = $this->user_can;
</span><span class="cx">
</span><span class="lines">@@ -479,7 +481,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function column_response( $comment ) {
</span><del>-                global $post;
</del><ins>+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 if ( isset( $this->pending_count[$post->ID] ) ) {
</span><span class="cx">                         $pending_comments = $this->pending_count[$post->ID];
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpmedialisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-media-list-table.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-media-list-table.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/class-wp-media-list-table.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -156,7 +156,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function display_rows() {
</span><del>-                global $post, $id;
</del><ins>+                $post = get_post();
+                $id = $post->ID;
</ins><span class="cx">
</span><span class="cx">                 add_filter( 'the_title','esc_html' );
</span><span class="cx">                 $alt = '';
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-posts-list-table.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-posts-list-table.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/class-wp-posts-list-table.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -316,7 +316,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function _display_rows( $posts, $level = 0 ) {
</span><del>-                global $post, $mode;
</del><ins>+                global $mode;
</ins><span class="cx">
</span><span class="cx">                 // Create array of post IDs.
</span><span class="cx">                 $post_ids = array();
</span><span class="lines">@@ -458,12 +458,12 @@
</span><span class="cx">                 unset( $children_pages[$parent] ); //required in order to keep track of orphans
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function single_row( $a_post, $level = 0 ) {
-                global $post, $mode;
</del><ins>+        function single_row( $post, $level = 0 ) {
+                global $mode;
</ins><span class="cx">                 static $alternate;
</span><span class="cx">
</span><del>-                $global_post = $post;
-                $post = $a_post;
</del><ins>+                $global_post = get_post();
+                $GLOBALS['post'] = $post;
</ins><span class="cx">                 setup_postdata( $post );
</span><span class="cx">
</span><span class="cx">                 $edit_link = get_edit_post_link( $post->ID );
</span><span class="lines">@@ -529,7 +529,7 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 else {
</span><span class="cx">                                         $attributes = 'class="post-title page-title column-title"' . $style;
</span><del>-                                        
</del><ins>+
</ins><span class="cx">                                         $pad = str_repeat( '&#8212; ', $level );
</span><span class="cx"> ?>
</span><span class="cx">                         <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong>
</span><span class="lines">@@ -684,7 +684,7 @@
</span><span class="cx">         ?>
</span><span class="cx">                 </tr>
</span><span class="cx">         <?php
</span><del>-                $post = $global_post;
</del><ins>+                $GLOBALS['post'] = $global_post;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span></span></pre></div>
<a id="trunkwpadminincludesexportphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/export.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/export.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/export.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx">          * @since 2.3.0
</span><span class="cx">          */
</span><span class="cx">         function wxr_post_taxonomy() {
</span><del>-                global $post;
</del><ins>+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 $taxonomies = get_object_taxonomies( $post->post_type );
</span><span class="cx">                 if ( empty( $taxonomies ) )
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/meta-boxes.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -466,15 +466,15 @@
</span><span class="cx"> *
</span><span class="cx"> * @param object $post
</span><span class="cx"> */
</span><del>-function post_comment_meta_box($post) {
-        global $wpdb, $post_ID;
</del><ins>+function post_comment_meta_box( $post ) {
+        global $wpdb;
</ins><span class="cx">
</span><span class="cx">         wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
</span><span class="cx">         ?>
</span><del>-        <p class="hide-if-no-js" id="add-new-comment"><a href="#commentstatusdiv" onclick="commentReply.addcomment(<?php echo $post_ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
</del><ins>+        <p class="hide-if-no-js" id="add-new-comment"><a href="#commentstatusdiv" onclick="commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
</ins><span class="cx">         <?php
</span><span class="cx">
</span><del>-        $total = get_comments( array( 'post_id' => $post_ID, 'number' => 1, 'count' => true ) );
</del><ins>+        $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
</ins><span class="cx">         $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
</span><span class="cx">         $wp_list_table->display( true );
</span><span class="cx">
</span><span class="lines">@@ -910,8 +910,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> */
</span><del>-function post_thumbnail_meta_box() {
-        global $post;
</del><ins>+function post_thumbnail_meta_box( $post ) {
</ins><span class="cx">         $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
</span><span class="cx">         echo _wp_post_thumbnail_html( $thumbnail_id );
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/post.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -1121,16 +1121,15 @@
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><span class="cx"> * @param int $thumbnail_id ID of the attachment used for thumbnail
</span><del>- * @param int $post_id ID of the post associated with the thumbnail, defaults to global $post_ID
</del><ins>+ * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
</ins><span class="cx"> * @return string html
</span><span class="cx"> */
</span><del>-function _wp_post_thumbnail_html( $thumbnail_id = null, $post_id = null ) {
-        global $content_width, $_wp_additional_image_sizes, $post_ID;
</del><ins>+function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
+        global $content_width, $_wp_additional_image_sizes;
</ins><span class="cx">
</span><del>-        if ( empty( $post_id ) )
-                $post_id = $post_ID;
</del><ins>+        $post = get_post( $post );
</ins><span class="cx">
</span><del>-        $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post_id) );
</del><ins>+        $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
</ins><span class="cx">         $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
</span><span class="cx">         $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
</span><span class="cx">
</span><span class="lines">@@ -1142,14 +1141,14 @@
</span><span class="cx">                 else
</span><span class="cx">                         $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
</span><span class="cx">                 if ( !empty( $thumbnail_html ) ) {
</span><del>-                        $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_id" );
</del><ins>+                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
</ins><span class="cx">                         $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
</span><span class="cx">                         $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
</span><span class="cx">                 }
</span><span class="cx">                 $content_width = $old_content_width;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        return apply_filters( 'admin_post_thumbnail_html', $content, $post_id );
</del><ins>+        return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1207,8 +1206,7 @@
</span><span class="cx"> * @return none
</span><span class="cx"> */
</span><span class="cx"> function _admin_notice_post_locked() {
</span><del>-        global $post;
-
</del><ins>+        $post = get_post();
</ins><span class="cx">         $lock = explode( ':', get_post_meta( $post->ID, '_edit_lock', true ) );
</span><span class="cx">         $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
</span><span class="cx">         $last_user = get_userdata( $user );
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-admin/includes/template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -166,10 +166,9 @@
</span><span class="cx"> * @return array List of popular term IDs.
</span><span class="cx"> */
</span><span class="cx"> function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
</span><del>-        global $post_ID;
-
-        if ( $post_ID )
-                $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids'));
</del><ins>+        $post = get_post();
+        if ( $post->ID )
+                $checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
</ins><span class="cx">         else
</span><span class="cx">                 $checked_terms = array();
</span><span class="cx">
</span><span class="lines">@@ -575,7 +574,8 @@
</span><span class="cx"> * @param unknown_type $multi
</span><span class="cx"> */
</span><span class="cx"> function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
</span><del>-        global $wp_locale, $post, $comment;
</del><ins>+        global $wp_locale, $comment;
+        $post = get_post();
</ins><span class="cx">
</span><span class="cx">         if ( $for_post )
</span><span class="cx">                 $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
</span><span class="lines">@@ -670,17 +670,16 @@
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><span class="cx"> function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
</span><del>-        global $wpdb, $post_ID;
</del><ins>+        global $wpdb;
+        $post = get_post();
</ins><span class="cx">         $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
</span><span class="cx">
</span><span class="cx">         if ( $items ) {
</span><span class="cx">                 foreach ( $items as $item ) {
</span><span class="cx">                         // A page cannot be its own parent.
</span><del>-                        if (!empty ( $post_ID ) ) {
-                                if ( $item->ID == $post_ID ) {
-                                        continue;
-                                }
-                        }
</del><ins>+                        if ( $post->ID && $item->ID == $post->ID )
+                                continue;
+
</ins><span class="cx">                         $pad = str_repeat( '&nbsp;', $level * 3 );
</span><span class="cx">                         if ( $item->ID == $default)
</span><span class="cx">                                 $current = ' selected="selected"';
</span><span class="lines">@@ -1345,8 +1344,9 @@
</span><span class="cx"> * @since 2.7.0
</span><span class="cx"> */
</span><span class="cx"> function the_post_password() {
</span><del>-        global $post;
-        if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password );
</del><ins>+        $post = get_post();
+        if ( isset( $post->post_password ) )
+                echo esc_attr( $post->post_password );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1356,13 +1356,13 @@
</span><span class="cx"> * returned.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.7.0
</span><del>- * @param int $post_id The post id. If not supplied the global $post is used.
</del><ins>+ * @param mixed $post Post id or object. If not supplied the global $post is used.
</ins><span class="cx"> * @return string The post title if set
</span><span class="cx"> */
</span><del>-function _draft_or_post_title( $post_id = 0 ) {
-        $title = get_the_title($post_id);
-        if ( empty($title) )
-                $title = __('(no title)');
</del><ins>+function _draft_or_post_title( $post = 0 ) {
+        $title = get_the_title( $post );
+        if ( empty( $title ) )
+                $title = __( '(no title)' );
</ins><span class="cx">         return $title;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/admin-bar.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/admin-bar.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -419,10 +419,11 @@
</span><span class="cx"> * @since 3.1.0
</span><span class="cx"> */
</span><span class="cx"> function wp_admin_bar_edit_menu( $wp_admin_bar ) {
</span><del>-        global $post, $tag, $wp_the_query;
</del><ins>+        global $tag, $wp_the_query;
</ins><span class="cx">
</span><span class="cx">         if ( is_admin() ) {
</span><span class="cx">                 $current_screen = get_current_screen();
</span><ins>+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 if ( 'post' == $current_screen->base
</span><span class="cx">                         && 'add' != $current_screen->action
</span><span class="lines">@@ -619,7 +620,7 @@
</span><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         $title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
</span><del>-        $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
</del><ins>+        $title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
</ins><span class="cx">
</span><span class="cx">         $wp_admin_bar->add_menu( array(
</span><span class="cx">                 'id' => 'updates',
</span></span></pre></div>
<a id="trunkwpincludesauthortemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/author-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/author-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/author-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -69,8 +69,7 @@
</span><span class="cx"> * @return string The author's display name.
</span><span class="cx"> */
</span><span class="cx"> function get_the_modified_author() {
</span><del>-        global $post;
-        if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
</del><ins>+        if ( $last_id = get_post_meta( get_post()->ID, '_edit_last', true) ) {
</ins><span class="cx">                 $last_user = get_userdata($last_id);
</span><span class="cx">                 return apply_filters('the_modified_author', $last_user->display_name);
</span><span class="cx">         }
</span><span class="lines">@@ -164,8 +163,7 @@
</span><span class="cx"> * @return int The number of posts by the author.
</span><span class="cx"> */
</span><span class="cx"> function get_the_author_posts() {
</span><del>-        global $post;
-        return count_user_posts($post->post_author);
</del><ins>+        return count_user_posts( get_post()->post_author );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludescategorytemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/category-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/category-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/category-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -1054,29 +1054,21 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param int $id Post ID.
</del><ins>+ * @param mixed $post Post ID or object.
</ins><span class="cx"> * @param string $taxonomy Taxonomy name.
</span><span class="cx"> * @return array|bool False on failure. Array of term objects on success.
</span><span class="cx"> */
</span><del>-function get_the_terms( $id, $taxonomy ) {
-        global $post;
</del><ins>+function get_the_terms( $post, $taxonomy ) {
+        if ( ! $post = get_post( $post ) )
+                return false;
</ins><span class="cx">
</span><del>-         $id = (int) $id;
-
-        if ( !$id ) {
-                if ( empty( $post->ID ) )
-                        return false;
-                else
-                        $id = (int) $post->ID;
-        }
-
-        $terms = get_object_term_cache( $id, $taxonomy );
</del><ins>+        $terms = get_object_term_cache( $post->ID, $taxonomy );
</ins><span class="cx">         if ( false === $terms ) {
</span><del>-                $terms = wp_get_object_terms( $id, $taxonomy );
-                wp_cache_add($id, $terms, $taxonomy . '_relationships');
</del><ins>+                $terms = wp_get_object_terms( $post->ID, $taxonomy );
+                wp_cache_add($post->ID, $terms, $taxonomy . '_relationships');
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        $terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy );
</del><ins>+        $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
</ins><span class="cx">
</span><span class="cx">         if ( empty( $terms ) )
</span><span class="cx">                 return false;
</span></span></pre></div>
<a id="trunkwpincludesclasswpatomserverphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-atom-server.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-atom-server.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/class-wp-atom-server.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -846,10 +846,9 @@
</span><span class="cx">          * @param int $postID Post ID.
</span><span class="cx">          * @return string
</span><span class="cx">          */
</span><del>-        function get_entry_url($postID = null) {
</del><ins>+        function get_entry_url( $postID = null ) {
</ins><span class="cx">                 if (!isset($postID)) {
</span><del>-                        global $post;
-                        $postID = (int) $post->ID;
</del><ins>+                        $postID = (int) get_post()->ID;
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $url = $this->app_base . $this->ENTRY_PATH . "/$postID";
</span><span class="lines">@@ -878,8 +877,7 @@
</span><span class="cx">          */
</span><span class="cx">         function get_media_url($postID = null) {
</span><span class="cx">                 if (!isset($postID)) {
</span><del>-                        global $post;
-                        $postID = (int) $post->ID;
</del><ins>+                        $postID = (int) get_post()->ID;
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID";
</span></span></pre></div>
<a id="trunkwpincludesclasswpeditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-editor.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-editor.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/class-wp-editor.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         public static function editor_settings($editor_id, $set) {
</span><del>-                global $editor_styles, $post;
</del><ins>+                global $editor_styles;
</ins><span class="cx">                 $first_run = false;
</span><span class="cx">
</span><span class="cx">                 if ( empty(self::$first_init) ) {
</span><span class="lines">@@ -370,8 +370,8 @@
</span><span class="cx">
</span><span class="cx">                         $body_class = $editor_id;
</span><span class="cx">
</span><del>-                        if ( isset($post) )
-                                $body_class .= " post-type-$post->post_type";
</del><ins>+                        if ( $post = get_post() )
+                                $body_class .= ' post-type-' . $post->post_type;
</ins><span class="cx">
</span><span class="cx">                         if ( !empty($set['tinymce']['body_class']) ) {
</span><span class="cx">                                 $body_class .= ' ' . $set['tinymce']['body_class'];
</span><span class="lines">@@ -612,7 +612,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         public static function wp_fullscreen_html() {
</span><del>-                global $content_width, $post;
</del><ins>+                global $content_width;
+                $post = get_post();
</ins><span class="cx">
</span><span class="cx">                 $width = isset($content_width) && 800 > $content_width ? $content_width : 800;
</span><span class="cx">                 $width = $width + 22; // compensate for the padding and border
</span></span></pre></div>
<a id="trunkwpincludescommenttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/comment-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -810,12 +810,9 @@
</span><span class="cx"> * @uses $post Gets the ID of the current post for the token
</span><span class="cx"> */
</span><span class="cx"> function wp_comment_form_unfiltered_html_nonce() {
</span><del>-        global $post;
</del><ins>+        $post = get_post();
+        $post_id = $post ? $post->ID : 0;
</ins><span class="cx">
</span><del>-        $post_id = 0;
-        if ( !empty($post) )
-                $post_id = $post->ID;
-
</del><span class="cx">         if ( current_user_can( 'unfiltered_html' ) ) {
</span><span class="cx">                 wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
</span><span class="cx">                 echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
</span></span></pre></div>
<a id="trunkwpincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/deprecated.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/deprecated.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/deprecated.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -57,14 +57,14 @@
</span><span class="cx"> * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
</span><span class="cx"> */
</span><span class="cx"> function start_wp() {
</span><del>-        global $wp_query, $post;
</del><ins>+        global $wp_query;
</ins><span class="cx">
</span><span class="cx">         _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') );
</span><span class="cx">
</span><span class="cx">         // Since the old style loop is being used, advance the query iterator here.
</span><span class="cx">         $wp_query->next_post();
</span><span class="cx">
</span><del>-        setup_postdata($post);
</del><ins>+        setup_postdata( get_post() );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/general-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -1311,8 +1311,7 @@
</span><span class="cx"> * @since 1.0.0
</span><span class="cx"> */
</span><span class="cx"> function the_date_xml() {
</span><del>-        global $post;
-        echo mysql2date('Y-m-d', $post->post_date, false);
</del><ins>+        echo mysql2date( 'Y-m-d', get_post()->post_date, false );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1367,7 +1366,7 @@
</span><span class="cx"> * @return string|null Null if displaying, string if retrieving.
</span><span class="cx"> */
</span><span class="cx"> function get_the_date( $d = '' ) {
</span><del>-        global $post;
</del><ins>+        $post = get_post();
</ins><span class="cx">         $the_date = '';
</span><span class="cx">
</span><span class="cx">         if ( '' == $d )
</span><span class="lines">@@ -1528,8 +1527,8 @@
</span><span class="cx"> * @uses $post
</span><span class="cx"> */
</span><span class="cx"> function the_weekday() {
</span><del>-        global $wp_locale, $post;
-        $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
</del><ins>+        global $wp_locale;
+        $the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
</ins><span class="cx">         $the_weekday = apply_filters('the_weekday', $the_weekday);
</span><span class="cx">         echo $the_weekday;
</span><span class="cx"> }
</span><span class="lines">@@ -1546,11 +1545,11 @@
</span><span class="cx"> * @param string $after Optional Output after the date.
</span><span class="cx"> */
</span><span class="cx"> function the_weekday_date($before='',$after='') {
</span><del>-        global $wp_locale, $post, $day, $previousweekday;
</del><ins>+        global $wp_locale, $day, $previousweekday;
</ins><span class="cx">         $the_weekday_date = '';
</span><span class="cx">         if ( $currentday != $previousweekday ) {
</span><span class="cx">                 $the_weekday_date .= $before;
</span><del>-                $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
</del><ins>+                $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
</ins><span class="cx">                 $the_weekday_date .= $after;
</span><span class="cx">                 $previousweekday = $currentday;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpincludeslinktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/link-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/link-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/link-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -54,11 +54,11 @@
</span><span class="cx"> *
</span><span class="cx"> * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'.
</span><span class="cx"> */
</span><del>-function permalink_anchor($mode = 'id') {
-        global $post;
-        switch ( strtolower($mode) ) {
</del><ins>+function permalink_anchor( $mode = 'id' ) {
+        $post = get_post();
+        switch ( strtolower( $mode ) ) {
</ins><span class="cx">                 case 'title':
</span><del>-                        $title = sanitize_title($post->post_title) . '-' . $post->ID;
</del><ins>+                        $title = sanitize_title( $post->post_title ) . '-' . $post->ID;
</ins><span class="cx">                         echo '<a id="'.$title.'"></a>';
</span><span class="cx">                         break;
</span><span class="cx">                 case 'id':
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name.
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function get_permalink($id = 0, $leavename = false) {
</del><ins>+function get_permalink( $id = 0, $leavename = false ) {
</ins><span class="cx">         $rewritecode = array(
</span><span class="cx">                 '%year%',
</span><span class="cx">                 '%monthnum%',
</span><span class="lines">@@ -232,24 +232,20 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param mixed $post Optional. Post ID or object.
</ins><span class="cx"> * @param bool $leavename Optional, defaults to false. Whether to keep page name.
</span><span class="cx"> * @param bool $sample Optional, defaults to false. Is it a sample permalink.
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function get_page_link( $id = false, $leavename = false, $sample = false ) {
-        global $post;
</del><ins>+function get_page_link( $post = false, $leavename = false, $sample = false ) {
+        $post = get_post( $post );
</ins><span class="cx">
</span><del>-        $id = (int) $id;
-        if ( !$id )
-                $id = (int) $post->ID;
-
-        if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
</del><ins>+        if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
</ins><span class="cx">                 $link = home_url('/');
</span><span class="cx">         else
</span><del>-                $link = _get_page_link( $id , $leavename, $sample );
</del><ins>+                $link = _get_page_link( $post, $leavename, $sample );
</ins><span class="cx">
</span><del>-        return apply_filters('page_link', $link, $id, $sample);
</del><ins>+        return apply_filters( 'page_link', $link, $post->ID, $sample );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -260,15 +256,15 @@
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param mixed $post Optional. Post ID or object.
</ins><span class="cx"> * @param bool $leavename Optional. Leave name.
</span><span class="cx"> * @param bool $sample Optional. Sample permalink.
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function _get_page_link( $id = false, $leavename = false, $sample = false ) {
</del><ins>+function _get_page_link( $post = false, $leavename = false, $sample = false ) {
</ins><span class="cx">         global $wp_rewrite;
</span><span class="cx">
</span><del>-        $post = get_post( $id );
</del><ins>+        $post = get_post( $post );
</ins><span class="cx">
</span><span class="cx">         $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
</span><span class="cx">
</span><span class="lines">@@ -276,16 +272,16 @@
</span><span class="cx">
</span><span class="cx">         if ( !empty($link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
</span><span class="cx">                 if ( ! $leavename ) {
</span><del>-                        $link = str_replace('%pagename%', get_page_uri($id), $link);
</del><ins>+                        $link = str_replace('%pagename%', get_page_uri( $post ), $link);
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $link = home_url($link);
</span><span class="cx">                 $link = user_trailingslashit($link, 'page');
</span><span class="cx">         } else {
</span><del>-                $link = home_url("?page_id=$id");
</del><ins>+                $link = home_url( '?page_id=' . $post->ID );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        return apply_filters( '_get_page_link', $link, $id );
</del><ins>+        return apply_filters( '_get_page_link', $link, $post->ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -295,38 +291,36 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param mixed $post Optional. Post ID or object.
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function get_attachment_link($id = false) {
-        global $post, $wp_rewrite;
</del><ins>+function get_attachment_link( $post = null ) {
+        global $wp_rewrite;
</ins><span class="cx">
</span><span class="cx">         $link = false;
</span><span class="cx">
</span><del>-        if ( ! $id)
-                $id = (int) $post->ID;
</del><ins>+        $post = get_post( $post );
</ins><span class="cx">
</span><del>-        $object = get_post($id);
-        if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) {
-                $parent = get_post($object->post_parent);
</del><ins>+        if ( $wp_rewrite->using_permalinks() && ( $post->post_parent > 0 ) && ( $post->post_parent != $post->ID ) ) {
+                $parent = get_post($post->post_parent);
</ins><span class="cx">                 if ( 'page' == $parent->post_type )
</span><del>-                        $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
</del><ins>+                        $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
</ins><span class="cx">                 else
</span><del>-                        $parentlink = get_permalink( $object->post_parent );
</del><ins>+                        $parentlink = get_permalink( $post->post_parent );
</ins><span class="cx">
</span><del>-                if ( is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
-                        $name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
</del><ins>+                if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
+                        $name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
</ins><span class="cx">                 else
</span><del>-                        $name = $object->post_name;
</del><ins>+                        $name = $post->post_name;
</ins><span class="cx">
</span><span class="cx">                 if ( strpos($parentlink, '?') === false )
</span><span class="cx">                         $link = user_trailingslashit( trailingslashit($parentlink) . $name );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( ! $link )
</span><del>-                $link = home_url( "/?attachment_id=$id" );
</del><ins>+                $link = home_url( '/?attachment_id=' . $post->ID );
</ins><span class="cx">
</span><del>-        return apply_filters('attachment_link', $link, $id);
</del><ins>+        return apply_filters( 'attachment_link', $link, $post->ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -895,7 +889,7 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_edit_post_link( $id = 0, $context = 'display' ) {
</span><del>-        if ( !$post = get_post( $id ) )
</del><ins>+        if ( ! $post = get_post( $id ) )
</ins><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         if ( 'display' == $context )
</span><span class="lines">@@ -1122,9 +1116,9 @@
</span><span class="cx"> * @return mixed Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
</span><span class="cx"> */
</span><span class="cx"> function get_adjacent_post( $in_same_cat = false, $excluded_categories = '', $previous = true ) {
</span><del>-        global $post, $wpdb;
</del><ins>+        global $wpdb;
</ins><span class="cx">
</span><del>-        if ( empty( $post ) )
</del><ins>+        if ( ! $post = get_post() )
</ins><span class="cx">                 return null;
</span><span class="cx">
</span><span class="cx">         $current_post_date = $post->post_date;
</span><span class="lines">@@ -1207,10 +1201,10 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
</span><del>-        if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) )
-                $post = get_post($GLOBALS['post']->post_parent);
</del><ins>+        if ( $previous && is_attachment() && $post = get_post() )
+                $post = get_post( $post->post_parent );
</ins><span class="cx">         else
</span><del>-                $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
</del><ins>+                $post = get_adjacent_post( $in_same_cat, $excluded_categories, $previous );
</ins><span class="cx">
</span><span class="cx">         if ( empty($post) )
</span><span class="cx">                 return;
</span><span class="lines">@@ -1299,9 +1293,8 @@
</span><span class="cx"> * @return object
</span><span class="cx"> */
</span><span class="cx"> function get_boundary_post( $in_same_cat = false, $excluded_categories = '', $start = true ) {
</span><del>-        global $post;
-
-        if ( empty($post) || ! is_single() || is_attachment() )
</del><ins>+        $post = get_post();
+        if ( ! $post || ! is_single() || is_attachment() )
</ins><span class="cx">                 return null;
</span><span class="cx">
</span><span class="cx">         $cat_array = array();
</span><span class="lines">@@ -1373,7 +1366,7 @@
</span><span class="cx"> */
</span><span class="cx"> function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
</span><span class="cx">         if ( $previous && is_attachment() )
</span><del>-                $post = get_post($GLOBALS['post']->post_parent);
</del><ins>+                $post = get_post( get_post()->post_parent );
</ins><span class="cx">         else
</span><span class="cx">                 $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous);
</span><span class="cx">
</span><span class="lines">@@ -1680,11 +1673,11 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
</span><del>-        global $post, $wp_rewrite;
</del><ins>+        global $wp_rewrite;
</ins><span class="cx">
</span><span class="cx">         $pagenum = (int) $pagenum;
</span><span class="cx">
</span><del>-        $result = get_permalink( $post->ID );
</del><ins>+        $result = get_permalink();
</ins><span class="cx">
</span><span class="cx">         if ( 'newest' == get_option('default_comments_page') ) {
</span><span class="cx">                 if ( $pagenum != $max_page ) {
</span><span class="lines">@@ -2412,15 +2405,13 @@
</span><span class="cx"> * @param string $after Optional HTML to display after the link.
</span><span class="cx"> */
</span><span class="cx"> function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
</span><del>-        global $post;
-
</del><span class="cx">         if ( empty( $text ) )
</span><span class="cx">                 $text = __('This is the short link.');
</span><span class="cx">
</span><span class="cx">         if ( empty( $title ) )
</span><span class="cx">                 $title = the_title_attribute( array( 'echo' => false ) );
</span><span class="cx">
</span><del>-        $shortlink = wp_get_shortlink( $post->ID );
</del><ins>+        $shortlink = wp_get_shortlink();
</ins><span class="cx">
</span><span class="cx">         if ( !empty( $shortlink ) ) {
</span><span class="cx">                 $link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
</span></span></pre></div>
<a id="trunkwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/media.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/media.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/media.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -775,7 +775,7 @@
</span><span class="cx"> * @return string HTML content to display gallery.
</span><span class="cx"> */
</span><span class="cx"> function gallery_shortcode($attr) {
</span><del>-        global $post;
</del><ins>+        $post = get_post();
</ins><span class="cx">
</span><span class="cx">         static $instance = 0;
</span><span class="cx">         $instance++;
</span><span class="lines">@@ -928,9 +928,8 @@
</span><span class="cx"> * @param bool $prev Optional. Default is true to display previous link, false for next.
</span><span class="cx"> */
</span><span class="cx"> function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
</span><del>-        global $post;
-        $post = get_post($post);
-        $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
</del><ins>+        $post = get_post();
+        $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
</ins><span class="cx">
</span><span class="cx">         foreach ( $attachments as $k => $attachment )
</span><span class="cx">                 if ( $attachment->ID == $post->ID )
</span><span class="lines">@@ -1102,16 +1101,16 @@
</span><span class="cx">          * an AJAX request that will call WP_Embed::cache_oembed().
</span><span class="cx">          */
</span><span class="cx">         function maybe_run_ajax_cache() {
</span><del>-                global $post_ID;
</del><ins>+                $post = get_post();
</ins><span class="cx">
</span><del>-                if ( empty($post_ID) || empty($_GET['message']) || 1 != $_GET['message'] )
</del><ins>+                if ( ! $post || empty($_GET['message']) || 1 != $_GET['message'] )
</ins><span class="cx">                         return;
</span><span class="cx">
</span><span class="cx"> ?>
</span><span class="cx"> <script type="text/javascript">
</span><span class="cx"> /* <![CDATA[ */
</span><span class="cx">         jQuery(document).ready(function($){
</span><del>-                $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post_ID, 'relative' ); ?>");
</del><ins>+                $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>");
</ins><span class="cx">         });
</span><span class="cx"> /* ]]> */
</span><span class="cx"> </script>
</span><span class="lines">@@ -1167,9 +1166,9 @@
</span><span class="cx">          * @return string The embed HTML on success, otherwise the original URL.
</span><span class="cx">          */
</span><span class="cx">         function shortcode( $attr, $url = '' ) {
</span><del>-                global $post;
</del><ins>+                $post = get_post();
</ins><span class="cx">
</span><del>-                if ( empty($url) )
</del><ins>+                if ( empty( $url ) )
</ins><span class="cx">                         return '';
</span><span class="cx">
</span><span class="cx">                 $rawattr = $attr;
</span><span class="lines">@@ -1190,8 +1189,8 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $post_ID = ( !empty($post->ID) ) ? $post->ID : null;
-                if ( !empty($this->post_ID) ) // Potentially set by WP_Embed::cache_oembed()
</del><ins>+                $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null;
+                if ( ! empty( $this->post_ID ) ) // Potentially set by WP_Embed::cache_oembed()
</ins><span class="cx">                         $post_ID = $this->post_ID;
</span><span class="cx">
</span><span class="cx">                 // Unknown URL format. Let oEmbed have a go.
</span><span class="lines">@@ -1206,7 +1205,7 @@
</span><span class="cx">                                 if ( '{{unknown}}' === $cache )
</span><span class="cx">                                         return $this->maybe_make_link( $url );
</span><span class="cx">
</span><del>-                                if ( !empty($cache) )
</del><ins>+                                if ( ! empty( $cache ) )
</ins><span class="cx">                                         return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
</span><span class="cx">                         }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post-template.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post-template.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/post-template.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -26,8 +26,7 @@
</span><span class="cx"> * @return int
</span><span class="cx"> */
</span><span class="cx"> function get_the_ID() {
</span><del>-        global $post;
-        return $post->ID;
</del><ins>+        return get_post()->ID;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -97,24 +96,25 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 0.71
</span><span class="cx"> *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param mixed $post Optional. Post ID or object.
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function get_the_title( $id = 0 ) {
-        $post = get_post($id);
</del><ins>+function get_the_title( $post = 0 ) {
+        $post = get_post( $post );
</ins><span class="cx">
</span><del>-        $title = isset($post->post_title) ? $post->post_title : '';
-        $id = isset($post->ID) ? $post->ID : (int) $id;
</del><ins>+        $title = isset( $post->post_title ) ? $post->post_title : '';
+        $id = isset( $post->ID ) ? $post->ID : 0;
</ins><span class="cx">
</span><del>-        if ( !is_admin() ) {
-                if ( !empty($post->post_password) ) {
-                        $protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
-                        $title = sprintf($protected_title_format, $title);
-                } else if ( isset($post->post_status) && 'private' == $post->post_status ) {
-                        $private_title_format = apply_filters('private_title_format', __('Private: %s'));
-                        $title = sprintf($private_title_format, $title);
</del><ins>+        if ( ! is_admin() ) {
+                if ( ! empty( $post->post_password ) ) {
+                        $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) );
+                        $title = sprintf( $protected_title_format, $title );
+                } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {
+                        $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) );
+                        $title = sprintf( $private_title_format, $title );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">         return apply_filters( 'the_title', $title, $id );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -177,9 +177,11 @@
</span><span class="cx"> * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>-function get_the_content($more_link_text = null, $stripteaser = false) {
-        global $post, $more, $page, $pages, $multipage, $preview;
</del><ins>+function get_the_content( $more_link_text = null, $stripteaser = false ) {
+        global $more, $page, $pages, $multipage, $preview;
</ins><span class="cx">
</span><ins>+        $post = get_post();
+
</ins><span class="cx">         if ( null === $more_link_text )
</span><span class="cx">                 $more_link_text = __( '(more...)' );
</span><span class="cx">
</span><span class="lines">@@ -187,7 +189,7 @@
</span><span class="cx">         $hasTeaser = false;
</span><span class="cx">
</span><span class="cx">         // If post password required and it doesn't match the cookie.
</span><del>-        if ( post_password_required($post) )
</del><ins>+        if ( post_password_required() )
</ins><span class="cx">                 return get_the_password_form();
</span><span class="cx">
</span><span class="cx">         if ( $page > count($pages) ) // if the requested page doesn't exist
</span><span class="lines">@@ -259,8 +261,7 @@
</span><span class="cx">         if ( !empty( $deprecated ) )
</span><span class="cx">                 _deprecated_argument( __FUNCTION__, '2.3' );
</span><span class="cx">
</span><del>-        global $post;
-        if ( post_password_required($post) ) {
</del><ins>+        if ( post_password_required() ) {
</ins><span class="cx">                 return __( 'There is no excerpt because this is a protected post.' );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -676,7 +677,8 @@
</span><span class="cx"> * @return string Link.
</span><span class="cx"> */
</span><span class="cx"> function _wp_link_page( $i ) {
</span><del>-        global $post, $wp_rewrite;
</del><ins>+        global $wp_rewrite;
+        $post = get_post();
</ins><span class="cx">
</span><span class="cx">         if ( 1 == $i ) {
</span><span class="cx">                 $url = get_permalink();
</span><span class="lines">@@ -1171,7 +1173,7 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> function prepend_attachment($content) {
</span><del>-        global $post;
</del><ins>+        $post = get_post();
</ins><span class="cx">
</span><span class="cx">         if ( empty($post->post_type) || $post->post_type != 'attachment' )
</span><span class="cx">                 return $content;
</span><span class="lines">@@ -1198,7 +1200,7 @@
</span><span class="cx"> * @return string HTML content for password form for password protected post.
</span><span class="cx"> */
</span><span class="cx"> function get_the_password_form() {
</span><del>-        global $post;
</del><ins>+        $post = get_post();
</ins><span class="cx">         $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
</span><span class="cx">         $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
</span><span class="cx">         <p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (21734 => 21735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2012-09-04 14:44:17 UTC (rev 21734)
+++ trunk/wp-includes/post.php        2012-09-04 16:29:28 UTC (rev 21735)
</span><span class="lines">@@ -372,12 +372,12 @@
</span><span class="cx"> * @uses $wpdb
</span><span class="cx"> * @link http://codex.wordpress.org/Function_Reference/get_post
</span><span class="cx"> *
</span><del>- * @param int|object $post Post ID or post object.
</del><ins>+ * @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
</ins><span class="cx"> * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
</span><span class="cx"> * @param string $filter Optional, default is raw.
</span><span class="cx"> * @return WP_Post|null WP_Post on success or null on failure
</span><span class="cx"> */
</span><del>-function get_post( $post, $output = OBJECT, $filter = 'raw' ) {
</del><ins>+function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
</ins><span class="cx">         if ( empty( $post ) && isset( $GLOBALS['post'] ) )
</span><span class="cx">                 $post = $GLOBALS['post'];
</span><span class="cx">
</span><span class="lines">@@ -945,20 +945,13 @@
</span><span class="cx"> *
</span><span class="cx"> * @uses $post The Loop current post global
</span><span class="cx"> *
</span><del>- * @param mixed $the_post Optional. Post object or post ID.
</del><ins>+ * @param mixed $post Optional. Post object or post ID.
</ins><span class="cx"> * @return bool|string post type or false on failure.
</span><span class="cx"> */
</span><del>-function get_post_type( $the_post = false ) {
-        global $post;
</del><ins>+function get_post_type( $post = null ) {
+        if ( $post = get_post( $post ) )
+                return $post->post_type;
</ins><span class="cx">
</span><del>-        if ( false === $the_post )
-                $the_post = $post;
-        elseif ( is_numeric($the_post) )
-                $the_post = get_post($the_post);
-
-        if ( is_object($the_post) )
-                return $the_post->post_type;
-
</del><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>