| @@ -22,11 +22,9 @@ | ||
| 22 | 22 | |
| 23 | 23 | /** Directory *************************************************************/ |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * Path to the bbPress admin directory. | |
| 27 | - * | |
| 28 | - * @var string | |
| 26 | + * @var string Path to the bbPress admin directory | |
| 29 | 27 | */ |
| 30 | 28 | public $admin_dir = ''; |
| 31 | 29 | |
| 32 | 30 | /** URLs ******************************************************************/ |
| @@ -31,39 +29,29 @@ | ||
| 31 | 29 | |
| 32 | 30 | /** URLs ******************************************************************/ |
| 33 | 31 | |
| 34 | 32 | /** |
| 35 | - * URL to the bbPress admin directory. | |
| 36 | - * | |
| 37 | - * @var string | |
| 33 | + * @var string URL to the bbPress admin directory | |
| 38 | 34 | */ |
| 39 | 35 | public $admin_url = ''; |
| 40 | 36 | |
| 41 | 37 | /** |
| 42 | - * URL to the bbPress images directory. | |
| 43 | - * | |
| 44 | - * @var string | |
| 38 | + * @var string URL to the bbPress images directory | |
| 45 | 39 | */ |
| 46 | 40 | public $images_url = ''; |
| 47 | 41 | |
| 48 | 42 | /** |
| 49 | - * URL to the bbPress admin styles directory. | |
| 50 | - * | |
| 51 | - * @var string | |
| 43 | + * @var string URL to the bbPress admin styles directory | |
| 52 | 44 | */ |
| 53 | 45 | public $styles_url = ''; |
| 54 | 46 | |
| 55 | 47 | /** |
| 56 | - * URL to the bbPress admin css directory. | |
| 57 | - * | |
| 58 | - * @var string | |
| 48 | + * @var string URL to the bbPress admin css directory | |
| 59 | 49 | */ |
| 60 | 50 | public $css_url = ''; |
| 61 | 51 | |
| 62 | 52 | /** |
| 63 | - * URL to the bbPress admin js directory. | |
| 64 | - * | |
| 65 | - * @var string | |
| 53 | + * @var string URL to the bbPress admin js directory | |
| 66 | 54 | */ |
| 67 | 55 | public $js_url = ''; |
| 68 | 56 | |
| 69 | 57 | /** Capability ************************************************************/ |
| @@ -68,11 +56,9 @@ | ||
| 68 | 56 | |
| 69 | 57 | /** Capability ************************************************************/ |
| 70 | 58 | |
| 71 | 59 | /** |
| 72 | - * Minimum capability to access Tools and Settings. | |
| 73 | - * | |
| 74 | - * @var bool | |
| 60 | + * @var bool Minimum capability to access Tools and Settings | |
| 75 | 61 | */ |
| 76 | 62 | public $minimum_capability = 'keep_gate'; |
| 77 | 63 | |
| 78 | 64 | /** Separator *************************************************************/ |
| @@ -77,11 +63,9 @@ | ||
| 77 | 63 | |
| 78 | 64 | /** Separator *************************************************************/ |
| 79 | 65 | |
| 80 | 66 | /** |
| 81 | - * Whether or not to add an extra top level menu separator. | |
| 82 | - * | |
| 83 | - * @var bool | |
| 67 | + * @var bool Whether or not to add an extra top level menu separator | |
| 84 | 68 | */ |
| 85 | 69 | public $show_separator = false; |
| 86 | 70 | |
| 87 | 71 | /** Tools *****************************************************************/ |
| @@ -86,11 +70,9 @@ | ||
| 86 | 70 | |
| 87 | 71 | /** Tools *****************************************************************/ |
| 88 | 72 | |
| 89 | 73 | /** |
| 90 | - * Array of available repair tools. | |
| 91 | - * | |
| 92 | - * @var array | |
| 74 | + * @var array Array of available repair tools | |
| 93 | 75 | */ |
| 94 | 76 | public $tools = array(); |
| 95 | 77 | |
| 96 | 78 | /** Notices ***************************************************************/ |
| @@ -95,11 +77,9 @@ | ||
| 95 | 77 | |
| 96 | 78 | /** Notices ***************************************************************/ |
| 97 | 79 | |
| 98 | 80 | /** |
| 99 | - * Array of notices to output to the current user. | |
| 100 | - * | |
| 101 | - * @var array | |
| 81 | + * @var array Array of notices to output to the current user | |
| 102 | 82 | */ |
| 103 | 83 | public $notices = array(); |
| 104 | 84 | |
| 105 | 85 | /** Components ************************************************************/ |
| @@ -104,32 +84,24 @@ | ||
| 104 | 84 | |
| 105 | 85 | /** Components ************************************************************/ |
| 106 | 86 | |
| 107 | 87 | /** |
| 108 | - * Forums admin. | |
| 109 | - * | |
| 110 | - * @var BBP_Forums_Admin | |
| 88 | + * @var BBP_Forums_Admin Forums admin | |
| 111 | 89 | */ |
| 112 | 90 | public $forums = null; |
| 113 | 91 | |
| 114 | 92 | /** |
| 115 | - * Topics admin. | |
| 116 | - * | |
| 117 | - * @var BBP_Topics_Admin | |
| 93 | + * @var BBP_Topics_Admin Topics admin | |
| 118 | 94 | */ |
| 119 | 95 | public $topics = null; |
| 120 | 96 | |
| 121 | 97 | /** |
| 122 | - * Replies admin. | |
| 123 | - * | |
| 124 | - * @var BBP_Replies_Admin | |
| 98 | + * @var BBP_Replies_Admin Replies admin | |
| 125 | 99 | */ |
| 126 | 100 | public $replies = null; |
| 127 | 101 | |
| 128 | 102 | /** |
| 129 | - * Converter admin. | |
| 130 | - * | |
| 131 | - * @var BBP_Converter | |
| 103 | + * @var BBP_Converter Converter admin | |
| 132 | 104 | */ |
| 133 | 105 | public $converter = null; |
| 134 | 106 | |
| 135 | 107 | /** Functions *************************************************************/ |
| @@ -134,9 +106,9 @@ | ||
| 134 | 106 | |
| 135 | 107 | /** Functions *************************************************************/ |
| 136 | 108 | |
| 137 | 109 | /** |
| 138 | - * The main bbPress admin loader. | |
| 110 | + * The main bbPress admin loader | |
| 139 | 111 | * |
| 140 | 112 | * @since 2.0.0 bbPress (r2515) |
| 141 | 113 | */ |
| 142 | 114 | public function __construct() { |
| @@ -145,9 +117,9 @@ | ||
| 145 | 117 | $this->setup_actions(); |
| 146 | 118 | } |
| 147 | 119 | |
| 148 | 120 | /** |
| 149 | - * Admin globals. | |
| 121 | + * Admin globals | |
| 150 | 122 | * |
| 151 | 123 | * @since 2.0.0 bbPress (r2646) |
| 152 | 124 | * |
| 153 | 125 | * @access private |
| @@ -166,9 +138,9 @@ | ||
| 166 | 138 | $this->images_url = trailingslashit( $this->admin_url . 'images' ); // Admin images URL |
| 167 | 139 | } |
| 168 | 140 | |
| 169 | 141 | /** |
| 170 | - * Include required files. | |
| 142 | + * Include required files | |
| 171 | 143 | * |
| 172 | 144 | * @since 2.0.0 bbPress (r2646) |
| 173 | 145 | * |
| 174 | 146 | * @access private |
| @@ -194,9 +166,9 @@ | ||
| 194 | 166 | require $this->admin_dir . 'users.php'; |
| 195 | 167 | } |
| 196 | 168 | |
| 197 | 169 | /** |
| 198 | - * Setup the admin hooks, actions and filters. | |
| 170 | + * Setup the admin hooks, actions and filters | |
| 199 | 171 | * |
| 200 | 172 | * @since 2.0.0 bbPress (r2646) |
| 201 | 173 | * |
| 202 | 174 | * @access private |
| @@ -246,11 +218,8 @@ | ||
| 246 | 218 | |
| 247 | 219 | // Allow keymasters to save forums settings |
| 248 | 220 | add_filter( 'option_page_capability_bbpress', array( $this, 'option_page_capability_bbpress' ) ); |
| 249 | 221 | |
| 250 | - // Maybe add post-state support for Forum & Topic Archive pages | |
| 251 | - add_filter( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 ); | |
| 252 | - | |
| 253 | 222 | /** Network Admin *****************************************************/ |
| 254 | 223 | |
| 255 | 224 | // Add menu item to settings menu |
| 256 | 225 | add_action( 'network_admin_menu', array( $this, 'network_admin_menus' ) ); |
| @@ -338,9 +307,9 @@ | ||
| 338 | 307 | } |
| 339 | 308 | } |
| 340 | 309 | |
| 341 | 310 | /** |
| 342 | - * Output all admin area notices. | |
| 311 | + * Output all admin area notices | |
| 343 | 312 | * |
| 344 | 313 | * @since 2.6.0 bbPress (r6771) |
| 345 | 314 | */ |
| 346 | 315 | public function output_notices() { |
| @@ -362,17 +331,17 @@ | ||
| 362 | 331 | echo ob_get_clean(); |
| 363 | 332 | } |
| 364 | 333 | |
| 365 | 334 | /** |
| 366 | - * Add a notice to the notices array. | |
| 335 | + * Add a notice to the notices array | |
| 367 | 336 | * |
| 368 | 337 | * @since 2.6.0 bbPress (r6771) |
| 369 | 338 | * |
| 370 | - * @param string|WP_Error $message A message to be displayed or {@link WP_Error}. | |
| 371 | - * @param string $class Optional. A class to be added to the message div. | |
| 372 | - * @param bool $is_dismissible Optional. True to dismiss, false to persist. | |
| 339 | + * @param string|WP_Error $message A message to be displayed or {@link WP_Error} | |
| 340 | + * @param string $class Optional. A class to be added to the message div | |
| 341 | + * @param bool $is_dismissible Optional. True to dismiss, false to persist | |
| 373 | 342 | * |
| 374 | - * @return bool|void False on failure, void otherwise. | |
| 343 | + * @return void | |
| 375 | 344 | */ |
| 376 | 345 | public function add_notice( $message, $class = false, $is_dismissible = true ) { |
| 377 | 346 | |
| 378 | 347 | // One message as string |
| @@ -428,13 +397,13 @@ | ||
| 428 | 397 | $this->notices[] = $message; |
| 429 | 398 | } |
| 430 | 399 | |
| 431 | 400 | /** |
| 432 | - * Escape message string output. | |
| 401 | + * Escape message string output | |
| 433 | 402 | * |
| 434 | 403 | * @since 2.6.0 bbPress (r6775) |
| 435 | 404 | * |
| 436 | - * @param string $message The message. | |
| 405 | + * @param string $message | |
| 437 | 406 | * |
| 438 | 407 | * @return string |
| 439 | 408 | */ |
| 440 | 409 | private function esc_notice( $message = '' ) { |
| @@ -482,9 +451,9 @@ | ||
| 482 | 451 | } |
| 483 | 452 | } |
| 484 | 453 | |
| 485 | 454 | /** |
| 486 | - * Add the admin menus. | |
| 455 | + * Add the admin menus | |
| 487 | 456 | * |
| 488 | 457 | * @since 2.0.0 bbPress (r2646) |
| 489 | 458 | */ |
| 490 | 459 | public function admin_menus() { |
| @@ -579,9 +548,9 @@ | ||
| 579 | 548 | ); |
| 580 | 549 | } |
| 581 | 550 | |
| 582 | 551 | /** |
| 583 | - * Add the network admin menus. | |
| 552 | + * Add the network admin menus | |
| 584 | 553 | * |
| 585 | 554 | * @since 2.1.0 bbPress (r3689) |
| 586 | 555 | */ |
| 587 | 556 | public function network_admin_menus() { |
| @@ -601,13 +570,13 @@ | ||
| 601 | 570 | ); |
| 602 | 571 | } |
| 603 | 572 | |
| 604 | 573 | /** |
| 605 | - * Register the settings. | |
| 574 | + * Register the settings | |
| 606 | 575 | * |
| 607 | 576 | * @since 2.0.0 bbPress (r2737) |
| 608 | 577 | * |
| 609 | - * @todo Put fields into multidimensional array. | |
| 578 | + * @todo Put fields into multidimensional array | |
| 610 | 579 | */ |
| 611 | 580 | public static function register_admin_settings() { |
| 612 | 581 | |
| 613 | 582 | // Bail if no sections available |
| @@ -662,18 +631,18 @@ | ||
| 662 | 631 | } |
| 663 | 632 | } |
| 664 | 633 | |
| 665 | 634 | /** |
| 666 | - * Maps settings capabilities. | |
| 635 | + * Maps settings capabilities | |
| 667 | 636 | * |
| 668 | 637 | * @since 2.2.0 bbPress (r4242) |
| 669 | 638 | * |
| 670 | - * @param array $caps Capabilities for meta capability. | |
| 671 | - * @param string $cap Capability name. | |
| 672 | - * @param int $user_id User id. | |
| 673 | - * @param array $args Arguments. | |
| 639 | + * @param array $caps Capabilities for meta capability | |
| 640 | + * @param string $cap Capability name | |
| 641 | + * @param int $user_id User id | |
| 642 | + * @param array $args Arguments | |
| 674 | 643 | * |
| 675 | - * @return array Actual capabilities for meta capability. | |
| 644 | + * @return array Actual capabilities for meta capability | |
| 676 | 645 | */ |
| 677 | 646 | public static function map_settings_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { |
| 678 | 647 | |
| 679 | 648 | // What capability is being checked? |
| @@ -724,23 +693,14 @@ | ||
| 724 | 693 | |
| 725 | 694 | break; |
| 726 | 695 | } |
| 727 | 696 | |
| 728 | - /** | |
| 729 | - * Filters the mapped Settings capabilities. | |
| 730 | - * | |
| 731 | - * @since 2.2.0 | |
| 732 | - * | |
| 733 | - * @param array $caps The capabilities for meta capability. | |
| 734 | - * @param string $cap Capability name. | |
| 735 | - * @param int $user_id User ID. | |
| 736 | - * @param array $args Arguments. | |
| 737 | - */ | |
| 697 | + // Filter & return | |
| 738 | 698 | return (array) apply_filters( 'bbp_map_settings_meta_caps', $caps, $cap, $user_id, $args ); |
| 739 | 699 | } |
| 740 | 700 | |
| 741 | 701 | /** |
| 742 | - * Register the importers. | |
| 702 | + * Register the importers | |
| 743 | 703 | * |
| 744 | 704 | * @since 2.0.0 bbPress (r2737) |
| 745 | 705 | */ |
| 746 | 706 | public function register_importers() { |
| @@ -772,15 +732,15 @@ | ||
| 772 | 732 | } |
| 773 | 733 | } |
| 774 | 734 | |
| 775 | 735 | /** |
| 776 | - * Add Settings link to plugins area. | |
| 736 | + * Add Settings link to plugins area | |
| 777 | 737 | * |
| 778 | 738 | * @since 2.0.0 bbPress (r2737) |
| 779 | 739 | * |
| 780 | - * @param array $links Links array in which we would prepend our link. | |
| 781 | - * @param string $file Current plugin basename. | |
| 782 | - * @return array Processed links. | |
| 740 | + * @param array $links Links array in which we would prepend our link | |
| 741 | + * @param string $file Current plugin basename | |
| 742 | + * @return array Processed links | |
| 783 | 743 | */ |
| 784 | 744 | public static function modify_plugin_action_links( $links, $file ) { |
| 785 | 745 | |
| 786 | 746 | // Return normal links if not bbPress |
| @@ -805,9 +765,9 @@ | ||
| 805 | 765 | return array_merge( $links, $new_links ); |
| 806 | 766 | } |
| 807 | 767 | |
| 808 | 768 | /** |
| 809 | - * Enqueue any admin scripts we might need. | |
| 769 | + * Enqueue any admin scripts we might need | |
| 810 | 770 | * |
| 811 | 771 | * @since 2.2.0 bbPress (r4260) |
| 812 | 772 | */ |
| 813 | 773 | public function enqueue_scripts() { |
| @@ -845,9 +805,9 @@ | ||
| 845 | 805 | } |
| 846 | 806 | } |
| 847 | 807 | |
| 848 | 808 | /** |
| 849 | - * Enqueue any admin scripts we might need. | |
| 809 | + * Enqueue any admin scripts we might need | |
| 850 | 810 | * |
| 851 | 811 | * @since 2.6.0 bbPress (r5224) |
| 852 | 812 | */ |
| 853 | 813 | public function enqueue_styles() { |
| @@ -855,9 +815,9 @@ | ||
| 855 | 815 | } |
| 856 | 816 | |
| 857 | 817 | /** |
| 858 | 818 | * Remove the individual recount and converter menus. |
| 859 | - * They are grouped together by h2 tabs. | |
| 819 | + * They are grouped together by h2 tabs | |
| 860 | 820 | * |
| 861 | 821 | * @since 2.0.0 bbPress (r2464) |
| 862 | 822 | */ |
| 863 | 823 | public function admin_head() { |
| @@ -872,9 +832,9 @@ | ||
| 872 | 832 | remove_submenu_page( 'index.php', 'bbp-credits' ); |
| 873 | 833 | } |
| 874 | 834 | |
| 875 | 835 | /** |
| 876 | - * Registers the bbPress admin styling and color schemes. | |
| 836 | + * Registers the bbPress admin styling and color schemes | |
| 877 | 837 | * |
| 878 | 838 | * Because wp-content can exist outside of the WordPress root, there is no |
| 879 | 839 | * way to be certain what the relative path of admin images is. |
| 880 | 840 | * |
| @@ -888,11 +848,10 @@ | ||
| 888 | 848 | |
| 889 | 849 | // Get the version to use for JS |
| 890 | 850 | $version = bbp_get_asset_version(); |
| 891 | 851 | |
| 892 | - // Register admin CSS | |
| 893 | - wp_register_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), $version ); | |
| 894 | - wp_register_style( 'bbp-admin-blocks', $this->css_url . 'blocks' . $suffix . '.css', array(), $version ); | |
| 852 | + // Register admin CSS with dashicons dependency | |
| 853 | + wp_register_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), $version ); | |
| 895 | 854 | |
| 896 | 855 | // Color schemes are not available when running out of src |
| 897 | 856 | if ( false !== strpos( plugin_basename( bbpress()->file ), 'src' ) ) { |
| 898 | 857 | return; |
| @@ -925,10 +884,14 @@ | ||
| 925 | 884 | ); |
| 926 | 885 | } |
| 927 | 886 | |
| 928 | 887 | /** |
| 929 | - * Registers the bbPress admin scripts. | |
| 888 | + * Registers the bbPress admin color schemes | |
| 930 | 889 | * |
| 890 | + * Because wp-content can exist outside of the WordPress root there is no | |
| 891 | + * way to be certain what the relative path of the admin images is. | |
| 892 | + * We are including the two most common configurations here, just in case. | |
| 893 | + * | |
| 931 | 894 | * @since 2.6.0 bbPress (r2521) |
| 932 | 895 | */ |
| 933 | 896 | public function register_admin_scripts() { |
| 934 | 897 | |
| @@ -935,18 +898,9 @@ | ||
| 935 | 898 | // Minified |
| 936 | 899 | $suffix = bbp_doing_script_debug() ? '' : '.min'; |
| 937 | 900 | |
| 938 | 901 | // Get the version to use for JS |
| 939 | - $version = bbp_get_asset_version(); | |
| 940 | - | |
| 941 | - // Array of JS dependencies for blocks | |
| 942 | - $block_js_dependencies = array( | |
| 943 | - 'wp-blocks', | |
| 944 | - 'wp-block-editor', | |
| 945 | - 'wp-components', | |
| 946 | - 'wp-i18n', | |
| 947 | - 'wp-element', | |
| 948 | - 'wp-server-side-render' | |
| 902 | + $version = bbp_get_asset_version( | |
| 949 | 903 | ); |
| 950 | 904 | |
| 951 | 905 | // Header JS |
| 952 | 906 | // phpcs:disable |
| @@ -953,22 +907,20 @@ | ||
| 953 | 907 | wp_register_script( 'bbp-admin-common-js', $this->js_url . 'common' . $suffix . '.js', array( 'jquery', 'suggest' ), $version ); |
| 954 | 908 | wp_register_script( 'bbp-admin-topics-js', $this->js_url . 'topics' . $suffix . '.js', array( 'jquery' ), $version ); |
| 955 | 909 | wp_register_script( 'bbp-admin-replies-js', $this->js_url . 'replies' . $suffix . '.js', array( 'jquery', 'suggest' ), $version ); |
| 956 | 910 | wp_register_script( 'bbp-converter', $this->js_url . 'converter' . $suffix . '.js', array( 'jquery', 'postbox', 'dashboard' ), $version ); |
| 957 | - // phpcs:enable | |
| 958 | 911 | |
| 959 | 912 | // Footer JS |
| 960 | - wp_register_script( 'bbp-admin-blocks', $this->js_url . 'blocks' . $suffix . '.js', $block_js_dependencies, $version, true ); | |
| 961 | - wp_register_script( 'bbp-admin-badge-js', $this->js_url . 'badge' . $suffix . '.js', array(), $version, true ); | |
| 913 | + wp_register_script( 'bbp-admin-badge-js', $this->js_url . 'badge' . $suffix . '.js', array(), $version, true ); | |
| 962 | 914 | } |
| 963 | 915 | |
| 964 | 916 | /** |
| 965 | - * Allow keymaster role to save Forums settings. | |
| 917 | + * Allow keymaster role to save Forums settings | |
| 966 | 918 | * |
| 967 | 919 | * @since 2.3.0 bbPress (r4678) |
| 968 | 920 | * |
| 969 | - * @param string $capability Optional. Default 'manage_options'. | |
| 970 | - * @return string Return minimum capability. | |
| 921 | + * @param string $capability | |
| 922 | + * @return string Return minimum capability | |
| 971 | 923 | */ |
| 972 | 924 | public function option_page_capability_bbpress( $capability = 'manage_options' ) { |
| 973 | 925 | $capability = $this->minimum_capability; |
| 974 | 926 | return $capability; |
| @@ -973,84 +925,12 @@ | ||
| 973 | 925 | $capability = $this->minimum_capability; |
| 974 | 926 | return $capability; |
| 975 | 927 | } |
| 976 | 928 | |
| 977 | - /** | |
| 978 | - * Add post-state support for shortcode usages. | |
| 979 | - * | |
| 980 | - * Also does a quick slug comparison, to avoid doing many get_page_by_path() | |
| 981 | - * calls inside of a list-table loop. This is less precise but should work | |
| 982 | - * well-enough for most installations. | |
| 983 | - * | |
| 984 | - * @since 2.7.0 | |
| 985 | - * | |
| 986 | - * @param array $post_states | |
| 987 | - * @param int|WP_Post $post | |
| 988 | - * | |
| 989 | - * @return array | |
| 990 | - */ | |
| 991 | - public function display_post_states( $post_states = array(), $post = 0 ) { | |
| 992 | - | |
| 993 | - // Default return value | |
| 994 | - $retval = $post_states; | |
| 995 | - | |
| 996 | - /** Shortcodes ********************************************************/ | |
| 997 | - | |
| 998 | - // Forum Archive | |
| 999 | - if ( has_shortcode( $post->post_content, 'bbp-forum-index' ) ) { | |
| 1000 | - $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' ); | |
| 1001 | - | |
| 1002 | - // Topic Archive | |
| 1003 | - } elseif ( has_shortcode( $post->post_content, 'bbp-topic-index' ) ) { | |
| 1004 | - $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' ); | |
| 1005 | - | |
| 1006 | - // Topic Tags | |
| 1007 | - } elseif ( has_shortcode( $post->post_content, 'bbp-topic-tags' ) ) { | |
| 1008 | - $retval[] = esc_html_x( 'Topic Tags', 'page label', 'bbpress' ); | |
| 1009 | - | |
| 1010 | - // Topic View | |
| 1011 | - } elseif ( has_shortcode( $post->post_content, 'bbp-single-view' ) ) { | |
| 1012 | - $retval[] = esc_html_x( 'Topic View', 'page label', 'bbpress' ); | |
| 1013 | - | |
| 1014 | - // Search | |
| 1015 | - } elseif ( has_shortcode( $post->post_content, 'bbp-search' ) ) { | |
| 1016 | - $retval[] = esc_html_x( 'Forum Search', 'page label', 'bbpress' ); | |
| 1017 | - | |
| 1018 | - // Login | |
| 1019 | - } elseif ( has_shortcode( $post->post_content, 'bbp-login' ) ) { | |
| 1020 | - $retval[] = esc_html_x( 'Forum Login', 'page label', 'bbpress' ); | |
| 1021 | - | |
| 1022 | - // Register | |
| 1023 | - } elseif ( has_shortcode( $post->post_content, 'bbp-register' ) ) { | |
| 1024 | - $retval[] = esc_html_x( 'Forum Registration', 'page label', 'bbpress' ); | |
| 1025 | - | |
| 1026 | - // Lost Password | |
| 1027 | - } elseif ( has_shortcode( $post->post_content, 'bbp-lost-pass' ) ) { | |
| 1028 | - $retval[] = esc_html_x( 'Forum Lost Password', 'page label', 'bbpress' ); | |
| 1029 | - | |
| 1030 | - // Statistics | |
| 1031 | - } elseif ( has_shortcode( $post->post_content, 'bbp-stats' ) ) { | |
| 1032 | - $retval[] = esc_html_x( 'Forum Statistics', 'page label', 'bbpress' ); | |
| 1033 | - | |
| 1034 | - /** Paths *************************************************************/ | |
| 1035 | - | |
| 1036 | - // Forum Archive | |
| 1037 | - } elseif ( bbp_get_root_slug() === $post->post_name ) { | |
| 1038 | - $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' ); | |
| 1039 | - | |
| 1040 | - // Topic Archive | |
| 1041 | - } elseif ( bbp_get_topic_archive_slug() === $post->post_name ) { | |
| 1042 | - $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' ); | |
| 1043 | - } | |
| 1044 | - | |
| 1045 | - // Return possibly modified post states | |
| 1046 | - return $retval; | |
| 1047 | - } | |
| 1048 | - | |
| 1049 | 929 | /** Ajax ******************************************************************/ |
| 1050 | 930 | |
| 1051 | 931 | /** |
| 1052 | - * Ajax action for facilitating the forum auto-suggest. | |
| 932 | + * Ajax action for facilitating the forum auto-suggest | |
| 1053 | 933 | * |
| 1054 | 934 | * @since 2.2.0 bbPress (r4261) |
| 1055 | 935 | */ |
| 1056 | 936 | public function suggest_topic() { |
| @@ -1064,9 +944,9 @@ | ||
| 1064 | 944 | if ( empty( $request ) ) { |
| 1065 | 945 | wp_die(); |
| 1066 | 946 | } |
| 1067 | 947 | |
| 1068 | - // Bail if user cannot moderate - only moderators can change hierarchy | |
| 948 | + // Bail if user cannot moderate | |
| 1069 | 949 | if ( ! current_user_can( 'moderate' ) ) { |
| 1070 | 950 | wp_die(); |
| 1071 | 951 | } |
| 1072 | 952 | |
| @@ -1076,28 +956,25 @@ | ||
| 1076 | 956 | // Allow the maximum number of results to be filtered |
| 1077 | 957 | $number = (int) apply_filters( 'bbp_suggest_topic_count', 10 ); |
| 1078 | 958 | |
| 1079 | 959 | // Try to get some topics |
| 1080 | - $topics = get_posts( | |
| 1081 | - array( | |
| 1082 | - 's' => bbp_db()->esc_like( $request ), | |
| 1083 | - 'post_type' => bbp_get_topic_post_type(), | |
| 1084 | - 'posts_per_page' => $number, | |
| 960 | + $topics = get_posts( array( | |
| 961 | + 's' => bbp_db()->esc_like( $_REQUEST['q'] ), | |
| 962 | + 'post_type' => bbp_get_topic_post_type(), | |
| 963 | + 'posts_per_page' => $number, | |
| 1085 | 964 | |
| 1086 | - // Performance | |
| 1087 | - 'nopaging' => true, | |
| 1088 | - 'suppress_filters' => true, | |
| 1089 | - 'update_post_term_cache' => false, | |
| 1090 | - 'update_post_meta_cache' => false, | |
| 1091 | - 'ignore_sticky_posts' => true, | |
| 1092 | - 'no_found_rows' => true | |
| 1093 | - ) | |
| 1094 | - ); | |
| 965 | + // Performance | |
| 966 | + 'nopaging' => true, | |
| 967 | + 'suppress_filters' => true, | |
| 968 | + 'update_post_term_cache' => false, | |
| 969 | + 'update_post_meta_cache' => false, | |
| 970 | + 'ignore_sticky_posts' => true, | |
| 971 | + 'no_found_rows' => true | |
| 972 | + ) ); | |
| 1095 | 973 | |
| 1096 | 974 | // If we found some topics, loop through and display them |
| 1097 | 975 | if ( ! empty( $topics ) ) { |
| 1098 | 976 | foreach ( (array) $topics as $post ) { |
| 1099 | - /* translators: 1: Topic ID, 2: Topic title */ | |
| 1100 | 977 | printf( esc_html__( '%1$s - %2$s', 'bbpress' ), bbp_get_topic_id( $post->ID ), bbp_get_topic_title( $post->ID ) . "\n" ); |
| 1101 | 978 | } |
| 1102 | 979 | } |
| 1103 | 980 | die(); |
| @@ -1103,9 +980,9 @@ | ||
| 1103 | 980 | die(); |
| 1104 | 981 | } |
| 1105 | 982 | |
| 1106 | 983 | /** |
| 1107 | - * Ajax action for facilitating the topic and reply author auto-suggest. | |
| 984 | + * Ajax action for facilitating the topic and reply author auto-suggest | |
| 1108 | 985 | * |
| 1109 | 986 | * @since 2.4.0 bbPress (r5014) |
| 1110 | 987 | */ |
| 1111 | 988 | public function suggest_user() { |
| @@ -1131,9 +1008,9 @@ | ||
| 1131 | 1008 | // Fields to retrieve & search by |
| 1132 | 1009 | $fields = $search = array( 'ID', 'user_nicename' ); |
| 1133 | 1010 | |
| 1134 | 1011 | // Keymasters & Super-Mods can also search by email |
| 1135 | - if ( bbp_is_user_keymaster( bbp_get_current_user_id() ) || bbp_allow_super_mods() ) { | |
| 1012 | + if ( current_user_can( 'keep_gate' ) || bbp_allow_super_mods() ) { | |
| 1136 | 1013 | |
| 1137 | 1014 | // Add user_email to searchable columns |
| 1138 | 1015 | array_push( $search, 'user_email' ); |
| 1139 | 1016 | |
| @@ -1164,28 +1041,21 @@ | ||
| 1164 | 1041 | // Allow the maximum number of results to be filtered |
| 1165 | 1042 | $number = (int) apply_filters( 'bbp_suggest_user_count', 10 ); |
| 1166 | 1043 | |
| 1167 | 1044 | // Query database for users based on above criteria |
| 1168 | - $users_query = new WP_User_Query( | |
| 1169 | - array( | |
| 1170 | - 'search' => '*' . bbp_db()->esc_like( $suggest ) . '*', | |
| 1171 | - 'fields' => $fields, | |
| 1172 | - 'search_columns' => $search, | |
| 1173 | - 'orderby' => 'ID', | |
| 1174 | - 'number' => $number, | |
| 1175 | - 'count_total' => false | |
| 1176 | - ) | |
| 1177 | - ); | |
| 1045 | + $users_query = new WP_User_Query( array( | |
| 1046 | + 'search' => '*' . bbp_db()->esc_like( $suggest ) . '*', | |
| 1047 | + 'fields' => $fields, | |
| 1048 | + 'search_columns' => $search, | |
| 1049 | + 'orderby' => 'ID', | |
| 1050 | + 'number' => $number, | |
| 1051 | + 'count_total' => false | |
| 1052 | + ) ); | |
| 1178 | 1053 | |
| 1179 | 1054 | // If we found some users, loop through and output them to the AJAX |
| 1180 | 1055 | if ( ! empty( $users_query->results ) ) { |
| 1181 | 1056 | foreach ( (array) $users_query->results as $user ) { |
| 1182 | - printf( | |
| 1183 | - /* translators: 1: User ID, 2: User nicename */ | |
| 1184 | - esc_html__( '%1$s - %2$s', 'bbpress' ), | |
| 1185 | - bbp_get_user_id( $user->ID ), | |
| 1186 | - bbp_get_user_nicename( $user->ID, array( 'force' => $user->user_nicename ) ) . "\n" | |
| 1187 | - ); | |
| 1057 | + printf( esc_html__( '%1$s - %2$s', 'bbpress' ), bbp_get_user_id( $user->ID ), bbp_get_user_nicename( $user->ID, array( 'force' => $user->user_nicename ) ) . "\n" ); | |
| 1188 | 1058 | } |
| 1189 | 1059 | } |
| 1190 | 1060 | die(); |
| 1191 | 1061 | } |
| @@ -1192,11 +1062,11 @@ | ||
| 1192 | 1062 | |
| 1193 | 1063 | /** About *****************************************************************/ |
| 1194 | 1064 | |
| 1195 | 1065 | /** |
| 1196 | - * Output the shared screen header for about_screen() & credits_screen(). | |
| 1066 | + * Output the shared screen header for about_screen() & credits_screen() | |
| 1197 | 1067 | * |
| 1198 | - * Contains title, subtitle, and badge area. | |
| 1068 | + * Contains title, subtitle, and badge area | |
| 1199 | 1069 | * |
| 1200 | 1070 | * @since 2.6.0 bbPress (r6604) |
| 1201 | 1071 | */ |
| 1202 | 1072 | private function screen_header() { |
| @@ -1201,17 +1071,9 @@ | ||
| 1201 | 1071 | */ |
| 1202 | 1072 | private function screen_header() { |
| 1203 | 1073 | list( $display_version ) = explode( '-', bbp_get_version() ); ?> |
| 1204 | 1074 | |
| 1205 | - <h1 class="wp-heading-inline"> | |
| 1206 | - <?php | |
| 1207 | - printf( | |
| 1208 | - /* translators: %s: bbPress version number */ | |
| 1209 | - esc_html__( 'Welcome to bbPress %s', 'bbpress' ), | |
| 1210 | - $display_version | |
| 1211 | - ); | |
| 1212 | - ?> | |
| 1213 | - </h1> | |
| 1075 | + <h1 class="wp-heading-inline"><?php printf( esc_html__( 'Welcome to bbPress %s', 'bbpress' ), $display_version ); ?></h1> | |
| 1214 | 1076 | <hr class="wp-header-end"> |
| 1215 | 1077 | <div class="about-text"><?php printf( esc_html__( 'bbPress is fun to use, contains no artificial colors or preservatives, and is absolutely wonderful in every environment. Your community is going to love using it.', 'bbpress' ), $display_version ); ?></div> |
| 1216 | 1078 | |
| 1217 | 1079 | <span class="bbp-hive" id="bbp-hive"></span> |
| @@ -1222,9 +1084,9 @@ | ||
| 1222 | 1084 | <?php |
| 1223 | 1085 | } |
| 1224 | 1086 | |
| 1225 | 1087 | /** |
| 1226 | - * Output the about screen. | |
| 1088 | + * Output the about screen | |
| 1227 | 1089 | * |
| 1228 | 1090 | * @since 2.2.0 bbPress (r4159) |
| 1229 | 1091 | * |
| 1230 | 1092 | * @todo Host this remotely. |
| @@ -1296,9 +1158,9 @@ | ||
| 1296 | 1158 | <?php |
| 1297 | 1159 | } |
| 1298 | 1160 | |
| 1299 | 1161 | /** |
| 1300 | - * Output the credits screen. | |
| 1162 | + * Output the credits screen | |
| 1301 | 1163 | * |
| 1302 | 1164 | * @since 2.2.0 bbPress (r4159) |
| 1303 | 1165 | * |
| 1304 | 1166 | * @todo Host this remotely. |
| @@ -1438,9 +1300,9 @@ | ||
| 1438 | 1300 | |
| 1439 | 1301 | /** Updaters **************************************************************/ |
| 1440 | 1302 | |
| 1441 | 1303 | /** |
| 1442 | - * Update all bbPress forums across all sites. | |
| 1304 | + * Update all bbPress forums across all sites | |
| 1443 | 1305 | * |
| 1444 | 1306 | * @since 2.1.0 bbPress (r3689) |
| 1445 | 1307 | */ |
| 1446 | 1308 | public static function update_screen() { |
| @@ -1468,10 +1330,9 @@ | ||
| 1468 | 1330 | |
| 1469 | 1331 | break; |
| 1470 | 1332 | |
| 1471 | 1333 | case 'show' : |
| 1472 | - default : | |
| 1473 | - ?> | |
| 1334 | + default : ?> | |
| 1474 | 1335 | |
| 1475 | 1336 | <p><?php esc_html_e( 'You can update your forum through this page. Hit the link below to update.', 'bbpress' ); ?></p> |
| 1476 | 1337 | <p><a class="button" href="index.php?page=bbp-update&action=bbp-update"><?php esc_html_e( 'Update Forum', 'bbpress' ); ?></a></p> |
| 1477 | 1338 | |
| @@ -1482,9 +1343,9 @@ | ||
| 1482 | 1343 | </div><?php |
| 1483 | 1344 | } |
| 1484 | 1345 | |
| 1485 | 1346 | /** |
| 1486 | - * Update all bbPress forums across all sites. | |
| 1347 | + * Update all bbPress forums across all sites | |
| 1487 | 1348 | * |
| 1488 | 1349 | * @since 2.1.0 bbPress (r3689) |
| 1489 | 1350 | */ |
| 1490 | 1351 | public static function network_update_screen() { |
| @@ -1526,15 +1387,12 @@ | ||
| 1526 | 1387 | |
| 1527 | 1388 | // Get site URLs |
| 1528 | 1389 | $site_url = get_site_url( $details['blog_id'] ); |
| 1529 | 1390 | $admin_url = get_site_url( $details['blog_id'], 'wp-admin.php', 'admin' ); |
| 1530 | - $remote_url = add_query_arg( | |
| 1531 | - array( | |
| 1532 | - 'page' => 'bbp-update', | |
| 1533 | - 'action' => 'bbp-update' | |
| 1534 | - ), | |
| 1535 | - $admin_url | |
| 1536 | - ); ?> | |
| 1391 | + $remote_url = add_query_arg( array( | |
| 1392 | + 'page' => 'bbp-update', | |
| 1393 | + 'action' => 'bbp-update' | |
| 1394 | + ), $admin_url ); ?> | |
| 1537 | 1395 | |
| 1538 | 1396 | <li><?php echo esc_html( $site_url ); ?></li> |
| 1539 | 1397 | |
| 1540 | 1398 | <?php |
| @@ -1549,20 +1407,13 @@ | ||
| 1549 | 1407 | ); |
| 1550 | 1408 | |
| 1551 | 1409 | // Site errored out, no response? |
| 1552 | 1410 | if ( is_wp_error( $response ) ) { |
| 1553 | - wp_die( | |
| 1554 | - sprintf( | |
| 1555 | - /* translators: 1: Site URL, 2: Error message */ | |
| 1556 | - esc_html__( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s', 'bbpress' ), | |
| 1557 | - $site_url, | |
| 1558 | - '<em>' . $response->get_error_message() . '</em>' | |
| 1559 | - ) | |
| 1560 | - ); | |
| 1411 | + wp_die( sprintf( esc_html__( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s', 'bbpress' ), $site_url, '<em>' . $response->get_error_message() . '</em>' ) ); | |
| 1561 | 1412 | } |
| 1562 | 1413 | |
| 1563 | 1414 | // Switch to the new site |
| 1564 | - bbp_switch_to_site( $details['blog_id'] ); | |
| 1415 | + bbp_switch_to_site( $details[ 'blog_id' ] ); | |
| 1565 | 1416 | |
| 1566 | 1417 | $basename = bbpress()->basename; |
| 1567 | 1418 | |
| 1568 | 1419 | // Run the updater on this site |
| @@ -1573,10 +1424,10 @@ | ||
| 1573 | 1424 | // Restore original site |
| 1574 | 1425 | bbp_restore_current_site(); |
| 1575 | 1426 | |
| 1576 | 1427 | // Do some actions to allow plugins to do things too |
| 1577 | - do_action( 'after_bbpress_upgrade', $response ); | |
| 1578 | - do_action( 'bbp_upgrade_site', $details['blog_id'] ); | |
| 1428 | + do_action( 'after_bbpress_upgrade', $response ); | |
| 1429 | + do_action( 'bbp_upgrade_site', $details[ 'blog_id' ] ); | |
| 1579 | 1430 | |
| 1580 | 1431 | endforeach; ?> |
| 1581 | 1432 | |
| 1582 | 1433 | </ul> |
| @@ -1587,9 +1438,9 @@ | ||
| 1587 | 1438 | </p> |
| 1588 | 1439 | <script type='text/javascript'> |
| 1589 | 1440 | <!-- |
| 1590 | 1441 | function nextpage() { |
| 1591 | - location.href = 'update-core.php?page=bbpress-update&action=bbpress-update&n=<?php echo ( $n + 5 ); ?>'; | |
| 1442 | + location.href = 'update-core.php?page=bbpress-update&action=bbpress-update&n=<?php echo ( $n + 5 ) ?>'; | |
| 1592 | 1443 | } |
| 1593 | 1444 | setTimeout( 'nextpage()', 250 ); |
| 1594 | 1445 | //--> |
| 1595 | 1446 | </script><?php |
| @@ -1598,10 +1449,10 @@ | ||
| 1598 | 1449 | |
| 1599 | 1450 | break; |
| 1600 | 1451 | |
| 1601 | 1452 | case 'show' : |
| 1602 | - default : | |
| 1603 | - ?> | |
| 1453 | + default : ?> | |
| 1454 | + | |
| 1604 | 1455 | <p><?php esc_html_e( 'You can update all the forums on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update.', 'bbpress' ); ?></p> |
| 1605 | 1456 | <p><a class="button" href="update-core.php?page=bbpress-update&action=bbpress-update"><?php esc_html_e( 'Update Forums', 'bbpress' ); ?></a></p> |
| 1606 | 1457 | |
| 1607 | 1458 | <?php break; |