Skip to:
Content

BuddyPress.org

Changeset 12535


Ignore:
Timestamp:
01/20/2020 06:58:31 PM (5 weeks ago)
Author:
imath
Message:

Core: fix PHP Code standards in inline comments

props passoniate

Fixes #8217

File:
1 edited

Legend:

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

    r12471 r12535  
    114114    public static function instance() {
    115115
    116         // Store the instance locally to avoid private static replication
     116        // Store the instance locally to avoid private static replication.
    117117        static $instance = null;
    118118
    119         // Only run these methods if they haven't been run previously
     119        // Only run these methods if they haven't been run previously.
    120120        if ( null === $instance ) {
    121121            $instance = new BuddyPress;
     
    127127        }
    128128
    129         // Always return the instance
     129        // Always return the instance.
    130130        return $instance;
    131131
     
    227227        }
    228228
    229         // Path and URL
     229        // Path and URL.
    230230        if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
    231231            define( 'BP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    246246        }
    247247
    248         // Only applicable to those running trunk
     248        // Only applicable to those running trunk.
    249249        if ( ! defined( 'BP_SOURCE_SUBDIRECTORY' ) ) {
    250250            define( 'BP_SOURCE_SUBDIRECTORY', '' );
    251251        }
    252252
    253         // Define on which blog ID BuddyPress should run
     253        // Define on which blog ID BuddyPress should run.
    254254        if ( ! defined( 'BP_ROOT_BLOG' ) ) {
    255255
    256             // Default to use current blog ID
    257             // Fulfills non-network installs and BP_ENABLE_MULTIBLOG installs
     256            // Default to use current blog ID.
     257            // Fulfills non-network installs and BP_ENABLE_MULTIBLOG installs.
    258258            $root_blog_id = get_current_blog_id();
    259259
    260             // Multisite check
     260            // Multisite check.
    261261            if ( is_multisite() ) {
    262262
    263                 // Multiblog isn't enabled
     263                // Multiblog isn't enabled.
    264264                if ( ! defined( 'BP_ENABLE_MULTIBLOG' ) || ( defined( 'BP_ENABLE_MULTIBLOG' ) && (int) constant( 'BP_ENABLE_MULTIBLOG' ) === 0 ) ) {
    265265                    // Check to see if BP is network-activated
     
    267267                    // /wp-admin/includes/plugin.php file in order to use that function.
    268268
    269                     // get network-activated plugins
     269                    // Get network-activated plugins.
    270270                    $plugins = get_site_option( 'active_sitewide_plugins');
    271271
    272                     // basename
     272                    // Basename.
    273273                    $basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
    274274
    275                     // plugin is network-activated; use main site ID instead
     275                    // Plugin is network-activated; use main site ID instead.
    276276                    if ( isset( $plugins[ $basename ] ) ) {
    277277                        $current_site = get_current_site();
     
    286286
    287287        // The search slug has to be defined nice and early because of the way
    288         // search requests are loaded
     288        // search requests are loaded.
    289289        //
    290         // @todo Make this better
     290        // @todo Make this better.
    291291        if ( ! defined( 'BP_SEARCH_SLUG' ) ) {
    292292            define( 'BP_SEARCH_SLUG', 'search' );
     
    372372        /** Paths**************************************************************/
    373373
    374         // BuddyPress root directory
     374        // BuddyPress root directory.
    375375        $this->file           = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php';
    376376        $this->basename       = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
     
    378378        $this->plugin_url     = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) );
    379379
    380         // Languages
     380        // Languages.
    381381        $this->lang_dir       = $this->plugin_dir . 'bp-languages';
    382382
    383         // Templates (theme compatibility)
     383        // Templates (theme compatibility).
    384384        $this->themes_dir     = $this->plugin_dir . 'bp-templates';
    385385        $this->themes_url     = $this->plugin_url . 'bp-templates';
    386386
    387         // Themes (for bp-default)
     387        // Themes (for bp-default).
    388388        $this->old_themes_dir = $this->plugin_dir . 'bp-themes';
    389389        $this->old_themes_url = $this->plugin_url . 'bp-themes';
     
    391391        /** Theme Compat ******************************************************/
    392392
    393         $this->theme_compat   = new stdClass(); // Base theme compatibility class
    394         $this->filters        = new stdClass(); // Used when adding/removing filters
     393        $this->theme_compat   = new stdClass(); // Base theme compatibility class.
     394        $this->filters        = new stdClass(); // Used when adding/removing filters.
    395395
    396396        /** Users *************************************************************/
     
    430430    private function legacy_constants() {
    431431
    432         // Define the BuddyPress version
     432        // Define the BuddyPress version.
    433433        if ( ! defined( 'BP_VERSION' ) ) {
    434434            define( 'BP_VERSION', $this->version );
    435435        }
    436436
    437         // Define the database version
     437        // Define the database version.
    438438        if ( ! defined( 'BP_DB_VERSION' ) ) {
    439439            define( 'BP_DB_VERSION', $this->db_version );
    440440        }
    441441
    442         // Define if deprecated functions should be ignored
     442        // Define if deprecated functions should be ignored.
    443443        if ( ! defined( 'BP_IGNORE_DEPRECATED' ) ) {
    444444            define( 'BP_IGNORE_DEPRECATED', true );
     
    458458        require( $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php' );
    459459
    460         // Setup the versions (after we include multisite abstraction above)
     460        // Setup the versions (after we include multisite abstraction above).
    461461        $this->versions();
    462462
    463463        /** Update/Install ****************************************************/
    464464
    465         // Theme compatibility
     465        // Theme compatibility.
    466466        require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php'     );
    467467        require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );
    468468
    469         // Require all of the BuddyPress core libraries
     469        // Require all of the BuddyPress core libraries.
    470470        require( $this->plugin_dir . 'bp-core/bp-core-dependency.php'       );
    471471        require( $this->plugin_dir . 'bp-core/bp-core-actions.php'          );
     
    490490        require( $this->plugin_dir . 'bp-core/bp-core-rest-api.php'         );
    491491
    492         // Maybe load deprecated functionality (this double negative is proof positive!)
     492        // Maybe load deprecated functionality (this double negative is proof positive!).
    493493        if ( ! bp_get_option( '_bp_ignore_deprecated_code', ! $this->load_deprecated ) ) {
    494494            require( $this->plugin_dir . 'bp-core/deprecated/1.2.php' );
     
    511511        }
    512512
    513         // Load wp-cli module if PHP 5.4+
     513        // Load wp-cli module if PHP 5.4+.
    514514        if ( defined( 'WP_CLI' ) && file_exists( $this->plugin_dir . 'cli/wp-cli-bp.php' ) && version_compare( phpversion(), '5.4.0', '>=' ) ) {
    515515            require( $this->plugin_dir . 'cli/wp-cli-bp.php' );
     
    659659    private function setup_actions() {
    660660
    661         // Add actions to plugin activation and deactivation hooks
     661        // Add actions to plugin activation and deactivation hooks.
    662662        add_action( 'activate_'   . $this->basename, 'bp_activation'   );
    663663        add_action( 'deactivate_' . $this->basename, 'bp_deactivation' );
    664664
    665         // If BuddyPress is being deactivated, do not add any actions
     665        // If BuddyPress is being deactivated, do not add any actions.
    666666        if ( bp_is_deactivation( $this->basename ) ) {
    667667            return;
     
    670670        // Array of BuddyPress core actions
    671671        $actions = array(
    672             'setup_theme',              // Setup the default theme compat
    673             'setup_current_user',       // Setup currently logged in user
    674             'register_post_types',      // Register post types
    675             'register_post_statuses',   // Register post statuses
    676             'register_taxonomies',      // Register taxonomies
    677             'register_views',           // Register the views
    678             'register_theme_directory', // Register the theme directory
    679             'register_theme_packages',  // Register bundled theme packages (bp-themes)
    680             'load_textdomain',          // Load textdomain
    681             'add_rewrite_tags',         // Add rewrite tags
    682             'generate_rewrite_rules'    // Generate rewrite rules
     672            'setup_theme',              // Setup the default theme compat.
     673            'setup_current_user',       // Setup currently logged in user.
     674            'register_post_types',      // Register post types.
     675            'register_post_statuses',   // Register post statuses.
     676            'register_taxonomies',      // Register taxonomies.
     677            'register_views',           // Register the views.
     678            'register_theme_directory', // Register the theme directory.
     679            'register_theme_packages',  // Register bundled theme packages (bp-themes).
     680            'load_textdomain',          // Load textdomain.
     681            'add_rewrite_tags',         // Add rewrite tags.
     682            'generate_rewrite_rules'    // Generate rewrite rules.
    683683        );
    684684
    685         // Add the actions
     685        // Add the actions.
    686686        foreach( $actions as $class_action ) {
    687687            if ( method_exists( $this, $class_action ) ) {
     
    709709    private function versions() {
    710710
    711         // Get the possible DB versions (boy is this gross)
     711        // Get the possible DB versions (boy is this gross).
    712712        $versions               = array();
    713713        $versions['1.6-single'] = get_blog_option( $this->root_blog_id, '_bp_db_version' );
    714714
    715         // 1.6-single exists, so trust it
     715        // 1.6-single exists, so trust it.
    716716        if ( !empty( $versions['1.6-single'] ) ) {
    717717            $this->db_version_raw = (int) $versions['1.6-single'];
    718718
    719         // If no 1.6-single exists, use the max of the others
     719        // If no 1.6-single exists, use the max of the others.
    720720        } else {
    721721            $versions['1.2']        = get_site_option(                      'bp-core-db-version' );
     
    724724            $versions['1.5-single'] = get_blog_option( $this->root_blog_id,      'bp-db-version' );
    725725
    726             // Remove empty array items
     726            // Remove empty array items.
    727727            $versions             = array_filter( $versions );
    728728            $this->db_version_raw = (int) ( !empty( $versions ) ) ? (int) max( $versions ) : 0;
     
    765765    public function register_theme_packages() {
    766766
    767         // Register the default theme compatibility package
     767        // Register the default theme compatibility package.
    768768        bp_register_theme_package( array(
    769769            'id'      => 'legacy',
     
    795795    public function setup_theme() {
    796796
    797         // Bail if something already has this under control
     797        // Bail if something already has this under control.
    798798        if ( ! empty( $this->theme_compat->theme ) ) {
    799799            return;
    800800        }
    801801
    802         // Setup the theme package to use for compatibility
     802        // Setup the theme package to use for compatibility.
    803803        bp_setup_theme_compat( bp_get_theme_package_id() );
    804804    }
Note: See TracChangeset for help on using the changeset viewer.