Skip to:
Content

BuddyPress.org

Ticket #7653: 7653-1.diff

File 7653-1.diff, 10.1 KB (added by espellcaste, 7 years ago)
  • src/bp-core/admin/bp-core-admin-components.php

    diff --git a/src/bp-core/admin/bp-core-admin-components.php b/src/bp-core/admin/bp-core-admin-components.php
    index 79f20d6db..d94abc079 100644
    a b function bp_core_admin_components_options() { 
    5959         *
    6060         * @param mixed $value Active components.
    6161         */
    62         $active_components      = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
     62        $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
    6363
    6464        // The default components (if none are previously selected).
    6565        $default_components = array(
    6666                'xprofile' => array(
    6767                        'title'       => __( 'Extended Profiles', 'buddypress' ),
    68                         'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
     68                        'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' ),
    6969                ),
    7070                'settings' => array(
    7171                        'title'       => __( 'Account Settings', 'buddypress' ),
    72                         'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
     72                        'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' ),
    7373                ),
    7474                'notifications' => array(
    7575                        'title'       => __( 'Notifications', 'buddypress' ),
    76                         'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' )
     76                        'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' ),
    7777                ),
    7878        );
    7979
    8080        $optional_components = bp_core_admin_get_components( 'optional' );
    8181        $required_components = bp_core_admin_get_components( 'required' );
    82         $retired_components  = bp_core_admin_get_components( 'retired'  );
     82        $retired_components  = bp_core_admin_get_components( 'retired' );
    8383
    8484        // Merge optional and required together.
    8585        $all_components = $optional_components + $required_components;
    function bp_core_admin_components_options() { 
    8888        // deactivated components into activated ones.
    8989        if ( empty( $active_components ) ) {
    9090                $deactivated_components = bp_get_option( 'bp-deactivated-components' );
    91                 if ( !empty( $deactivated_components ) ) {
     91                if ( ! empty( $deactivated_components ) ) {
    9292
    9393                        // Trim off namespace and filename.
    9494                        $trimmed = array();
    function bp_core_admin_components_options() { 
    9898
    9999                        // Loop through the optional components to create an active component array.
    100100                        foreach ( array_keys( (array) $optional_components ) as $ocomponent ) {
    101                                 if ( !in_array( $ocomponent, $trimmed ) ) {
    102                                         $active_components[$ocomponent] = 1;
     101                                if ( ! in_array( $ocomponent, $trimmed, true ) ) {
     102                                        $active_components[ $ocomponent ] = 1;
    103103                                }
    104104                        }
    105105                }
    function bp_core_admin_components_options() { 
    119119
    120120        // Get the total count of all plugins.
    121121        $all_count = count( $all_components );
    122         $page      = bp_core_do_network_admin()  ? 'settings.php' : 'options-general.php';
    123         $action    = !empty( $_GET['action'] ) ? $_GET['action'] : 'all';
     122        $page      = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
     123        $action    = ! empty( $_GET['action'] ) ? $_GET['action'] : 'all';
    124124
    125         switch( $action ) {
    126                 case 'all' :
     125        switch ( $action ) {
     126                case 'all':
    127127                        $current_components = $all_components;
    128128                        break;
    129                 case 'active' :
     129                case 'active':
    130130                        foreach ( array_keys( $active_components ) as $component ) {
    131                                 $current_components[$component] = $all_components[$component];
     131                                $current_components[ $component ] = $all_components[ $component ];
    132132                        }
    133133                        break;
    134                 case 'inactive' :
     134                case 'inactive':
    135135                        foreach ( $inactive_components as $component ) {
    136                                 $current_components[$component] = $all_components[$component];
     136                                $current_components[ $component ] = $all_components[ $component ];
    137137                        }
    138138                        break;
    139                 case 'mustuse' :
     139                case 'mustuse':
    140140                        $current_components = $required_components;
    141141                        break;
    142                 case 'retired' :
     142                case 'retired':
    143143                        $current_components = $retired_components;
    144144                        break;
    145145        } ?>
    function bp_core_admin_components_options() { 
    150150        ?></h3>
    151151
    152152        <ul class="subsubsub">
    153                 <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'all'      ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'all'      ) : ?>class="current"<?php endif; ?>><?php printf( _nx( 'All <span class="count">(%s)</span>',      'All <span class="count">(%s)</span>',      $all_count,         'plugins', 'buddypress' ), number_format_i18n( $all_count                    ) ); ?></a> | </li>
    154                 <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'active'   ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'active'   ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Active <span class="count">(%s)</span>',   'Active <span class="count">(%s)</span>',   count( $active_components   ), 'buddypress' ), number_format_i18n( count( $active_components   ) ) ); ?></a> | </li>
     153                <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'all'      ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'all' ) : ?>class="current"<?php endif; ?>><?php printf( _nx( 'All <span class="count">(%s)</span>',      'All <span class="count">(%s)</span>',      $all_count,         'plugins', 'buddypress' ), number_format_i18n( $all_count                    ) ); ?></a> | </li>
     154                <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'active'   ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'active' ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Active <span class="count">(%s)</span>',   'Active <span class="count">(%s)</span>',   count( $active_components   ), 'buddypress' ), number_format_i18n( count( $active_components   ) ) ); ?></a> | </li>
    155155                <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'inactive' ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'inactive' ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', count( $inactive_components ), 'buddypress' ), number_format_i18n( count( $inactive_components ) ) ); ?></a> | </li>
    156                 <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'mustuse'  ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'mustuse'  ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count( $required_components ), 'buddypress' ), number_format_i18n( count( $required_components ) ) ); ?></a> | </li>
    157                 <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'retired'  ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'retired'  ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Retired <span class="count">(%s)</span>',  'Retired <span class="count">(%s)</span>',  count( $retired_components ),  'buddypress' ), number_format_i18n( count( $retired_components  ) ) ); ?></a></li>
     156                <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'mustuse'  ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'mustuse' ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count( $required_components ), 'buddypress' ), number_format_i18n( count( $required_components ) ) ); ?></a> | </li>
     157                <li><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bp-components', 'action' => 'retired'  ), bp_get_admin_url( $page ) ) ); ?>" <?php if ( $action === 'retired' ) : ?>class="current"<?php endif; ?>><?php printf( _n(  'Retired <span class="count">(%s)</span>',  'Retired <span class="count">(%s)</span>',  count( $retired_components ),  'buddypress' ), number_format_i18n( count( $retired_components  ) ) ); ?></a></li>
    158158        </ul>
    159159
    160160        <h3 class="screen-reader-text"><?php
    function bp_core_admin_components_options() { 
    177177
    178178                <tbody id="the-list">
    179179
    180                         <?php if ( !empty( $current_components ) ) : ?>
     180                        <?php if ( ! empty( $current_components ) ) : ?>
    181181
    182182                                <?php foreach ( $current_components as $name => $labels ) : ?>
    183183
    184                                         <?php if ( !in_array( $name, array( 'core', 'members' ) ) ) :
    185                                                 $class = isset( $active_components[esc_attr( $name )] ) ? 'active' : 'inactive';
     184                                        <?php if ( ! in_array( $name, array( 'core', 'members' ), true ) ) :
     185                                                $class = isset( $active_components[ esc_attr( $name ) ] ) ? 'active' : 'inactive';
    186186                                        else :
    187187                                                $class = 'active';
    188188                                        endif; ?>
    function bp_core_admin_components_options() { 
    190190                                        <tr id="<?php echo esc_attr( $name ); ?>" class="<?php echo esc_attr( $name ) . ' ' . esc_attr( $class ); ?>">
    191191                                                <th scope="row" class="check-column">
    192192
    193                                                         <?php if ( !in_array( $name, array( 'core', 'members' ) ) ) : ?>
     193                                                        <?php if ( ! in_array( $name, array( 'core', 'members' ), true ) ) : ?>
    194194
    195195                                                                <input type="checkbox" id="<?php echo esc_attr( "bp_components[$name]" ); ?>" name="<?php echo esc_attr( "bp_components[$name]" ); ?>" value="1"<?php checked( isset( $active_components[esc_attr( $name )] ) ); ?> /><label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" class="screen-reader-text"><?php
    196196                                                                        /* translators: accessibility text */
    function bp_core_admin_components_options() { 
    200200
    201201                                                </th>
    202202                                                <td class="plugin-title column-primary">
    203                                                         <?php if ( !in_array( $name, array( 'core', 'members' ) ) ) : ?>
     203                                                        <?php if ( ! in_array( $name, array( 'core', 'members' ), true ) ) : ?>
    204204
    205205                                                                <label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" aria-label="<?php
    206206                                                                /* translators: accessibility text */