| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Admin Tools Common. | |
| 4 | + * bbPress Admin Tools Common | |
| 5 | 5 | * |
| 6 | 6 | * @package bbPress |
| 7 | 7 | * @subpackage Administration |
| 8 | 8 | */ |
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | // Exit if accessed directly |
| 11 | 11 | defined( 'ABSPATH' ) || exit; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Return the current admin repair tool page. | |
| 14 | + * Return the current admin repair tool page | |
| 15 | 15 | * |
| 16 | 16 | * @since 2.6.0 bbPress (r6894) |
| 17 | 17 | * |
| 18 | 18 | * @return string |
| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | return sanitize_key( $_GET['page'] ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Return the current admin repair tool page ID. | |
| 25 | + * Return the current admin repair tool page ID | |
| 26 | 26 | * |
| 27 | 27 | * @since 2.6.0 bbPress (r6894) |
| 28 | 28 | * |
| 29 | 29 | * @return string |
| @@ -43,9 +43,9 @@ | ||
| 43 | 43 | return $page; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Return a URL to the repair tool page. | |
| 47 | + * Return a URL to the repair tool page | |
| 48 | 48 | * |
| 49 | 49 | * @since 2.6.0 bbPress (r6894) |
| 50 | 50 | * |
| 51 | 51 | * @param array $args |
| @@ -65,9 +65,9 @@ | ||
| 65 | 65 | return add_query_arg( $r, admin_url( 'tools.php' ) ); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | - * Output the URL to run a specific repair tool. | |
| 69 | + * Output the URL to run a specific repair tool | |
| 70 | 70 | * |
| 71 | 71 | * @since 2.6.0 bbPress (r5885) |
| 72 | 72 | * |
| 73 | 73 | * @param string $component |
| @@ -75,38 +75,38 @@ | ||
| 75 | 75 | function bbp_admin_repair_tool_run_url( $component = array() ) { |
| 76 | 76 | echo esc_url( bbp_get_admin_repair_tool_run_url( $component ) ); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -/** | |
| 80 | - * Return the URL to run a specific repair tool. | |
| 81 | - * | |
| 82 | - * @since 2.6.0 bbPress (r5885) | |
| 83 | - * | |
| 84 | - * @param string $component | |
| 85 | - */ | |
| 86 | -function bbp_get_admin_repair_tool_run_url( $component = array() ) { | |
| 79 | + /** | |
| 80 | + * Return the URL to run a specific repair tool | |
| 81 | + * | |
| 82 | + * @since 2.6.0 bbPress (r5885) | |
| 83 | + * | |
| 84 | + * @param string $component | |
| 85 | + */ | |
| 86 | + function bbp_get_admin_repair_tool_run_url( $component = array() ) { | |
| 87 | 87 | |
| 88 | - // Page | |
| 89 | - $page = ( 'repair' === $component['type'] ) | |
| 90 | - ? 'bbp-repair' | |
| 91 | - : 'bbp-upgrade'; | |
| 88 | + // Page | |
| 89 | + $page = ( 'repair' === $component['type'] ) | |
| 90 | + ? 'bbp-repair' | |
| 91 | + : 'bbp-upgrade'; | |
| 92 | 92 | |
| 93 | - // Arguments | |
| 94 | - $args = array( | |
| 95 | - 'page' => $page, | |
| 96 | - 'action' => 'run', | |
| 97 | - 'checked' => array( $component['id'] ) | |
| 98 | - ); | |
| 93 | + // Arguments | |
| 94 | + $args = array( | |
| 95 | + 'page' => $page, | |
| 96 | + 'action' => 'run', | |
| 97 | + 'checked' => array( $component['id'] ) | |
| 98 | + ); | |
| 99 | 99 | |
| 100 | - // Url | |
| 101 | - $nonced = wp_nonce_url( bbp_get_admin_repair_tool_page_url( $args ), 'bbpress-do-counts' ); | |
| 100 | + // Url | |
| 101 | + $nonced = wp_nonce_url( bbp_get_admin_repair_tool_page_url( $args ), 'bbpress-do-counts' ); | |
| 102 | 102 | |
| 103 | - // Filter & return | |
| 104 | - return apply_filters( 'bbp_get_admin_repair_tool_run_url', $nonced, $component ); | |
| 105 | -} | |
| 103 | + // Filter & return | |
| 104 | + return apply_filters( 'bbp_get_admin_repair_tool_run_url', $nonced, $component ); | |
| 105 | + } | |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * Assemble the admin notices. | |
| 108 | + * Assemble the admin notices | |
| 109 | 109 | * |
| 110 | 110 | * @since 2.0.0 bbPress (r2613) |
| 111 | 111 | * |
| 112 | 112 | * @param string|WP_Error $message A message to be displayed or {@link WP_Error} |
| @@ -119,9 +119,9 @@ | ||
| 119 | 119 | return bbp_admin()->add_notice( $message, $class, $is_dismissible ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * Handle the processing and feedback of the admin tools page. | |
| 123 | + * Handle the processing and feedback of the admin tools page | |
| 124 | 124 | * |
| 125 | 125 | * @since 2.0.0 bbPress (r2613) |
| 126 | 126 | * |
| 127 | 127 | */ |
| @@ -185,9 +185,9 @@ | ||
| 185 | 185 | wp_cache_flush(); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | - * Get the array of available repair tools. | |
| 189 | + * Get the array of available repair tools | |
| 190 | 190 | * |
| 191 | 191 | * @since 2.6.0 bbPress (r5885) |
| 192 | 192 | * |
| 193 | 193 | * @param string $type repair|upgrade The type of tools to get. Default empty for all tools. |
| @@ -209,9 +209,9 @@ | ||
| 209 | 209 | return (array) apply_filters( 'bbp_get_admin_repair_tools', $tools, $type ); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | - * Return array of components from the array of registered tools. | |
| 213 | + * Return array of components from the array of registered tools | |
| 214 | 214 | * |
| 215 | 215 | * @since 2.5.0 bbPress (r5885) |
| 216 | 216 | * |
| 217 | 217 | * @return array |
| @@ -221,9 +221,9 @@ | ||
| 221 | 221 | // Default return value |
| 222 | 222 | $retval = array(); |
| 223 | 223 | |
| 224 | 224 | // Get tools |
| 225 | - $tools = bbp_get_admin_repair_tools( bbp_get_admin_repair_tool_page_id() ); | |
| 225 | + $tools = bbp_get_admin_repair_tools( bbp_get_admin_repair_tool_page_id() ); | |
| 226 | 226 | |
| 227 | 227 | // Loop through tools |
| 228 | 228 | if ( ! empty( $tools ) ) { |
| 229 | 229 | $plucked = wp_list_pluck( $tools, 'components' ); |
| @@ -249,14 +249,14 @@ | ||
| 249 | 249 | return (array) apply_filters( 'bbp_get_admin_repair_tool_registered_components', $retval ); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | - * Output the repair list search form. | |
| 253 | + * Output the repair list search form | |
| 254 | 254 | * |
| 255 | 255 | * @since 2.6.0 bbPress (r5885) |
| 256 | 256 | */ |
| 257 | 257 | function bbp_admin_repair_list_search_form() { |
| 258 | -?> | |
| 258 | + ?> | |
| 259 | 259 | |
| 260 | 260 | <p class="search-box"> |
| 261 | 261 | <label class="screen-reader-text" for="bbp-repair-search-input"><?php esc_html_e( 'Search Tools:', 'bbpress' ); ?></label> |
| 262 | 262 | <input type="search" id="bbp-repair-search-input" name="s" value="<?php _admin_search_query(); ?>"> |
| @@ -266,9 +266,9 @@ | ||
| 266 | 266 | <?php |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | - * Output a select drop-down of components to filter by. | |
| 270 | + * Output a select drop-down of components to filter by | |
| 271 | 271 | * |
| 272 | 272 | * @since 2.5.0 bbPress (r5885) |
| 273 | 273 | */ |
| 274 | 274 | function bbp_admin_repair_list_components_filter() { |
| @@ -301,9 +301,9 @@ | ||
| 301 | 301 | <?php |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | - * Return array of versions from the array of registered tools. | |
| 305 | + * Return array of versions from the array of registered tools | |
| 306 | 306 | * |
| 307 | 307 | * @since 2.6.0 bbPress (r6894) |
| 308 | 308 | * |
| 309 | 309 | * @return array |
| @@ -313,9 +313,9 @@ | ||
| 313 | 313 | // Default return value |
| 314 | 314 | $retval = array(); |
| 315 | 315 | |
| 316 | 316 | // Get tools |
| 317 | - $tools = bbp_get_admin_repair_tools( bbp_get_admin_repair_tool_page_id() ); | |
| 317 | + $tools = bbp_get_admin_repair_tools( bbp_get_admin_repair_tool_page_id() ); | |
| 318 | 318 | |
| 319 | 319 | // Loop through tools |
| 320 | 320 | if ( ! empty( $tools ) ) { |
| 321 | 321 | $plucked = wp_list_pluck( $tools, 'version' ); |
| @@ -352,9 +352,9 @@ | ||
| 352 | 352 | return (array) apply_filters( 'bbp_get_admin_repair_tool_registered_versions', $retval ); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | - * Output a select drop-down of versions to filter by. | |
| 356 | + * Output a select drop-down of versions to filter by | |
| 357 | 357 | * |
| 358 | 358 | * @since 2.5.0 bbPress (r6894) |
| 359 | 359 | */ |
| 360 | 360 | function bbp_admin_repair_list_versions_filter() { |
| @@ -389,9 +389,9 @@ | ||
| 389 | 389 | |
| 390 | 390 | /** Translations **************************************************************/ |
| 391 | 391 | |
| 392 | 392 | /** |
| 393 | - * Maybe translate a repair tool overhead name. | |
| 393 | + * Maybe translate a repair tool overhead name | |
| 394 | 394 | * |
| 395 | 395 | * @since 2.6.0 bbPress (r6177) |
| 396 | 396 | * |
| 397 | 397 | * @param string $overhead |
| @@ -418,9 +418,9 @@ | ||
| 418 | 418 | return $name; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | - * Maybe translate a repair tool component name. | |
| 422 | + * Maybe translate a repair tool component name | |
| 423 | 423 | * |
| 424 | 424 | * @since 2.6.0 bbPress (r5885) |
| 425 | 425 | * |
| 426 | 426 | * @param string $component |
| @@ -465,9 +465,9 @@ | ||
| 465 | 465 | return $name; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Maybe translate a repair tool overhead name. | |
| 469 | + * Maybe translate a repair tool overhead name | |
| 470 | 470 | * |
| 471 | 471 | * @since 2.6.0 bbPress (r6894) |
| 472 | 472 | * |
| 473 | 473 | * @param string $version |
| @@ -502,9 +502,9 @@ | ||
| 502 | 502 | * set of tools. |
| 503 | 503 | * |
| 504 | 504 | * @since 2.0.0 bbPress (r2613) |
| 505 | 505 | * |
| 506 | - * @return array Repair list of options. | |
| 506 | + * @return array Repair list of options | |
| 507 | 507 | */ |
| 508 | 508 | function bbp_admin_repair_list( $type = 'repair' ) { |
| 509 | 509 | |
| 510 | 510 | // Define empty array |
| @@ -526,9 +526,9 @@ | ||
| 526 | 526 | ? sanitize_key( $_GET['status'] ) |
| 527 | 527 | : ''; |
| 528 | 528 | |
| 529 | 529 | // Overhead |
| 530 | - $overhead = ! empty( $_GET['overhead'] ) | |
| 530 | + $overhead = ! empty( $_GET['overhead'] ) | |
| 531 | 531 | ? sanitize_key( $_GET['overhead'] ) |
| 532 | 532 | : ''; |
| 533 | 533 | |
| 534 | 534 | // Component |
| @@ -611,9 +611,9 @@ | ||
| 611 | 611 | return (array) apply_filters( 'bbp_repair_list', $retval ); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
| 615 | - * Get filter links for components for a specific admin repair tool. | |
| 615 | + * Get filter links for components for a specific admin repair tool | |
| 616 | 616 | * |
| 617 | 617 | * @since 2.6.0 bbPress (r5885) |
| 618 | 618 | * |
| 619 | 619 | * @param array $item |
| @@ -648,9 +648,9 @@ | ||
| 648 | 648 | return (array) apply_filters( 'bbp_get_admin_repair_tool_components', $links, $item ); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
| 652 | - * Get filter links for versions for a specific admin repair tool. | |
| 652 | + * Get filter links for versions for a specific admin repair tool | |
| 653 | 653 | * |
| 654 | 654 | * @since 2.6.0 bbPress (r6894) |
| 655 | 655 | * |
| 656 | 656 | * @param array $item |
| @@ -685,9 +685,9 @@ | ||
| 685 | 685 | return (array) apply_filters( 'bbp_get_admin_repair_tool_version', $links, $item ); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
| 689 | - * Get filter links for overhead for a specific admin repair tool. | |
| 689 | + * Get filter links for overhead for a specific admin repair tool | |
| 690 | 690 | * |
| 691 | 691 | * @since 2.6.0 bbPress (r5885) |
| 692 | 692 | * |
| 693 | 693 | * @param array $item |
| @@ -724,9 +724,9 @@ | ||
| 724 | 724 | |
| 725 | 725 | /** Overhead ******************************************************************/ |
| 726 | 726 | |
| 727 | 727 | /** |
| 728 | - * Output filter links for overheads for a specific admin repair tool. | |
| 728 | + * Output filter links for overheads for a specific admin repair tool | |
| 729 | 729 | * |
| 730 | 730 | * @since 2.6.0 bbPress (r5885) |
| 731 | 731 | * |
| 732 | 732 | * @param array $args |
| @@ -735,9 +735,9 @@ | ||
| 735 | 735 | echo bbp_get_admin_repair_tool_overhead_filters( $args ); |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
| 739 | - * Get filter links for overheads for a specific admin repair tool. | |
| 739 | + * Get filter links for overheads for a specific admin repair tool | |
| 740 | 740 | * |
| 741 | 741 | * @since 2.6.0 bbPress (r5885) |
| 742 | 742 | * |
| 743 | 743 | * @param array $args |
| @@ -792,9 +792,9 @@ | ||
| 792 | 792 | $overheads[ $overhead ] = 0; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | // Bump the overhead count |
| 796 | - ++$overheads[ $overhead ]; | |
| 796 | + $overheads[ $overhead ]++; | |
| 797 | 797 | } |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | // Get the current overhead, if any |
| @@ -803,24 +803,14 @@ | ||
| 803 | 803 | : ''; |
| 804 | 804 | |
| 805 | 805 | // Create the "All" link |
| 806 | 806 | $current = empty( $selected ) ? 'current' : ''; |
| 807 | - | |
| 808 | - $all_text = sprintf( | |
| 807 | + $links[] = $r['link_before'] . '<a href="' . esc_url( $tools_url ) . '" class="' . esc_attr( $current ) . '">' . sprintf( | |
| 809 | 808 | /* translators: %s: Number of items */ |
| 810 | 809 | esc_html__( 'All %s', 'bbpress' ), |
| 811 | 810 | $r['count_before'] . count( $tools ) . $r['count_after'] |
| 812 | - ); | |
| 811 | + ) . '</a>' . $r['link_after']; | |
| 813 | 812 | |
| 814 | - $links[] = sprintf( | |
| 815 | - '%1$s<a href="%2$s" class="%3$s">%4$s</a>%5$s', | |
| 816 | - $r['link_before'], | |
| 817 | - esc_url( $tools_url ), | |
| 818 | - esc_attr( $current ), | |
| 819 | - $all_text, | |
| 820 | - $r['link_after'] | |
| 821 | - ); | |
| 822 | - | |
| 823 | 813 | // Loop through overheads and created links |
| 824 | 814 | if ( count( $overheads ) ) { |
| 825 | 815 | |
| 826 | 816 | // Sort |
| @@ -858,9 +848,9 @@ | ||
| 858 | 848 | |
| 859 | 849 | /** Pending ******************************************************************/ |
| 860 | 850 | |
| 861 | 851 | /** |
| 862 | - * Output filter links for statuses. | |
| 852 | + * Output filter links for statuses | |
| 863 | 853 | * |
| 864 | 854 | * @since 2.6.0 bbPress (r6925) |
| 865 | 855 | * |
| 866 | 856 | * @param array $args |
| @@ -869,9 +859,9 @@ | ||
| 869 | 859 | echo bbp_get_admin_repair_tool_status_filters( $args ); |
| 870 | 860 | } |
| 871 | 861 | |
| 872 | 862 | /** |
| 873 | - * Get filter links for statuses. | |
| 863 | + * Get filter links for statuses | |
| 874 | 864 | * |
| 875 | 865 | * @since 2.6.0 bbPress (r5885) |
| 876 | 866 | * |
| 877 | 867 | * @param array $args |