Make WordPress Core

Ticket #14408: 14408.3.diff

File 14408.3.diff, 1.6 KB (added by obenland, 10 years ago)
  • wp-includes/class-wp.php

     
    441441         * WordPress environment.
    442442         *
    443443         * @global string $query_string Query string for the loop.
     444         * @global array $posts The found posts.
     445         * @global WP_Post|null $post The current post, if available.
     446         * @global string $request The SQL statement for the request.
    444447         * @global int $more Only set, if single page or post.
    445448         * @global int $single If single page or post. Only set, if single page or post.
     449         * @global WP_User $authordata Only set, if author archive.
    446450         *
    447451         * @since 2.0.0
    448452         */
    449453        function register_globals() {
    450454                global $wp_query;
     455
    451456                // Extract updated query vars back into global namespace.
    452                 foreach ( (array) $wp_query->query_vars as $key => $value) {
    453                         $GLOBALS[$key] = $value;
     457                foreach ( (array) $wp_query->query_vars as $key => $value ) {
     458                        $GLOBALS[ $key ] = $value;
    454459                }
    455460
    456461                $GLOBALS['query_string'] = $this->query_string;
    457462                $GLOBALS['posts'] = & $wp_query->posts;
    458                 $GLOBALS['post'] = (isset($wp_query->post)) ? $wp_query->post : null;
     463                $GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null;
    459464                $GLOBALS['request'] = $wp_query->request;
    460465
    461                 if ( is_single() || is_page() ) {
    462                         $GLOBALS['more'] = 1;
     466                if ( $wp_query->is_single() || $wp_query->is_page() ) {
     467                        $GLOBALS['more']   = 1;
    463468                        $GLOBALS['single'] = 1;
    464469                }
     470
     471                if ( $wp_query->is_author() )
     472                        $GLOBALS['authordata'] = $wp_query->get_queried_object();
    465473        }
    466474
    467475        /**