PluginProbe ʕ •ᴥ•ʔ
Slider Ultimate / 2.2.10
Slider Ultimate v2.2.10
2.2.10 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9
ultimate-slider / ultimate-slider.php
ultimate-slider Last commit date
assets 1 month ago ewd-us-templates 2 years ago includes 1 month ago languages 4 years ago lib 2 years ago views 2 years ago woocommerce-templates 4 years ago readme.txt 2 weeks ago ultimate-slider.php 1 month ago
ultimate-slider.php
418 lines
1 <?php
2 /*
3 Plugin Name: Slider Ultimate
4 Plugin URI: http://www.EtoileWebDesign.com/plugins/
5 Description: Add a responsive slider to any page with a block shortcode. Multiple slide effects. WooCommerce slider integration.
6 Author: Etoile Web Design
7 Author URI: http://www.EtoileWebDesign.com/plugins/
8 Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9 Text Domain: ultimate-slider
10 Version: 2.2.10
11 */
12
13 if ( ! defined( 'ABSPATH' ) )
14 exit;
15
16 if ( ! class_exists( 'ewdusInit' ) ) {
17 class ewdusInit {
18
19 // pointers to classes used by the plugin, where needed
20 public $cpts;
21 public $permissions;
22 public $settings;
23
24 // Any data that needs to be passed from PHP to our JS files
25 public $front_end_php_js_data = array();
26
27 /**
28 * Initialize the plugin and register hooks
29 */
30 public function __construct() {
31
32 self::constants();
33 self::includes();
34 self::instantiate();
35 self::wp_hooks();
36 }
37
38 /**
39 * Define plugin constants.
40 *
41 * @since 2.0.0
42 * @access protected
43 * @return void
44 */
45 protected function constants() {
46
47 define( 'EWD_US_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
48 define( 'EWD_US_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
49 define( 'EWD_US_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
50 define( 'EWD_US_TEMPLATE_DIR', 'ewd-us-templates' );
51 define( 'EWD_US_VERSION', '2.2.10' );
52
53 define( 'EWD_US_SLIDER_POST_TYPE', 'ultimate_slider' );
54 define( 'EWD_US_SLIDER_CATEGORY_TAXONOMY', 'ultimate_slider_categories' );
55 define( 'EWD_US_SLIDER_TAG_TAXONOMY', 'ultimate_slider_tags' );
56 }
57
58 /**
59 * Include necessary classes.
60 *
61 * @since 2.0.0
62 * @access protected
63 * @return void
64 */
65 protected function includes() {
66
67 require_once( EWD_US_PLUGIN_DIR . '/includes/AboutUs.class.php' );
68 require_once( EWD_US_PLUGIN_DIR . '/includes/Blocks.class.php' );
69 require_once( EWD_US_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
70 require_once( EWD_US_PLUGIN_DIR . '/includes/Dashboard.class.php' );
71 require_once( EWD_US_PLUGIN_DIR . '/includes/DeactivationSurvey.class.php' );
72 require_once( EWD_US_PLUGIN_DIR . '/includes/Helper.class.php' );
73 require_once( EWD_US_PLUGIN_DIR . '/includes/InstallationWalkthrough.class.php' );
74 require_once( EWD_US_PLUGIN_DIR . '/includes/Permissions.class.php' );
75 require_once( EWD_US_PLUGIN_DIR . '/includes/ReviewAsk.class.php' );
76 require_once( EWD_US_PLUGIN_DIR . '/includes/Settings.class.php' );
77 require_once( EWD_US_PLUGIN_DIR . '/includes/template-functions.php' );
78 require_once( EWD_US_PLUGIN_DIR . '/includes/Widgets.class.php' );
79 require_once( EWD_US_PLUGIN_DIR . '/includes/WooCommerceIntegration.class.php' );
80 }
81
82 /**
83 * Spin up instances of our plugin classes.
84 *
85 * @since 2.0.0
86 * @access protected
87 * @return void
88 */
89 protected function instantiate() {
90
91 new ewdusDashboard();
92 new ewdusDeactivationSurvey();
93 new ewdusInstallationWalkthrough();
94 new ewdusReviewAsk();
95
96 $this->cpts = new ewdusCustomPostTypes();
97 $this->permissions = new ewdusPermissions();
98 $this->settings = new ewdusSettings();
99
100 new ewdusBlocks();
101 new ewdusWidgetManager();
102
103 if ( $this->settings->get_setting( 'wc-product-image-slider' ) ) {
104 new ewdusWooCommerceIntegration();
105 }
106
107 new ewdusAboutUs();
108 }
109
110 /**
111 * Run walk-through, load assets, add links to plugin listing, etc.
112 *
113 * @since 2.0.0
114 * @access protected
115 * @return void
116 */
117 protected function wp_hooks() {
118
119 register_activation_hook( __FILE__, array( $this, 'run_walkthrough' ) );
120 register_activation_hook( __FILE__, array( $this, 'convert_options' ) );
121
122 add_action( 'init', array( $this, 'load_view_files' ) );
123
124 add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
125
126 add_action( 'admin_notices', array( $this, 'display_header_area' ) );
127 add_action( 'admin_notices', array( $this, 'maybe_display_helper_notice' ) );
128
129 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ), 10, 1 );
130 add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
131 add_action( 'wp_head', 'ewd_add_frontend_ajax_url' );
132 add_action( 'wp_footer', array( $this, 'assets_footer' ), 2 );
133
134 add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2);
135
136 add_action( 'wp_ajax_ewd_us_hide_helper_notice', array( $this, 'hide_helper_notice' ) );
137 }
138
139 /**
140 * Run the options conversion function on update if necessary
141 *
142 * @since 2.0.0
143 * @access protected
144 * @return void
145 */
146 public function convert_options() {
147
148 require_once( EWD_US_PLUGIN_DIR . '/includes/BackwardsCompatibility.class.php' );
149 new ewdusBackwardsCompatibility();
150 }
151
152 /**
153 * Load files needed for views
154 * @since 2.0.0
155 * @note Can be filtered to add new classes as needed
156 */
157 public function load_view_files() {
158
159 $files = array(
160 EWD_US_PLUGIN_DIR . '/views/Base.class.php' // This will load all default classes
161 );
162
163 $files = apply_filters( 'ewd_us_load_view_files', $files );
164
165 foreach( $files as $file ) {
166 require_once( $file );
167 }
168
169 }
170
171 /**
172 * Load the plugin textdomain for localisation
173 * @since 2.0.0
174 */
175 public function load_textdomain() {
176
177 load_plugin_textdomain( 'ultimate-slider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages/' );
178 }
179
180 /**
181 * Set a transient so that the walk-through gets run
182 * @since 2.0.0
183 */
184 public function run_walkthrough() {
185
186 set_transient( 'ewd-us-getting-started', true, 30 );
187 }
188
189 /**
190 * Enqueue the admin-only CSS and Javascript
191 * @since 2.0.0
192 */
193 public function enqueue_admin_assets( $hook ) {
194 global $post;
195
196 wp_enqueue_script( 'ewd-us-helper-notice', EWD_US_PLUGIN_URL . '/assets/js/ewd-us-helper-install-notice.js', array( 'jquery' ), EWD_US_VERSION, true );
197 wp_localize_script(
198 'ewd-us-helper-notice',
199 'ewd_us_helper_notice',
200 array( 'nonce' => wp_create_nonce( 'ewd-us-helper-notice' ) )
201 );
202
203 wp_enqueue_style( 'ewd-us-helper-notice', EWD_US_PLUGIN_URL . '/assets/css/ewd-us-helper-install-notice.css', array(), EWD_US_VERSION );
204
205 $screen = get_current_screen();
206
207 $candidates = array(
208 EWD_US_SLIDER_POST_TYPE,
209
210 'ultimate_slider_page_ewd-us-settings',
211
212 'widgets.php',
213 );
214
215 // Return if not ultimate_slider post_type, we're not on a post-type page, or we're not on the settings or widget pages
216 if ( ! in_array( $hook, $candidates )
217 and ( empty( $screen->post_type ) or ! in_array ( $screen->post_type, $candidates ) )
218 and ! in_array( $screen->id, $candidates )
219 ) {
220 return;
221 }
222
223 wp_enqueue_script( 'jquery-ui-core' );
224 wp_enqueue_script( 'jquery-ui-sortable' );
225 wp_enqueue_script( 'ewd-us-admin-js', EWD_US_PLUGIN_URL . '/assets/js/ewd-us-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), EWD_US_VERSION, true );
226
227 wp_enqueue_style( 'ewd-us-admin-css', EWD_US_PLUGIN_URL . '/assets/css/ewd-us-admin.css', EWD_US_VERSION );
228
229 $settings = array(
230 'nonce' => wp_create_nonce( 'ewd-us-admin-js' ),
231 );
232
233 wp_localize_script( 'ewd-us-admin-js', 'ewd_us_admin_php_data', $settings );
234 }
235
236 /**
237 * Register the front-end CSS and Javascript for the slider
238 * @since 2.0.0
239 */
240 function register_assets() {
241 global $ewd_us_controller;
242
243 wp_register_script( 'ewd-us-js', EWD_US_PLUGIN_URL . '/assets/js/ewd-us.js', array( 'jquery', 'jquery-ui-core', 'jquery-effects-slide' ), EWD_US_VERSION, true );
244 wp_register_script( 'iframe-clicks', EWD_US_PLUGIN_URL . '/assets/js/jquery.iframetracker.js' , array( 'jquery' ), EWD_US_VERSION, true );
245
246 wp_register_style( 'ewd-us-css', EWD_US_PLUGIN_URL . '/assets/css/ewd-us.css', EWD_US_VERSION );
247
248 if ( $ewd_us_controller->settings->get_setting( 'lightbox' ) ) {
249
250 wp_register_script( 'ultimate-lightbox', EWD_US_PLUGIN_URL . '/assets/js/ultimate-lightbox.js', array( 'jquery' ), EWD_US_VERSION, true );
251
252 wp_register_style( 'ewd-ulb-main', EWD_US_PLUGIN_URL . '/assets/css/ewd-ulb-main.css', EWD_US_VERSION );
253 }
254 }
255
256 /**
257 * Print out any PHP data needed for our JS to work correctly
258 * @since 2.1.0
259 */
260 public function assets_footer() {
261
262 if ( empty( $this->front_end_php_js_data ) ) { return; }
263
264 $print_variables = array();
265
266 foreach ( (array) $this->front_end_php_js_data as $variable => $values ) {
267
268 if ( empty( $values ) ) { continue; }
269
270 $print_variables[ $variable ] = ewdusHelper::escape_js_recursive( $values );
271 }
272
273 foreach ( $print_variables as $variable => $values ) {
274
275 echo "<script type='text/javascript'>\n";
276 echo "/* <![CDATA[ */\n";
277 echo 'var ' . esc_attr( $variable ) . ' = ' . wp_json_encode( $values ) . "\n";
278 echo "/* ]]> */\n";
279 echo "</script>\n";
280 }
281 }
282
283 /**
284 * Adds a variable to be passed to our front-end JS
285 * @since 2.1.0
286 */
287 public function add_front_end_php_data( $handle, $variable, $data ) {
288
289 $this->front_end_php_js_data[ $variable ] = $data;
290 }
291
292 /**
293 * Returns the corresponding front-end JS variable if it exists, otherwise an empty array
294 * @since 2.1.0
295 */
296 public function get_front_end_php_data( $handle, $variable ) {
297
298 return ! empty( $this->front_end_php_js_data[ $variable ] ) ? $this->front_end_php_js_data[ $variable ] : array();
299 }
300
301 /**
302 * Add links to the plugin listing on the installed plugins page
303 * @since 2.0.0
304 */
305 public function plugin_action_links( $links, $plugin ) {
306 global $ewd_us_controller;
307
308 if ( $plugin == EWD_US_PLUGIN_FNAME ) {
309
310 if ( ! $ewd_us_controller->permissions->check_permission( 'premium' ) ) {
311
312 array_unshift( $links, '<a class="ewd-us-plugin-page-upgrade-link" href="https://www.etoilewebdesign.com/license-payment/?Selected=US&Quantity=1&utm_source=wp_admin_plugins_page" title="' . __( 'Try Premium', 'ultimate-slider' ) . '" target="_blank">' . __( 'Try Premium', 'ultimate-slider' ) . '</a>' );
313 }
314
315 $links['settings'] = '<a href="admin.php?page=ewd-us-settings" title="' . __( 'Head to the settings page for Ultimate Slider', 'ultimate-slider' ) . '">' . __( 'Settings', 'ultimate-slider' ) . '</a>';
316 }
317
318 return $links;
319
320 }
321
322 /**
323 * Adds in a menu bar for the plugin
324 * @since 2.0.0
325 */
326 public function display_header_area() {
327 global $ewd_us_controller;
328
329 $screen = get_current_screen();
330
331 if ( empty( $screen->parent_file ) or $screen->parent_file != 'edit.php?post_type=ultimate_slider' ) { return; }
332
333 if ( ! $ewd_us_controller->permissions->check_permission( 'styling' ) or get_option( 'EWD_US_Trial_Happening' ) == 'Yes' ) {
334 ?>
335 <div class="ewd-us-dashboard-new-upgrade-banner">
336 <div class="ewd-us-dashboard-banner-icon"></div>
337 <div class="ewd-us-dashboard-banner-buttons">
338 <a class="ewd-us-dashboard-new-upgrade-button" href="https://www.etoilewebdesign.com/license-payment/?Selected=US&Quantity=1&utm_source=us_admin&utm_content=banner" target="_blank">UPGRADE NOW</a>
339 </div>
340 <div class="ewd-us-dashboard-banner-text">
341 <div class="ewd-us-dashboard-banner-title">
342 GET FULL ACCESS WITH OUR PREMIUM VERSION
343 </div>
344 <div class="ewd-us-dashboard-banner-brief">
345 Slide and title animations/effects, modify the controls, WooCommerce integration, advanced styling options and more!
346 </div>
347 </div>
348 </div>
349 <?php
350 }
351
352 ?>
353 <div class="ewd-us-admin-header-menu">
354 <h2 class="nav-tab-wrapper">
355 <a id="ewd-us-dash-mobile-menu-open" href="#" class="menu-tab nav-tab"><?php _e("MENU", 'ultimate-slider'); ?><span id="ewd-us-dash-mobile-menu-down-caret">&nbsp;&nbsp;&#9660;</span><span id="ewd-us-dash-mobile-menu-up-caret">&nbsp;&nbsp;&#9650;</span></a>
356 <a id="dashboard-menu" href='admin.php?page=ewd-us-dashboard' class="menu-tab nav-tab <?php if ( $screen->id == 'ultimate_slider_ewd-us-dashboard' ) {echo 'nav-tab-active';}?>"><?php _e("Dashboard", 'ultimate-slider'); ?></a>
357 <a id="slides-menu" href='edit.php?post_type=ultimate_slider' class="menu-tab nav-tab <?php if ( $screen->id == 'edit-ultimate_slider' ) {echo 'nav-tab-active';}?>"><?php _e("Slides", 'ultimate-slider'); ?></a>
358 <a id="options-menu" href='edit.php?post_type=ultimate_slider&page=ewd-us-settings' class="menu-tab nav-tab <?php if ( $screen->id == ' ultimate_slider_page_ewd-us-settings' ) {echo 'nav-tab-active';}?>"><?php _e("Settings", 'ultimate-slider'); ?></a>
359 </h2>
360 </div>
361 <?php
362 }
363
364 public function maybe_display_helper_notice() {
365 global $ewd_us_controller;
366
367 if ( empty( $ewd_us_controller->permissions->check_permission( 'premium' ) ) ) { return; }
368
369 if ( is_plugin_active( 'ewd-premium-helper/ewd-premium-helper.php' ) ) { return; }
370
371 if ( get_transient( 'ewd-helper-notice-dismissed' ) ) { return; }
372
373 ?>
374
375 <div class='notice notice-error is-dismissible ewd-us-helper-install-notice'>
376
377 <div class='ewd-us-helper-install-notice-img'>
378 <img src='<?php echo EWD_US_PLUGIN_URL . '/lib/simple-admin-pages/img/options-asset-exclamation.png' ; ?>' />
379 </div>
380
381 <div class='ewd-us-helper-install-notice-txt'>
382 <?php _e( 'You\'re using the Ultimate Slider premium version, but the premium helper plugin is not active.', 'ultimate-slider' ); ?>
383 <br />
384 <?php echo sprintf( __( 'Please re-activate the helper plugin, or <a target=\'_blank\' href=\'%s\'>download and install it</a> if the plugin is no longer installed to ensure continued access to the premium features of the plugin.', 'ultimate-slider' ), 'https://www.etoilewebdesign.com/2021/12/11/requiring-premium-helper-plugin/' ); ?>
385 </div>
386
387 <div class='ewd-us-clear'></div>
388
389 </div>
390
391 <?php
392 }
393
394 public function hide_helper_notice() {
395
396 // Authenticate request
397 if ( ! check_ajax_referer( 'ewd-us-helper-notice', 'nonce' ) or ! current_user_can( 'manage_options' ) ) {
398
399 wp_send_json_error(
400 array(
401 'error' => 'loggedout',
402 'msg' => sprintf( __( 'You have been logged out. Please %slogin again%s.', 'ultimate-slider' ), '<a href="' . wp_login_url( admin_url( 'admin.php?page=ewd-us-dashboard' ) ) . '">', '</a>' ),
403 )
404 );
405 }
406
407 set_transient( 'ewd-helper-notice-dismissed', true, 3600*24*7 );
408
409 die();
410 }
411
412 }
413 } // endif;
414
415 global $ewd_us_controller;
416 $ewd_us_controller = new ewdusInit();
417
418 do_action( 'ewd_us_initialized' );