# enteraddons/2.2.9/classes/Cache_Manager.php

Enter Addons – Ultimate Template Builder for Elementor, version 2.2.9. 58 lines.

- Page: https://pluginprobe.com/plugins/enteraddons/2.2.9/code/classes/Cache_Manager.php
- Raw: https://pluginprobe.com/plugins/enteraddons/2.2.9/raw/classes/Cache_Manager.php
- Modified: 2025-11-21T18:47:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/enteraddons/2.2.9/code/classes/Cache_Manager.php#L10-L20`.

```php
<?php
namespace Enteraddons\Classes;
/**
 * Enteraddons helper class
 *
 * @package     Enteraddons
 * @author      ThemeLooks
 * @copyright   2022 ThemeLooks
 * @license     GPL-2.0-or-later
 *
 *
 */
if( !defined( 'WPINC' ) ) {
    die;
}

class Cache_Manager {

	public static function init() {
		add_action( 'elementor/editor/after_save', [ __CLASS__, 'widgets_cache' ], 10, 2 );
		add_action( 'after_delete_post', [ __CLASS__, 'delete_cache' ] );
		add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueue_frontend' ] );
	}

	public static function widgets_cache( $post_id, $editor_data ) {
		$widgets = self::getWidgetsList( $editor_data );
		$Assets_Cache = new Assets_Cache( $post_id, $widgets );
		$Assets_Cache::putStyle();
	}

	public static function delete_cache( $post_id ) {
		$Assets_Cache = new Assets_Cache( $post_id );
		$Assets_Cache::deleteCacheFile();
	}

	public static function enqueue_frontend() {
		if( !\Enteraddons\Classes\Helper::is_elementor_edit_mode() ) {
			$Assets_Cache = new Assets_Cache( get_the_ID() );
			$Assets_Cache::enqueue();
		}
	}

	public static function getWidgetsList( $data ) {

		$widgets = [];
		foreach( new \RecursiveIteratorIterator( new \RecursiveArrayIterator( $data ), \RecursiveIteratorIterator::LEAVES_ONLY ) as $iteratorKey => $iteratorValue ){
			if( $iteratorKey == 'widgetType' ) {
				$widgets[] = self::purifyWidgetsName( $iteratorValue );
			}
		}
		return array_unique( $widgets );
	}

	public static function purifyWidgetsName( $string ) {
		return str_replace('enteraddons-', '', $string);
	}
} // End Class

```
