HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: /volume1/web/wordpress/wp-content/brizy/compatibilities/astra-addon.php
<?php
/*
 * https://wpastra.com/changelog/astra-pro-addon/
 * */
class Brizy_Compatibilities_AstraAddon {

	public function __construct() {
		add_action( 'brizy_preview_enqueue_scripts', [ $this, 'preview_enqueue_scripts' ] );
	}

	public function preview_enqueue_scripts( Brizy_Editor_Post $editorPost ) {
		global $template;

		if ( is_singular( 'astra-advanced-hook' ) || ! strpos( $template, Brizy_Config::BRIZY_BLANK_TEMPLATE_FILE_NAME ) ) {
			return;
		}

		$postId = $editorPost->getWpPost()->ID;

		if ( ! in_array( get_post_meta( $postId, 'ast-advanced-hook-layout', true ), [ 'header', 'footer' ] ) ) {
			return;
		}

		Brizy_Public_AssetEnqueueManager::_init()->dequeuePost( $editorPost );
	}
}