PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.19.3
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.19.3
1.19.8 1.19.7 1.19.6 1.19.5 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.11.0 1.12.0 1.13.0 1.14.0 1.15.0 1.15.1 1.15.2 1.15.3 1.16.0 1.16.1 1.16.2 1.16.3 1.16.4 1.16.5 1.16.6 1.16.7 1.16.8 1.17.0 1.17.6 1.17.7 1.17.8 1.17.9 1.18.0 1.18.1 1.18.2 1.18.3 1.18.4 1.18.5 1.18.6 1.18.7 1.18.8 1.18.9 1.19.0 1.19.1 1.19.2 1.19.3 1.19.4 1.3.19 1.3.20 1.4.0 1.4.1 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.16 1.5.17 1.5.18 1.5.19 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.8.1 1.8.3 1.9.0 1.9.1 1.9.2
nitropack / classes / WordPress / Settings / BeaverBuilder.php
nitropack / classes / WordPress / Settings Last commit date
AutoPurge.php 4 months ago BeaverBuilder.php 4 months ago CPTOptimization.php 4 months ago CacheWarmup.php 3 months ago CartCache.php 4 months ago Components.php 4 months ago EditorClearCache.php 4 months ago GeneratePreview.php 7 months ago HTMLCompression.php 3 months ago Logger.php 4 months ago OptimizationLevel.php 3 months ago Optimizations.php 4 months ago PurgeCache.php 4 months ago Shortcodes.php 4 months ago StockRefresh.php 4 months ago Subscription.php 4 months ago SystemReport.php 4 months ago TestMode.php 4 months ago
BeaverBuilder.php
64 lines
1 <?php
2
3 namespace NitroPack\WordPress\Settings;
4 use NitroPack\WordPress\NitroPack;
5 use NitroPack\Integration\Plugin\BeaverBuilder as BeaverBuilderPlugin;
6
7 /**
8 * Sync Beaver Builder cache when purging NitroPack cache in class NitroPack\Integration\Plugin\BeaverBuilder
9 */
10 class BeaverBuilder {
11 /** @var string */
12 public $option_name;
13 public function __construct() {
14 add_action( 'wp_ajax_nitropack_set_bb_cache_purge_sync_ajax', [ $this, 'nitropack_set_bb_cache_purge_sync_ajax' ] );
15 $this->option_name = 'nitropack-bbCacheSyncPurge';
16 }
17
18 /**
19 * AJAX handler when toggling the setting in the Dashboard
20 * @return void
21 */
22 public function nitropack_set_bb_cache_purge_sync_ajax() {
23 nitropack_verify_ajax_nonce( $_REQUEST );
24 $option = (int) ! empty( $_POST["bbCachePurgeSyncStatus"] );
25 $updated = update_option( $this->option_name, $option );
26 if ( $updated ) {
27 NitroPack::getInstance()->getLogger()->notice( 'Beaver Builder Status is ' . ( $option === 1 ? 'enabled' : 'disabled' ) );
28 nitropack_json_and_exit( array( "type" => "success", "message" => nitropack_admin_toast_msgs( 'success' ), 'bbCacheSyncPurgeStatus' => $option ) );
29 } else {
30 NitroPack::getInstance()->getLogger()->error( 'Beaver Builder Status cannot be ' . ( $option === 1 ? 'enabled' : 'disabled' ) );
31 nitropack_json_and_exit( array(
32 "type" => "error",
33 "message" => nitropack_admin_toast_msgs( 'error' )
34 ) );
35 }
36 }
37
38 /**
39 * Renders the Beaver Builder option in the Dashboard if the plugin is active
40 * @return void
41 */
42 public function render() {
43 if ( BeaverBuilderPlugin::isActive() ) {
44 $beaver_setting = get_option( $this->option_name, 0 );
45 ?>
46 <div class="nitro-option" id="beaver-builder-widget">
47 <div class="nitro-option-main">
48 <div class="text-box">
49 <h6><span
50 id="detected-compression"><?php esc_html_e( 'Sync NitroPack Purge with Beaver Builder', 'nitropack' ); ?>
51 </span></h6>
52 <p>
53 <?php esc_html_e( 'When Beaver Builder cache is purged, NitroPack will perform a full cache purge keeping your site\'s content up-to-date.', 'nitropack' ); ?>
54 </p>
55 </div>
56 <?php $components = new Components();
57 $components->render_toggle( 'bb-purge-status', $beaver_setting );
58 ?>
59 </div>
60 </div>
61 <?php }
62 }
63 }
64