PluginProbe ʕ •ᴥ•ʔ
Prime Slider Addons for Elementor / 4.4.1
Prime Slider Addons for Elementor v4.4.1
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 2 weeks ago assets 2 weeks ago base 2 weeks ago includes 2 weeks ago languages 2 weeks ago modules 2 weeks ago traits 2 weeks ago .buildignore 2 weeks ago bdthemes-prime-slider.php 2 weeks ago loader.php 2 weeks ago readme.txt 2 weeks ago
loader.php
399 lines
1 <?php
2
3 namespace PrimeSlider;
4
5 use Elementor\Plugin;
6 use PrimeSlider\Includes\PrimeSlider_WPML;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12 /**
13 * Main class for element pack
14 */
15 class Prime_Slider_Loader {
16
17 /**
18 * @var Prime_Slider_Loader
19 */
20 private static $_instance;
21
22 /**
23 * @var Manager
24 */
25 private $_modules_manager;
26
27 private $classes_aliases = [
28 'PrimeSlider\Modules\PanelPostsControl\Module' => 'PrimeSlider\Modules\QueryControl\Module',
29 'PrimeSlider\Modules\PanelPostsControl\Controls\Group_Control_Posts' => 'PrimeSlider\Modules\QueryControl\Controls\Group_Control_Posts',
30 'PrimeSlider\Modules\PanelPostsControl\Controls\Query' => 'PrimeSlider\Modules\QueryControl\Controls\Query',
31 ];
32
33 public $elements_data = [
34 'sections' => [],
35 'columns' => [],
36 'widgets' => [],
37 ];
38
39 /**
40 * @deprecated
41 *
42 * @return string
43 */
44 public function get_version() {
45 return BDTPS_CORE_VER;
46 }
47
48 /**
49 * Throw error on object clone
50 *
51 * The whole idea of the singleton design pattern is that there is a single
52 * object therefore, we don't want the object to be cloned.
53 *
54 * @since 1.0.0
55 * @return void
56 */
57 public function __clone() {
58 // Cloning instances of the class is forbidden
59 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'bdthemes-prime-slider' ), '1.6.0' );
60 }
61
62 /**
63 * Disable unserializing of the class
64 *
65 * @since 1.0.0
66 * @return void
67 */
68 public function __wakeup() {
69 // Unserializing instances of the class is forbidden
70 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'bdthemes-prime-slider' ), '1.6.0' );
71 }
72
73 /**
74 * @return Plugin
75 */
76
77 public static function elementor() {
78 return Plugin::$instance;
79 }
80
81 /**
82 * @return Prime_Slider_Loader
83 */
84 public static function instance() {
85 if ( is_null( self::$_instance ) ) {
86 self::$_instance = new self();
87 }
88
89 do_action( 'bdthemes_prime_slider_lite/init' );
90
91 return self::$_instance;
92 }
93
94 /**
95 * we loaded module manager + admin php from here
96 * @return [type] [description]
97 */
98 private function _includes() {
99 $duplicator = prime_slider_option( 'duplicator', 'prime_slider_other_settings', 'off' );
100 $live_copy = prime_slider_option( 'live-copy', 'prime_slider_other_settings', 'off' );
101
102 // Admin settings controller
103 require_once BDTPS_CORE_ADMIN_PATH . 'module-settings.php';
104 //Assets Manager
105 // require_once 'admin/optimizer/asset-minifier-manager.php';
106
107 // Dynamic Select control
108 require BDTPS_CORE_PATH . 'traits/query-controls/select-input/dynamic-select-input-module.php';
109 require BDTPS_CORE_PATH . 'traits/query-controls/select-input/dynamic-select.php';
110 // Global Controls
111 require_once BDTPS_CORE_PATH . 'traits/global-widget-controls.php';
112 //require_once BDTPS_CORE_PATH . 'traits/global-swiper-controls.php';
113 //require_once BDTPS_CORE_PATH . 'traits/global-mask-controls.php';
114
115 // wpml compatibility class for wpml support
116 require_once BDTPS_CORE_PATH . 'includes/class-elements-wpml-compatibility.php';
117
118 require BDTPS_CORE_PATH . 'includes/modules-manager.php';
119
120 if ( ! class_exists( 'BdThemes_Duplicator' ) ) {
121 if ( $duplicator == 'on' ) {
122 require BDTPS_CORE_PATH . 'includes/class-duplicator.php';
123 }
124 }
125
126 if ( ! class_exists( 'BdThemes_Live_Copy' ) ) {
127 if ( ( $live_copy == 'on' ) && ( ! is_plugin_active( 'live-copy-paste/live-copy-paste.php' ) ) ) {
128 require_once BDTPS_CORE_PATH . 'includes/live-copy/class-live-copy.php';
129 }
130 }
131 }
132
133 // Load WPML compatibility instance
134 public function wpml_compatiblity() {
135 return PrimeSlider_WPML::get_instance();
136 }
137
138 /**
139 * Autoloader function for all classes files
140 * @param [type] $class [description]
141 * @return [type] [description]
142 */
143 public function autoload( $class ) {
144 if ( 0 !== strpos( $class, __NAMESPACE__ ) ) {
145 return;
146 }
147
148 $has_class_alias = isset( $this->classes_aliases[ $class ] );
149
150 // Backward Compatibility: Save old class name for set an alias after the new class is loaded
151 if ( $has_class_alias ) {
152 $class_alias_name = $this->classes_aliases[ $class ];
153 $class_to_load = $class_alias_name;
154 } else {
155 $class_to_load = $class;
156 }
157
158 if ( ! class_exists( $class_to_load ) ) {
159 $filename = strtolower(
160 preg_replace(
161 [ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
162 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
163 $class_to_load
164 )
165 );
166 $filename = BDTPS_CORE_PATH . $filename . '.php';
167
168 if ( is_readable( $filename ) ) {
169 include( $filename );
170 }
171 }
172
173 if ( $has_class_alias ) {
174 class_alias( $class_alias_name, $class );
175 }
176 }
177
178 /**
179 * Register all script that need for any specific widget on call basis.
180 * @return [type] [description]
181 */
182 public function register_site_scripts() {
183
184 //TODO more attractive animation
185 //Thirdparty widgets
186 if ( prime_slider_is_widget_enabled( 'multiscroll' ) ) {
187 wp_register_script( 'jquery-multiscroll', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.multiscroll.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
188 wp_register_script( 'easings', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.easings.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
189 }
190 if ( prime_slider_is_widget_enabled( 'pagepiling' ) ) {
191 wp_register_script( 'jquery-pagepiling', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.pagepiling.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
192 }
193 if ( prime_slider_is_widget_enabled( 'knily' ) or prime_slider_is_third_party_enabled( 'woolamp' ) ) {
194 wp_register_script( 'bdt-goodshare', BDTPS_CORE_ASSETS_URL . 'vendor/js/goodshare.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
195 }
196
197 if ( prime_slider_is_third_party_enabled( 'woocircle' ) ) {
198 wp_register_script( 'classie', BDTPS_CORE_ASSETS_URL . 'vendor/js/classie.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
199 wp_register_script( 'dynamics', BDTPS_CORE_ASSETS_URL . 'vendor/js/dynamics.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
200 }
201 if ( prime_slider_is_widget_enabled( 'pieces' ) ) {
202 wp_register_script( 'pieces', BDTPS_CORE_ASSETS_URL . 'vendor/js/pieces.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
203 }
204 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' ) ) {
205 wp_register_script( 'shutters', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-shutters.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
206 wp_register_script( 'gl', BDTPS_CORE_ASSETS_URL . 'vendor/js/swiper-gl.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
207 wp_register_script( 'slicer', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-slicer.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
208 wp_register_script( 'tinder', BDTPS_CORE_ASSETS_URL . 'vendor/js/effect-tinder.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
209 }
210 if ( prime_slider_is_widget_enabled( 'fluent' ) or prime_slider_is_widget_enabled( 'flogia' ) ) {
211 wp_register_script( 'mThumbnailScroller', BDTPS_CORE_ASSETS_URL . 'vendor/js/jquery.mThumbnailScroller.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
212 }
213
214 wp_register_script( 'bdt-parallax', BDTPS_CORE_ASSETS_URL . 'vendor/js/parallax.min.js', [ 'jquery' ], null, true );
215
216 if ( prime_slider_is_widget_enabled( 'blog' )
217 || prime_slider_is_widget_enabled( 'dragon' )
218 || prime_slider_is_widget_enabled( 'flogia' )
219 || prime_slider_is_widget_enabled( 'general' )
220 || prime_slider_is_widget_enabled( 'isolate' )
221 || prime_slider_is_widget_enabled( 'mount' )
222 || prime_slider_is_widget_enabled( 'sequester' )
223 || prime_slider_is_widget_enabled( 'woocommerce' )
224 || prime_slider_is_widget_enabled( 'woolamp' )
225 || prime_slider_is_widget_enabled( 'fluent' ) // Pro widget
226 ) {
227 wp_register_script( 'ps-animation-helper', BDTPS_CORE_ASSETS_URL . 'js/ps-animation-helper.min.js', [ 'jquery' ], BDTPS_CORE_VER, true );
228 }
229
230 }
231
232 public function register_site_styles() {
233 $direction_suffix = is_rtl() ? '.rtl' : '';
234
235 wp_register_style( 'prime-slider-font', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-font' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
236
237 }
238
239 /**
240 * Loading site related style from here.
241 * @return [type] [description]
242 */
243 public function enqueue_site_styles() {
244
245 $direction_suffix = is_rtl() ? '.rtl' : '';
246
247 wp_register_style( 'bdt-uikit', BDTPS_CORE_ASSETS_URL . 'css/bdt-uikit' . $direction_suffix . '.css', [], '3.21.7' );
248 wp_register_style( 'prime-slider-site', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-site' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
249 wp_register_style( 'splitting', BDTPS_CORE_ASSETS_URL . 'vendor/css/splitting' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
250
251 wp_enqueue_style( 'bdt-uikit' );
252 wp_enqueue_style( 'prime-slider-site' );
253 }
254
255
256 /**
257 * Loading site related script that needs all time such as uikit.
258 * @return [type] [description]
259 */
260 public function enqueue_site_scripts() {
261
262 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '.min';
263
264 wp_register_script( 'bdt-uikit', BDTPS_CORE_ASSETS_URL . 'js/bdt-uikit.min.js', [ 'jquery' ], '3.21.7' );
265 wp_register_script( 'prime-slider-site', BDTPS_CORE_ASSETS_URL . 'js/prime-slider-site' . $suffix . '.js', [ 'jquery' ], BDTPS_CORE_VER, true );
266
267 wp_enqueue_script( 'bdt-uikit' );
268 wp_enqueue_script( 'prime-slider-site' );
269 }
270
271 public function enqueue_editor_scripts() {
272
273 wp_register_script( 'ps-editor', BDTPS_CORE_ASSETS_URL . 'js/prime-slider-editor.min.js', [
274 'backbone-marionette',
275 'elementor-common-modules',
276 'elementor-editor-modules',
277 ], BDTPS_CORE_VER, true );
278
279 wp_enqueue_script( 'ps-editor' );
280
281 $_is_ps_pro_activated = false;
282 if ( function_exists( 'ps_license_validation' ) && true === ps_license_validation() ) {
283 $_is_ps_pro_activated = true;
284 }
285
286 $localize_data = [
287 'pro_installed' => _is_ps_pro_activated(),
288 'pro_license_activated' => $_is_ps_pro_activated,
289 'promotional_widgets' => [],
290 ];
291
292 if ( ! $_is_ps_pro_activated ) {
293 $pro_widget_map = new \PrimeSlider\Includes\Pro_Widget_Map();
294 $localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map();
295 }
296
297 wp_localize_script( 'ps-editor', 'PrimeSliderConfigEditor', $localize_data );
298 }
299
300 /**
301 * Load editor editor related style from here
302 * @return [type] [description]
303 */
304 public function enqueue_preview_styles() {
305 $direction_suffix = is_rtl() ? '.rtl' : '';
306
307 wp_register_style( 'prime-slider-preview', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-preview' . $direction_suffix . '.css', array(), BDTPS_CORE_VER );
308
309 wp_enqueue_style( 'prime-slider-preview' );
310 }
311
312
313 public function enqueue_editor_styles() {
314 $direction_suffix = is_rtl() ? '-rtl' : '';
315
316 wp_register_style( 'prime-slider-editor', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-editor' . $direction_suffix . '.css', array(), BDTPS_CORE_VER );
317 wp_register_style( 'prime-slider-font', BDTPS_CORE_ASSETS_URL . 'css/prime-slider-font' . $direction_suffix . '.css', [], BDTPS_CORE_VER );
318
319 wp_enqueue_style( 'prime-slider-editor' );
320 wp_add_inline_style(
321 'prime-slider-editor',
322 '#elementor-panel{--ps-pro-control-message:' . wp_json_encode( __( 'This is a pro control, available with Prime Slider Pro version.', 'bdthemes-prime-slider' ) ) . ';}'
323 );
324 wp_enqueue_style( 'prime-slider-font' );
325 }
326
327 /**
328 * initialize the category
329 * @return [type] [description]
330 */
331 public function prime_slider_init() {
332 $this->_modules_manager = new Manager();
333 do_action( 'bdthemes_prime_slider/init' );
334 }
335
336 /**
337 * initialize the category
338 */
339 public function category_register() {
340 $elementor = Plugin::$instance;
341
342 // Add element category in panel
343 $elementor->elements_manager->add_category( BDTPS_CORE_SLUG, [ 'title' => BDTPS_CORE_TITLE, 'icon' => 'font' ] );
344 }
345
346 private function setup_hooks() {
347 add_action( 'elementor/elements/categories_registered', [ $this, 'category_register' ] );
348 add_action( 'elementor/init', [ $this, 'prime_slider_init' ] );
349 add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_styles' ] );
350
351 add_action( 'wp_enqueue_scripts', [ $this, 'register_site_styles' ], 99999 );
352 add_action( 'wp_enqueue_scripts', [ $this, 'register_site_scripts' ], 99999 );
353 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_site_styles' ], 99999 );
354 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_site_scripts' ], 99999 );
355
356 add_action( 'elementor/preview/enqueue_styles', [ $this, 'enqueue_preview_styles' ] );
357 add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] );
358 }
359
360 /**
361 * Load files on init
362 */
363 public function init() {
364 if ( is_admin() && ps_is_dashboard_enabled() ) {
365 require_once BDTPS_CORE_ADMIN_PATH . 'admin-biggopti.php';
366 require_once BDTPS_CORE_ADMIN_PATH . 'admin-api-biggopti.php';
367 require_once BDTPS_CORE_ADMIN_PATH . 'admin.php';
368 new Admin();
369 }
370 }
371
372 /**
373 * Prime_Slider_Loader constructor.
374 * @throws \Exception
375 */
376 private function __construct() {
377 // Register class automatically
378 spl_autoload_register( [ $this, 'autoload' ] );
379 // Include some backend files
380 $this->_includes();
381 // Finally hooked up all things here
382 $this->setup_hooks();
383
384 $this->wpml_compatiblity()->init();
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