Changeset 13879
- Timestamp:
- 06/01/2024 04:30:27 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13878 r13879 47 47 * 'bp-general-settings' menu, it will only contain one item. Kill it. 48 48 */ 49 if ( 1 != count( $submenu['bp-general-settings'] ) ) {49 if ( 1 !== count( $submenu['bp-general-settings'] ) ) { 50 50 return; 51 51 } … … 77 77 78 78 // This tweaks the Settings subnav menu to show only one BuddyPress menu item. 79 if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings' ) ) ) {79 if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings' ), true ) ) { 80 80 $submenu_file = 'bp-components'; 81 81 } 82 82 83 83 // Network Admin > Tools. 84 if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ) ) ) {84 if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ), true ) ) { 85 85 $submenu_file = $plugin_page; 86 86 } … … 441 441 'a' => array( 442 442 'href' => true, 443 'class' => true 443 'class' => true, 444 444 ), 445 445 ) … … 464 464 * @since 8.0.0 Adds the `$context` parameter. 465 465 * 466 * @param string $active_tab Name of the tab that is active. Optional. 467 * @param string $context The context of use for the tabs. Defaults to 'settings'. 468 * Possible values are 'settings' & 'tools'. 469 */ 470 function bp_core_admin_tabs( $active_tab = '', $context = 'settings', $echo = true ) { 466 * @param string $active_tab Optional. Name of the tab that is active. 467 * @param string $context Optional. The context of use for the tabs. Defaults to 'settings'. 468 * Possible values are 'settings' or 'tools'. 469 * @param bool $echo_tabs Optional. Whether to echo or return the tabs. Default: true. 470 * @return string|null 471 */ 472 function bp_core_admin_tabs( $active_tab = '', $context = 'settings', $echo_tabs = true ) { 471 473 $tabs_html = ''; 472 474 $idle_class = 'buddypress-nav-tab'; … … 478 480 * @since 1.9.0 479 481 * 480 * @param array $ valueArray of tabs to output to the admin area.482 * @param array $admin_tabs Array of tabs to output to the admin area. 481 483 */ 482 $tabs 483 $tabs_html 484 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) ); 485 $tabs_html = array(); 484 486 485 487 // Loop through tabs and build navigation. 486 488 foreach ( array_values( $tabs ) as $tab_data ) { 487 $is_current = (bool) ( $tab_data['name']== $active_tab );488 $tab_class 489 $tabs_html[] 490 } 491 492 if ( ! $echo ) {489 $is_current = (bool) ( $tab_data['name'] === $active_tab ); 490 $tab_class = $is_current ? $active_class : $idle_class; 491 $tabs_html[] = '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 492 } 493 494 if ( ! $echo_tabs ) { 493 495 return $tabs_html; 494 496 } … … 504 506 * @since 10.0.0 Adds the `$active_tab` parameter. 505 507 * 506 * @param string $context The context of use for the tabs. 508 * @param string $context The context of use for the tabs. 509 * @param string $active_tab The active tab. 507 510 */ 508 511 do_action( 'bp_admin_tabs', $context, $active_tab ); … … 515 518 * 516 519 * @param bool $apply_filters Whether to apply filters or not. 517 * @return array 520 * @return array The BP Admin settings tabs. 518 521 */ 519 522 function bp_core_get_admin_settings_tabs( $apply_filters = true ) { … … 577 580 * 578 581 * @param bool $apply_filters Whether to apply filters or not. 579 * @return array 582 * @return array The BP Admin tools tabs. 580 583 */ 581 584 function bp_core_get_admin_tools_tabs( $apply_filters = true ) { … … 784 787 break; 785 788 786 case 'edit-bp_member_type' 789 case 'edit-bp_member_type': 787 790 // Help tab. 788 791 $screen->add_help_tab( … … 985 988 * @since 1.7.0 986 989 * 987 * @param bool $menu_order Menu order.988 * @return bool Alwaystrue.990 * @param bool $menu_order Optional. Menu order. Default: false. 991 * @return bool False if user cannot see admin pages, otherwise true. 989 992 */ 990 993 function bp_admin_custom_menu_order( $menu_order = false ) { … … 1040 1043 1041 1044 // Position BuddyPress menus above appearance. 1042 if ( $last_sep == $item ) {1045 if ( $last_sep === $item ) { 1043 1046 1044 1047 // Add our custom menus. 1045 1048 foreach ( (array) $custom_menus as $custom_menu ) { 1046 if ( array_search( $custom_menu, $menu_order ) ) {1049 if ( array_search( $custom_menu, $menu_order, true ) ) { 1047 1050 $bp_menu_order[] = $custom_menu; 1048 1051 } … … 1053 1056 1054 1057 // Skip our menu items. 1055 } elseif ( ! in_array( $item, $custom_menus ) ) {1058 } elseif ( ! in_array( $item, $custom_menus, true ) ) { 1056 1059 $bp_menu_order[] = $item; 1057 1060 } … … 1076 1079 */ 1077 1080 function bp_admin_list_table_current_bulk_action() { 1078 1079 1081 $action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; 1080 1082 1081 1083 // If the bottom is set, let it override the action. 1082 if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] != '-1' ) {1084 if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] !== '-1' ) { 1083 1085 $action = $_REQUEST['action2']; 1084 1086 } … … 1109 1111 * @since 7.0.0 1110 1112 * 1111 * @param null $n ullA null value.1113 * @param null $nil A null value. 1112 1114 * @param WP_Query $wp_query The WP_Query instance (passed by reference). 1113 1115 * @return array The BP Member nav items to short-circuit WP's query, 1114 1116 */ 1115 function bp_admin_get_wp_nav_menu_items( $n ull, $wp_query ) {1117 function bp_admin_get_wp_nav_menu_items( $nil, $wp_query ) { 1116 1118 if ( isset( $wp_query->query['orderby'], $wp_query->query['order'] ) && 'post_date' === $wp_query->query['orderby'] && 'DESC' === $wp_query->query['order'] ) { 1117 1119 return bp_nav_menu_get_loggedin_pages(); … … 1130 1132 * 1131 1133 * @global $nav_menu_selected_id 1132 */ 1133 function bp_admin_do_wp_nav_menu_meta_box( $object = '', $box = array() ) { 1134 * 1135 * @param WP_Post $post The current post object. 1136 * @param array $box The meta box arguments. 1137 */ 1138 function bp_admin_do_wp_nav_menu_meta_box( $post = '', $box = array() ) { 1134 1139 global $nav_menu_selected_id; 1135 1140 … … 1143 1148 'bp_nav_menu_item', 1144 1149 array( 1145 'label' => 'BuddyPress',1146 'labels' => array(1150 'label' => 'BuddyPress', 1151 'labels' => array( 1147 1152 'search_items' => __( 'Search BuddyPress member menu items', 'buddypress' ), 1148 1153 'all_items' => __( 'All BuddyPress Member menu items', 'buddypress' ), 1149 1154 ), 1150 'public' => true,1155 'public' => true, 1151 1156 'hierarchical' => false, 1152 1157 'has_archive' => false, … … 1162 1167 $output = ob_get_clean(); 1163 1168 1164 $get_bp_items = new WP_Query ;1169 $get_bp_items = new WP_Query(); 1165 1170 $all_bp_items = $get_bp_items->query( array( 'nopaging' => true ) ); 1166 1171 $walker = new Walker_Nav_Menu_Checklist(); … … 1306 1311 * 1307 1312 * @param WP_Post $post Post object. 1308 * @param array $box { 1309 * Tags meta box arguments. 1310 * 1311 * @type string $id Meta box ID. 1312 * @type string $title Meta box title. 1313 * @type callable $callback Meta box display callback. 1314 * } 1315 */ 1316 function bp_email_tax_type_metabox( $post, $box ) { 1313 */ 1314 function bp_email_tax_type_metabox( $post ) { 1317 1315 $r = array( 1318 1316 'taxonomy' => bp_get_email_tax_type(), … … 1326 1324 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> 1327 1325 <?php 1328 $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';1326 $name = ( $tax_name === 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; 1329 1327 echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 1330 1328 ?> … … 1367 1365 * @since 2.5.0 1368 1366 * 1369 * @param WP_Post $post 1367 * @param WP_Post $post Post object. 1370 1368 */ 1371 1369 function bp_email_plaintext_metabox( $post ) { … … 1378 1376 ?> 1379 1377 </label> 1380 <textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php 1378 <textarea rows="5" cols="40" name="excerpt" id="excerpt"> 1379 <?php 1381 1380 // phpcs:ignore WordPress.Security.EscapeOutput 1382 echo $post->post_excerpt; ?> 1381 echo $post->post_excerpt; 1382 ?> 1383 1383 </textarea> 1384 1384 … … 1425 1425 * @since 2.0.0 1426 1426 * 1427 * @param array $actionsUser row action links.1428 * @param object $user_object Current user information.1427 * @param string[] $actions User row action links. 1428 * @param WP_User $user_object WP_User object for the currently listed user. 1429 1429 * @return array $actions User row action links. 1430 1430 */ … … 1453 1453 ); 1454 1454 $unspam_link = wp_nonce_url( $url, 'bp-spam-user' ); 1455 $actions['ham'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $unspam_link ), esc_html__( 'Not Spam', 'buddypress' ) );1455 $actions['ham'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $unspam_link ), esc_html__( 'Not Spam', 'buddypress' ) ); 1456 1456 1457 1457 // If not already spammed, create spam link. … … 1492 1492 1493 1493 // If this is a multisite, bulk request, stop now! 1494 if ( 'list' == $mode ) {1494 if ( 'list' === $mode ) { 1495 1495 return; 1496 1496 } 1497 1497 1498 1498 // Process a spam/ham request. 1499 if ( ! empty( $action ) && in_array( $action, array( 'spam', 'ham' ) ) ) {1499 if ( ! empty( $action ) && in_array( $action, array( 'spam', 'ham' ), true ) ) { 1500 1500 1501 1501 check_admin_referer( 'bp-spam-user' ); … … 1509 1509 $redirect = wp_get_referer(); 1510 1510 1511 $status = ( $action == 'spam' ) ? 'spam' : 'ham';1511 $status = ( $action === 'spam' ) ? 'spam' : 'ham'; 1512 1512 1513 1513 // Process the user. … … 1521 1521 1522 1522 // Display feedback. 1523 if ( ! empty( $updated ) && in_array( $updated, array( 'marked-spam', 'marked-ham' ) ) ) {1523 if ( ! empty( $updated ) && in_array( $updated, array( 'marked-spam', 'marked-ham' ), true ) ) { 1524 1524 1525 1525 if ( 'marked-spam' === $updated ) { … … 1595 1595 * 1596 1596 * @param string $classes CSS classes for the body tag in the admin, a space separated string. 1597 *1598 1597 * @return string 1599 1598 */ … … 1614 1613 * 1615 1614 * @since 5.0.0 1616 * @since 8.0.0 The `bp_block_category_post_types` filter has been deprecated.1615 * @since 8.0.0 The `bp_block_category_post_types` filter has been deprecated. 1617 1616 * @since 12.0.0 This category is left for third party plugin but not used anymore. 1618 1617 * 1619 1618 * @todo deprecate. 1620 1619 * 1621 * @param array $categories Array of block categories.1622 * @param string|WP_Post $postPost being loaded.1620 * @param array $categories Array of block categories. 1621 * @param string|WP_Post|null $editor_name_or_post Post being loaded. 1623 1622 */ 1624 1623 function bp_block_category( $categories = array(), $editor_name_or_post = null ) { … … 1651 1650 * @since 11.4.0 1652 1651 * 1653 * @param object $notification An Admin Notification object.1652 * @param object|null $notification An Admin Notification object. 1654 1653 */ 1655 1654 function bp_core_admin_format_notifications( $notification = null ) { 1656 1655 if ( ! isset( $notification->id ) ) { 1657 return '';1656 return; 1658 1657 } 1659 1658 ?> … … 1663 1662 <h2><span class="bp-version"><?php echo esc_html( number_format_i18n( $notification->version, 1 ) ); ?></span> <?php echo esc_html( $notification->title ); ?></h2> 1664 1663 <p class="about-description"> 1665 <?php echo wp_kses( $notification->content, array( 'a' => array( 'href' => true ), 'br' => array(), 'strong' => array() ) ); ?> 1664 <?php 1665 echo wp_kses( 1666 $notification->content, 1667 array( 1668 'a' => array( 'href' => true ), 1669 'br' => array(), 1670 'strong' => array(), 1671 ) 1672 ); 1673 ?> 1666 1674 </p> 1667 1675 <div class="bp-admin-notification-action"><a href="<?php echo esc_url( $notification->href ); ?>" class="button button-primary"><?php echo esc_html( $notification->text ); ?></a></div>
Note: See TracChangeset
for help on using the changeset viewer.