Skip to:
Content

BuddyPress.org

Changeset 13109


Ignore:
Timestamp:
09/13/2021 11:08:29 PM (4 years ago)
Author:
espellcaste
Message:

Making PHPDoc Improvements to the class-buddypress.php file.

Also, adding several minor PHP changes.

Props imath

Fixes #8198 and see #8553

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/class-buddypress.php

    r13028 r13109  
    11<?php
     2/**
     3 * Main BuddyPress Class.
     4 *
     5 * @package BuddyPress
     6 * @subpackage Main
     7 * @since 1.6.0
     8 */
    29
    310// Exit if accessed directly.
     
    3138
    3239    /**
     40     * Primary BuddyPress navigation.
     41     *
    3342     * @var array Primary BuddyPress navigation.
    3443     */
     
    3645
    3746    /**
     47     * Options for the BuddyPress navigation.
     48     *
    3849     * @var array Secondary BuddyPress navigation to $bp_nav.
    3950     */
     
    4152
    4253    /**
     54     * Unfiltered URI.
     55     *
     56     * @see bp_core_set_uri_globals()
    4357     * @var array The unfiltered URI broken down into chunks.
    44      * @see bp_core_set_uri_globals()
    4558     */
    4659    public $unfiltered_uri = array();
    4760
    4861    /**
    49      * @var array The canonical URI stack.
     62     * Canonical stack.
     63     *
    5064     * @see bp_redirect_canonical()
    5165     * @see bp_core_new_nav_item()
     66     * @var array The canonical URI stack.
    5267     */
    5368    public $canonical_stack = array();
    5469
    5570    /**
     71     * Current action variables.
     72     *
    5673     * @var array Additional navigation elements (supplemental).
    5774     */
     
    5976
    6077    /**
     78     * Current member type.
     79     *
    6180     * @var string Current member directory type.
    6281     */
     
    6483
    6584    /**
     85     * BuddyPress required components.
     86     *
    6687     * @var array Required components (core, members).
    6788     */
     
    6990
    7091    /**
     92     * BuddyPress loaded components.
     93     *
    7194     * @var array Additional active components.
    7295     */
     
    7497
    7598    /**
     99     * BuddyPress active components.
     100     *
    76101     * @var array Active components.
    77102     */
     
    82107     *
    83108     * @since 2.5.0
     109     *
    84110     * @var bool
    85111     */
     
    89115
    90116    /**
     117     * BuddyPress options.
     118     *
    91119     * @var array Optional Overloads default options retrieved from get_option().
    92120     */
     
    119147        // Only run these methods if they haven't been run previously.
    120148        if ( null === $instance ) {
    121             $instance = new BuddyPress;
     149            $instance = new BuddyPress();
    122150            $instance->constants();
    123151            $instance->setup_globals();
     
    139167     *
    140168     * @since 1.7.0
     169     *
    141170     * @see BuddyPress::instance()
    142171     * @see buddypress()
    143172     */
    144     private function __construct() { /* Do nothing here */ }
     173    private function __construct() {
     174        /* Do nothing here */
     175    }
    145176
    146177    /**
     
    149180     * @since 1.7.0
    150181     */
    151     public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'buddypress' ), '1.7' ); }
     182    public function __clone() {
     183        _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'buddypress' ), '1.7' );
     184    }
    152185
    153186    /**
     
    156189     * @since 1.7.0
    157190     */
    158     public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'buddypress' ), '1.7' ); }
     191    public function __wakeup() {
     192        _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'buddypress' ), '1.7' );
     193    }
    159194
    160195    /**
     
    167202     * @return bool
    168203     */
    169     public function __isset( $key ) { return isset( $this->data[$key] ); }
     204    public function __isset( $key ) {
     205        return isset( $this->data[ $key ] );
     206    }
    170207
    171208    /**
     
    178215     * @return mixed
    179216     */
    180     public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
     217    public function __get( $key ) {
     218        return isset( $this->data[ $key ] ) ? $this->data[ $key ] : null;
     219    }
    181220
    182221    /**
     
    188227     * @param mixed  $value Value to set.
    189228     */
    190     public function __set( $key, $value ) { $this->data[$key] = $value; }
     229    public function __set( $key, $value ) {
     230        $this->data[ $key ] = $value;
     231    }
    191232
    192233    /**
     
    197238     * @param string $key Key to unset a value for.
    198239     */
    199     public function __unset( $key ) { if ( isset( $this->data[$key] ) ) unset( $this->data[$key] ); }
     240    public function __unset( $key ) {
     241        if ( isset( $this->data[ $key ] ) ) {
     242            unset( $this->data[ $key ] );
     243        }
     244    }
    200245
    201246    /**
     
    209254     * @return null
    210255     */
    211     public function __call( $name = '', $args = array() ) { unset( $name, $args ); return null; }
     256    public function __call( $name = '', $args = array() ) {
     257        unset( $name, $args );
     258
     259        return null;
     260    }
    212261
    213262    /** Private Methods *******************************************************/
     
    217266     *
    218267     * @since 1.6.0
    219      *
    220268     */
    221269    private function constants() {
     
    224272        // '/plugins/bp-custom.php' and it will be loaded before anything else.
    225273        if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) ) {
    226             require( WP_PLUGIN_DIR . '/bp-custom.php' );
     274            require WP_PLUGIN_DIR . '/bp-custom.php';
    227275        }
    228276
     
    268316
    269317                    // Get network-activated plugins.
    270                     $plugins = get_site_option( 'active_sitewide_plugins');
     318                    $plugins = get_site_option( 'active_sitewide_plugins' );
    271319
    272320                    // Basename.
     
    279327                    }
    280328                }
    281 
    282329            }
    283330
     
    298345     *
    299346     * @since 1.6.0
    300      *
    301347     */
    302348    private function setup_globals() {
    303349
    304         /** Versions **********************************************************/
     350        /** Versions */
    305351
    306352        $this->version    = '10.0.0-alpha';
    307353        $this->db_version = 12850;
    308354
    309         /** Loading ***********************************************************/
     355        /** Loading */
    310356
    311357        /**
     
    317363        $this->load_deprecated = false;
    318364
    319         /** Toolbar ***********************************************************/
     365        /** Toolbar */
    320366
    321367        /**
     
    324370        $this->my_account_menu_id = '';
    325371
    326         /** URIs **************************************************************/
     372        /** URIs */
    327373
    328374        /**
     
    337383        $this->no_status_set = false;
    338384
    339         /** Components ********************************************************/
     385        /** Components */
    340386
    341387        /**
     
    359405        $this->is_single_item = false;
    360406
    361         /** Root **************************************************************/
     407        /** Root */
    362408
    363409        /**
     
    370416        $this->root_blog_id = (int) apply_filters( 'bp_get_root_blog_id', BP_ROOT_BLOG );
    371417
    372         /** Paths**************************************************************/
     418        /** Paths */
    373419
    374420        // BuddyPress root directory.
    375         $this->file           = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php';
    376         $this->basename       = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
    377         $this->plugin_dir     = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) );
    378         $this->plugin_url     = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) );
     421        $this->file       = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php';
     422        $this->basename   = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
     423        $this->plugin_dir = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) );
     424        $this->plugin_url = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) );
    379425
    380426        // Languages.
    381         $this->lang_dir       = $this->plugin_dir . 'bp-languages';
     427        $this->lang_dir = $this->plugin_dir . 'bp-languages';
    382428
    383429        // Templates (theme compatibility).
    384         $this->themes_dir     = $this->plugin_dir . 'bp-templates';
    385         $this->themes_url     = $this->plugin_url . 'bp-templates';
     430        $this->themes_dir = $this->plugin_dir . 'bp-templates';
     431        $this->themes_url = $this->plugin_url . 'bp-templates';
    386432
    387433        // Themes (for bp-default).
     
    389435        $this->old_themes_url = $this->plugin_url . 'bp-themes';
    390436
    391         /** Theme Compat ******************************************************/
    392 
    393         $this->theme_compat   = new stdClass(); // Base theme compatibility class.
    394         $this->filters        = new stdClass(); // Used when adding/removing filters.
    395 
    396         /** Users *************************************************************/
     437        /** Theme Compat */
     438
     439        $this->theme_compat = new stdClass(); // Base theme compatibility class.
     440        $this->filters      = new stdClass(); // Used when adding/removing filters.
     441
     442        /** Users */
    397443
    398444        $this->current_user   = new stdClass();
    399445        $this->displayed_user = new stdClass();
    400446
    401         /** Post types and taxonomies *****************************************/
     447        /** Post types and taxonomies */
    402448
    403449        /**
    404450         * Filters the post type slug for the email component.
    405451         *
    406          * since 2.5.0
     452         * @since 2.5.0
    407453         *
    408454         * @param string $value Email post type slug.
    409455         */
    410         $this->email_post_type     = apply_filters( 'bp_email_post_type', 'bp-email' );
     456        $this->email_post_type = apply_filters( 'bp_email_post_type', 'bp-email' );
    411457
    412458        /**
     
    450496     *
    451497     * @since 1.6.0
    452      *
    453498     */
    454499    private function includes() {
     
    456501
    457502        // Load the WP abstraction file so BuddyPress can run on all WordPress setups.
    458         require( $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php' );
     503        require $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php';
    459504
    460505        // Setup the versions (after we include multisite abstraction above).
    461506        $this->versions();
    462507
    463         /** Update/Install ****************************************************/
     508        /** Update/Install */
    464509
    465510        // Theme compatibility.
    466         require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php'     );
    467         require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );
     511        require $this->plugin_dir . 'bp-core/bp-core-template-loader.php';
     512        require $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php';
    468513
    469514        // Require all of the BuddyPress core libraries.
    470         require( $this->plugin_dir . 'bp-core/bp-core-dependency.php'       );
    471         require( $this->plugin_dir . 'bp-core/bp-core-actions.php'          );
    472         require( $this->plugin_dir . 'bp-core/bp-core-caps.php'             );
    473         require( $this->plugin_dir . 'bp-core/bp-core-cache.php'            );
    474         require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php'            );
    475         require( $this->plugin_dir . 'bp-core/bp-core-update.php'           );
    476         require( $this->plugin_dir . 'bp-core/bp-core-options.php'          );
    477         require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php'         );
    478         require( $this->plugin_dir . 'bp-core/bp-core-filters.php'          );
    479         require( $this->plugin_dir . 'bp-core/bp-core-attachments.php'      );
    480         require( $this->plugin_dir . 'bp-core/bp-core-avatars.php'          );
    481         require( $this->plugin_dir . 'bp-core/bp-core-widgets.php'          );
    482         require( $this->plugin_dir . 'bp-core/bp-core-template.php'         );
    483         require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php'         );
    484         require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php'         );
    485         require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php'         );
    486         require( $this->plugin_dir . 'bp-core/bp-core-functions.php'        );
    487         require( $this->plugin_dir . 'bp-core/bp-core-moderation.php'       );
    488         require( $this->plugin_dir . 'bp-core/bp-core-loader.php'           );
    489         require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );
    490         require( $this->plugin_dir . 'bp-core/bp-core-rest-api.php'         );
    491         require( $this->plugin_dir . 'bp-core/bp-core-blocks.php'           );
     515        require $this->plugin_dir . 'bp-core/bp-core-dependency.php';
     516        require $this->plugin_dir . 'bp-core/bp-core-actions.php';
     517        require $this->plugin_dir . 'bp-core/bp-core-caps.php';
     518        require $this->plugin_dir . 'bp-core/bp-core-cache.php';
     519        require $this->plugin_dir . 'bp-core/bp-core-cssjs.php';
     520        require $this->plugin_dir . 'bp-core/bp-core-update.php';
     521        require $this->plugin_dir . 'bp-core/bp-core-options.php';
     522        require $this->plugin_dir . 'bp-core/bp-core-taxonomy.php';
     523        require $this->plugin_dir . 'bp-core/bp-core-filters.php';
     524        require $this->plugin_dir . 'bp-core/bp-core-attachments.php';
     525        require $this->plugin_dir . 'bp-core/bp-core-avatars.php';
     526        require $this->plugin_dir . 'bp-core/bp-core-widgets.php';
     527        require $this->plugin_dir . 'bp-core/bp-core-template.php';
     528        require $this->plugin_dir . 'bp-core/bp-core-adminbar.php';
     529        require $this->plugin_dir . 'bp-core/bp-core-buddybar.php';
     530        require $this->plugin_dir . 'bp-core/bp-core-catchuri.php';
     531        require $this->plugin_dir . 'bp-core/bp-core-functions.php';
     532        require $this->plugin_dir . 'bp-core/bp-core-moderation.php';
     533        require $this->plugin_dir . 'bp-core/bp-core-loader.php';
     534        require $this->plugin_dir . 'bp-core/bp-core-customizer-email.php';
     535        require $this->plugin_dir . 'bp-core/bp-core-rest-api.php';
     536        require $this->plugin_dir . 'bp-core/bp-core-blocks.php';
    492537
    493538        // Maybe load deprecated functionality (this double negative is proof positive!).
    494539        if ( ! bp_get_option( '_bp_ignore_deprecated_code', ! $this->load_deprecated ) ) {
    495             require( $this->plugin_dir . 'bp-core/deprecated/1.2.php' );
    496             require( $this->plugin_dir . 'bp-core/deprecated/1.5.php' );
    497             require( $this->plugin_dir . 'bp-core/deprecated/1.6.php' );
    498             require( $this->plugin_dir . 'bp-core/deprecated/1.7.php' );
    499             require( $this->plugin_dir . 'bp-core/deprecated/1.9.php' );
    500             require( $this->plugin_dir . 'bp-core/deprecated/2.0.php' );
    501             require( $this->plugin_dir . 'bp-core/deprecated/2.1.php' );
    502             require( $this->plugin_dir . 'bp-core/deprecated/2.2.php' );
    503             require( $this->plugin_dir . 'bp-core/deprecated/2.3.php' );
    504             require( $this->plugin_dir . 'bp-core/deprecated/2.4.php' );
    505             require( $this->plugin_dir . 'bp-core/deprecated/2.5.php' );
    506             require( $this->plugin_dir . 'bp-core/deprecated/2.6.php' );
    507             require( $this->plugin_dir . 'bp-core/deprecated/2.7.php' );
    508             require( $this->plugin_dir . 'bp-core/deprecated/2.8.php' );
    509             require( $this->plugin_dir . 'bp-core/deprecated/2.9.php' );
    510             require( $this->plugin_dir . 'bp-core/deprecated/3.0.php' );
    511             require( $this->plugin_dir . 'bp-core/deprecated/4.0.php' );
    512             require( $this->plugin_dir . 'bp-core/deprecated/6.0.php' );
    513             require( $this->plugin_dir . 'bp-core/deprecated/7.0.php' );
    514             require( $this->plugin_dir . 'bp-core/deprecated/8.0.php' );
    515             require( $this->plugin_dir . 'bp-core/deprecated/9.0.php' );
     540            require $this->plugin_dir . 'bp-core/deprecated/1.2.php';
     541            require $this->plugin_dir . 'bp-core/deprecated/1.5.php';
     542            require $this->plugin_dir . 'bp-core/deprecated/1.6.php';
     543            require $this->plugin_dir . 'bp-core/deprecated/1.7.php';
     544            require $this->plugin_dir . 'bp-core/deprecated/1.9.php';
     545            require $this->plugin_dir . 'bp-core/deprecated/2.0.php';
     546            require $this->plugin_dir . 'bp-core/deprecated/2.1.php';
     547            require $this->plugin_dir . 'bp-core/deprecated/2.2.php';
     548            require $this->plugin_dir . 'bp-core/deprecated/2.3.php';
     549            require $this->plugin_dir . 'bp-core/deprecated/2.4.php';
     550            require $this->plugin_dir . 'bp-core/deprecated/2.5.php';
     551            require $this->plugin_dir . 'bp-core/deprecated/2.6.php';
     552            require $this->plugin_dir . 'bp-core/deprecated/2.7.php';
     553            require $this->plugin_dir . 'bp-core/deprecated/2.8.php';
     554            require $this->plugin_dir . 'bp-core/deprecated/2.9.php';
     555            require $this->plugin_dir . 'bp-core/deprecated/3.0.php';
     556            require $this->plugin_dir . 'bp-core/deprecated/4.0.php';
     557            require $this->plugin_dir . 'bp-core/deprecated/6.0.php';
     558            require $this->plugin_dir . 'bp-core/deprecated/7.0.php';
     559            require $this->plugin_dir . 'bp-core/deprecated/8.0.php';
     560            require $this->plugin_dir . 'bp-core/deprecated/9.0.php';
    516561        }
    517562
     
    522567            && file_exists( $this->plugin_dir . 'cli/wp-cli-bp.php' )
    523568            && version_compare( phpversion(), '5.6.0', '>=' ) ) {
    524             require( $this->plugin_dir . 'cli/wp-cli-bp.php' );
     569            require $this->plugin_dir . 'cli/wp-cli-bp.php';
    525570        }
    526571    }
     
    531576     * @since 2.5.0
    532577     *
    533      * @param string $class
     578     * @param string $class Classes to be autoloaded.
     579     * @return string Path of a class.
    534580     */
    535581    public function autoload( $class ) {
     
    555601        // These classes don't have a name that matches their component.
    556602        $irregular_map = array(
    557             'BP_Akismet'                => 'activity',
    558             'BP_REST_Activity_Endpoint' => 'activity',
    559 
    560             'BP_REST_Blogs_Endpoint'                   => 'blogs',
    561             'BP_REST_Attachments_Blog_Avatar_Endpoint' => 'blogs',
    562 
    563             'BP_Admin'                     => 'core',
    564             'BP_Attachment_Avatar'         => 'core',
    565             'BP_Attachment_Cover_Image'    => 'core',
    566             'BP_Attachment'                => 'core',
    567             'BP_Button'                    => 'core',
    568             'BP_Block'                     => 'core',
    569             'BP_Component'                 => 'core',
    570             'BP_Customizer_Control_Range'  => 'core',
    571             'BP_Date_Query'                => 'core',
    572             'BP_Email_Delivery'            => 'core',
    573             'BP_Email_Address'             => 'core',
    574             'BP_Email_Recipient'           => 'core',
    575             'BP_Email_Sender'              => 'core',
    576             'BP_Email_Participant'         => 'core',
    577             'BP_Email'                     => 'core',
    578             'BP_Embed'                     => 'core',
    579             'BP_Media_Extractor'           => 'core',
    580             'BP_Members_Suggestions'       => 'core',
    581             'BP_PHPMailer'                 => 'core',
    582             'BP_Recursive_Query'           => 'core',
    583             'BP_Suggestions'               => 'core',
    584             'BP_Theme_Compat'              => 'core',
    585             'BP_User_Query'                => 'core',
    586             'BP_Walker_Category_Checklist' => 'core',
     603            'BP_Akismet'                                 => 'activity',
     604            'BP_REST_Activity_Endpoint'                  => 'activity',
     605
     606            'BP_REST_Blogs_Endpoint'                     => 'blogs',
     607            'BP_REST_Attachments_Blog_Avatar_Endpoint'   => 'blogs',
     608
     609            'BP_Admin'                                   => 'core',
     610            'BP_Attachment_Avatar'                       => 'core',
     611            'BP_Attachment_Cover_Image'                  => 'core',
     612            'BP_Attachment'                              => 'core',
     613            'BP_Button'                                  => 'core',
     614            'BP_Block'                                   => 'core',
     615            'BP_Component'                               => 'core',
     616            'BP_Customizer_Control_Range'                => 'core',
     617            'BP_Date_Query'                              => 'core',
     618            'BP_Email_Delivery'                          => 'core',
     619            'BP_Email_Address'                           => 'core',
     620            'BP_Email_Recipient'                         => 'core',
     621            'BP_Email_Sender'                            => 'core',
     622            'BP_Email_Participant'                       => 'core',
     623            'BP_Email'                                   => 'core',
     624            'BP_Embed'                                   => 'core',
     625            'BP_Media_Extractor'                         => 'core',
     626            'BP_Members_Suggestions'                     => 'core',
     627            'BP_PHPMailer'                               => 'core',
     628            'BP_Recursive_Query'                         => 'core',
     629            'BP_Suggestions'                             => 'core',
     630            'BP_Theme_Compat'                            => 'core',
     631            'BP_User_Query'                              => 'core',
     632            'BP_Walker_Category_Checklist'               => 'core',
    587633            /**
    588634             * BP_Walker_Nav_Menu_Checklist class.
     
    593639             * @todo Remove the BP_Walker_Nav_Menu_Checklist from our Classes Autoloader.
    594640             */
    595             'BP_Walker_Nav_Menu_Checklist' => 'core',
    596             'BP_Walker_Nav_Menu'           => 'core',
    597             'BP_Invitation_Manager'        => 'core',
    598             'BP_Invitation'                => 'core',
    599             'BP_REST_Components_Endpoint'  => 'core',
    600             'BP_REST_Attachments'          => 'core',
    601             'BP_Admin_Types'               => 'core',
    602             'BP_Optout'                    => 'core',
    603             'BP_Optouts_List_Table'        => 'core',
    604 
    605             'BP_Core_Friends_Widget'   => 'friends',
    606             'BP_REST_Friends_Endpoint' => 'friends',
    607 
    608             'BP_Group_Extension'                        => 'groups',
    609             'BP_Group_Member_Query'                     => 'groups',
    610             'BP_REST_Groups_Endpoint'                   => 'groups',
    611             'BP_REST_Group_Membership_Endpoint'         => 'groups',
    612             'BP_REST_Group_Invites_Endpoint'            => 'groups',
    613             'BP_REST_Group_Membership_Request_Endpoint' => 'groups',
    614             'BP_REST_Attachments_Group_Avatar_Endpoint' => 'groups',
    615             'BP_REST_Attachments_Group_Cover_Endpoint'  => 'groups',
     641            'BP_Walker_Nav_Menu_Checklist'               => 'core',
     642            'BP_Walker_Nav_Menu'                         => 'core',
     643            'BP_Invitation_Manager'                      => 'core',
     644            'BP_Invitation'                              => 'core',
     645            'BP_REST_Components_Endpoint'                => 'core',
     646            'BP_REST_Attachments'                        => 'core',
     647            'BP_Admin_Types'                             => 'core',
     648            'BP_Optout'                                  => 'core',
     649            'BP_Optouts_List_Table'                      => 'core',
     650
     651            'BP_Core_Friends_Widget'                     => 'friends',
     652            'BP_REST_Friends_Endpoint'                   => 'friends',
     653
     654            'BP_Group_Extension'                         => 'groups',
     655            'BP_Group_Member_Query'                      => 'groups',
     656            'BP_REST_Groups_Endpoint'                    => 'groups',
     657            'BP_REST_Group_Membership_Endpoint'          => 'groups',
     658            'BP_REST_Group_Invites_Endpoint'             => 'groups',
     659            'BP_REST_Group_Membership_Request_Endpoint'  => 'groups',
     660            'BP_REST_Attachments_Group_Avatar_Endpoint'  => 'groups',
     661            'BP_REST_Attachments_Group_Cover_Endpoint'   => 'groups',
    616662
    617663            'BP_Core_Members_Template'                   => 'members',
     
    628674            'BP_Members_Invitations_Template'            => 'members',
    629675
    630             'BP_REST_Messages_Endpoint' => 'messages',
    631 
    632             'BP_REST_Notifications_Endpoint' => 'notifications',
    633 
    634             'BP_REST_XProfile_Fields_Endpoint'       => 'xprofile',
    635             'BP_REST_XProfile_Field_Groups_Endpoint' => 'xprofile',
    636             'BP_REST_XProfile_Data_Endpoint'         => 'xprofile',
     676            'BP_REST_Messages_Endpoint'                  => 'messages',
     677
     678            'BP_REST_Notifications_Endpoint'             => 'notifications',
     679
     680            'BP_REST_XProfile_Fields_Endpoint'           => 'xprofile',
     681            'BP_REST_XProfile_Field_Groups_Endpoint'     => 'xprofile',
     682            'BP_REST_XProfile_Data_Endpoint'             => 'xprofile',
    637683        );
    638684
     
    685731     *
    686732     * @since 1.6.0
    687      *
    688733     */
    689734    private function setup_actions() {
    690735
    691736        // Add actions to plugin activation and deactivation hooks.
    692         add_action( 'activate_'   . $this->basename, 'bp_activation'  );
     737        add_action( 'activate_' . $this->basename, 'bp_activation' );
    693738        add_action( 'deactivate_' . $this->basename, 'bp_deactivation' );
    694739
     
    698743        }
    699744
    700         // Array of BuddyPress core actions
     745        // Array of BuddyPress core actions.
    701746        $actions = array(
    702747            'setup_theme',              // Setup the default theme compat.
     
    710755            'load_textdomain',          // Load textdomain.
    711756            'add_rewrite_tags',         // Add rewrite tags.
    712             'generate_rewrite_rules'    // Generate rewrite rules.
     757            'generate_rewrite_rules',    // Generate rewrite rules.
    713758        );
    714759
    715760        // Add the actions.
    716         foreach( $actions as $class_action ) {
     761        foreach ( $actions as $class_action ) {
    717762            if ( method_exists( $this, $class_action ) ) {
    718763                add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 );
     
    744789
    745790        // 1.6-single exists, so trust it.
    746         if ( !empty( $versions['1.6-single'] ) ) {
     791        if ( ! empty( $versions['1.6-single'] ) ) {
    747792            $this->db_version_raw = (int) $versions['1.6-single'];
    748793
    749794        // If no 1.6-single exists, use the max of the others.
    750795        } else {
    751             $versions['1.2']        = get_site_option(                      'bp-core-db-version' );
    752             $versions['1.5-multi']  = get_site_option(                           'bp-db-version' );
    753             $versions['1.6-multi']  = get_site_option(                          '_bp_db_version' );
    754             $versions['1.5-single'] = get_blog_option( $this->root_blog_id,      'bp-db-version' );
     796            $versions['1.2']        = get_site_option( 'bp-core-db-version' );
     797            $versions['1.5-multi']  = get_site_option( 'bp-db-version' );
     798            $versions['1.6-multi']  = get_site_option( '_bp_db_version' );
     799            $versions['1.5-single'] = get_blog_option( $this->root_blog_id, 'bp-db-version' );
    755800
    756801            // Remove empty array items.
    757802            $versions             = array_filter( $versions );
    758             $this->db_version_raw = (int) ( !empty( $versions ) ) ? (int) max( $versions ) : 0;
     803            $this->db_version_raw = (int) ( ! empty( $versions ) ) ? (int) max( $versions ) : 0;
    759804        }
    760805    }
     
    796841
    797842        // Register the default theme compatibility package.
    798         bp_register_theme_package( array(
    799             'id'      => 'legacy',
    800             'name'    => __( 'BuddyPress Legacy', 'buddypress' ),
    801             'version' => bp_get_version(),
    802             'dir'     => trailingslashit( $this->themes_dir . '/bp-legacy' ),
    803             'url'     => trailingslashit( $this->themes_url . '/bp-legacy' )
    804         ) );
    805 
    806         bp_register_theme_package( array(
    807             'id'      => 'nouveau',
    808             'name'    => __( 'BuddyPress Nouveau', 'buddypress' ),
    809             'version' => bp_get_version(),
    810             'dir'     => trailingslashit( $this->themes_dir . '/bp-nouveau' ),
    811             'url'     => trailingslashit( $this->themes_url . '/bp-nouveau' )
    812         ) );
     843        bp_register_theme_package(
     844            array(
     845                'id'      => 'legacy',
     846                'name'    => __( 'BuddyPress Legacy', 'buddypress' ),
     847                'version' => bp_get_version(),
     848                'dir'     => trailingslashit( $this->themes_dir . '/bp-legacy' ),
     849                'url'     => trailingslashit( $this->themes_url . '/bp-legacy' ),
     850            )
     851        );
     852
     853        bp_register_theme_package(
     854            array(
     855                'id'      => 'nouveau',
     856                'name'    => __( 'BuddyPress Nouveau', 'buddypress' ),
     857                'version' => bp_get_version(),
     858                'dir'     => trailingslashit( $this->themes_dir . '/bp-nouveau' ),
     859                'url'     => trailingslashit( $this->themes_url . '/bp-nouveau' ),
     860            )
     861        );
    813862
    814863        // Register the basic theme stack. This is really dope.
    815864        bp_register_template_stack( 'get_stylesheet_directory', 10 );
    816         bp_register_template_stack( 'get_template_directory',   12 );
    817         bp_register_template_stack( 'bp_get_theme_compat_dir',  14 );
     865        bp_register_template_stack( 'get_template_directory', 12 );
     866        bp_register_template_stack( 'bp_get_theme_compat_dir', 14 );
    818867    }
    819868
Note: See TracChangeset for help on using the changeset viewer.