Ticket #5021: 5021.06.patch
File 5021.06.patch, 2.6 KB (added by , 11 years ago) |
---|
-
bp-core/bp-core-template-loader.php
function bp_buffer_template_part( $slug, $name = null, $echo = true ) { 207 207 208 208 bp_get_template_part( $slug, $name ); 209 209 210 // Remove 'bp_replace_the_content' filter to prevent infinite loops211 add_filter( 'the_content', 'bp_replace_the_content' );212 213 210 // Get the output buffer contents 214 211 $output = ob_get_contents(); 215 212 216 213 // Flush the output buffer 217 214 ob_end_clean(); 218 215 216 // Put all the filters back 217 bp_restore_all_filters( 'the_content' ); 218 219 219 // Echo or return the output buffer contents 220 220 if ( true === $echo ) { 221 221 echo $output; -
bp-core/bp-core-theme-compatibility.php
function bp_template_include_theme_compat( $template = '' ) { 528 528 // from the_content as late as possible. 529 529 add_action( 'loop_start', 'bp_theme_compat_main_loop_start', 9999 ); 530 530 531 // Hook to the end of the main post loop to restore all filters to532 // the_content as early as possible.533 add_action( 'loop_end', 'bp_theme_compat_main_loop_end', -9999 );534 535 531 // Add BuddyPress's head action to wp_head 536 532 if ( ! has_action( 'wp_head', 'bp_head' ) ) { 537 533 add_action( 'wp_head', 'bp_head' ); … … function bp_replace_the_content( $content = '' ) { 588 584 */ 589 585 function bp_theme_compat_main_loop_start() { 590 586 587 global $wp_query; 588 589 // Bail if there is more than one post in this loop, our page injection means 590 // there is only one post in the loop 591 if ( $wp_query->post_count > 1 ) 592 return; 593 594 // Prevent recursion 595 remove_action( 'loop_start', 'bp_theme_compat_main_loop_start', 9999 ); 596 591 597 // Bail if not the main query 592 598 if ( ! in_the_loop() ) 593 599 return; … … function bp_theme_compat_main_loop_start() { 599 605 add_filter( 'the_content', 'bp_replace_the_content' ); 600 606 } 601 607 602 /**603 * Helper function to conditionally toggle the_content filters in the main604 * query loop. Aids with theme compatibility.605 *606 * @since BuddyPress (1.8)607 * @internal Used only by theme compatibilty608 * @see bp_template_include_theme_compat()609 * @see bp_theme_compat_main_loop_start()610 */611 function bp_theme_compat_main_loop_end() {612 613 // Bail if not the main query614 if ( ! in_the_loop() )615 return;616 617 // Put all the filters back618 bp_restore_all_filters( 'the_content' );619 }620 621 608 /** Filters *******************************************************************/ 622 609 623 610 /**