Skip to:
Content

bbPress.org

Changeset 6419


Ignore:
Timestamp:
05/19/2017 04:52:16 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Settings: General improvements:

  • Use escaped equivalent for gettext output
  • Update settings-integration away from bool to allow future flexibility
  • Stash settings fields in a static variable to speed up registration
Location:
trunk/src/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/admin.php

    r6395 r6419  
    181181        add_filter( 'bbp_map_meta_caps',   array( $this, 'map_settings_meta_caps' ), 10, 4 );
    182182
    183         // Hide the theme compat package selection
    184         add_filter( 'bbp_admin_get_settings_sections', array( $this, 'hide_theme_compat_packages' ) );
    185 
    186183        // Allow keymasters to save forums settings
    187184        add_filter( 'option_page_capability_bbpress',  array( $this, 'option_page_capability_bbpress' ) );
     
    247244
    248245        // Are settings enabled?
    249         if ( ! bbp_settings_integration() ) {
     246        if ( 'basic' === bbp_settings_integration() ) {
    250247            add_options_page(
    251248                __( 'Forums',  'bbpress' ),
     
    369366
    370367            // Toggle the section if core integration is on
    371             if ( ( true === $settings_integration ) && ! empty( $section['page'] ) ) {
     368            if ( ( 'deep' === $settings_integration ) && ! empty( $section['page'] ) ) {
    372369                $page = $section['page'];
    373370            } else {
     
    668665            array( 'base' => '#f1f3f2', 'focus' => '#fff', 'current' => '#fff' )
    669666        );
    670     }
    671 
    672     /**
    673      * Hide theme compat package selection if only 1 package is registered
    674      *
    675      * @since 2.2.0 bbPress (r4315)
    676      *
    677      * @param array $sections Forums settings sections
    678      * @return array
    679      */
    680     public function hide_theme_compat_packages( $sections = array() ) {
    681         if ( count( bbpress()->theme_compat->packages ) <= 1 ) {
    682             unset( $sections['bbp_settings_theme_compat'] );
    683         }
    684 
    685         return $sections;
    686667    }
    687668
  • trunk/src/includes/admin/settings.php

    r6321 r6419  
    2323    return (array) apply_filters( 'bbp_admin_get_settings_sections', array(
    2424        'bbp_settings_users' => array(
    25             'title'    => __( 'Forum User Settings', 'bbpress' ),
     25            'title'    => esc_html__( 'Forum User Settings', 'bbpress' ),
    2626            'callback' => 'bbp_admin_setting_callback_user_section',
    2727            'page'     => 'discussion'
    2828        ),
    2929        'bbp_settings_features' => array(
    30             'title'    => __( 'Forum Features', 'bbpress' ),
     30            'title'    => esc_html__( 'Forum Features', 'bbpress' ),
    3131            'callback' => 'bbp_admin_setting_callback_features_section',
    3232            'page'     => 'discussion'
    3333        ),
    3434        'bbp_settings_theme_compat' => array(
    35             'title'    => __( 'Forum Theme Packages', 'bbpress' ),
     35            'title'    => esc_html__( 'Forum Theme Packages', 'bbpress' ),
    3636            'callback' => 'bbp_admin_setting_callback_subtheme_section',
    3737            'page'     => 'general'
    3838        ),
    3939        'bbp_settings_per_page' => array(
    40             'title'    => __( 'Topics and Replies Per Page', 'bbpress' ),
     40            'title'    => esc_html__( 'Topics and Replies Per Page', 'bbpress' ),
    4141            'callback' => 'bbp_admin_setting_callback_per_page_section',
    4242            'page'     => 'reading'
    4343        ),
    4444        'bbp_settings_per_rss_page' => array(
    45             'title'    => __( 'Topics and Replies Per RSS Page', 'bbpress' ),
     45            'title'    => esc_html__( 'Topics and Replies Per RSS Page', 'bbpress' ),
    4646            'callback' => 'bbp_admin_setting_callback_per_rss_page_section',
    4747            'page'     => 'reading',
    4848        ),
    4949        'bbp_settings_root_slugs' => array(
    50             'title'    => __( 'Forum Root Slug', 'bbpress' ),
     50            'title'    => esc_html__( 'Forum Root Slug', 'bbpress' ),
    5151            'callback' => 'bbp_admin_setting_callback_root_slug_section',
    5252            'page'     => 'permalink'
    5353        ),
    5454        'bbp_settings_single_slugs' => array(
    55             'title'    => __( 'Single Forum Slugs', 'bbpress' ),
     55            'title'    => esc_html__( 'Single Forum Slugs', 'bbpress' ),
    5656            'callback' => 'bbp_admin_setting_callback_single_slug_section',
    5757            'page'     => 'permalink',
    5858        ),
    5959        'bbp_settings_user_slugs' => array(
    60             'title'    => __( 'Forum User Slugs', 'bbpress' ),
     60            'title'    => esc_html__( 'Forum User Slugs', 'bbpress' ),
    6161            'callback' => 'bbp_admin_setting_callback_user_slug_section',
    6262            'page'     => 'permalink',
    6363        ),
    6464        'bbp_settings_buddypress' => array(
    65             'title'    => __( 'BuddyPress Integration', 'bbpress' ),
     65            'title'    => esc_html__( 'BuddyPress Integration', 'bbpress' ),
    6666            'callback' => 'bbp_admin_setting_callback_buddypress_section',
    6767            'page'     => 'buddypress',
    6868        ),
    6969        'bbp_settings_akismet' => array(
    70             'title'    => __( 'Akismet Integration', 'bbpress' ),
     70            'title'    => esc_html__( 'Akismet Integration', 'bbpress' ),
    7171            'callback' => 'bbp_admin_setting_callback_akismet_section',
    7272            'page'     => 'discussion'
     
    9191            // Edit lock setting
    9292            '_bbp_edit_lock' => array(
    93                 'title'             => __( 'Disallow editing after', 'bbpress' ),
     93                'title'             => esc_html__( 'Disallow editing after', 'bbpress' ),
    9494                'callback'          => 'bbp_admin_setting_callback_editlock',
    9595                'sanitize_callback' => 'intval',
     
    9999            // Throttle setting
    100100            '_bbp_throttle_time' => array(
    101                 'title'             => __( 'Throttle posting every', 'bbpress' ),
     101                'title'             => esc_html__( 'Throttle posting every', 'bbpress' ),
    102102                'callback'          => 'bbp_admin_setting_callback_throttle',
    103103                'sanitize_callback' => 'intval',
     
    107107            // Allow anonymous posting setting
    108108            '_bbp_allow_anonymous' => array(
    109                 'title'             => __( 'Anonymous posting', 'bbpress' ),
     109                'title'             => esc_html__( 'Anonymous posting', 'bbpress' ),
    110110                'callback'          => 'bbp_admin_setting_callback_anonymous',
    111111                'sanitize_callback' => 'intval',
     
    115115            // Allow global access (on multisite)
    116116            '_bbp_allow_global_access' => array(
    117                 'title'             => __( 'Auto role', 'bbpress' ),
     117                'title'             => esc_html__( 'Auto role', 'bbpress' ),
    118118                'callback'          => 'bbp_admin_setting_callback_global_access',
    119119                'sanitize_callback' => 'intval',
     
    134134            // Allow topic and reply revisions
    135135            '_bbp_allow_revisions' => array(
    136                 'title'             => __( 'Revisions', 'bbpress' ),
     136                'title'             => esc_html__( 'Revisions', 'bbpress' ),
    137137                'callback'          => 'bbp_admin_setting_callback_revisions',
    138138                'sanitize_callback' => 'intval',
     
    142142            // Allow favorites setting
    143143            '_bbp_enable_favorites' => array(
    144                 'title'             => __( 'Favorites', 'bbpress' ),
     144                'title'             => esc_html__( 'Favorites', 'bbpress' ),
    145145                'callback'          => 'bbp_admin_setting_callback_favorites',
    146146                'sanitize_callback' => 'intval',
     
    150150            // Allow subscriptions setting
    151151            '_bbp_enable_subscriptions' => array(
    152                 'title'             => __( 'Subscriptions', 'bbpress' ),
     152                'title'             => esc_html__( 'Subscriptions', 'bbpress' ),
    153153                'callback'          => 'bbp_admin_setting_callback_subscriptions',
    154154                'sanitize_callback' => 'intval',
     
    158158            // Allow engagements setting
    159159            '_bbp_enable_engagements' => array(
    160                 'title'             => __( 'Engagements', 'bbpress' ),
     160                'title'             => esc_html__( 'Engagements', 'bbpress' ),
    161161                'callback'          => 'bbp_admin_setting_callback_engagements',
    162162                'sanitize_callback' => 'intval',
     
    166166            // Allow topic tags
    167167            '_bbp_allow_topic_tags' => array(
    168                 'title'             => __( 'Topic tags', 'bbpress' ),
     168                'title'             => esc_html__( 'Topic tags', 'bbpress' ),
    169169                'callback'          => 'bbp_admin_setting_callback_topic_tags',
    170170                'sanitize_callback' => 'intval',
     
    174174            // Allow per-forum moderators
    175175            '_bbp_allow_forum_mods' => array(
    176                 'title'             => __( 'Forum Moderators', 'bbpress' ),
     176                'title'             => esc_html__( 'Forum Moderators', 'bbpress' ),
    177177                'callback'          => 'bbp_admin_setting_callback_forum_mods',
    178178                'sanitize_callback' => 'intval',
     
    182182            // Allow topic tags
    183183            '_bbp_allow_search' => array(
    184                 'title'             => __( 'Search', 'bbpress' ),
     184                'title'             => esc_html__( 'Search', 'bbpress' ),
    185185                'callback'          => 'bbp_admin_setting_callback_search',
    186186                'sanitize_callback' => 'intval',
     
    190190            // Allow fancy editor setting
    191191            '_bbp_use_wp_editor' => array(
    192                 'title'             => __( 'Post Formatting', 'bbpress' ),
     192                'title'             => esc_html__( 'Post Formatting', 'bbpress' ),
    193193                'callback'          => 'bbp_admin_setting_callback_use_wp_editor',
    194194                'args'              => array(),
     
    198198            // Allow auto embedding setting
    199199            '_bbp_use_autoembed' => array(
    200                 'title'             => __( 'Auto-embed links', 'bbpress' ),
     200                'title'             => esc_html__( 'Auto-embed links', 'bbpress' ),
    201201                'callback'          => 'bbp_admin_setting_callback_use_autoembed',
    202202                'sanitize_callback' => 'intval',
     
    206206            // Set reply threading level
    207207            '_bbp_thread_replies_depth' => array(
    208                 'title'             => __( 'Reply Threading', 'bbpress' ),
     208                'title'             => esc_html__( 'Reply Threading', 'bbpress' ),
    209209                'callback'          => 'bbp_admin_setting_callback_thread_replies_depth',
    210210                'sanitize_callback' => 'intval',
     
    225225            // Theme package setting
    226226            '_bbp_theme_package_id' => array(
    227                 'title'             => __( 'Current Package', 'bbpress' ),
     227                'title'             => esc_html__( 'Current Package', 'bbpress' ),
    228228                'callback'          => 'bbp_admin_setting_callback_subtheme_id',
    229229                'sanitize_callback' => 'esc_sql',
     
    238238            // Replies per page setting
    239239            '_bbp_topics_per_page' => array(
    240                 'title'             => __( 'Topics', 'bbpress' ),
     240                'title'             => esc_html__( 'Topics', 'bbpress' ),
    241241                'callback'          => 'bbp_admin_setting_callback_topics_per_page',
    242242                'sanitize_callback' => 'intval',
     
    246246            // Replies per page setting
    247247            '_bbp_replies_per_page' => array(
    248                 'title'             => __( 'Replies', 'bbpress' ),
     248                'title'             => esc_html__( 'Replies', 'bbpress' ),
    249249                'callback'          => 'bbp_admin_setting_callback_replies_per_page',
    250250                'sanitize_callback' => 'intval',
     
    259259            // Replies per page setting
    260260            '_bbp_topics_per_rss_page' => array(
    261                 'title'             => __( 'Topics', 'bbpress' ),
     261                'title'             => esc_html__( 'Topics', 'bbpress' ),
    262262                'callback'          => 'bbp_admin_setting_callback_topics_per_rss_page',
    263263                'sanitize_callback' => 'intval',
     
    267267            // Replies per page setting
    268268            '_bbp_replies_per_rss_page' => array(
    269                 'title'             => __( 'Replies', 'bbpress' ),
     269                'title'             => esc_html__( 'Replies', 'bbpress' ),
    270270                'callback'          => 'bbp_admin_setting_callback_replies_per_rss_page',
    271271                'sanitize_callback' => 'intval',
     
    280280            // Root slug setting
    281281            '_bbp_root_slug' => array(
    282                 'title'             => __( 'Forum Root', 'bbpress' ),
     282                'title'             => esc_html__( 'Forum Root', 'bbpress' ),
    283283                'callback'          => 'bbp_admin_setting_callback_root_slug',
    284284                'sanitize_callback' => 'bbp_sanitize_slug',
     
    288288            // Include root setting
    289289            '_bbp_include_root' => array(
    290                 'title'             => __( 'Forum Prefix', 'bbpress' ),
     290                'title'             => esc_html__( 'Forum Prefix', 'bbpress' ),
    291291                'callback'          => 'bbp_admin_setting_callback_include_root',
    292292                'sanitize_callback' => 'intval',
     
    296296            // What to show on Forum Root
    297297            '_bbp_show_on_root' => array(
    298                 'title'             => __( 'Forum root should show', 'bbpress' ),
     298                'title'             => esc_html__( 'Forum root should show', 'bbpress' ),
    299299                'callback'          => 'bbp_admin_setting_callback_show_on_root',
    300300                'sanitize_callback' => 'sanitize_text_field',
     
    309309            // Forum slug setting
    310310            '_bbp_forum_slug' => array(
    311                 'title'             => __( 'Forum', 'bbpress' ),
     311                'title'             => esc_html__( 'Forum', 'bbpress' ),
    312312                'callback'          => 'bbp_admin_setting_callback_forum_slug',
    313313                'sanitize_callback' => 'bbp_sanitize_slug',
     
    317317            // Topic slug setting
    318318            '_bbp_topic_slug' => array(
    319                 'title'             => __( 'Topic', 'bbpress' ),
     319                'title'             => esc_html__( 'Topic', 'bbpress' ),
    320320                'callback'          => 'bbp_admin_setting_callback_topic_slug',
    321321                'sanitize_callback' => 'bbp_sanitize_slug',
     
    325325            // Topic tag slug setting
    326326            '_bbp_topic_tag_slug' => array(
    327                 'title'             => __( 'Topic Tag', 'bbpress' ),
     327                'title'             => esc_html__( 'Topic Tag', 'bbpress' ),
    328328                'callback'          => 'bbp_admin_setting_callback_topic_tag_slug',
    329329                'sanitize_callback' => 'bbp_sanitize_slug',
     
    333333            // View slug setting
    334334            '_bbp_view_slug' => array(
    335                 'title'             => __( 'Topic View', 'bbpress' ),
     335                'title'             => esc_html__( 'Topic View', 'bbpress' ),
    336336                'callback'          => 'bbp_admin_setting_callback_view_slug',
    337337                'sanitize_callback' => 'bbp_sanitize_slug',
     
    349349            // Search slug setting
    350350            '_bbp_search_slug' => array(
    351                 'title'             => __( 'Search', 'bbpress' ),
     351                'title'             => esc_html__( 'Search', 'bbpress' ),
    352352                'callback'          => 'bbp_admin_setting_callback_search_slug',
    353353                'sanitize_callback' => 'bbp_sanitize_slug',
     
    362362            // User slug setting
    363363            '_bbp_user_slug' => array(
    364                 'title'             => __( 'User Base', 'bbpress' ),
     364                'title'             => esc_html__( 'User Base', 'bbpress' ),
    365365                'callback'          => 'bbp_admin_setting_callback_user_slug',
    366366                'sanitize_callback' => 'bbp_sanitize_slug',
     
    370370            // Topics slug setting
    371371            '_bbp_topic_archive_slug' => array(
    372                 'title'             => __( 'Topics Started', 'bbpress' ),
     372                'title'             => esc_html__( 'Topics Started', 'bbpress' ),
    373373                'callback'          => 'bbp_admin_setting_callback_topic_archive_slug',
    374374                'sanitize_callback' => 'bbp_sanitize_slug',
     
    378378            // Replies slug setting
    379379            '_bbp_reply_archive_slug' => array(
    380                 'title'             => __( 'Replies Created', 'bbpress' ),
     380                'title'             => esc_html__( 'Replies Created', 'bbpress' ),
    381381                'callback'          => 'bbp_admin_setting_callback_reply_archive_slug',
    382382                'sanitize_callback' => 'bbp_sanitize_slug',
     
    386386            // Favorites slug setting
    387387            '_bbp_user_favs_slug' => array(
    388                 'title'             => __( 'Favorite Topics', 'bbpress' ),
     388                'title'             => esc_html__( 'Favorite Topics', 'bbpress' ),
    389389                'callback'          => 'bbp_admin_setting_callback_user_favs_slug',
    390390                'sanitize_callback' => 'bbp_sanitize_slug',
     
    394394            // Subscriptions slug setting
    395395            '_bbp_user_subs_slug' => array(
    396                 'title'             => __( 'Subscriptions', 'bbpress' ),
     396                'title'             => esc_html__( 'Subscriptions', 'bbpress' ),
    397397                'callback'          => 'bbp_admin_setting_callback_user_subs_slug',
    398398                'sanitize_callback' => 'bbp_sanitize_slug',
     
    402402            // Engagements slug setting
    403403            '_bbp_user_engagements_slug' => array(
    404                 'title'             => __( 'Engagements', 'bbpress' ),
     404                'title'             => esc_html__( 'Engagements', 'bbpress' ),
    405405                'callback'          => 'bbp_admin_setting_callback_user_engagements_slug',
    406406                'sanitize_callback' => 'bbp_sanitize_slug',
     
    415415            // Are group forums enabled?
    416416            '_bbp_enable_group_forums' => array(
    417                 'title'             => __( 'Enable Group Forums', 'bbpress' ),
     417                'title'             => esc_html__( 'Enable Group Forums', 'bbpress' ),
    418418                'callback'          => 'bbp_admin_setting_callback_group_forums',
    419419                'sanitize_callback' => 'intval',
     
    423423            // Group forums parent forum ID
    424424            '_bbp_group_forums_root_id' => array(
    425                 'title'             => __( 'Group Forums Parent', 'bbpress' ),
     425                'title'             => esc_html__( 'Group Forums Parent', 'bbpress' ),
    426426                'callback'          => 'bbp_admin_setting_callback_group_forums_root_id',
    427427                'sanitize_callback' => 'intval',
     
    436436            // Should we use Akismet
    437437            '_bbp_enable_akismet' => array(
    438                 'title'             => __( 'Use Akismet', 'bbpress' ),
     438                'title'             => esc_html__( 'Use Akismet', 'bbpress' ),
    439439                'callback'          => 'bbp_admin_setting_callback_akismet',
    440440                'sanitize_callback' => 'intval',
     
    450450 * @since 2.1.0 bbPress (r4001)
    451451 *
    452  * @param string $section_id
     452 * @param string $section_id ID of the section to get fields for
     453 * @staticvar array $fields All of the available fields
    453454 * @return mixed False if section is invalid, array of fields otherwise.
    454455 */
    455456function bbp_admin_get_settings_fields_for_section( $section_id = '' ) {
     457    static $fields = array();
     458
     459    // Default return value
     460    $retval = array();
    456461
    457462    // Bail if section is empty
     
    460465    }
    461466
    462     $fields = bbp_admin_get_settings_fields();
    463     $retval = isset( $fields[ $section_id ] )
    464         ? $fields[ $section_id ]
    465         : false;
    466 
     467    // Get all of the fields (so we can snag one section of them)
     468    if ( empty( $fields ) ) {
     469        $fields = bbp_admin_get_settings_fields();
     470    }
     471
     472    // Get the field by section
     473    if ( isset( $fields[ $section_id ] ) ) {
     474        $retval = $fields[ $section_id ];
     475    }
     476
     477    // Filter & return
    467478    return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id );
    468479}
     
    974985    $root_options = array(
    975986        'forums' => array(
    976             'name' => __( 'Forum Index', 'bbpress' )
     987            'name' => esc_attr__( 'Forum Index', 'bbpress' )
    977988        ),
    978989        'topics' => array(
    979             'name' => __( 'Topics by Last Post', 'bbpress' )
     990            'name' => esc_attr__( 'Topics by Last Post', 'bbpress' )
    980991        )
    981992    ); ?>
     
    12721283    bbp_dropdown( array(
    12731284        'selected'           => bbp_get_group_forums_root_id(),
    1274         'show_none'          => __( '&mdash; Forum root &mdash;', 'bbpress' ),
     1285        'show_none'          => esc_attr__( '&mdash; Forum root &mdash;', 'bbpress' ),
    12751286        'orderby'            => 'title',
    12761287        'order'              => 'ASC',
     
    16241635    $current_screen->add_help_tab( array(
    16251636        'id'      => 'overview',
    1626         'title'   => __( 'Overview', 'bbpress' ),
    1627         'content' => '<p>' . __( 'This screen provides access to all of the Forums settings.',                          'bbpress' ) . '</p>' .
    1628                      '<p>' . __( 'Please see the additional help tabs for more information on each individual section.', 'bbpress' ) . '</p>'
     1637        'title'   => esc_html__( 'Overview', 'bbpress' ),
     1638        'content' => '<p>' . esc_html__( 'This screen provides access to all of the Forums settings.',                          'bbpress' ) . '</p>' .
     1639                     '<p>' . esc_html__( 'Please see the additional help tabs for more information on each individual section.', 'bbpress' ) . '</p>'
    16291640    ) );
    16301641
     
    16321643    $current_screen->add_help_tab( array(
    16331644        'id'      => 'main_settings',
    1634         'title'   => __( 'Main Settings', 'bbpress' ),
    1635         'content' => '<p>' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' .
     1645        'title'   => esc_html__( 'Main Settings', 'bbpress' ),
     1646        'content' => '<p>' . esc_html__( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' .
    16361647                     '<p>' .
    16371648                        '<ul>' .
    1638                             '<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>' .
    1639                             '<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>' .
    1640                             '<li>' . __( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.',                                                                           'bbpress' ) . '</li>' .
    1641                             '<li>' . __( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.',                                                                 'bbpress' ) . '</li>' .
    1642                             '<li>' . __( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.',                                                                                                'bbpress' ) . '</li>' .
    1643                             '<li>' . __( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.',                                                             'bbpress' ) . '</li>' .
    1644                             '<li>' . __( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.',                                                  'bbpress' ) . '</li>' .
    1645                             '<li>' . __( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.',                                                            'bbpress' ) . '</li>' .
     1649                            '<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>' .
     1650                            '<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>' .
     1651                            '<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>' .
     1652                            '<li>' . esc_html__( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.',                                                                 'bbpress' ) . '</li>' .
     1653                            '<li>' . esc_html__( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.',                                                                                                'bbpress' ) . '</li>' .
     1654                            '<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>' .
     1655                            '<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>' .
     1656                            '<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>' .
    16461657                        '</ul>' .
    16471658                    '</p>' .
    1648                     '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>'
     1659                    '<p>' . esc_html__( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>'
    16491660    ) );
    16501661
     
    16521663    $current_screen->add_help_tab( array(
    16531664        'id'      => 'per_page',
    1654         'title'   => __( 'Per Page', 'bbpress' ),
    1655         'content' => '<p>' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.',                                                    'bbpress' ) . '</p>' .
    1656                      '<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>' .
    1657                      '<p>' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.',                                        'bbpress' ) . '</p>'
     1665        'title'   => esc_html__( 'Per Page', 'bbpress' ),
     1666        'content' => '<p>' . esc_html__( 'Per Page settings allow you to control the number of topics and replies appear on each page.',                                                    'bbpress' ) . '</p>' .
     1667                     '<p>' . 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' ) . '</p>' .
     1668                     '<p>' . esc_html__( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.',                                        'bbpress' ) . '</p>'
    16581669    ) );
    16591670
     
    16611672    $current_screen->add_help_tab( array(
    16621673        'id'      => 'slus',
    1663         'title'   => __( 'Slugs', 'bbpress' ),
    1664         'content' => '<p>' . __( 'The Slugs section allows you to control the permalink structure for your forums.',                                                                                                            'bbpress' ) . '</p>' .
    1665                      '<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>' .
    1666                      '<p>' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.',                                                                                          'bbpress' ) . '</p>' .
    1667                      '<p>' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>'
     1674        'title'   => esc_html__( 'Slugs', 'bbpress' ),
     1675        'content' => '<p>' . esc_html__( 'The Slugs section allows you to control the permalink structure for your forums.',                                                                                                            'bbpress' ) . '</p>' .
     1676                     '<p>' . 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' ) . '</p>' .
     1677                     '<p>' . esc_html__( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.',                                                                                          'bbpress' ) . '</p>' .
     1678                     '<p>' . esc_html__( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>'
    16681679    ) );
    16691680
    16701681    // Help Sidebar
    16711682    $current_screen->set_help_sidebar(
    1672         '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' .
     1683        '<p><strong>' . esc_html__( 'For more information:', 'bbpress' ) . '</strong></p>' .
    16731684        '<p>' . __( '<a href="https://codex.bbpress.org" target="_blank">bbPress Documentation</a>',    'bbpress' ) . '</p>' .
    16741685        '<p>' . __( '<a href="https://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>'
     
    17641775
    17651776            // Core Post Types
    1766             'post_base'       => array( 'name' => __( 'Posts',         'bbpress' ), 'default' => 'post',          'context' => 'WordPress' ),
    1767             'page_base'       => array( 'name' => __( 'Pages',         'bbpress' ), 'default' => 'page',          'context' => 'WordPress' ),
    1768             'revision_base'   => array( 'name' => __( 'Revisions',     'bbpress' ), 'default' => 'revision',      'context' => 'WordPress' ),
    1769             'attachment_base' => array( 'name' => __( 'Attachments',   'bbpress' ), 'default' => 'attachment',    'context' => 'WordPress' ),
    1770             'nav_menu_base'   => array( 'name' => __( 'Menus',         'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
     1777            'post_base'       => array( 'name' => esc_html__( 'Posts',         'bbpress' ), 'default' => 'post',          'context' => 'WordPress' ),
     1778            'page_base'       => array( 'name' => esc_html__( 'Pages',         'bbpress' ), 'default' => 'page',          'context' => 'WordPress' ),
     1779            'revision_base'   => array( 'name' => esc_html__( 'Revisions',     'bbpress' ), 'default' => 'revision',      'context' => 'WordPress' ),
     1780            'attachment_base' => array( 'name' => esc_html__( 'Attachments',   'bbpress' ), 'default' => 'attachment',    'context' => 'WordPress' ),
     1781            'nav_menu_base'   => array( 'name' => esc_html__( 'Menus',         'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
    17711782
    17721783            // Post Tags
    1773             'tag_base'        => array( 'name' => __( 'Tag base',      'bbpress' ), 'default' => 'tag',           'context' => 'WordPress' ),
     1784            'tag_base'        => array( 'name' => esc_html__( 'Tag base',      'bbpress' ), 'default' => 'tag',           'context' => 'WordPress' ),
    17741785
    17751786            // Post Categories
    1776             'category_base'   => array( 'name' => __( 'Category base', 'bbpress' ), 'default' => 'category',      'context' => 'WordPress' ),
     1787            'category_base'   => array( 'name' => esc_html__( 'Category base', 'bbpress' ), 'default' => 'category',      'context' => 'WordPress' ),
    17771788
    17781789            /** bbPress Core ******************************************************/
    17791790
    17801791            // Forum archive slug
    1781             '_bbp_root_slug'          => array( 'name' => __( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ),
     1792            '_bbp_root_slug'          => array( 'name' => esc_html__( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ),
    17821793
    17831794            // Topic archive slug
    1784             '_bbp_topic_archive_slug' => array( 'name' => __( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ),
     1795            '_bbp_topic_archive_slug' => array( 'name' => esc_html__( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ),
    17851796
    17861797            // Forum slug
    1787             '_bbp_forum_slug'         => array( 'name' => __( 'Forum slug',  'bbpress' ), 'default' => 'forum',  'context' => 'bbPress' ),
     1798            '_bbp_forum_slug'         => array( 'name' => esc_html__( 'Forum slug',  'bbpress' ), 'default' => 'forum',  'context' => 'bbPress' ),
    17881799
    17891800            // Topic slug
    1790             '_bbp_topic_slug'         => array( 'name' => __( 'Topic slug',  'bbpress' ), 'default' => 'topic',  'context' => 'bbPress' ),
     1801            '_bbp_topic_slug'         => array( 'name' => esc_html__( 'Topic slug',  'bbpress' ), 'default' => 'topic',  'context' => 'bbPress' ),
    17911802
    17921803            // Reply slug
    1793             '_bbp_reply_slug'         => array( 'name' => __( 'Reply slug',  'bbpress' ), 'default' => 'reply',  'context' => 'bbPress' ),
     1804            '_bbp_reply_slug'         => array( 'name' => esc_html__( 'Reply slug',  'bbpress' ), 'default' => 'reply',  'context' => 'bbPress' ),
    17941805
    17951806            // User profile slug
    1796             '_bbp_user_slug'          => array( 'name' => __( 'User base',   'bbpress' ), 'default' => 'users',  'context' => 'bbPress' ),
     1807            '_bbp_user_slug'          => array( 'name' => esc_html__( 'User base',   'bbpress' ), 'default' => 'users',  'context' => 'bbPress' ),
    17971808
    17981809            // View slug
    1799             '_bbp_view_slug'          => array( 'name' => __( 'View base',   'bbpress' ), 'default' => 'view',   'context' => 'bbPress' ),
     1810            '_bbp_view_slug'          => array( 'name' => esc_html__( 'View base',   'bbpress' ), 'default' => 'view',   'context' => 'bbPress' ),
    18001811
    18011812            // Topic tag slug
    1802             '_bbp_topic_tag_slug'     => array( 'name' => __( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ),
     1813            '_bbp_topic_tag_slug'     => array( 'name' => esc_html__( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ),
    18031814        ) );
    18041815
     
    18121823                foreach ( $bp->pages as $page => $page_data ) {
    18131824                    $page_base    = $page . '_base';
    1814                     $page_title   = sprintf( __( '%s page', 'bbpress' ), $page_data->title );
     1825                    $page_title   = sprintf( esc_html__( '%s page', 'bbpress' ), $page_data->title );
    18151826                    $core_slugs[ $page_base ] = array(
    18161827                        'name'    => $page_title,
  • trunk/src/includes/core/options.php

    r6323 r6419  
    4848        '_bbp_theme_package_id'       => 'default',                  // The ID for the current theme package
    4949        '_bbp_default_role'           => bbp_get_participant_role(), // Default forums role
    50         '_bbp_settings_integration'   => 0,                          // Put settings into existing admin pages
     50        '_bbp_settings_integration'   => 'basic',                    // How to integrate into wp-admin
    5151
    5252        /** Per Page **********************************************************/
     
    479479 * Integrate settings into existing WordPress pages
    480480 *
     481 * There are 3 possible modes:
     482 * - 'basic'   Traditional admin integration
     483 * - 'compact' One "bbPress" top-level admin menu
     484 * - 'deep'    Deeply integrate with the WordPress admin interface
     485 *
    481486 * @since 2.4.0 bbPress (r4932)
    482487 *
     
    485490 * @return bool To deeply integrate settings, or not
    486491 */
    487 function bbp_settings_integration( $default = 0 ) {
    488     return (bool) apply_filters( 'bbp_settings_integration', (bool) get_option( '_bbp_settings_integration', $default ) );
     492function bbp_settings_integration( $default = 'basic' ) {
     493
     494    // Get the option value
     495    $integration = get_option( '_bbp_settings_integration', $default );
     496
     497    // Back-compat for deep/basic (pre-2.6)
     498    if ( is_numeric( $integration ) ) {
     499        $integration = ( 1 === (int) $integration )
     500            ? 'deep'
     501            : 'basic';
     502    }
     503
     504    // Fallback to 'none' if invalid
     505    if ( ! in_array( $integration, array( 'basic', 'deep', 'compact' ), true ) ) {
     506        $integration = 'basic';
     507    }
     508
     509    // Filter & return
     510    return apply_filters( 'bbp_settings_integration', $integration, $default );
    489511}
    490512
Note: See TracChangeset for help on using the changeset viewer.