PHP 8.2.30
Preview: bbpress.cls.php Size: 2.33 KB
//usr/src/litespeed-wp-plugin/7.3.0.1/litespeed-cache/thirdparty/bbpress.cls.php

<?php
/**
 * The Third Party integration with the bbPress plugin.
 *
 * @since       1.0.5
 */
namespace LiteSpeed\Thirdparty;

defined('WPINC') || exit();

use LiteSpeed\Router;

class BBPress {

	/**
	 * Detect if bbPress is installed and if the page is a bbPress page.
	 *
	 * @since 1.0.5
	 * @access public
	 */
	public static function detect() {
		if (function_exists('is_bbpress')) {
			add_action('litespeed_api_purge_post', __CLASS__ . '::on_purge'); // todo
			if (apply_filters('litespeed_esi_status', false)) {
				// don't consider private cache yet (will do if any feedback)
				add_action('litespeed_control_finalize', __CLASS__ . '::set_control');
			}
		}
	}

	/**
	 * This filter is used to let the cache know if a page is cacheable.
	 *
	 * @access public
	 * @since 1.2.0
	 */
	public static function set_control() {
		if (!apply_filters('litespeed_control_cacheable', false)) {
			return;
		}

		// set non ESI public
		if (is_bbpress() && Router::is_logged_in()) {
			do_action('litespeed_control_set_nocache', 'bbpress nocache due to loggedin');
		}
	}

	/**
	 * When a bbPress page is purged, need to purge the forums list and
	 * any/all ancestor pages.
	 *
	 * @since 1.0.5
	 * @access public
	 * @param integer $post_id The post id of the page being purged.
	 */
	public static function on_purge( $post_id ) {
		if (!is_bbpress()) {
			if (!function_exists('bbp_is_forum') || !function_exists('bbp_is_topic') || !function_exists('bbp_is_reply')) {
				return;
			}
			if (!bbp_is_forum($post_id) && !bbp_is_topic($post_id) && !bbp_is_reply($post_id)) {
				return;
			}
		}

		// Need to purge base forums page, bbPress page was updated.
		do_action('litespeed_purge_posttype', bbp_get_forum_post_type());
		$ancestors = get_post_ancestors($post_id);

		// If there are ancestors, need to purge them as well.
		if (!empty($ancestors)) {
			foreach ($ancestors as $ancestor) {
				do_action('litespeed_purge_post', $ancestor);
			}
		}

		global $wp_widget_factory;
		$replies_widget = $wp_widget_factory->get_widget_object('BBP_Replies_Widget');
		if (bbp_is_reply($post_id) && $replies_widget) {
			do_action('litespeed_purge_widget', $replies_widget->id);
		}

		$topic_widget = $wp_widget_factory->get_widget_object('BBP_Topics_Widget');
		if (bbp_is_topic($post_id) && $topic_widget) {
			do_action('litespeed_purge_widget', $topic_widget->id);
		}
	}
}

Directory Contents

Dirs: 0 × Files: 30

Name Size Perms Modified Actions
1.81 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
1.89 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
736 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
651 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
2.33 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
946 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
408 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
2.21 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
1.61 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
1.46 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
691 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
525 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
4.63 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
6.23 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
663 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
875 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
524 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
653 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
940 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
603 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
24.39 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
3.50 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download
182 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
484 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
612 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
804 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
693 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
633 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
708 B lrw-r--r-- 2025-07-30 23:05:04
Edit Download
4.34 KB lrw-r--r-- 2025-07-30 23:05:04
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).