Skip to:
Content

bbPress.org

Changeset 4483


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

Extract:

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

Legend:

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

    r4482 r4483  
    18831883        if ( empty( $args['home_text'] ) ) {
    18841884
    1885             // Set home text to page title
    18861885            $front_id = get_option( 'page_on_front' );
     1886
     1887            // Set home text to page title         
    18871888            if ( !empty( $front_id ) ) {
    18881889                $pre_front_text = get_the_title( $front_id );
     
    19081909
    19091910        // Root slug is also the front page
    1910         if ( !empty( $front_id ) && ( $front_id == $root_id ) )
     1911        if ( !empty( $front_id ) && ( $front_id == $root_id ) ) {
    19111912            $pre_include_root = false;
     1913        }
    19121914
    19131915        // Don't show root if viewing forum archive
    1914         if ( bbp_is_forum_archive() )
     1916        if ( bbp_is_forum_archive() ) {
    19151917            $pre_include_root = false;
     1918        }
    19161919
    19171920        // Don't show root if viewing page in place of forum archive
    1918         if ( !empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id == get_the_ID() ) ) )
     1921        if ( !empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id == get_the_ID() ) ) ) {
    19191922            $pre_include_root = false;
     1923        }
    19201924
    19211925        /** Current Text ******************************************************/
     
    19711975
    19721976        // Parse args
    1973         $defaults = array(
     1977        $r = bbp_parse_args( $args, array(
    19741978
    19751979            // HTML
     
    20002004            'current_before'  => '<span class="bbp-breadcrumb-current">',
    20012005            'current_after'   => '</span>',
    2002         );
    2003         $r = bbp_parse_args( $args, $defaults, 'get_breadcrumb' );
    2004         extract( $r );
     2006        ), 'get_breadcrumb' );
    20052007
    20062008        /** Ancestors *********************************************************/
    20072009
    20082010        // Get post ancestors
    2009         if ( is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit() )
     2011        if ( is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit() ) {
    20102012            $ancestors = array_reverse( (array) get_post_ancestors( get_the_ID() ) );
     2013        }
    20112014
    20122015        // Do we want to include a link to home?
    2013         if ( !empty( $include_home ) || empty( $home_text ) )
    2014             $crumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $home_text . '</a>';
     2016        if ( !empty( $r['include_home'] ) || empty( $r['home_text'] ) ) {
     2017            $crumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $r['home_text'] . '</a>';
     2018        }
    20152019
    20162020        // Do we want to include a link to the forum root?
    2017         if ( !empty( $include_root ) || empty( $root_text ) ) {
     2021        if ( !empty( $r['include_root'] ) || empty( $r['root_text'] ) ) {
    20182022
    20192023            // Page exists at root slug path, so use its permalink
     
    20282032
    20292033            // Add the breadcrumb
    2030             $crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $root_text . '</a>';
     2034            $crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $r['root_text'] . '</a>';
    20312035        }
    20322036
     
    20732077
    20742078        // Add current page to breadcrumb
    2075         if ( !empty( $include_current ) || empty( $pre_current_text ) )
    2076             $crumbs[] = $current_before . $current_text . $current_after;
     2079        if ( !empty( $r['include_current'] ) || empty( $r['pre_current_text'] ) ) {
     2080            $crumbs[] = $r['current_before'] . $r['current_text'] . $r['current_after'];
     2081        }
    20772082
    20782083        /** Separator *********************************************************/
    20792084
    20802085        // Wrap the separator in before/after before padding and filter
    2081         if ( ! empty( $sep ) )
    2082             $sep = $sep_before . $sep . $sep_after;
     2086        if ( ! empty( $r['sep'] ) ) {
     2087            $sep = $r['sep_before'] . $r['sep'] . $r['sep_after'];
     2088        }
    20832089
    20842090        // Pad the separator
    2085         if ( !empty( $pad_sep ) )
    2086             $sep = str_pad( $sep, strlen( $sep ) + ( (int) $pad_sep * 2 ), ' ', STR_PAD_BOTH );
     2091        if ( !empty( $r['pad_sep'] ) ) {
     2092            $sep = str_pad( $sep, strlen( $sep ) + ( (int) $r['pad_sep'] * 2 ), ' ', STR_PAD_BOTH );
     2093        }
    20872094
    20882095        /** Finish Up *********************************************************/
     
    20932100
    20942101        // Build the trail
    2095         $trail = !empty( $crumbs ) ? ( $before . $crumb_before . implode( $sep . $crumb_after . $crumb_before , $crumbs ) . $crumb_after . $after ) : '';
     2102        $trail = !empty( $crumbs ) ? ( $r['before'] . $r['crumb_before'] . implode( $sep . $r['crumb_after'] . $r['crumb_before'] , $crumbs ) . $r['crumb_after'] . $r['after'] ) : '';
    20962103
    20972104        return apply_filters( 'bbp_get_breadcrumb', $trail, $crumbs, $r );
Note: See TracChangeset for help on using the changeset viewer.