PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.6.2
Spider Elements – Premium Elementor Widgets & Addons Library v1.6.2
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
407 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.2
8 * Requires at least: 5.0
9 * Tested up to: 6.7.2
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' => false,
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.6.2';
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
207 $css_data = plugins_url( 'assets/vendors/elegant-icon/style.css', __FILE__ );
208 $json_data = plugins_url( 'assets/vendors/elegant-icon/elegant-icons.json', __FILE__ );
209
210 $custom_fonts['elegant-icon'] = [
211 'name' => 'elegant-icon',
212 'label' => esc_html__( 'Elegant Icons', 'spider-elements' ),
213 'url' => $css_data,
214 'prefix' => '',
215 'displayPrefix' => '',
216 'labelIcon' => 'icon_star',
217 'ver' => '',
218 'fetchJson' => $json_data,
219 'native' => true,
220 ];
221
222 return $custom_fonts;
223 }
224
225 /**
226 * Load Textdomain
227 *
228 * Load plugin localization files.
229 */
230 public function i18n(): void {
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 // Extra functions
246 require_once __DIR__ . '/includes/functions.php';
247
248 //Action Filter
249 require_once __DIR__ . '/includes/filters.php';
250
251 require_once __DIR__ . '/includes/Admin/Module_Settings.php';
252
253 // Admin and Frontend Scripts Loaded
254 require_once __DIR__ . '/includes/Admin/Plugin_Installer.php';
255
256 $theme = wp_get_theme();
257 if ( spel_is_premium() || in_array( $theme->get( 'Name' ), [ 'jobi', 'Jobi', 'jobi-child', 'Jobi Child' ] ) ) {
258 require_once __DIR__ . '/includes/Admin/extension/Heading_Highlighted.php';
259 require_once __DIR__ . '/includes/Admin/extension/Features_Badge.php';
260 }
261
262 // Admin UI
263 if ( is_admin() ) {
264 require_once __DIR__ . '/includes/Admin/Assets.php';
265 require_once __DIR__ . '/includes/Admin/Dashboard.php';
266 }
267
268 // Frontend UI
269 require_once __DIR__ . '/includes/Frontend/Assets.php';
270 }
271
272 /**
273 * Initialize the plugin
274 *
275 * Validates that Elementor is already loaded.
276 * Checks for basic plugin requirements, if one check fail don't continue,
277 * if all checks have passed include the plugin class.
278 *
279 * Fired by `plugins_loaded` action hook.
280 *
281 * @access public
282 */
283 public function init_plugin(): void {
284
285 $theme = wp_get_theme();
286 $features_opt = get_option( 'spel_features_settings' );
287
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 * Add new Elementor Categories
319 *
320 * Register new widget categories for Spider Elements widgets.
321 */
322 public function elements_register_category(): void {
323
324 \Elementor\Plugin::instance()->elements_manager->add_category( 'spider-elements', [
325 'title' => esc_html__( 'Spider Elements', 'spider-elements' ),
326 ], 1 );
327
328 }
329
330 /**
331 * Register New Widgets
332 *
333 * Include Spider Elements widgets files and register them in Elementor.
334 *
335 * @since 1.0.0
336 *
337 * @access public
338 */
339 public function widgets_register(): void {
340 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
341 $elements_opt = get_option( 'spe_widget_settings' );
342
343 $widgets = [
344 'docy_tabs' => 'Tabs',
345 'spel_videos_playlist' => 'Video_Playlist',
346 'docly_alerts_box' => 'Alerts_Box',
347 'spel_accordion' => 'Accordion',
348 'docy_testimonial' => 'Testimonial',
349 'docly_list_item' => 'List_Item',
350 'docly_cheatsheet' => 'Cheat_Sheet',
351 'docy_team_carousel' => 'Team_Carousel',
352 'docy_integrations' => 'Integrations',
353 'spel_before_after' => 'Before_after',
354 'docy_video_popup' => 'Video_Popup',
355 'docy_blog_grid' => 'Blog_Grid',
356 'spe_timeline_widget' => 'Timeline',
357 'spe_counter' => 'Counter',
358 'spel_icon_box' => 'Icon_Box',
359 ];
360
361 foreach ( $widgets as $key => $widget ) {
362 if ( isset( $elements_opt[ $key ] ) && $elements_opt[ $key ] === 'on' ) {
363 require_once( __DIR__ . "/widgets/{$widget}.php" );
364 $classname = "\\SPEL\\Widgets\\$widget";
365 $widgets_manager->register( new $classname() );
366 }
367 }
368 }
369
370
371 /**
372 * @return void
373 * @since 1.7.0
374 * @access public
375 * @static
376 */
377 public function define_constants(): void {
378 //SPEL(Short form - Spider Elements)
379 define( 'SPEL_VERSION', self::VERSION );
380 define( 'SPEL_FILE', __FILE__ );
381 define( 'SPEL_PATH', __DIR__ );
382 define( 'SPEL_URL', plugins_url( '', SPEL_FILE ) );
383 define( 'SPEL_ASSETS', SPEL_URL . '/assets' );
384 define( 'SPEL_CSS', SPEL_URL . '/assets/css' );
385 define( 'SPEL_JS', SPEL_URL . '/assets/js' );
386 define( 'SPEL_IMG', SPEL_URL . '/assets/images' );
387 define( 'SPEL_VEND', SPEL_URL . '/assets/vendors' );
388 }
389 }
390 }
391
392
393 /**
394 * Initialize the main plugin class
395 *
396 * @return SPEL
397 *
398 */
399 if ( ! function_exists( 'spel' ) ) {
400
401 function spel() {
402 return SPEL::instance();
403 }
404
405 //kick-off the plugin
406 spel();
407 }