Changeset 3945
- Timestamp:
- 06/12/2012 04:22:28 AM (13 years ago)
- Location:
- branches/plugin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-admin.php
r3916 r3945 280 280 /** Main Section ******************************************************/ 281 281 282 // Add the main section 283 add_settings_section( 'bbp_main', __( 'Main Settings', 'bbpress' ), 'bbp_admin_setting_callback_main_section', 'bbpress' ); 284 285 // Edit lock setting 286 add_settings_field( '_bbp_edit_lock', __( 'Lock post editing after', 'bbpress' ), 'bbp_admin_setting_callback_editlock', 'bbpress', 'bbp_main' ); 287 register_setting ( 'bbpress', '_bbp_edit_lock', 'intval' ); 288 289 // Throttle setting 290 add_settings_field( '_bbp_throttle_time', __( 'Throttle time', 'bbpress' ), 'bbp_admin_setting_callback_throttle', 'bbpress', 'bbp_main' ); 291 register_setting ( 'bbpress', '_bbp_throttle_time', 'intval' ); 292 293 // Allow topic and reply revisions 294 add_settings_field( '_bbp_allow_revisions', __( 'Allow Revisions', 'bbpress' ), 'bbp_admin_setting_callback_revisions', 'bbpress', 'bbp_main' ); 295 register_setting ( 'bbpress', '_bbp_allow_revisions', 'intval' ); 296 297 // Allow favorites setting 298 add_settings_field( '_bbp_enable_favorites', __( 'Allow Favorites', 'bbpress' ), 'bbp_admin_setting_callback_favorites', 'bbpress', 'bbp_main' ); 299 register_setting ( 'bbpress', '_bbp_enable_favorites', 'intval' ); 300 301 // Allow subscriptions setting 302 add_settings_field( '_bbp_enable_subscriptions', __( 'Allow Subscriptions', 'bbpress' ), 'bbp_admin_setting_callback_subscriptions', 'bbpress', 'bbp_main' ); 303 register_setting ( 'bbpress', '_bbp_enable_subscriptions', 'intval' ); 304 305 // Allow anonymous posting setting 306 add_settings_field( '_bbp_allow_anonymous', __( 'Allow Anonymous Posting', 'bbpress' ), 'bbp_admin_setting_callback_anonymous', 'bbpress', 'bbp_main' ); 307 register_setting ( 'bbpress', '_bbp_allow_anonymous', 'intval' ); 308 309 // Allow global access setting 310 if ( is_multisite() ) { 311 add_settings_field( '_bbp_allow_global_access', __( 'Allow Global Access', 'bbpress' ), 'bbp_admin_setting_callback_global_access', 'bbpress', 'bbp_main' ); 312 register_setting ( 'bbpress', '_bbp_allow_global_access', 'intval' ); 313 } 314 315 // Allow fancy editor setting 316 add_settings_field( '_bbp_use_wp_editor', __( 'Fancy Editor', 'bbpress' ), 'bbp_admin_setting_callback_use_wp_editor', 'bbpress', 'bbp_main' ); 317 register_setting ( 'bbpress', '_bbp_use_wp_editor', 'intval' ); 318 319 // Allow auto embedding setting 320 add_settings_field( '_bbp_use_autoembed', __( 'Auto-embed Links', 'bbpress' ), 'bbp_admin_setting_callback_use_autoembed', 'bbpress', 'bbp_main' ); 321 register_setting ( 'bbpress', '_bbp_use_autoembed', 'intval' ); 282 $section = 'bbp_settings_main'; 283 if ( bbp_admin_show_ui( $section ) ) { 284 285 // Add the main section 286 add_settings_section( $section, __( 'Main Settings', 'bbpress' ), 'bbp_admin_setting_callback_main_section', 'bbpress' ); 287 288 // Edit lock setting 289 add_settings_field( '_bbp_edit_lock', __( 'Lock post editing after', 'bbpress' ), 'bbp_admin_setting_callback_editlock', 'bbpress', $section ); 290 register_setting ( 'bbpress', '_bbp_edit_lock', 'intval' ); 291 292 // Throttle setting 293 add_settings_field( '_bbp_throttle_time', __( 'Throttle time', 'bbpress' ), 'bbp_admin_setting_callback_throttle', 'bbpress', $section ); 294 register_setting ( 'bbpress', '_bbp_throttle_time', 'intval' ); 295 296 // Allow topic and reply revisions 297 add_settings_field( '_bbp_allow_revisions', __( 'Allow Revisions', 'bbpress' ), 'bbp_admin_setting_callback_revisions', 'bbpress', $section ); 298 register_setting ( 'bbpress', '_bbp_allow_revisions', 'intval' ); 299 300 // Allow favorites setting 301 add_settings_field( '_bbp_enable_favorites', __( 'Allow Favorites', 'bbpress' ), 'bbp_admin_setting_callback_favorites', 'bbpress', $section ); 302 register_setting ( 'bbpress', '_bbp_enable_favorites', 'intval' ); 303 304 // Allow subscriptions setting 305 add_settings_field( '_bbp_enable_subscriptions', __( 'Allow Subscriptions', 'bbpress' ), 'bbp_admin_setting_callback_subscriptions', 'bbpress', $section ); 306 register_setting ( 'bbpress', '_bbp_enable_subscriptions', 'intval' ); 307 308 // Allow anonymous posting setting 309 add_settings_field( '_bbp_allow_anonymous', __( 'Allow Anonymous Posting', 'bbpress' ), 'bbp_admin_setting_callback_anonymous', 'bbpress', $section ); 310 register_setting ( 'bbpress', '_bbp_allow_anonymous', 'intval' ); 311 312 // Allow global access setting 313 if ( is_multisite() ) { 314 add_settings_field( '_bbp_allow_global_access', __( 'Allow Global Access', 'bbpress' ), 'bbp_admin_setting_callback_global_access', 'bbpress', $section ); 315 register_setting ( 'bbpress', '_bbp_allow_global_access', 'intval' ); 316 } 317 318 // Allow fancy editor setting 319 add_settings_field( '_bbp_use_wp_editor', __( 'Fancy Editor', 'bbpress' ), 'bbp_admin_setting_callback_use_wp_editor', 'bbpress', $section ); 320 register_setting ( 'bbpress', '_bbp_use_wp_editor', 'intval' ); 321 322 // Allow auto embedding setting 323 add_settings_field( '_bbp_use_autoembed', __( 'Auto-embed Links', 'bbpress' ), 'bbp_admin_setting_callback_use_autoembed', 'bbpress', $section ); 324 register_setting ( 'bbpress', '_bbp_use_autoembed', 'intval' ); 325 } 322 326 323 327 /** Theme Packages ****************************************************/ 324 328 325 // Add the per page section 326 add_settings_section( 'bbp_theme_compat', __( 'Theme Packages', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_section', 'bbpress' ); 327 328 // Replies per page setting 329 add_settings_field( '_bbp_theme_package_id', __( 'Current Package', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_id', 'bbpress', 'bbp_theme_compat' ); 330 register_setting ( 'bbpress', '_bbp_theme_package_id', '' ); 329 $section = 'bbp_settings_theme_compat'; 330 if ( bbp_admin_show_ui( $section ) ) { 331 332 // Add the per page section 333 add_settings_section( $section, __( 'Theme Packages', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_section', 'bbpress' ); 334 335 // Replies per page setting 336 add_settings_field( '_bbp_theme_package_id', __( 'Current Package', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_id', 'bbpress', $section ); 337 register_setting ( 'bbpress', '_bbp_theme_package_id', '' ); 338 } 331 339 332 340 /** Per Page Section **************************************************/ 333 341 334 // Add the per page section 335 add_settings_section( 'bbp_per_page', __( 'Per Page', 'bbpress' ), 'bbp_admin_setting_callback_per_page_section', 'bbpress' ); 336 337 // Topics per page setting 338 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_page', 'bbpress', 'bbp_per_page' ); 339 register_setting ( 'bbpress', '_bbp_topics_per_page', 'intval' ); 340 341 // Replies per page setting 342 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_page', 'bbpress', 'bbp_per_page' ); 343 register_setting ( 'bbpress', '_bbp_replies_per_page', 'intval' ); 342 $section = 'bbp_settings_per_page'; 343 if ( bbp_admin_show_ui( $section ) ) { 344 345 // Add the per page section 346 add_settings_section( $section, __( 'Per Page', 'bbpress' ), 'bbp_admin_setting_callback_per_page_section', 'bbpress' ); 347 348 // Topics per page setting 349 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_page', 'bbpress', $section ); 350 register_setting ( 'bbpress', '_bbp_topics_per_page', 'intval' ); 351 352 // Replies per page setting 353 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_page', 'bbpress', $section ); 354 register_setting ( 'bbpress', '_bbp_replies_per_page', 'intval' ); 355 } 344 356 345 357 /** Per RSS Page Section **********************************************/ 346 358 347 // Add the per page section 348 add_settings_section( 'bbp_per_rss_page', __( 'Per RSS Page', 'bbpress' ), 'bbp_admin_setting_callback_per_rss_page_section', 'bbpress' ); 349 350 // Topics per page setting 351 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_rss_page', 'bbpress', 'bbp_per_rss_page' ); 352 register_setting ( 'bbpress', '_bbp_topics_per_rss_page', 'intval' ); 353 354 // Replies per page setting 355 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_rss_page', 'bbpress', 'bbp_per_rss_page' ); 356 register_setting ( 'bbpress', '_bbp_replies_per_rss_page', 'intval' ); 359 $section = 'bbp_settings_per_page_rss'; 360 if ( bbp_admin_show_ui( $section ) ) { 361 362 // Add the per page section 363 add_settings_section( $section, __( 'Per RSS Page', 'bbpress' ), 'bbp_admin_setting_callback_per_rss_page_section', 'bbpress' ); 364 365 // Topics per page setting 366 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_rss_page', 'bbpress', $section ); 367 register_setting ( 'bbpress', '_bbp_topics_per_rss_page', 'intval' ); 368 369 // Replies per page setting 370 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_rss_page', 'bbpress', $section ); 371 register_setting ( 'bbpress', '_bbp_replies_per_rss_page', 'intval' ); 372 } 357 373 358 374 /** Front Slugs *******************************************************/ 359 375 360 // Add the per page section 361 add_settings_section( 'bbp_root_slug', __( 'Archive Slugs', 'bbpress' ), 'bbp_admin_setting_callback_root_slug_section', 'bbpress' ); 362 363 // Root slug setting 364 add_settings_field ( '_bbp_root_slug', __( 'Forums base', 'bbpress' ), 'bbp_admin_setting_callback_root_slug', 'bbpress', 'bbp_root_slug' ); 365 register_setting ( 'bbpress', '_bbp_root_slug', 'esc_sql' ); 366 367 // Topic archive setting 368 add_settings_field ( '_bbp_topic_archive_slug', __( 'Topics base', 'bbpress' ), 'bbp_admin_setting_callback_topic_archive_slug', 'bbpress', 'bbp_root_slug' ); 369 register_setting ( 'bbpress', '_bbp_topic_archive_slug', 'esc_sql' ); 376 $section = 'bbp_settings_root_slugs'; 377 if ( bbp_admin_show_ui( $section ) ) { 378 379 // Add the per page section 380 add_settings_section( $section, __( 'Archive Slugs', 'bbpress' ), 'bbp_admin_setting_callback_root_slug_section', 'bbpress' ); 381 382 /** 383 * Here we sanitize with 'esc_sql', rather than 'sanitize_title' to 384 * allow for slashes or any other URI friendly format. 385 */ 386 387 // Root slug setting 388 add_settings_field ( '_bbp_root_slug', __( 'Forums base', 'bbpress' ), 'bbp_admin_setting_callback_root_slug', 'bbpress', $section ); 389 register_setting ( 'bbpress', '_bbp_root_slug', 'esc_sql' ); 390 391 // Topic archive setting 392 add_settings_field ( '_bbp_topic_archive_slug', __( 'Topics base', 'bbpress' ), 'bbp_admin_setting_callback_topic_archive_slug', 'bbpress', $section ); 393 register_setting ( 'bbpress', '_bbp_topic_archive_slug', 'esc_sql' ); 394 } 370 395 371 396 /** Single slugs ******************************************************/ 372 397 373 // Add the per page section 374 add_settings_section( 'bbp_single_slugs', __( 'Single Slugs', 'bbpress' ), 'bbp_admin_setting_callback_single_slug_section', 'bbpress' ); 375 376 // Include root setting 377 add_settings_field( '_bbp_include_root', __( 'Forum Prefix', 'bbpress' ), 'bbp_admin_setting_callback_include_root', 'bbpress', 'bbp_single_slugs' ); 378 register_setting ( 'bbpress', '_bbp_include_root', 'intval' ); 379 380 // Forum slug setting 381 add_settings_field( '_bbp_forum_slug', __( 'Forum slug', 'bbpress' ), 'bbp_admin_setting_callback_forum_slug', 'bbpress', 'bbp_single_slugs' ); 382 register_setting ( 'bbpress', '_bbp_forum_slug', 'sanitize_title' ); 383 384 // Topic slug setting 385 add_settings_field( '_bbp_topic_slug', __( 'Topic slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_slug', 'bbpress', 'bbp_single_slugs' ); 386 register_setting ( 'bbpress', '_bbp_topic_slug', 'sanitize_title' ); 387 388 // Topic tag slug setting 389 add_settings_field( '_bbp_topic_tag_slug', __( 'Topic tag slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_tag_slug', 'bbpress', 'bbp_single_slugs' ); 390 register_setting ( 'bbpress', '_bbp_topic_tag_slug', 'sanitize_title' ); 391 392 // Reply slug setting 393 add_settings_field( '_bbp_reply_slug', __( 'Reply slug', 'bbpress' ), 'bbp_admin_setting_callback_reply_slug', 'bbpress', 'bbp_single_slugs' ); 394 register_setting ( 'bbpress', '_bbp_reply_slug', 'sanitize_title' ); 395 396 /** Other slugs *******************************************************/ 397 398 // User slug setting 399 add_settings_field( '_bbp_user_slug', __( 'User base', 'bbpress' ), 'bbp_admin_setting_callback_user_slug', 'bbpress', 'bbp_single_slugs' ); 400 register_setting ( 'bbpress', '_bbp_user_slug', 'sanitize_title' ); 401 402 // View slug setting 403 add_settings_field( '_bbp_view_slug', __( 'View base', 'bbpress' ), 'bbp_admin_setting_callback_view_slug', 'bbpress', 'bbp_single_slugs' ); 404 register_setting ( 'bbpress', '_bbp_view_slug', 'sanitize_title' ); 398 $section = 'bbp_settings_single_slugs'; 399 if ( bbp_admin_show_ui( $section ) ) { 400 401 // Add the per page section 402 add_settings_section( $section, __( 'Single Slugs', 'bbpress' ), 'bbp_admin_setting_callback_single_slug_section', 'bbpress' ); 403 404 // Include root setting 405 add_settings_field( '_bbp_include_root', __( 'Forum Prefix', 'bbpress' ), 'bbp_admin_setting_callback_include_root', 'bbpress', $section ); 406 register_setting ( 'bbpress', '_bbp_include_root', 'intval' ); 407 408 // Forum slug setting 409 add_settings_field( '_bbp_forum_slug', __( 'Forum slug', 'bbpress' ), 'bbp_admin_setting_callback_forum_slug', 'bbpress', $section ); 410 register_setting ( 'bbpress', '_bbp_forum_slug', 'sanitize_title' ); 411 412 // Topic slug setting 413 add_settings_field( '_bbp_topic_slug', __( 'Topic slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_slug', 'bbpress', $section ); 414 register_setting ( 'bbpress', '_bbp_topic_slug', 'sanitize_title' ); 415 416 // Topic tag slug setting 417 add_settings_field( '_bbp_topic_tag_slug', __( 'Topic tag slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_tag_slug', 'bbpress', $section ); 418 register_setting ( 'bbpress', '_bbp_topic_tag_slug', 'sanitize_title' ); 419 420 // Reply slug setting 421 add_settings_field( '_bbp_reply_slug', __( 'Reply slug', 'bbpress' ), 'bbp_admin_setting_callback_reply_slug', 'bbpress', $section ); 422 register_setting ( 'bbpress', '_bbp_reply_slug', 'sanitize_title' ); 423 424 /** Other slugs ***************************************************/ 425 426 // User slug setting 427 add_settings_field( '_bbp_user_slug', __( 'User base', 'bbpress' ), 'bbp_admin_setting_callback_user_slug', 'bbpress', $section ); 428 register_setting ( 'bbpress', '_bbp_user_slug', 'sanitize_title' ); 429 430 // View slug setting 431 add_settings_field( '_bbp_view_slug', __( 'View base', 'bbpress' ), 'bbp_admin_setting_callback_view_slug', 'bbpress', $section ); 432 register_setting ( 'bbpress', '_bbp_view_slug', 'sanitize_title' ); 433 } 405 434 406 435 /** BuddyPress ********************************************************/ 407 436 408 if ( is_plugin_active( 'buddypress/bp-loader.php' ) && defined( 'BP_VERSION' ) ) { 437 $section = 'bbp_settings_buddypress'; 438 if ( bbp_admin_show_ui( $section ) ) { 409 439 410 440 // Add the per page section … … 422 452 /** Akismet ***********************************************************/ 423 453 424 if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) { 454 $section = 'bbp_settings_akismet'; 455 if ( bbp_admin_show_ui( $section ) ) { 425 456 426 457 // Add the per page section -
branches/plugin/bbp-includes/bbp-core-caps.php
r3944 r3945 653 653 } 654 654 655 /** 656 * Should the admin UI be visible? 657 * 658 * Used when registering post types and taxonomies to decide if 'show_ui' should 659 * be set to true or false 660 * 661 * @since bbPress (r3944) 662 * @uses current_user_can() To check the 'moderate' capability 663 * @return bool Results of current_user_can( 'moderate' ) check. 664 */ 665 function bbp_admin_show_ui( $component = '' ) { 666 667 // Define local variable 668 $retval = false; 669 670 // Allow for context switching by plugins 671 switch ( $component ) { 672 case 'bbp_converter' : // Converter 673 case 'bbp_settings_main' : // Settings 674 case 'bbp_settings_theme_compat' : // Settings - Theme compat 675 case 'bbp_settings_root_slugs' : // Settings - Root slugs 676 case 'bbp_settings_single_slugs' : // Settings - Single slugs 677 case 'bbp_settings_per_page' : // Settings - Single slugs 678 case 'bbp_settings_per_page_rss' : // Settings - Single slugs 679 $retval = is_super_admin(); 680 break; 681 682 case 'bbp_settings_buddypress' : // BuddyPress Extension 683 $retval = ( is_plugin_active( 'buddypress/bp-loader.php' ) && defined( 'BP_VERSION' ) ) && is_super_admin(); 684 break; 685 686 case 'bbp_settings_akismet' : // Akismet Extension 687 $retval = ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) && is_super_admin(); 688 break; 689 690 case bbp_get_forum_post_type() : // Forums 691 case bbp_get_topic_post_type() : // Topics 692 case bbp_get_reply_post_type() : // Replies 693 case bbp_get_topic_tag_tax_id() : // Topic-Tags 694 default : 695 $retval = current_user_can( 'moderate' ); 696 break; 697 } 698 699 return (bool) apply_filters( 'bbp_admin_show_ui', $retval, $component ); 700 } 701 655 702 ?> -
branches/plugin/bbpress.php
r3928 r3945 679 679 'show_in_nav_menus' => true, 680 680 'public' => true, 681 'show_ui' => true,681 'show_ui' => bbp_admin_show_ui( bbp_get_forum_post_type() ), 682 682 'can_export' => true, 683 683 'hierarchical' => true, … … 736 736 'show_in_nav_menus' => false, 737 737 'public' => true, 738 'show_ui' => true,738 'show_ui' => bbp_admin_show_ui( bbp_get_topic_post_type() ), 739 739 'can_export' => true, 740 740 'hierarchical' => false, … … 793 793 'show_in_nav_menus' => false, 794 794 'public' => true, 795 'show_ui' => true,795 'show_ui' => bbp_admin_show_ui( bbp_get_reply_post_type() ), 796 796 'can_export' => true, 797 797 'hierarchical' => false, … … 925 925 'hierarchical' => false, 926 926 'public' => true, 927 'show_ui' => true927 'show_ui' => bbp_admin_show_ui( bbp_get_topic_tag_tax_id() ) 928 928 ) 929 929 ) );
Note: See TracChangeset
for help on using the changeset viewer.