Skip to:
Content

BuddyPress.org

Changeset 9741


Ignore:
Timestamp:
04/11/2015 11:07:06 AM (10 years ago)
Author:
djpaul
Message:

Core: move _bp_strip_spans_from_title() out of bp_modify_page_title().

The nested function was causing PHP Fatal Errors ("cannot redeclare") when WP's title functions were invoked more than once on the same screen.
This was introduced in r9732.

Fixes #6369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/src/bp-core/bp-core-filters.php

    r9734 r9741  
    541541    $displayed_user_name = bp_get_displayed_user_fullname();
    542542
    543     /**
    544      * Strip span tags out of title part strings.
    545      *
    546      * This is a temporary function for compatibility with WordPress versions
    547      * less than 4.0, and should be removed at a later date.
    548      *
    549      * @param  string $title_part
    550      * @return string
    551      */
    552     function _bp_strip_spans_from_title( $title_part = '' ) {
    553         $title = $title_part;
    554         $span = strpos( $title, '<span' );
    555         if ( false !== $span ) {
    556             $title = substr( $title, 0, $span - 1 );
    557         }
    558         return $title;
    559     }
    560 
    561543    // Displayed user
    562544    if ( ! empty( $displayed_user_name ) && ! is_404() ) {
     
    691673add_filter( 'bp_modify_page_title', 'convert_chars'   );
    692674add_filter( 'bp_modify_page_title', 'esc_html'        );
     675
     676/**
     677 * Strip span tags out of title part strings.
     678 *
     679 * This is a temporary function for compatibility with WordPress versions
     680 * less than 4.0, and should be removed at a later date.
     681 *
     682 * @param  string $title_part
     683 * @return string
     684 */
     685function _bp_strip_spans_from_title( $title_part = '' ) {
     686    $title = $title_part;
     687    $span = strpos( $title, '<span' );
     688    if ( false !== $span ) {
     689        $title = substr( $title, 0, $span - 1 );
     690    }
     691    return $title;
     692}
    693693
    694694/**
Note: See TracChangeset for help on using the changeset viewer.