Skip to:
Content

BuddyPress.org

Changeset 6157


Ignore:
Timestamp:
06/30/2012 01:30:19 PM (8 years ago)
Author:
djpaul
Message:

Removing bp_form_slug_conflict_check() for 1.6. See #2086

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/admin/bp-core-settings.php

    r6156 r6157  
    337337        return apply_filters( 'bp_get_form_option', $value, $option );
    338338    }
    339 
    340 /**
    341  * Used to check if a BuddyPress slug conflicts with an existing known slug.
    342  *
    343  * @since BuddyPress (1.6)
    344  *
    345  * @param string $slug
    346  * @param string $default
    347  *
    348  * @uses bp_get_form_option() To get a sanitized slug string
    349  */
    350 function bp_form_slug_conflict_check( $slug, $default ) {
    351 
    352     // Only set the slugs once ver page load
    353     static $the_core_slugs = array();
    354 
    355     // Get the form value
    356     $this_slug = bp_get_form_option( $slug, $default, true );
    357 
    358     if ( empty( $the_core_slugs ) ) {
    359 
    360         // Slugs to check
    361         $core_slugs = apply_filters( 'bp_slug_conflict_check', array(
    362 
    363             /** WordPress Core ****************************************************/
    364 
    365             // Core Post Types
    366             'post_base'       => array( 'name' => __( 'Posts'         ), 'default' => 'post',          'context' => 'WordPress' ),
    367             'page_base'       => array( 'name' => __( 'Pages'         ), 'default' => 'page',          'context' => 'WordPress' ),
    368             'revision_base'   => array( 'name' => __( 'Revisions'     ), 'default' => 'revision',      'context' => 'WordPress' ),
    369             'attachment_base' => array( 'name' => __( 'Attachments'   ), 'default' => 'attachment',    'context' => 'WordPress' ),
    370             'nav_menu_base'   => array( 'name' => __( 'Menus'         ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
    371 
    372             // Post Tags
    373             'tag_base'        => array( 'name' => __( 'Tag base'      ), 'default' => 'tag',           'context' => 'WordPress' ),
    374 
    375             // Post Categories
    376             'category_base'   => array( 'name' => __( 'Category base' ), 'default' => 'category',      'context' => 'WordPress' ),
    377 
    378         ) );
    379 
    380         /** bbPress Core ******************************************************/
    381 
    382         if ( bp_forums_is_bbpress_active() ) {
    383 
    384             // Forum archive slug
    385             $core_slugs['_bbp_root_slug']          = array( 'name' => __( 'Forums base', 'buddypress' ), 'default' => 'forums', 'context' => 'buddypress' );
    386 
    387             // Topic archive slug
    388             $core_slugs['_bbp_topic_archive_slug'] = array( 'name' => __( 'Topics base', 'buddypress' ), 'default' => 'topics', 'context' => 'buddypress' );
    389 
    390             // Forum slug
    391             $core_slugs['_bbp_forum_slug']         = array( 'name' => __( 'Forum slug',  'buddypress' ), 'default' => 'forum',  'context' => 'buddypress' );
    392 
    393             // Topic slug
    394             $core_slugs['_bbp_topic_slug']         = array( 'name' => __( 'Topic slug',  'buddypress' ), 'default' => 'topic',  'context' => 'buddypress' );
    395 
    396             // Reply slug
    397             $core_slugs['_bbp_reply_slug']         = array( 'name' => __( 'Reply slug',  'buddypress' ), 'default' => 'reply',  'context' => 'buddypress' );
    398 
    399             // User profile slug
    400             $core_slugs['_bbp_user_slug']          = array( 'name' => __( 'User base',   'buddypress' ), 'default' => 'users',  'context' => 'buddypress' );
    401 
    402             // View slug
    403             $core_slugs['_bbp_view_slug']          = array( 'name' => __( 'View base',   'buddypress' ), 'default' => 'view',   'context' => 'buddypress' );
    404 
    405             // Topic tag slug
    406             $core_slugs['_bbp_topic_tag_slug']     = array( 'name' => __( 'Topic tag slug', 'buddypress' ), 'default' => 'topic-tag', 'context' => 'buddypress' );
    407         }
    408 
    409         /** BuddyPress Core *******************************************************/
    410 
    411         global $bp;
    412 
    413         // Loop through root slugs and check for conflict
    414         if ( !empty( $bp->pages ) ) {
    415             foreach ( $bp->pages as $page => $page_data ) {
    416                 $page_base    = $page . '_base';
    417                 $page_title   = sprintf( __( '%s page', 'buddypress' ), $page_data->title );
    418                 $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context' => 'buddypress' );
    419             }
    420         }
    421 
    422         // Set the static
    423         $the_core_slugs = apply_filters( 'bp_slug_conflict', $core_slugs );
    424     }
    425 
    426     // Loop through slugs to check
    427     foreach( $the_core_slugs as $key => $value ) {
    428 
    429         // Get the slug
    430         $slug_check = bp_get_form_option( $key, $value['default'], true );
    431 
    432         // Compare
    433         if ( ( $slug != $key ) && ( $slug_check == $this_slug ) ) : ?>
    434 
    435             <span class="attention"><?php printf( __( 'Possible %1$s conflict: <strong>%2$s</strong>', 'buddypress' ), $value['context'], $value['name'] ); ?></span>
    436 
    437         <?php endif;
    438     }
    439 }
    440 
    441 ?>
     339?>
Note: See TracChangeset for help on using the changeset viewer.