PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.1.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.1.0
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / spider-elements.php
spider-elements Last commit date
assets 2 years ago includes 2 years ago languages 2 years ago widgets 2 years ago index.php 2 years ago readme.txt 1 year ago spider-elements.php 2 years ago
spider-elements.php
593 lines
1 <?php
2 /**
3 * Plugin Name: Spider Elements
4 * Requires Plugins: elementor
5 * Plugin URI: https://wordpress-plugins.spider-themes.net/spider-elements/
6 * Description: Spider Elements is a hassle-free addon bundle with super useful widgets for building beautiful websites. Plug and play to create stunning designs effortlessly.
7 * Version: 1.1.0
8 * Requires at least: 5.0
9 * Tested up to: 6.5.4
10 * Requires PHP: 7.4
11 * Author: spider-themes
12 * Author URI: https://spider-themes.net/spider-elements
13 * Domain Path: /languages
14 * License: GPL2 or later
15 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
16 * Text domain: spider-elements
17 * Elementor requires at least: 3.0.0
18 * Elementor tested up to: 3.20.3
19 */
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 /**
25 * SPEL class.
26 *
27 * The main class that initiates and runs the addon.
28 *
29 */
30 if (!class_exists('SPEL')) {
31
32 /**
33 * Class SPEL
34 */
35 final class SPEL {
36
37 /**
38 * Plugin Version
39 *
40 * Holds the version of the plugin.
41 *
42 * @var string The plugin version.
43 */
44 const VERSION = '1.1.0';
45
46 /**
47 * Minimum Elementor Version
48 *
49 * @var string Minimum Elementor version required to run the plugin.
50 */
51 const MINIMUM_ELEMENTOR_VERSION = '3.0.0';
52
53 /**
54 * Minimum PHP Version
55 *
56 * Holds the minimum PHP version required to run the plugin.
57 *
58 * @var string Minimum PHP version required to run the plugin.
59 */
60 const MINIMUM_PHP_VERSION = '7.4';
61
62
63 /**
64 * Instance
65 *
66 * Holds a single instance of the `SPEL` class.
67 *
68 * @access private
69 * @static
70 *
71 * @var SPEL A single instance of the class.
72 */
73 private static $_instance = null;
74
75
76 /**
77 * Instance
78 *
79 * Ensures only one instance of the class is loaded or can be loaded.
80 *
81 * @return SPEL An instance of the class.
82 * @since 1.7.0
83 *
84 * @access public
85 * @static
86 *
87 */
88 public static function instance() {
89 if ( is_null( self::$_instance ) ) {
90 self::$_instance = new self();
91 }
92
93 return self::$_instance;
94 }
95
96 /**
97 * Constructor
98 *
99 * Initialize the Spider Elements plugins.
100 *
101 */
102 public function __construct() {
103
104 // Include Files
105 $this->core_includes();
106
107 // define constants
108 $this->define_constants();
109
110 // Init Plugin
111 add_action('plugins_loaded', array( $this, 'init_plugin' ));
112
113 // Load text domain for localization
114 add_action('init', [ $this, 'i18n' ]);
115
116 // Register Category
117 add_action('elementor/elements/categories_registered', [ $this, 'elements_register_category' ]);
118
119 // Register widgets
120 add_action('elementor/widgets/register', [ $this, 'on_widgets_registered' ], 99 );
121
122 // Register Icon
123 add_filter('elementor/icons_manager/additional_tabs', [ $this, 'elegant_icons' ]);
124
125 }
126
127
128 /**
129 * Clone
130 *
131 * Disable class cloning.
132 *
133 * @return void
134 * @since 1.7.0
135 *
136 * @access protected
137 *
138 */
139 public function __clone() {
140 // Cloning instances of the class is forbidden
141 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'spider-elements' ), self::VERSION );
142 }
143
144
145 /**
146 * Wakeup
147 *
148 * Disable unserializing the class.
149 *
150 * @return void
151 * @since 1.7.0
152 *
153 * @access protected
154 *
155 */
156 public function __wakeup() {
157 // Un-serializing instances of the class is forbidden.
158 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'spider-elements' ), '1.7.0' );
159 }
160
161
162 /***
163 * Added Custom Font Icon Integrated Elementor Icon Library
164 */
165 public function elegant_icons( $custom_fonts ) {
166 $css_data = plugins_url( 'assets/vendors/elegant-icon/style.css', __FILE__ );
167 $json_data = plugins_url( 'assets/vendors/elegant-icon/eleganticons.json', __FILE__ );
168
169 $custom_fonts[ 'elegant-icon' ] = [
170 'name' => 'elegant-icon',
171 'label' => esc_html__( 'Elegant Icons', 'spider-elements' ),
172 'url' => $css_data,
173 'prefix' => '',
174 'displayPrefix' => '',
175 'labelIcon' => 'icon_star',
176 'ver' => '',
177 'fetchJson' => $json_data,
178 'native' => true,
179 ];
180
181 return $custom_fonts;
182 }
183
184
185 /**
186 * Include Files
187 *
188 * Load core files required to run the plugin.
189 *
190 * @since 1.7.0
191 *
192 * @access public
193 */
194 public function core_includes() {
195
196 // Extra functions
197 require_once __DIR__ . '/includes/extra.php';
198
199 require_once __DIR__ . '/includes/Admin/Module_Settings.php';
200
201 // Admin and Frontend Scripts Loaded
202 if ( is_admin() ) {
203 require_once __DIR__ . '/includes/Admin/Assets.php';
204 require_once __DIR__ . '/includes/Admin/Admin_Settings.php';
205 require_once __DIR__ . '/includes/classes/Plugin_Installer.php';
206 } else {
207 require_once __DIR__ . '/includes/Frontend/Assets.php';
208 }
209 }
210
211 /**
212 * Load Textdomain
213 *
214 * Load plugin localization files.
215 */
216 public function i18n() {
217 load_plugin_textdomain( 'spider-elements', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
218 }
219
220
221 /**
222 * Initialize the plugin
223 *
224 * Validates that Elementor is already loaded.
225 * Checks for basic plugin requirements, if one check fail don't continue,
226 * if all check have passed include the plugin class.
227 *
228 * Fired by `plugins_loaded` action hook.
229 *
230 * @access public
231 */
232 public function init_plugin() {
233
234 // Check if Elementor installed and activated
235 if ( ! did_action( 'elementor/loaded' ) ) {
236 add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] );
237
238 return;
239 }
240
241 // Check for required Elementor version
242 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
243 add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] );
244
245 return;
246 }
247
248 // Check for required PHP version
249 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
250 add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
251 }
252
253
254 if ( is_admin() ) {
255 //Admin
256 new SPEL\includes\Admin\Admin_Settings();
257
258 //Classes
259 new SPEL\includes\classes\Plugin_Installer();
260 }
261
262 }
263
264 /**
265 * Admin notice
266 *
267 * Warning when the site doesn't have Elementor installed or activated.
268 *
269 * @since 1.0.0
270 *
271 * @access public
272 */
273 public function admin_notice_missing_main_plugin() {
274
275 $screen = get_current_screen();
276 if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) {
277 return;
278 }
279
280 $plugin = 'elementor/elementor.php';
281 $plugin_name = esc_html__('Spider Elements', 'spider-elements');
282 $elementor_name = esc_html__('Elementor', 'spider-elements');
283 $installed_plugins = get_plugins();
284 $is_elementor_installed = isset($installed_plugins[ $plugin ]);
285
286 if ($is_elementor_installed) {
287 if (!current_user_can('activate_plugins')) {
288 return;
289 }
290 $button_text = esc_html__('Activate Elementor', 'spider-elements');
291 $button_link = wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s',
292 'activate-plugin_' . $plugin);
293 $message = sprintf(
294 /* translators: 1: Plugin name, 2: Elementor plugin name */
295 esc_html__('%1$s requires %2$s plugin to be active. Please activate the %2$s to continue.', 'spider-elements'),
296 '<strong>' . $plugin_name . '</strong>',
297 '<strong>' . $elementor_name . '</strong>'
298 );
299 } else {
300 if (!current_user_can('install_plugins')) {
301 return;
302 }
303 $button_text = esc_html__('Install Elementor', 'spider-elements');
304 $button_link = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'),
305 'install-plugin_elementor');
306 $message = sprintf(
307 /* translators: 1: Plugin name, 2: Elementor plugin name */
308 esc_html__('%1$s requires %2$s plugin to be installed and activated. Please install the %2$s to continue.', 'spider-elements'),
309 '<strong>' . $plugin_name . '</strong>',
310 '<strong>' . $elementor_name . '</strong>'
311 );
312 }
313
314 //Admin Notice
315 if (is_readable(__DIR__ . '/includes/Admin/notices.php')) {
316 require_once __DIR__ . '/includes/Admin/notices.php';
317 }
318
319 }
320
321 /**
322 * Admin notice
323 *
324 * Warning when the site doesn't have a minimum required Elementor version.
325 *
326 * @access public
327 */
328 public function admin_notice_minimum_elementor_version() {
329
330 if (isset($_GET['activate']) && isset($_GET['_wpnonce'])) {
331
332 // Ensure it's a valid action (optional, depending on your needs)
333 if ($_GET['activate'] === 'spider-elements-activation' && wp_verify_nonce($_GET['_wpnonce'], 'spider-elements-activation')) {
334
335 // After activation is complete, remove the 'activate' parameter
336 unset($_GET[ 'activate' ]);
337
338 // Redirect to a specific page after activation (optional)
339 wp_redirect(admin_url('admin.php?page=spider-elements-settings'));
340 exit;
341 }
342 }
343
344 $message = sprintf(
345 /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
346 esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'spider-elements'),
347 '<strong>' . esc_html__('Spider Elements', 'spider-elements') . '</strong>',
348 '<strong>' . esc_html__('Elementor', 'spider-elements') . '</strong>',
349 self::MINIMUM_ELEMENTOR_VERSION
350 );
351
352 printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses($message, ['strong' => [] ] ) );
353 }
354
355 /**
356 * Admin notice
357 *
358 * Warning when the site doesn't have a minimum required PHP version.
359 */
360 public function admin_notice_minimum_php_version() {
361
362 // Verify nonce
363 if (isset($_GET['activate']) && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'spider-elements-activation')) {
364
365 // After activation is complete, remove the 'activate' parameter
366 unset($_GET['activate']);
367
368 // Redirect to a specific page after activation (optional)
369 wp_redirect(admin_url('admin.php?page=spider-elements-settings'));
370 exit;
371 }
372
373 // Create nonce
374 $nonce = wp_create_nonce('spider-elements-activation');
375
376 // Activation URL with nonce
377 $activation_url = add_query_arg(array(
378 'page' => 'spider-elements-settings',
379 'activate' => 'spider-elements-activation',
380 'nonce' => $nonce
381 ), admin_url('admin.php'));
382
383 // Message about minimum PHP version
384 $message = sprintf(
385 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
386 esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'spider-elements'),
387 '<strong>' . esc_html__('Spider Elements', 'spider-elements') . '</strong>',
388 '<strong>' . esc_html__('PHP', 'spider-elements') . '</strong>',
389 self::MINIMUM_PHP_VERSION
390 );
391
392 // Display admin notice with activation link
393 printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p><p><a href="%2$s">%3$s</a></p></div>',
394 wp_kses($message, ['strong' => []]),
395 esc_url($activation_url),
396 esc_html__('Activate Now', 'spider-elements')
397 );
398 }
399
400
401 /**
402 * Add new Elementor Categories
403 *
404 * Register new widget categories for Spider Elements widgets.
405 */
406 public function elements_register_category ()
407 {
408
409 \Elementor\Plugin::instance()->elements_manager->add_category('spider-elements', [
410 'title' => esc_html__('Spider Elements', 'spider-elements'),
411 ], 1);
412
413 }
414
415 /**
416 * Register New Widgets
417 *
418 * Include Spider Elements widgets files and register them in Elementor.
419 *
420 * @since 1.0.0
421 *
422 * @access public
423 */
424 public function on_widgets_registered() {
425 $this->include_widgets();
426 $this->register_widgets();
427 }
428
429
430 /**
431 * Include Widgets files
432 *
433 * Load widgets files
434 *
435 * @since 1.2.0
436 * @access private
437 */
438 private function include_widgets() {
439
440 require_once( __DIR__ . '/widgets/Tabs.php' );
441 require_once( __DIR__ . '/widgets/Video_Playlist.php' );
442 require_once( __DIR__ . '/widgets/Alerts_Box.php' );
443 require_once( __DIR__ . '/widgets/Accordion.php' );
444 require_once( __DIR__ . '/widgets/Testimonial.php' );
445 require_once( __DIR__ . '/widgets/Pricing_Table_Tabs.php' );
446 require_once( __DIR__ . '/widgets/Pricing_Table_Switcher.php' );
447 require_once( __DIR__ . '/widgets/List_Item.php' );
448 require_once( __DIR__ . '/widgets/Cheat_sheet.php' );
449 require_once( __DIR__ . '/widgets/Team_Carousel.php' );
450 require_once( __DIR__ . '/widgets/Integrations.php' );
451 require_once( __DIR__ . '/widgets/Before_after.php' );
452 require_once( __DIR__ . '/widgets/Video_Popup.php' );
453 require_once( __DIR__ . '/widgets/Blog_Grid.php' );
454 require_once( __DIR__ . '/widgets/Skill_Showcase.php' );
455 require_once( __DIR__ . '/widgets/Timeline.php' );
456 require_once( __DIR__ . '/widgets/Buttons.php' );
457 require_once( __DIR__ . '/widgets/Animated_Heading.php' );
458 // require_once( __DIR__ . '/widgets/Marquee_Slides.php' );
459 require_once( __DIR__ . '/widgets/Counter.php' );
460 require_once( __DIR__ . '/widgets/Instagram.php' );
461 require_once( __DIR__ . '/widgets/Fullscreen_Slider.php' );
462 require_once( __DIR__ . '/widgets/Icon_box.php' );
463
464
465 }
466
467 /**
468 * Register Widgets
469 *
470 * Register new Elementor widgets.
471 *
472 * @since 1.0.0
473 *
474 * @access private
475 */
476 private function register_widgets() {
477
478 // Register each widget class
479 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
480 $elements_opt = get_option( 'spe_widget_settings' );
481
482 if ( isset( $elements_opt[ 'docy_accordion' ] ) && $elements_opt[ 'docy_accordion' ] == 'on' ) {
483 $widgets_manager->register( new \SPEL\Widgets\Accordion() );
484 }
485 if ( isset( $elements_opt[ 'docly_alerts_box' ] ) && $elements_opt[ 'docly_alerts_box' ] == 'on' ) {
486 $widgets_manager->register( new \SPEL\Widgets\Alerts_Box() );
487 }
488 if ( isset( $elements_opt[ 'spe_animated_heading' ] ) && $elements_opt[ 'spe_animated_heading' ] == 'on' ) {
489 $widgets_manager->register( new \SPEL\Widgets\Animated_Heading() );
490 }
491 if ( isset( $elements_opt[ 'spe_after_before_widget' ] ) && $elements_opt[ 'spe_after_before_widget' ] == 'on' ) {
492 $widgets_manager->register( new \SPEL\Widgets\Before_After() );
493 }
494 if ( isset( $elements_opt[ 'docy_blog_grid' ] ) && $elements_opt[ 'docy_blog_grid' ] == 'on' ) {
495 $widgets_manager->register( new \SPEL\Widgets\Blog_Grid() );
496 }
497 if ( isset( $elements_opt[ 'spe_buttons' ] ) && $elements_opt[ 'spe_buttons' ] == 'on' ) {
498 $widgets_manager->register( new \SPEL\Widgets\Buttons() );
499 }
500 if ( isset( $elements_opt[ 'docly_cheatsheet' ] ) && $elements_opt[ 'docly_cheatsheet' ] == 'on' ) {
501 $widgets_manager->register( new \SPEL\Widgets\Cheat_sheet() );
502 }
503 if ( isset( $elements_opt[ 'spe_counter' ] ) && $elements_opt[ 'spe_counter' ] == 'on' ) {
504 $widgets_manager->register( new \SPEL\Widgets\Counter() );
505 }
506 if ( isset( $elements_opt[ 'spe_instagram' ] ) && $elements_opt[ 'spe_instagram' ] == 'on' ) {
507 $widgets_manager->register( new \SPEL\Widgets\Instagram() );
508 }
509 if ( isset( $elements_opt[ 'docy_integrations' ] ) && $elements_opt[ 'docy_integrations' ] == 'on' ) {
510 $widgets_manager->register( new \SPEL\Widgets\Integrations() );
511 }
512 if ( isset( $elements_opt[ 'docly_list_item' ] ) && $elements_opt[ 'docly_list_item' ] == 'on' ) {
513 $widgets_manager->register( new \SPEL\Widgets\List_Item() );
514 }
515 // if ( isset( $elements_opt[ 'spe_marquee_slides' ] ) && $elements_opt[ 'spe_marquee_slides' ] == 'on' ) {
516 // $widgets_manager->register( new \SPEL\Widgets\Marquee_Slides() );
517 // }
518 if ( isset( $elements_opt[ 'landpagy_pricing_table_switcher' ] ) && $elements_opt[ 'landpagy_pricing_table_switcher' ] == 'on' ) {
519 $widgets_manager->register( new \SPEL\Widgets\Pricing_Table_Switcher() );
520 }
521 if ( isset( $elements_opt[ 'landpagy_pricing_table_tabs' ] ) && $elements_opt[ 'landpagy_pricing_table_tabs' ] == 'on' ) {
522 $widgets_manager->register( new \SPEL\Widgets\Pricing_Table_Tabs() );
523 }
524 if ( isset( $elements_opt[ 'spe_skill_showcase_widget' ] ) && $elements_opt[ 'spe_skill_showcase_widget' ] == 'on' ) {
525 $widgets_manager->register( new \SPEL\Widgets\Skill_Showcase() );
526 }
527 if ( isset( $elements_opt[ 'docy_tabs' ] ) && $elements_opt[ 'docy_tabs' ] == 'on' ) {
528 $widgets_manager->register( new \SPEL\Widgets\Tabs() );
529 }
530 if ( isset( $elements_opt[ 'docy_team_carousel' ] ) && $elements_opt[ 'docy_team_carousel' ] == 'on' ) {
531 $widgets_manager->register( new \SPEL\Widgets\Team_Carousel() );
532 }
533 if ( isset( $elements_opt[ 'docy_testimonial' ] ) && $elements_opt[ 'docy_testimonial' ] == 'on' ) {
534 $widgets_manager->register( new \SPEL\Widgets\Testimonial() );
535 }
536 if ( isset( $elements_opt[ 'spe_timeline_widget' ] ) && $elements_opt[ 'spe_timeline_widget' ] == 'on' ) {
537 $widgets_manager->register( new \SPEL\Widgets\Timeline() );
538 }
539 if ( isset( $elements_opt[ 'docy_videos_playlist' ] ) && $elements_opt[ 'docy_videos_playlist' ] == 'on' ) {
540 $widgets_manager->register( new \SPEL\Widgets\Video_Playlist() );
541 }
542 if ( isset( $elements_opt[ 'docy_video_popup' ] ) && $elements_opt[ 'docy_video_popup' ] == 'on' ) {
543 $widgets_manager->register( new \SPEL\Widgets\Video_Popup() );
544 }
545 if ( isset( $elements_opt[ 'spel_icon_box' ] ) && $elements_opt[ 'spel_icon_box' ] == 'on' ) {
546 $widgets_manager->register( new \SPEL\Widgets\Icon_box() );
547 }
548
549
550 }
551
552
553 /**
554 * @return void
555 * @since 1.7.0
556 * @access public
557 * @static
558 */
559 public function define_constants() {
560
561 //SPEL(Short form - Spider Elements)
562 define('SPEL_VERSION', self::VERSION);
563 define('SPEL_FILE', __FILE__);
564 define('SPEL_PATH', __DIR__);
565 define('SPEL_URL', plugins_url('', SPEL_FILE));
566 define('SPEL_ASSETS', SPEL_URL . '/assets');
567 define('SPEL_CSS', SPEL_URL . '/assets/css');
568 define('SPEL_JS', SPEL_URL . '/assets/js');
569 define('SPEL_IMG', SPEL_URL . '/assets/images');
570 define('SPEL_VEND', SPEL_URL . '/assets/vendors');
571 }
572
573
574 }
575 }
576
577
578 /**
579 * Initialize the main plugin class
580 *
581 * @return \SPEL
582 *
583 */
584 if (!function_exists('spel')) {
585
586 function spel ()
587 {
588 return SPEL::instance();
589 }
590
591 //kick-off the plugin
592 spel();
593 }