Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/10/2024 05:10:17 PM (2 years ago)
Author:
imath
Message:

WPCS: improve BP Nouveau's main functions file code formatting.

Props narenin

Fixes #9230
See #9174
Closes ​https://github.com/buddypress/buddypress/pull/372

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress-functions.php

    r14003 r14022  
    55 * @since 3.0.0
    66 * @package BuddyPress
    7  * @version 12.0.0
     7 * @version 15.0.0
    88 *
    99 * @buddypress-template-pack {
    … …  
    5151        public static function get_instance() {
    5252                if ( null === self::$instance ) {
    53                         self::$instance = new self;
     53                        self::$instance = new self();
    5454                }
    5555
    … …  
    101101                        require $this->includes_dir . 'ajax.php';
    102102
    103                 // Load AJAX code only on AJAX requests.
     103                        // Load AJAX code only on AJAX requests.
    104104                } else {
    105                         add_action( 'admin_init', function () {
    106                                 if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX ) {
    107                                         require bp_nouveau()->includes_dir . 'ajax.php';
    108                                 }
    109                         }, 0 );
     105                        add_action(
     106                                'admin_init',
     107                                function () {
     108                                        if ( wp_doing_ajax() ) {
     109                                                require bp_nouveau()->includes_dir . 'ajax.php';
     110                                        }
     111                                },
     112                                0
     113                        );
    110114                }
    111115
    … …  
    122126                        );
    123127
    124                         // When BP Classic is activated, regular themes need this filter. 
     128                        // When BP Classic is activated, regular themes need this filter.
    125129                        if ( function_exists( 'bp_classic' ) ) {
    126130                                // Set the BP Uri for the Ajax customizer preview.
    … …  
    138142                        }
    139143
    140                         require( $component_loader );
     144                        require $component_loader;
    141145                }
    142146
    … …  
    242246                add_action( 'bp_nouveau_feedback_messages', array( $this, 'filter_registration_messages' ), 99 );
    243247
    244                 /** Override **********************************************************/
    245 
    246248                /**
    247249                 * Fires after all of the BuddyPress theme compat actions have been added.
    … …  
    287289                 * @param array $value Array of styles to enqueue.
    288290                 */
    289                 $styles = apply_filters( 'bp_nouveau_enqueue_styles', array(
    290                         'bp-nouveau' => array(
    291                                 'file' => 'css/buddypress%1$s%2$s.css', 'dependencies' => $css_dependencies, 'version' => $this->version,
    292                         ),
    293                         'bp-nouveau-priority-nav' => array(
    294                                 'file' => 'css/priority-nav%1$s%2$s.css', 'dependencies' => array( 'dashicons' ), 'version' => $this->version,
    295                         ),
    296                 ) );
     291                $styles = apply_filters(
     292                        'bp_nouveau_enqueue_styles',
     293                        array(
     294                                'bp-nouveau'              => array(
     295                                        'file'         => 'css/buddypress%1$s%2$s.css',
     296                                        'dependencies' => $css_dependencies,
     297                                        'version'      => $this->version,
     298                                ),
     299                                'bp-nouveau-priority-nav' => array(
     300                                        'file'         => 'css/priority-nav%1$s%2$s.css',
     301                                        'dependencies' => array( 'dashicons' ),
     302                                        'version'      => $this->version,
     303                                ),
     304                        )
     305                );
    297306
    298307                if ( $styles ) {
    … …  
    388397                        'bp_nouveau_register_scripts',
    389398                        array(
    390                                 'bp-nouveau' => array(
     399                                'bp-nouveau'               => array(
    391400                                        'file'         => 'js/buddypress-nouveau%s.js',
    392401                                        'dependencies' => $dependencies,
    … …  
    399408                                        'version'      => $this->version,
    400409                                        'footer'       => true,
    401                                 )
     410                                ),
    402411                        )
    403412                );
    … …  
    493502        public function localize_scripts() {
    494503                $params = array(
    495                         'ajaxurl'             => bp_core_ajax_url(),
    496                         'confirm'             => __( 'Are you sure?', 'buddypress' ),
     504                        'ajaxurl'           => bp_core_ajax_url(),
     505                        'confirm'           => __( 'Are you sure?', 'buddypress' ),
    497506
    498507                        /* translators: %s: number of activity comments */
    499                         'show_x_comments'     => __( 'Show all %d comments', 'buddypress' ),
    500                         'unsaved_changes'     => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
    501                         'object_nav_parent'   => '#buddypress',
     508                        'show_x_comments'   => __( 'Show all %d comments', 'buddypress' ),
     509                        'unsaved_changes'   => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
     510                        'object_nav_parent' => '#buddypress',
    502511                );
    503512
    … …  
    678687
    679688                foreach ( $nav_items as $nav_item ) {
    680                         if ( empty( $nav_item['component'] ) || $nav_item['component'] !== bp_current_component() ) {
     689                        if ( empty( $nav_item['component'] ) || bp_current_component() !== $nav_item['component'] ) {
    681690                                continue;
    682691                        }
Note: See TracChangeset for help on using the changeset viewer.