Changeset 6176
- Timestamp:
- 12/18/2016 03:47:16 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/tools.php
r6175 r6176 111 111 <div class="bbp-tool-overhead"> 112 112 113 <?php echo esc_html( $item['overhead']); ?>113 <?php echo implode( ', ', bbp_get_admin_repair_tool_overhead( $item ) ); ?> 114 114 115 115 </div> … … 448 448 'callback' => '', 449 449 'priority' => 0, 450 'overhead' => esc_html__( 'Low', 'bbpress' ),450 'overhead' => 'low', 451 451 'components' => array(), 452 452 … … 488 488 'callback' => 'bbp_admin_repair_topic_meta', 489 489 'priority' => 5, 490 'overhead' => esc_html__( 'Low', 'bbpress' ),490 'overhead' => 'low', 491 491 'components' => array( bbp_get_reply_post_type() ) 492 492 ) ); … … 498 498 'callback' => 'bbp_admin_repair_forum_meta', 499 499 'priority' => 10, 500 'overhead' => esc_html__( 'Low', 'bbpress' ),500 'overhead' => 'low', 501 501 'components' => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) 502 502 ) ); … … 508 508 'callback' => 'bbp_admin_repair_forum_visibility', 509 509 'priority' => 15, 510 'overhead' => esc_html__( 'Low', 'bbpress' ),510 'overhead' => 'low', 511 511 'components' => array( bbp_get_forum_post_type() ) 512 512 ) ); … … 518 518 'callback' => 'bbp_admin_repair_freshness', 519 519 'priority' => 20, 520 'overhead' => esc_html__( 'High', 'bbpress' ),520 'overhead' => 'high', 521 521 'components' => array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() ) 522 522 ) ); … … 528 528 'callback' => 'bbp_admin_repair_sticky', 529 529 'priority' => 25, 530 'overhead' => esc_html__( 'Low', 'bbpress' ),530 'overhead' => 'low', 531 531 'components' => array( bbp_get_topic_post_type() ) 532 532 ) ); … … 538 538 'callback' => 'bbp_admin_repair_reply_menu_order', 539 539 'priority' => 30, 540 'overhead' => esc_html__( 'High', 'bbpress' ),540 'overhead' => 'high', 541 541 'components' => array( bbp_get_reply_post_type() ) 542 542 ) ); … … 548 548 'callback' => 'bbp_admin_repair_group_forum_relationship', 549 549 'priority' => 35, 550 'overhead' => esc_html__( 'Low', 'bbpress' ),550 'overhead' => 'low', 551 551 'components' => array( bbp_get_forum_post_type() ) 552 552 ) ); … … 558 558 'callback' => 'bbp_admin_repair_closed_topics', 559 559 'priority' => 40, 560 'overhead' => esc_html__( 'Medium', 'bbpress' ),560 'overhead' => 'medium', 561 561 'components' => array( bbp_get_topic_post_type() ) 562 562 ) ); … … 568 568 'callback' => 'bbp_admin_repair_forum_topic_count', 569 569 'priority' => 45, 570 'overhead' => esc_html__( 'Medium', 'bbpress' ),570 'overhead' => 'medium', 571 571 'components' => array( bbp_get_forum_post_type(), bbp_get_topic_post_type() ) 572 572 ) ); … … 578 578 'callback' => 'bbp_admin_repair_forum_reply_count', 579 579 'priority' => 50, 580 'overhead' => esc_html__( 'High', 'bbpress' ),580 'overhead' => 'high', 581 581 'components' => array( bbp_get_forum_post_type(), bbp_get_reply_post_type() ) 582 582 ) ); … … 588 588 'callback' => 'bbp_admin_repair_topic_reply_count', 589 589 'priority' => 55, 590 'overhead' => esc_html__( 'High', 'bbpress' ),590 'overhead' => 'high', 591 591 'components' => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) 592 592 ) ); … … 598 598 'callback' => 'bbp_admin_repair_topic_voice_count', 599 599 'priority' => 60, 600 'overhead' => esc_html__( 'Medium', 'bbpress' ),600 'overhead' => 'medium', 601 601 'components' => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() ) 602 602 ) ); … … 608 608 'callback' => 'bbp_admin_repair_topic_hidden_reply_count', 609 609 'priority' => 65, 610 'overhead' => esc_html__( 'High', 'bbpress' ),610 'overhead' => 'high', 611 611 'components' => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) 612 612 ) ); … … 618 618 'callback' => 'bbp_admin_repair_user_topic_count', 619 619 'priority' => 70, 620 'overhead' => esc_html__( 'Medium', 'bbpress' ),620 'overhead' => 'medium', 621 621 'components' => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() ) 622 622 ) ); … … 628 628 'callback' => 'bbp_admin_repair_user_reply_count', 629 629 'priority' => 75, 630 'overhead' => esc_html__( 'Medium', 'bbpress' ),630 'overhead' => 'medium', 631 631 'components' => array( bbp_get_reply_post_type(), bbp_get_user_rewrite_id() ) 632 632 ) ); … … 638 638 'callback' => 'bbp_admin_repair_user_favorites', 639 639 'priority' => 80, 640 'overhead' => esc_html__( 'Medium', 'bbpress' ),640 'overhead' => 'medium', 641 641 'components' => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() ) 642 642 ) ); … … 648 648 'callback' => 'bbp_admin_repair_user_topic_subscriptions', 649 649 'priority' => 85, 650 'overhead' => esc_html__( 'Medium', 'bbpress' ),650 'overhead' => 'medium', 651 651 'components' => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() ) 652 652 ) ); … … 658 658 'callback' => 'bbp_admin_repair_user_forum_subscriptions', 659 659 'priority' => 90, 660 'overhead' => esc_html__( 'Medium', 'bbpress' ),660 'overhead' => 'medium', 661 661 'components' => array( bbp_get_forum_post_type(), bbp_get_user_rewrite_id() ) 662 662 ) ); … … 668 668 'callback' => 'bbp_admin_repair_user_roles', 669 669 'priority' => 95, 670 'overhead' => esc_html__( 'Low', 'bbpress' ),670 'overhead' => 'low', 671 671 'components' => array( bbp_get_user_rewrite_id() ) 672 672 ) ); … … 676 676 'id' => 'bbp-user-favorites-move', 677 677 'description' => __( 'Upgrade user favorites', 'bbpress' ), 678 'callback' => 'bbp_admin_ migrate_user_favorites',678 'callback' => 'bbp_admin_upgrade_user_favorites', 679 679 'priority' => 100, 680 'overhead' => esc_html__( 'High', 'bbpress' ),680 'overhead' => 'high', 681 681 'components' => array( bbp_get_user_rewrite_id() ) 682 682 ) ); … … 686 686 'id' => 'bbp-user-subscriptions-move', 687 687 'description' => __( 'Upgrade user subscriptions', 'bbpress' ), 688 'callback' => 'bbp_admin_ migrate_user_subscriptions',688 'callback' => 'bbp_admin_upgrade_user_subscriptions', 689 689 'priority' => 105, 690 'overhead' => esc_html__( 'High', 'bbpress' ),690 'overhead' => 'high', 691 691 'components' => array( bbp_get_user_rewrite_id() ) 692 692 ) ); … … 744 744 } 745 745 746 /** 747 * Output a select drop-down of components to filter by 748 * 749 * @since 2.5.0 bbPress (r5885) 750 */ 746 751 function bbp_admin_repair_list_components_filter() { 747 752 753 // Sanitize component value, if exists 748 754 $selected = ! empty( $_GET['components'] ) 749 755 ? sanitize_key( $_GET['components'] ) 750 756 : ''; 751 757 758 // Get registered components 752 759 $components = bbp_get_admin_repair_tool_registered_components(); ?> 753 760 … … 766 773 767 774 <?php 775 } 776 777 /** 778 * Maybe translate a repair tool overhead name 779 * 780 * @since 2.6.0 bbPress (r6177) 781 * 782 * @param string $overhead 783 * @return string 784 */ 785 function bbp_admin_repair_tool_translate_overhead( $overhead = '' ) { 786 787 // Get the name of the component 788 switch ( $overhead ) { 789 case 'low' : 790 $name = esc_html__( 'Low', 'bbpress' ); 791 break; 792 case 'medium' : 793 $name = esc_html__( 'Medium', 'bbpress' ); 794 break; 795 case 'high' : 796 $name = esc_html__( 'High', 'bbpress' ); 797 break; 798 default : 799 $name = ucwords( $overhead ); 800 break; 801 } 802 803 return $name; 768 804 } 769 805 … … 792 828 $name = esc_html__( 'Replies', 'bbpress' ); 793 829 break; 794 default ;830 default : 795 831 $name = ucwords( $component ); 796 832 break; … … 821 857 // Overhead filter 822 858 if ( ! empty( $overhead ) ) { 823 $list = wp_list_filter( $list, array( 'overhead' => ucwords( $overhead )) );859 $list = wp_list_filter( $list, array( 'overhead' => $overhead ) ); 824 860 } 825 861 … … 858 894 859 895 /** 860 * Get filter links for components for a specific admi rrepair tool896 * Get filter links for components for a specific admin repair tool 861 897 * 862 898 * @since 2.6.0 bbPress (r5885) … … 884 920 return apply_filters( 'bbp_get_admin_repair_tool_components', $links, $item ); 885 921 } 886 // 922 923 /** 924 * Output filter links for components for a specific admin repair tool 925 * 926 * @since 2.6.0 bbPress (r5885) 927 * 928 * @param type array 929 */ 887 930 function bbp_admin_repair_tool_overhead_filters( $args = array() ) { 888 931 echo bbp_get_admin_repair_tool_overhead_filters( $args ); … … 890 933 891 934 /** 892 * Get filter links for components for a specific admir repair tool 935 * Get filter links for overhead for a specific admin repair tool 936 * 937 * @since 2.6.0 bbPress (r5885) 938 * 939 * @param array $item 940 * @return array 941 */ 942 function bbp_get_admin_repair_tool_overhead( $item = array() ) { 943 944 // Get the tools URL 945 $tools_url = add_query_arg( array( 'page' => 'bbp-repair' ), admin_url( 'tools.php' ) ); 946 947 // Define links array 948 $links = array(); 949 $overheads = array( $item['overhead'] ); 950 951 // Loop through tool overhead and build links 952 foreach ( $overheads as $overhead ) { 953 $args = array( 'overhead' => $overhead ); 954 $filter_url = add_query_arg( $args, $tools_url ); 955 $name = bbp_admin_repair_tool_translate_overhead( $overhead ); 956 $links[] = '<a href="' . esc_url( $filter_url ) . '">' . esc_html( $name ) . '</a>'; 957 } 958 959 // Filter & return 960 return apply_filters( 'bbp_get_admin_repair_tool_overhead', $links, $item ); 961 } 962 963 /** 964 * Get filter links for components for a specific admin repair tool 893 965 * 894 966 * @since 2.6.0 bbPress (r5885) … … 962 1034 963 1035 // Build the link 964 $output .= $r['link_before'] . '<a href="' . esc_url( $filter_url ) . '" class="' . esc_attr( $current ) . '">' . $overhead. $overhead_count . '</a>' . $show_sep . $r['link_after'];1036 $output .= $r['link_before'] . '<a href="' . esc_url( $filter_url ) . '" class="' . esc_attr( $current ) . '">' . bbp_admin_repair_tool_translate_overhead( $overhead ) . $overhead_count . '</a>' . $show_sep . $r['link_after']; 965 1037 } 966 1038 … … 1683 1755 // Get users of this site, limited to 1000 1684 1756 while ( $users = get_users( array( 1685 1686 1687 1688 1689 1757 'role' => $role, 1758 'fields' => 'ID', 1759 'number' => 1000, 1760 'offset' => $offset 1761 ) ) ) { 1690 1762 1691 1763 // Iterate through each user of $role and try to set it … … 2149 2221 * @return array An array of the status code and the message 2150 2222 */ 2151 function bbp_admin_ migrate_user_favorites() {2223 function bbp_admin_upgrade_user_favorites() { 2152 2224 2153 2225 // Define variables … … 2205 2277 * @return array An array of the status code and the message 2206 2278 */ 2207 function bbp_admin_ migrate_user_subscriptions() {2279 function bbp_admin_upgrade_user_subscriptions() { 2208 2280 2209 2281 // Define variables
Note: See TracChangeset
for help on using the changeset viewer.