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