Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/14/2015 12:31:42 AM (10 years ago)
Author:
johnjamesjacoby
Message:

Abstraction: Use bbp_db(), bbp_rewrite() & friends, introduced in r5823 & r5826.

This commit improves the stability of bbPress in the WordPress environment by reducing global variable exposure. It also comes with minimal opcode improvements in some circumstances where $GLOBALS is preferred over defining via global statements.

Some additional surrounding cleanup directly related to functions & methods being altered is also being performed here.

Fixes #2786.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/admin.php

    r5809 r5827  
    693693     */
    694694    public function suggest_topic() {
    695         global $wpdb;
    696695
    697696        // Bail early if no request
     
    710709        // Try to get some topics
    711710        $topics = get_posts( array(
    712             's'         => $wpdb->esc_like( $_REQUEST['q'] ),
     711            's'         => bbp_db()->esc_like( $_REQUEST['q'] ),
    713712            'post_type' => bbp_get_topic_post_type()
    714713        ) );
     
    729728     */
    730729    public function suggest_user() {
    731         global $wpdb;
    732730
    733731        // Bail early if no request
     
    746744        // Try to get some users
    747745        $users_query = new WP_User_Query( array(
    748             'search'         => '*' . $wpdb->esc_like( $_REQUEST['q'] ) . '*',
     746            'search'         => '*' . bbp_db()->esc_like( $_REQUEST['q'] ) . '*',
    749747            'fields'         => array( 'ID', 'user_nicename' ),
    750748            'search_columns' => array( 'ID', 'user_nicename', 'user_email' ),
     
    948946     * @since bbPress (r3689)
    949947     *
    950      * @global WPDB $wpdb
    951948     * @uses get_blog_option()
    952949     * @uses wp_remote_get()
     
    995992     * @since bbPress (r3689)
    996993     *
    997      * @global WPDB $wpdb
    998994     * @uses get_blog_option()
    999995     * @uses wp_remote_get()
    1000996     */
    1001997    public static function network_update_screen() {
    1002         global $wpdb;
     998        $bbp_db = bbp_db();
    1003999
    10041000        // Get action
     
    10191015
    10201016                // Get blogs 5 at a time
    1021                 $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
     1017                $blogs = $bbp_db->get_results( "SELECT * FROM {$bbp_db->blogs} WHERE site_id = '{$bbp_db->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
    10221018
    10231019                // No blogs so all done!
Note: See TracChangeset for help on using the changeset viewer.