PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
← All changes | includes/admin/classes/class-bbp-admin.php +101 -250 trunk → 2.6.19 View file →
@@ -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 (r3071)
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 (r3338)
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 (r3338)
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 (r3338)
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() {
@@ -580,9 +549,9 @@
580 549 );
581 550 }
582 551
583 552 /**
584 - * Add the network admin menus.
553 + * Add the network admin menus
585 554 *
586 555 * @since 2.1.0 bbPress (r3731)
587 556 */
588 557 public function network_admin_menus() {
@@ -602,13 +571,13 @@
602 571 );
603 572 }
604 573
605 574 /**
606 - * Register the settings.
575 + * Register the settings
607 576 *
608 577 * @since 2.0.0 bbPress (r2737)
609 578 *
610 - * @todo Put fields into multidimensional array.
579 + * @todo Put fields into multidimensional array
611 580 */
612 581 public static function register_admin_settings() {
613 582
614 583 // Bail if no sections available
@@ -663,18 +632,18 @@
663 632 }
664 633 }
665 634
666 635 /**
667 - * Maps settings capabilities.
636 + * Maps settings capabilities
668 637 *
669 638 * @since 2.2.0 bbPress (r4244)
670 639 *
671 - * @param array $caps Capabilities for meta capability.
672 - * @param string $cap Capability name.
673 - * @param int $user_id User id.
674 - * @param array $args Arguments.
640 + * @param array $caps Capabilities for meta capability
641 + * @param string $cap Capability name
642 + * @param int $user_id User id
643 + * @param array $args Arguments
675 644 *
676 - * @return array Actual capabilities for meta capability.
645 + * @return array Actual capabilities for meta capability
677 646 */
678 647 public static function map_settings_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
679 648
680 649 // What capability is being checked?
@@ -732,23 +701,14 @@
732 701
733 702 break;
734 703 }
735 704
736 - /**
737 - * Filters the mapped Settings capabilities.
738 - *
739 - * @since 2.2.0 bbPress (r4244)
740 - *
741 - * @param array $caps The capabilities for meta capability.
742 - * @param string $cap Capability name.
743 - * @param int $user_id User ID.
744 - * @param array $args Arguments.
745 - */
705 + // Filter & return
746 706 return (array) apply_filters( 'bbp_map_settings_meta_caps', $caps, $cap, $user_id, $args );
747 707 }
748 708
749 709 /**
750 - * Register the importers.
710 + * Register the importers
751 711 *
752 712 * @since 2.0.0 bbPress (r3194)
753 713 */
754 714 public function register_importers() {
@@ -780,15 +740,15 @@
780 740 }
781 741 }
782 742
783 743 /**
784 - * Add Settings link to plugins area.
744 + * Add Settings link to plugins area
785 745 *
786 746 * @since 2.2.0 bbPress (r4159)
787 747 *
788 - * @param array $links Links array in which we would prepend our link.
789 - * @param string $file Current plugin basename.
790 - * @return array Processed links.
748 + * @param array $links Links array in which we would prepend our link
749 + * @param string $file Current plugin basename
750 + * @return array Processed links
791 751 */
792 752 public static function modify_plugin_action_links( $links, $file ) {
793 753
794 754 // Return normal links if not bbPress
@@ -813,9 +773,9 @@
813 773 return array_merge( $links, $new_links );
814 774 }
815 775
816 776 /**
817 - * Enqueue any admin scripts we might need.
777 + * Enqueue any admin scripts we might need
818 778 *
819 779 * @since 2.2.0 bbPress (r4261)
820 780 */
821 781 public function enqueue_scripts() {
@@ -853,9 +813,9 @@
853 813 }
854 814 }
855 815
856 816 /**
857 - * Enqueue any admin scripts we might need.
817 + * Enqueue any admin scripts we might need
858 818 *
859 819 * @since 2.6.0 bbPress (r5225)
860 820 */
861 821 public function enqueue_styles() {
@@ -863,9 +823,9 @@
863 823 }
864 824
865 825 /**
866 826 * Remove the individual recount and converter menus.
867 - * They are grouped together by h2 tabs.
827 + * They are grouped together by h2 tabs
868 828 *
869 829 * @since 2.0.0 bbPress (r2464)
870 830 */
871 831 public function admin_head() {
@@ -880,9 +840,9 @@
880 840 remove_submenu_page( 'index.php', 'bbp-credits' );
881 841 }
882 842
883 843 /**
884 - * Registers the bbPress admin styling and color schemes.
844 + * Registers the bbPress admin styling and color schemes
885 845 *
886 846 * Because wp-content can exist outside of the WordPress root, there is no
887 847 * way to be certain what the relative path of admin images is.
888 848 *
@@ -896,11 +856,10 @@
896 856
897 857 // Get the version to use for JS
898 858 $version = bbp_get_asset_version();
899 859
900 - // Register admin CSS
901 - wp_register_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), $version );
902 - wp_register_style( 'bbp-admin-blocks', $this->css_url . 'blocks' . $suffix . '.css', array(), $version );
860 + // Register admin CSS with dashicons dependency
861 + wp_register_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), $version );
903 862
904 863 // Color schemes are not available when running out of src
905 864 if ( false !== strpos( plugin_basename( bbpress()->file ), 'src' ) ) {
906 865 return;
@@ -933,10 +892,14 @@
933 892 );
934 893 }
935 894
936 895 /**
937 - * Registers the bbPress admin scripts.
896 + * Registers the bbPress admin color schemes
938 897 *
898 + * Because wp-content can exist outside of the WordPress root there is no
899 + * way to be certain what the relative path of the admin images is.
900 + * We are including the two most common configurations here, just in case.
901 + *
939 902 * @since 2.6.0 bbPress (r6913)
940 903 */
941 904 public function register_admin_scripts() {
942 905
@@ -943,18 +906,9 @@
943 906 // Minified
944 907 $suffix = bbp_doing_script_debug() ? '' : '.min';
945 908
946 909 // Get the version to use for JS
947 - $version = bbp_get_asset_version();
948 -
949 - // Array of JS dependencies for blocks
950 - $block_js_dependencies = array(
951 - 'wp-blocks',
952 - 'wp-block-editor',
953 - 'wp-components',
954 - 'wp-i18n',
955 - 'wp-element',
956 - 'wp-server-side-render'
910 + $version = bbp_get_asset_version(
957 911 );
958 912
959 913 // Header JS
960 914 // phpcs:disable
@@ -961,22 +915,20 @@
961 915 wp_register_script( 'bbp-admin-common-js', $this->js_url . 'common' . $suffix . '.js', array( 'jquery', 'suggest' ), $version );
962 916 wp_register_script( 'bbp-admin-topics-js', $this->js_url . 'topics' . $suffix . '.js', array( 'jquery' ), $version );
963 917 wp_register_script( 'bbp-admin-replies-js', $this->js_url . 'replies' . $suffix . '.js', array( 'jquery', 'suggest' ), $version );
964 918 wp_register_script( 'bbp-converter', $this->js_url . 'converter' . $suffix . '.js', array( 'jquery', 'postbox', 'dashboard' ), $version );
965 - // phpcs:enable
966 919
967 920 // Footer JS
968 - wp_register_script( 'bbp-admin-blocks', $this->js_url . 'blocks' . $suffix . '.js', $block_js_dependencies, $version, true );
969 - wp_register_script( 'bbp-admin-badge-js', $this->js_url . 'badge' . $suffix . '.js', array(), $version, true );
921 + wp_register_script( 'bbp-admin-badge-js', $this->js_url . 'badge' . $suffix . '.js', array(), $version, true );
970 922 }
971 923
972 924 /**
973 - * Allow keymaster role to save Forums settings.
925 + * Allow keymaster role to save Forums settings
974 926 *
975 927 * @since 2.3.0 bbPress (r4678)
976 928 *
977 - * @param string $capability Optional. Default 'manage_options'.
978 - * @return string Return minimum capability.
929 + * @param string $capability
930 + * @return string Return minimum capability
979 931 */
980 932 public function option_page_capability_bbpress( $capability = 'manage_options' ) {
981 933 $capability = $this->minimum_capability;
982 934 return $capability;
@@ -981,84 +933,12 @@
981 933 $capability = $this->minimum_capability;
982 934 return $capability;
983 935 }
984 936
985 - /**
986 - * Add post-state support for shortcode usages.
987 - *
988 - * Also does a quick slug comparison, to avoid doing many get_page_by_path()
989 - * calls inside of a list-table loop. This is less precise but should work
990 - * well-enough for most installations.
991 - *
992 - * @since 2.7.0 bbPress (r7278)
993 - *
994 - * @param array $post_states
995 - * @param int|WP_Post $post
996 - *
997 - * @return array
998 - */
999 - public function display_post_states( $post_states = array(), $post = 0 ) {
1000 -
1001 - // Default return value
1002 - $retval = $post_states;
1003 -
1004 - /** Shortcodes ********************************************************/
1005 -
1006 - // Forum Archive
1007 - if ( has_shortcode( $post->post_content, 'bbp-forum-index' ) ) {
1008 - $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' );
1009 -
1010 - // Topic Archive
1011 - } elseif ( has_shortcode( $post->post_content, 'bbp-topic-index' ) ) {
1012 - $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' );
1013 -
1014 - // Topic Tags
1015 - } elseif ( has_shortcode( $post->post_content, 'bbp-topic-tags' ) ) {
1016 - $retval[] = esc_html_x( 'Topic Tags', 'page label', 'bbpress' );
1017 -
1018 - // Topic View
1019 - } elseif ( has_shortcode( $post->post_content, 'bbp-single-view' ) ) {
1020 - $retval[] = esc_html_x( 'Topic View', 'page label', 'bbpress' );
1021 -
1022 - // Search
1023 - } elseif ( has_shortcode( $post->post_content, 'bbp-search' ) ) {
1024 - $retval[] = esc_html_x( 'Forum Search', 'page label', 'bbpress' );
1025 -
1026 - // Login
1027 - } elseif ( has_shortcode( $post->post_content, 'bbp-login' ) ) {
1028 - $retval[] = esc_html_x( 'Forum Login', 'page label', 'bbpress' );
1029 -
1030 - // Register
1031 - } elseif ( has_shortcode( $post->post_content, 'bbp-register' ) ) {
1032 - $retval[] = esc_html_x( 'Forum Registration', 'page label', 'bbpress' );
1033 -
1034 - // Lost Password
1035 - } elseif ( has_shortcode( $post->post_content, 'bbp-lost-pass' ) ) {
1036 - $retval[] = esc_html_x( 'Forum Lost Password', 'page label', 'bbpress' );
1037 -
1038 - // Statistics
1039 - } elseif ( has_shortcode( $post->post_content, 'bbp-stats' ) ) {
1040 - $retval[] = esc_html_x( 'Forum Statistics', 'page label', 'bbpress' );
1041 -
1042 - /** Paths *************************************************************/
1043 -
1044 - // Forum Archive
1045 - } elseif ( bbp_get_root_slug() === $post->post_name ) {
1046 - $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' );
1047 -
1048 - // Topic Archive
1049 - } elseif ( bbp_get_topic_archive_slug() === $post->post_name ) {
1050 - $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' );
1051 - }
1052 -
1053 - // Return possibly modified post states
1054 - return $retval;
1055 - }
1056 -
1057 937 /** Ajax ******************************************************************/
1058 938
1059 939 /**
1060 - * Ajax action for facilitating the forum auto-suggest.
940 + * Ajax action for facilitating the forum auto-suggest
1061 941 *
1062 942 * @since 2.2.0 bbPress (r4261)
1063 943 */
1064 944 public function suggest_topic() {
@@ -1072,9 +952,9 @@
1072 952 if ( empty( $request ) ) {
1073 953 wp_die();
1074 954 }
1075 955
1076 - // Bail if user cannot moderate - only moderators can change hierarchy
956 + // Bail if user cannot moderate
1077 957 if ( ! current_user_can( 'moderate' ) ) {
1078 958 wp_die();
1079 959 }
1080 960
@@ -1084,28 +964,25 @@
1084 964 // Allow the maximum number of results to be filtered
1085 965 $number = (int) apply_filters( 'bbp_suggest_topic_count', 10 );
1086 966
1087 967 // Try to get some topics
1088 - $topics = get_posts(
1089 - array(
1090 - 's' => bbp_db()->esc_like( $request ),
1091 - 'post_type' => bbp_get_topic_post_type(),
1092 - 'posts_per_page' => $number,
968 + $topics = get_posts( array(
969 + 's' => bbp_db()->esc_like( $_REQUEST['q'] ),
970 + 'post_type' => bbp_get_topic_post_type(),
971 + 'posts_per_page' => $number,
1093 972
1094 - // Performance
1095 - 'nopaging' => true,
1096 - 'suppress_filters' => true,
1097 - 'update_post_term_cache' => false,
1098 - 'update_post_meta_cache' => false,
1099 - 'ignore_sticky_posts' => true,
1100 - 'no_found_rows' => true
1101 - )
1102 - );
973 + // Performance
974 + 'nopaging' => true,
975 + 'suppress_filters' => true,
976 + 'update_post_term_cache' => false,
977 + 'update_post_meta_cache' => false,
978 + 'ignore_sticky_posts' => true,
979 + 'no_found_rows' => true
980 + ) );
1103 981
1104 982 // If we found some topics, loop through and display them
1105 983 if ( ! empty( $topics ) ) {
1106 984 foreach ( (array) $topics as $post ) {
1107 - /* translators: 1: Topic ID, 2: Topic title */
1108 985 printf( esc_html__( '%1$s - %2$s', 'bbpress' ), bbp_get_topic_id( $post->ID ), esc_html( bbp_get_topic_title( $post->ID ) ) . "\n" );
1109 986 }
1110 987 }
1111 988 die();
@@ -1111,9 +988,9 @@
1111 988 die();
1112 989 }
1113 990
1114 991 /**
1115 - * Ajax action for facilitating the topic and reply author auto-suggest.
992 + * Ajax action for facilitating the topic and reply author auto-suggest
1116 993 *
1117 994 * @since 2.4.0 bbPress (r5015)
1118 995 */
1119 996 public function suggest_user() {
@@ -1139,9 +1016,9 @@
1139 1016 // Fields to retrieve & search by
1140 1017 $fields = $search = array( 'ID', 'user_nicename' );
1141 1018
1142 1019 // Keymasters & Super-Mods can also search by email
1143 - if ( bbp_is_user_keymaster( bbp_get_current_user_id() ) || bbp_allow_super_mods() ) {
1020 + if ( current_user_can( 'keep_gate' ) || bbp_allow_super_mods() ) {
1144 1021
1145 1022 // Add user_email to searchable columns
1146 1023 array_push( $search, 'user_email' );
1147 1024
@@ -1172,28 +1049,21 @@
1172 1049 // Allow the maximum number of results to be filtered
1173 1050 $number = (int) apply_filters( 'bbp_suggest_user_count', 10 );
1174 1051
1175 1052 // Query database for users based on above criteria
1176 - $users_query = new WP_User_Query(
1177 - array(
1178 - 'search' => '*' . bbp_db()->esc_like( $suggest ) . '*',
1179 - 'fields' => $fields,
1180 - 'search_columns' => $search,
1181 - 'orderby' => 'ID',
1182 - 'number' => $number,
1183 - 'count_total' => false
1184 - )
1185 - );
1053 + $users_query = new WP_User_Query( array(
1054 + 'search' => '*' . bbp_db()->esc_like( $suggest ) . '*',
1055 + 'fields' => $fields,
1056 + 'search_columns' => $search,
1057 + 'orderby' => 'ID',
1058 + 'number' => $number,
1059 + 'count_total' => false
1060 + ) );
1186 1061
1187 1062 // If we found some users, loop through and output them to the AJAX
1188 1063 if ( ! empty( $users_query->results ) ) {
1189 1064 foreach ( (array) $users_query->results as $user ) {
1190 - printf(
1191 - /* translators: 1: User ID, 2: User nicename */
1192 - esc_html__( '%1$s - %2$s', 'bbpress' ),
1193 - bbp_get_user_id( $user->ID ),
1194 - esc_html( bbp_get_user_nicename( $user->ID, array( 'force' => $user->user_nicename ) ) ) . "\n"
1195 - );
1065 + printf( esc_html__( '%1$s - %2$s', 'bbpress' ), bbp_get_user_id( $user->ID ), esc_html( bbp_get_user_nicename( $user->ID, array( 'force' => $user->user_nicename ) ) ) . "\n" );
1196 1066 }
1197 1067 }
1198 1068 die();
1199 1069 }
@@ -1200,11 +1070,11 @@
1200 1070
1201 1071 /** About *****************************************************************/
1202 1072
1203 1073 /**
1204 - * Output the shared screen header for about_screen() & credits_screen().
1074 + * Output the shared screen header for about_screen() & credits_screen()
1205 1075 *
1206 - * Contains title, subtitle, and badge area.
1076 + * Contains title, subtitle, and badge area
1207 1077 *
1208 1078 * @since 2.6.0 bbPress (r6604)
1209 1079 */
1210 1080 private function screen_header() {
@@ -1209,17 +1079,9 @@
1209 1079 */
1210 1080 private function screen_header() {
1211 1081 list( $display_version ) = explode( '-', bbp_get_version() ); ?>
1212 1082
1213 - <h1 class="wp-heading-inline">
1214 - <?php
1215 - printf(
1216 - /* translators: %s: bbPress version number */
1217 - esc_html__( 'Welcome to bbPress %s', 'bbpress' ),
1218 - $display_version
1219 - );
1220 - ?>
1221 - </h1>
1083 + <h1 class="wp-heading-inline"><?php printf( esc_html__( 'Welcome to bbPress %s', 'bbpress' ), $display_version ); ?></h1>
1222 1084 <hr class="wp-header-end">
1223 1085 <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>
1224 1086
1225 1087 <span class="bbp-hive" id="bbp-hive"></span>
@@ -1230,9 +1092,9 @@
1230 1092 <?php
1231 1093 }
1232 1094
1233 1095 /**
1234 - * Output the about screen.
1096 + * Output the about screen
1235 1097 *
1236 1098 * @since 2.2.0 bbPress (r4159)
1237 1099 *
1238 1100 * @todo Host this remotely.
@@ -1304,9 +1166,9 @@
1304 1166 <?php
1305 1167 }
1306 1168
1307 1169 /**
1308 - * Output the credits screen.
1170 + * Output the credits screen
1309 1171 *
1310 1172 * @since 2.2.0 bbPress (r4159)
1311 1173 *
1312 1174 * @todo Host this remotely.
@@ -1446,9 +1308,9 @@
1446 1308
1447 1309 /** Updaters **************************************************************/
1448 1310
1449 1311 /**
1450 - * Update all bbPress forums across all sites.
1312 + * Update all bbPress forums across all sites
1451 1313 *
1452 1314 * @since 2.1.0 bbPress (r3731)
1453 1315 */
1454 1316 public static function update_screen() {
@@ -1477,10 +1339,9 @@
1477 1339
1478 1340 break;
1479 1341
1480 1342 case 'show' :
1481 - default :
1482 - ?>
1343 + default : ?>
1483 1344
1484 1345 <p><?php esc_html_e( 'You can update your forum through this page. Hit the link below to update.', 'bbpress' ); ?></p>
1485 1346 <p><a class="button" href="<?php echo esc_url( wp_nonce_url( 'index.php?page=bbp-update&action=bbp-update', 'bbp-update' ) ); ?>"><?php esc_html_e( 'Update Forum', 'bbpress' ); ?></a></p>
1486 1347
@@ -1491,9 +1352,9 @@
1491 1352 </div><?php
1492 1353 }
1493 1354
1494 1355 /**
1495 - * Update all bbPress forums across all sites.
1356 + * Update all bbPress forums across all sites
1496 1357 *
1497 1358 * @since 2.1.0 bbPress (r3731)
1498 1359 */
1499 1360 public static function network_update_screen() {
@@ -1536,15 +1397,12 @@
1536 1397
1537 1398 // Get site URLs
1538 1399 $site_url = get_site_url( $details['blog_id'] );
1539 1400 $admin_url = get_site_url( $details['blog_id'], 'wp-admin.php', 'admin' );
1540 - $remote_url = add_query_arg(
1541 - array(
1542 - 'page' => 'bbp-update',
1543 - 'action' => 'bbp-update'
1544 - ),
1545 - $admin_url
1546 - ); ?>
1401 + $remote_url = add_query_arg( array(
1402 + 'page' => 'bbp-update',
1403 + 'action' => 'bbp-update'
1404 + ), $admin_url ); ?>
1547 1405
1548 1406 <li><?php echo esc_html( $site_url ); ?></li>
1549 1407
1550 1408 <?php
@@ -1559,20 +1417,13 @@
1559 1417 );
1560 1418
1561 1419 // Site errored out, no response?
1562 1420 if ( is_wp_error( $response ) ) {
1563 - wp_die(
1564 - sprintf(
1565 - /* translators: 1: Site URL, 2: Error message */
1566 - 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' ),
1567 - $site_url,
1568 - '<em>' . $response->get_error_message() . '</em>'
1569 - )
1570 - );
1421 + 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>' ) );
1571 1422 }
1572 1423
1573 1424 // Switch to the new site
1574 - bbp_switch_to_site( $details['blog_id'] );
1425 + bbp_switch_to_site( $details[ 'blog_id' ] );
1575 1426
1576 1427 $basename = bbpress()->basename;
1577 1428
1578 1429 // Run the updater on this site
@@ -1583,10 +1434,10 @@
1583 1434 // Restore original site
1584 1435 bbp_restore_current_site();
1585 1436
1586 1437 // Do some actions to allow plugins to do things too
1587 - do_action( 'after_bbpress_upgrade', $response );
1588 - do_action( 'bbp_upgrade_site', $details['blog_id'] );
1438 + do_action( 'after_bbpress_upgrade', $response );
1439 + do_action( 'bbp_upgrade_site', $details[ 'blog_id' ] );
1589 1440
1590 1441 endforeach; ?>
1591 1442
1592 1443 </ul>
@@ -1608,10 +1459,10 @@
1608 1459
1609 1460 break;
1610 1461
1611 1462 case 'show' :
1612 - default :
1613 - ?>
1463 + default : ?>
1464 +
1614 1465 <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>
1615 1466 <p><a class="button" href="<?php echo esc_url( wp_nonce_url( 'update-core.php?page=bbpress-update&action=bbpress-update', 'bbpress-update' ) ); ?>"><?php esc_html_e( 'Update Forums', 'bbpress' ); ?></a></p>
1616 1467
1617 1468 <?php break;