PHP 8.2.30
Preview: editor-assets-api.php Size: 1.76 KB
//proc/thread-self/root/home/byroehnu/geniuskidsacademy.org/wp-content/plugins/elementor/includes/editor-assets-api.php

<?php
namespace Elementor\Includes;

class EditorAssetsAPI {
	protected array $config;

	const ASSETS_DATA_TRANSIENT_KEY = 'ASSETS_DATA_TRANSIENT_KEY';

	const ASSETS_DATA_URL = 'ASSETS_DATA_URL';

	const ASSETS_DATA_KEY = 'ASSETS_DATA_KEY';

	public function __construct( array $config ) {
		$this->config = $config;
	}

	public function config( $key ): string {
		return $this->config[ $key ] ?? '';
	}

	public function get_assets_data( $force_request = false ): array {
		$assets_data = $this->get_transient( $this->config( static::ASSETS_DATA_TRANSIENT_KEY ) );

		if ( $force_request || false === $assets_data ) {
			$assets_data = $this->fetch_data();
			$this->set_transient( $this->config( static::ASSETS_DATA_TRANSIENT_KEY ), $assets_data, '+1 hour' );
		}

		return $assets_data;
	}

	private function fetch_data(): array {
		$response = wp_remote_get( $this->config( static::ASSETS_DATA_URL ) );

		if ( is_wp_error( $response ) ) {
			return [];
		}

		$data = json_decode( wp_remote_retrieve_body( $response ), true );

		if ( empty( $data[ $this->config( static::ASSETS_DATA_KEY ) ] ) || ! is_array( $data[ $this->config( static::ASSETS_DATA_KEY ) ] ) ) {
			return [];
		}

		return $data[ $this->config( static::ASSETS_DATA_KEY ) ];
	}

	private function get_transient( $cache_key ) {
		$cache = get_option( $cache_key );

		if ( empty( $cache['timeout'] ) ) {
			return false;
		}

		if ( current_time( 'timestamp' ) > $cache['timeout'] ) {
			return false;
		}

		return json_decode( $cache['value'], true );
	}

	private function set_transient( $cache_key, $value, $expiration = '+12 hours' ): bool {
		$data = [
			'timeout' => strtotime( $expiration, current_time( 'timestamp' ) ),
			'value' => wp_json_encode( $value ),
		];

		return update_option( $cache_key, $data, false );
	}
}

Directory Contents

Dirs: 11 × Files: 22

Name Size Perms Modified Actions
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
base DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
controls DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
elements DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
libraries DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
managers DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
settings DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
widgets DIR
- drwxr-xr-x 2026-03-16 08:30:56
Edit Download
8.61 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
9.79 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
2.99 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
10.96 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
2.70 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
15.89 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
1.76 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
8.48 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
62.53 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
39.13 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
2.57 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
11.16 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
2.81 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
15.60 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
7.69 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
4.16 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
7.81 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
8.91 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
17.00 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
3.44 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
9.99 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download
24.35 KB lrw-r--r-- 2026-02-04 08:59:27
Edit Download

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