Skip to:
Content

bbPress.org

Changeset 6331


Ignore:
Timestamp:
02/27/2017 10:54:08 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Bootstrap: Split setup_globals() up into 2 methods:

  • setup_environment() to handle directories, paths, urls, etc...
  • setup_variables() to handle queries, rewrite rules, bbPress specific "globals", etc...

This will allow us to use included functions as default variables later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bbpress.php

    r6320 r6331  
    113113        if ( null === $instance ) {
    114114            $instance = new bbPress;
    115             $instance->setup_globals();
     115            $instance->setup_environment();
    116116            $instance->includes();
     117            $instance->setup_variables();
    117118            $instance->setup_actions();
    118119        }
     
    190191
    191192    /**
    192      * Set some smart defaults to class variables. Allow some of them to be
    193      * filtered to allow for early overriding.
     193     * Setup the environment variables to allow the rest of bbPress to function
     194     * more easily.
    194195     *
    195196     * @since 2.0.0 bbPress (r2626)
     
    200201     * @uses apply_filters() Calls various filters
    201202     */
    202     private function setup_globals() {
     203    private function setup_environment() {
    203204
    204205        /** Versions **********************************************************/
     
    227228        $this->themes_dir   = apply_filters( 'bbp_themes_dir',   trailingslashit( $this->plugin_dir . 'templates' ) );
    228229        $this->themes_url   = apply_filters( 'bbp_themes_url',   trailingslashit( $this->plugin_url . 'templates' ) );
     230    }
     231
     232    /**
     233     * Smart defaults to many bbPress specific class variables.
     234     *
     235     * @since 2.6.0 bbPress (r6330)
     236     */
     237    private function setup_variables() {
    229238
    230239        /** Identifiers *******************************************************/
     
    265274        $this->current_reply_id     = 0; // Current reply id
    266275        $this->current_topic_tag_id = 0; // Current topic tag id
    267 
    268         $this->forum_query    = new WP_Query(); // Main forum query
    269         $this->topic_query    = new WP_Query(); // Main topic query
    270         $this->reply_query    = new WP_Query(); // Main reply query
    271         $this->search_query   = new WP_Query(); // Main search query
     276        $this->current_user_id      = 0; // Current topic tag id
     277
     278        $this->forum_query    = new WP_Query();      // Main forum query
     279        $this->topic_query    = new WP_Query();      // Main topic query
     280        $this->reply_query    = new WP_Query();      // Main reply query
     281        $this->search_query   = new WP_Query();      // Main search query
     282        $this->user_query     = new WP_User_Query(); // Main user query
    272283
    273284        /** Theme Compat ******************************************************/
Note: See TracChangeset for help on using the changeset viewer.