1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<?php
namespace MatthiasWeb\RealMediaLibrary\comp;
use MatthiasWeb\RealMediaLibrary\general;
use MatthiasWeb\RealMediaLibrary\base;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
class PageBuilders extends base\Base {
private static $me = null;
private function __construct($root = null) {
}
public function init() {
if (class_exists("Tatsu_Builder")) {
$this->oshine_tatsu_builder();
}
if (defined('ELEMENTOR_VERSION')) {
$this->elementor();
}
if (class_exists("Cornerstone_Preview_Frame_Loader")) {
$this->cornerstone();
}
}
private function cornerstone() {
if ( ! isset( $_POST['cs_preview_state'] ) || ! $_POST['cs_preview_state'] || 'off' === $_POST['cs_preview_state'] ) {
return;
}
if ( ! isset( $_POST['_cs_nonce'] ) || ! wp_verify_nonce( $_POST['_cs_nonce'], 'cornerstone_nonce' ) ) {
return;
}
add_filter("print_head_scripts", array($this, 'cornerstone_print_head_scripts'), 0);
}
public function cornerstone_print_head_scripts($res) {
$this->getCore()->getAssets()->admin_enqueue_scripts();
return $res;
}
private function elementor() {
add_action('elementor/editor/before_enqueue_scripts', array($this->getCore()->getAssets(), 'admin_enqueue_scripts') );
}
private function oshine_tatsu_builder() {
add_action('tatsu_builder_head', array($this->getCore()->getAssets(), 'admin_enqueue_scripts') );
}
public static function getInstance() {
if (self::$me == null) {
self::$me = new PageBuilders();
}
return self::$me;
}
}
?>