diff -r c7c0fbc09788 -r 5e8dcbe22c24 web/wp-content/plugins/bbpress/includes/admin/settings.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/bbpress/includes/admin/settings.php Tue Dec 04 18:43:10 2012 -0800 @@ -0,0 +1,1494 @@ + array( + 'title' => __( 'Main Settings', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_main_section', + 'page' => 'bbpress', + ), + 'bbp_settings_theme_compat' => array( + 'title' => __( 'Theme Packages', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_subtheme_section', + 'page' => 'bbpress', + ), + 'bbp_settings_per_page' => array( + 'title' => __( 'Per Page', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_per_page_section', + 'page' => 'bbpress', + ), + 'bbp_settings_per_rss_page' => array( + 'title' => __( 'Per RSS Page', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_per_rss_page_section', + 'page' => 'bbpress', + ), + 'bbp_settings_root_slugs' => array( + 'title' => __( 'Archive Slugs', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_root_slug_section', + 'page' => 'bbpress', + ), + 'bbp_settings_single_slugs' => array( + 'title' => __( 'Single Slugs', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_single_slug_section', + 'page' => 'bbpress', + ), + 'bbp_settings_buddypress' => array( + 'title' => __( 'BuddyPress', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_buddypress_section', + 'page' => 'bbpress', + ), + 'bbp_settings_akismet' => array( + 'title' => __( 'Akismet', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_akismet_section', + 'page' => 'bbpress' + ) + ) ); +} + +/** + * Get all of the settings fields. + * + * @since bbPress (r4001) + * @return type + */ +function bbp_admin_get_settings_fields() { + return (array) apply_filters( 'bbp_admin_get_settings_fields', array( + + /** Main Section ******************************************************/ + + 'bbp_settings_main' => array( + + // Edit lock setting + '_bbp_edit_lock' => array( + 'title' => __( 'Disallow editing after', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_editlock', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Throttle setting + '_bbp_throttle_time' => array( + 'title' => __( 'Throttle posting every', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_throttle', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow topic and reply revisions + '_bbp_allow_revisions' => array( + 'title' => __( 'Revisions', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_revisions', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow favorites setting + '_bbp_enable_favorites' => array( + 'title' => __( 'Favorites', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_favorites', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow subscriptions setting + '_bbp_enable_subscriptions' => array( + 'title' => __( 'Subscriptions', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_subscriptions', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow topic tags + '_bbp_allow_topic_tags' => array( + 'title' => __( 'Topic tags', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topic_tags', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow anonymous posting setting + '_bbp_allow_anonymous' => array( + 'title' => __( 'Anonymous posting', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_anonymous', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow global access (on multisite) + '_bbp_default_role' => array( + 'title' => __( 'Default user role', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_default_role', + 'sanitize_callback' => 'sanitize_text_field', + 'args' => array() + ), + + // Allow global access (on multisite) + '_bbp_allow_global_access' => array( + 'title' => __( 'Auto role', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_global_access', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Allow fancy editor setting + '_bbp_use_wp_editor' => array( + 'title' => __( 'Fancy editor', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_use_wp_editor', + 'args' => array(), + 'sanitize_callback' => 'intval' + ), + + // Allow auto embedding setting + '_bbp_use_autoembed' => array( + 'title' => __( 'Auto-embed links', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_use_autoembed', + 'sanitize_callback' => 'intval', + 'args' => array() + ) + ), + + /** Theme Packages ****************************************************/ + + 'bbp_settings_theme_compat' => array( + + // Replies per page setting + '_bbp_theme_package_id' => array( + 'title' => __( 'Current Package', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_subtheme_id', + 'sanitize_callback' => 'esc_sql', + 'args' => array() + ) + ), + + /** Per Page Section **************************************************/ + + 'bbp_settings_per_page' => array( + + // Replies per page setting + '_bbp_topics_per_page' => array( + 'title' => __( 'Topics', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topics_per_page', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Replies per page setting + '_bbp_replies_per_page' => array( + 'title' => __( 'Replies', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_replies_per_page', + 'sanitize_callback' => 'intval', + 'args' => array() + ) + ), + + /** Per RSS Page Section **********************************************/ + + 'bbp_settings_per_rss_page' => array( + + // Replies per page setting + '_bbp_topics_per_rss_page' => array( + 'title' => __( 'Topics', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topics_per_rss_page', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Replies per page setting + '_bbp_replies_per_rss_page' => array( + 'title' => __( 'Replies', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_replies_per_rss_page', + 'sanitize_callback' => 'intval', + 'args' => array() + ) + ), + + /** Front Slugs *******************************************************/ + + 'bbp_settings_root_slugs' => array( + + // Root slug setting + '_bbp_root_slug' => array( + 'title' => __( 'Forums base', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_root_slug', + 'sanitize_callback' => 'esc_sql', + 'args' => array() + ), + + // Topic archive setting + '_bbp_topic_archive_slug' => array( + 'title' => __( 'Topics base', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topic_archive_slug', + 'sanitize_callback' => 'esc_sql', + 'args' => array() + ) + ), + + /** Single Slugs ******************************************************/ + + 'bbp_settings_single_slugs' => array( + + // Include root setting + '_bbp_include_root' => array( + 'title' => __( 'Forum Prefix', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_include_root', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Forum slug setting + '_bbp_forum_slug' => array( + 'title' => __( 'Forum slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_forum_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ), + + // Topic slug setting + '_bbp_topic_slug' => array( + 'title' => __( 'Topic slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topic_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ), + + // Topic tag slug setting + '_bbp_topic_tag_slug' => array( + 'title' => __( 'Topic tag slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_topic_tag_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ), + + // Reply slug setting + '_bbp_reply_slug' => array( + 'title' => __( 'Reply slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_reply_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ), + + // User slug setting + '_bbp_user_slug' => array( + 'title' => __( 'User slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_user_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ), + + // View slug setting + '_bbp_view_slug' => array( + 'title' => __( 'Topic view slug', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_view_slug', + 'sanitize_callback' => 'sanitize_title', + 'args' => array() + ) + ), + + /** BuddyPress ********************************************************/ + + 'bbp_settings_buddypress' => array( + + // Are group forums enabled? + '_bbp_enable_group_forums' => array( + 'title' => __( 'Enable Group Forums', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_group_forums', + 'sanitize_callback' => 'intval', + 'args' => array() + ), + + // Group forums parent forum ID + '_bbp_group_forums_root_id' => array( + 'title' => __( 'Group Forums Parent', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_group_forums_root_id', + 'sanitize_callback' => 'intval', + 'args' => array() + ) + ), + + /** Akismet ***********************************************************/ + + 'bbp_settings_akismet' => array( + + // Should we use Akismet + '_bbp_enable_akismet' => array( + 'title' => __( 'Use Akismet', 'bbpress' ), + 'callback' => 'bbp_admin_setting_callback_akismet', + 'sanitize_callback' => 'intval', + 'args' => array() + ) + ) + ) ); +} + +/** + * Get settings fields by section. + * + * @since bbPress (r4001) + * @param string $section_id + * @return mixed False if section is invalid, array of fields otherwise. + */ +function bbp_admin_get_settings_fields_for_section( $section_id = '' ) { + + // Bail if section is empty + if ( empty( $section_id ) ) + return false; + + $fields = bbp_admin_get_settings_fields(); + $retval = isset( $fields[$section_id] ) ? $fields[$section_id] : false; + + return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id ); +} + +/** Main Section **************************************************************/ + +/** + * Main settings section description for the settings page + * + * @since bbPress (r2786) + */ +function bbp_admin_setting_callback_main_section() { +?> + +
+ + + + /> + + + + + /> + + + + + /> + + + + + /> + + + + + /> + + + + + /> + + + + + /> + + + + + /> + + + + + + + + + /> + + + + + + +theme_compat->packages as $id => $theme ) { + $theme_options .= ''; + } + + if ( !empty( $theme_options ) ) : ?> + + + + + + + + + + + /> + + + + + + + + + /> + + + + + /> + + + + + + + + + /> + + + + + /> + + + + + + + + + /> + + + + /> + + + + + + + + /> + + + + + /> + + + + /> + + + + /> + + + + /> + + + + /> + + + + /> + + + + + + + + /> + + + bbp_get_group_forums_root_id(), + 'show_none' => __( '— Forum root —', 'bbpress' ), + 'orderby' => 'title', + 'order' => 'ASC', + 'select_id' => '_bbp_group_forums_root_id', + 'disable_categories' => false, + 'disabled' => '_bbp_group_forums_root_id' + ) ); ?> + + + + + + + + + + + /> + + + + +Backup your database before proceeding.', 'bbpress' ); ?>
+ +admin->admin_dir . 'converters/' ); + + // Bail if no directory was found (how did this happen?) + if ( empty( $curdir ) ) + return; + + // Loop through files in the converters folder and assemble some options + while ( $file = readdir( $curdir ) ) { + if ( ( stristr( $file, '.php' ) ) && ( stristr( $file, 'index' ) === false ) ) { + $file = preg_replace( '/.php/', '', $file ); + $platform_options .= ''; + } + } + + closedir( $curdir ); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /> + + + + + + /> + + + + + + /> + + + + + +' . __( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '
' . + '' . __( 'Please see the additional help tabs for more information on each indiviual section.', 'bbpress' ) . '
' + ) ); + + // Main Settings + $current_screen->add_help_tab( array( + 'id' => 'main_settings', + 'title' => __( 'Main Settings', 'bbpress' ), + 'content' => '' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '
' . + '' . + '
' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '
' + ) ); + + // Per Page + $current_screen->add_help_tab( array( + 'id' => 'per_page', + 'title' => __( 'Per Page', 'bbpress' ), + 'content' => '' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.', 'bbpress' ) . '
' . + '' . __( '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' ) . '
' . + '' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '
' + ) ); + + // Slugs + $current_screen->add_help_tab( array( + 'id' => 'slus', + 'title' => __( 'Slugs', 'bbpress' ), + 'content' => '' . __( 'The Slugs section allows you to control the permalink structure for your forums.', 'bbpress' ) . '
' . + '' . __( '"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' ) . '
' . + '' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '
' . + '' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '
' + ) ); + + // Help Sidebar + $current_screen->set_help_sidebar( + '' . __( 'For more information:' ) . '
' . + '' . __( 'bbPress Documentation', 'bbpress' ) . '
' . + '' . __( 'bbPress Support Forums', 'bbpress' ) . '
' + ); +} + +/** + * Disable a settings field if the value is forcibly set in bbPress's global + * options array. + * + * @since bbPress (r4347) + * + * @param string $option_key + */ +function bbp_maybe_admin_setting_disabled( $option_key = '' ) { + disabled( isset( bbpress()->options[$option_key] ) ); +} + +/** + * Output settings API option + * + * @since bbPress (r3203) + * + * @uses bbp_get_bbp_form_option() + * + * @param string $option + * @param string $default + * @param bool $slug + */ +function bbp_form_option( $option, $default = '' , $slug = false ) { + echo bbp_get_form_option( $option, $default, $slug ); +} + /** + * Return settings API option + * + * @since bbPress (r3203) + * + * @uses get_option() + * @uses esc_attr() + * @uses apply_filters() + * + * @param string $option + * @param string $default + * @param bool $slug + */ + function bbp_get_form_option( $option, $default = '', $slug = false ) { + + // Get the option and sanitize it + $value = get_option( $option, $default ); + + // Slug? + if ( true === $slug ) { + $value = esc_attr( apply_filters( 'editable_slug', $value ) ); + + // Not a slug + } else { + $value = esc_attr( $value ); + } + + // Fallback to default + if ( empty( $value ) ) + $value = $default; + + // Allow plugins to further filter the output + return apply_filters( 'bbp_get_form_option', $value, $option ); + } + +/** + * Used to check if a bbPress slug conflicts with an existing known slug. + * + * @since bbPress (r3306) + * + * @param string $slug + * @param string $default + * + * @uses bbp_get_form_option() To get a sanitized slug string + */ +function bbp_form_slug_conflict_check( $slug, $default ) { + + // Only set the slugs once ver page load + static $the_core_slugs = array(); + + // Get the form value + $this_slug = bbp_get_form_option( $slug, $default, true ); + + if ( empty( $the_core_slugs ) ) { + + // Slugs to check + $core_slugs = apply_filters( 'bbp_slug_conflict_check', array( + + /** WordPress Core ****************************************************/ + + // Core Post Types + 'post_base' => array( 'name' => __( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ), + 'page_base' => array( 'name' => __( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ), + 'revision_base' => array( 'name' => __( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ), + 'attachment_base' => array( 'name' => __( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ), + 'nav_menu_base' => array( 'name' => __( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ), + + // Post Tags + 'tag_base' => array( 'name' => __( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ), + + // Post Categories + 'category_base' => array( 'name' => __( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ), + + /** bbPress Core ******************************************************/ + + // Forum archive slug + '_bbp_root_slug' => array( 'name' => __( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ), + + // Topic archive slug + '_bbp_topic_archive_slug' => array( 'name' => __( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ), + + // Forum slug + '_bbp_forum_slug' => array( 'name' => __( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ), + + // Topic slug + '_bbp_topic_slug' => array( 'name' => __( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ), + + // Reply slug + '_bbp_reply_slug' => array( 'name' => __( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ), + + // User profile slug + '_bbp_user_slug' => array( 'name' => __( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ), + + // View slug + '_bbp_view_slug' => array( 'name' => __( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ), + + // Topic tag slug + '_bbp_topic_tag_slug' => array( 'name' => __( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ), + ) ); + + /** BuddyPress Core *******************************************************/ + + if ( defined( 'BP_VERSION' ) ) { + $bp = buddypress(); + + // Loop through root slugs and check for conflict + if ( !empty( $bp->pages ) ) { + foreach ( $bp->pages as $page => $page_data ) { + $page_base = $page . '_base'; + $page_title = sprintf( __( '%s page', 'bbpress' ), $page_data->title ); + $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context' => 'BuddyPress' ); + } + } + } + + // Set the static + $the_core_slugs = apply_filters( 'bbp_slug_conflict', $core_slugs ); + } + + // Loop through slugs to check + foreach( $the_core_slugs as $key => $value ) { + + // Get the slug + $slug_check = bbp_get_form_option( $key, $value['default'], true ); + + // Compare + if ( ( $slug != $key ) && ( $slug_check == $this_slug ) ) : ?> + + %2$s', 'bbpress' ), $value['context'], $value['name'] ); ?> + +