PluginProbe ʕ •ᴥ•ʔ
Slider Ultimate / 2.0.8
Slider Ultimate v2.0.8
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 4 years ago ewd-us-templates 4 years ago includes 4 years ago languages 4 years ago lib 4 years ago views 4 years ago readme.txt 4 years ago ultimate-slider.php 4 years ago
ultimate-slider.php
274 lines
1 <?php
2 /*
3 Plugin Name: Slider Ultimate
4 Plugin URI: http://www.EtoileWebDesign.com/plugins/
5 Description: A plugin that lets you create a slider, using posts, WooCommerce or Ultimate Product Catalog products
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.0.8
11 */
12
13 if ( ! defined( 'ABSPATH' ) )
14 exit;
15
16 if ( ! class_exists( 'ewdusInit' ) ) {
17 class ewdusInit {
18
19 /**
20 * Initialize the plugin and register hooks
21 */
22 public function __construct() {
23
24 self::constants();
25 self::includes();
26 self::instantiate();
27 self::wp_hooks();
28 }
29
30 /**
31 * Define plugin constants.
32 *
33 * @since 2.0.0
34 * @access protected
35 * @return void
36 */
37 protected function constants() {
38
39 define( 'EWD_US_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
40 define( 'EWD_US_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
41 define( 'EWD_US_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
42 define( 'EWD_US_TEMPLATE_DIR', 'ewd-us-templates' );
43 define( 'EWD_US_VERSION', '2.0.8' );
44
45 define( 'EWD_US_SLIDER_POST_TYPE', 'ultimate_slider' );
46 define( 'EWD_US_SLIDER_CATEGORY_TAXONOMY', 'ultimate_slider_categories' );
47 define( 'EWD_US_SLIDER_TAG_TAXONOMY', 'ultimate_slider_tags' );
48 }
49
50 /**
51 * Include necessary classes.
52 *
53 * @since 2.0.0
54 * @access protected
55 * @return void
56 */
57 protected function includes() {
58
59 require_once( EWD_US_PLUGIN_DIR . '/includes/Blocks.class.php' );
60 require_once( EWD_US_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
61 require_once( EWD_US_PLUGIN_DIR . '/includes/Dashboard.class.php' );
62 require_once( EWD_US_PLUGIN_DIR . '/includes/DeactivationSurvey.class.php' );
63 require_once( EWD_US_PLUGIN_DIR . '/includes/InstallationWalkthrough.class.php' );
64 require_once( EWD_US_PLUGIN_DIR . '/includes/Permissions.class.php' );
65 require_once( EWD_US_PLUGIN_DIR . '/includes/ReviewAsk.class.php' );
66 require_once( EWD_US_PLUGIN_DIR . '/includes/Settings.class.php' );
67 require_once( EWD_US_PLUGIN_DIR . '/includes/template-functions.php' );
68 require_once( EWD_US_PLUGIN_DIR . '/includes/Widgets.class.php' );
69 require_once( EWD_US_PLUGIN_DIR . '/includes/WooCommerceIntegration.class.php' );
70 }
71
72 /**
73 * Spin up instances of our plugin classes.
74 *
75 * @since 2.0.0
76 * @access protected
77 * @return void
78 */
79 protected function instantiate() {
80
81 new ewdusDashboard();
82 new ewdusDeactivationSurvey();
83 new ewdusInstallationWalkthrough();
84 new ewdusReviewAsk();
85
86 $this->cpts = new ewdusCustomPostTypes();
87 $this->permissions = new ewdusPermissions();
88 $this->settings = new ewdusSettings();
89
90 new ewdusBlocks();
91 new ewdusWidgetManager();
92
93 if ( $this->settings->get_setting( 'wc-product-image-slider' ) ) {
94 new ewdusWooCommerceIntegration();
95 }
96 }
97
98 /**
99 * Run walk-through, load assets, add links to plugin listing, etc.
100 *
101 * @since 2.0.0
102 * @access protected
103 * @return void
104 */
105 protected function wp_hooks() {
106
107 register_activation_hook( __FILE__, array( $this, 'run_walkthrough' ) );
108 register_activation_hook( __FILE__, array( $this, 'convert_options' ) );
109
110 add_action( 'init', array( $this, 'load_view_files' ) );
111
112 add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
113
114 add_action( 'admin_notices', array( $this, 'display_header_area' ) );
115
116 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ), 10, 1 );
117 add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
118 add_action( 'wp_head', 'ewd_add_frontend_ajax_url' );
119
120 add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2);
121 }
122
123 /**
124 * Run the options conversion function on update if necessary
125 *
126 * @since 2.0.0
127 * @access protected
128 * @return void
129 */
130 public function convert_options() {
131
132 require_once( EWD_US_PLUGIN_DIR . '/includes/BackwardsCompatibility.class.php' );
133 new ewdusBackwardsCompatibility();
134 }
135
136 /**
137 * Load files needed for views
138 * @since 2.0.0
139 * @note Can be filtered to add new classes as needed
140 */
141 public function load_view_files() {
142
143 $files = array(
144 EWD_US_PLUGIN_DIR . '/views/Base.class.php' // This will load all default classes
145 );
146
147 $files = apply_filters( 'ewd_us_load_view_files', $files );
148
149 foreach( $files as $file ) {
150 require_once( $file );
151 }
152
153 }
154
155 /**
156 * Load the plugin textdomain for localisation
157 * @since 2.0.0
158 */
159 public function load_textdomain() {
160
161 load_plugin_textdomain( 'ultimate-slider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages/' );
162 }
163
164 /**
165 * Set a transient so that the walk-through gets run
166 * @since 2.0.0
167 */
168 public function run_walkthrough() {
169
170 set_transient( 'ewd-us-getting-started', true, 30 );
171 }
172
173 /**
174 * Enqueue the admin-only CSS and Javascript
175 * @since 2.0.0
176 */
177 public function enqueue_admin_assets( $hook ) {
178 global $post;
179
180 $post_type = is_object( $post ) ? $post->post_type : ( isset( $_GET['post_type'] ) ? $_GET['post_type'] : '' );
181
182 // 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
183 if ( ( $post_type != EWD_US_SLIDER_POST_TYPE or ( $hook != 'edit.php' and $hook != 'post-new.php' and $hook != 'post.php' ) ) and $hook != 'ultimate_slider_page_ewd-us-settings' and $hook != 'widgets.php' ) { return; }
184
185 wp_enqueue_script( 'jquery-ui-core' );
186 wp_enqueue_script( 'jquery-ui-sortable' );
187 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 );
188
189 wp_enqueue_style( 'ewd-us-admin-css', EWD_US_PLUGIN_URL . '/assets/css/ewd-us-admin.css', EWD_US_VERSION );
190 }
191
192 /**
193 * Register the front-end CSS and Javascript for the slider
194 * @since 2.0.0
195 */
196 function register_assets() {
197 global $ewd_us_controller;
198
199 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 );
200 wp_register_script( 'iframe-clicks', EWD_US_PLUGIN_URL . '/assets/js/jquery.iframetracker.js' , array( 'jquery' ), EWD_US_VERSION, true );
201
202 wp_register_style( 'ewd-us-css', EWD_US_PLUGIN_URL . '/assets/css/ewd-us.css', EWD_US_VERSION );
203
204 if ( $ewd_us_controller->settings->get_setting( 'lightbox' ) ) {
205
206 wp_register_script( 'ultimate-lightbox', EWD_US_PLUGIN_URL . '/assets/js/ultimate-lightbox.js', array( 'jquery' ), EWD_US_VERSION, true );
207
208 wp_register_style( 'ewd-ulb-main', EWD_US_PLUGIN_URL . '/assets/css/ewd-ulb-main.css', EWD_US_VERSION );
209 }
210 }
211
212 /**
213 * Add links to the plugin listing on the installed plugins page
214 * @since 2.0.0
215 */
216 public function plugin_action_links( $links, $plugin ) {
217
218 if ( $plugin == EWD_US_PLUGIN_FNAME ) {
219
220 $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>';
221 }
222
223 return $links;
224
225 }
226
227 /**
228 * Adds in a menu bar for the plugin
229 * @since 2.0.0
230 */
231 public function display_header_area() {
232 global $ewd_us_controller;
233
234 $screen = get_current_screen();
235
236 if ( empty( $screen->parent_file ) or $screen->parent_file != 'edit.php?post_type=ultimate_slider' ) { return; }
237
238 if ( ! $ewd_us_controller->permissions->check_permission( 'styling' ) or get_option( 'EWD_US_Trial_Happening' ) == 'Yes' ) {
239 ?>
240 <div class="ewd-us-dashboard-new-upgrade-banner">
241 <div class="ewd-us-dashboard-banner-icon"></div>
242 <div class="ewd-us-dashboard-banner-buttons">
243 <a class="ewd-us-dashboard-new-upgrade-button" href="https://www.etoilewebdesign.com/license-payment/?Selected=US&Quantity=1" target="_blank">UPGRADE NOW</a>
244 </div>
245 <div class="ewd-us-dashboard-banner-text">
246 <div class="ewd-us-dashboard-banner-title">
247 GET FULL ACCESS WITH OUR PREMIUM VERSION
248 </div>
249 <div class="ewd-us-dashboard-banner-brief">
250 WooCommerce Integration, Advanced styling options, Advanced control options and more!
251 </div>
252 </div>
253 </div>
254 <?php
255 }
256
257 ?>
258 <div class="ewd-us-admin-header-menu">
259 <h2 class="nav-tab-wrapper">
260 <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>
261 <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>
262 <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>
263 <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>
264 </h2>
265 </div>
266 <?php
267 }
268
269 }
270 } // endif;
271
272 global $ewd_us_controller;
273 $ewd_us_controller = new ewdusInit();
274