WordPress.org

Make WordPress Core

Ticket #15233: 15233.001.diff

File 15233.001.diff, 5.2 KB (added by aaroncampbell, 8 years ago)
  • wp-app.php

     
    387387         * @since 2.2.0
    388388         */
    389389        function create_post() {
    390                 global $blog_id, $user_ID;
     390                global $user_ID;
    391391                $this->get_accepted_content_type($this->atom_content_types);
    392392
    393393                $parser = new AtomParser();
     
    419419                if ( !current_user_can($cap) )
    420420                        $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
    421421
    422                 $blog_ID = (int ) $blog_id;
     422                $blog_ID = get_current_blog_id();
    423423                $post_status = ($publish) ? 'publish' : 'draft';
    424424                $post_author = (int) $user_ID;
    425425                $post_title = $entry->title[1];
  • wp-includes/admin-bar/admin-bar-class.php

     
    66        var $changed_locale = false;
    77
    88        function WP_Admin_Bar() {
    9                 global $current_user, $blog_id;
     9                global $current_user;
    1010
    1111                $this->user = new stdClass;
    1212                $this->menu = new stdClass;
     
    1818                        $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
    1919                        $this->user->account_domain = $this->user->domain;
    2020                } else {
    21                         $this->user->active_blog = $this->user->blogs[$blog_id];
     21                        $this->user->active_blog = $this->user->blogs[get_current_blog_id()];
    2222                        $this->user->domain = trailingslashit( home_url() );
    2323                        $this->user->account_domain = $this->user->domain;
    2424                }
     
    7171        function remove_menu( $id ) {
    7272                return $this->remove_node( $id, $this->menu );
    7373        }
    74        
     74
    7575        function render() {
    7676        ?>
    7777                <div id="wpadminbar" class="snap_nopreview no-grav">
  • wp-includes/general-template.php

     
    492492}
    493493
    494494/**
     495 * Retrieve the current blog id
     496 *
     497 * @since 3.1.0
     498 *
     499 * @return int Blog id
     500 */
     501function get_current_blog_id() {
     502        global $blog_id;
     503        return absint($blog_id);
     504}
     505
     506/**
    495507 * Display or retrieve page title for all areas of blog.
    496508 *
    497509 * By default, the page title will display the separator before the page title,
  • wp-includes/post.php

     
    10161016 *   behave like edit_posts.
    10171017 * - publish_posts - Controls publishing objects of this post type.
    10181018 * - read_private_posts - Controls whether private objects can be read.
    1019  
     1019
    10201020 * These four primitive capabilities are checked in core in various locations.
    10211021 * There are also seven other primitive capabilities which are not referenced
    10221022 * directly in core, except in map_meta_cap(), which takes the three aforementioned
     
    22652265                'meta_value' =>'', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private',
    22662266                'suppress_filters' => true
    22672267        );
    2268        
     2268
    22692269        $r = wp_parse_args( $args, $defaults );
    22702270
    22712271        $results = get_posts( $r );
    2272        
     2272
    22732273        // Backward compatibility. Prior to 3.1 expected posts to be returned in array
    22742274        if ( ARRAY_A == $output ){
    22752275                foreach( $results as $key => $result ) {
     
    41414141 * @return string The date.
    41424142 */
    41434143function _get_last_post_time( $timezone, $field ) {
    4144         global $wpdb, $blog_id;
     4144        global $wpdb;
    41454145
    41464146        if ( !in_array( $field, array( 'date', 'modified' ) ) )
    41474147                return false;
     
    41524152
    41534153        $post_types = apply_filters( "get_lastpost{$field}_post_types", (array) $post_types );
    41544154
    4155         $key = "lastpost{$field}:$blog_id:$timezone:" . md5( serialize( $post_types ) );
     4155        $key = "lastpost{$field}:" . get_current_blog_id() . ":$timezone:" . md5( serialize( $post_types ) );
    41564156
    41574157        $date = wp_cache_get( $key, 'timeinfo' );
    41584158
  • wp-includes/user.php

     
    376376                        $this->query_vars = wp_parse_args( $query, array(
    377377                                'blog_id' => $GLOBALS['blog_id'],
    378378                                'role' => '',
    379                                 'meta_key' => '', 
     379                                'meta_key' => '',
    380380                                'meta_value' => '',
    381381                                'meta_compare' => '',
    382382                                'include' => array(),
     
    572572 * @return array List of users that are part of that Blog ID
    573573 */
    574574function get_users_of_blog( $id = '' ) {
    575         global $blog_id;
    576 
    577575        if ( empty( $id ) )
    578                 $id = (int) $blog_id;
     576                $id = get_current_blog_id();
    579577
    580578        return get_users( array( 'blog_id' => $id ) );
    581579}
     
    593591        global $wpdb;
    594592
    595593        if ( !is_multisite() ) {
    596                 global $blog_id;
     594                $blog_id = get_current_blog_id();
    597595                $blogs = array();
    598596                $blogs[ $blog_id ]->userblog_id = $blog_id;
    599597                $blogs[ $blog_id ]->blogname = get_option('blogname');
     
    757755 * @return array Includes a grand total and an array of counts indexed by role strings.
    758756 */
    759757function count_users($strategy = 'time') {
    760         global $wpdb, $blog_id, $wp_roles;
     758        global $wpdb, $wp_roles;
    761759
    762760        // Initialize
    763         $id = (int) $blog_id;
     761        $id = get_current_blog_id();
    764762        $blog_prefix = $wpdb->get_blog_prefix($id);
    765763        $result = array();
    766764