Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/01/2024 05:06:17 PM (4 months ago)
Author:
espellcaste
Message:

WPCS: miscellaneous fixes for some of the files of the core component.

Closes https://github.com/buddypress/buddypress/pull/304
See #9164 and #7228

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-admin.php

    r13878 r13883  
    1111defined( 'ABSPATH' ) || exit;
    1212
    13 if ( !class_exists( 'BP_Admin' ) ) :
     13if ( class_exists( 'BP_Admin' ) ) {
     14    return;
     15}
    1416
    1517/**
     
    2931     *
    3032     * @since 1.6.0
    31      * @var string $admin_dir
     33     * @var string
    3234     */
    3335    public $admin_dir = '';
     
    3739    /**
    3840     * URL to the BuddyPress admin directory.
    39      *
    40      * @since 1.6.0
    41      * @var string $admin_url
    42      */
    43     public $admin_url = '';
    44 
    45     /**
    46      * URL to the BuddyPress images directory.
    47      *
    48      * @since 1.6.0
    49      * @var string $images_url
    50      */
    51     public $images_url = '';
    52 
    53     /**
    54      * URL to the BuddyPress admin CSS directory.
    55      *
    56      * @since 1.6.0
    57      * @var string $css_url
    58      */
    59     public $css_url = '';
    60 
    61     /**
    62      * URL to the BuddyPress admin JS directory.
    6341     *
    6442     * @since 1.6.0
    6543     * @var string
    6644     */
     45    public $admin_url = '';
     46
     47    /**
     48     * URL to the BuddyPress images directory.
     49     *
     50     * @since 1.6.0
     51     * @var string
     52     */
     53    public $images_url = '';
     54
     55    /**
     56     * URL to the BuddyPress admin CSS directory.
     57     *
     58     * @since 1.6.0
     59     * @var string
     60     */
     61    public $css_url = '';
     62
     63    /**
     64     * URL to the BuddyPress admin JS directory.
     65     *
     66     * @since 1.6.0
     67     * @var string
     68     */
    6769    public $js_url = '';
    6870
     
    7375     *
    7476     * @since 1.9.0
    75      * @var array()
     77     * @var array
    7678     */
    7779    public $notices = array();
     
    8183     *
    8284     * @since 10.0.0
    83      * @var array()
     85     * @var array
    8486     */
    8587    public $nav_tabs = array();
     
    8991     *
    9092     * @since 10.0.0
    91      * @var string()
     93     * @var string
    9294     */
    9395    public $active_nav_tab = '';
     
    9799     *
    98100     * @since 10.0.0
    99      * @var array()
     101     * @var array
    100102     */
    101103    public $submenu_pages = array();
     
    107109     *
    108110     * @since 1.6.0
    109      *
    110111     */
    111112    public function __construct() {
     
    123124        $bp = buddypress();
    124125
    125         // Paths and URLs
    126         $this->admin_dir  = trailingslashit( $bp->plugin_dir  . 'bp-core/admin' ); // Admin path.
    127         $this->admin_url  = trailingslashit( $bp->plugin_url  . 'bp-core/admin' ); // Admin url.
    128         $this->images_url = trailingslashit( $this->admin_url . 'images'        ); // Admin images URL.
    129         $this->css_url    = trailingslashit( $this->admin_url . 'css'           ); // Admin css URL.
    130         $this->js_url     = trailingslashit( $this->admin_url . 'js'            ); // Admin css URL.
     126        // Paths and URLs.
     127        $this->admin_dir  = trailingslashit( $bp->plugin_dir . 'bp-core/admin' ); // Admin path.
     128        $this->admin_url  = trailingslashit( $bp->plugin_url . 'bp-core/admin' ); // Admin url.
     129        $this->images_url = trailingslashit( $this->admin_url . 'images' ); // Admin images URL.
     130        $this->css_url    = trailingslashit( $this->admin_url . 'css' ); // Admin css URL.
     131        $this->js_url     = trailingslashit( $this->admin_url . 'js' ); // Admin css URL.
    131132
    132133        // Main settings page.
     
    159160     *
    160161     * @since 1.6.0
    161      *
    162162     */
    163163    private function setup_actions() {
     
    166166
    167167        // Add some page specific output to the <head>.
    168         add_action( 'bp_admin_head',            array( $this, 'admin_head'  ), 999 );
     168        add_action( 'bp_admin_head',            array( $this, 'admin_head' ), 999 );
    169169
    170170        // Add menu item to settings menu.
     
    225225        add_filter( 'user_row_actions',    'bp_core_admin_user_row_actions', 10, 2 );
    226226
    227         // Emails
     227        // Emails.
    228228        add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
    229229        add_action( 'load-edit.php', array( $this, 'post_type_load_admin_screen' ), 20 );
     
    232232        // Official BuddyPress supported Add-ons.
    233233        add_filter( 'install_plugins_tabs', array( $this, 'addons_tab' ) );
    234         add_filter( 'install_plugins_table_api_args_bp-add-ons', array( $this,'addons_args' ) );
     234        add_filter( 'install_plugins_table_api_args_bp-add-ons', array( $this, 'addons_args' ) );
    235235    }
    236236
     
    320320
    321321        $this->submenu_pages['settings']['bp-admin-notifications'] = $bp_admin_notifications;
    322         $hooks[]                                                   = $bp_admin_notifications;
     322        $hooks[] = $bp_admin_notifications;
    323323
    324324        // Credits.
     
    477477     *
    478478     * @since 1.6.0
    479      *
    480479     */
    481480    public function register_admin_settings() {
     
    490489        register_setting( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
    491490
    492         // Community Visibility
     491        // Community Visibility.
    493492        if ( 'rewrites' === bp_core_get_query_parser() ) {
    494493            add_settings_field( '_bp_community_visibility', __( 'Community Visibility', 'buddypress' ), 'bp_admin_setting_callback_community_visibility', 'buddypress', 'bp_main' );
     
    547546            // Profile sync setting.
    548547            add_settings_field( 'bp-disable-profile-sync',   __( 'Profile Syncing',  'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' );
    549             register_setting  ( 'buddypress', 'bp-disable-profile-sync', 'intval' );
     548            register_setting( 'buddypress', 'bp-disable-profile-sync', 'intval' );
    550549        }
    551550
     
    612611        }
    613612
    614         $wp_admin_bar->add_node( array(
    615             'parent' => 'wp-logo',
    616             'id'     => 'bp-about',
    617             'title'  => esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ),
    618             'href'   => bp_get_admin_url( '?hello=buddypress' ),
    619             'meta'   => array(
    620                 'class' => 'say-hello-buddypress',
    621             ),
    622         ) );
     613        $wp_admin_bar->add_node(
     614            array(
     615                'parent' => 'wp-logo',
     616                'id'     => 'bp-about',
     617                'title'  => esc_html_x( 'Hello, BuddyPress!', 'Colloquial alternative to "learn about BuddyPress"', 'buddypress' ),
     618                'href'   => bp_get_admin_url( '?hello=buddypress' ),
     619                'meta'   => array(
     620                    'class' => 'say-hello-buddypress',
     621                ),
     622            )
     623        );
    623624    }
    624625
     
    635636
    636637        // Return normal links if not BuddyPress.
    637         if ( plugin_basename( buddypress()->basename ) != $file ) {
     638        if ( plugin_basename( buddypress()->basename ) !== $file ) {
    638639            return $links;
    639640        }
     
    780781
    781782        // Get BuddyPress stable version.
    782         $version      =  self::display_version();
     783        $version      = self::display_version();
    783784        $version_slug = 'version-' . str_replace( '.', '-', $version );
    784785
     
    824825                        <h2>
    825826                            <?php
    826                             printf(
     827                                printf(
    827828                                    /* Translators: %s is a raising hands emoji. */
    828829                                    esc_html__( 'You now have complete control over all BuddyPress-generated URLs %s', 'buddypress' ),
     
    895896                        <h2>
    896897                            <?php
    897                             printf(
     898                                printf(
    898899                                    /* Translators: %s is a woman supervillain emoji. */
    899900                                    esc_html__( 'Here\'s another benefit of the BP Rewrites API: the new "members only" community visibility level %s', 'buddypress' ),
     
    966967                                'span' => array(
    967968                                    'class' => true,
    968                                 )
     969                                ),
    969970                            )
    970971                        );
     
    12841285        $taxonomy_object = get_taxonomy( bp_get_email_tax_type() );
    12851286
    1286         if ( is_wp_error( $terms ) || ! $terms  ) {
     1287        if ( is_wp_error( $terms ) || ! $terms ) {
    12871288            printf( '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>', esc_html( $taxonomy_object->labels->no_terms ) );
    12881289        } else {
     
    13481349
    13491350            // Check for prerelease hyphen.
    1350             $pre     = strpos( $version, '-' );
     1351            $pre = strpos( $version, '-' );
    13511352
    13521353            // Strip prerelease suffix.
     
    15711572                    }
    15721573                    %2$s',
    1573                     implode( " ", $grid_columns ),
     1574                    implode( ' ', $grid_columns ),
    15741575                    $help_tab_css
    15751576                )
     
    16121613     * @global int $paged The current page of the Plugin results.
    16131614     *
    1614      * @param false|array $args  `false` by default.
    1615      * @return array             The "BuddyPress add-ons" args.
    1616      */
    1617     public function addons_args( $args = false ) {
     1615     * @return array The "BuddyPress add-ons" args.
     1616     */
     1617    public function addons_args() {
    16181618        global $paged;
    16191619
     
    16861686    }
    16871687}
    1688 endif; // End class_exists check.
Note: See TracChangeset for help on using the changeset viewer.