Skip to:
Content

bbPress.org

Changeset 4484


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

Extract:

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

Legend:

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

    r4483 r4484  
    15791579    function bbp_get_the_content( $args = array() ) {
    15801580
    1581         // Default arguments
    1582         $defaults = array(
     1581        // Parse arguments with default values
     1582        $r = bbp_parse_args( $args, array(
    15831583            'context'       => 'topic',
    15841584            'before'        => '<div class="bbp-the-content-wrapper">',
     
    15921592            'teeny'         => true,
    15931593            'quicktags'     => true
    1594         );
    1595         $r = bbp_parse_args( $args, $defaults, 'get_the_content' );
    1596         extract( $r );
     1594        ), 'get_the_content' );
    15971595
    15981596        // Assume we are not editing
     
    16031601
    16041602        // Output something before the editor
    1605         if ( !empty( $before ) )
    1606             echo $before;
     1603        if ( !empty( $r['before'] ) ) {
     1604            echo $r['before'];
     1605        }
    16071606
    16081607        // Get sanitized content
    1609         if ( bbp_is_edit() )
    1610             $post_content = call_user_func( 'bbp_get_form_' . $context . '_content' );
     1608        if ( bbp_is_edit() ) {
     1609            $post_content = call_user_func( 'bbp_get_form_' . $r['context'] . '_content' );
     1610        }
    16111611
    16121612        // Use TinyMCE if available
    16131613        if ( bbp_use_wp_editor() ) :
    1614             wp_editor( htmlspecialchars_decode( $post_content, ENT_QUOTES ), 'bbp_' . $context . '_content', array(
    1615                 'wpautop'       => $wpautop,
    1616                 'media_buttons' => $media_buttons,
    1617                 'textarea_rows' => $textarea_rows,
    1618                 'tabindex'      => $tabindex,
    1619                 'editor_class'  => $editor_class,
    1620                 'tinymce'       => $tinymce,
    1621                 'teeny'         => $teeny,
    1622                 'quicktags'     => $quicktags
     1614            wp_editor( htmlspecialchars_decode( $post_content, ENT_QUOTES ), 'bbp_' . $r['context'] . '_content', array(
     1615                'wpautop'       => $r['wpautop'],
     1616                'media_buttons' => $r['media_buttons'],
     1617                'textarea_rows' => $r['textarea_rows'],
     1618                'tabindex'      => $r['tabindex'],
     1619                'editor_class'  => $r['editor_class'],
     1620                'tinymce'       => $r['tinymce'],
     1621                'teeny'         => $r['teeny'],
     1622                'quicktags'     => $r['quicktags']
    16231623            ) );
    16241624
     
    16311631        else : ?>
    16321632
    1633             <textarea id="bbp_<?php echo esc_attr( $context ); ?>_content" class="<?php echo esc_attr( $editor_class ); ?>" name="bbp_<?php echo esc_attr( $context ); ?>_content" cols="60" rows="<?php echo esc_attr( $textarea_rows ); ?>" tabindex="<?php echo esc_attr( $tabindex ); ?>"><?php echo $post_content; ?></textarea>
     1633            <textarea id="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" class="<?php echo esc_attr( $r['editor_class'] ); ?>" name="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" cols="60" rows="<?php echo esc_attr( $r['textarea_rows'] ); ?>" tabindex="<?php echo esc_attr( $r['tabindex'] ); ?>"><?php echo $r['post_content']; ?></textarea>
    16341634
    16351635        <?php endif;
    16361636
    16371637        // Output something after the editor
    1638         if ( !empty( $after ) )
    1639             echo $after;
     1638        if ( !empty( $r['after'] ) ) {
     1639            echo $r['after'];
     1640        }
    16401641
    16411642        // Put the output into a usable variable
Note: See TracChangeset for help on using the changeset viewer.