Skip to:
Content

bbPress.org

Changeset 4485


Ignore:
Timestamp:
11/23/2012 11:13:27 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Extract:

  • Remove extract() from bbp_get_dropdown().
  • Other general code cleanup.
  • See #2056.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/template-tags.php

    r4484 r4485  
    12481248        /** Arguments *********************************************************/
    12491249
    1250         $defaults = array (
     1250        $r = bbp_parse_args( $args, array(
    12511251            'post_type'          => bbp_get_forum_post_type(),
    12521252            'selected'           => 0,
     
    12661266            'disable_categories' => true,
    12671267            'disabled'           => ''
    1268         );
    1269         $r = bbp_parse_args( $args, $defaults, 'get_dropdown' );
     1268        ), 'get_dropdown' );
    12701269
    12711270        if ( empty( $r['walker'] ) ) {
     
    12751274
    12761275        // Force 0
    1277         if ( is_numeric( $r['selected'] ) && $r['selected'] < 0 )
     1276        if ( is_numeric( $r['selected'] ) && $r['selected'] < 0 ) {
    12781277            $r['selected'] = 0;
    1279 
    1280         extract( $r );
     1278        }
    12811279
    12821280        // Unset the args not needed for WP_Query to avoid any possible conflicts.
     
    12931291
    12941292        // Forums
    1295         if ( bbp_get_forum_post_type() == $post_type ) {
     1293        if ( bbp_get_forum_post_type() == $r['post_type'] ) {
    12961294
    12971295            // Private forums
     
    13111309        /** Setup variables ***************************************************/
    13121310
    1313         $name      = esc_attr( $select_id );
     1311        $name      = esc_attr( $r['select_id'] );
    13141312        $select_id = $name;
    1315         $tab       = (int) $tab;
     1313        $tab       = (int) $r['tab'];
    13161314        $retval    = '';
    13171315        $posts     = get_posts( $r );
    1318         $disabled  = disabled( isset( bbpress()->options[$disabled] ), true, false );
     1316        $disabled  = disabled( isset( bbpress()->options[$r['disabled']] ), true, false );
    13191317
    13201318        /** Drop Down *********************************************************/
     
    13221320        // Items found
    13231321        if ( !empty( $posts ) ) {
    1324             if ( empty( $options_only ) ) {
     1322            if ( empty( $r['options_only'] ) ) {
    13251323                $tab     = !empty( $tab ) ? ' tabindex="' . $tab . '"' : '';
    13261324                $retval .= '<select name="' . $name . '" id="' . $select_id . '"' . $tab  . $disabled . '>' . "\n";
    13271325            }
    13281326
    1329             $retval .= !empty( $show_none ) ? "\t<option value=\"\" class=\"level-0\">" . $show_none . '</option>' : '';
     1327            $retval .= !empty( $r['show_none'] ) ? "\t<option value=\"\" class=\"level-0\">" . $r['show_none'] . '</option>' : '';
    13301328            $retval .= walk_page_dropdown_tree( $posts, 0, $r );
    13311329
    1332             if ( empty( $options_only ) )
     1330            if ( empty( $r['options_only'] ) ) {
    13331331                $retval .= '</select>';
     1332            }
    13341333
    13351334        // No items found - Display feedback if no custom message was passed
    1336         } elseif ( empty( $none_found ) ) {
     1335        } elseif ( empty( $r['none_found'] ) ) {
    13371336
    13381337            // Switch the response based on post type
    1339             switch ( $post_type ) {
     1338            switch ( $r['post_type'] ) {
    13401339
    13411340                // Topics
Note: See TracChangeset for help on using the changeset viewer.