PluginProbe ʕ •ᴥ•ʔ
Prime Slider Addons for Elementor / 4.0.8
Prime Slider Addons for Elementor v4.0.8
4.4.2 4.4.1 4.4.0 4.3.1 4.3.0 4.2.2 4.2.1 trunk 1.11.0 1.12.0 1.9.0 2.10.0 2.2.0 2.3.0 2.4.0 2.5.1 2.6.2 2.7.1 2.8.0 2.8.1 2.9.4 2.9.5 3.0.0 3.1.0 3.1.3 3.10.0 3.10.2 3.10.3 3.10.4 3.10.5 3.10.6 3.11.10 3.11.11 3.11.12 3.11.13 3.11.2 3.11.5 3.11.6 3.11.7 3.11.9 3.12.0 3.13.4 3.13.7 3.14.0 3.14.1 3.14.10 3.14.11 3.14.12 3.14.13 3.14.14 3.14.15 3.14.2 3.14.5 3.14.6 3.14.7 3.14.8 3.14.9 3.15.0 3.15.1 3.15.10 3.15.11 3.15.12 3.15.13 3.15.14 3.15.15 3.15.16 3.15.17 3.15.18 3.15.19 3.15.2 3.15.20 3.15.21 3.15.22 3.15.23 3.15.3 3.15.4 3.15.5 3.15.6 3.15.7 3.15.8 3.15.9 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.17.10 3.17.11 3.17.12 3.17.13 3.17.14 3.17.15 3.17.16 3.17.17 3.17.2 3.17.3 3.17.4 3.17.5 3.17.6 3.17.7 3.17.8 3.17.9 3.18.0 3.18.1 3.18.2 3.18.3 3.18.4 3.18.5 3.18.6 3.18.7 3.2.0 3.4.0 3.4.1 3.5.3 3.5.6 3.6.1 3.6.2 3.6.5 3.6.6 3.7.1 3.8.3 3.9.1 4.0.0 4.0.1 4.0.10 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.13 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.9 4.2.0
bdthemes-prime-slider-lite / loader.php
bdthemes-prime-slider-lite Last commit date
admin 7 months ago assets 7 months ago base 7 months ago includes 7 months ago languages 7 months ago modules 7 months ago traits 7 months ago .buildignore 7 months ago bdthemes-prime-slider.php 7 months ago loader.php 7 months ago readme.txt 7 months ago
loader.php
399 lines
1 <?php
2
3 namespace PrimeSlider;
4
5 use Elementor\Plugin;
6
7 if ( ! defined( 'ABSPATH' ) )
8 exit; // Exit if accessed directly
9
10 /**
11 * Main class for element pack
12 */
13 class Prime_Slider_Loader {
14
15 /**
16 * @var Prime_Slider_Loader
17 */
18 private static $_instance;
19
20 /**
21 * @var Manager
22 */
23 private $_modules_manager;
24
25 private $classes_aliases = [
26 'PrimeSlider\Modules\PanelPostsControl\Module' => 'PrimeSlider\Modules\QueryControl\Module',
27 'PrimeSlider\Modules\PanelPostsControl\Controls\Group_Control_Posts' => 'PrimeSlider\Modules\QueryControl\Controls\Group_Control_Posts',
28 'PrimeSlider\Modules\PanelPostsControl\Controls\Query' => 'PrimeSlider\Modules\QueryControl\Controls\Query',
29 ];
30
31 public $elements_data = [
32 'sections' => [],
33 'columns' => [],
34 'widgets' => [],
35 ];
36
37 /**
38 * @deprecated
39 *
40 * @return string
41 */
42 public function get_version() {
43 return BDTPS_CORE_VER;
44 }
45
46 /**
47 * Throw error on object clone
48 *
49 * The whole idea of the singleton design pattern is that there is a single
50 * object therefore, we don't want the object to be cloned.
51 *
52 * @since 1.0.0
53 * @return void
54 */
55 public function __clone() {
56 // Cloning instances of the class is forbidden
57 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'bdthemes-prime-slider' ), '1.6.0' );
58 }
59
60 /**
61 * Disable unserializing of the class
62 *
63 * @since 1.0.0
64 * @return void
65 */
66 public function __wakeup() {
67 // Unserializing instances of the class is forbidden
68 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'bdthemes-prime-slider' ), '1.6.0' );
69 }
70
71 /**
72 * @return Plugin
73 */
74
75 public static function elementor() {
76 return Plugin::$instance;
77 }
78
79 /**
80 * @return Prime_Slider_Loader
81 */
82 public static function instance() {
83 if ( is_null( self::$_instance ) ) {
84 self::$_instance = new self();
85 }
86
87 do_action( 'bdthemes_prime_slider_lite/init' );
88
89 return self::$_instance;
90 }
91
92 /**
93 * we loaded module manager + admin php from here
94 * @return [type] [description]
95 */
96 private function _includes() {
97 $duplicator = prime_slider_option( 'duplicator', 'prime_slider_other_settings', 'off' );
98 $live_copy = prime_slider_option( 'live-copy', 'prime_slider_other_settings', 'off' );
99
100 // Admin settings controller
101 require_once BDTPS_CORE_ADMIN_PATH . 'module-settings.php';
102 //Assets Manager
103 // require_once 'admin/optimizer/asset-minifier-manager.php';
104
105 // Dynamic Select control
106 require BDTPS_CORE_PATH . 'traits/query-controls/select-input/dynamic-select-input-module.php';
107 require BDTPS_CORE_PATH . 'traits/query-controls/select-input/dynamic-select.php';
108 // Global Controls
109 require_once BDTPS_CORE_PATH . 'traits/global-widget-controls.php';
110 //require_once BDTPS_CORE_PATH . 'traits/global-swiper-controls.php';
111 //require_once BDTPS_CORE_PATH . 'traits/global-mask-controls.php';
112
113 require BDTPS_CORE_PATH . 'includes/modules-manager.php';
114
115 if ( ! class_exists( 'BdThemes_Duplicator' ) ) {
116 if ( $duplicator == 'on' ) {
117 require BDTPS_CORE_PATH . 'includes/class-duplicator.php';
118 }
119 }
120
121 if ( ! class_exists( 'BdThemes_Live_Copy' ) ) {
122 if ( ( $live_copy == 'on' ) && ( ! is_plugin_active( 'live-copy-paste/live-copy-paste.php' ) ) ) {
123 require_once BDTPS_CORE_PATH . 'includes/live-copy/class-live-copy.php';
124 }
125 }
126 }
127
128 /**
129 * Autoloader function for all classes files
130 * @param [type] $class [description]
131 * @return [type] [description]
132 */
133 public function autoload( $class ) {
134 if ( 0 !== strpos( $class, __NAMESPACE__ ) ) {
135 return;
136 }
137
138 $has_class_alias = isset( $this->classes_aliases[ $class ] );
139
140 // Backward Compatibility: Save old class name for set an alias after the new class is loaded
141 if ( $has_class_alias ) {
142 $class_alias_name = $this->classes_aliases[ $class ];
143 $class_to_load = $class_alias_name;
144 } else {
145 $class_to_load = $class;
146 }
147
148 if ( ! class_exists( $class_to_load ) ) {
149 $filename = strtolower(
150 preg_replace(
151 [ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
152 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
153 $class_to_load
154 )
155 );
156 $filename = BDTPS_CORE_PATH . $filename . '.php';
157
158 if ( is_readable( $filename ) ) {
159 include( $filename );
160 }
161 }
162
163 if ( $has_class_alias ) {
164 class_alias( $class_alias_name, $class );
165 }
166 }
167
168 /**
169 * Register all script that need for any specific widget on call basis.
170 * @return [type] [description]
171 */
172 public function register_site_scripts() {
173
174 //TODO more attractive animation
175 //Thirdparty widgets
176 if ( prime_slider_is_widget_enabled( 'multiscroll' ) ) {
177 wp_register_script( 'jquery-multiscroll', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.multiscroll.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
178 wp_register_script( 'easings', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.easings.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
179 }
180 if ( prime_slider_is_widget_enabled( 'pagepiling' ) ) {
181 wp_register_script( 'jquery-pagepiling', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.pagepiling.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
182 }
183 if ( prime_slider_is_widget_enabled( 'knily' ) or prime_slider_is_third_party_enabled( 'woolamp' ) ) {
184 wp_register_script( 'bdt-goodshare', BDTPS_CORE_ASSETS_URL . 'vendor/js/goodshare.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
185 }
186
187 if ( prime_slider_is_third_party_enabled( 'woocircle' ) ) {
188 wp_register_script( 'classie', BDTPS_CORE_ASSETS_URL . 'vendor/js/classie.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
189 wp_register_script( 'dynamics', BDTPS_CORE_ASSETS_URL . 'vendor/js/dynamics.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
190 }
191 if ( prime_slider_is_widget_enabled( 'pieces' ) ) {
192 wp_register_script( 'pieces', BDTPS_CORE_ASSETS_URL . 'vendor/js/pieces.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
193 }
194 if ( prime_slider_is_widget_enabled( 'fortune' ) or prime_slider_is_widget_enabled( 'knily' ) or prime_slider_is_widget_enabled( 'storker' ) or prime_slider_is_widget_enabled( 'omatic' ) or prime_slider_is_widget_enabled( 'sniper' ) or prime_slider_is_widget_enabled( 'mercury' ) or prime_slider_is_widget_enabled( 'coddle' ) or prime_slider_is_widget_enabled( 'escape' ) or prime_slider_is_widget_enabled( 'titanic' ) or prime_slider_is_widget_enabled( 'woohotspot' ) ) {
195 wp_register_script( 'shutters', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-shutters.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
196 wp_register_script( 'gl', BDTPS_CORE_ASSETS_URL . 'vendor/js/swiper-gl.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
197 wp_register_script( 'slicer', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-slicer.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
198 wp_register_script( 'tinder', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-tinder.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
199 }
200 if ( prime_slider_is_widget_enabled( 'fluent' ) or prime_slider_is_widget_enabled( 'flogia' ) ) {
201 wp_register_script( 'mThumbnailScroller', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.mThumbnailScroller.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
202 }
203
204 wp_register_script( 'bdt-parallax', BDTPS_CORE_ASSETS_URL . 'vendor/js/parallax.min.js', [ 'jquery' ], null, true );
205
206 if ( prime_slider_is_widget_enabled( 'blog' )
207 || prime_slider_is_widget_enabled( 'dragon' )
208 || prime_slider_is_widget_enabled( 'flogia' )
209 || prime_slider_is_widget_enabled( 'general' )
210 || prime_slider_is_widget_enabled( 'isolate' )
211 || prime_slider_is_widget_enabled( 'mount' )
212 || prime_slider_is_widget_enabled( 'sequester' )
213 || prime_slider_is_widget_enabled( 'woocommerce' )
214 || prime_slider_is_widget_enabled( 'woolamp' )
215 || prime_slider_is_widget_enabled( 'fluent' ) // Pro widget
216 ) {
217 wp_register_script( 'ps-animation-helper', BDTPS_CORE_ASSETS_URL . 'js/ps-animation-helper.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
218 }
219
220 }
221
222 public function register_site_styles() {
223 $direction_suffix = is_rtl() ? '.rtl' : '';
224
225 wp_register_style( 'prime-slider-font', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-font' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
226
227 }
228
229 /**
230 * Loading site related style from here.
231 * @return [type] [description]
232 */
233 public function enqueue_site_styles() {
234
235 $direction_suffix = is_rtl() ? '.rtl' : '';
236
237 wp_register_style( 'bdt-uikit', BDTPS_CORE_ASSETS_URL . 'css/bdt-uikit' . $direction_suffix . '.css', [], '3.21.7' );
238 wp_register_style( 'prime-slider-site', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-site' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
239 wp_register_style( 'splitting', BDTPS_CORE_ASSETS_URL . 'vendor/css/splitting' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
240
241 wp_enqueue_style( 'bdt-uikit' );
242 wp_enqueue_style( 'prime-slider-site' );
243 }
244
245
246 /**
247 * Loading site related script that needs all time such as uikit.
248 * @return [type] [description]
249 */
250 public function enqueue_site_scripts() {
251
252 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '.min';
253
254 wp_register_script( 'bdt-uikit', BDTPS_CORE_ASSETS_URL . 'js/bdt-uikit.min.js', [ 'jquery' ], '3.21.7' );
255 wp_register_script( 'prime-slider-site', BDTPS_CORE_ASSETS_URL . 'js/prime-slider-site' . $suffix . '.js', [ 'jquery' ], BDTPS_CORE_VER, true );
256
257 wp_enqueue_script( 'bdt-uikit' );
258 wp_enqueue_script( 'prime-slider-site' );
259 }
260
261 public function enqueue_editor_scripts() {
262
263 wp_register_script( 'ps-editor', BDTPS_CORE_ASSETS_URL . 'js/prime-slider-editor.min.js', [
264 'backbone-marionette',
265 'elementor-common-modules',
266 'elementor-editor-modules',
267 ], BDTPS_CORE_VER, true );
268
269 wp_enqueue_script( 'ps-editor' );
270
271 $_is_ps_pro_activated = false;
272 if ( function_exists( 'ps_license_validation' ) && true === ps_license_validation() ) {
273 $_is_ps_pro_activated = true;
274 }
275
276 $localize_data = [
277 'pro_installed' => _is_ps_pro_activated(),
278 'pro_license_activated' => $_is_ps_pro_activated,
279 'promotional_widgets' => [],
280 ];
281
282 if ( ! $_is_ps_pro_activated ) {
283 $pro_widget_map = new \PrimeSlider\Includes\Pro_Widget_Map();
284 $localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map();
285 }
286
287 wp_localize_script( 'ps-editor', 'PrimeSliderConfigEditor', $localize_data );
288 }
289
290 /**
291 * Load editor editor related style from here
292 * @return [type] [description]
293 */
294 public function enqueue_preview_styles() {
295 $direction_suffix = is_rtl() ? '.rtl' : '';
296
297 wp_register_style( 'prime-slider-preview', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-preview' . $direction_suffix . '.css', array(), BDTPS_CORE_VER );
298
299 wp_enqueue_style( 'prime-slider-preview' );
300 }
301
302
303 public function enqueue_editor_styles() {
304 $direction_suffix = is_rtl() ? '-rtl' : '';
305
306 wp_register_style( 'prime-slider-editor', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-editor' . $direction_suffix . '.css', array(), BDTPS_CORE_VER );
307 wp_register_style( 'prime-slider-font', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-font' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
308
309 wp_enqueue_style( 'prime-slider-editor' );
310 wp_enqueue_style( 'prime-slider-font' );
311 }
312
313
314 public function enqueue_admin_scripts() {
315 wp_register_script( 'ps-biggopti', BDTPS_CORE_ADMIN_URL . 'assets/js/ps-biggopti.js', [ 'jquery' ], BDTPS_CORE_VER, true );
316 $script_config = [
317 'ajaxurl' => admin_url( 'admin-ajax.php' ),
318 'nonce' => wp_create_nonce( 'prime-slider' ),
319 ];
320 wp_localize_script( 'ps-biggopti', 'PrimeSliderBiggoptiConfig', $script_config );
321
322 wp_enqueue_script( 'ps-biggopti' );
323 }
324
325
326 /**
327 * initialize the category
328 * @return [type] [description]
329 */
330 public function prime_slider_init() {
331 $this->_modules_manager = new Manager();
332 do_action( 'bdthemes_prime_slider/init' );
333 }
334
335 /**
336 * initialize the category
337 */
338 public function category_register() {
339 $elementor = Plugin::$instance;
340
341 // Add element category in panel
342 $elementor->elements_manager->add_category( BDTPS_CORE_SLUG, [ 'title' => BDTPS_CORE_TITLE, 'icon' => 'font' ] );
343 }
344
345 private function setup_hooks() {
346 add_action( 'elementor/elements/categories_registered', [ $this, 'category_register' ] );
347 add_action( 'elementor/init', [ $this, 'prime_slider_init' ] );
348 add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_styles' ] );
349
350 add_action( 'wp_enqueue_scripts', [ $this, 'register_site_styles' ], 99999 );
351 add_action( 'wp_enqueue_scripts', [ $this, 'register_site_scripts' ], 99999 );
352 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_site_styles' ], 99999 );
353 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_site_scripts' ], 99999 );
354
355 add_action( 'elementor/preview/enqueue_styles', [ $this, 'enqueue_preview_styles' ] );
356 add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] );
357
358
359 // load WordPress dashboard scripts
360 add_action( 'admin_init', [ $this, 'enqueue_admin_scripts' ] );
361 }
362
363 /**
364 * Load files on init
365 */
366 public function init() {
367 if ( is_admin() && ps_is_dashboard_enabled() ) {
368 require_once BDTPS_CORE_ADMIN_PATH . 'admin-biggopti.php';
369 require_once BDTPS_CORE_ADMIN_PATH . 'admin.php';
370 new Admin();
371 }
372 }
373
374 /**
375 * Prime_Slider_Loader constructor.
376 * @throws \Exception
377 */
378 private function __construct() {
379 // Register class automatically
380 spl_autoload_register( [ $this, 'autoload' ] );
381 // Include some backend files
382 $this->_includes();
383 // Finally hooked up all things here
384 $this->setup_hooks();
385
386 add_action( 'init', [ $this, 'init' ] );
387 }
388 }
389
390 if ( ! defined( 'BDTPS_CORE_TESTS' ) ) {
391 // In tests we run the instance manually.
392 Prime_Slider_Loader::instance();
393 }
394
395 // handy function for push data
396 function prime_slider_config() {
397 return Prime_Slider_Loader::instance();
398 }
399