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() { |
59 | 59 | * |
60 | 60 | * @param mixed $value Active components. |
61 | 61 | */ |
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' ) ); |
63 | 63 | |
64 | 64 | // The default components (if none are previously selected). |
65 | 65 | $default_components = array( |
66 | 66 | 'xprofile' => array( |
67 | 67 | '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' ), |
69 | 69 | ), |
70 | 70 | 'settings' => array( |
71 | 71 | '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' ), |
73 | 73 | ), |
74 | 74 | 'notifications' => array( |
75 | 75 | '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' ), |
77 | 77 | ), |
78 | 78 | ); |
79 | 79 | |
80 | 80 | $optional_components = bp_core_admin_get_components( 'optional' ); |
81 | 81 | $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' ); |
83 | 83 | |
84 | 84 | // Merge optional and required together. |
85 | 85 | $all_components = $optional_components + $required_components; |
… |
… |
function bp_core_admin_components_options() { |
88 | 88 | // deactivated components into activated ones. |
89 | 89 | if ( empty( $active_components ) ) { |
90 | 90 | $deactivated_components = bp_get_option( 'bp-deactivated-components' ); |
91 | | if ( !empty( $deactivated_components ) ) { |
| 91 | if ( ! empty( $deactivated_components ) ) { |
92 | 92 | |
93 | 93 | // Trim off namespace and filename. |
94 | 94 | $trimmed = array(); |
… |
… |
function bp_core_admin_components_options() { |
98 | 98 | |
99 | 99 | // Loop through the optional components to create an active component array. |
100 | 100 | 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; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
… |
… |
function bp_core_admin_components_options() { |
119 | 119 | |
120 | 120 | // Get the total count of all plugins. |
121 | 121 | $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'; |
124 | 124 | |
125 | | switch( $action ) { |
126 | | case 'all' : |
| 125 | switch ( $action ) { |
| 126 | case 'all': |
127 | 127 | $current_components = $all_components; |
128 | 128 | break; |
129 | | case 'active' : |
| 129 | case 'active': |
130 | 130 | foreach ( array_keys( $active_components ) as $component ) { |
131 | | $current_components[$component] = $all_components[$component]; |
| 131 | $current_components[ $component ] = $all_components[ $component ]; |
132 | 132 | } |
133 | 133 | break; |
134 | | case 'inactive' : |
| 134 | case 'inactive': |
135 | 135 | foreach ( $inactive_components as $component ) { |
136 | | $current_components[$component] = $all_components[$component]; |
| 136 | $current_components[ $component ] = $all_components[ $component ]; |
137 | 137 | } |
138 | 138 | break; |
139 | | case 'mustuse' : |
| 139 | case 'mustuse': |
140 | 140 | $current_components = $required_components; |
141 | 141 | break; |
142 | | case 'retired' : |
| 142 | case 'retired': |
143 | 143 | $current_components = $retired_components; |
144 | 144 | break; |
145 | 145 | } ?> |
… |
… |
function bp_core_admin_components_options() { |
150 | 150 | ?></h3> |
151 | 151 | |
152 | 152 | <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> |
155 | 155 | <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> |
158 | 158 | </ul> |
159 | 159 | |
160 | 160 | <h3 class="screen-reader-text"><?php |
… |
… |
function bp_core_admin_components_options() { |
177 | 177 | |
178 | 178 | <tbody id="the-list"> |
179 | 179 | |
180 | | <?php if ( !empty( $current_components ) ) : ?> |
| 180 | <?php if ( ! empty( $current_components ) ) : ?> |
181 | 181 | |
182 | 182 | <?php foreach ( $current_components as $name => $labels ) : ?> |
183 | 183 | |
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'; |
186 | 186 | else : |
187 | 187 | $class = 'active'; |
188 | 188 | endif; ?> |
… |
… |
function bp_core_admin_components_options() { |
190 | 190 | <tr id="<?php echo esc_attr( $name ); ?>" class="<?php echo esc_attr( $name ) . ' ' . esc_attr( $class ); ?>"> |
191 | 191 | <th scope="row" class="check-column"> |
192 | 192 | |
193 | | <?php if ( !in_array( $name, array( 'core', 'members' ) ) ) : ?> |
| 193 | <?php if ( ! in_array( $name, array( 'core', 'members' ), true ) ) : ?> |
194 | 194 | |
195 | 195 | <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 |
196 | 196 | /* translators: accessibility text */ |
… |
… |
function bp_core_admin_components_options() { |
200 | 200 | |
201 | 201 | </th> |
202 | 202 | <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 ) ) : ?> |
204 | 204 | |
205 | 205 | <label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" aria-label="<?php |
206 | 206 | /* translators: accessibility text */ |