| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | * @subpackage Administration |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly |
| 11 | -if ( !defined( 'ABSPATH' ) ) exit; | |
| 11 | +defined( 'ABSPATH' ) || exit; | |
| 12 | 12 | |
| 13 | 13 | /** Sections ******************************************************************/ |
| 14 | 14 | |
| 15 | 15 | /** |
| @@ -14,52 +14,81 @@ | ||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Get the Forums settings sections. |
| 17 | 17 | * |
| 18 | - * @since bbPress (r4001) | |
| 18 | + * @since 2.1.0 bbPress (r4001) | |
| 19 | + * | |
| 19 | 20 | * @return array |
| 20 | 21 | */ |
| 21 | 22 | function bbp_admin_get_settings_sections() { |
| 23 | + | |
| 24 | + // Filter & return | |
| 22 | 25 | return (array) apply_filters( 'bbp_admin_get_settings_sections', array( |
| 23 | - 'bbp_settings_main' => array( | |
| 24 | - 'title' => __( 'Main Settings', 'bbpress' ), | |
| 25 | - 'callback' => 'bbp_admin_setting_callback_main_section', | |
| 26 | - 'page' => 'bbpress', | |
| 26 | + | |
| 27 | + // Settings | |
| 28 | + 'bbp_settings_users' => array( | |
| 29 | + 'title' => esc_html__( 'Forum User Settings', 'bbpress' ), | |
| 30 | + 'callback' => 'bbp_admin_setting_callback_user_section', | |
| 31 | + 'page' => 'discussion' | |
| 27 | 32 | ), |
| 33 | + 'bbp_settings_features' => array( | |
| 34 | + 'title' => esc_html__( 'Forum Features', 'bbpress' ), | |
| 35 | + 'callback' => 'bbp_admin_setting_callback_features_section', | |
| 36 | + 'page' => 'discussion' | |
| 37 | + ), | |
| 28 | 38 | 'bbp_settings_theme_compat' => array( |
| 29 | - 'title' => __( 'Theme Packages', 'bbpress' ), | |
| 39 | + 'title' => esc_html__( 'Forum Theme Packages', 'bbpress' ), | |
| 30 | 40 | 'callback' => 'bbp_admin_setting_callback_subtheme_section', |
| 31 | - 'page' => 'bbpress', | |
| 41 | + 'page' => 'general' | |
| 32 | 42 | ), |
| 33 | 43 | 'bbp_settings_per_page' => array( |
| 34 | - 'title' => __( 'Per Page', 'bbpress' ), | |
| 44 | + 'title' => esc_html__( 'Topics and Replies Per Page', 'bbpress' ), | |
| 35 | 45 | 'callback' => 'bbp_admin_setting_callback_per_page_section', |
| 36 | - 'page' => 'bbpress', | |
| 46 | + 'page' => 'reading' | |
| 37 | 47 | ), |
| 38 | 48 | 'bbp_settings_per_rss_page' => array( |
| 39 | - 'title' => __( 'Per RSS Page', 'bbpress' ), | |
| 49 | + 'title' => esc_html__( 'Topics and Replies Per RSS Page', 'bbpress' ), | |
| 40 | 50 | 'callback' => 'bbp_admin_setting_callback_per_rss_page_section', |
| 41 | - 'page' => 'bbpress', | |
| 51 | + 'page' => 'reading', | |
| 42 | 52 | ), |
| 43 | 53 | 'bbp_settings_root_slugs' => array( |
| 44 | - 'title' => __( 'Archive Slugs', 'bbpress' ), | |
| 54 | + 'title' => esc_html__( 'Forum Root Slug', 'bbpress' ), | |
| 45 | 55 | 'callback' => 'bbp_admin_setting_callback_root_slug_section', |
| 46 | - 'page' => 'bbpress', | |
| 56 | + 'page' => 'permalink' | |
| 47 | 57 | ), |
| 48 | 58 | 'bbp_settings_single_slugs' => array( |
| 49 | - 'title' => __( 'Single Slugs', 'bbpress' ), | |
| 59 | + 'title' => esc_html__( 'Forum Single Slugs', 'bbpress' ), | |
| 50 | 60 | 'callback' => 'bbp_admin_setting_callback_single_slug_section', |
| 51 | - 'page' => 'bbpress', | |
| 61 | + 'page' => 'permalink', | |
| 52 | 62 | ), |
| 63 | + 'bbp_settings_user_slugs' => array( | |
| 64 | + 'title' => esc_html__( 'Forum User Slugs', 'bbpress' ), | |
| 65 | + 'callback' => 'bbp_admin_setting_callback_user_slug_section', | |
| 66 | + 'page' => 'permalink', | |
| 67 | + ), | |
| 68 | + | |
| 69 | + // Extend | |
| 53 | 70 | 'bbp_settings_buddypress' => array( |
| 54 | - 'title' => __( 'BuddyPress', 'bbpress' ), | |
| 71 | + 'title' => esc_html__( 'Forum Integration for BuddyPress', 'bbpress' ), | |
| 55 | 72 | 'callback' => 'bbp_admin_setting_callback_buddypress_section', |
| 56 | - 'page' => 'bbpress', | |
| 73 | + 'page' => 'buddypress', | |
| 57 | 74 | ), |
| 58 | 75 | 'bbp_settings_akismet' => array( |
| 59 | - 'title' => __( 'Akismet', 'bbpress' ), | |
| 76 | + 'title' => esc_html__( 'Forum Integration for Akismet', 'bbpress' ), | |
| 60 | 77 | 'callback' => 'bbp_admin_setting_callback_akismet_section', |
| 61 | - 'page' => 'bbpress' | |
| 78 | + 'page' => 'discussion' | |
| 79 | + ), | |
| 80 | + | |
| 81 | + // Converter | |
| 82 | + 'bbp_converter_connection' => array( | |
| 83 | + 'title' => esc_html__( 'Database Settings', 'bbpress' ), | |
| 84 | + 'callback' => 'bbp_converter_setting_callback_main_section', | |
| 85 | + 'page' => 'converter' | |
| 86 | + ), | |
| 87 | + 'bbp_converter_options' => array( | |
| 88 | + 'title' => esc_html__( 'Options', 'bbpress' ), | |
| 89 | + 'callback' => 'bbp_converter_setting_callback_options_section', | |
| 90 | + 'page' => 'converter' | |
| 62 | 91 | ) |
| 63 | 92 | ) ); |
| 64 | 93 | } |
| 65 | 94 | |
| @@ -65,37 +94,101 @@ | ||
| 65 | 94 | |
| 66 | 95 | /** |
| 67 | 96 | * Get all of the settings fields. |
| 68 | 97 | * |
| 69 | - * @since bbPress (r4001) | |
| 70 | - * @return type | |
| 98 | + * @since 2.1.0 bbPress (r4001) | |
| 99 | + * | |
| 100 | + * @return array | |
| 71 | 101 | */ |
| 72 | 102 | function bbp_admin_get_settings_fields() { |
| 103 | + | |
| 104 | + // Filter & return | |
| 73 | 105 | return (array) apply_filters( 'bbp_admin_get_settings_fields', array( |
| 74 | 106 | |
| 75 | - /** Main Section ******************************************************/ | |
| 107 | + /** User Section ******************************************************/ | |
| 76 | 108 | |
| 77 | - 'bbp_settings_main' => array( | |
| 109 | + 'bbp_settings_users' => array( | |
| 78 | 110 | |
| 111 | + // Default role setting | |
| 112 | + '_bbp_default_role' => array( | |
| 113 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 114 | + 'args' => array() | |
| 115 | + ), | |
| 116 | + | |
| 117 | + // Allow global access | |
| 118 | + '_bbp_allow_global_access' => array( | |
| 119 | + 'title' => esc_html__( 'Roles', 'bbpress' ), | |
| 120 | + 'callback' => 'bbp_admin_setting_callback_global_access', | |
| 121 | + 'sanitize_callback' => 'intval', | |
| 122 | + 'args' => array() | |
| 123 | + ), | |
| 124 | + | |
| 125 | + // Allow content throttling | |
| 126 | + '_bbp_allow_content_throttle' => array( | |
| 127 | + 'sanitize_callback' => 'intval', | |
| 128 | + 'args' => array() | |
| 129 | + ), | |
| 130 | + | |
| 131 | + // Throttle setting | |
| 132 | + '_bbp_throttle_time' => array( | |
| 133 | + 'title' => esc_html__( 'Flooding', 'bbpress' ), | |
| 134 | + 'callback' => 'bbp_admin_setting_callback_throttle', | |
| 135 | + 'sanitize_callback' => 'intval', | |
| 136 | + 'args' => array() | |
| 137 | + ), | |
| 138 | + | |
| 139 | + // Allow content editing | |
| 140 | + '_bbp_allow_content_edit' => array( | |
| 141 | + 'sanitize_callback' => 'intval', | |
| 142 | + 'args' => array() | |
| 143 | + ), | |
| 144 | + | |
| 79 | 145 | // Edit lock setting |
| 80 | 146 | '_bbp_edit_lock' => array( |
| 81 | - 'title' => __( 'Disallow editing after', 'bbpress' ), | |
| 147 | + 'title' => esc_html__( 'Editing', 'bbpress' ), | |
| 82 | 148 | 'callback' => 'bbp_admin_setting_callback_editlock', |
| 83 | 149 | 'sanitize_callback' => 'intval', |
| 84 | 150 | 'args' => array() |
| 85 | 151 | ), |
| 86 | 152 | |
| 87 | - // Throttle setting | |
| 88 | - '_bbp_throttle_time' => array( | |
| 89 | - 'title' => __( 'Throttle posting every', 'bbpress' ), | |
| 90 | - 'callback' => 'bbp_admin_setting_callback_throttle', | |
| 153 | + // Allow anonymous posting setting | |
| 154 | + '_bbp_allow_anonymous' => array( | |
| 155 | + 'title' => esc_html__( 'Anonymous', 'bbpress' ), | |
| 156 | + 'callback' => 'bbp_admin_setting_callback_anonymous', | |
| 91 | 157 | 'sanitize_callback' => 'intval', |
| 92 | 158 | 'args' => array() |
| 159 | + ) | |
| 160 | + ), | |
| 161 | + | |
| 162 | + /** Features Section **************************************************/ | |
| 163 | + | |
| 164 | + 'bbp_settings_features' => array( | |
| 165 | + | |
| 166 | + // Allow auto embedding setting | |
| 167 | + '_bbp_use_autoembed' => array( | |
| 168 | + 'title' => esc_html__( 'Auto-embed links', 'bbpress' ), | |
| 169 | + 'callback' => 'bbp_admin_setting_callback_use_autoembed', | |
| 170 | + 'sanitize_callback' => 'intval', | |
| 171 | + 'args' => array() | |
| 93 | 172 | ), |
| 94 | 173 | |
| 174 | + // Set reply threading level | |
| 175 | + '_bbp_thread_replies_depth' => array( | |
| 176 | + 'title' => esc_html__( 'Reply Threading', 'bbpress' ), | |
| 177 | + 'callback' => 'bbp_admin_setting_callback_thread_replies_depth', | |
| 178 | + 'sanitize_callback' => 'intval', | |
| 179 | + 'args' => array() | |
| 180 | + ), | |
| 181 | + | |
| 182 | + // Allow threaded replies | |
| 183 | + '_bbp_allow_threaded_replies' => array( | |
| 184 | + 'sanitize_callback' => 'intval', | |
| 185 | + 'args' => array() | |
| 186 | + ), | |
| 187 | + | |
| 95 | 188 | // Allow topic and reply revisions |
| 96 | 189 | '_bbp_allow_revisions' => array( |
| 97 | - 'title' => __( 'Revisions', 'bbpress' ), | |
| 190 | + 'title' => esc_html__( 'Revisions', 'bbpress' ), | |
| 98 | 191 | 'callback' => 'bbp_admin_setting_callback_revisions', |
| 99 | 192 | 'sanitize_callback' => 'intval', |
| 100 | 193 | 'args' => array() |
| 101 | 194 | ), |
| @@ -101,9 +194,9 @@ | ||
| 101 | 194 | ), |
| 102 | 195 | |
| 103 | 196 | // Allow favorites setting |
| 104 | 197 | '_bbp_enable_favorites' => array( |
| 105 | - 'title' => __( 'Favorites', 'bbpress' ), | |
| 198 | + 'title' => esc_html__( 'Favorites', 'bbpress' ), | |
| 106 | 199 | 'callback' => 'bbp_admin_setting_callback_favorites', |
| 107 | 200 | 'sanitize_callback' => 'intval', |
| 108 | 201 | 'args' => array() |
| 109 | 202 | ), |
| @@ -109,42 +202,34 @@ | ||
| 109 | 202 | ), |
| 110 | 203 | |
| 111 | 204 | // Allow subscriptions setting |
| 112 | 205 | '_bbp_enable_subscriptions' => array( |
| 113 | - 'title' => __( 'Subscriptions', 'bbpress' ), | |
| 206 | + 'title' => esc_html__( 'Subscriptions', 'bbpress' ), | |
| 114 | 207 | 'callback' => 'bbp_admin_setting_callback_subscriptions', |
| 115 | 208 | 'sanitize_callback' => 'intval', |
| 116 | 209 | 'args' => array() |
| 117 | 210 | ), |
| 118 | 211 | |
| 119 | - // Allow topic tags | |
| 120 | - '_bbp_allow_topic_tags' => array( | |
| 121 | - 'title' => __( 'Topic tags', 'bbpress' ), | |
| 122 | - 'callback' => 'bbp_admin_setting_callback_topic_tags', | |
| 212 | + // Allow engagements setting | |
| 213 | + '_bbp_enable_engagements' => array( | |
| 214 | + 'title' => esc_html__( 'Engagements', 'bbpress' ), | |
| 215 | + 'callback' => 'bbp_admin_setting_callback_engagements', | |
| 123 | 216 | 'sanitize_callback' => 'intval', |
| 124 | 217 | 'args' => array() |
| 125 | 218 | ), |
| 126 | 219 | |
| 127 | - // Allow anonymous posting setting | |
| 128 | - '_bbp_allow_anonymous' => array( | |
| 129 | - 'title' => __( 'Anonymous posting', 'bbpress' ), | |
| 130 | - 'callback' => 'bbp_admin_setting_callback_anonymous', | |
| 220 | + // Allow topic tags | |
| 221 | + '_bbp_allow_topic_tags' => array( | |
| 222 | + 'title' => esc_html__( 'Topic tags', 'bbpress' ), | |
| 223 | + 'callback' => 'bbp_admin_setting_callback_topic_tags', | |
| 131 | 224 | 'sanitize_callback' => 'intval', |
| 132 | 225 | 'args' => array() |
| 133 | 226 | ), |
| 134 | 227 | |
| 135 | - // Allow global access (on multisite) | |
| 136 | - '_bbp_default_role' => array( | |
| 137 | - 'title' => __( 'Default user role', 'bbpress' ), | |
| 138 | - 'callback' => 'bbp_admin_setting_callback_default_role', | |
| 139 | - 'sanitize_callback' => 'sanitize_text_field', | |
| 140 | - 'args' => array() | |
| 141 | - ), | |
| 142 | - | |
| 143 | - // Allow global access (on multisite) | |
| 144 | - '_bbp_allow_global_access' => array( | |
| 145 | - 'title' => __( 'Auto role', 'bbpress' ), | |
| 146 | - 'callback' => 'bbp_admin_setting_callback_global_access', | |
| 228 | + // Allow topic tags | |
| 229 | + '_bbp_allow_search' => array( | |
| 230 | + 'title' => esc_html__( 'Search', 'bbpress' ), | |
| 231 | + 'callback' => 'bbp_admin_setting_callback_search', | |
| 147 | 232 | 'sanitize_callback' => 'intval', |
| 148 | 233 | 'args' => array() |
| 149 | 234 | ), |
| 150 | 235 | |
| @@ -149,20 +234,29 @@ | ||
| 149 | 234 | ), |
| 150 | 235 | |
| 151 | 236 | // Allow fancy editor setting |
| 152 | 237 | '_bbp_use_wp_editor' => array( |
| 153 | - 'title' => __( 'Fancy editor', 'bbpress' ), | |
| 238 | + 'title' => esc_html__( 'Post Formatting', 'bbpress' ), | |
| 154 | 239 | 'callback' => 'bbp_admin_setting_callback_use_wp_editor', |
| 155 | 240 | 'args' => array(), |
| 156 | 241 | 'sanitize_callback' => 'intval' |
| 157 | 242 | ), |
| 158 | 243 | |
| 159 | - // Allow auto embedding setting | |
| 160 | - '_bbp_use_autoembed' => array( | |
| 161 | - 'title' => __( 'Auto-embed links', 'bbpress' ), | |
| 162 | - 'callback' => 'bbp_admin_setting_callback_use_autoembed', | |
| 244 | + // Allow per-forum moderators | |
| 245 | + '_bbp_allow_forum_mods' => array( | |
| 246 | + 'title' => esc_html__( 'Forum Moderators', 'bbpress' ), | |
| 247 | + 'callback' => 'bbp_admin_setting_callback_forum_mods', | |
| 163 | 248 | 'sanitize_callback' => 'intval', |
| 164 | 249 | 'args' => array() |
| 250 | + ), | |
| 251 | + | |
| 252 | + // Allow moderators to edit users | |
| 253 | + '_bbp_allow_super_mods' => array( | |
| 254 | + 'title' => esc_html__( 'Super Moderators', 'bbpress' ), | |
| 255 | + 'callback' => 'bbp_admin_setting_callback_super_mods', | |
| 256 | + 'sanitize_callback' => 'intval', | |
| 257 | + 'capability' => 'edit_users', | |
| 258 | + 'args' => array() | |
| 165 | 259 | ) |
| 166 | 260 | ), |
| 167 | 261 | |
| 168 | 262 | /** Theme Packages ****************************************************/ |
| @@ -168,11 +262,11 @@ | ||
| 168 | 262 | /** Theme Packages ****************************************************/ |
| 169 | 263 | |
| 170 | 264 | 'bbp_settings_theme_compat' => array( |
| 171 | 265 | |
| 172 | - // Replies per page setting | |
| 266 | + // Theme package setting | |
| 173 | 267 | '_bbp_theme_package_id' => array( |
| 174 | - 'title' => __( 'Current Package', 'bbpress' ), | |
| 268 | + 'title' => esc_html__( 'Current Package', 'bbpress' ), | |
| 175 | 269 | 'callback' => 'bbp_admin_setting_callback_subtheme_id', |
| 176 | 270 | 'sanitize_callback' => 'esc_sql', |
| 177 | 271 | 'args' => array() |
| 178 | 272 | ) |
| @@ -181,22 +275,22 @@ | ||
| 181 | 275 | /** Per Page Section **************************************************/ |
| 182 | 276 | |
| 183 | 277 | 'bbp_settings_per_page' => array( |
| 184 | 278 | |
| 185 | - // Replies per page setting | |
| 279 | + // Topics per page setting | |
| 186 | 280 | '_bbp_topics_per_page' => array( |
| 187 | - 'title' => __( 'Topics', 'bbpress' ), | |
| 281 | + 'title' => esc_html__( 'Topics', 'bbpress' ), | |
| 188 | 282 | 'callback' => 'bbp_admin_setting_callback_topics_per_page', |
| 189 | 283 | 'sanitize_callback' => 'intval', |
| 190 | - 'args' => array() | |
| 284 | + 'args' => array( 'label_for' => '_bbp_topics_per_page' ) | |
| 191 | 285 | ), |
| 192 | 286 | |
| 193 | 287 | // Replies per page setting |
| 194 | 288 | '_bbp_replies_per_page' => array( |
| 195 | - 'title' => __( 'Replies', 'bbpress' ), | |
| 289 | + 'title' => esc_html__( 'Replies', 'bbpress' ), | |
| 196 | 290 | 'callback' => 'bbp_admin_setting_callback_replies_per_page', |
| 197 | 291 | 'sanitize_callback' => 'intval', |
| 198 | - 'args' => array() | |
| 292 | + 'args' => array( 'label_for' => '_bbp_replies_per_page' ) | |
| 199 | 293 | ) |
| 200 | 294 | ), |
| 201 | 295 | |
| 202 | 296 | /** Per RSS Page Section **********************************************/ |
| @@ -202,22 +296,22 @@ | ||
| 202 | 296 | /** Per RSS Page Section **********************************************/ |
| 203 | 297 | |
| 204 | 298 | 'bbp_settings_per_rss_page' => array( |
| 205 | 299 | |
| 206 | - // Replies per page setting | |
| 300 | + // Topics per page setting | |
| 207 | 301 | '_bbp_topics_per_rss_page' => array( |
| 208 | - 'title' => __( 'Topics', 'bbpress' ), | |
| 302 | + 'title' => esc_html__( 'Topics', 'bbpress' ), | |
| 209 | 303 | 'callback' => 'bbp_admin_setting_callback_topics_per_rss_page', |
| 210 | 304 | 'sanitize_callback' => 'intval', |
| 211 | - 'args' => array() | |
| 305 | + 'args' => array( 'label_for' => '_bbp_topics_per_rss_page' ) | |
| 212 | 306 | ), |
| 213 | 307 | |
| 214 | 308 | // Replies per page setting |
| 215 | 309 | '_bbp_replies_per_rss_page' => array( |
| 216 | - 'title' => __( 'Replies', 'bbpress' ), | |
| 310 | + 'title' => esc_html__( 'Replies', 'bbpress' ), | |
| 217 | 311 | 'callback' => 'bbp_admin_setting_callback_replies_per_rss_page', |
| 218 | 312 | 'sanitize_callback' => 'intval', |
| 219 | - 'args' => array() | |
| 313 | + 'args' => array( 'label_for' => '_bbp_replies_per_rss_page' ) | |
| 220 | 314 | ) |
| 221 | 315 | ), |
| 222 | 316 | |
| 223 | 317 | /** Front Slugs *******************************************************/ |
| @@ -225,21 +319,29 @@ | ||
| 225 | 319 | 'bbp_settings_root_slugs' => array( |
| 226 | 320 | |
| 227 | 321 | // Root slug setting |
| 228 | 322 | '_bbp_root_slug' => array( |
| 229 | - 'title' => __( 'Forums base', 'bbpress' ), | |
| 323 | + 'title' => esc_html__( 'Forum Root', 'bbpress' ), | |
| 230 | 324 | 'callback' => 'bbp_admin_setting_callback_root_slug', |
| 231 | - 'sanitize_callback' => 'esc_sql', | |
| 325 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 326 | + 'args' => array( 'label_for' => '_bbp_root_slug' ) | |
| 327 | + ), | |
| 328 | + | |
| 329 | + // Include root setting | |
| 330 | + '_bbp_include_root' => array( | |
| 331 | + 'title' => esc_html__( 'Forum Prefix', 'bbpress' ), | |
| 332 | + 'callback' => 'bbp_admin_setting_callback_include_root', | |
| 333 | + 'sanitize_callback' => 'intval', | |
| 232 | 334 | 'args' => array() |
| 233 | 335 | ), |
| 234 | 336 | |
| 235 | - // Topic archive setting | |
| 236 | - '_bbp_topic_archive_slug' => array( | |
| 237 | - 'title' => __( 'Topics base', 'bbpress' ), | |
| 238 | - 'callback' => 'bbp_admin_setting_callback_topic_archive_slug', | |
| 239 | - 'sanitize_callback' => 'esc_sql', | |
| 240 | - 'args' => array() | |
| 241 | - ) | |
| 337 | + // What to show on Forum Root | |
| 338 | + '_bbp_show_on_root' => array( | |
| 339 | + 'title' => esc_html__( 'Forum root should show', 'bbpress' ), | |
| 340 | + 'callback' => 'bbp_admin_setting_callback_show_on_root', | |
| 341 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 342 | + 'args' => array( 'label_for'=>'_bbp_show_on_root' ) | |
| 343 | + ), | |
| 242 | 344 | ), |
| 243 | 345 | |
| 244 | 346 | /** Single Slugs ******************************************************/ |
| 245 | 347 | |
| @@ -244,62 +346,115 @@ | ||
| 244 | 346 | /** Single Slugs ******************************************************/ |
| 245 | 347 | |
| 246 | 348 | 'bbp_settings_single_slugs' => array( |
| 247 | 349 | |
| 248 | - // Include root setting | |
| 249 | - '_bbp_include_root' => array( | |
| 250 | - 'title' => __( 'Forum Prefix', 'bbpress' ), | |
| 251 | - 'callback' => 'bbp_admin_setting_callback_include_root', | |
| 252 | - 'sanitize_callback' => 'intval', | |
| 253 | - 'args' => array() | |
| 254 | - ), | |
| 255 | - | |
| 256 | 350 | // Forum slug setting |
| 257 | 351 | '_bbp_forum_slug' => array( |
| 258 | - 'title' => __( 'Forum slug', 'bbpress' ), | |
| 352 | + 'title' => esc_html__( 'Forum', 'bbpress' ), | |
| 259 | 353 | 'callback' => 'bbp_admin_setting_callback_forum_slug', |
| 260 | - 'sanitize_callback' => 'sanitize_title', | |
| 261 | - 'args' => array() | |
| 354 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 355 | + 'args' => array( 'label_for'=>'_bbp_forum_slug' ) | |
| 262 | 356 | ), |
| 263 | 357 | |
| 264 | 358 | // Topic slug setting |
| 265 | 359 | '_bbp_topic_slug' => array( |
| 266 | - 'title' => __( 'Topic slug', 'bbpress' ), | |
| 360 | + 'title' => esc_html__( 'Topic', 'bbpress' ), | |
| 267 | 361 | 'callback' => 'bbp_admin_setting_callback_topic_slug', |
| 268 | - 'sanitize_callback' => 'sanitize_title', | |
| 269 | - 'args' => array() | |
| 362 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 363 | + 'args' => array( 'label_for'=>'_bbp_topic_slug' ) | |
| 270 | 364 | ), |
| 271 | 365 | |
| 272 | 366 | // Topic tag slug setting |
| 273 | 367 | '_bbp_topic_tag_slug' => array( |
| 274 | - 'title' => __( 'Topic tag slug', 'bbpress' ), | |
| 368 | + 'title' => esc_html__( 'Topic Tag', 'bbpress' ), | |
| 275 | 369 | 'callback' => 'bbp_admin_setting_callback_topic_tag_slug', |
| 276 | - 'sanitize_callback' => 'sanitize_title', | |
| 277 | - 'args' => array() | |
| 370 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 371 | + 'args' => array( 'label_for'=>'_bbp_topic_tag_slug' ) | |
| 278 | 372 | ), |
| 279 | 373 | |
| 374 | + // View slug setting | |
| 375 | + '_bbp_view_slug' => array( | |
| 376 | + 'title' => esc_html__( 'Topic View', 'bbpress' ), | |
| 377 | + 'callback' => 'bbp_admin_setting_callback_view_slug', | |
| 378 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 379 | + 'args' => array( 'label_for'=>'_bbp_view_slug' ) | |
| 380 | + ), | |
| 381 | + | |
| 280 | 382 | // Reply slug setting |
| 281 | 383 | '_bbp_reply_slug' => array( |
| 282 | - 'title' => __( 'Reply slug', 'bbpress' ), | |
| 384 | + 'title' => _x( 'Reply', 'noun', 'bbpress' ), | |
| 283 | 385 | 'callback' => 'bbp_admin_setting_callback_reply_slug', |
| 284 | - 'sanitize_callback' => 'sanitize_title', | |
| 285 | - 'args' => array() | |
| 386 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 387 | + 'args' => array( 'label_for'=>'_bbp_reply_slug' ) | |
| 286 | 388 | ), |
| 287 | 389 | |
| 390 | + // Edit slug setting | |
| 391 | + '_bbp_edit_slug' => array( | |
| 392 | + 'title' => esc_html__( 'Edit', 'bbpress' ), | |
| 393 | + 'callback' => 'bbp_admin_setting_callback_edit_slug', | |
| 394 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 395 | + 'args' => array( 'label_for'=>'_bbp_edit_slug' ) | |
| 396 | + ), | |
| 397 | + | |
| 398 | + // Search slug setting | |
| 399 | + '_bbp_search_slug' => array( | |
| 400 | + 'title' => esc_html__( 'Search', 'bbpress' ), | |
| 401 | + 'callback' => 'bbp_admin_setting_callback_search_slug', | |
| 402 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 403 | + 'args' => array( 'label_for'=>'_bbp_search_slug' ) | |
| 404 | + ) | |
| 405 | + ), | |
| 406 | + | |
| 407 | + /** User Slugs ********************************************************/ | |
| 408 | + | |
| 409 | + 'bbp_settings_user_slugs' => array( | |
| 410 | + | |
| 288 | 411 | // User slug setting |
| 289 | 412 | '_bbp_user_slug' => array( |
| 290 | - 'title' => __( 'User slug', 'bbpress' ), | |
| 413 | + 'title' => esc_html__( 'User Base', 'bbpress' ), | |
| 291 | 414 | 'callback' => 'bbp_admin_setting_callback_user_slug', |
| 292 | - 'sanitize_callback' => 'sanitize_title', | |
| 293 | - 'args' => array() | |
| 415 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 416 | + 'args' => array( 'label_for'=>'_bbp_user_slug' ) | |
| 294 | 417 | ), |
| 295 | 418 | |
| 296 | - // View slug setting | |
| 297 | - '_bbp_view_slug' => array( | |
| 298 | - 'title' => __( 'Topic view slug', 'bbpress' ), | |
| 299 | - 'callback' => 'bbp_admin_setting_callback_view_slug', | |
| 300 | - 'sanitize_callback' => 'sanitize_title', | |
| 301 | - 'args' => array() | |
| 419 | + // Topics slug setting | |
| 420 | + '_bbp_topic_archive_slug' => array( | |
| 421 | + 'title' => esc_html__( 'Topics Started', 'bbpress' ), | |
| 422 | + 'callback' => 'bbp_admin_setting_callback_topic_archive_slug', | |
| 423 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 424 | + 'args' => array( 'label_for'=>'_bbp_topic_archive_slug' ) | |
| 425 | + ), | |
| 426 | + | |
| 427 | + // Replies slug setting | |
| 428 | + '_bbp_reply_archive_slug' => array( | |
| 429 | + 'title' => esc_html__( 'Replies Created', 'bbpress' ), | |
| 430 | + 'callback' => 'bbp_admin_setting_callback_reply_archive_slug', | |
| 431 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 432 | + 'args' => array( 'label_for'=>'_bbp_reply_archive_slug' ) | |
| 433 | + ), | |
| 434 | + | |
| 435 | + // Favorites slug setting | |
| 436 | + '_bbp_user_favs_slug' => array( | |
| 437 | + 'title' => esc_html__( 'Favorite Topics', 'bbpress' ), | |
| 438 | + 'callback' => 'bbp_admin_setting_callback_user_favs_slug', | |
| 439 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 440 | + 'args' => array( 'label_for'=>'_bbp_user_favs_slug' ) | |
| 441 | + ), | |
| 442 | + | |
| 443 | + // Subscriptions slug setting | |
| 444 | + '_bbp_user_subs_slug' => array( | |
| 445 | + 'title' => esc_html__( 'Subscriptions', 'bbpress' ), | |
| 446 | + 'callback' => 'bbp_admin_setting_callback_user_subs_slug', | |
| 447 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 448 | + 'args' => array( 'label_for'=>'_bbp_user_subs_slug' ) | |
| 449 | + ), | |
| 450 | + | |
| 451 | + // Engagements slug setting | |
| 452 | + '_bbp_user_engs_slug' => array( | |
| 453 | + 'title' => esc_html__( 'Engagements', 'bbpress' ), | |
| 454 | + 'callback' => 'bbp_admin_setting_callback_user_engagements_slug', | |
| 455 | + 'sanitize_callback' => 'bbp_sanitize_slug', | |
| 456 | + 'args' => array( 'label_for'=>'_bbp_user_engs_slug' ) | |
| 302 | 457 | ) |
| 303 | 458 | ), |
| 304 | 459 | |
| 305 | 460 | /** BuddyPress ********************************************************/ |
| @@ -307,9 +462,9 @@ | ||
| 307 | 462 | 'bbp_settings_buddypress' => array( |
| 308 | 463 | |
| 309 | 464 | // Are group forums enabled? |
| 310 | 465 | '_bbp_enable_group_forums' => array( |
| 311 | - 'title' => __( 'Enable Group Forums', 'bbpress' ), | |
| 466 | + 'title' => esc_html__( 'Group Forums', 'bbpress' ), | |
| 312 | 467 | 'callback' => 'bbp_admin_setting_callback_group_forums', |
| 313 | 468 | 'sanitize_callback' => 'intval', |
| 314 | 469 | 'args' => array() |
| 315 | 470 | ), |
| @@ -315,12 +470,12 @@ | ||
| 315 | 470 | ), |
| 316 | 471 | |
| 317 | 472 | // Group forums parent forum ID |
| 318 | 473 | '_bbp_group_forums_root_id' => array( |
| 319 | - 'title' => __( 'Group Forums Parent', 'bbpress' ), | |
| 474 | + 'title' => esc_html__( 'Primary Forum', 'bbpress' ), | |
| 320 | 475 | 'callback' => 'bbp_admin_setting_callback_group_forums_root_id', |
| 321 | 476 | 'sanitize_callback' => 'intval', |
| 322 | - 'args' => array() | |
| 477 | + 'args' => array( 'label_for'=>'_bbp_group_forums_root_id' ) | |
| 323 | 478 | ) |
| 324 | 479 | ), |
| 325 | 480 | |
| 326 | 481 | /** Akismet ***********************************************************/ |
| @@ -328,13 +483,127 @@ | ||
| 328 | 483 | 'bbp_settings_akismet' => array( |
| 329 | 484 | |
| 330 | 485 | // Should we use Akismet |
| 331 | 486 | '_bbp_enable_akismet' => array( |
| 332 | - 'title' => __( 'Use Akismet', 'bbpress' ), | |
| 487 | + 'title' => esc_html__( 'Use Akismet', 'bbpress' ), | |
| 333 | 488 | 'callback' => 'bbp_admin_setting_callback_akismet', |
| 334 | 489 | 'sanitize_callback' => 'intval', |
| 335 | 490 | 'args' => array() |
| 336 | 491 | ) |
| 492 | + ), | |
| 493 | + | |
| 494 | + /** Converter Page ****************************************************/ | |
| 495 | + | |
| 496 | + // Connection | |
| 497 | + 'bbp_converter_connection' => array( | |
| 498 | + | |
| 499 | + // System Select | |
| 500 | + '_bbp_converter_platform' => array( | |
| 501 | + 'title' => esc_html__( 'Select Platform', 'bbpress' ), | |
| 502 | + 'callback' => 'bbp_converter_setting_callback_platform', | |
| 503 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 504 | + 'args' => array( 'label_for'=> '_bbp_converter_platform' ) | |
| 505 | + ), | |
| 506 | + | |
| 507 | + // Database Server | |
| 508 | + '_bbp_converter_db_server' => array( | |
| 509 | + 'title' => esc_html__( 'Database Server', 'bbpress' ), | |
| 510 | + 'callback' => 'bbp_converter_setting_callback_dbserver', | |
| 511 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 512 | + 'args' => array( 'label_for'=> '_bbp_converter_db_server' ) | |
| 513 | + ), | |
| 514 | + | |
| 515 | + // Database Server Port | |
| 516 | + '_bbp_converter_db_port' => array( | |
| 517 | + 'title' => esc_html__( 'Database Port', 'bbpress' ), | |
| 518 | + 'callback' => 'bbp_converter_setting_callback_dbport', | |
| 519 | + 'sanitize_callback' => 'intval', | |
| 520 | + 'args' => array( 'label_for'=> '_bbp_converter_db_port' ) | |
| 521 | + ), | |
| 522 | + | |
| 523 | + // Database Name | |
| 524 | + '_bbp_converter_db_name' => array( | |
| 525 | + 'title' => esc_html__( 'Database Name', 'bbpress' ), | |
| 526 | + 'callback' => 'bbp_converter_setting_callback_dbname', | |
| 527 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 528 | + 'args' => array( 'label_for'=> '_bbp_converter_db_name' ) | |
| 529 | + ), | |
| 530 | + | |
| 531 | + // Database User | |
| 532 | + '_bbp_converter_db_user' => array( | |
| 533 | + 'title' => esc_html__( 'Database User', 'bbpress' ), | |
| 534 | + 'callback' => 'bbp_converter_setting_callback_dbuser', | |
| 535 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 536 | + 'args' => array( 'label_for'=> '_bbp_converter_db_user' ) | |
| 537 | + ), | |
| 538 | + | |
| 539 | + // Database Password | |
| 540 | + '_bbp_converter_db_pass' => array( | |
| 541 | + 'title' => esc_html__( 'Database Password', 'bbpress' ), | |
| 542 | + 'callback' => 'bbp_converter_setting_callback_dbpass', | |
| 543 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 544 | + 'args' => array( 'label_for'=> '_bbp_converter_db_pass' ) | |
| 545 | + ), | |
| 546 | + | |
| 547 | + // Database Prefix | |
| 548 | + '_bbp_converter_db_prefix' => array( | |
| 549 | + 'title' => esc_html__( 'Table Prefix', 'bbpress' ), | |
| 550 | + 'callback' => 'bbp_converter_setting_callback_dbprefix', | |
| 551 | + 'sanitize_callback' => 'sanitize_text_field', | |
| 552 | + 'args' => array( 'label_for'=> '_bbp_converter_db_prefix' ) | |
| 553 | + ) | |
| 554 | + ), | |
| 555 | + | |
| 556 | + // Options | |
| 557 | + 'bbp_converter_options' => array( | |
| 558 | + | |
| 559 | + // Rows Limit | |
| 560 | + '_bbp_converter_rows' => array( | |
| 561 | + 'title' => esc_html__( 'Rows Limit', 'bbpress' ), | |
| 562 | + 'callback' => 'bbp_converter_setting_callback_rows', | |
| 563 | + 'sanitize_callback' => 'intval', | |
| 564 | + 'args' => array( 'label_for'=> '_bbp_converter_rows' ) | |
| 565 | + ), | |
| 566 | + | |
| 567 | + // Delay Time | |
| 568 | + '_bbp_converter_delay_time' => array( | |
| 569 | + 'title' => esc_html__( 'Delay Time', 'bbpress' ), | |
| 570 | + 'callback' => 'bbp_converter_setting_callback_delay_time', | |
| 571 | + 'sanitize_callback' => 'intval', | |
| 572 | + 'args' => array( 'label_for'=> '_bbp_converter_delay_time' ) | |
| 573 | + ), | |
| 574 | + | |
| 575 | + // Convert Users | |
| 576 | + '_bbp_converter_convert_users' => array( | |
| 577 | + 'title' => esc_html__( 'Convert Users', 'bbpress' ), | |
| 578 | + 'callback' => 'bbp_converter_setting_callback_convert_users', | |
| 579 | + 'sanitize_callback' => 'intval', | |
| 580 | + 'args' => array( 'label_for'=> '_bbp_converter_convert_users' ) | |
| 581 | + ), | |
| 582 | + | |
| 583 | + // Halt | |
| 584 | + '_bbp_converter_halt' => array( | |
| 585 | + 'title' => esc_html__( 'Stop on Error', 'bbpress' ), | |
| 586 | + 'callback' => 'bbp_converter_setting_callback_halt', | |
| 587 | + 'sanitize_callback' => 'intval', | |
| 588 | + 'args' => array( 'label_for'=> '_bbp_converter_halt' ) | |
| 589 | + ), | |
| 590 | + | |
| 591 | + // Restart | |
| 592 | + '_bbp_converter_restart' => array( | |
| 593 | + 'title' => esc_html__( 'Start Over', 'bbpress' ), | |
| 594 | + 'callback' => 'bbp_converter_setting_callback_restart', | |
| 595 | + 'sanitize_callback' => 'intval', | |
| 596 | + 'args' => array( 'label_for'=> '_bbp_converter_restart' ) | |
| 597 | + ), | |
| 598 | + | |
| 599 | + // Clean | |
| 600 | + '_bbp_converter_clean' => array( | |
| 601 | + 'title' => esc_html__( 'Helper Data', 'bbpress' ), | |
| 602 | + 'callback' => 'bbp_converter_setting_callback_clean', | |
| 603 | + 'sanitize_callback' => 'intval', | |
| 604 | + 'args' => array( 'label_for'=> '_bbp_converter_clean' ) | |
| 605 | + ) | |
| 337 | 606 | ) |
| 338 | 607 | ) ); |
| 339 | 608 | } |
| 340 | 609 | |
| @@ -340,67 +609,166 @@ | ||
| 340 | 609 | |
| 341 | 610 | /** |
| 342 | 611 | * Get settings fields by section. |
| 343 | 612 | * |
| 344 | - * @since bbPress (r4001) | |
| 345 | - * @param string $section_id | |
| 613 | + * @since 2.1.0 bbPress (r4001) | |
| 614 | + * | |
| 615 | + * @param string $section_id ID of the section to get fields for | |
| 616 | + * @staticvar array $fields All of the available fields | |
| 346 | 617 | * @return mixed False if section is invalid, array of fields otherwise. |
| 347 | 618 | */ |
| 348 | 619 | function bbp_admin_get_settings_fields_for_section( $section_id = '' ) { |
| 620 | + static $fields = array(); | |
| 349 | 621 | |
| 622 | + // Default return value | |
| 623 | + $retval = array(); | |
| 624 | + | |
| 350 | 625 | // Bail if section is empty |
| 351 | - if ( empty( $section_id ) ) | |
| 626 | + if ( empty( $section_id ) ) { | |
| 352 | 627 | return false; |
| 628 | + } | |
| 353 | 629 | |
| 354 | - $fields = bbp_admin_get_settings_fields(); | |
| 355 | - $retval = isset( $fields[$section_id] ) ? $fields[$section_id] : false; | |
| 630 | + // Get all of the fields (so we can snag one section of them) | |
| 631 | + if ( empty( $fields ) ) { | |
| 632 | + $fields = bbp_admin_get_settings_fields(); | |
| 633 | + } | |
| 356 | 634 | |
| 635 | + // Get the field by section | |
| 636 | + if ( isset( $fields[ $section_id ] ) ) { | |
| 637 | + $retval = $fields[ $section_id ]; | |
| 638 | + } | |
| 639 | + | |
| 640 | + // Filter & return | |
| 357 | 641 | return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id ); |
| 358 | 642 | } |
| 359 | 643 | |
| 360 | -/** Main Section **************************************************************/ | |
| 644 | +/** User Section **************************************************************/ | |
| 361 | 645 | |
| 362 | 646 | /** |
| 363 | - * Main settings section description for the settings page | |
| 647 | + * User settings section description for the settings page | |
| 364 | 648 | * |
| 365 | - * @since bbPress (r2786) | |
| 649 | + * @since 2.0.0 bbPress (r2786) | |
| 366 | 650 | */ |
| 367 | -function bbp_admin_setting_callback_main_section() { | |
| 651 | +function bbp_admin_setting_callback_user_section() { | |
| 368 | 652 | ?> |
| 369 | 653 | |
| 370 | - <p><?php _e( 'Main forum settings for enabling features and setting time limits', 'bbpress' ); ?></p> | |
| 654 | + <p><?php esc_html_e( 'Setting time limits and other user posting capabilities', 'bbpress' ); ?></p> | |
| 371 | 655 | |
| 372 | 656 | <?php |
| 373 | 657 | } |
| 374 | 658 | |
| 659 | + | |
| 375 | 660 | /** |
| 376 | 661 | * Edit lock setting field |
| 377 | 662 | * |
| 378 | - * @since bbPress (r2737) | |
| 663 | + * @since 2.0.0 bbPress (r2737) | |
| 664 | + */ | |
| 665 | +function bbp_admin_setting_callback_editlock() { | |
| 666 | + | |
| 667 | + // Start the output buffer for the second option | |
| 668 | + ob_start(); ?> | |
| 669 | + | |
| 670 | + </label> | |
| 671 | + <label for="_bbp_edit_lock"> | |
| 672 | + <input name="_bbp_edit_lock" id="_bbp_edit_lock" type="number" min="0" step="1" value="<?php bbp_form_option( '_bbp_edit_lock', '5' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_lock' ); ?> /> | |
| 673 | + | |
| 674 | + <?php $select = ob_get_clean(); ?> | |
| 675 | + | |
| 676 | + <label for="_bbp_allow_content_edit"> | |
| 677 | + <input name="_bbp_allow_content_edit" id="_bbp_allow_content_edit" type="checkbox" value="1" <?php checked( bbp_allow_content_edit( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_content_edit' ); ?> /> | |
| 678 | + <?php printf( esc_html__( 'Allow users to edit their content for %s minutes after posting', 'bbpress' ), $select ); ?> | |
| 679 | + </label> | |
| 680 | + <p class="description"><?php esc_html_e( 'If checked, setting to "0 minutes" allows editing forever.', 'bbpress' ); ?></p> | |
| 681 | + | |
| 682 | +<?php | |
| 683 | +} | |
| 684 | + | |
| 685 | +/** | |
| 686 | + * Throttle setting field | |
| 379 | 687 | * |
| 380 | - * @uses bbp_form_option() To output the option value | |
| 688 | + * @since 2.0.0 bbPress (r2737) | |
| 381 | 689 | */ |
| 382 | -function bbp_admin_setting_callback_editlock() { | |
| 690 | +function bbp_admin_setting_callback_throttle() { | |
| 691 | + | |
| 692 | + // Start the output buffer for the second option | |
| 693 | + ob_start(); ?> | |
| 694 | + | |
| 695 | + </label> | |
| 696 | + <label for="_bbp_throttle_time"> | |
| 697 | + <input name="_bbp_throttle_time" id="_bbp_throttle_time" type="number" min="0" step="1" value="<?php bbp_form_option( '_bbp_throttle_time', '10' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_throttle_time' ); ?> /> | |
| 698 | + | |
| 699 | + <?php $select = ob_get_clean(); ?> | |
| 700 | + | |
| 701 | + <label for="_bbp_allow_content_throttle"> | |
| 702 | + <input name="_bbp_allow_content_throttle" id="_bbp_allow_content_throttle" type="checkbox" value="1" <?php checked( bbp_allow_content_throttle( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_content_throttle' ); ?> /> | |
| 703 | + <?php printf( esc_html__( 'Allow flood protection by throttling users for %s seconds after posting', 'bbpress' ), $select ); ?> | |
| 704 | + </label> | |
| 705 | + <p class="description"><?php esc_html_e( 'Use this to discourage users from spamming your forums.', 'bbpress' ); ?></p> | |
| 706 | + | |
| 707 | +<?php | |
| 708 | +} | |
| 709 | + | |
| 710 | +/** | |
| 711 | + * Allow anonymous posting setting field | |
| 712 | + * | |
| 713 | + * @since 2.0.0 bbPress (r2737) | |
| 714 | + */ | |
| 715 | +function bbp_admin_setting_callback_anonymous() { | |
| 383 | 716 | ?> |
| 384 | 717 | |
| 385 | - <input name="_bbp_edit_lock" type="number" min="0" step="1" id="_bbp_edit_lock" value="<?php bbp_form_option( '_bbp_edit_lock', '5' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_lock' ); ?> /> | |
| 386 | - <label for="_bbp_edit_lock"><?php _e( 'minutes', 'bbpress' ); ?></label> | |
| 718 | + <input name="_bbp_allow_anonymous" id="_bbp_allow_anonymous" type="checkbox" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> /> | |
| 719 | + <label for="_bbp_allow_anonymous"><?php esc_html_e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label> | |
| 720 | + <p class="description"><?php esc_html_e( 'Works best on intranets or paired with antispam measures like Akismet.', 'bbpress' ); ?></p> | |
| 387 | 721 | |
| 388 | 722 | <?php |
| 389 | 723 | } |
| 390 | 724 | |
| 391 | 725 | /** |
| 392 | - * Throttle setting field | |
| 726 | + * Allow global access setting field | |
| 393 | 727 | * |
| 394 | - * @since bbPress (r2737) | |
| 728 | + * @since 2.0.0 bbPress (r3378) | |
| 729 | + */ | |
| 730 | +function bbp_admin_setting_callback_global_access() { | |
| 731 | + | |
| 732 | + // Get the default role once rather than loop repeatedly below | |
| 733 | + $default_role = bbp_get_default_role(); | |
| 734 | + $roles = bbp_get_dynamic_roles(); | |
| 735 | + | |
| 736 | + // Start the output buffer for the select dropdown | |
| 737 | + ob_start(); ?> | |
| 738 | + | |
| 739 | + </label> | |
| 740 | + <label for="_bbp_default_role"> | |
| 741 | + <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>> | |
| 742 | + <?php foreach ( $roles as $role => $details ) : ?> | |
| 743 | + | |
| 744 | + <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo bbp_translate_user_role( $details['name'] ); ?></option> | |
| 745 | + | |
| 746 | + <?php endforeach; ?> | |
| 747 | + </select> | |
| 748 | + | |
| 749 | + <?php $select = ob_get_clean(); ?> | |
| 750 | + | |
| 751 | + <label for="_bbp_allow_global_access"> | |
| 752 | + <input name="_bbp_allow_global_access" id="_bbp_allow_global_access" type="checkbox" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> /> | |
| 753 | + <?php printf( esc_html__( 'Automatically give registered visitors the %s forum role', 'bbpress' ), $select ); ?> | |
| 754 | + </label> | |
| 755 | + <p class="description"><?php esc_html_e( 'Uncheck this to manually assign all user access to your forums.', 'bbpress' ); ?></p> | |
| 756 | + | |
| 757 | +<?php | |
| 758 | +} | |
| 759 | + | |
| 760 | +/** Features Section **********************************************************/ | |
| 761 | + | |
| 762 | +/** | |
| 763 | + * Features settings section description for the settings page | |
| 395 | 764 | * |
| 396 | - * @uses bbp_form_option() To output the option value | |
| 765 | + * @since 2.0.0 bbPress (r2786) | |
| 397 | 766 | */ |
| 398 | -function bbp_admin_setting_callback_throttle() { | |
| 767 | +function bbp_admin_setting_callback_features_section() { | |
| 399 | 768 | ?> |
| 400 | 769 | |
| 401 | - <input name="_bbp_throttle_time" type="number" min="0" step="1" id="_bbp_throttle_time" value="<?php bbp_form_option( '_bbp_throttle_time', '10' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_throttle_time' ); ?> /> | |
| 402 | - <label for="_bbp_throttle_time"><?php _e( 'seconds', 'bbpress' ); ?></label> | |
| 770 | + <p><?php esc_html_e( 'Forum features that can be toggled on and off', 'bbpress' ); ?></p> | |
| 403 | 771 | |
| 404 | 772 | <?php |
| 405 | 773 | } |
| 406 | 774 | |
| @@ -406,17 +774,15 @@ | ||
| 406 | 774 | |
| 407 | 775 | /** |
| 408 | 776 | * Allow favorites setting field |
| 409 | 777 | * |
| 410 | - * @since bbPress (r2786) | |
| 411 | - * | |
| 412 | - * @uses checked() To display the checked attribute | |
| 778 | + * @since 2.0.0 bbPress (r2786) | |
| 413 | 779 | */ |
| 414 | 780 | function bbp_admin_setting_callback_favorites() { |
| 415 | 781 | ?> |
| 416 | 782 | |
| 417 | - <input id="_bbp_enable_favorites" name="_bbp_enable_favorites" type="checkbox" id="_bbp_enable_favorites" value="1" <?php checked( bbp_is_favorites_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_favorites' ); ?> /> | |
| 418 | - <label for="_bbp_enable_favorites"><?php _e( 'Allow users to mark topics as favorites', 'bbpress' ); ?></label> | |
| 783 | + <input name="_bbp_enable_favorites" id="_bbp_enable_favorites" type="checkbox" value="1" <?php checked( bbp_is_favorites_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_favorites' ); ?> /> | |
| 784 | + <label for="_bbp_enable_favorites"><?php esc_html_e( 'Allow users to mark topics as favorites', 'bbpress' ); ?></label> | |
| 419 | 785 | |
| 420 | 786 | <?php |
| 421 | 787 | } |
| 422 | 788 | |
| @@ -422,17 +788,29 @@ | ||
| 422 | 788 | |
| 423 | 789 | /** |
| 424 | 790 | * Allow subscriptions setting field |
| 425 | 791 | * |
| 426 | - * @since bbPress (r2737) | |
| 792 | + * @since 2.0.0 bbPress (r2737) | |
| 793 | + */ | |
| 794 | +function bbp_admin_setting_callback_subscriptions() { | |
| 795 | +?> | |
| 796 | + | |
| 797 | + <input name="_bbp_enable_subscriptions" id="_bbp_enable_subscriptions" type="checkbox" value="1" <?php checked( bbp_is_subscriptions_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_subscriptions' ); ?> /> | |
| 798 | + <label for="_bbp_enable_subscriptions"><?php esc_html_e( 'Allow users to subscribe to forums and topics', 'bbpress' ); ?></label> | |
| 799 | + | |
| 800 | +<?php | |
| 801 | +} | |
| 802 | + | |
| 803 | +/** | |
| 804 | + * Allow engagements setting field | |
| 427 | 805 | * |
| 428 | - * @uses checked() To display the checked attribute | |
| 806 | + * @since 2.0.0 bbPress (r2737) | |
| 429 | 807 | */ |
| 430 | -function bbp_admin_setting_callback_subscriptions() { | |
| 808 | +function bbp_admin_setting_callback_engagements() { | |
| 431 | 809 | ?> |
| 432 | 810 | |
| 433 | - <input id="_bbp_enable_subscriptions" name="_bbp_enable_subscriptions" type="checkbox" id="_bbp_enable_subscriptions" value="1" <?php checked( bbp_is_subscriptions_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_subscriptions' ); ?> /> | |
| 434 | - <label for="_bbp_enable_subscriptions"><?php _e( 'Allow users to subscribe to topics', 'bbpress' ); ?></label> | |
| 811 | + <input name="_bbp_enable_engagements" id="_bbp_enable_engagements" type="checkbox" value="1" <?php checked( bbp_is_engagements_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_engagements' ); ?> /> | |
| 812 | + <label for="_bbp_enable_engagements"><?php esc_html_e( 'Allow tracking of topics each user engages in', 'bbpress' ); ?></label> | |
| 435 | 813 | |
| 436 | 814 | <?php |
| 437 | 815 | } |
| 438 | 816 | |
| @@ -438,103 +816,123 @@ | ||
| 438 | 816 | |
| 439 | 817 | /** |
| 440 | 818 | * Allow topic tags setting field |
| 441 | 819 | * |
| 442 | - * @since bbPress (r####) | |
| 443 | - * | |
| 444 | - * @uses checked() To display the checked attribute | |
| 820 | + * @since 2.4.0 bbPress (r4944) | |
| 445 | 821 | */ |
| 446 | 822 | function bbp_admin_setting_callback_topic_tags() { |
| 447 | 823 | ?> |
| 448 | 824 | |
| 449 | - <input id="_bbp_allow_topic_tags" name="_bbp_allow_topic_tags" type="checkbox" id="_bbp_allow_topic_tags" value="1" <?php checked( bbp_allow_topic_tags( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_topic_tags' ); ?> /> | |
| 450 | - <label for="_bbp_allow_topic_tags"><?php _e( 'Allow topics to have tags', 'bbpress' ); ?></label> | |
| 825 | + <input name="_bbp_allow_topic_tags" id="_bbp_allow_topic_tags" type="checkbox" value="1" <?php checked( bbp_allow_topic_tags( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_topic_tags' ); ?> /> | |
| 826 | + <label for="_bbp_allow_topic_tags"><?php esc_html_e( 'Allow topics to have tags', 'bbpress' ); ?></label> | |
| 451 | 827 | |
| 452 | 828 | <?php |
| 453 | 829 | } |
| 454 | 830 | |
| 455 | 831 | /** |
| 456 | - * Allow topic and reply revisions | |
| 832 | + * Allow forum-mods setting field | |
| 457 | 833 | * |
| 458 | - * @since bbPress (r3412) | |
| 459 | - * | |
| 460 | - * @uses checked() To display the checked attribute | |
| 834 | + * @since 2.6.0 bbPress (r5834) | |
| 461 | 835 | */ |
| 462 | -function bbp_admin_setting_callback_revisions() { | |
| 836 | +function bbp_admin_setting_callback_forum_mods() { | |
| 463 | 837 | ?> |
| 464 | 838 | |
| 465 | - <input id="_bbp_allow_revisions" name="_bbp_allow_revisions" type="checkbox" id="_bbp_allow_revisions" value="1" <?php checked( bbp_allow_revisions( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_revisions' ); ?> /> | |
| 466 | - <label for="_bbp_allow_revisions"><?php _e( 'Allow topic and reply revision logging', 'bbpress' ); ?></label> | |
| 839 | + <input name="_bbp_allow_forum_mods" id="_bbp_allow_forum_mods" type="checkbox" value="1" <?php checked( bbp_allow_forum_mods( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_forum_mods' ); ?> /> | |
| 840 | + <label for="_bbp_allow_forum_mods"><?php esc_html_e( 'Allow forums to have dedicated moderators', 'bbpress' ); ?></label> | |
| 841 | + <p class="description"><?php esc_html_e( 'This does not include the ability to edit users.', 'bbpress' ); ?></p> | |
| 467 | 842 | |
| 468 | 843 | <?php |
| 469 | 844 | } |
| 470 | 845 | |
| 471 | 846 | /** |
| 472 | - * Allow anonymous posting setting field | |
| 847 | + * Allow super-mods setting field | |
| 473 | 848 | * |
| 474 | - * @since bbPress (r2737) | |
| 475 | - * | |
| 476 | - * @uses checked() To display the checked attribute | |
| 849 | + * @since 2.6.0 bbPress (r6562) | |
| 477 | 850 | */ |
| 478 | -function bbp_admin_setting_callback_anonymous() { | |
| 851 | +function bbp_admin_setting_callback_super_mods() { | |
| 479 | 852 | ?> |
| 480 | 853 | |
| 481 | - <input id="_bbp_allow_anonymous" name="_bbp_allow_anonymous" type="checkbox" id="_bbp_allow_anonymous" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> /> | |
| 482 | - <label for="_bbp_allow_anonymous"><?php _e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label> | |
| 854 | + <input name="_bbp_allow_super_mods" id="_bbp_allow_super_mods" type="checkbox" value="1" <?php checked( bbp_allow_super_mods( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_super_mods' ); ?> /> | |
| 855 | + <label for="_bbp_allow_super_mods"><?php esc_html_e( 'Allow Moderators and Keymasters to edit users', 'bbpress' ); ?></label> | |
| 856 | + <p class="description"><?php esc_html_e( 'This includes roles, passwords, and email addresses.', 'bbpress' ); ?></p> | |
| 483 | 857 | |
| 484 | 858 | <?php |
| 485 | 859 | } |
| 486 | 860 | |
| 487 | 861 | /** |
| 488 | - * Allow global access setting field | |
| 862 | + * Allow forum wide search | |
| 489 | 863 | * |
| 490 | - * @since bbPress (r3378) | |
| 491 | - * | |
| 492 | - * @uses checked() To display the checked attribute | |
| 864 | + * @since 2.4.0 bbPress (r4970) | |
| 493 | 865 | */ |
| 494 | -function bbp_admin_setting_callback_global_access() { | |
| 866 | +function bbp_admin_setting_callback_search() { | |
| 495 | 867 | ?> |
| 496 | 868 | |
| 497 | - <input id="_bbp_allow_global_access" name="_bbp_allow_global_access" type="checkbox" id="_bbp_allow_global_access" value="1" <?php checked( bbp_allow_global_access( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> /> | |
| 498 | - <label for="_bbp_allow_global_access"><?php _e( 'Automatically assign default role to new, registered users upon visiting the site.', 'bbpress' ); ?></label> | |
| 869 | + <input name="_bbp_allow_search" id="_bbp_allow_search" type="checkbox" value="1" <?php checked( bbp_allow_search( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_search' ); ?> /> | |
| 870 | + <label for="_bbp_allow_search"><?php esc_html_e( 'Allow forum wide search', 'bbpress' ); ?></label> | |
| 499 | 871 | |
| 500 | 872 | <?php |
| 501 | 873 | } |
| 502 | 874 | |
| 503 | 875 | /** |
| 504 | - * Output forum role selector (for user edit) | |
| 876 | + * Hierarchical reply maximum depth level setting field | |
| 505 | 877 | * |
| 506 | - * @since bbPress (r4284) | |
| 878 | + * Replies will be threaded if depth is 2 or greater | |
| 879 | + * | |
| 880 | + * @since 2.4.0 bbPress (r4944) | |
| 507 | 881 | */ |
| 508 | -function bbp_admin_setting_callback_default_role() { | |
| 882 | +function bbp_admin_setting_callback_thread_replies_depth() { | |
| 509 | 883 | |
| 510 | - $default_role = bbp_get_default_role(); ?> | |
| 884 | + // Set maximum depth for dropdown | |
| 885 | + $max_depth = (int) apply_filters( 'bbp_thread_replies_depth_max', 10 ); | |
| 886 | + $current_depth = bbp_thread_replies_depth(); | |
| 511 | 887 | |
| 512 | - <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>> | |
| 888 | + // Start an output buffer for the select dropdown | |
| 889 | + ob_start(); ?> | |
| 513 | 890 | |
| 514 | - <?php foreach ( bbp_get_dynamic_roles() as $role => $details ) : ?> | |
| 891 | + </label> | |
| 892 | + <label for="_bbp_thread_replies_depth"> | |
| 893 | + <select name="_bbp_thread_replies_depth" id="_bbp_thread_replies_depth" <?php bbp_maybe_admin_setting_disabled( '_bbp_thread_replies_depth' ); ?>> | |
| 894 | + <?php for ( $i = 2; $i <= $max_depth; $i++ ) : ?> | |
| 515 | 895 | |
| 516 | - <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option> | |
| 896 | + <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $current_depth ); ?>><?php echo esc_html( $i ); ?></option> | |
| 517 | 897 | |
| 518 | - <?php endforeach; ?> | |
| 898 | + <?php endfor; ?> | |
| 899 | + </select> | |
| 519 | 900 | |
| 520 | - </select> | |
| 901 | + <?php $select = ob_get_clean(); ?> | |
| 521 | 902 | |
| 522 | - <?php | |
| 903 | + <label for="_bbp_allow_threaded_replies"> | |
| 904 | + <input name="_bbp_allow_threaded_replies" id="_bbp_allow_threaded_replies" type="checkbox" value="1" <?php checked( '1', bbp_allow_threaded_replies( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_threaded_replies' ); ?> /> | |
| 905 | + <?php printf( esc_html__( 'Enable threaded (nested) replies %s levels deep', 'bbpress' ), $select ); ?> | |
| 906 | + </label> | |
| 907 | + | |
| 908 | +<?php | |
| 523 | 909 | } |
| 524 | 910 | |
| 525 | 911 | /** |
| 912 | + * Allow topic and reply revisions | |
| 913 | + * | |
| 914 | + * @since 2.0.0 bbPress (r3412) | |
| 915 | + */ | |
| 916 | +function bbp_admin_setting_callback_revisions() { | |
| 917 | +?> | |
| 918 | + | |
| 919 | + <input name="_bbp_allow_revisions" id="_bbp_allow_revisions" type="checkbox" value="1" <?php checked( bbp_allow_revisions( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_revisions' ); ?> /> | |
| 920 | + <label for="_bbp_allow_revisions"><?php esc_html_e( 'Allow topic and reply revision logging', 'bbpress' ); ?></label> | |
| 921 | + | |
| 922 | +<?php | |
| 923 | +} | |
| 924 | + | |
| 925 | +/** | |
| 526 | 926 | * Use the WordPress editor setting field |
| 527 | 927 | * |
| 528 | - * @since bbPress (r3586) | |
| 529 | - * | |
| 530 | - * @uses checked() To display the checked attribute | |
| 928 | + * @since 2.1.0 bbPress (r3586) | |
| 531 | 929 | */ |
| 532 | 930 | function bbp_admin_setting_callback_use_wp_editor() { |
| 533 | 931 | ?> |
| 534 | 932 | |
| 535 | - <input id="_bbp_use_wp_editor" name="_bbp_use_wp_editor" type="checkbox" id="_bbp_use_wp_editor" value="1" <?php checked( bbp_use_wp_editor( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_wp_editor' ); ?> /> | |
| 536 | - <label for="_bbp_use_wp_editor"><?php _e( 'Use the fancy WordPress editor to create and edit topics and replies', 'bbpress' ); ?></label> | |
| 933 | + <input name="_bbp_use_wp_editor" id="_bbp_use_wp_editor" type="checkbox" value="1" <?php checked( bbp_use_wp_editor( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_wp_editor' ); ?> /> | |
| 934 | + <label for="_bbp_use_wp_editor"><?php esc_html_e( 'Add toolbar & buttons to textareas to help with HTML formatting', 'bbpress' ); ?></label> | |
| 537 | 935 | |
| 538 | 936 | <?php |
| 539 | 937 | } |
| 540 | 938 | |
| @@ -540,14 +938,14 @@ | ||
| 540 | 938 | |
| 541 | 939 | /** |
| 542 | 940 | * Main subtheme section |
| 543 | 941 | * |
| 544 | - * @since bbPress (r2786) | |
| 942 | + * @since 2.0.0 bbPress (r2786) | |
| 545 | 943 | */ |
| 546 | 944 | function bbp_admin_setting_callback_subtheme_section() { |
| 547 | 945 | ?> |
| 548 | 946 | |
| 549 | - <p><?php _e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p> | |
| 947 | + <p><?php esc_html_e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p> | |
| 550 | 948 | |
| 551 | 949 | <?php |
| 552 | 950 | } |
| 553 | 951 | |
| @@ -553,11 +951,9 @@ | ||
| 553 | 951 | |
| 554 | 952 | /** |
| 555 | 953 | * Use the WordPress editor setting field |
| 556 | 954 | * |
| 557 | - * @since bbPress (r3586) | |
| 558 | - * | |
| 559 | - * @uses checked() To display the checked attribute | |
| 955 | + * @since 2.1.0 bbPress (r3586) | |
| 560 | 956 | */ |
| 561 | 957 | function bbp_admin_setting_callback_subtheme_id() { |
| 562 | 958 | |
| 563 | 959 | // Declare locale variable |
| @@ -569,19 +965,19 @@ | ||
| 569 | 965 | // something else is wrong. |
| 570 | 966 | // |
| 571 | 967 | // @see bbPress::register_theme_packages() |
| 572 | 968 | foreach ( (array) bbpress()->theme_compat->packages as $id => $theme ) { |
| 573 | - $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . sprintf( __( '%1$s - %2$s', 'bbpress' ), esc_html( $theme->name ), esc_html( str_replace( WP_CONTENT_DIR, '', $theme->dir ) ) ) . '</option>'; | |
| 969 | + $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . esc_html( $theme->name ) . '</option>'; | |
| 574 | 970 | } |
| 575 | 971 | |
| 576 | - if ( !empty( $theme_options ) ) : ?> | |
| 972 | + if ( ! empty( $theme_options ) ) : ?> | |
| 577 | 973 | |
| 578 | - <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" <?php bbp_maybe_admin_setting_disabled( '_bbp_theme_package_id' ); ?>><?php echo $theme_options ?></select> | |
| 579 | - <label for="_bbp_theme_package_id"><?php _e( 'will serve all bbPress templates', 'bbpress' ); ?></label> | |
| 974 | + <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" <?php bbp_maybe_admin_setting_disabled( '_bbp_theme_package_id' ); ?>><?php echo $theme_options; ?></select> | |
| 975 | + <label for="_bbp_theme_package_id"><?php esc_html_e( 'will serve all bbPress templates', 'bbpress' ); ?></label> | |
| 580 | 976 | |
| 581 | 977 | <?php else : ?> |
| 582 | 978 | |
| 583 | - <p><?php _e( 'No template packages available.', 'bbpress' ); ?></p> | |
| 979 | + <p><?php esc_html_e( 'No template packages available.', 'bbpress' ); ?></p> | |
| 584 | 980 | |
| 585 | 981 | <?php endif; |
| 586 | 982 | } |
| 587 | 983 | |
| @@ -587,17 +983,15 @@ | ||
| 587 | 983 | |
| 588 | 984 | /** |
| 589 | 985 | * Allow oEmbed in replies |
| 590 | 986 | * |
| 591 | - * @since bbPress (r3752) | |
| 592 | - * | |
| 593 | - * @uses checked() To display the checked attribute | |
| 987 | + * @since 2.1.0 bbPress (r3752) | |
| 594 | 988 | */ |
| 595 | 989 | function bbp_admin_setting_callback_use_autoembed() { |
| 596 | 990 | ?> |
| 597 | 991 | |
| 598 | - <input id="_bbp_use_autoembed" name="_bbp_use_autoembed" type="checkbox" id="_bbp_use_autoembed" value="1" <?php checked( bbp_use_autoembed( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_autoembed' ); ?> /> | |
| 599 | - <label for="_bbp_use_autoembed"><?php _e( 'Embed media (YouTube, Twitter, Flickr, etc...) directly into topics and replies', 'bbpress' ); ?></label> | |
| 992 | + <input name="_bbp_use_autoembed" id="_bbp_use_autoembed" type="checkbox" value="1" <?php checked( bbp_use_autoembed( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_autoembed' ); ?> /> | |
| 993 | + <label for="_bbp_use_autoembed"><?php esc_html_e( 'Embed media (YouTube, Twitter, Flickr, etc...) directly into topics and replies', 'bbpress' ); ?></label> | |
| 600 | 994 | |
| 601 | 995 | <?php |
| 602 | 996 | } |
| 603 | 997 | |
| @@ -605,14 +999,14 @@ | ||
| 605 | 999 | |
| 606 | 1000 | /** |
| 607 | 1001 | * Per page settings section description for the settings page |
| 608 | 1002 | * |
| 609 | - * @since bbPress (r2786) | |
| 1003 | + * @since 2.0.0 bbPress (r2786) | |
| 610 | 1004 | */ |
| 611 | 1005 | function bbp_admin_setting_callback_per_page_section() { |
| 612 | 1006 | ?> |
| 613 | 1007 | |
| 614 | - <p><?php _e( 'How many topics and replies to show per page', 'bbpress' ); ?></p> | |
| 1008 | + <p><?php esc_html_e( 'How many topics and replies to show per page', 'bbpress' ); ?></p> | |
| 615 | 1009 | |
| 616 | 1010 | <?php |
| 617 | 1011 | } |
| 618 | 1012 | |
| @@ -618,17 +1012,15 @@ | ||
| 618 | 1012 | |
| 619 | 1013 | /** |
| 620 | 1014 | * Topics per page setting field |
| 621 | 1015 | * |
| 622 | - * @since bbPress (r2786) | |
| 623 | - * | |
| 624 | - * @uses bbp_form_option() To output the option value | |
| 1016 | + * @since 2.0.0 bbPress (r2786) | |
| 625 | 1017 | */ |
| 626 | 1018 | function bbp_admin_setting_callback_topics_per_page() { |
| 627 | 1019 | ?> |
| 628 | 1020 | |
| 629 | - <input name="_bbp_topics_per_page" type="number" min="1" step="1" id="_bbp_topics_per_page" value="<?php bbp_form_option( '_bbp_topics_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_page' ); ?> /> | |
| 630 | - <label for="_bbp_topics_per_page"><?php _e( 'per page', 'bbpress' ); ?></label> | |
| 1021 | + <input name="_bbp_topics_per_page" id="_bbp_topics_per_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_topics_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_page' ); ?> /> | |
| 1022 | + <?php esc_html_e( 'per page', 'bbpress' ); ?> | |
| 631 | 1023 | |
| 632 | 1024 | <?php |
| 633 | 1025 | } |
| 634 | 1026 | |
| @@ -634,17 +1026,15 @@ | ||
| 634 | 1026 | |
| 635 | 1027 | /** |
| 636 | 1028 | * Replies per page setting field |
| 637 | 1029 | * |
| 638 | - * @since bbPress (r2786) | |
| 639 | - * | |
| 640 | - * @uses bbp_form_option() To output the option value | |
| 1030 | + * @since 2.0.0 bbPress (r2786) | |
| 641 | 1031 | */ |
| 642 | 1032 | function bbp_admin_setting_callback_replies_per_page() { |
| 643 | 1033 | ?> |
| 644 | 1034 | |
| 645 | - <input name="_bbp_replies_per_page" type="number" min="1" step="1" id="_bbp_replies_per_page" value="<?php bbp_form_option( '_bbp_replies_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_page' ); ?> /> | |
| 646 | - <label for="_bbp_replies_per_page"><?php _e( 'per page', 'bbpress' ); ?></label> | |
| 1035 | + <input name="_bbp_replies_per_page" id="_bbp_replies_per_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_replies_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_page' ); ?> /> | |
| 1036 | + <?php esc_html_e( 'per page', 'bbpress' ); ?> | |
| 647 | 1037 | |
| 648 | 1038 | <?php |
| 649 | 1039 | } |
| 650 | 1040 | |
| @@ -652,14 +1042,14 @@ | ||
| 652 | 1042 | |
| 653 | 1043 | /** |
| 654 | 1044 | * Per page settings section description for the settings page |
| 655 | 1045 | * |
| 656 | - * @since bbPress (r2786) | |
| 1046 | + * @since 2.0.0 bbPress (r2786) | |
| 657 | 1047 | */ |
| 658 | 1048 | function bbp_admin_setting_callback_per_rss_page_section() { |
| 659 | 1049 | ?> |
| 660 | 1050 | |
| 661 | - <p><?php _e( 'How many topics and replies to show per RSS page', 'bbpress' ); ?></p> | |
| 1051 | + <p><?php esc_html_e( 'How many topics and replies to show per RSS page', 'bbpress' ); ?></p> | |
| 662 | 1052 | |
| 663 | 1053 | <?php |
| 664 | 1054 | } |
| 665 | 1055 | |
| @@ -665,17 +1055,15 @@ | ||
| 665 | 1055 | |
| 666 | 1056 | /** |
| 667 | 1057 | * Topics per RSS page setting field |
| 668 | 1058 | * |
| 669 | - * @since bbPress (r2786) | |
| 670 | - * | |
| 671 | - * @uses bbp_form_option() To output the option value | |
| 1059 | + * @since 2.0.0 bbPress (r2786) | |
| 672 | 1060 | */ |
| 673 | 1061 | function bbp_admin_setting_callback_topics_per_rss_page() { |
| 674 | 1062 | ?> |
| 675 | 1063 | |
| 676 | - <input name="_bbp_topics_per_rss_page" type="number" min="1" step="1" id="_bbp_topics_per_rss_page" value="<?php bbp_form_option( '_bbp_topics_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_rss_page' ); ?> /> | |
| 677 | - <label for="_bbp_topics_per_rss_page"><?php _e( 'per page', 'bbpress' ); ?></label> | |
| 1064 | + <input name="_bbp_topics_per_rss_page" id="_bbp_topics_per_rss_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_topics_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_rss_page' ); ?> /> | |
| 1065 | + <?php esc_html_e( 'per page', 'bbpress' ); ?> | |
| 678 | 1066 | |
| 679 | 1067 | <?php |
| 680 | 1068 | } |
| 681 | 1069 | |
| @@ -681,17 +1069,15 @@ | ||
| 681 | 1069 | |
| 682 | 1070 | /** |
| 683 | 1071 | * Replies per RSS page setting field |
| 684 | 1072 | * |
| 685 | - * @since bbPress (r2786) | |
| 686 | - * | |
| 687 | - * @uses bbp_form_option() To output the option value | |
| 1073 | + * @since 2.0.0 bbPress (r2786) | |
| 688 | 1074 | */ |
| 689 | 1075 | function bbp_admin_setting_callback_replies_per_rss_page() { |
| 690 | 1076 | ?> |
| 691 | 1077 | |
| 692 | - <input name="_bbp_replies_per_rss_page" type="number" min="1" step="1" id="_bbp_replies_per_rss_page" value="<?php bbp_form_option( '_bbp_replies_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_rss_page' ); ?> /> | |
| 693 | - <label for="_bbp_replies_per_rss_page"><?php _e( 'per page', 'bbpress' ); ?></label> | |
| 1078 | + <input name="_bbp_replies_per_rss_page" id="_bbp_replies_per_rss_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_replies_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_rss_page' ); ?> /> | |
| 1079 | + <?php esc_html_e( 'per page', 'bbpress' ); ?> | |
| 694 | 1080 | |
| 695 | 1081 | <?php |
| 696 | 1082 | } |
| 697 | 1083 | |
| @@ -699,17 +1085,18 @@ | ||
| 699 | 1085 | |
| 700 | 1086 | /** |
| 701 | 1087 | * Slugs settings section description for the settings page |
| 702 | 1088 | * |
| 703 | - * @since bbPress (r2786) | |
| 1089 | + * @since 2.0.0 bbPress (r2786) | |
| 704 | 1090 | */ |
| 705 | 1091 | function bbp_admin_setting_callback_root_slug_section() { |
| 706 | 1092 | |
| 707 | 1093 | // Flush rewrite rules when this section is saved |
| 708 | - if ( isset( $_GET['settings-updated'] ) && isset( $_GET['page'] ) ) | |
| 709 | - flush_rewrite_rules(); ?> | |
| 1094 | + if ( isset( $_GET['settings-updated'] ) && isset( $_GET['page'] ) ) { | |
| 1095 | + flush_rewrite_rules(); | |
| 1096 | + } ?> | |
| 710 | 1097 | |
| 711 | - <p><?php printf( __( 'Custom root slugs to prefix your forums and topics with. These can be partnered with WordPress pages to allow more flexibility.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p> | |
| 1098 | + <p><?php esc_html_e( 'Customize your Forums root. Partner with a WordPress Page and use Shortcodes for more flexibility.', 'bbpress' ); ?></p> | |
| 712 | 1099 | |
| 713 | 1100 | <?php |
| 714 | 1101 | } |
| 715 | 1102 | |
| @@ -715,16 +1102,14 @@ | ||
| 715 | 1102 | |
| 716 | 1103 | /** |
| 717 | 1104 | * Root slug setting field |
| 718 | 1105 | * |
| 719 | - * @since bbPress (r2786) | |
| 720 | - * | |
| 721 | - * @uses bbp_form_option() To output the option value | |
| 1106 | + * @since 2.0.0 bbPress (r2786) | |
| 722 | 1107 | */ |
| 723 | 1108 | function bbp_admin_setting_callback_root_slug() { |
| 724 | 1109 | ?> |
| 725 | 1110 | |
| 726 | - <input name="_bbp_root_slug" type="text" id="_bbp_root_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_root_slug', 'forums', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_root_slug' ); ?> /> | |
| 1111 | + <input name="_bbp_root_slug" id="_bbp_root_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_root_slug', 'forums', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_root_slug' ); ?> /> | |
| 727 | 1112 | |
| 728 | 1113 | <?php |
| 729 | 1114 | // Slug Check |
| 730 | 1115 | bbp_form_slug_conflict_check( '_bbp_root_slug', 'forums' ); |
| @@ -730,18 +1115,103 @@ | ||
| 730 | 1115 | bbp_form_slug_conflict_check( '_bbp_root_slug', 'forums' ); |
| 731 | 1116 | } |
| 732 | 1117 | |
| 733 | 1118 | /** |
| 1119 | + * Include root slug setting field | |
| 1120 | + * | |
| 1121 | + * @since 2.0.0 bbPress (r2786) | |
| 1122 | + */ | |
| 1123 | +function bbp_admin_setting_callback_include_root() { | |
| 1124 | +?> | |
| 1125 | + | |
| 1126 | + <input name="_bbp_include_root" id="_bbp_include_root" type="checkbox" value="1" <?php checked( bbp_include_root_slug() ); bbp_maybe_admin_setting_disabled( '_bbp_include_root' ); ?> /> | |
| 1127 | + <label for="_bbp_include_root"><?php esc_html_e( 'Prefix all forum content with the Forum Root slug (Recommended)', 'bbpress' ); ?></label> | |
| 1128 | + | |
| 1129 | +<?php | |
| 1130 | +} | |
| 1131 | + | |
| 1132 | +/** | |
| 1133 | + * Include root slug setting field | |
| 1134 | + * | |
| 1135 | + * @since 2.0.0 bbPress (r2786) | |
| 1136 | + */ | |
| 1137 | +function bbp_admin_setting_callback_show_on_root() { | |
| 1138 | + | |
| 1139 | + // Current setting | |
| 1140 | + $show_on_root = bbp_show_on_root(); | |
| 1141 | + | |
| 1142 | + // Options for forum root output | |
| 1143 | + $root_options = array( | |
| 1144 | + 'forums' => array( | |
| 1145 | + 'name' => esc_attr__( 'Forum Index', 'bbpress' ) | |
| 1146 | + ), | |
| 1147 | + 'topics' => array( | |
| 1148 | + 'name' => esc_attr__( 'Topics by Last Post', 'bbpress' ) | |
| 1149 | + ) | |
| 1150 | + ); ?> | |
| 1151 | + | |
| 1152 | + <select name="_bbp_show_on_root" id="_bbp_show_on_root" <?php bbp_maybe_admin_setting_disabled( '_bbp_show_on_root' ); ?>> | |
| 1153 | + | |
| 1154 | + <?php foreach ( $root_options as $option_id => $details ) : ?> | |
| 1155 | + | |
| 1156 | + <option <?php selected( $show_on_root, $option_id ); ?> value="<?php echo esc_attr( $option_id ); ?>"><?php echo esc_html( $details['name'] ); ?></option> | |
| 1157 | + | |
| 1158 | + <?php endforeach; ?> | |
| 1159 | + | |
| 1160 | + </select> | |
| 1161 | + | |
| 1162 | + <?php | |
| 1163 | + | |
| 1164 | + // Look for theme support | |
| 1165 | + $forum_archive = basename( bbp_get_forum_archive_template() ); | |
| 1166 | + | |
| 1167 | + // This setting doesn't work if the theme has an archive-forum.php template. | |
| 1168 | + if ( ! empty( $forum_archive ) ) : ?> | |
| 1169 | + | |
| 1170 | + <p class="description"><?php printf( esc_html__( 'This setting will be ignored because %s was found in your theme.', 'bbpress' ), '<code>' . $forum_archive . '</code>' ); ?></p> | |
| 1171 | + | |
| 1172 | + <?php endif; | |
| 1173 | +} | |
| 1174 | + | |
| 1175 | +/** User Slug Section *********************************************************/ | |
| 1176 | + | |
| 1177 | +/** | |
| 1178 | + * Slugs settings section description for the settings page | |
| 1179 | + * | |
| 1180 | + * @since 2.0.0 bbPress (r2786) | |
| 1181 | + */ | |
| 1182 | +function bbp_admin_setting_callback_user_slug_section() { | |
| 1183 | +?> | |
| 1184 | + | |
| 1185 | + <p><?php esc_html_e( 'Customize your user profile slugs.', 'bbpress' ); ?></p> | |
| 1186 | + | |
| 1187 | +<?php | |
| 1188 | +} | |
| 1189 | + | |
| 1190 | +/** | |
| 1191 | + * User slug setting field | |
| 1192 | + * | |
| 1193 | + * @since 2.0.0 bbPress (r2786) | |
| 1194 | + */ | |
| 1195 | +function bbp_admin_setting_callback_user_slug() { | |
| 1196 | +?> | |
| 1197 | + | |
| 1198 | + <input name="_bbp_user_slug" id="_bbp_user_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_slug', 'users', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_slug' ); ?> /> | |
| 1199 | + | |
| 1200 | +<?php | |
| 1201 | + // Slug Check | |
| 1202 | + bbp_form_slug_conflict_check( '_bbp_user_slug', 'users' ); | |
| 1203 | +} | |
| 1204 | + | |
| 1205 | +/** | |
| 734 | 1206 | * Topic archive slug setting field |
| 735 | 1207 | * |
| 736 | - * @since bbPress (r2786) | |
| 737 | - * | |
| 738 | - * @uses bbp_form_option() To output the option value | |
| 1208 | + * @since 2.0.0 bbPress (r2786) | |
| 739 | 1209 | */ |
| 740 | 1210 | function bbp_admin_setting_callback_topic_archive_slug() { |
| 741 | 1211 | ?> |
| 742 | 1212 | |
| 743 | - <input name="_bbp_topic_archive_slug" type="text" id="_bbp_topic_archive_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_archive_slug', 'topics', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_archive_slug' ); ?> /> | |
| 1213 | + <input name="_bbp_topic_archive_slug" id="_bbp_topic_archive_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_archive_slug', 'topics', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_archive_slug' ); ?> /> | |
| 744 | 1214 | |
| 745 | 1215 | <?php |
| 746 | 1216 | // Slug Check |
| 747 | 1217 | bbp_form_slug_conflict_check( '_bbp_topic_archive_slug', 'topics' ); |
| @@ -746,50 +1216,92 @@ | ||
| 746 | 1216 | // Slug Check |
| 747 | 1217 | bbp_form_slug_conflict_check( '_bbp_topic_archive_slug', 'topics' ); |
| 748 | 1218 | } |
| 749 | 1219 | |
| 750 | -/** Single Slugs **************************************************************/ | |
| 1220 | +/** | |
| 1221 | + * Reply archive slug setting field | |
| 1222 | + * | |
| 1223 | + * @since 2.4.0 bbPress (r4932) | |
| 1224 | + */ | |
| 1225 | +function bbp_admin_setting_callback_reply_archive_slug() { | |
| 1226 | +?> | |
| 751 | 1227 | |
| 1228 | + <input name="_bbp_reply_archive_slug" id="_bbp_reply_archive_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_archive_slug', 'replies', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_archive_slug' ); ?> /> | |
| 1229 | + | |
| 1230 | +<?php | |
| 1231 | + // Slug Check | |
| 1232 | + bbp_form_slug_conflict_check( '_bbp_reply_archive_slug', 'replies' ); | |
| 1233 | +} | |
| 1234 | + | |
| 752 | 1235 | /** |
| 753 | - * Slugs settings section description for the settings page | |
| 1236 | + * Favorites slug setting field | |
| 754 | 1237 | * |
| 755 | - * @since bbPress (r2786) | |
| 1238 | + * @since 2.4.0 bbPress (r4932) | |
| 756 | 1239 | */ |
| 757 | -function bbp_admin_setting_callback_single_slug_section() { | |
| 1240 | +function bbp_admin_setting_callback_user_favs_slug() { | |
| 758 | 1241 | ?> |
| 759 | 1242 | |
| 760 | - <p><?php printf( __( 'Custom slugs for single forums, topics, replies, tags, users, and views here. If you change these, existing permalinks will also change.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p> | |
| 1243 | + <input name="_bbp_user_favs_slug" id="_bbp_user_favs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_favs_slug', 'favorites', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_favs_slug' ); ?> /> | |
| 761 | 1244 | |
| 762 | 1245 | <?php |
| 1246 | + // Slug Check | |
| 1247 | + bbp_form_slug_conflict_check( '_bbp_user_favs_slug', 'favorites' ); | |
| 763 | 1248 | } |
| 764 | 1249 | |
| 765 | 1250 | /** |
| 766 | - * Include root slug setting field | |
| 1251 | + * Subscriptions slug setting field | |
| 767 | 1252 | * |
| 768 | - * @since bbPress (r2786) | |
| 1253 | + * @since 2.4.0 bbPress (r4932) | |
| 1254 | + */ | |
| 1255 | +function bbp_admin_setting_callback_user_subs_slug() { | |
| 1256 | +?> | |
| 1257 | + | |
| 1258 | + <input name="_bbp_user_subs_slug" id="_bbp_user_subs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_subs_slug', 'subscriptions', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_subs_slug' ); ?> /> | |
| 1259 | + | |
| 1260 | +<?php | |
| 1261 | + // Slug Check | |
| 1262 | + bbp_form_slug_conflict_check( '_bbp_user_subs_slug', 'subscriptions' ); | |
| 1263 | +} | |
| 1264 | + | |
| 1265 | +/** | |
| 1266 | + * Engagements slug setting field | |
| 769 | 1267 | * |
| 770 | - * @uses checked() To display the checked attribute | |
| 1268 | + * @since 2.6.0 bbPress (r6320) | |
| 771 | 1269 | */ |
| 772 | -function bbp_admin_setting_callback_include_root() { | |
| 1270 | +function bbp_admin_setting_callback_user_engagements_slug() { | |
| 773 | 1271 | ?> |
| 774 | 1272 | |
| 775 | - <input id="_bbp_include_root" name="_bbp_include_root" type="checkbox" id="_bbp_include_root" value="1" <?php checked( get_option( '_bbp_include_root', true ) ); bbp_maybe_admin_setting_disabled( '_bbp_include_root' ); ?> /> | |
| 776 | - <label for="_bbp_include_root"><?php _e( 'Prefix your forum area with the Forum Base slug (Recommended)', 'bbpress' ); ?></label> | |
| 1273 | + <input name="_bbp_user_engs_slug" id="_bbp_user_engs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_engs_slug', 'engagements', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_engs_slug' ); ?> /> | |
| 777 | 1274 | |
| 778 | 1275 | <?php |
| 1276 | + // Slug Check | |
| 1277 | + bbp_form_slug_conflict_check( '_bbp_user_engs_slug', 'engagements' ); | |
| 779 | 1278 | } |
| 780 | 1279 | |
| 1280 | +/** Single Slugs **************************************************************/ | |
| 1281 | + | |
| 781 | 1282 | /** |
| 1283 | + * Slugs settings section description for the settings page | |
| 1284 | + * | |
| 1285 | + * @since 2.0.0 bbPress (r2786) | |
| 1286 | + */ | |
| 1287 | +function bbp_admin_setting_callback_single_slug_section() { | |
| 1288 | +?> | |
| 1289 | + | |
| 1290 | + <p><?php printf( esc_html__( 'Custom slugs for single forums, topics, replies, tags, views, edit, and search.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p> | |
| 1291 | + | |
| 1292 | +<?php | |
| 1293 | +} | |
| 1294 | + | |
| 1295 | +/** | |
| 782 | 1296 | * Forum slug setting field |
| 783 | 1297 | * |
| 784 | - * @since bbPress (r2786) | |
| 785 | - * | |
| 786 | - * @uses bbp_form_option() To output the option value | |
| 1298 | + * @since 2.0.0 bbPress (r2786) | |
| 787 | 1299 | */ |
| 788 | 1300 | function bbp_admin_setting_callback_forum_slug() { |
| 789 | 1301 | ?> |
| 790 | 1302 | |
| 791 | - <input name="_bbp_forum_slug" type="text" id="_bbp_forum_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_forum_slug', 'forum', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_forum_slug' ); ?> /> | |
| 1303 | + <input name="_bbp_forum_slug" id="_bbp_forum_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_forum_slug', 'forum', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_forum_slug' ); ?> /> | |
| 792 | 1304 | |
| 793 | 1305 | <?php |
| 794 | 1306 | // Slug Check |
| 795 | 1307 | bbp_form_slug_conflict_check( '_bbp_forum_slug', 'forum' ); |
| @@ -797,16 +1309,14 @@ | ||
| 797 | 1309 | |
| 798 | 1310 | /** |
| 799 | 1311 | * Topic slug setting field |
| 800 | 1312 | * |
| 801 | - * @since bbPress (r2786) | |
| 802 | - * | |
| 803 | - * @uses bbp_form_option() To output the option value | |
| 1313 | + * @since 2.0.0 bbPress (r2786) | |
| 804 | 1314 | */ |
| 805 | 1315 | function bbp_admin_setting_callback_topic_slug() { |
| 806 | 1316 | ?> |
| 807 | 1317 | |
| 808 | - <input name="_bbp_topic_slug" type="text" id="_bbp_topic_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_slug', 'topic', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_slug' ); ?> /> | |
| 1318 | + <input name="_bbp_topic_slug" id="_bbp_topic_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_slug', 'topic', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_slug' ); ?> /> | |
| 809 | 1319 | |
| 810 | 1320 | <?php |
| 811 | 1321 | // Slug Check |
| 812 | 1322 | bbp_form_slug_conflict_check( '_bbp_topic_slug', 'topic' ); |
| @@ -814,16 +1324,14 @@ | ||
| 814 | 1324 | |
| 815 | 1325 | /** |
| 816 | 1326 | * Reply slug setting field |
| 817 | 1327 | * |
| 818 | - * @since bbPress (r2786) | |
| 819 | - * | |
| 820 | - * @uses bbp_form_option() To output the option value | |
| 1328 | + * @since 2.0.0 bbPress (r2786) | |
| 821 | 1329 | */ |
| 822 | 1330 | function bbp_admin_setting_callback_reply_slug() { |
| 823 | 1331 | ?> |
| 824 | 1332 | |
| 825 | - <input name="_bbp_reply_slug" type="text" id="_bbp_reply_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_slug', 'reply', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_slug' ); ?> /> | |
| 1333 | + <input name="_bbp_reply_slug" id="_bbp_reply_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_slug', 'reply', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_slug' ); ?> /> | |
| 826 | 1334 | |
| 827 | 1335 | <?php |
| 828 | 1336 | // Slug Check |
| 829 | 1337 | bbp_form_slug_conflict_check( '_bbp_reply_slug', 'reply' ); |
| @@ -831,16 +1339,14 @@ | ||
| 831 | 1339 | |
| 832 | 1340 | /** |
| 833 | 1341 | * Topic tag slug setting field |
| 834 | 1342 | * |
| 835 | - * @since bbPress (r2786) | |
| 836 | - * | |
| 837 | - * @uses bbp_form_option() To output the option value | |
| 1343 | + * @since 2.0.0 bbPress (r2786) | |
| 838 | 1344 | */ |
| 839 | 1345 | function bbp_admin_setting_callback_topic_tag_slug() { |
| 840 | 1346 | ?> |
| 841 | 1347 | |
| 842 | - <input name="_bbp_topic_tag_slug" type="text" id="_bbp_topic_tag_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_tag_slug', 'topic-tag', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_tag_slug' ); ?> /> | |
| 1348 | + <input name="_bbp_topic_tag_slug" id="_bbp_topic_tag_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_tag_slug', 'topic-tag', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_tag_slug' ); ?> /> | |
| 843 | 1349 | |
| 844 | 1350 | <?php |
| 845 | 1351 | |
| 846 | 1352 | // Slug Check |
| @@ -846,42 +1352,51 @@ | ||
| 846 | 1352 | // Slug Check |
| 847 | 1353 | bbp_form_slug_conflict_check( '_bbp_topic_tag_slug', 'topic-tag' ); |
| 848 | 1354 | } |
| 849 | 1355 | |
| 850 | -/** Other Slugs ***************************************************************/ | |
| 1356 | +/** | |
| 1357 | + * View slug setting field | |
| 1358 | + * | |
| 1359 | + * @since 2.0.0 bbPress (r2789) | |
| 1360 | + */ | |
| 1361 | +function bbp_admin_setting_callback_view_slug() { | |
| 1362 | +?> | |
| 851 | 1363 | |
| 1364 | + <input name="_bbp_view_slug" id="_bbp_view_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_view_slug', 'view', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_view_slug' ); ?> /> | |
| 1365 | + | |
| 1366 | +<?php | |
| 1367 | + // Slug Check | |
| 1368 | + bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' ); | |
| 1369 | +} | |
| 1370 | + | |
| 852 | 1371 | /** |
| 853 | - * User slug setting field | |
| 1372 | + * Search slug setting field | |
| 854 | 1373 | * |
| 855 | - * @since bbPress (r2786) | |
| 856 | - * | |
| 857 | - * @uses bbp_form_option() To output the option value | |
| 1374 | + * @since 2.3.0 bbPress (r4579) | |
| 858 | 1375 | */ |
| 859 | -function bbp_admin_setting_callback_user_slug() { | |
| 1376 | +function bbp_admin_setting_callback_search_slug() { | |
| 860 | 1377 | ?> |
| 861 | 1378 | |
| 862 | - <input name="_bbp_user_slug" type="text" id="_bbp_user_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_slug', 'users', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_slug' ); ?> /> | |
| 1379 | + <input name="_bbp_search_slug" id="_bbp_search_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_search_slug', 'search', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_search_slug' ); ?> /> | |
| 863 | 1380 | |
| 864 | 1381 | <?php |
| 865 | 1382 | // Slug Check |
| 866 | - bbp_form_slug_conflict_check( '_bbp_user_slug', 'users' ); | |
| 1383 | + bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' ); | |
| 867 | 1384 | } |
| 868 | 1385 | |
| 869 | 1386 | /** |
| 870 | - * View slug setting field | |
| 1387 | + * Edit slug setting field | |
| 871 | 1388 | * |
| 872 | - * @since bbPress (r2789) | |
| 873 | - * | |
| 874 | - * @uses bbp_form_option() To output the option value | |
| 1389 | + * @since 2.6.2 bbPress (r6965) | |
| 875 | 1390 | */ |
| 876 | -function bbp_admin_setting_callback_view_slug() { | |
| 1391 | +function bbp_admin_setting_callback_edit_slug() { | |
| 877 | 1392 | ?> |
| 878 | 1393 | |
| 879 | - <input name="_bbp_view_slug" type="text" id="_bbp_view_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_view_slug', 'view', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_view_slug' ); ?> /> | |
| 1394 | + <input name="_bbp_edit_slug" id="_bbp_edit_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_edit_slug', 'edit', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_slug' ); ?> /> | |
| 880 | 1395 | |
| 881 | 1396 | <?php |
| 882 | 1397 | // Slug Check |
| 883 | - bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' ); | |
| 1398 | + bbp_form_slug_conflict_check( '_bbp_edit_slug', 'edit' ); | |
| 884 | 1399 | } |
| 885 | 1400 | |
| 886 | 1401 | /** BuddyPress ****************************************************************/ |
| 887 | 1402 | |
| @@ -887,14 +1402,14 @@ | ||
| 887 | 1402 | |
| 888 | 1403 | /** |
| 889 | 1404 | * Extension settings section description for the settings page |
| 890 | 1405 | * |
| 891 | - * @since bbPress (r3575) | |
| 1406 | + * @since 2.1.0 bbPress (r3575) | |
| 892 | 1407 | */ |
| 893 | 1408 | function bbp_admin_setting_callback_buddypress_section() { |
| 894 | 1409 | ?> |
| 895 | 1410 | |
| 896 | - <p><?php _e( 'Forum settings for BuddyPress', 'bbpress' ); ?></p> | |
| 1411 | + <p><?php esc_html_e( 'Forum settings for BuddyPress', 'bbpress' ); ?></p> | |
| 897 | 1412 | |
| 898 | 1413 | <?php |
| 899 | 1414 | } |
| 900 | 1415 | |
| @@ -900,17 +1415,15 @@ | ||
| 900 | 1415 | |
| 901 | 1416 | /** |
| 902 | 1417 | * Allow BuddyPress group forums setting field |
| 903 | 1418 | * |
| 904 | - * @since bbPress (r3575) | |
| 905 | - * | |
| 906 | - * @uses checked() To display the checked attribute | |
| 1419 | + * @since 2.1.0 bbPress (r3575) | |
| 907 | 1420 | */ |
| 908 | 1421 | function bbp_admin_setting_callback_group_forums() { |
| 909 | 1422 | ?> |
| 910 | 1423 | |
| 911 | - <input id="_bbp_enable_group_forums" name="_bbp_enable_group_forums" type="checkbox" id="_bbp_enable_group_forums" value="1" <?php checked( bbp_is_group_forums_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_group_forums' ); ?> /> | |
| 912 | - <label for="_bbp_enable_group_forums"><?php _e( 'Allow BuddyPress Groups to have their own forums', 'bbpress' ); ?></label> | |
| 1424 | + <input name="_bbp_enable_group_forums" id="_bbp_enable_group_forums" type="checkbox" value="1" <?php checked( bbp_is_group_forums_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_group_forums' ); ?> /> | |
| 1425 | + <label for="_bbp_enable_group_forums"><?php esc_html_e( 'Allow BuddyPress Groups to have their own forums', 'bbpress' ); ?></label> | |
| 913 | 1426 | |
| 914 | 1427 | <?php |
| 915 | 1428 | } |
| 916 | 1429 | |
| @@ -916,28 +1429,54 @@ | ||
| 916 | 1429 | |
| 917 | 1430 | /** |
| 918 | 1431 | * Replies per page setting field |
| 919 | 1432 | * |
| 920 | - * @since bbPress (r3575) | |
| 921 | - * | |
| 922 | - * @uses bbp_form_option() To output the option value | |
| 1433 | + * @since 2.1.0 bbPress (r3575) | |
| 923 | 1434 | */ |
| 924 | 1435 | function bbp_admin_setting_callback_group_forums_root_id() { |
| 925 | 1436 | |
| 1437 | + // Group root ID | |
| 1438 | + $group_root = bbp_get_group_forums_root_id(); | |
| 1439 | + if ( ! bbp_get_forum( $group_root ) ) { | |
| 1440 | + delete_option( '_bbp_group_forums_root_id' ); | |
| 1441 | + $group_root = 0; | |
| 1442 | + } | |
| 1443 | + | |
| 926 | 1444 | // Output the dropdown for all forums |
| 927 | - bbp_dropdown( array( | |
| 928 | - 'selected' => bbp_get_group_forums_root_id(), | |
| 929 | - 'show_none' => __( '— Forum root —', 'bbpress' ), | |
| 1445 | + $select = bbp_get_dropdown( array( | |
| 1446 | + 'selected' => $group_root, | |
| 1447 | + 'show_none' => esc_html__( '— No parent —', 'bbpress' ), | |
| 930 | 1448 | 'orderby' => 'title', |
| 931 | 1449 | 'order' => 'ASC', |
| 932 | 1450 | 'select_id' => '_bbp_group_forums_root_id', |
| 933 | 1451 | 'disable_categories' => false, |
| 934 | 1452 | 'disabled' => '_bbp_group_forums_root_id' |
| 935 | - ) ); ?> | |
| 1453 | + ) ); | |
| 936 | 1454 | |
| 937 | - <label for="_bbp_group_forums_root_id"><?php _e( 'is the parent for all group forums', 'bbpress' ); ?></label> | |
| 938 | - <p class="description"><?php _e( 'Using the Forum Root is not recommended. Changing this does not move existing forums.', 'bbpress' ); ?></p> | |
| 1455 | + // Check cap one time | |
| 1456 | + $can_add_new = current_user_can( 'publish_forums' ); | |
| 1457 | + $button = ''; | |
| 939 | 1458 | |
| 1459 | + // Text variations based on configuration | |
| 1460 | + if ( empty( $group_root ) && ( true === $can_add_new ) ) { | |
| 1461 | + | |
| 1462 | + // New URL | |
| 1463 | + $new_url = wp_nonce_url( add_query_arg( array( | |
| 1464 | + 'page' => 'bbpress', | |
| 1465 | + 'create' => 'bbp-group-forum-root' | |
| 1466 | + ), admin_url( 'options-general.php' ) ), '_bbp_group_forums_root_id' ); | |
| 1467 | + | |
| 1468 | + // Button & text | |
| 1469 | + $button = '<a href="' . esc_url( $new_url ) . '">' . esc_html__( 'create a new one', 'bbpress' ) . '</a>'; | |
| 1470 | + $text = esc_html__( 'Use %s to contain your group forums, or %s', 'bbpress' ); //phpcs:ignore | |
| 1471 | + } else { | |
| 1472 | + $text = esc_html__( 'Use %s to contain your group forums', 'bbpress' ); | |
| 1473 | + } | |
| 1474 | + | |
| 1475 | + // Output | |
| 1476 | + printf( $text, $select, $button ); ?> | |
| 1477 | + <p class="description"><?php esc_html_e( 'Changing this will not move existing forums.', 'bbpress' ); ?></p> | |
| 1478 | + | |
| 940 | 1479 | <?php |
| 941 | 1480 | } |
| 942 | 1481 | |
| 943 | 1482 | /** Akismet *******************************************************************/ |
| @@ -944,14 +1483,14 @@ | ||
| 944 | 1483 | |
| 945 | 1484 | /** |
| 946 | 1485 | * Extension settings section description for the settings page |
| 947 | 1486 | * |
| 948 | - * @since bbPress (r3575) | |
| 1487 | + * @since 2.1.0 bbPress (r3575) | |
| 949 | 1488 | */ |
| 950 | 1489 | function bbp_admin_setting_callback_akismet_section() { |
| 951 | 1490 | ?> |
| 952 | 1491 | |
| 953 | - <p><?php _e( 'Forum settings for Akismet', 'bbpress' ); ?></p> | |
| 1492 | + <p><?php esc_html_e( 'Forum settings for Akismet', 'bbpress' ); ?></p> | |
| 954 | 1493 | |
| 955 | 1494 | <?php |
| 956 | 1495 | } |
| 957 | 1496 | |
| @@ -958,17 +1497,15 @@ | ||
| 958 | 1497 | |
| 959 | 1498 | /** |
| 960 | 1499 | * Allow Akismet setting field |
| 961 | 1500 | * |
| 962 | - * @since bbPress (r3575) | |
| 963 | - * | |
| 964 | - * @uses checked() To display the checked attribute | |
| 1501 | + * @since 2.1.0 bbPress (r3575) | |
| 965 | 1502 | */ |
| 966 | 1503 | function bbp_admin_setting_callback_akismet() { |
| 967 | 1504 | ?> |
| 968 | 1505 | |
| 969 | - <input id="_bbp_enable_akismet" name="_bbp_enable_akismet" type="checkbox" id="_bbp_enable_akismet" value="1" <?php checked( bbp_is_akismet_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_akismet' ); ?> /> | |
| 970 | - <label for="_bbp_enable_akismet"><?php _e( 'Allow Akismet to actively prevent forum spam.', 'bbpress' ); ?></label> | |
| 1506 | + <input name="_bbp_enable_akismet" id="_bbp_enable_akismet" type="checkbox" value="1" <?php checked( bbp_is_akismet_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_akismet' ); ?> /> | |
| 1507 | + <label for="_bbp_enable_akismet"><?php esc_html_e( 'Allow Akismet to actively prevent forum spam.', 'bbpress' ); ?></label> | |
| 971 | 1508 | |
| 972 | 1509 | <?php |
| 973 | 1510 | } |
| 974 | 1511 | |
| @@ -976,23 +1513,17 @@ | ||
| 976 | 1513 | |
| 977 | 1514 | /** |
| 978 | 1515 | * The main settings page |
| 979 | 1516 | * |
| 980 | - * @since bbPress (r2643) | |
| 981 | - * | |
| 982 | - * @uses screen_icon() To display the screen icon | |
| 983 | - * @uses settings_fields() To output the hidden fields for the form | |
| 984 | - * @uses do_settings_sections() To output the settings sections | |
| 1517 | + * @since 2.0.0 bbPress (r2643) | |
| 985 | 1518 | */ |
| 986 | 1519 | function bbp_admin_settings() { |
| 987 | 1520 | ?> |
| 988 | 1521 | |
| 989 | 1522 | <div class="wrap"> |
| 1523 | + <h1 class="wp-heading-inline"><?php esc_html_e( 'Forums Settings', 'bbpress' ); ?></h1> | |
| 1524 | + <hr class="wp-header-end"> | |
| 990 | 1525 | |
| 991 | - <?php screen_icon(); ?> | |
| 992 | - | |
| 993 | - <h2><?php _e( 'Forums Settings', 'bbpress' ) ?></h2> | |
| 994 | - | |
| 995 | 1526 | <form action="options.php" method="post"> |
| 996 | 1527 | |
| 997 | 1528 | <?php settings_fields( 'bbpress' ); ?> |
| 998 | 1529 | |
| @@ -1006,20 +1537,19 @@ | ||
| 1006 | 1537 | |
| 1007 | 1538 | <?php |
| 1008 | 1539 | } |
| 1009 | 1540 | |
| 1010 | - | |
| 1011 | 1541 | /** Converter Section *********************************************************/ |
| 1012 | 1542 | |
| 1013 | 1543 | /** |
| 1014 | 1544 | * Main settings section description for the settings page |
| 1015 | 1545 | * |
| 1016 | - * @since bbPress (r3813) | |
| 1546 | + * @since 2.1.0 bbPress (r3813) | |
| 1017 | 1547 | */ |
| 1018 | 1548 | function bbp_converter_setting_callback_main_section() { |
| 1019 | 1549 | ?> |
| 1020 | 1550 | |
| 1021 | - <p><?php _e( 'Information about your previous forums database so that they can be converted. <strong>Backup your database before proceeding.</strong>', 'bbpress' ); ?></p> | |
| 1551 | + <p><?php _e( 'Information about the database for your previous forums so they can be converted.', 'bbpress' ); ?></p> | |
| 1022 | 1552 | |
| 1023 | 1553 | <?php |
| 1024 | 1554 | } |
| 1025 | 1555 | |
| @@ -1025,32 +1555,25 @@ | ||
| 1025 | 1555 | |
| 1026 | 1556 | /** |
| 1027 | 1557 | * Edit Platform setting field |
| 1028 | 1558 | * |
| 1029 | - * @since bbPress (r3813) | |
| 1559 | + * @since 2.1.0 bbPress (r3813) | |
| 1030 | 1560 | */ |
| 1031 | 1561 | function bbp_converter_setting_callback_platform() { |
| 1032 | 1562 | |
| 1033 | - $platform_options = ''; | |
| 1034 | - $curdir = opendir( bbpress()->admin->admin_dir . 'converters/' ); | |
| 1563 | + // Converters | |
| 1564 | + $current = get_option( '_bbp_converter_platform' ); | |
| 1565 | + $converters = bbp_get_converters(); | |
| 1566 | + $options = ''; | |
| 1035 | 1567 | |
| 1036 | - // Bail if no directory was found (how did this happen?) | |
| 1037 | - if ( empty( $curdir ) ) | |
| 1038 | - return; | |
| 1568 | + // Put options together | |
| 1569 | + foreach ( $converters as $name => $file ) { | |
| 1570 | + $options .= '<option value="' . esc_attr( $name ) . '"' . selected( $name, $current, false ) . '>' . esc_html( $name ) . '</option>'; | |
| 1571 | + } ?> | |
| 1039 | 1572 | |
| 1040 | - // Loop through files in the converters folder and assemble some options | |
| 1041 | - while ( $file = readdir( $curdir ) ) { | |
| 1042 | - if ( ( stristr( $file, '.php' ) ) && ( stristr( $file, 'index' ) === false ) ) { | |
| 1043 | - $file = preg_replace( '/.php/', '', $file ); | |
| 1044 | - $platform_options .= '<option value="' . $file . '">' . $file . '</option>'; | |
| 1045 | - } | |
| 1046 | - } | |
| 1573 | + <select name="_bbp_converter_platform" id="_bbp_converter_platform"><?php echo $options; ?></select> | |
| 1574 | + <p class="description"><?php esc_html_e( 'The previous forum software', 'bbpress' ); ?></p> | |
| 1047 | 1575 | |
| 1048 | - closedir( $curdir ); ?> | |
| 1049 | - | |
| 1050 | - <select name="_bbp_converter_platform" id="_bbp_converter_platform" /><?php echo $platform_options ?></select> | |
| 1051 | - <label for="_bbp_converter_platform"><?php _e( 'is the previous forum software', 'bbpress' ); ?></label> | |
| 1052 | - | |
| 1053 | 1576 | <?php |
| 1054 | 1577 | } |
| 1055 | 1578 | |
| 1056 | 1579 | /** |
| @@ -1055,15 +1578,15 @@ | ||
| 1055 | 1578 | |
| 1056 | 1579 | /** |
| 1057 | 1580 | * Edit Database Server setting field |
| 1058 | 1581 | * |
| 1059 | - * @since bbPress (r3813) | |
| 1582 | + * @since 2.1.0 bbPress (r3813) | |
| 1060 | 1583 | */ |
| 1061 | 1584 | function bbp_converter_setting_callback_dbserver() { |
| 1062 | 1585 | ?> |
| 1063 | 1586 | |
| 1064 | - <input name="_bbp_converter_db_server" type="text" id="_bbp_converter_db_server" value="<?php bbp_form_option( '_bbp_converter_db_server', 'localhost' ); ?>" class="medium-text" /> | |
| 1065 | - <label for="_bbp_converter_db_server"><?php _e( 'IP or hostname', 'bbpress' ); ?></label> | |
| 1587 | + <input name="_bbp_converter_db_server" id="_bbp_converter_db_server" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_server', 'localhost' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_server' ); ?> /> | |
| 1588 | + <p class="description"><?php printf( esc_html__( 'Use default %s if same server, or IP or hostname', 'bbpress' ), '<code>localhost</code>' ); ?></p> | |
| 1066 | 1589 | |
| 1067 | 1590 | <?php |
| 1068 | 1591 | } |
| 1069 | 1592 | |
| @@ -1069,15 +1592,15 @@ | ||
| 1069 | 1592 | |
| 1070 | 1593 | /** |
| 1071 | 1594 | * Edit Database Server Port setting field |
| 1072 | 1595 | * |
| 1073 | - * @since bbPress (r3813) | |
| 1596 | + * @since 2.1.0 bbPress (r3813) | |
| 1074 | 1597 | */ |
| 1075 | 1598 | function bbp_converter_setting_callback_dbport() { |
| 1076 | 1599 | ?> |
| 1077 | 1600 | |
| 1078 | - <input name="_bbp_converter_db_port" type="text" id="_bbp_converter_db_port" value="<?php bbp_form_option( '_bbp_converter_db_port', '3306' ); ?>" class="small-text" /> | |
| 1079 | - <label for="_bbp_converter_db_port"><?php _e( 'Use default 3306 if unsure', 'bbpress' ); ?></label> | |
| 1601 | + <input name="_bbp_converter_db_port" id="_bbp_converter_db_port" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_port', '3306' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_port' ); ?> /> | |
| 1602 | + <p class="description"><?php printf( esc_html__( 'Use default %s if unsure', 'bbpress' ), '<code>3306</code>' ); ?></p> | |
| 1080 | 1603 | |
| 1081 | 1604 | <?php |
| 1082 | 1605 | } |
| 1083 | 1606 | |
| @@ -1083,15 +1606,15 @@ | ||
| 1083 | 1606 | |
| 1084 | 1607 | /** |
| 1085 | 1608 | * Edit Database User setting field |
| 1086 | 1609 | * |
| 1087 | - * @since bbPress (r3813) | |
| 1610 | + * @since 2.1.0 bbPress (r3813) | |
| 1088 | 1611 | */ |
| 1089 | 1612 | function bbp_converter_setting_callback_dbuser() { |
| 1090 | 1613 | ?> |
| 1091 | 1614 | |
| 1092 | - <input name="_bbp_converter_db_user" type="text" id="_bbp_converter_db_user" value="<?php bbp_form_option( '_bbp_converter_db_user' ); ?>" class="medium-text" /> | |
| 1093 | - <label for="_bbp_converter_db_user"><?php _e( 'User for your database connection', 'bbpress' ); ?></label> | |
| 1615 | + <input name="_bbp_converter_db_user" id="_bbp_converter_db_user" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_user' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_user' ); ?> /> | |
| 1616 | + <p class="description"><?php esc_html_e( 'User to access the database', 'bbpress' ); ?></p> | |
| 1094 | 1617 | |
| 1095 | 1618 | <?php |
| 1096 | 1619 | } |
| 1097 | 1620 | |
| @@ -1097,15 +1620,21 @@ | ||
| 1097 | 1620 | |
| 1098 | 1621 | /** |
| 1099 | 1622 | * Edit Database Pass setting field |
| 1100 | 1623 | * |
| 1101 | - * @since bbPress (r3813) | |
| 1624 | + * @since 2.1.0 bbPress (r3813) | |
| 1102 | 1625 | */ |
| 1103 | 1626 | function bbp_converter_setting_callback_dbpass() { |
| 1104 | 1627 | ?> |
| 1105 | 1628 | |
| 1106 | - <input name="_bbp_converter_db_pass" type="password" id="_bbp_converter_db_pass" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" class="medium-text" /> | |
| 1107 | - <label for="_bbp_converter_db_pass"><?php _e( 'Password to access the database', 'bbpress' ); ?></label> | |
| 1629 | + <span class="bbp-converter-db-password-wrapper"> | |
| 1630 | + <input name="_bbp_converter_db_pass" id="_bbp_converter_db_pass" class="bbp-converter-db-pass code" type="password" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" autocomplete="off" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_pass' ); ?> /> | |
| 1631 | + <button type="button" class="bbp-db-pass-toggle password"> | |
| 1632 | + <span class="screen-reader-text"><?php esc_html_e( 'Toggle', 'bbpress' ); ?></span> | |
| 1633 | + <span class="toggle-indicator" aria-hidden="true"></span> | |
| 1634 | + </button> | |
| 1635 | + </span> | |
| 1636 | + <p class="description"><?php esc_html_e( 'Password for the above database user', 'bbpress' ); ?></p> | |
| 1108 | 1637 | |
| 1109 | 1638 | <?php |
| 1110 | 1639 | } |
| 1111 | 1640 | |
| @@ -1111,15 +1640,15 @@ | ||
| 1111 | 1640 | |
| 1112 | 1641 | /** |
| 1113 | 1642 | * Edit Database Name setting field |
| 1114 | 1643 | * |
| 1115 | - * @since bbPress (r3813) | |
| 1644 | + * @since 2.1.0 bbPress (r3813) | |
| 1116 | 1645 | */ |
| 1117 | 1646 | function bbp_converter_setting_callback_dbname() { |
| 1118 | 1647 | ?> |
| 1119 | 1648 | |
| 1120 | - <input name="_bbp_converter_db_name" type="text" id="_bbp_converter_db_name" value="<?php bbp_form_option( '_bbp_converter_db_name' ); ?>" class="medium-text" /> | |
| 1121 | - <label for="_bbp_converter_db_name"><?php _e( 'Name of the database with your old forum data', 'bbpress' ); ?></label> | |
| 1649 | + <input name="_bbp_converter_db_name" id="_bbp_converter_db_name" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_name' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_name' ); ?> /> | |
| 1650 | + <p class="description"><?php esc_html_e( 'Name of the database with your old forum data', 'bbpress' ); ?></p> | |
| 1122 | 1651 | |
| 1123 | 1652 | <?php |
| 1124 | 1653 | } |
| 1125 | 1654 | |
| @@ -1125,14 +1654,14 @@ | ||
| 1125 | 1654 | |
| 1126 | 1655 | /** |
| 1127 | 1656 | * Main settings section description for the settings page |
| 1128 | 1657 | * |
| 1129 | - * @since bbPress (r3813) | |
| 1658 | + * @since 2.1.0 bbPress (r3813) | |
| 1130 | 1659 | */ |
| 1131 | 1660 | function bbp_converter_setting_callback_options_section() { |
| 1132 | 1661 | ?> |
| 1133 | 1662 | |
| 1134 | - <p><?php _e( 'Some optional parameters to help tune the conversion process.', 'bbpress' ); ?></p> | |
| 1663 | + <p><?php esc_html_e( 'Some optional parameters to help tune the conversion process.', 'bbpress' ); ?></p> | |
| 1135 | 1664 | |
| 1136 | 1665 | <?php |
| 1137 | 1666 | } |
| 1138 | 1667 | |
| @@ -1138,15 +1667,15 @@ | ||
| 1138 | 1667 | |
| 1139 | 1668 | /** |
| 1140 | 1669 | * Edit Table Prefix setting field |
| 1141 | 1670 | * |
| 1142 | - * @since bbPress (r3813) | |
| 1671 | + * @since 2.1.0 bbPress (r3813) | |
| 1143 | 1672 | */ |
| 1144 | 1673 | function bbp_converter_setting_callback_dbprefix() { |
| 1145 | 1674 | ?> |
| 1146 | 1675 | |
| 1147 | - <input name="_bbp_converter_db_prefix" type="text" id="_bbp_converter_db_prefix" value="<?php bbp_form_option( '_bbp_converter_db_prefix' ); ?>" class="medium-text" /> | |
| 1148 | - <label for="_bbp_converter_db_prefix"><?php _e( '(If converting from BuddyPress Forums, use "wp_bb_" or your custom prefix)', 'bbpress' ); ?></label> | |
| 1676 | + <input name="_bbp_converter_db_prefix" id="_bbp_converter_db_prefix" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_prefix' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_prefix' ); ?> /> | |
| 1677 | + <p class="description"><?php printf( esc_html__( 'Use %s if converting from BuddyPress Legacy', 'bbpress' ), '<code>wp_bb_</code>' ); ?></p> | |
| 1149 | 1678 | |
| 1150 | 1679 | <?php |
| 1151 | 1680 | } |
| 1152 | 1681 | |
| @@ -1152,16 +1681,16 @@ | ||
| 1152 | 1681 | |
| 1153 | 1682 | /** |
| 1154 | 1683 | * Edit Rows Limit setting field |
| 1155 | 1684 | * |
| 1156 | - * @since bbPress (r3813) | |
| 1685 | + * @since 2.1.0 bbPress (r3813) | |
| 1157 | 1686 | */ |
| 1158 | 1687 | function bbp_converter_setting_callback_rows() { |
| 1159 | 1688 | ?> |
| 1160 | 1689 | |
| 1161 | - <input name="_bbp_converter_rows" type="text" id="_bbp_converter_rows" value="<?php bbp_form_option( '_bbp_converter_rows', '100' ); ?>" class="small-text" /> | |
| 1162 | - <label for="_bbp_converter_rows"><?php _e( 'rows to process at a time', 'bbpress' ); ?></label> | |
| 1163 | - <p class="description"><?php _e( 'Keep this low if you experience out-of-memory issues.', 'bbpress' ); ?></p> | |
| 1690 | + <input name="_bbp_converter_rows" id="_bbp_converter_rows" type="number" min="1" max="5000" value="<?php bbp_form_option( '_bbp_converter_rows', '100' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_rows' ); ?> /> | |
| 1691 | + <label for="_bbp_converter_rows"><?php esc_html_e( 'entry maximum when querying for data to convert', 'bbpress' ); ?></label> | |
| 1692 | + <p class="description"><?php esc_html_e( 'Keep this low if you experience out-of-memory issues.', 'bbpress' ); ?></p> | |
| 1164 | 1693 | |
| 1165 | 1694 | <?php |
| 1166 | 1695 | } |
| 1167 | 1696 | |
| @@ -1167,31 +1696,47 @@ | ||
| 1167 | 1696 | |
| 1168 | 1697 | /** |
| 1169 | 1698 | * Edit Delay Time setting field |
| 1170 | 1699 | * |
| 1171 | - * @since bbPress (r3813) | |
| 1700 | + * @since 2.1.0 bbPress (r3813) | |
| 1172 | 1701 | */ |
| 1173 | 1702 | function bbp_converter_setting_callback_delay_time() { |
| 1174 | 1703 | ?> |
| 1175 | 1704 | |
| 1176 | - <input name="_bbp_converter_delay_time" type="text" id="_bbp_converter_delay_time" value="<?php bbp_form_option( '_bbp_converter_delay_time', '1' ); ?>" class="small-text" /> | |
| 1177 | - <label for="_bbp_converter_delay_time"><?php _e( 'second(s) delay between each group of rows', 'bbpress' ); ?></label> | |
| 1178 | - <p class="description"><?php _e( 'Keep this high to prevent too-many-connection issues.', 'bbpress' ); ?></p> | |
| 1705 | + <input name="_bbp_converter_delay_time" id="_bbp_converter_delay_time" type="number" min="2" max="3600" value="<?php bbp_form_option( '_bbp_converter_delay_time', '2' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_delay_time' ); ?> /> | |
| 1706 | + <label for="_bbp_converter_delay_time"><?php esc_html_e( 'second delay between each query of rows above', 'bbpress' ); ?></label> | |
| 1707 | + <p class="description"><?php esc_html_e( 'Keep this high to prevent too-many-connection issues.', 'bbpress' ); ?></p> | |
| 1179 | 1708 | |
| 1180 | 1709 | <?php |
| 1181 | 1710 | } |
| 1182 | 1711 | |
| 1183 | 1712 | /** |
| 1713 | + * Edit Halt setting field | |
| 1714 | + * | |
| 1715 | + * @since 2.6.0 bbPress (r6599) | |
| 1716 | + */ | |
| 1717 | +function bbp_converter_setting_callback_halt() { | |
| 1718 | +?> | |
| 1719 | + | |
| 1720 | + <input name="_bbp_converter_halt" id="_bbp_converter_halt" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_halt', false ) ); ?> /> | |
| 1721 | + <label for="_bbp_converter_halt"><?php esc_html_e( 'Halt the conversion if an error occurs', 'bbpress' ); ?></label> | |
| 1722 | + <p class="description"><?php esc_html_e( 'This is helpful if you want to debug problems.', 'bbpress' ); ?></p> | |
| 1723 | + | |
| 1724 | +<?php | |
| 1725 | +} | |
| 1726 | + | |
| 1727 | + | |
| 1728 | +/** | |
| 1184 | 1729 | * Edit Restart setting field |
| 1185 | 1730 | * |
| 1186 | - * @since bbPress (r3813) | |
| 1731 | + * @since 2.1.0 bbPress (r3813) | |
| 1187 | 1732 | */ |
| 1188 | 1733 | function bbp_converter_setting_callback_restart() { |
| 1189 | 1734 | ?> |
| 1190 | 1735 | |
| 1191 | - <input id="_bbp_converter_restart" name="_bbp_converter_restart" type="checkbox" id="_bbp_converter_restart" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> | |
| 1192 | - <label for="_bbp_converter_restart"><?php _e( 'Start a fresh conversion from the beginning', 'bbpress' ); ?></label> | |
| 1193 | - <p class="description"><?php _e( 'You should clean old conversion information before starting over.', 'bbpress' ); ?></p> | |
| 1736 | + <input name="_bbp_converter_restart" id="_bbp_converter_restart" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> | |
| 1737 | + <label for="_bbp_converter_restart"><?php esc_html_e( 'Restart the converter from the beginning', 'bbpress' ); ?></label> | |
| 1738 | + <p class="description"><?php esc_html_e( 'This forces all steps back to 0. Avoid duplicate data by purging or resetting first.', 'bbpress' ); ?></p> | |
| 1194 | 1739 | |
| 1195 | 1740 | <?php |
| 1196 | 1741 | } |
| 1197 | 1742 | |
| @@ -1197,16 +1742,16 @@ | ||
| 1197 | 1742 | |
| 1198 | 1743 | /** |
| 1199 | 1744 | * Edit Clean setting field |
| 1200 | 1745 | * |
| 1201 | - * @since bbPress (r3813) | |
| 1746 | + * @since 2.1.0 bbPress (r3813) | |
| 1202 | 1747 | */ |
| 1203 | 1748 | function bbp_converter_setting_callback_clean() { |
| 1204 | 1749 | ?> |
| 1205 | 1750 | |
| 1206 | - <input id="_bbp_converter_clean" name="_bbp_converter_clean" type="checkbox" id="_bbp_converter_clean" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> /> | |
| 1207 | - <label for="_bbp_converter_clean"><?php _e( 'Purge all information from a previously attempted import', 'bbpress' ); ?></label> | |
| 1208 | - <p class="description"><?php _e( 'Use this if an import failed and you want to remove that incomplete data.', 'bbpress' ); ?></p> | |
| 1751 | + <input name="_bbp_converter_clean" id="_bbp_converter_clean" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> /> | |
| 1752 | + <label for="_bbp_converter_clean"><?php esc_html_e( 'Purge all meta-data from a previous import', 'bbpress' ); ?></label> | |
| 1753 | + <p class="description"><?php esc_html_e( 'Use this if an import failed, or you just want to remove the relationship data.', 'bbpress' ); ?></p> | |
| 1209 | 1754 | |
| 1210 | 1755 | <?php |
| 1211 | 1756 | } |
| 1212 | 1757 | |
| @@ -1212,16 +1757,16 @@ | ||
| 1212 | 1757 | |
| 1213 | 1758 | /** |
| 1214 | 1759 | * Edit Convert Users setting field |
| 1215 | 1760 | * |
| 1216 | - * @since bbPress (r3813) | |
| 1761 | + * @since 2.1.0 bbPress (r3813) | |
| 1217 | 1762 | */ |
| 1218 | 1763 | function bbp_converter_setting_callback_convert_users() { |
| 1219 | 1764 | ?> |
| 1220 | 1765 | |
| 1221 | - <input id="_bbp_converter_convert_users" name="_bbp_converter_convert_users" type="checkbox" id="_bbp_converter_convert_users" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> /> | |
| 1222 | - <label for="_bbp_converter_convert_users"><?php _e( 'Attempt to import user accounts from previous forums', 'bbpress' ); ?></label> | |
| 1223 | - <p class="description"><?php _e( 'Non-bbPress passwords cannot be automatically converted. They will be converted as each user logs in.', 'bbpress' ); ?></p> | |
| 1766 | + <input name="_bbp_converter_convert_users" id="_bbp_converter_convert_users" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_convert_users' ); ?> /> | |
| 1767 | + <label for="_bbp_converter_convert_users"><?php esc_html_e( 'Import user accounts from previous forums', 'bbpress' ); ?></label> | |
| 1768 | + <p class="description"><?php esc_html_e( 'Passwords remain encrypted, and are converted as individual users log in.', 'bbpress' ); ?></p> | |
| 1224 | 1769 | |
| 1225 | 1770 | <?php |
| 1226 | 1771 | } |
| 1227 | 1772 | |
| @@ -1229,37 +1774,79 @@ | ||
| 1229 | 1774 | |
| 1230 | 1775 | /** |
| 1231 | 1776 | * The main settings page |
| 1232 | 1777 | * |
| 1233 | - * @uses screen_icon() To display the screen icon | |
| 1234 | - * @uses settings_fields() To output the hidden fields for the form | |
| 1235 | - * @uses do_settings_sections() To output the settings sections | |
| 1778 | + * @since 2.1.0 bbPress (r3186) | |
| 1236 | 1779 | */ |
| 1237 | -function bbp_converter_settings() { | |
| 1238 | -?> | |
| 1780 | +function bbp_converter_settings_page() { | |
| 1239 | 1781 | |
| 1240 | - <div class="wrap"> | |
| 1782 | + // Status | |
| 1783 | + $step = (int) get_option( '_bbp_converter_step', 0 ); | |
| 1784 | + $max = (int) bbp_admin()->converter->max_steps; | |
| 1241 | 1785 | |
| 1242 | - <?php screen_icon( 'tools' ); ?> | |
| 1786 | + // Starting or continuing? | |
| 1787 | + $status_text = ! empty( $step ) | |
| 1788 | + ? sprintf( esc_html__( 'Up next: step %s', 'bbpress' ), $step ) | |
| 1789 | + : esc_html__( 'Ready', 'bbpress' ); | |
| 1243 | 1790 | |
| 1244 | - <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( __( 'Import Forums', 'bbpress' ) ); ?></h2> | |
| 1791 | + // Starting or continuing? | |
| 1792 | + $start_text = ! empty( $step ) | |
| 1793 | + ? esc_html__( 'Resume', 'bbpress' ) | |
| 1794 | + : esc_html__( 'Start', 'bbpress' ); | |
| 1245 | 1795 | |
| 1246 | - <form action="#" method="post" id="bbp-converter-settings"> | |
| 1796 | + // Starting or continuing? | |
| 1797 | + $progress_text = ! empty( $step ) | |
| 1798 | + ? sprintf( esc_html__( 'Previously stopped at step %1$d of %2$d', 'bbpress' ), $step, $max ) | |
| 1799 | + : esc_html__( 'Ready to go.', 'bbpress' ); ?> | |
| 1247 | 1800 | |
| 1248 | - <?php settings_fields( 'bbpress_converter' ); ?> | |
| 1801 | + <div class="wrap"> | |
| 1802 | + <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> | |
| 1803 | + <hr class="wp-header-end"> | |
| 1804 | + <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-converter' ); ?></h2> | |
| 1249 | 1805 | |
| 1250 | - <?php do_settings_sections( 'bbpress_converter' ); ?> | |
| 1806 | + <div class="bbp-converter-wrap"> | |
| 1807 | + <div id="poststuff" class="bbp-converter-monitor-wrap"> | |
| 1808 | + <div id="post-body" class="metabox-holder columns-1"> | |
| 1809 | + <div id="postbox-container-1" class="postbox-container"> | |
| 1810 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 1811 | + <div id="bbp-converter-monitor" class="postbox"> | |
| 1812 | + <button type="button" class="handlediv" aria-expanded="true"> | |
| 1813 | + <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Import Status', 'bbpress' ); ?></span> | |
| 1814 | + <span class="toggle-indicator" aria-hidden="true"></span> | |
| 1815 | + </button> | |
| 1816 | + <h2 class="hndle ui-sortable-handle"> | |
| 1817 | + <span><?php esc_html_e( 'Import Monitor', 'bbpress' ); ?></span> | |
| 1818 | + <span id="bbp-converter-status"><?php echo esc_html( $status_text ); ?></span> | |
| 1819 | + <span id="bbp-converter-step-percentage" class="bbp-progress-bar"></span> | |
| 1820 | + <span id="bbp-converter-total-percentage" class="bbp-progress-bar"></span> | |
| 1821 | + </h2> | |
| 1822 | + <div class="inside"> | |
| 1823 | + <div id="bbp-converter-message" class="bbp-converter-log"> | |
| 1824 | + <p><?php echo esc_html( $progress_text ); ?></p> | |
| 1825 | + </div> | |
| 1826 | + </div> | |
| 1827 | + <div class="actions"> | |
| 1828 | + <input type="button" name="submit" class="button-primary" id="bbp-converter-start" value="<?php echo esc_attr( $start_text ); ?>" /> | |
| 1829 | + <input type="button" name="submit" class="button-primary" id="bbp-converter-stop" value="<?php esc_attr_e( 'Pause', 'bbpress' ); ?>" /> | |
| 1830 | + <span class="spinner" id="bbp-converter-spinner"></span> | |
| 1831 | + </div> | |
| 1832 | + </div> | |
| 1833 | + </div> | |
| 1834 | + </div> | |
| 1835 | + </div> | |
| 1836 | + </div> | |
| 1251 | 1837 | |
| 1252 | - <p class="submit"> | |
| 1253 | - <input type="button" name="submit" class="button-primary" id="bbp-converter-start" value="<?php esc_attr_e( 'Start', 'bbpress' ); ?>" onclick="bbconverter_start()" /> | |
| 1254 | - <input type="button" name="submit" class="button-primary" id="bbp-converter-stop" value="<?php esc_attr_e( 'Stop', 'bbpress' ); ?>" onclick="bbconverter_stop()" /> | |
| 1255 | - <img id="bbp-converter-progress" src=""> | |
| 1256 | - </p> | |
| 1838 | + <form action="#" method="post" id="bbp-converter-settings" class="bbp-converter-settings-wrap"><?php | |
| 1257 | 1839 | |
| 1258 | - <div class="bbp-converter-updated" id="bbp-converter-message"></div> | |
| 1259 | - </form> | |
| 1840 | + // Fields | |
| 1841 | + settings_fields( 'converter' ); | |
| 1842 | + | |
| 1843 | + // Sections | |
| 1844 | + do_settings_sections( 'converter' ); | |
| 1845 | + | |
| 1846 | + ?></form> | |
| 1847 | + </div> | |
| 1260 | 1848 | </div> |
| 1261 | - | |
| 1262 | 1849 | <?php |
| 1263 | 1850 | } |
| 1264 | 1851 | |
| 1265 | 1852 | /** Helpers *******************************************************************/ |
| @@ -1266,10 +1853,9 @@ | ||
| 1266 | 1853 | |
| 1267 | 1854 | /** |
| 1268 | 1855 | * Contextual help for Forums settings page |
| 1269 | 1856 | * |
| 1270 | - * @since bbPress (r3119) | |
| 1271 | - * @uses get_current_screen() | |
| 1857 | + * @since 2.0.0 bbPress (r3119) | |
| 1272 | 1858 | */ |
| 1273 | 1859 | function bbp_admin_settings_help() { |
| 1274 | 1860 | |
| 1275 | 1861 | $current_screen = get_current_screen(); |
| @@ -1274,112 +1860,128 @@ | ||
| 1274 | 1860 | |
| 1275 | 1861 | $current_screen = get_current_screen(); |
| 1276 | 1862 | |
| 1277 | 1863 | // Bail if current screen could not be found |
| 1278 | - if ( empty( $current_screen ) ) | |
| 1864 | + if ( empty( $current_screen ) ) { | |
| 1279 | 1865 | return; |
| 1866 | + } | |
| 1280 | 1867 | |
| 1281 | 1868 | // Overview |
| 1282 | 1869 | $current_screen->add_help_tab( array( |
| 1283 | 1870 | 'id' => 'overview', |
| 1284 | - 'title' => __( 'Overview', 'bbpress' ), | |
| 1285 | - 'content' => '<p>' . __( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '</p>' . | |
| 1286 | - '<p>' . __( 'Please see the additional help tabs for more information on each indiviual section.', 'bbpress' ) . '</p>' | |
| 1871 | + 'title' => esc_html__( 'Overview', 'bbpress' ), | |
| 1872 | + 'content' => '<p>' . esc_html__( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '</p>' . | |
| 1873 | + '<p>' . esc_html__( 'Please see the additional help tabs for more information on each individual section.', 'bbpress' ) . '</p>' | |
| 1287 | 1874 | ) ); |
| 1288 | 1875 | |
| 1289 | 1876 | // Main Settings |
| 1290 | 1877 | $current_screen->add_help_tab( array( |
| 1291 | 1878 | 'id' => 'main_settings', |
| 1292 | - 'title' => __( 'Main Settings', 'bbpress' ), | |
| 1293 | - 'content' => '<p>' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' . | |
| 1879 | + 'title' => esc_html__( 'Main Settings', 'bbpress' ), | |
| 1880 | + 'content' => '<p>' . esc_html__( 'The "Main Settings" section includes a number of options:', 'bbpress' ) . '</p>' . | |
| 1294 | 1881 | '<p>' . |
| 1295 | 1882 | '<ul>' . |
| 1296 | - '<li>' . __( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.', 'bbpress' ) . '</li>' . | |
| 1297 | - '<li>' . __( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' . | |
| 1298 | - '<li>' . __( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1299 | - '<li>' . __( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1300 | - '<li>' . __( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1301 | - '<li>' . __( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.', 'bbpress' ) . '</li>' . | |
| 1302 | - '<li>' . __( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.', 'bbpress' ) . '</li>' . | |
| 1303 | - '<li>' . __( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.', 'bbpress' ) . '</li>' . | |
| 1883 | + '<li>' . esc_html__( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.', 'bbpress' ) . '</li>' . | |
| 1884 | + '<li>' . esc_html__( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' . | |
| 1885 | + '<li>' . esc_html__( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1886 | + '<li>' . esc_html__( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1887 | + '<li>' . esc_html__( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.', 'bbpress' ) . '</li>' . | |
| 1888 | + '<li>' . esc_html__( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.', 'bbpress' ) . '</li>' . | |
| 1889 | + '<li>' . esc_html__( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.', 'bbpress' ) . '</li>' . | |
| 1890 | + '<li>' . esc_html__( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.', 'bbpress' ) . '</li>' . | |
| 1304 | 1891 | '</ul>' . |
| 1305 | 1892 | '</p>' . |
| 1306 | - '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>' | |
| 1893 | + '<p>' . esc_html__( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>' | |
| 1307 | 1894 | ) ); |
| 1308 | 1895 | |
| 1896 | + // Theme Package | |
| 1897 | + $current_screen->add_help_tab( array( | |
| 1898 | + 'id' => 'theme_packages', | |
| 1899 | + 'title' => esc_html__( 'Theme Packages', 'bbpress' ), | |
| 1900 | + 'content' => '<p>' . esc_html__( 'The "Theme Packages" section allows you to choose which theme package should be used.', 'bbpress' ) . '</p>' . | |
| 1901 | + '<p>' . | |
| 1902 | + '<ul>' . | |
| 1903 | + '<li>' . esc_html__( 'The "bbPress Default" package is installed by default.', 'bbpress' ) . '</li>' . | |
| 1904 | + '<li>' . esc_html__( 'Some themes may choose to ignore this setting entirely.', 'bbpress' ) . '</li>' . | |
| 1905 | + '<li>' . esc_html__( 'Packages can be stacked to allow for intelligent fallbacks.', 'bbpress' ) . '</li>' . | |
| 1906 | + '</ul>' . | |
| 1907 | + '</p>' | |
| 1908 | + ) ); | |
| 1909 | + | |
| 1309 | 1910 | // Per Page |
| 1310 | 1911 | $current_screen->add_help_tab( array( |
| 1311 | 1912 | 'id' => 'per_page', |
| 1312 | - 'title' => __( 'Per Page', 'bbpress' ), | |
| 1313 | - 'content' => '<p>' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.', 'bbpress' ) . '</p>' . | |
| 1314 | - '<p>' . __( 'This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' ) . '</p>' . | |
| 1315 | - '<p>' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '</p>' | |
| 1913 | + 'title' => esc_html__( 'Per Page', 'bbpress' ), | |
| 1914 | + 'content' => '<p>' . esc_html__( 'The "Per Page" section allows you to control the number of topics and replies appear on each page.', 'bbpress' ) . '</p>' . | |
| 1915 | + '<ul>' . | |
| 1916 | + '<li>' . esc_html__( 'This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' ) . '</li>' . | |
| 1917 | + '<li>' . esc_html__( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '</li>' . | |
| 1918 | + '</ul>' . | |
| 1919 | + '<p>' | |
| 1316 | 1920 | ) ); |
| 1317 | 1921 | |
| 1318 | 1922 | // Slugs |
| 1319 | 1923 | $current_screen->add_help_tab( array( |
| 1320 | - 'id' => 'slus', | |
| 1321 | - 'title' => __( 'Slugs', 'bbpress' ), | |
| 1322 | - 'content' => '<p>' . __( 'The Slugs section allows you to control the permalink structure for your forums.', 'bbpress' ) . '</p>' . | |
| 1323 | - '<p>' . __( '"Archive Slugs" are used as the "root" for your forums and topics. If you combine these values with existing page slugs, bbPress will attempt to output the most correct title and content.', 'bbpress' ) . '</p>' . | |
| 1324 | - '<p>' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '</p>' . | |
| 1325 | - '<p>' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>' | |
| 1924 | + 'id' => 'slugs', | |
| 1925 | + 'title' => esc_html__( 'Slugs', 'bbpress' ), | |
| 1926 | + 'content' => '<p>' . esc_html__( 'The "Slugs" section allows you to control the permalink structure for your forums.', 'bbpress' ) . '</p>' . | |
| 1927 | + '<ul>' . | |
| 1928 | + '<li>' . esc_html__( '"Archive Slugs" are used as the "root" for your forums and topics. If you combine these values with existing page slugs, bbPress will attempt to output the most correct title and content.', 'bbpress' ) . '</li>' . | |
| 1929 | + '<li>' . esc_html__( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '</li>' . | |
| 1930 | + '<li>' . esc_html__( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</li>' . | |
| 1931 | + '</ul>' . | |
| 1932 | + '<p>' | |
| 1326 | 1933 | ) ); |
| 1327 | 1934 | |
| 1328 | 1935 | // Help Sidebar |
| 1329 | 1936 | $current_screen->set_help_sidebar( |
| 1330 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . | |
| 1331 | - '<p>' . __( '<a href="http://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . | |
| 1332 | - '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>' | |
| 1937 | + '<p><strong>' . esc_html__( 'For more information:', 'bbpress' ) . '</strong></p>' . | |
| 1938 | + '<p>' . __( '<a href="https://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . | |
| 1939 | + '<p>' . __( '<a href="https://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>' | |
| 1333 | 1940 | ); |
| 1334 | 1941 | } |
| 1335 | 1942 | |
| 1336 | 1943 | /** |
| 1337 | - * Disable a settings field if the value is forcibly set in bbPress's global | |
| 1338 | - * options array. | |
| 1944 | + * Disable a settings field if it is forcibly set in the global options array. | |
| 1339 | 1945 | * |
| 1340 | - * @since bbPress (r4347) | |
| 1946 | + * @since 2.2.0 bbPress (r4347) | |
| 1341 | 1947 | * |
| 1342 | 1948 | * @param string $option_key |
| 1343 | 1949 | */ |
| 1344 | 1950 | function bbp_maybe_admin_setting_disabled( $option_key = '' ) { |
| 1345 | - disabled( isset( bbpress()->options[$option_key] ) ); | |
| 1951 | + disabled( isset( bbpress()->options[ $option_key ] ) ); | |
| 1346 | 1952 | } |
| 1347 | 1953 | |
| 1348 | 1954 | /** |
| 1349 | 1955 | * Output settings API option |
| 1350 | 1956 | * |
| 1351 | - * @since bbPress (r3203) | |
| 1957 | + * @since 2.0.0 bbPress (r3203) | |
| 1352 | 1958 | * |
| 1353 | - * @uses bbp_get_bbp_form_option() | |
| 1354 | - * | |
| 1355 | 1959 | * @param string $option |
| 1356 | 1960 | * @param string $default |
| 1357 | 1961 | * @param bool $slug |
| 1358 | 1962 | */ |
| 1359 | -function bbp_form_option( $option, $default = '' , $slug = false ) { | |
| 1963 | +function bbp_form_option( $option, $default = '', $slug = false ) { | |
| 1360 | 1964 | echo bbp_get_form_option( $option, $default, $slug ); |
| 1361 | 1965 | } |
| 1362 | 1966 | /** |
| 1363 | 1967 | * Return settings API option |
| 1364 | 1968 | * |
| 1365 | - * @since bbPress (r3203) | |
| 1969 | + * @since 2.0.0 bbPress (r3203) | |
| 1366 | 1970 | * |
| 1367 | - * @uses get_option() | |
| 1368 | - * @uses esc_attr() | |
| 1369 | - * @uses apply_filters() | |
| 1370 | - * | |
| 1371 | 1971 | * @param string $option |
| 1372 | 1972 | * @param string $default |
| 1373 | - * @param bool $slug | |
| 1973 | + * @param bool $is_slug | |
| 1974 | + * | |
| 1975 | + * @return mixed | |
| 1374 | 1976 | */ |
| 1375 | - function bbp_get_form_option( $option, $default = '', $slug = false ) { | |
| 1977 | + function bbp_get_form_option( $option, $default = '', $is_slug = false ) { | |
| 1376 | 1978 | |
| 1377 | 1979 | // Get the option and sanitize it |
| 1378 | 1980 | $value = get_option( $option, $default ); |
| 1379 | 1981 | |
| 1380 | 1982 | // Slug? |
| 1381 | - if ( true === $slug ) { | |
| 1983 | + if ( true === $is_slug ) { | |
| 1382 | 1984 | $value = esc_attr( apply_filters( 'editable_slug', $value ) ); |
| 1383 | 1985 | |
| 1384 | 1986 | // Not a slug |
| 1385 | 1987 | } else { |
| @@ -1386,24 +1988,23 @@ | ||
| 1386 | 1988 | $value = esc_attr( $value ); |
| 1387 | 1989 | } |
| 1388 | 1990 | |
| 1389 | 1991 | // Fallback to default |
| 1390 | - if ( empty( $value ) ) | |
| 1992 | + if ( empty( $value ) ) { | |
| 1391 | 1993 | $value = $default; |
| 1994 | + } | |
| 1392 | 1995 | |
| 1393 | - // Allow plugins to further filter the output | |
| 1394 | - return apply_filters( 'bbp_get_form_option', $value, $option ); | |
| 1996 | + // Filter & return | |
| 1997 | + return apply_filters( 'bbp_get_form_option', $value, $option, $default, $is_slug ); | |
| 1395 | 1998 | } |
| 1396 | 1999 | |
| 1397 | 2000 | /** |
| 1398 | 2001 | * Used to check if a bbPress slug conflicts with an existing known slug. |
| 1399 | 2002 | * |
| 1400 | - * @since bbPress (r3306) | |
| 2003 | + * @since 2.0.0 bbPress (r3306) | |
| 1401 | 2004 | * |
| 1402 | 2005 | * @param string $slug |
| 1403 | 2006 | * @param string $default |
| 1404 | - * | |
| 1405 | - * @uses bbp_get_form_option() To get a sanitized slug string | |
| 1406 | 2007 | */ |
| 1407 | 2008 | function bbp_form_slug_conflict_check( $slug, $default ) { |
| 1408 | 2009 | |
| 1409 | 2010 | // Only set the slugs once ver page load |
| @@ -1419,45 +2020,48 @@ | ||
| 1419 | 2020 | |
| 1420 | 2021 | /** WordPress Core ****************************************************/ |
| 1421 | 2022 | |
| 1422 | 2023 | // Core Post Types |
| 1423 | - 'post_base' => array( 'name' => __( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ), | |
| 1424 | - 'page_base' => array( 'name' => __( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ), | |
| 1425 | - 'revision_base' => array( 'name' => __( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ), | |
| 1426 | - 'attachment_base' => array( 'name' => __( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ), | |
| 1427 | - 'nav_menu_base' => array( 'name' => __( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ), | |
| 2024 | + 'post_base' => array( 'name' => esc_html__( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ), | |
| 2025 | + 'page_base' => array( 'name' => esc_html__( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ), | |
| 2026 | + 'revision_base' => array( 'name' => esc_html__( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ), | |
| 2027 | + 'attachment_base' => array( 'name' => esc_html__( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ), | |
| 2028 | + 'nav_menu_base' => array( 'name' => esc_html__( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ), | |
| 1428 | 2029 | |
| 1429 | 2030 | // Post Tags |
| 1430 | - 'tag_base' => array( 'name' => __( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ), | |
| 2031 | + 'tag_base' => array( 'name' => esc_html__( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ), | |
| 1431 | 2032 | |
| 1432 | 2033 | // Post Categories |
| 1433 | - 'category_base' => array( 'name' => __( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ), | |
| 2034 | + 'category_base' => array( 'name' => esc_html__( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ), | |
| 1434 | 2035 | |
| 1435 | 2036 | /** bbPress Core ******************************************************/ |
| 1436 | 2037 | |
| 1437 | 2038 | // Forum archive slug |
| 1438 | - '_bbp_root_slug' => array( 'name' => __( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ), | |
| 2039 | + '_bbp_root_slug' => array( 'name' => esc_html__( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ), | |
| 1439 | 2040 | |
| 1440 | 2041 | // Topic archive slug |
| 1441 | - '_bbp_topic_archive_slug' => array( 'name' => __( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ), | |
| 2042 | + '_bbp_topic_archive_slug' => array( 'name' => esc_html__( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ), | |
| 1442 | 2043 | |
| 1443 | 2044 | // Forum slug |
| 1444 | - '_bbp_forum_slug' => array( 'name' => __( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ), | |
| 2045 | + '_bbp_forum_slug' => array( 'name' => esc_html__( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ), | |
| 1445 | 2046 | |
| 1446 | 2047 | // Topic slug |
| 1447 | - '_bbp_topic_slug' => array( 'name' => __( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ), | |
| 2048 | + '_bbp_topic_slug' => array( 'name' => esc_html__( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ), | |
| 1448 | 2049 | |
| 1449 | 2050 | // Reply slug |
| 1450 | - '_bbp_reply_slug' => array( 'name' => __( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ), | |
| 2051 | + '_bbp_reply_slug' => array( 'name' => esc_html__( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ), | |
| 1451 | 2052 | |
| 2053 | + // Edit slug | |
| 2054 | + '_bbp_edit_slug' => array( 'name' => esc_html__( 'Edit slug', 'bbpress' ), 'default' => 'edit', 'context' => 'bbPress' ), | |
| 2055 | + | |
| 1452 | 2056 | // User profile slug |
| 1453 | - '_bbp_user_slug' => array( 'name' => __( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ), | |
| 2057 | + '_bbp_user_slug' => array( 'name' => esc_html__( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ), | |
| 1454 | 2058 | |
| 1455 | 2059 | // View slug |
| 1456 | - '_bbp_view_slug' => array( 'name' => __( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ), | |
| 2060 | + '_bbp_view_slug' => array( 'name' => esc_html__( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ), | |
| 1457 | 2061 | |
| 1458 | 2062 | // Topic tag slug |
| 1459 | - '_bbp_topic_tag_slug' => array( 'name' => __( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ), | |
| 2063 | + '_bbp_topic_tag_slug' => array( 'name' => esc_html__( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ), | |
| 1460 | 2064 | ) ); |
| 1461 | 2065 | |
| 1462 | 2066 | /** BuddyPress Core *******************************************************/ |
| 1463 | 2067 | |
| @@ -1464,13 +2068,17 @@ | ||
| 1464 | 2068 | if ( defined( 'BP_VERSION' ) ) { |
| 1465 | 2069 | $bp = buddypress(); |
| 1466 | 2070 | |
| 1467 | 2071 | // Loop through root slugs and check for conflict |
| 1468 | - if ( !empty( $bp->pages ) ) { | |
| 2072 | + if ( ! empty( $bp->pages ) ) { | |
| 1469 | 2073 | foreach ( $bp->pages as $page => $page_data ) { |
| 1470 | 2074 | $page_base = $page . '_base'; |
| 1471 | - $page_title = sprintf( __( '%s page', 'bbpress' ), $page_data->title ); | |
| 1472 | - $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context' => 'BuddyPress' ); | |
| 2075 | + $page_title = sprintf( esc_html__( '%s page', 'bbpress' ), $page_data->title ); | |
| 2076 | + $core_slugs[ $page_base ] = array( | |
| 2077 | + 'name' => $page_title, | |
| 2078 | + 'default' => $page_data->slug, | |
| 2079 | + 'context' => 'BuddyPress' | |
| 2080 | + ); | |
| 1473 | 2081 | } |
| 1474 | 2082 | } |
| 1475 | 2083 | } |
| 1476 | 2084 | |
| @@ -1478,17 +2086,17 @@ | ||
| 1478 | 2086 | $the_core_slugs = apply_filters( 'bbp_slug_conflict', $core_slugs ); |
| 1479 | 2087 | } |
| 1480 | 2088 | |
| 1481 | 2089 | // Loop through slugs to check |
| 1482 | - foreach( $the_core_slugs as $key => $value ) { | |
| 2090 | + foreach ( $the_core_slugs as $key => $value ) { | |
| 1483 | 2091 | |
| 1484 | 2092 | // Get the slug |
| 1485 | 2093 | $slug_check = bbp_get_form_option( $key, $value['default'], true ); |
| 1486 | 2094 | |
| 1487 | 2095 | // Compare |
| 1488 | - if ( ( $slug != $key ) && ( $slug_check == $this_slug ) ) : ?> | |
| 2096 | + if ( ( $slug !== $key ) && ( $slug_check === $this_slug ) ) : ?> | |
| 1489 | 2097 | |
| 1490 | - <span class="attention"><?php printf( __( 'Possible %1$s conflict: <strong>%2$s</strong>', 'bbpress' ), $value['context'], $value['name'] ); ?></span> | |
| 2098 | + <span class="attention"><?php printf( esc_html__( 'Possible %1$s conflict: %2$s', 'bbpress' ), $value['context'], '<strong>' . $value['name'] . '</strong>' ); ?></span> | |
| 1491 | 2099 | |
| 1492 | 2100 | <?php endif; |
| 1493 | 2101 | } |
| 1494 | 2102 | } |