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