Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/litespee.../thirdpar...
File: bbpress.cls.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* The Third Party integration with the bbPress plugin.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 1.0.5
[4] Fix | Delete
* @package LiteSpeed
[5] Fix | Delete
* @subpackage LiteSpeed_Cache/thirdparty
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
namespace LiteSpeed\Thirdparty;
[9] Fix | Delete
[10] Fix | Delete
defined( 'WPINC' ) || exit;
[11] Fix | Delete
[12] Fix | Delete
use LiteSpeed\Router;
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Integration for bbPress cache handling and purging.
[16] Fix | Delete
*/
[17] Fix | Delete
class BBPress {
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Detect if bbPress is installed and if the page is a bbPress page.
[21] Fix | Delete
*
[22] Fix | Delete
* @since 1.0.5
[23] Fix | Delete
* @access public
[24] Fix | Delete
* @return void
[25] Fix | Delete
*/
[26] Fix | Delete
public static function detect() {
[27] Fix | Delete
if ( function_exists( 'is_bbpress' ) ) {
[28] Fix | Delete
add_action( 'litespeed_api_purge_post', __CLASS__ . '::on_purge' ); // todo
[29] Fix | Delete
if ( apply_filters( 'litespeed_esi_status', false ) ) {
[30] Fix | Delete
// Don't consider private cache yet (will do if any feedback)
[31] Fix | Delete
add_action( 'litespeed_control_finalize', __CLASS__ . '::set_control' );
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* This filter is used to let the cache know if a page is cacheable.
[38] Fix | Delete
*
[39] Fix | Delete
* @since 1.2.0
[40] Fix | Delete
* @access public
[41] Fix | Delete
* @return void
[42] Fix | Delete
*/
[43] Fix | Delete
public static function set_control() {
[44] Fix | Delete
if ( ! apply_filters( 'litespeed_control_cacheable', false ) ) {
[45] Fix | Delete
return;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
// Set non ESI public
[49] Fix | Delete
if ( is_bbpress() && Router::is_logged_in() ) {
[50] Fix | Delete
do_action( 'litespeed_control_set_nocache', 'bbpress nocache due to loggedin' );
[51] Fix | Delete
}
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* When a bbPress page is purged, need to purge the forums list and
[56] Fix | Delete
* any/all ancestor pages.
[57] Fix | Delete
*
[58] Fix | Delete
* @since 1.0.5
[59] Fix | Delete
* @access public
[60] Fix | Delete
* @param int $post_id The post id of the page being purged.
[61] Fix | Delete
* @return void
[62] Fix | Delete
*/
[63] Fix | Delete
public static function on_purge( $post_id ) {
[64] Fix | Delete
if ( ! is_bbpress() ) {
[65] Fix | Delete
if ( ! function_exists( 'bbp_is_forum' ) || ! function_exists( 'bbp_is_topic' ) || ! function_exists( 'bbp_is_reply' ) ) {
[66] Fix | Delete
return;
[67] Fix | Delete
}
[68] Fix | Delete
if ( ! bbp_is_forum( $post_id ) && ! bbp_is_topic( $post_id ) && ! bbp_is_reply( $post_id ) ) {
[69] Fix | Delete
return;
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
// Need to purge base forums page, bbPress page was updated.
[74] Fix | Delete
do_action( 'litespeed_purge_posttype', bbp_get_forum_post_type() );
[75] Fix | Delete
$ancestors = get_post_ancestors( $post_id );
[76] Fix | Delete
[77] Fix | Delete
// If there are ancestors, need to purge them as well.
[78] Fix | Delete
if ( ! empty( $ancestors ) ) {
[79] Fix | Delete
foreach ( $ancestors as $ancestor ) {
[80] Fix | Delete
do_action( 'litespeed_purge_post', $ancestor );
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
global $wp_widget_factory;
[85] Fix | Delete
$replies_widget = $wp_widget_factory->get_widget_object( 'BBP_Replies_Widget' );
[86] Fix | Delete
if ( bbp_is_reply( $post_id ) && $replies_widget ) {
[87] Fix | Delete
do_action( 'litespeed_purge_widget', $replies_widget->id );
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
$topic_widget = $wp_widget_factory->get_widget_object( 'BBP_Topics_Widget' );
[91] Fix | Delete
if ( bbp_is_topic( $post_id ) && $topic_widget ) {
[92] Fix | Delete
do_action( 'litespeed_purge_widget', $topic_widget->id );
[93] Fix | Delete
}
[94] Fix | Delete
}
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function