Skip to:
Content

bbPress.org

Changeset 4501


Ignore:
Timestamp:
11/24/2012 07:07:31 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Extract:

  • Remove unused BBP_Forum_Walker class, and bbp_walk_forum function, that use extract().
  • See #2056.
Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/classes.php

    r4333 r4501  
    174174
    175175if ( class_exists( 'Walker' ) ) :
    176 /**
    177  * Create HTML list of forums.
    178  *
    179  * @package bbPress
    180  * @subpackage Classes
    181  *
    182  * @since bbPress (r2514)
    183  *
    184  * @uses Walker
    185  */
    186 class BBP_Walker_Forum extends Walker {
    187 
    188         /**
    189          * @see Walker::$tree_type
    190          *
    191          * @since bbPress (r2514)
    192          *
    193          * @var string
    194          */
    195         var $tree_type;
    196 
    197         /**
    198          * @see Walker::$db_fields
    199          *
    200          * @since bbPress (r2514)
    201          *
    202          * @var array
    203          */
    204         var $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' );
    205 
    206         /** Methods ***************************************************************/
    207 
    208         /**
    209          * Set the tree_type
    210          *
    211          * @since bbPress (r2514)
    212          */
    213         public function __construct() {
    214                 $this->tree_type = bbp_get_forum_post_type();
    215         }
    216 
    217         /**
    218          * @see Walker::start_lvl()
    219          *
    220          * @since bbPress (r2514)
    221          *
    222          * @param string $output Passed by reference. Used to append additional
    223          *                        content.
    224          * @param int $depth Depth of page. Used for padding.
    225          */
    226         public function start_lvl( &$output, $depth ) {
    227                 $indent  = str_repeat( "\t", $depth );
    228                 $output .= "\n$indent<ul class='children'>\n";
    229         }
    230 
    231         /**
    232          * @see Walker::end_lvl()
    233          *
    234          * @since bbPress (r2514)
    235          *
    236          * @param string $output Passed by reference. Used to append additional
    237          *                        content.
    238          * @param int $depth Depth of page. Used for padding.
    239          */
    240         public function end_lvl( &$output, $depth ) {
    241                 $indent  = str_repeat( "\t", $depth );
    242                 $output .= "$indent</ul>\n";
    243         }
    244 
    245         /**
    246          * @see Walker::start_el()
    247          *
    248          * @since bbPress (r2514)
    249          *
    250          * @param string $output Passed by reference. Used to append additional
    251          *                        content.
    252          * @param object $forum Page data object.
    253          * @param int $depth Depth of page. Used for padding.
    254          * @param int $current_forum Page ID.
    255          * @param array $args
    256          */
    257         public function start_el( &$output, $forum, $depth, $args, $current_forum ) {
    258 
    259                 $indent = $depth ? str_repeat( "\t", $depth ) : '';
    260 
    261                 extract( $args, EXTR_SKIP );
    262                 $css_class = array( 'bbp-forum-item', 'bbp-forum-item-' . $forum->ID );
    263 
    264                 if ( !empty( $current_forum ) ) {
    265                         $_current_page = bbp_get_forum( $current_forum );
    266 
    267                         if ( isset( $_current_page->ancestors ) && in_array( $forum->ID, (array) $_current_page->ancestors ) )
    268                                 $css_class[] = 'bbp-current-forum-ancestor';
    269 
    270                         if ( $forum->ID == $current_forum )
    271                                 $css_class[] = 'bbp_current_forum_item';
    272                         elseif ( $_current_page && $forum->ID == $_current_page->post_parent )
    273                                 $css_class[] = 'bbp-current-forum-parent';
    274 
    275                 } elseif ( $forum->ID == get_option( 'page_for_posts' ) ) {
    276                         $css_class[] = 'bbp-current-forum-parent';
    277                 }
    278 
    279                 $css_class = implode( ' ', apply_filters( 'bbp_forum_css_class', $css_class, $forum ) );
    280                 $output .= $indent . '<li class="' . $css_class . '"><a href="' . bbp_get_forum_permalink( $forum->ID ) . '" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $forum->post_title, $forum->ID ) ) ) . '">' . $link_before . apply_filters( 'the_title', $forum->post_title, $forum->ID ) . $link_after . '</a>';
    281 
    282                 if ( !empty( $show_date ) ) {
    283                         $time    = ( 'modified' == $show_date ) ? $forum->post_modified : $time = $forum->post_date;
    284                         $output .= " " . mysql2date( $date_format, $time );
    285                 }
    286         }
    287 
    288         /**
    289          * @see Walker::end_el()
    290          *
    291          * @since bbPress (r2514)
    292          *
    293          * @param string $output Passed by reference. Used to append additional
    294          *                        content.
    295          * @param object $forum Page data object. Not used.
    296          * @param int $depth Depth of page. Not Used.
    297          */
    298         public function end_el( &$output, $forum, $depth ) {
    299                 $output .= "</li>\n";
    300         }
    301 }
    302 
    303176/**
    304177 * Create HTML dropdown list of bbPress forums/topics.
  • trunk/includes/forums/functions.php

    r4489 r4501  
    664664}
    665665
    666 /** Walk **********************************************************************/
    667 
    668 /**
    669  * Walk the forum tree
    670  *
    671  * @param object $forums Forums
    672  * @param int $depth Depth
    673  * @param int $current Current forum
    674  * @param array $r Parsed arguments, supported by the walker. If you want to
    675  *                  use your own walker, pass the 'walker' arg with the walker.
    676  *                  The walker defaults to {@link BBP_Walker_Forum}
    677  * @return object Walked forum tree
    678  */
    679 function bbp_walk_forum( $forums, $depth, $current, $r ) {
    680         $walker = empty( $r['walker'] ) ? new BBP_Walker_Forum : $r['walker'];
    681         $args   = array( $forums, $depth, $r, $current );
    682         return call_user_func_array( array( &$walker, 'walk' ), $args );
    683 }
    684 
    685666/** Forum Actions *************************************************************/
    686667
Note: See TracChangeset for help on using the changeset viewer.