PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / trunk
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid vtrunk
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Controllers / DiviController.php
the-post-grid / app / Controllers Last commit date
Admin 1 month ago Api 1 month ago Blocks 2 months ago Hooks 1 month ago AjaxController.php 1 month ago BlocksController.php 1 month ago DiviController.php 1 year ago ElementorController.php 1 year ago GutenBergController.php 1 month ago PageTemplateController.php 2 years ago ScriptController.php 1 month ago ShortcodeController.php 5 months ago WidgetController.php 2 years ago
DiviController.php
135 lines
1 <?php
2 /**
3 * Elementor Controller class.
4 *
5 * @package RT_TPG
6 */
7
8 namespace RT\ThePostGrid\Controllers;
9
10 // Do not allow directly accessing this file.
11 use RT\ThePostGrid\Helpers\DiviFns;
12 use RT\ThePostGrid\Helpers\Fns;
13 use RT\ThePostGrid\Divi\Mudules\GridLayout;
14 use RT\ThePostGrid\Divi\Mudules\GridHoverLayout;
15 use RT\ThePostGrid\Divi\Mudules\ListLayout;
16 use RT\ThePostGrid\Divi\Utils\DiviEditorCss;
17 use RT\ThePostGrid\Divi\Utils\DiviFrontEndCss;
18
19 if (!defined('ABSPATH')) {
20 exit('This script cannot be accessed directly.');
21 }
22
23 if (!class_exists('DiviController')) :
24 /**
25 * Elementor Controller class.
26 */
27 class DiviController
28 {
29
30 protected $settings = [];
31 /**
32 * Version
33 *
34 * @var string
35 */
36 private $version;
37
38 /**
39 * Class constructor
40 */
41 public function __construct()
42 {
43 $this->version = defined('WP_DEBUG') && WP_DEBUG ? time() : RT_THE_POST_GRID_VERSION;
44 add_action('wp_enqueue_scripts', [$this, 'front_end_script'], 999999999);
45 add_action('et_builder_ready', [$this, 'load_modules'], 20);
46 add_action('wp_enqueue_scripts', [$this, 'tpg_et_builder_editor_enqueue'], 999999999);
47 add_action('admin_head', [$this, 'tpg_et_builder_archive_enqueue'], 999999999);
48 add_action('wp_head', [$this, 'css_prop_for_editor_front_end']);
49 }
50
51 public function load_modules()
52 {
53 if (!class_exists(\ET_Builder_Element::class)) {
54 return;
55 }
56
57 $modules = [
58 GridLayout::class,
59 GridHoverLayout::class,
60 ListLayout::class,
61 ];
62
63 if (defined('RT_TPG_PRO_VERSION') && version_compare(RT_TPG_PRO_VERSION, '7.8.0', '>')) {
64 $modules = apply_filters('rttpg_divi_modules', $modules);
65 }
66
67 foreach ($modules as $module_class) {
68 if (class_exists($module_class)) {
69 new $module_class();
70 }
71 }
72 }
73
74 public function front_end_script()
75 {
76 if (DiviFns::is_divi_builder_preview()) {
77 wp_enqueue_script(
78 'rttpg-divi-modules',
79 rtTPG()->get_assets_uri('divi/divi-modules.js'),
80 [
81 'jquery',
82 'react-dom',
83 'react',
84 'et_pb_media_library',
85 'wp-element',
86 'wp-i18n',
87 ],
88 $this->version,
89 true
90 );
91
92 wp_enqueue_style('rt-fontawsome');
93 wp_enqueue_style('rt-flaticon');
94 wp_enqueue_style('rt-tpg-block');
95 wp_enqueue_style('swiper');
96 wp_enqueue_script('rt-tpg');
97 wp_enqueue_script('rttpg-block-pro');
98
99 do_action('rttpg_divi_frontend_scripts');
100 }
101 }
102
103 /**
104 * Front-end tab css modify
105 *
106 * @return array
107 */
108 public function tpg_et_builder_editor_enqueue()
109 {
110 if (wp_style_is('et-frontend-builder')) {
111 $custom_css = DiviEditorCss::editor_css();
112 wp_add_inline_style('et-frontend-builder', $custom_css);
113 }
114 }
115
116 public function tpg_et_builder_archive_enqueue()
117 {
118 $custom_css = DiviEditorCss::editor_css();
119 if (DiviFns::is_divi_builder_preview()) {
120 echo "<style>{$custom_css}</style>";
121 }
122 }
123
124 public function css_prop_for_editor_front_end()
125 {
126 if (DiviFns::is_divi_builder_preview()) {
127 ?>
128 <script>window.tpgDiviLayoutCSS =<?php echo wp_json_encode(DiviFrontEndCss::css_collection()); ?></script>
129 <?php
130 }
131 }
132
133 }
134 endif;
135