PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.6.0
Shortcodes and extra features for Phlox theme v2.6.0
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / classes / class-auxin-welcome.php
auxin-elements / includes / classes Last commit date
class-auxels-admin-assets.php 6 years ago class-auxels-archive-menu-links.php 6 years ago class-auxels-envato-elements.php 6 years ago class-auxels-import-parser.php 8 years ago class-auxels-import.php 6 years ago class-auxels-search-post-type.php 6 years ago class-auxin-admin-dashboard.php 6 years ago class-auxin-demo-importer.php 6 years ago class-auxin-dependency-sorting.php 8 years ago class-auxin-import.php 6 years ago class-auxin-install.php 6 years ago class-auxin-master-nav-menu-admin.php 6 years ago class-auxin-page-template.php 6 years ago class-auxin-permalink.php 6 years ago class-auxin-plugin-requirements.php 6 years ago class-auxin-post-type-base.php 6 years ago class-auxin-siteorigin-widget.php 6 years ago class-auxin-svg-support-allowedattributes.php 7 years ago class-auxin-svg-support-allowedtags.php 7 years ago class-auxin-svg-support.php 7 years ago class-auxin-walker-nav-menu-back.php 6 years ago class-auxin-welcome-sections.php 6 years ago class-auxin-welcome.php 6 years ago class-auxin-whitelabel.php 6 years ago class-auxin-widget-indie.php 6 years ago class-auxin-widget-shortcode-map.php 6 years ago class-auxin-widget.php 6 years ago
class-auxin-welcome.php
1759 lines
1 <?php
2
3 // no direct access allowed
4 if ( ! defined('ABSPATH') ) exit;
5
6 /**
7 * Auxin_Welcome class
8 */
9 class Auxin_Welcome extends Auxin_Welcome_Base {
10
11 /**
12 * Current step
13 *
14 * @var string
15 */
16 protected $step = '';
17
18 /** @var array Steps for the setup wizard */
19 protected $steps = array();
20
21 /**
22 * TGMPA instance storage
23 *
24 * @var object
25 */
26 protected $tgmpa_instance;
27
28 /**
29 * TGMPA Menu slug
30 *
31 * @var string
32 */
33 protected $tgmpa_menu_slug = 'tgmpa-install-plugins';
34
35 /**
36 * TGMPA Menu url
37 *
38 * @var string
39 */
40 protected $tgmpa_url = 'themes.php?page=tgmpa-install-plugins';
41
42 /**
43 * Plugin filters
44 *
45 * @var array
46 */
47 protected $plugin_filters = array();
48
49
50 /**
51 * Holds the current instance of the theme manager
52 *
53 */
54 protected static $instance = null;
55
56 /**
57 * Retrieves class instance
58 *
59 * @return Auxin_Welcome
60 */
61 public static function get_instance() {
62 if ( ! self::$instance ) {
63 self::$instance = new self;
64 }
65
66 return self::$instance;
67 }
68
69
70 /**
71 * Constructor
72 */
73 public function __construct() {
74 parent::__construct();
75
76 $this->init_globals();
77 $this->init_actions();
78 }
79
80 /**
81 * Setup the class globals.
82 *
83 */
84 public function init_globals() {
85 $this->page_slug = 'auxin-welcome';
86 $this->parent_slug = 'auxin-welcome';
87 }
88
89 /**
90 * Setup the hooks, actions and filters.
91 *
92 */
93 public function init_actions() {
94 // Call the parent method
95 parent::init_actions();
96
97 if ( current_user_can( 'manage_options' ) ) {
98
99 // Disable redirect for "related posts for WordPress" plugin
100 update_option('rp4wp_do_install', 0, false );
101 // Disable redirect for the "WooCommerce" plugin
102 delete_transient( '_wc_activation_redirect' );
103 // Disable redirect for Phlox Pro plugin
104 remove_action( 'init', 'auxpro_redirect_to_welcome_page_on_first_activation' );
105
106 if ( class_exists( 'TGM_Plugin_Activation' ) && isset( $GLOBALS['tgmpa'] ) ) {
107 add_action( 'init' , array( $this, 'get_tgmpa_instanse' ), 30 );
108 add_action( 'init' , array( $this, 'set_tgmpa_url' ), 40 );
109 }
110
111 if( ! class_exists( 'Auxin_Demo_Importer' ) ){
112 require_once( 'class-auxin-demo-importer.php' );
113 }
114
115 // Get instance of Auxin_Demo_Importer Class
116 Auxin_Demo_Importer::get_instance();
117
118 // add_action( 'admin_enqueue_scripts' , array( $this, 'enqueue_scripts' ) );
119 add_filter( 'tgmpa_load' , array( $this, 'tgmpa_load' ), 10, 1 );
120 add_action( 'wp_ajax_aux_setup_plugins' , array( $this, 'ajax_plugins' ) );
121
122 add_action( 'wp_ajax_aux_ajax_uninstall', array( $this, 'ajax_uninstall') );
123
124 add_action( 'wp_ajax_aux_ajax_lightbox' , array( $this, 'ajax_lightbox') );
125 add_action( 'wp_ajax_aux_step_manager' , array( $this, 'step_manager' ) );
126
127 if( isset( $_POST['action'] ) && $_POST['action'] === "aux_setup_plugins" && wp_doing_ajax() ) {
128 add_filter( 'wp_redirect', '__return_false', 999 );
129 }
130
131 Auxin_Welcome_Sections::get_instance()->page_slug = $this->page_slug;
132 Auxin_Welcome_Sections::get_instance()->welcome = $this;
133 }
134 }
135
136 /**
137 * Adds a constant class names to body on wizard page
138 */
139 public function add_body_class( $classes ){
140 $classes = parent::add_body_class( $classes );
141
142 if( $this->current_tab( 'importer', 'plugins' ) ){
143 $classes .= ' auxin-wizard-panel';
144
145 // Add PRO selector, for some probable custom styles
146 if( defined('THEME_PRO' ) && THEME_PRO ) {
147 $classes .= ' auxin-wizard-pro';
148 }
149 }
150
151 return $classes;
152 }
153
154 /**
155 * Enqueue admin scripts
156 *
157 */
158 public function enqueue_scripts() {}
159
160 /**
161 * Check for TGMPA load
162 *
163 */
164 public function tgmpa_load( $status ) {
165 return is_admin() || current_user_can( 'install_themes' );
166 }
167
168 /**
169 * Get configured TGMPA instance
170 *
171 */
172 public function get_tgmpa_instanse() {
173 $this->tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
174 }
175
176 /**
177 * Update $tgmpa_menu_slug and $tgmpa_parent_slug from TGMPA instance
178 *
179 */
180 public function set_tgmpa_url() {
181 $this->tgmpa_menu_slug = ( property_exists( $this->tgmpa_instance, 'menu' ) ) ? $this->tgmpa_instance->menu : $this->tgmpa_menu_slug;
182 $this->tgmpa_menu_slug = apply_filters( $this->theme_id . '_theme_setup_wizard_tgmpa_menu_slug', $this->tgmpa_menu_slug );
183
184 $tgmpa_parent_slug = ( property_exists( $this->tgmpa_instance, 'parent_slug' ) && $this->tgmpa_instance->parent_slug !== 'themes.php' ) ? 'admin.php' : 'themes.php';
185
186 $this->tgmpa_url = apply_filters( $this->theme_id . '_theme_setup_wizard_tgmpa_url', $tgmpa_parent_slug . '?page=' . $this->tgmpa_menu_slug );
187 }
188
189 /**
190 * Register the admin menu
191 *
192 * @return void
193 */
194 public function register_admin_menu() {
195
196 $menu_args = $this->get_admin_menu_args();
197
198 /* Register root setting menu
199 /*-----------------------------*/
200 add_menu_page(
201 $menu_args['title'], // [Title] The title to be displayed on the corresponding page for this menu
202 $menu_args['name'], // [Text] The text to be displayed for this actual menu item
203 $menu_args['compatibility'],
204 $this->page_slug, // [ID/slug] The unique ID - that is, the slug - for this menu item
205 array( $this, 'render'), // [Callback] The name of the function to call when rendering the menu for this page
206 '', // icon_url
207 3 // [Position] The position in the menu order this menu should appear 3 means after dashboard
208 );
209
210 /* Add a menu separator
211 /*-----------------------------*/
212 add_menu_page(
213 '',
214 '',
215 'read',
216 'wp-menu-separator',
217 '',
218 '',
219 4
220 );
221
222 $this->add_submenus();
223 }
224
225
226 /**
227 * Add submenu for admin menu
228 *
229 * @return void
230 */
231 protected function add_submenus(){
232
233 global $submenu;
234
235 $menu_args = $this->get_admin_menu_args();
236
237 $sections = $this->get_sections();
238 if( empty( $sections ) ){
239 return;
240 }
241
242 foreach ( $sections as $section_id => $section ) {
243 if( ! empty( $section['add_admin_menu'] ) && $section['add_admin_menu'] ){
244
245 if( ! empty( $section['url'] ) ){
246
247 $submenu[ $this->page_slug ][] = array(
248 $section['label'],
249 $menu_args['compatibility'],
250 esc_url( $section['url'] )
251 );
252
253 } else {
254 add_submenu_page(
255 $this->page_slug,
256 $section['label'],
257 $section['label'],
258 $menu_args['compatibility'],
259 $this->get_page_rel_tab( $section_id )
260 );
261 }
262
263 }
264 }
265
266 if( isset( $submenu[ $this->page_slug ]['0'] ) ){
267 $submenu[ $this->page_slug ]['0']['0'] = __( 'Dashboard', 'auxin-elements' );
268 }
269 unset( $submenu[ $this->page_slug ]['1'] );
270 }
271
272 /*-----------------------------------------------------------------------------------*/
273 /* Start Setup Wizard
274 /*-----------------------------------------------------------------------------------*/
275
276 /**
277 * Retrieves the welcome page relative path
278 *
279 * @return string Page relative path
280 */
281 public function get_page_rel_path(){
282 return 'admin.php?page=' . $this->page_slug;
283 }
284
285 /**
286 * Display Alert Message
287 */
288 public function display_alerts( $message_body = '', $class_name = '' ){
289 ?>
290 <div class="aux-alert <?php echo esc_attr( $class_name ); ?>">
291 <p>
292 <?php
293 if( empty($message_body ) ) {
294 echo sprintf("<strong>%s</strong> %s", esc_html__( 'Note:', 'auxin-elements' ), __( 'You are recommended to install Phlox exclusive plugins in order to enable all features.', 'auxin-elements' ) );
295 } else {
296 echo esc_html( $message_body );
297 }
298 ?>
299 </p>
300 </div>
301 <?php
302 }
303
304
305 /**
306 * Collect the plugin filters
307 *
308 * @return array plugin filters
309 */
310 private function get_plugins_categories_localized(){
311 if( empty( $this->plugin_filters ) ){
312 $this->plugin_filters = apply_filters( 'auxin_admin_welcome_plugins_categories_localized', array() );
313 }
314
315 return $this->plugin_filters;
316 }
317
318
319 /**
320 * Collect all plugin categories from bundled plugins
321 *
322 * @return array plugin categories
323 */
324 private function get_plugins_categories( $all_plugins ){
325 $plugin_categories = array();
326
327 foreach ( $all_plugins as $slug => $plugin ) {
328 $filter_terms = '';
329 if( ! empty( $plugin['categories'] ) ){
330 if( is_array( $plugin['categories'] ) ){
331 $plugin_categories = array_merge( $plugin_categories, $plugin['categories'] );
332 }
333 }
334 }
335
336 return array_unique( $plugin_categories );
337 }
338
339
340 /*-----------------------------------------------------------------------------------*/
341 /* Third step (Plugin installation)
342 /*-----------------------------------------------------------------------------------*/
343 public function setup_plugins() {
344
345 tgmpa_load_bulk_installer();
346 // install plugins with TGM.
347 if ( ! class_exists( 'TGM_Plugin_Activation' ) || ! isset( $GLOBALS['tgmpa'] ) ) {
348 die( 'Failed to find TGM' );
349 }
350 $url = wp_nonce_url( add_query_arg( array( 'plugins' => 'go' ) ), 'aux-setup' );
351
352 $custom_list = isset( $_GET['items'] ) && ! empty( $_GET['items'] ) ? explode( ',', $_GET['items'] ) : array();
353 $plugins = $this->get_plugins( $custom_list );
354
355 // copied from TGM
356
357 $method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
358 $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
359
360 if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
361 return true; // Stop the normal page form from displaying, credential request form will be shown.
362 }
363
364 // Now we have some credentials, setup WP_Filesystem.
365 if ( ! WP_Filesystem( $creds ) ) {
366 // Our credentials were no good, ask the user for them again.
367 request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
368
369 return true;
370 }
371
372 $embeds_plugins_desc = array(
373 'js_composer' => 'Drag and drop page builder for WordPress. Take full control over your WordPress site, build any layout you can imagine – no programming knowledge required.',
374 'Ultimate_VC_Addons' => 'Includes Visual Composer premium addon elements like Icon, Info Box, Interactive Banner, Flip Box, Info List & Counter. Best of all - provides A Font Icon Manager allowing users to upload / delete custom icon fonts.',
375 'masterslider' => 'Master Slider is the most advanced responsive HTML5 WordPress slider plugin with touch swipe navigation that works smoothly on devices too.',
376 'go_pricing' => 'The New Generation Pricing Tables. If you like traditional Pricing Tables, but you would like get much more out of it, then this rodded product is a useful tool for you.',
377 'waspthemes-yellow-pencil' => 'The most advanced visual CSS editor. Customize any page in real-time without coding.',
378 'auxin-the-news' => 'Publish news easily and beautifully with Phlox theme.',
379 'auxin-pro-tools' => 'Premium features for Phlox theme.',
380 'auxin-shop' => 'Make a shop in easiest way using phlox theme.',
381 'envato-market' => 'WP Theme Updater based on the Envato WordPress Toolkit Library and Pixelentity class from ThemeForest forums.'
382 );
383
384 /* If we arrive here, we have the filesystem */
385
386 ?>
387 <div class="aux-setup-content">
388 <div class="aux-section-content-box">
389 <?php if( ! isset( $_GET['view'] ) || $_GET['view'] !== 'abstract' ) : ?>
390 <h3 class="aux-content-title"><?php _e('Recommended Plugins', 'auxin-elements' ); ?></h3>
391 <p style="margin-bottom:0;"><?php echo wp_sprintf( esc_html__( 'The following is a list of best integrated plugins for %s theme, you can install them from here and add or remove them later on WordPress plugins page.', 'auxin-elements' ), THEME_NAME_I18N );?></p>
392 <p><?php esc_html_e( 'We recommend you to install only the plugins under "Essential" tab, and avoid installing all of plugins.', 'auxin-elements' ); ?></p>
393 <?php endif; ?>
394
395 <div class="aux-plugins-step aux-has-required-plugins aux-fadein-animation">
396 <?php
397 if ( count( $plugins['all'] ) ) {
398
399 $plugin_categories = $this->get_plugins_categories( $plugins['all'] );
400 $plugin_categories_localized = $this->get_plugins_categories_localized();
401
402 // -----------------------------------------------------
403 ?>
404
405 <div class="aux-table">
406 <section class="auxin-list-table">
407
408 <?php if( ! isset( $_GET['view'] ) || $_GET['view'] !== 'abstract' ) : ?>
409 <div class="aux-isotope-filters aux-filters aux-underline aux-clearfix aux-togglable aux-clearfix aux-center">
410 <div class="aux-select-overlay"></div>
411 <ul>
412 <li data-filter="all"><a href="#" class="aux-selected"><span data-select="<?php _e('Recent', 'auxin-elements'); ?>"><?php _e('Recent', 'auxin-elements'); ?></span></a></li>
413 <?php
414 foreach ( $plugin_categories_localized as $filter_slug => $filter_label ) {
415 if( in_array( $filter_slug, $plugin_categories ) ){
416 echo '<li data-filter="'. esc_attr( $filter_slug . '-plugins' ) .'"><a href="#"><span data-select="'. $filter_label .'">'. $filter_label .'</span></a></li>';
417 }
418 }
419 ?>
420 </ul>
421 </div>
422 <?php endif; ?>
423
424 <header class="aux-table-heading aux-table-row aux-clearfix">
425 <div id="cb" class="manage-column aux-column-cell column-cb check-column">
426 <label class="screen-reader-text" for="cb-select-all"><?php esc_html_e( 'Select All', 'auxin-elements' ); ?></label>
427 <input id="cb-select-all" type="checkbox" style="display:none;">
428 </div>
429 <div class="manage-column aux-column-cell column-thumbnail"></div>
430 <div scope="col" id="name" class="manage-column aux-column-cell column-name"><?php esc_html_e( 'Name', 'auxin-elements' ); ?></div>
431 <div scope="col" id="description" class="manage-column aux-column-cell column-description"><?php esc_html_e( 'Description', 'auxin-elements' ); ?></div>
432 <div scope="col" id="status" class="manage-column aux-column-cell column-status"><?php esc_html_e( 'Status', 'auxin-elements' ); ?></div>
433 <div scope="col" id="version" class="manage-column aux-column-cell column-version"><?php esc_html_e( 'Version', 'auxin-elements' ); ?></div>
434 </header>
435
436 <div class="aux-wizard-plugins aux-table-body aux-isotope-plugins-list aux-clearfix">
437 <?php
438 foreach ( $plugins['all'] as $slug => $plugin ) {
439
440 // Collect plugin filters for current item
441 $filter_terms = '';
442 if( ! empty( $plugin['categories'] ) ){
443 if( is_array( $plugin['categories'] ) ){
444 foreach ( $plugin['categories'] as $category ) {
445 $filter_terms .= $category . '-plugins ';
446 }
447 }
448 }
449
450 if( $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
451 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin['file_path'] );
452 } else {
453 $plugin_data = $this->get_plugin_data_by_slug( $slug );
454 }
455 ?>
456 <div class="aux-plugin aux-table-row aux-iso-item <?php echo esc_attr( $filter_terms ); ?>" data-slug="<?php echo esc_attr( $slug ); ?>">
457 <div scope="row" class="check-column aux-column-cell">
458 <input class="aux-check-column" name="plugin[]" value="<?php echo esc_attr( $slug ); ?>" type="checkbox">
459 <div class="spinner"></div>
460 </div>
461 <div class="thumbnail column-thumbnail aux-column-cell" data-colname="Thumbnail">
462 <?php
463 $thumbnail = "https://ps.w.org/{$plugin['slug']}/assets/icon-128x128.png";
464
465 if( isset( $plugin['thumbnail'] ) ){
466 if( 'custom' == $plugin['thumbnail'] ){
467 $thumbnail = AUXELS_ADMIN_URL . '/assets/images/welcome/' . $plugin['slug'] . '-plugin.png';
468 } elseif( 'default' === $plugin['thumbnail'] ){
469 $thumbnail = AUXELS_ADMIN_URL . '/assets/images/welcome/def-plugin.png';
470 } elseif( ! empty( $plugin['thumbnail'] ) ){
471 $thumbnail = $plugin['thumbnail'];
472 }
473 }
474 ?>
475 <img src="<?php echo esc_url( $thumbnail ); ?>" width="64" height="64" />
476 </div>
477 <div class="name column-name aux-column-cell" data-colname="Plugin"><?php echo esc_html( $plugin['name'] ); ?></div>
478 <div class="description column-description aux-column-cell" data-colname="Description">
479 <?php
480 $description = '';
481 if( isset( $plugin_data['Description'] ) ) {
482 $description = $plugin_data['Description'];
483 } else if ( isset( $embeds_plugins_desc[ $plugin['slug'] ] ) ){
484 $description = $embeds_plugins_desc[ $plugin['slug'] ];
485 }
486 if( $description ){
487 echo '<p>'. $description .'</p>';
488 }
489 if ( ! empty( $plugin['badge'] ) ) {
490 echo '<span class="aux-label aux-exclusive-label">' . esc_html( $plugin['badge'] ) . '</span>';
491 }
492 ?>
493 </div>
494 <div class="status column-status aux-column-cell" data-colname="Status">
495 <span>
496 <?php
497 if ( isset( $plugins['install'][ $slug ] ) ) {
498 echo esc_html__( 'Not Installed', 'auxin-elements' );
499 } elseif ( isset( $plugins['activate'][ $slug ] ) ) {
500 echo esc_html__( 'Not Activated', 'auxin-elements' );
501 }
502 ?>
503 </span>
504 </div>
505 <div class="version column-version aux-column-cell" data-colname="Version">
506 <?php if( isset( $plugin_data['Version'] ) ) { ?>
507 <span><?php echo esc_html( $plugin_data['Version'] ); ?></span>
508 <?php } ?>
509 </div>
510 </div>
511 <?php } ?>
512 </div>
513 </section>
514 </div>
515
516 <div class="clear"></div>
517
518 <div class="aux-sticky">
519 <div class="aux-setup-actions step">
520 <a href="#"
521 class="aux-button aux-primary install-plugins disabled"
522 data-callback="install_plugins"><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
523 <?php wp_nonce_field( 'aux-setup' ); ?>
524 </div>
525 </div>
526
527 <?php
528 } else { ?>
529
530 <?php $this->display_alerts( esc_html__( 'Good news! All plugins are already installed and up to date. Please continue.', 'auxin-elements' ) , 'success' ); ?>
531
532 <?php
533 } ?>
534 </div>
535 </div>
536 </div>
537 <?php
538 }
539
540 /**
541 * Output the tgmpa plugins list
542 */
543 private function get_plugins( $custom_list = array() ) {
544
545 $plugins = array(
546 'all' => array(), // Meaning: all plugins which still have open actions.
547 'install' => array(),
548 'update' => array(),
549 'activate' => array(),
550 );
551
552 foreach ( $this->tgmpa_instance->plugins as $slug => $plugin ) {
553
554 if( ! empty( $custom_list ) && ! in_array( $slug, $custom_list ) ){
555 // This condition is for custom requests lists
556 continue;
557 } elseif( $this->tgmpa_instance->is_plugin_active( $slug ) && false === $this->tgmpa_instance->does_plugin_have_update( $slug ) ) {
558 // No need to display plugins if they are installed, up-to-date and active.
559 continue;
560 } else {
561 $plugins['all'][ $slug ] = $plugin;
562
563 if ( ! $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
564 $plugins['install'][ $slug ] = $plugin;
565 } else {
566
567 if ( false !== $this->tgmpa_instance->does_plugin_have_update( $slug ) ) {
568 $plugins['update'][ $slug ] = $plugin;
569 }
570 if ( $this->tgmpa_instance->can_plugin_activate( $slug ) ) {
571 $plugins['activate'][ $slug ] = $plugin;
572 }
573
574 }
575 }
576 }
577
578 return $plugins;
579 }
580
581 /**
582 * Returns the plugin data from WP.org API
583 */
584 private function get_plugin_data_by_slug( $slug = '' ) {
585
586 if ( empty( $slug ) ) {
587 return false;
588 }
589
590 $key = sanitize_key( 'auxin_plugin_data_'.$slug );
591
592 if ( false === ( $plugins = auxin_get_transient( $key ) ) ) {
593 $args = array(
594 'slug' => $slug,
595 'fields' => array(
596 'short_description' => true
597 )
598 );
599 $response = wp_remote_post(
600 'http://api.wordpress.org/plugins/info/1.0/',
601 array(
602 'body' => array(
603 'action' => 'plugin_information',
604 'request' => serialize( (object) $args )
605 )
606 )
607 );
608 $data = unserialize( wp_remote_retrieve_body( $response ) );
609
610 $plugins = is_object( $data ) ? array( 'Description' => $data->short_description , 'Version' => $data->version ) : false;
611
612 // Set transient for next time... keep it for 24 hours
613 auxin_set_transient( $key, $plugins, 24 * HOUR_IN_SECONDS );
614
615 }
616
617 return $plugins;
618 }
619
620 /**
621 * Plugins AJAX Process
622 */
623 public function ajax_plugins() {
624 // Inputs validations
625 if ( ! check_ajax_referer( 'aux_setup_nonce', 'wpnonce' ) || ! isset( $_POST['slug'] ) || empty( $_POST['slug'] ) ) {
626 wp_send_json_error( array( 'message' => esc_html__( 'No Slug Found', 'auxin-elements' ) ) );
627 }
628 $request = array();
629 // send back some json we use to hit up TGM
630 $plugins = $this->get_plugins();
631 // what are we doing with this plugin?
632 foreach ( $plugins['activate'] as $slug => $plugin ) {
633 if ( $slug === 'related-posts-for-wp' ) {
634 update_option( 'rp4wp_do_install', false );
635 }
636 if ( $_POST['slug'] == $slug ) {
637 $request = array(
638 'url' => admin_url( $this->tgmpa_url ),
639 'plugin' => array( $slug ),
640 'tgmpa-page' => $this->tgmpa_menu_slug,
641 'plugin_status' => 'all',
642 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
643 'action' => 'tgmpa-bulk-activate',
644 'action2' => - 1,
645 'message' => esc_html__( 'Activating', 'auxin-elements' ),
646 );
647 break;
648 }
649 }
650 foreach ( $plugins['update'] as $slug => $plugin ) {
651 if ( $_POST['slug'] == $slug ) {
652 $request = array(
653 'url' => admin_url( $this->tgmpa_url ),
654 'plugin' => array( $slug ),
655 'tgmpa-page' => $this->tgmpa_menu_slug,
656 'plugin_status' => 'all',
657 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
658 'action' => 'tgmpa-bulk-update',
659 'action2' => - 1,
660 'message' => esc_html__( 'Updating', 'auxin-elements' ),
661 );
662 break;
663 }
664 }
665 foreach ( $plugins['install'] as $slug => $plugin ) {
666 if ( $_POST['slug'] == $slug ) {
667 $request = array(
668 'url' => admin_url( $this->tgmpa_url ),
669 'plugin' => array( $slug ),
670 'tgmpa-page' => $this->tgmpa_menu_slug,
671 'plugin_status' => 'all',
672 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
673 'action' => 'tgmpa-bulk-install',
674 'action2' => - 1,
675 'message' => esc_html__( 'Installing', 'auxin-elements' ),
676 );
677 break;
678 }
679 }
680
681 if ( ! empty( $request ) ) {
682 $request['hash'] = md5( serialize( $request ) ); // used for checking if duplicates happen, move to next plugin
683 wp_send_json_success( $request );
684 }
685
686 wp_send_json_success( array( 'message' => esc_html__( 'Activated', 'auxin-elements' ) ) );
687
688 }
689
690
691 /*-----------------------------------------------------------------------------------*/
692 /* Online Demo Importer
693 /*-----------------------------------------------------------------------------------*/
694
695 public function setup_templates(){
696 $tempList = $this->get_demo_list( 'templates' );
697
698 // Create subjects group by type
699 $subjectsGroup = array();
700 foreach ( $tempList['templates'] as $key => $args ) {
701 // Convert subject JSON to Array
702 $categoryStack = json_decode( $args['subject'], true );
703 // Set group type
704 if( ! isset( $subjectsGroup[ $args['type'] ] ) ) {
705 $subjectsGroup[ $args['type'] ] = array();
706 }
707 // Pass items to group type
708 $subjectsGroup[ $args['type'] ] = array_unique( array_merge( $subjectsGroup[ $args['type'] ], $categoryStack ), SORT_REGULAR );
709 }
710
711 $activeIsoGroup = get_option( 'aux_isotope_group_templates_kit', 'page' );
712 ?>
713
714 <div class="aux-setup-template">
715
716 <div class="aux-fadein-animation">
717
718 <div class="aux-isotope-filters aux-filters aux-underline aux-clearfix aux-togglable aux-clearfix aux-center">
719 <div class="aux-isotope-group-wrapper">
720 <span>Pages</span>
721 <input type="checkbox" class="aux-isotope-group aux_switch" data-nonce="<?php echo wp_create_nonce( 'aux-iso-group' ); ?>" value="1" <?php checked( 1, $activeIsoGroup === 'page' ? 0 : 1, true ); ?> />
722 <span>Sections</span>
723 </div>
724 <div class="aux-isotope-filters-wrapper">
725 <?php
726 foreach ( $subjectsGroup as $type => $subjects ) {
727 ?>
728 <ul class="aux-group-filter aux-grouping-<?php echo esc_attr( $type ); ?> <?php echo $activeIsoGroup !== $type ? 'aux-iso-hidden' : ''; ?>">
729 <li data-filter="all"><a href="#" class="aux-selected"><span data-select="<?php _e('Recent', 'auxin-elements'); ?>"><?php _e('Recent', 'auxin-elements'); ?></span></a></li>
730 <?php
731 foreach ( $subjects as $filter_label ) {
732 $filter_data = preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $filter_label ) );
733 echo '<li data-filter="'. strtolower( str_replace( ' ', '-', $filter_data ) . '-subject' ) .'"><a href="#"><span data-select="'. $filter_label .'">'. $filter_label .'</span></a></li>';
734 }
735 ?>
736 </ul>
737 <?php
738 }
739 ?>
740 </div>
741 <div class="aux-isotope-search-wrapper">
742 <input type="text" placeholder="<?php echo esc_html__( 'Search Templates', 'auxin-elements' ); ?>" class="aux-isotope-search">
743 </div>
744 </div>
745
746 <div class="aux-templates-list aux-grid-list aux-isotope-templates" data-search-filter="true" data-grouping="<?php echo esc_attr( $activeIsoGroup ); ?> ">
747 <?php
748 if( ! is_array( $tempList['templates'] ) ){
749 echo '<p class="aux-grid-item grid_12">'. __( 'An error occurred while downloading the list of templates. Please try again later.' ) .'</p>';
750 } else {
751 foreach ( $tempList['templates'] as $key => $args ) {
752
753 // Collect plugin filters for current item
754 $filter_categories = '';
755 if( ! empty( $args['subject'] ) ){
756 $categories = json_decode( $args['subject'], true );
757 foreach ( $categories as $num => $category ) {
758 $category_decode = preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $category ) );
759 $filter_categories .= strtolower( str_replace( ' ', '-', $category_decode ) . '-subject ' );
760 }
761 }
762
763 $filter_tags = '';
764 if( ! empty( $args['tags'] ) ){
765 $categories = json_decode( $args['tags'], true );
766 foreach ( $categories as $num => $tags ) {
767 $filter_tags .= strtolower( str_replace( ' ', '-', $tags ) . '-tag ' );
768 }
769 }
770
771 // Check demo license
772 $is_demo_allowed = auxin_is_activated() || ! $args['is_pro'];
773
774 echo '<div data-template-type="'.$args['type'].'" class="aux-grid-item aux-iso-item grid_3 aux-grouping-'.esc_attr( $args['type'] ).' '.esc_attr( $filter_categories ).' '.esc_attr( $filter_tags ).'">';
775 echo '<div class="aux-grid-item-inner">';
776 echo '<div class="aux-grid-template-media">';
777 echo '<img class="template_thumbnail aux-preload aux-blank" data-src='.$args['thumbnail'].' src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">';
778 if( ! $is_demo_allowed ) {
779 echo '<img class="premium_badge" alt="This is a premium demo" src="'. esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/pro-badge.png' ) .'">';
780 }
781 echo '</div>';
782 ?>
783 <div class="aux-grid-item-footer">
784 <h3 class="aux-item-title"><?php echo $args['title']; ?></h3>
785 <div class="aux-grid-item-buttons aux-clearfix">
786 <?php
787
788 $template_status = 'import';
789 $more_btn_class = 'hide';
790
791 if( $is_demo_allowed ) {
792 $color_class = " aux-open-modal aux-import-template aux-has-next-action aux-iconic-action aux-green2";
793 $btn_label = esc_html__( 'Download', 'auxin-elements' );
794 $import_btn_url = add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'type' => 'progress' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) );
795
796 if( ! empty( $args['plugins'] ) ) {
797 $plugins = $this->get_plugins( json_decode( $args['plugins'], true ) );
798 if( ! empty( $plugins['all'] ) ) {
799 $color_class = " aux-open-modal aux-import-template aux-iconic-action aux-green2";
800 $import_btn_url = add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'key' => $key, 'type' => 'plugins' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) );
801 }
802 }
803
804 if( false !== auxin_get_transient( sanitize_key( "auxin_template_kit_{$args['type']}_data_for_origin_id_{$args['id']}" ) ) ) {
805 $template_status = 'copy';
806 $btn_label = esc_html__( 'Copy to clipboard', 'auxin-elements' );
807 $color_class = " aux-copy-template aux-iconic-action aux-orange";
808 $import_btn_url = '#';
809 $more_btn_class = '';
810 }
811
812 } else {
813 $color_class = " aux-blue aux-pro-demo aux-locked-demo aux-iconic-action";
814 $btn_label = esc_html__( 'Unlock', 'auxin-elements' );
815 $import_btn_url = esc_url( 'http://phlox.pro/go-pro/?utm_source=phlox-welcome&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=template-unlock&utm_term='. $args['id'] );
816
817 if( defined('THEME_PRO' ) && THEME_PRO ){
818 $color_class .= " aux-ajax-open-modal";
819 $import_btn_url = add_query_arg( array( 'action' => 'auxin_display_actvation_form', 'nonce' => wp_create_nonce( 'aux-activation-form' ) ), admin_url( 'admin-ajax.php' ) );
820 }
821 }
822
823
824 ?>
825 <a target="_blank" href="<?php echo esc_url( add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'type' => 'preview', 'preview' => $args['preview'], 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) ) ) ?>"
826 class="aux-wl-button aux-open-modal aux-outline aux-round aux-transparent aux-large aux-preview"><?php esc_html_e( 'Preview', 'auxin-elements' ); ?></a>
827 <a href="<?php echo esc_url( $import_btn_url ); ?>"
828 class="aux-wl-button aux-outline aux-round aux-large <?php echo esc_attr( $color_class ); ?>"
829 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
830 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
831 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
832 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
833 data-status-type="<?php echo esc_attr( $template_status ); ?>"
834 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
835 ><span><?php echo $btn_label; ?></span></a>
836 <a href="#" class="aux-more-button <?php echo esc_attr( $more_btn_class ) ;?>">
837 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/more.svg' ); ?>" width="4" height="18" />
838 </a>
839 <ul class="aux-more-items">
840 <li>
841 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'type' => 'progress' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) ) ); ?>"
842 class="aux-open-modal aux-has-next-action"
843 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
844 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
845 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
846 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
847 data-status-type="create_my_template"
848 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
849 ><span><?php echo esc_html__( 'Save to my templates', 'auxin-elements' ); ?></span></a>
850 </li>
851 <li>
852 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'type' => 'progress' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) ) ); ?>"
853 class="aux-open-modal aux-has-next-action"
854 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
855 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
856 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
857 data-status-type="create_new_page"
858 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
859 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
860 ><span><?php echo esc_html__( 'Create new page', 'auxin-elements' ); ?></span></a>
861 </li>
862 </ul>
863 </div>
864 </div>
865 </div>
866 <?php
867 echo '</div>';
868 }
869 }
870 ?>
871 </div>
872
873 <div class="clear"></div>
874
875 </div>
876
877 </div>
878
879 <?php
880 }
881
882 /*-----------------------------------------------------------------------------------*/
883 /* Online Demo Importer
884 /*-----------------------------------------------------------------------------------*/
885
886 public function setup_importer() {
887 // Get the available demos list from Averta API
888 $demo_list = $this->get_demo_list();
889 // Get last imported demo data
890 $last_demo_imported = get_option( 'auxin_last_imported_demo' );
891
892 ?>
893 <div class="aux-setup-content">
894
895 <div class="aux-demo-importer-step aux-fadein-animation">
896
897 <div class="aux-demo-list aux-grid-list aux-isotope-list">
898 <?php
899 if( ! is_array( $demo_list ) ){
900 echo '<p class="aux-grid-item grid_12">'. __( 'An error occurred while downloading the list of demo sites. Please try again later.' ) .'</p>';
901 } else {
902 foreach ( $demo_list['items'] as $key => $args ) {
903 // Checking the last imported demo...
904 $is_active_demo = ! empty( $last_demo_imported ) && $last_demo_imported['id'] == $args['id'] ? 'aux-last-imported-demo' : '';
905
906 // Check demo license
907 $is_demo_allowed = auxin_is_activated() || !$args['is_pro'];
908
909 echo '<div data-demo-id="demo-'.$args['id'].'" class="aux-grid-item aux-iso-item grid_4 '.$is_active_demo.'">';
910 echo '<div class="aux-grid-item-inner">';
911 echo '<div class="aux-grid-item-media">';
912 echo '<img class="demo_thumbnail aux-preload aux-blank" data-src='.$args['thumbnail'].' src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">';
913 if( ! $is_demo_allowed ) {
914 echo '<img class="premium_badge" alt="This is a premium demo" src="'. esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/pro-badge.png' ) .'">';
915 }
916 echo '</div>';
917 ?>
918 <div class="aux-grid-item-footer">
919 <h3><?php echo $args['title']; ?></h3>
920 <div class="aux-grid-item-buttons aux-clearfix">
921 <?php
922 if( $is_demo_allowed ) {
923 $color_class = $is_active_demo ? " aux-open-modal aux-import-demo aux-iconic-action aux-uninstall aux-orange" : " aux-open-modal aux-import-demo aux-iconic-action aux-green2";
924 $btn_label = $is_active_demo ? esc_html__( 'Uninstall', 'auxin-elements' ) : esc_html__( 'Import', 'auxin-elements' );
925 $import_type = $is_active_demo ? 'uninstall' : 'install';
926 $import_btn_url = add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'key' => $key, 'type' => $import_type , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) );
927 } else {
928 $color_class = " aux-blue aux-pro-demo aux-locked-demo aux-iconic-action";
929 $btn_label = esc_html__( 'Unlock', 'auxin-elements' );
930 $import_btn_url = esc_url( 'http://phlox.pro/go-pro/?utm_source=phlox-welcome&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=demo-unlock&utm_term='. $args['id'] );
931 if( defined('THEME_PRO' ) && THEME_PRO ){
932 $color_class .= " aux-ajax-open-modal";
933 $import_btn_url = add_query_arg( array( 'action' => 'auxin_display_actvation_form', 'nonce' => wp_create_nonce( 'aux-activation-form' ) ), admin_url( 'admin-ajax.php' ) );
934 }
935 }
936 ?>
937 <a target="_blank" href="<?php echo $import_btn_url; ?>"
938 class="aux-wl-button aux-outline aux-round aux-large <?php echo esc_attr( $color_class ); ?>" data-demo-key="<?php echo esc_html( $key );?>"><?php echo $btn_label; ?></a>
939 <a target="_blank" href="<?php echo ! empty( $args['url'] ) ? esc_url( $args['url'] .'&utm_term='.$args['id'] ) : '#'; ?>"
940 class="aux-wl-button aux-outline aux-round aux-transparent aux-large aux-preview"><?php esc_html_e( 'Preview', 'auxin-elements' ); ?></a>
941 </div>
942 </div>
943 </div>
944 <?php
945 echo '</div>';
946 }
947 }
948 ?>
949 </div>
950
951 <div class="clear"></div>
952
953 </div>
954
955 </div>
956
957 <?php
958 }
959
960 /**
961 * Parse the demos list API
962 */
963 public function get_demo_list( $type = 'demos', $url = 'http://demo.phlox.pro/api/v2/info/', $sanitize_key = 'auxin_cache_demo_library_items' ) {
964
965 // $url = 'http://demo.phlox.pro/api/?demo_list&demo=beta&key=averta_avtdph';
966
967 if( $type === 'templates' ){
968 $url = 'http://library.phlox.pro/info-api/';
969 $sanitize_key = 'auxin_cache_template_library_items';
970 }
971
972 $key = sanitize_key( $sanitize_key );
973
974 if ( ( false === $data = auxin_get_transient( $key ) ) || isset( $_GET['flush_transient'] ) ) {
975
976 $response = wp_remote_post( $url );
977
978 if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
979 $response = wp_remote_retrieve_body( $response );
980 } else {
981 $error_message = "Something went wrong while connecting ($url): " . $response->get_error_message();
982 echo '<div class="aux-admin-info-box aux-admin-info-warn aux-admin-welcome-info">' . $error_message . '</div>';
983 // if cUrl timeout error was thrown, increase the timeout to 15. Default is 5.
984 if( false !== strpos( $error_message, 'cURL error 28') ){
985 set_theme_mod('increasing_curl_timeout_is_required', 15);
986 }
987
988 if ( wp_doing_ajax() ){
989 die();
990 } else {
991 return;
992 }
993 }
994
995 // translate the JSON into Array
996 $data = json_decode( $response, true );
997
998 if( ! is_array( $data ) ){
999 if ( wp_doing_ajax() ){
1000 die();
1001 } else {
1002 return;
1003 }
1004 }
1005
1006 // Add transient
1007 auxin_set_transient( $key, $data, 24 * HOUR_IN_SECONDS );
1008 }
1009
1010 return $data;
1011 }
1012
1013
1014 /*-----------------------------------------------------------------------------------*/
1015 /* Step setup_updates
1016 /*-----------------------------------------------------------------------------------*/
1017
1018 public function setup_updates(){
1019 $last_update = auxin_get_update_list();
1020
1021 $has_response = isset( $last_update->total_updates ) ? $last_update->total_updates : false;
1022 ?>
1023 <div class="aux-setup-content">
1024 <div class="aux-updates-step aux-section-content-box">
1025
1026 <?php
1027 if( ! $has_response ){
1028 ?>
1029 <h3 class="aux-content-title"><?php _e('You have already the latest version.', 'auxin-elements' ); ?></h3>
1030 <?php
1031 } else {
1032 ?>
1033 <h3 class="aux-content-title"><?php _e('New updates are available.', 'auxin-elements' ); ?></h3>
1034 <p><?php esc_html_e( 'The following items require update, click update button to update them to the latest version.', 'auxin-elements' ); ?></p>
1035 <?php
1036 }
1037 ?>
1038 <div class="aux-fadein-animation">
1039 <?php
1040 if( ! $has_response ){
1041 $this->display_alerts( sprintf(
1042 '%s %s %s',
1043 esc_html__( 'Last checked ', 'auxin-elements' ),
1044 $last_update->last_checked,
1045 esc_html__( 'ago', 'auxin-elements' )
1046 ) , 'success' );
1047 } else {
1048 echo '<div class="aux-update-items">';
1049
1050 if( isset( $last_update->themes ) && is_array( $last_update->themes ) ) {
1051 ?>
1052 <ul class="aux-update-list aux-update-themes">
1053 <?php
1054 foreach ( $last_update->themes as $stylesheet => $args ) {
1055 $theme = wp_get_theme( $stylesheet );
1056 ?>
1057 <li class="aux-item" data-key="<?php echo esc_attr( $stylesheet ); ?>" data-type="themes">
1058 <label class="aux-control">
1059 <?php echo esc_html( $theme->get( 'Name' ) ); ?>
1060 <div class="aux-indicator"></div>
1061 <input name="theme[]" value="<?php echo esc_attr( $stylesheet ); ?>" type="hidden">
1062 </label>
1063 <div class="aux-status column-status">
1064 <span class="update">
1065 <?php echo esc_html__( 'Ready to update', 'auxin-elements' ); ?>
1066 </span>
1067 </div>
1068 </li>
1069 <?php
1070 }
1071 ?>
1072 </ul>
1073 <?php
1074 }
1075
1076 if( isset( $last_update->plugins ) && is_array( $last_update->plugins ) ) {
1077 ?>
1078 <div class="aux-headers">
1079 <span>Plugin Name</span>
1080 <span>Status</span>
1081 </div>
1082 <ul class="aux-update-list aux-update-plugins">
1083 <?php
1084 foreach ( $last_update->plugins as $path => $args ) {
1085 $plugin = get_plugin_data( WP_PLUGIN_DIR . '/' . $path );
1086 ?>
1087 <li class="aux-item" data-key="<?php echo esc_attr( $path ); ?>" data-type="plugins">
1088 <label class="aux-control">
1089 <?php echo esc_html( $plugin['Name'] ); ?>
1090 <div class="aux-indicator"></div>
1091 <input name="plugin[]" value="<?php echo esc_attr( $path ); ?>" type="hidden">
1092 </label>
1093 <div class="aux-status column-status">
1094 <span class="update">
1095 <?php echo esc_html__( 'Ready to update', 'auxin-elements' ); ?>
1096 </span>
1097 </div>
1098 </li>
1099 <?php
1100 }
1101 ?>
1102 </ul>
1103 <?php
1104 }
1105
1106 echo '</div>';
1107 }
1108
1109 ?>
1110 </div>
1111 <div class="aux-sticky">
1112 <div class="aux-setup-actions step">
1113 <?php if( $has_response ){ ?>
1114 <a href="#"
1115 class="aux-button aux-primary aux-install-updates" data-nonce="<?php echo esc_attr( wp_create_nonce( 'auxin-start-upgrading' ) ); ?>"><?php esc_html_e( 'Update Now', 'auxin-elements' ); ?></a>
1116 <?php } ?>
1117 <a href="<?php echo self_admin_url( 'admin.php?page=auxin-welcome&tab=updates&force-check=1' ); ?>"
1118 class="aux-button aux-outline"><?php esc_html_e( 'Check Again', 'auxin-elements' ); ?></a>
1119 </div>
1120 </div>
1121 <div class="clear"></div>
1122 </div>
1123 </div>
1124 <?php
1125 }
1126
1127 /*-----------------------------------------------------------------------------------*/
1128 /* Step manager in modal
1129 /*-----------------------------------------------------------------------------------*/
1130
1131 /**
1132 * This function will removing the last imported demo
1133 */
1134 public function ajax_uninstall(){
1135 // Check Security Token
1136 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'aux-demo-uninstall' ) ) {
1137 // This nonce is not valid.
1138 wp_send_json_error( esc_html__( 'Security Token Error!', 'auxin-elements' ) );
1139 }
1140
1141 // Checking the Active Demo ID with requested one
1142 $last_demo = get_option( 'auxin_last_imported_demo' );
1143 $request_id = isset( $_POST['id'] ) ? $_POST['id'] : false;
1144 if( ! $request_id || ! $last_demo || $last_demo['id'] != $request_id ) {
1145 wp_send_json_error( esc_html__( 'You can\'t remove this demo.', 'auxin-elements' ) );
1146 }
1147
1148 // call WPDB class instance
1149 global $wpdb;
1150
1151 // Remove Attachments
1152 $attachments = get_posts( array(
1153 'post_type' => 'attachment',
1154 'posts_per_page' => -1,
1155 'post_status' => 'inherit',
1156 'meta_key' => 'auxin_import_id'
1157 ) );
1158 if ( $attachments ) {
1159 foreach ( $attachments as $attachment ) {
1160 wp_delete_attachment( $attachment->ID, true );
1161 }
1162 }
1163
1164 // Remove Posts
1165 $posts = get_posts( array(
1166 'post_type' => 'any',
1167 'posts_per_page' => -1,
1168 'post_status' => 'any',
1169 'meta_key' => 'auxin_import_post'
1170 ) );
1171 if ( $posts ) {
1172 foreach ( $posts as $post ) {
1173 wp_delete_post( $post->ID, true );
1174 }
1175 }
1176
1177 // Remove Menus
1178 $menus = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_name LIKE '%auxin_demo_importer_menu_origin_id_%'", OBJECT );
1179 foreach ($menus as $key => $menu) {
1180 if( is_numeric( $menu->option_value ) ) {
1181 wp_delete_nav_menu( $menu->option_value );
1182 }
1183 }
1184
1185 // Remove Options
1186 delete_option( THEME_ID.'_theme_options' );
1187 update_option( 'show_on_front', 'page' );
1188 update_option( 'page_on_front', '0' );
1189 remove_theme_mod('custom_css_string');
1190 remove_theme_mod('custom_css_array');
1191 remove_theme_mod('custom_logo');
1192 remove_theme_mod('font_subsets');
1193
1194 // Remove all active widgets
1195 update_option( 'sidebars_widgets', array( 'array_version' => 3 ) );
1196
1197 // Disable all demo plugins other than auxin plugins...
1198 $demo_plugins = isset( $_POST['plugins'] ) ? $_POST['plugins'] : array();
1199 if( ! empty( $demo_plugins ) ) {
1200 $active_plugins = get_option( 'active_plugins' );
1201 foreach ( $active_plugins as $key => $name ) {
1202 if( auxin_strposa( $name, $demo_plugins ) && strpos( $name, 'auxin' ) === false ){
1203 unset( $active_plugins[$key] );
1204 }
1205 }
1206 update_option( 'active_plugins', $active_plugins );
1207 }
1208
1209 // Remove Additional CSS data
1210 wp_update_custom_css_post( NULL );
1211
1212 // Stores css content in custom css file
1213 auxin_save_custom_css();
1214 // Stores JavaScript content in custom js file
1215 auxin_save_custom_js();
1216
1217 // And finally remove the last imported demo info
1218 delete_option( 'auxin_last_imported_demo' );
1219
1220 ob_start();
1221 ?>
1222 <div class="aux-setup-demo-content aux-content-col aux-step-import-completed">
1223 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/completed.svg' ); ?>" />
1224 <div><h2 class="aux-step-import-title"><?php esc_html_e( 'Done!', 'auxin-elements' ); ?></h2></div>
1225 <p class="aux-step-description"><?php esc_html_e( "Demo has been successfully uninstalled.", 'auxin-elements' ); ?></p>
1226 </div>
1227 <div class="aux-setup-demo-actions">
1228 <div class="aux-return-back">
1229 <a href="<?php echo home_url(); ?>" class="aux-button aux-round aux-green aux-medium" target="_blank">
1230 <?php _e( 'Preview', 'auxin-elements' ); ?>
1231 </a>
1232 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1233 <?php _e( 'Close', 'auxin-elements' ); ?>
1234 </a>
1235 </div>
1236 </div>
1237 <?php
1238
1239 // Return Success Notification
1240 wp_send_json_success( array(
1241 'button' => __( 'Import', 'auxin-elements' ),
1242 'url' => add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'key' => $_POST['key'], 'type' => 'install' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) ),
1243 'markup' => ob_get_clean(),
1244 ) );
1245 }
1246
1247 /**
1248 * Ajax modal box
1249 */
1250 public function ajax_lightbox() {
1251
1252 if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'aux-open-lightbox' ) ) {
1253 // This nonce is not valid.
1254 wp_die( esc_html__( 'Security Token Error!', 'auxin-elements' ) );
1255 }
1256
1257 $type = isset( $_GET['type'] ) ? $_GET['type'] : 'progress';
1258
1259 ob_start();
1260
1261 if( $type == 'progress' ) {
1262 echo sprintf( '<div class="aux-template-lightbox"><div class="aux-modal-item aux-default-modal clearfix aux-steps-col">%s</div></div>', $this->progress_step( array(), '' ) );
1263 wp_die( ob_get_clean() );
1264 }
1265
1266 if( $type == 'preview' ) {
1267 if( isset( $_GET['preview'] ) ){
1268 echo sprintf( '<div class="aux-template-lightbox aux-preview-lightbox"><div class="clearfix"><img class="aux-preview-image" src="%s" /><div class="aux-template-actions"><a href="#" class="aux-button aux-medium aux-outline aux-transparent aux-pp-close">%s</a></div></div></div>', $_GET['preview'], __( 'Close', 'auxin-elements' ) );
1269 wp_die( ob_get_clean() );
1270 }
1271 }
1272
1273 if( $type == 'plugins' ) {
1274 $data = $this->get_demo_list( 'templates' );
1275 $args = $data['templates'][ $_GET['key'] ];
1276 $args = array(
1277 'plugins' => $args['plugins'],
1278 'next_action' => 'template_manager'
1279 );
1280 echo sprintf( '<div class="aux-template-lightbox"><div class="aux-modal-item aux-default-modal clearfix aux-has-required-plugins aux-steps-col">%s</div></div>', $this->second_step( $args, '5' ) );
1281 wp_die( ob_get_clean() );
1282 }
1283
1284 $data = $this->get_demo_list();
1285
1286 if( ! isset( $_GET['key'] ) || empty( $data['items'] ) || ! array_key_exists( $_GET['key'] , $data['items'] ) ) {
1287 wp_die( esc_html__( 'An Error Occurred!', 'auxin-elements' ) );
1288 }
1289
1290 $args = $data['items'][ $_GET['key'] ];
1291
1292 if( $type == 'install' ) :
1293 ?>
1294 <div id="demo-<?php echo esc_attr( $args['id'] ); ?>" class="aux-demo-lightbox">
1295 <div class="aux-modal-item clearfix aux-has-required-plugins">
1296 <div class="grid_5 no-gutter aux-media-col" style="background-image: url(<?php echo esc_url( $args['screen'] ); ?>);" >
1297 </div>
1298 <div class="grid_7 no-gutter aux-steps-col">
1299 <div class="aux-setup-demo-content aux-content-col aux-step-import-notice">
1300 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/import-notice.svg' ); ?>" />
1301 <div><h2 class="aux-step-import-title aux-iconic-title"><?php esc_html_e( 'Notice', 'auxin-elements' ); ?></h2></div>
1302 <p class="aux-step-description">
1303 <?php esc_html_e( "For better and faster result, it's recommended to install the demo on a clean WordPress website.", 'auxin-elements' ); ?>
1304 </p>
1305 </div>
1306 <div class="aux-setup-demo-actions">
1307 <div class="aux-return-back">
1308 <a href="#" data-next-step="2" class="aux-button aux-next-step aux-primary aux-medium" data-args="<?php echo htmlspecialchars( wp_json_encode( $args ), ENT_QUOTES, 'UTF-8' ); ?>" data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>">
1309 <?php _e( 'Continue', 'auxin-elements' ); ?>
1310 </a>
1311 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1312 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1313 </a>
1314 </div>
1315 </div>
1316 </div>
1317 </div>
1318 </div>
1319 <?php
1320 else :
1321 ?>
1322 <div id="demo-<?php echo esc_attr( $args['id'] ); ?>" class="aux-demo-lightbox">
1323 <div class="aux-modal-item clearfix aux-has-required-plugins">
1324 <div class="grid_5 no-gutter aux-media-col" style="background-image: url(<?php echo esc_url( $args['screen'] ); ?>);" >
1325 </div>
1326 <div class="grid_7 no-gutter aux-steps-col">
1327 <div class="aux-setup-demo-content aux-content-col aux-step-import-notice">
1328 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/warning.png' ); ?>" />
1329 <div><h2 class="aux-step-import-title aux-iconic-title"><?php esc_html_e( 'Warning!', 'auxin-elements' ); ?></h2></div>
1330 <p class="aux-step-description">
1331 <?php esc_html_e( "This process will erase all images, posts and settings of this demo...", 'auxin-elements' ); ?>
1332 </p>
1333 </div>
1334 <div class="aux-setup-demo-actions">
1335 <div class="aux-return-back">
1336 <a href="#" class="aux-button aux-uninstall-demo aux-red aux-medium" data-demo-plugins="<?php echo htmlspecialchars( wp_json_encode( $args['plugins'] ), ENT_QUOTES, 'UTF-8' ); ?>" data-demo-id="<?php echo $args['id']; ?>" data-demo-nonce="<?php echo wp_create_nonce( 'aux-demo-uninstall' ); ?>" data-demo-confirm="<?php esc_html_e( 'Are you sure you want to uninstall this demo?', 'auxin-elements' ); ?>">
1337 <?php _e( 'Uninstall', 'auxin-elements' ); ?>
1338 </a>
1339 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1340 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1341 </a>
1342 </div>
1343 <div class="aux-progress hide">
1344 <div class="aux-big">
1345 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;">
1346 <span class="aux-progress-label"><?php esc_html_e( 'Please wait, this may take several minutes ..', 'auxin-elements' ); ?></span>
1347 </div>
1348 </div>
1349 </div>
1350 </div>
1351 </div>
1352 </div>
1353 </div>
1354 <?php
1355 endif;
1356
1357 wp_die( ob_get_clean() );
1358 }
1359
1360
1361 public function step_manager() {
1362 $next_step = $_POST['next_step'];
1363 $nonce = $_POST['nonce'];
1364 $args = $_POST['args'];
1365
1366 $steps = array(
1367 '1' => array(
1368 'method' => 'first_step',
1369 'next' => '2'
1370 ),
1371 '2' => array(
1372 'method' => 'second_step',
1373 'next' => '6'
1374 ),
1375 '3' => array(
1376 'method' => 'third_step',
1377 'next' => '4'
1378 ),
1379 '4' => array(
1380 'method' => 'fourth_step',
1381 'next' => ''
1382 ),
1383 '5' => array(
1384 'method' => 'progress_step',
1385 'next' => ''
1386 ),
1387 '6' => array(
1388 'method' => 'envato_elements_step',
1389 'next' => '3'
1390 ),
1391 '7' => array(
1392 'method' => 'get_user_email_step',
1393 'next' => '8'
1394 ),
1395 '8' => array(
1396 'method' => 'verify_envato_elements_step',
1397 'next' => '3'
1398 )
1399
1400 );
1401
1402 if ( ! wp_verify_nonce( $nonce, 'aux-step-manager' ) ) {
1403 // This nonce is not valid.
1404 wp_send_json_error( esc_html__( 'An error occurred!', 'auxin-elements' ) );
1405 } elseif( ! $next_step || $steps[$next_step]['method'] == '' ){
1406 wp_send_json_error( esc_html__( 'Method not exist!', 'auxin-elements' ) );
1407 }
1408
1409 wp_send_json_success(
1410 array(
1411 'markup' => call_user_func( array( $this, $steps[$next_step]['method'] ), $args, $steps[$next_step]['next'] )
1412 )
1413 );
1414 }
1415
1416 public function first_step( array $args, $next_step ) {
1417 ob_start();
1418 ?>
1419 <div class="aux-setup-demo-content aux-content-col">
1420 <h2><?php esc_html_e( 'Required Plugins for this demo.', 'auxin-elements' ); ?></h2>
1421 <p class="aux-step-description">
1422 <?php esc_html_e( "For better and faster install process it's recommended to install demo on a clean WordPress website.", 'auxin-elements' ); ?>
1423 </p>
1424 </div>
1425 <div class="aux-setup-demo-actions">
1426 <div class="aux-return-back">
1427 <a href="#" data-next-step="<?php echo esc_attr( $next_step ); ?>" class="aux-button aux-next-step aux-primary aux-medium" data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>" data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>">
1428 <?php _e( 'Continue', 'auxin-elements' ); ?>
1429 </a>
1430 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1431 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1432 </a>
1433 </div>
1434 </div>
1435 <?php
1436 return ob_get_clean();
1437 }
1438
1439 public function second_step( array $args, $next_step ) {
1440
1441 // Goto next step, if no required plugins found
1442 if( ! isset( $args['plugins'] ) ) {
1443 return call_user_func( array( $this, 'third_step' ), $args, '4' );
1444 }
1445
1446 $plugins_list = json_decode( stripslashes( $args['plugins'] ), true );
1447
1448 $plugins = $this->get_plugins( $plugins_list );
1449 $has_plugin_required = ! empty( $plugins_list ) && ! empty( $plugins['all'] );
1450
1451 if( $has_plugin_required ) :
1452 $next_step = Auxels_Envato_Elements::get_instance()->is_envato_element_enabled() ? '3' : $next_step;
1453 ob_start();
1454 ?>
1455 <div class="aux-setup-demo-content aux-content-col aux-install-plugins">
1456 <h2><?php esc_html_e( 'Required Plugins for this demo.', 'auxin-elements' ); ?></h2>
1457 <p class="aux-step-description"><?php esc_html_e( 'The following plugins are required to be installed for this demo.', 'auxin-elements' ); ?></p>
1458 <ul class="aux-wizard-plugins">
1459 <?php
1460 foreach ( $plugins['all'] as $slug => $plugin ) { ?>
1461 <li class="aux-plugin" data-slug="<?php echo esc_attr( $slug ); ?>">
1462 <label class="aux-control aux-checkbox">
1463 <?php echo esc_html( $plugin['name'] ); ?>
1464 <input name="plugin[]" value="<?php echo esc_attr($slug); ?>" type="checkbox" checked>
1465 <div class="aux-indicator"></div>
1466 </label>
1467 <div class="status column-status">
1468 <?php
1469 $keys = $class = '';
1470 if ( isset( $plugins['install'][ $slug ] ) ) {
1471 $keys = esc_html__( 'Ready to install', 'auxin-elements' );
1472 $class = 'install';
1473 }
1474 if ( isset( $plugins['activate'][ $slug ] ) ) {
1475 $keys = esc_html__( 'Not activated', 'auxin-elements' );
1476 $class = 'activate';
1477 }
1478 if ( isset( $plugins['update'][ $slug ] ) ) {
1479 $keys = esc_html__( 'Ready to update', 'auxin-elements' );
1480 $class = 'update';
1481 }
1482 ?>
1483 <span class="<?php echo $class ?>">
1484 <?php echo $keys; ?>
1485 </span>
1486 <div class="spinner"></div>
1487 </div>
1488 </li>
1489 <?php
1490 }
1491 ?>
1492 </ul>
1493 </div>
1494 <div class="aux-setup-demo-actions">
1495 <div class="aux-return-back">
1496 <a href="#"
1497 class="aux-button aux-medium install-plugins aux-primary"
1498 data-callback="install_plugins"
1499 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1500 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1501 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1502 data-next-action="<?php echo isset( $args['next_action'] ) ? $args['next_action'] : false; ?>"
1503 ><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
1504 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1505 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1506 </a>
1507 </div>
1508 </div>
1509 <?php
1510 return ob_get_clean();
1511 else :
1512 return Auxels_Envato_Elements::get_instance()->is_envato_element_enabled() ? call_user_func( array( $this, 'third_step' ), $args, '4' ) : call_user_func( array( $this, 'envato_elements_step' ), $args, '3' ) ;
1513 return ;
1514 endif;
1515 }
1516
1517 public function third_step( array $args, $next_step ) {
1518 ob_start();
1519 ?>
1520 <div class="aux-setup-demo-content aux-content-col aux-install-demos">
1521 <h2><?php esc_html_e( 'Import Demo Content of Phlox Theme.' ); ?></h2>
1522
1523 <form id="aux-import-data-<?php echo esc_attr( $args['id'] ); ?>" class="aux-import-parts">
1524 <div class="complete aux-border is-checked">
1525 <label class="aux-control aux-radio">
1526 <?php esc_html_e( 'Complete pre-build Website', 'auxin-elements' ); ?>
1527 <input type="radio" name="import" value="complete" checked="checked" />
1528 <div class="aux-indicator"></div>
1529 </label>
1530 <label class="aux-control aux-checkbox">
1531 <?php esc_html_e( 'Import media (images, videos, etc.)', 'auxin-elements' ); ?>
1532 <input type="checkbox" name="import-media" checked="checked" />
1533 <div class="aux-indicator"></div>
1534 </label>
1535 </div>
1536 <div class="custom aux-border">
1537 <label class="aux-control aux-radio">
1538 <?php esc_html_e( 'Selected Data Only', 'auxin-elements' ); ?>
1539 <input type="radio" name="import" value="custom" />
1540 <div class="aux-indicator"></div>
1541 </label>
1542 <div class="one_half no-gutter">
1543 <label class="aux-control aux-checkbox">
1544 <?php esc_html_e( 'Posts/Pages', 'auxin-elements' ); ?>
1545 <input type="checkbox" name="posts" />
1546 <div class="aux-indicator"></div>
1547 </label>
1548 <label class="aux-control aux-checkbox">
1549 <?php esc_html_e( 'Media', 'auxin-elements' ); ?>
1550 <input type="checkbox" name="media" />
1551 <div class="aux-indicator"></div>
1552 </label>
1553 <label class="aux-control aux-checkbox">
1554 <?php esc_html_e( 'Widgets', 'auxin-elements' ); ?>
1555 <input type="checkbox" name="widgets" />
1556 <div class="aux-indicator"></div>
1557 </label>
1558 </div>
1559 <div class="one_half no-gutter right-half">
1560 <label class="aux-control aux-checkbox">
1561 <?php esc_html_e( 'Menus', 'auxin-elements' ); ?>
1562 <input type="checkbox" name="menus" />
1563 <div class="aux-indicator"></div>
1564 </label>
1565 <label class="aux-control aux-checkbox">
1566 <?php esc_html_e( 'Theme Options', 'auxin-elements' ); ?>
1567 <input type="checkbox" name="options" />
1568 <div class="aux-indicator"></div>
1569 </label>
1570 <label class="aux-control aux-checkbox">
1571 <?php esc_html_e( 'MasterSlider (If Available)', 'auxin-elements' ); ?>
1572 <input type="checkbox" name="masterslider" />
1573 <div class="aux-indicator"></div>
1574 </label>
1575 </div>
1576 </div>
1577 </form>
1578 </div>
1579 <div class="aux-setup-demo-content aux-content-col aux-install-demos-waiting hide">
1580 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/importing-cloud.svg' ); ?>" />
1581 <h2><?php esc_html_e( 'Importing Demo Content is in Progress...' ); ?></h2>
1582 <p class="aux-step-description"><?php esc_html_e( 'This process may take 5 to 10 minutes to complete, please do not close or refresh this page.', 'auxin-elements' ); ?></p>
1583 </div>
1584 <div class="aux-setup-demo-actions">
1585 <div class="aux-return-back">
1586 <a href="#"
1587 class="aux-button aux-install-demo aux-medium aux-primary button-next"
1588 data-nonce="<?php echo wp_create_nonce( 'aux-import-demo-' . $args['id'] ); ?>"
1589 data-import-id="<?php echo esc_attr( $args['id'] ); ?>"
1590 data-callback="install_demos"
1591 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1592 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1593 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1594 ><?php esc_html_e( 'Import Content', 'auxin-elements' ); ?></a>
1595 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1596 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1597 </a>
1598 </div>
1599 <div class="aux-progress hide">
1600 <div class="aux-big">
1601 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;">
1602 <span class="aux-progress-label"><?php esc_html_e( 'Please wait, this may take several minutes ..', 'auxin-elements' ); ?></span>
1603 </div>
1604 </div>
1605 </div>
1606 </div>
1607 <?php
1608 return ob_get_clean();
1609 }
1610
1611 public function fourth_step( array $args, $next_step ) {
1612 ob_start();
1613 ?>
1614 <div class="aux-setup-demo-content aux-content-col aux-step-import-completed">
1615 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/completed.svg' ); ?>" />
1616 <div><h2 class="aux-step-import-title"><?php esc_html_e( 'Congratulations!' ); ?></h2></div>
1617 <p class="aux-step-description"><?php esc_html_e( "Demo has been successfully imported.", 'auxin-elements' ); ?></p>
1618 </div>
1619 <div class="aux-setup-demo-actions">
1620 <div class="aux-return-back">
1621 <a href="<?php echo self_admin_url('customize.php'); ?>" class="aux-button aux-primary aux-medium" target="_blank">
1622 <?php _e( 'Customize', 'auxin-elements' ); ?>
1623 </a>
1624 <a href="<?php echo home_url(); ?>" class="aux-button aux-round aux-green aux-medium" target="_blank">
1625 <?php _e( 'Preview', 'auxin-elements' ); ?>
1626 </a>
1627 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1628 <?php _e( 'Close', 'auxin-elements' ); ?>
1629 </a>
1630 </div>
1631 </div>
1632 <?php
1633 return ob_get_clean();
1634 }
1635
1636 public function progress_step( array $args, $next_step ) {
1637 ob_start();
1638 ?>
1639 <h3 class="aux-loading-title"><?php esc_html_e( 'Importing page content ...', 'auxin-elements' ); ?></h3>
1640 <div class="aux-progress">
1641 <div class="aux-big">
1642 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;"></div>
1643 </div>
1644 </div>
1645 <?php
1646 return ob_get_clean();
1647 }
1648
1649 public function envato_elements_step( array $args, $next_step ) {
1650 ob_start();
1651 ?>
1652 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements">
1653 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/envato_elements.svg' ); ?>" />
1654 <h2 class="aux-step-import-title"><?php esc_html_e( 'Images are copyrighted and watermarked. You can remove watermarks by having Envato Elements subscription', 'auxin-elements' ); ?></h2>
1655 <p class="aux-step-description"><?php esc_html_e( "By subscribing to Envato Elements you will have access to unlimited premium stock images, icons, graphical assets, videos and more.", 'auxin-elements' ); ?></p>
1656 <a href="http://avt.li/elements" class="aux-button aux-primary aux-medium aux-explore-envato">
1657 <?php _e( 'Explore and Subscribe', 'auxin-elements' ); ?>
1658 </a>
1659 <?php
1660 $activate_step = '7';
1661 if ( ! empty( get_option( 'phlox_envato_elements_license_code', '' ) ) ) {
1662 $activate_step = '8';
1663 }
1664 ?>
1665 <p><?php esc_html_e( 'Already an Envato Elements member?', 'auxin-elements' ); ?> <a href="#" class="aux-next-step" data-next-step="<?php echo esc_attr( $activate_step ); ?>" data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>" data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"><?php esc_html_e( 'Activate here', 'auxin-elements' );?></a> </p>
1666 </div>
1667 <div class="aux-setup-demo-actions">
1668 <div class="aux-return-back">
1669 <a href="#" data-next-step="<?php echo esc_attr( $next_step ); ?>" class="aux-button aux-next-step aux-outline aux-round aux-transparent aux-medium" data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>" data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>">
1670 <?php _e( 'Skip', 'auxin-elements' ); ?>
1671 </a>
1672 </div>
1673 </div>
1674 <?php
1675 return ob_get_clean();
1676 }
1677
1678 public function get_user_email_step( array $args, $next_step) {
1679 ob_start();
1680 ?>
1681 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements aux-step-verify-envato-elements">
1682 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/activation.svg' ); ?>" />
1683 <h2 class="aux-step-import-title"><?php esc_html_e( 'Verify Your Envato Elements Subscription', 'auxin-elements' ); ?></h2>
1684 <p class="aux-step-description"><?php esc_html_e( "Enter your email below and click continue button", 'auxin-elements' ); ?></p>
1685 <div class="token-wrapper">
1686 <input type="text" class="email-field" placeholder="<?php esc_attr_e( 'Enter your email', 'auxin-elements' ); ?>">
1687 <p class="result"></p>
1688 </div>
1689 </div>
1690 <div class="aux-setup-demo-actions">
1691 <div class="aux-return-back">
1692 <a href="#"
1693 class="aux-button aux-medium aux-primary aux-verify-elements-email"
1694 data-callback="get_license_code"
1695 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1696 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1697 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1698 ><?php esc_html_e( 'Continue', 'auxin-elements' ); ?></a>
1699 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1700 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1701 </a>
1702 </div>
1703 </div>
1704 <?php
1705 return ob_get_clean();
1706 }
1707
1708 public function verify_envato_elements_step( array $args, $next_step) {
1709 ob_start();
1710 ?>
1711 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements aux-step-verify-envato-elements">
1712 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/activation.svg' ); ?>" />
1713 <h2 class="aux-step-import-title"><?php esc_html_e( 'Verify Your Envato Elements Subscription', 'auxin-elements' ); ?></h2>
1714 <p class="aux-step-description"><?php esc_html_e( "Enter your token below to verify your Subscription", 'auxin-elements' ); ?></p>
1715 <div class="token-wrapper">
1716 <input type="text" class="token-field" placeholder="<?php esc_attr_e( 'Enter token here', 'auxin-elements' ); ?>">
1717 <a href="#" class="aux-button aux-medium aux-verify-elements-token">
1718 <?php _e( 'Verify token', 'auxin-elements' ); ?>
1719 </a>
1720 <p class="result"></p>
1721 </div>
1722 <div class="aux-info-links">
1723 <?php
1724 $token_link = '#';
1725 $extension_id = get_option( 'phlox_envato_elements_license_code', '' );
1726 if ( ! empty( $extension_id ) ) {
1727 $extension_description = get_bloginfo( 'name' ) . ' (' . get_home_url() . ')';
1728 $token_link = 'https://api.extensions.envato.com/extensions/begin_activation?extension_id=' . $extension_id . '&extension_type=envato-wordpress&extension_description=' . $this->encode_url_parameter( $extension_description ) . '&utm_content=settings&irgwc=1&clickid=1bPRxZzJ-xyOR7DwUx0Mo3EUUkiwuR1BCVsiXk0&iradid=298927&utm_campaign=elements_af_1264782&iradtype=ONLINE_TRACKING_LINK&irmptype=mediapartner&utm_medium=affiliate&utm_source=impact_radius&mp=averta';
1729 }
1730 ?>
1731 <a href="<?php echo esc_url( $token_link ); ?>" target="_blank" class="aux-generate-token" ><?php esc_html_e( 'How to generate a token ?', 'auxin-elements' );?></a>
1732 <a href="#" class="aux-subscription" ><?php esc_html_e( 'Don\'t have subscription?', 'auxin-elements' );?></a>
1733 </div>
1734 </div>
1735 <div class="aux-setup-demo-actions">
1736 <div class="aux-return-back">
1737 <a href="#"
1738 class="aux-button aux-medium aux-primary aux-token-step-continue button-next"
1739 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1740 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1741 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1742 ><?php esc_html_e( 'Continue', 'auxin-elements' ); ?></a>
1743 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1744 <?php _e( 'Cancel', 'auxin-elements' ); ?>
1745 </a>
1746 </div>
1747 </div>
1748 <?php
1749 return ob_get_clean();
1750 }
1751
1752 private function encode_url_parameter( $parameter ) {
1753 $parameter = html_entity_decode( $parameter, ENT_QUOTES | ENT_XML1, 'UTF-8' );
1754 $parameter = str_replace( '#', '', $parameter );
1755
1756 return urlencode( $parameter );
1757 }
1758 }
1759