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