PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.5.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.5.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 1 year ago includes 1 year ago languages 1 year ago widgets 1 year ago index.php 1 year ago readme.txt 1 year ago spider-elements.php 1 year ago
spider-elements.php
494 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.5.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 if ( function_exists( 'spel_fs' ) ) {
25 spel_fs()->set_basename( false, __FILE__ );
26 } else {
27
28 // DO NOT REMOVE THIS IF; IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
29 if ( ! function_exists( 'spel_fs' ) ) {
30 // Create a helper function for easy SDK access.
31 function spel_fs() {
32 global $spel_fs;
33
34 if ( ! isset( $spel_fs ) ) {
35
36 // Include Freemius SDK.
37 require_once dirname(__FILE__) . '/includes/freemius/start.php';
38
39 $spel_fs = fs_dynamic_init(
40 [
41 'id' => '16034',
42 'slug' => 'spider-elements',
43 'premium_slug' => 'spider-elements-pro',
44 'type' => 'plugin',
45 'public_key' => 'pk_711f20dd503c8eb713171079ffeb5',
46 'is_premium' => false,
47 'premium_suffix' => 'Pro',
48 'has_premium_version' => true,
49 'has_paid_plans' => true,
50 'trial' => [
51 'days' => 14,
52 'is_require_payment'=> true,
53 ],
54 'menu' => [
55 'slug' => 'spider_elements_settings',
56 'contact' => true,
57 'support' => true,
58 'first-path' => 'admin.php?page=spider_elements_settings'
59 ],
60 ]
61 );
62 }
63
64 return $spel_fs;
65 }
66
67 // Init Freemius.
68 spel_fs()->add_filter( 'deactivate_on_activation', '__return_false' );
69 spel_fs()->add_filter( 'hide_freemius_powered_by', '__return_true' );
70
71 // Init Freemius.
72 spel_fs();
73
74 // Signal that SDK was initiated.
75 do_action( 'spel_fs_loaded' );
76 }
77 }
78
79
80 /**
81 * SPEL class.
82 *
83 * The main class that initiates and runs the addon.
84 *
85 */
86 if (!class_exists('SPEL')) {
87
88 /**
89 * Class SPEL
90 */
91 final class SPEL {
92
93 /**
94 * Plugin Version
95 *
96 * Holds the version of the plugin.
97 *
98 * @var string The plugin version.
99 */
100 const VERSION = '1.5.0';
101
102
103 /**
104 * Instance
105 *
106 * Holds a single instance of the `SPEL` class.
107 *
108 * @access private
109 * @static
110 *
111 * @var SPEL A single instance of the class.
112 */
113 private static $_instance = null;
114
115
116 /**
117 * Instance
118 *
119 * Ensures only one instance of the class is loaded or can be loaded.
120 *
121 * @return SPEL An instance of the class.
122 * @since 1.7.0
123 *
124 * @access public
125 * @static
126 *
127 */
128 public static function instance() {
129 if ( is_null( self::$_instance ) ) {
130 self::$_instance = new self();
131 }
132
133 return self::$_instance;
134 }
135
136 /**
137 * Constructor
138 *
139 * Initialize the Spider Elements plugins.
140 *
141 */
142 public function __construct() {
143
144 // Include Files
145 $this->core_includes();
146
147 // define constants
148 $this->define_constants();
149
150 // Init Plugin
151 add_action('plugins_loaded', array( $this, 'init_plugin' ));
152
153 // Load text domain for localization
154 add_action('init', [ $this, 'i18n' ]);
155
156 // Register Category
157 add_action('elementor/elements/categories_registered', [ $this, 'elements_register_category' ]);
158
159 // Register widgets
160 add_action('elementor/widgets/register', [ $this, 'widgets_register' ], 99 );
161
162 // Register Icon
163 add_filter('elementor/icons_manager/additional_tabs', [ $this, 'elegant_icons' ]);
164
165 }
166
167
168 /**
169 * Clone
170 *
171 * Disable class cloning.
172 *
173 * @return void
174 * @since 1.7.0
175 *
176 * @access protected
177 *
178 */
179 public function __clone() {
180 // Cloning instances of the class is forbidden
181 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'spider-elements' ), self::VERSION );
182 }
183
184
185 /**
186 * Wakeup
187 *
188 * Disable unserializing the class.
189 *
190 * @return void
191 * @since 1.7.0
192 *
193 * @access protected
194 *
195 */
196 public function __wakeup() {
197 // Un-serializing instances of the class is forbidden.
198 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'spider-elements' ), '1.7.0' );
199 }
200
201
202 /***
203 * Added Custom Font Icon Integrated Elementor Icon Library
204 */
205 public function elegant_icons( $custom_fonts ) {
206 $css_data = plugins_url( 'assets/vendors/elegant-icon/style.css', __FILE__ );
207 $json_data = plugins_url( 'assets/vendors/elegant-icon/elegant-icons.json', __FILE__ );
208
209 $custom_fonts[ 'elegant-icon' ] = [
210 'name' => 'elegant-icon',
211 'label' => esc_html__( 'Elegant Icons', 'spider-elements' ),
212 'url' => $css_data,
213 'prefix' => '',
214 'displayPrefix' => '',
215 'labelIcon' => 'icon_star',
216 'ver' => '',
217 'fetchJson' => $json_data,
218 'native' => true,
219 ];
220
221 return $custom_fonts;
222 }
223
224 /**
225 * Load Textdomain
226 *
227 * Load plugin localization files.
228 */
229 public function i18n(): void
230 {
231 load_plugin_textdomain( 'spider-elements', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
232 }
233
234
235 /**
236 * Include Files
237 *
238 * Load core files required to run the plugin.
239 *
240 * @since 1.7.0
241 *
242 * @access public
243 */
244 public function core_includes(): void
245 {
246
247
248 // Extra functions
249 require_once __DIR__ . '/includes/functions.php';
250
251 //Action Filter
252 require_once __DIR__ . '/includes/filters.php';
253
254 require_once __DIR__ . '/includes/Admin/Module_Settings.php';
255 //require_once __DIR__ . '/includes/classes/Theme_Builder.php';
256
257 // Admin and Frontend Scripts Loaded
258 require_once __DIR__ . '/includes/Admin/Plugin_Installer.php';
259
260 $theme = wp_get_theme();
261 if ( spel_is_premium() || in_array($theme->get('Name'), ['jobi', 'Jobi', 'jobi-child', 'Jobi Child']) ) {
262 require_once __DIR__ . '/includes/Admin/extension/Heading_Highlighted.php';
263 require_once __DIR__ . '/includes/Admin/extension/Features_Badge.php';
264 }
265
266 // Admin UI
267 if ( is_admin() ) {
268 require_once __DIR__ . '/includes/Admin/Assets.php';
269 require_once __DIR__ . '/includes/Admin/Dashboard.php';
270 }
271
272 // Frontend UI
273 require_once __DIR__ . '/includes/Frontend/Assets.php';
274
275 //require_once __DIR__ . '/includes/template_library/Template_Library.php';
276
277 }
278
279 /**
280 * Initialize the plugin
281 *
282 * Validates that Elementor is already loaded.
283 * Checks for basic plugin requirements, if one check fail don't continue,
284 * if all checks have passed include the plugin class.
285 *
286 * Fired by `plugins_loaded` action hook.
287 *
288 * @access public
289 */
290 public function init_plugin(): void
291 {
292
293 $theme = wp_get_theme();
294 $features_opt = get_option('spel_features_settings');
295
296 $is_premium_or_theme = spel_is_premium() || in_array($theme->get('Name'), ['jobi', 'Jobi', 'jobi-child', 'Jobi Child']);
297
298 if ( $is_premium_or_theme ) {
299
300 // Get the feature badge status
301 $heading_highlighted = $features_opt['spel_heading_highlighted'] ?? '';
302 if ($heading_highlighted) {
303 new SPEL\includes\Admin\extension\Heading_Highlighted();
304 }
305
306 $badge = $features_opt['spel_badge'] ?? '';
307 if ($badge) {
308 new SPEL\includes\Admin\extension\Features_Badge();
309 }
310
311 }
312
313 // Admin UI
314 if ( is_admin() ) {
315 new SPEL\includes\Admin\Dashboard();
316 new SPEL\includes\Admin\Assets();
317 }
318
319 // Frontend UI
320 new SPEL\includes\Admin\Plugin_Installer();
321 new SPEL\includes\Frontend\Assets();
322
323
324 // Template Library
325 //new SPEL\includes\template_library\Template_Library();
326
327 //new SPEL\includes\classes\Theme_Builder();
328
329 }
330
331
332 /**
333 * Add new Elementor Categories
334 *
335 * Register new widget categories for Spider Elements widgets.
336 */
337 public function elements_register_category (): void
338 {
339
340 \Elementor\Plugin::instance()->elements_manager->add_category('spider-elements', [
341 'title' => esc_html__('Spider Elements', 'spider-elements'),
342 ], 1);
343
344 }
345
346 /**
347 * Register New Widgets
348 *
349 * Include Spider Elements widgets files and register them in Elementor.
350 *
351 * @since 1.0.0
352 *
353 * @access public
354 */
355 public function widgets_register(): void
356 {
357
358 // Register each widget class
359 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
360 $elements_opt = get_option( 'spe_widget_settings' );
361
362
363 if ( isset( $elements_opt[ 'docy_tabs' ] ) && $elements_opt[ 'docy_tabs' ] == 'on' ) {
364 require_once( __DIR__ . '/widgets/Tabs.php' );
365 $widgets_manager->register( new \SPEL\Widgets\Tabs() );
366 }
367 if ( isset( $elements_opt[ 'docy_videos_playlist' ] ) && $elements_opt[ 'docy_videos_playlist' ] == 'on' ) {
368 require_once( __DIR__ . '/widgets/Video_Playlist.php' );
369 $widgets_manager->register( new \SPEL\Widgets\Video_Playlist() );
370 }
371 if ( isset( $elements_opt[ 'docly_alerts_box' ] ) && $elements_opt[ 'docly_alerts_box' ] == 'on' ) {
372 require_once( __DIR__ . '/widgets/Alerts_Box.php' );
373 $widgets_manager->register( new \SPEL\Widgets\Alerts_Box() );
374 }
375 if ( isset( $elements_opt[ 'spel_accordion' ] ) && $elements_opt[ 'spel_accordion' ] == 'on' ) {
376 require_once( __DIR__ . '/widgets/Accordion.php' );
377 $widgets_manager->register( new \SPEL\Widgets\Accordion() );
378 }
379 if ( isset( $elements_opt[ 'docy_testimonial' ] ) && $elements_opt[ 'docy_testimonial' ] == 'on' ) {
380 require_once( __DIR__ . '/widgets/Testimonial.php' );
381 $widgets_manager->register( new \SPEL\Widgets\Testimonial() );
382 }
383 // if ( isset( $elements_opt[ 'landpagy_pricing_table_tabs' ] ) && $elements_opt[ 'landpagy_pricing_table_tabs' ] == 'on' ) {
384 // require_once( __DIR__ . '/widgets/Pricing_Table_Tabs.php' );
385 // $widgets_manager->register( new \SPEL\Widgets\Pricing_Table_Tabs() );
386 // }
387 // if ( isset( $elements_opt[ 'landpagy_pricing_table_switcher' ] ) && $elements_opt[ 'landpagy_pricing_table_switcher' ] == 'on' ) {
388 ////require_once( __DIR__ . '/widgets/Pricing_Table_Switcher.php' );
389 // $widgets_manager->register( new \SPEL\Widgets\Pricing_Table_Switcher() );
390 // }
391
392 if ( isset( $elements_opt[ 'docly_list_item' ] ) && $elements_opt[ 'docly_list_item' ] == 'on' ) {
393 require_once( __DIR__ . '/widgets/List_Item.php' );
394 $widgets_manager->register( new \SPEL\Widgets\List_Item() );
395 }
396 if ( isset( $elements_opt[ 'docly_cheatsheet' ] ) && $elements_opt[ 'docly_cheatsheet' ] == 'on' ) {
397 require_once( __DIR__ . '/widgets/Cheat_sheet.php' );
398 $widgets_manager->register( new \SPEL\Widgets\Cheat_sheet() );
399 }
400 if ( isset( $elements_opt[ 'docy_team_carousel' ] ) && $elements_opt[ 'docy_team_carousel' ] == 'on' ) {
401 require_once( __DIR__ . '/widgets/Team_Carousel.php' );
402 $widgets_manager->register( new \SPEL\Widgets\Team_Carousel() );
403 }
404 if ( isset( $elements_opt[ 'docy_integrations' ] ) && $elements_opt[ 'docy_integrations' ] == 'on' ) {
405 require_once( __DIR__ . '/widgets/Integrations.php' );
406 $widgets_manager->register( new \SPEL\Widgets\Integrations() );
407 }
408 if ( isset( $elements_opt[ 'spe_after_before_widget' ] ) && $elements_opt[ 'spe_after_before_widget' ] == 'on' ) {
409 require_once( __DIR__ . '/widgets/Before_after.php' );
410 $widgets_manager->register( new \SPEL\Widgets\Before_After() );
411 }
412 if ( isset( $elements_opt[ 'docy_video_popup' ] ) && $elements_opt[ 'docy_video_popup' ] == 'on' ) {
413 require_once( __DIR__ . '/widgets/Video_Popup.php' );
414 $widgets_manager->register( new \SPEL\Widgets\Video_Popup() );
415 }
416 if ( isset( $elements_opt[ 'docy_blog_grid' ] ) && $elements_opt[ 'docy_blog_grid' ] == 'on' ) {
417 require_once( __DIR__ . '/widgets/Blog_Grid.php' );
418 $widgets_manager->register( new \SPEL\Widgets\Blog_Grid() );
419 }
420 if ( isset( $elements_opt[ 'spe_timeline_widget' ] ) && $elements_opt[ 'spe_timeline_widget' ] == 'on' ) {
421 require_once( __DIR__ . '/widgets/Timeline.php' );
422 $widgets_manager->register( new \SPEL\Widgets\Timeline() );
423 }
424 // if ( isset( $elements_opt[ 'spe_buttons' ] ) && $elements_opt[ 'spe_buttons' ] == 'on' ) {
425 //require_once( __DIR__ . '/widgets/Buttons.php' );
426 // $widgets_manager->register( new \SPEL\Widgets\Buttons() );
427 // }
428 // if ( isset( $elements_opt[ 'spe_animated_heading' ] ) && $elements_opt[ 'spe_animated_heading' ] == 'on' ) {
429 //require_once( __DIR__ . '/widgets/Animated_Heading.php' );
430 // $widgets_manager->register( new \SPEL\Widgets\Animated_Heading() );
431 // }
432
433
434 if ( isset( $elements_opt[ 'spe_counter' ] ) && $elements_opt[ 'spe_counter' ] == 'on' ) {
435 require_once( __DIR__ . '/widgets/Counter.php' );
436 $widgets_manager->register( new \SPEL\Widgets\Counter() );
437 }
438
439 // if ( isset( $elements_opt[ 'spe_instagram' ] ) && $elements_opt[ 'spe_instagram' ] == 'on' ) {
440 //require_once( __DIR__ . '/widgets/Instagram.php' );
441 // $widgets_manager->register( new \SPEL\Widgets\Instagram() );
442 // }
443
444 if ( isset( $elements_opt[ 'spel_icon_box' ] ) && $elements_opt[ 'spel_icon_box' ] == 'on' ) {
445 require_once( __DIR__ . '/widgets/Icon_box.php' );
446 $widgets_manager->register( new \SPEL\Widgets\Icon_box() );
447 }
448
449 }
450
451
452 /**
453 * @return void
454 * @since 1.7.0
455 * @access public
456 * @static
457 */
458 public function define_constants(): void
459 {
460
461 //SPEL(Short form - Spider Elements)
462 define('SPEL_VERSION', self::VERSION);
463 define('SPEL_FILE', __FILE__);
464 define('SPEL_PATH', __DIR__);
465 define('SPEL_URL', plugins_url('', SPEL_FILE));
466 define('SPEL_ASSETS', SPEL_URL . '/assets');
467 define('SPEL_CSS', SPEL_URL . '/assets/css');
468 define('SPEL_JS', SPEL_URL . '/assets/js');
469 define('SPEL_IMG', SPEL_URL . '/assets/images');
470 define('SPEL_VEND', SPEL_URL . '/assets/vendors');
471
472 }
473
474
475 }
476 }
477
478
479 /**
480 * Initialize the main plugin class
481 *
482 * @return SPEL
483 *
484 */
485 if (!function_exists('spel')) {
486
487 function spel ()
488 {
489 return SPEL::instance();
490 }
491
492 //kick-off the plugin
493 spel();
494 }