PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.9.21
Shortcodes and extra features for Phlox theme v2.9.21
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 4 years ago class-auxels-archive-menu-links.php 4 years ago class-auxels-envato-elements.php 4 years ago class-auxels-import-parser.php 4 years ago class-auxels-import.php 3 years ago class-auxels-search-post-type.php 4 years ago class-auxels-wc-attribute-nav-menu.php 4 years ago class-auxin-admin-dashboard.php 4 years ago class-auxin-demo-importer.php 3 years ago class-auxin-dependency-sorting.php 4 years ago class-auxin-import.php 4 years ago class-auxin-install.php 4 years ago class-auxin-master-nav-menu-admin.php 3 years ago class-auxin-page-template.php 4 years ago class-auxin-permalink.php 3 years ago class-auxin-plugin-requirements.php 4 years ago class-auxin-post-type-base.php 4 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 4 years ago class-auxin-walker-nav-menu-back.php 4 years ago class-auxin-welcome-sections.php 3 years ago class-auxin-welcome.php 3 years ago class-auxin-whitelabel.php 4 years ago class-auxin-widget-indie.php 4 years ago class-auxin-widget-shortcode-map.php 4 years ago class-auxin-widget.php 3 years ago
class-auxin-welcome.php
2014 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' ), esc_html__( 'You are recommended to install Phlox exclusive plugins in order to enable all features.', 'auxin-elements' ) );
295 } else {
296 echo wp_kses_post( $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( ',', auxin_sanitize_input( $_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 'depicter' => 'Make animated and interactive sliders and carousels which work smoothly across devices.',
377 '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.',
378 'waspthemes-yellow-pencil' => 'The most advanced visual CSS editor. Customize any page in real-time without coding.',
379 'auxin-the-news' => 'Publish news easily and beautifully with Phlox theme.',
380 'auxin-pro-tools' => 'Premium features for Phlox theme.',
381 'auxin-shop' => 'Make a shop in easiest way using phlox theme.',
382 'envato-market' => 'WP Theme Updater based on the Envato WordPress Toolkit Library and Pixelentity class from ThemeForest forums.'
383 );
384
385 /* If we arrive here, we have the filesystem */
386
387 ?>
388 <div class="aux-setup-content">
389 <div class="aux-section-content-box">
390 <?php if( ! isset( $_GET['view'] ) || $_GET['view'] !== 'abstract' ) : ?>
391 <h3 class="aux-content-title"><?php esc_html_e('Recommended Plugins', 'auxin-elements' ); ?></h3>
392 <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>
393 <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>
394 <?php endif; ?>
395
396 <div class="aux-plugins-step aux-has-required-plugins aux-fadein-animation">
397 <?php
398 if ( count( $plugins['all'] ) ) {
399
400 $plugin_categories = $this->get_plugins_categories( $plugins['all'] );
401 $plugin_categories_localized = $this->get_plugins_categories_localized();
402
403 // -----------------------------------------------------
404 ?>
405
406 <div class="aux-table">
407 <section class="auxin-list-table">
408
409 <?php if( ! isset( $_GET['view'] ) || $_GET['view'] !== 'abstract' ) : ?>
410 <div class="aux-isotope-filters aux-filters aux-underline aux-clearfix aux-togglable aux-clearfix aux-center">
411 <div class="aux-select-overlay"></div>
412 <ul>
413 <li data-filter="all"><a href="#" class="aux-selected"><span data-select="<?php esc_attr_e('Recent', 'auxin-elements'); ?>"><?php esc_attr_e('Recent', 'auxin-elements'); ?></span></a></li>
414 <?php
415 foreach ( $plugin_categories_localized as $filter_slug => $filter_label ) {
416 if( in_array( $filter_slug, $plugin_categories ) ){
417 echo '<li data-filter="'. esc_attr( $filter_slug . '-plugins' ) .'"><a href="#"><span data-select="'. esc_attr( $filter_label ) .'">'. esc_html( $filter_label ) .'</span></a></li>';
418 }
419 }
420 ?>
421 </ul>
422 </div>
423 <?php endif; ?>
424
425 <header class="aux-table-heading aux-table-row aux-clearfix">
426 <div id="cb" class="manage-column aux-column-cell column-cb check-column">
427 <label class="screen-reader-text" for="cb-select-all"><?php esc_html_e( 'Select All', 'auxin-elements' ); ?></label>
428 <input id="cb-select-all" type="checkbox" style="display:none;">
429 </div>
430 <div class="manage-column aux-column-cell column-thumbnail"></div>
431 <div scope="col" id="name" class="manage-column aux-column-cell column-name"><?php esc_html_e( 'Name', 'auxin-elements' ); ?></div>
432 <div scope="col" id="description" class="manage-column aux-column-cell column-description"><?php esc_html_e( 'Description', 'auxin-elements' ); ?></div>
433 <div scope="col" id="status" class="manage-column aux-column-cell column-status"><?php esc_html_e( 'Status', 'auxin-elements' ); ?></div>
434 <div scope="col" id="version" class="manage-column aux-column-cell column-version"><?php esc_html_e( 'Version', 'auxin-elements' ); ?></div>
435 </header>
436
437 <div class="aux-wizard-plugins aux-table-body aux-isotope-plugins-list aux-clearfix">
438 <?php
439 foreach ( $plugins['all'] as $slug => $plugin ) {
440
441 // Collect plugin filters for current item
442 $filter_terms = '';
443 if( ! empty( $plugin['categories'] ) ){
444 if( is_array( $plugin['categories'] ) ){
445 foreach ( $plugin['categories'] as $category ) {
446 $filter_terms .= $category . '-plugins ';
447 }
448 }
449 }
450
451 if( $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
452 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin['file_path'] );
453 } else {
454 $plugin_data = $this->get_plugin_data_by_slug( $slug );
455 }
456 ?>
457 <div class="aux-plugin aux-table-row aux-iso-item <?php echo esc_attr( $filter_terms ); ?>" data-slug="<?php echo esc_attr( $slug ); ?>">
458 <div scope="row" class="check-column aux-column-cell">
459 <input class="aux-check-column" name="plugin[]" value="<?php echo esc_attr( $slug ); ?>" type="checkbox">
460 <div class="spinner"></div>
461 </div>
462 <div class="thumbnail column-thumbnail aux-column-cell" data-colname="Thumbnail">
463 <?php
464 if ( isset( $plugin['wp-image-name'] ) ) {
465 $thumbnail = "https://ps.w.org/{$plugin['slug']}/assets/" . $plugin['wp-image-name'];
466 } else {
467 $thumbnail = "https://ps.w.org/{$plugin['slug']}/assets/icon-128x128.png";
468 }
469
470 if( isset( $plugin['thumbnail'] ) ){
471 if( 'custom' == $plugin['thumbnail'] ){
472 $thumbnail = AUXELS_ADMIN_URL . '/assets/images/welcome/' . $plugin['slug'] . '-plugin.png';
473 } elseif( 'default' === $plugin['thumbnail'] ){
474 $thumbnail = AUXELS_ADMIN_URL . '/assets/images/welcome/def-plugin.png';
475 } elseif( ! empty( $plugin['thumbnail'] ) ){
476 $thumbnail = $plugin['thumbnail'];
477 }
478 }
479 ?>
480 <img src="<?php echo esc_url( $thumbnail ); ?>" width="64" height="64" />
481 </div>
482 <div class="name column-name aux-column-cell" data-colname="Plugin"><?php echo esc_html( $plugin['name'] ); ?></div>
483 <div class="description column-description aux-column-cell" data-colname="Description">
484 <?php
485 $description = '';
486 if( isset( $plugin_data['Description'] ) ) {
487 $description = $plugin_data['Description'];
488 } else if ( isset( $embeds_plugins_desc[ $plugin['slug'] ] ) ){
489 $description = $embeds_plugins_desc[ $plugin['slug'] ];
490 }
491 if( $description ){
492 echo '<p>'. wp_kses_post( $description ) .'</p>';
493 }
494 if ( ! empty( $plugin['badge'] ) ) {
495 echo '<span class="aux-label aux-exclusive-label">' . esc_html( $plugin['badge'] ) . '</span>';
496 }
497 ?>
498 </div>
499 <div class="status column-status aux-column-cell" data-colname="Status">
500 <span>
501 <?php
502 if ( isset( $plugins['install'][ $slug ] ) ) {
503 echo esc_html__( 'Not Installed', 'auxin-elements' );
504 } elseif ( isset( $plugins['activate'][ $slug ] ) ) {
505 echo esc_html__( 'Not Activated', 'auxin-elements' );
506 }
507 ?>
508 </span>
509 </div>
510 <div class="version column-version aux-column-cell" data-colname="Version">
511 <?php if( isset( $plugin_data['Version'] ) ) { ?>
512 <span><?php echo esc_html( $plugin_data['Version'] ); ?></span>
513 <?php } ?>
514 </div>
515 </div>
516 <?php } ?>
517 </div>
518 </section>
519 </div>
520
521 <div class="clear"></div>
522
523 <div class="aux-sticky">
524 <div class="aux-setup-actions step">
525 <a href="#"
526 class="aux-button aux-primary install-plugins disabled"
527 data-callback="install_plugins"><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
528 <?php wp_nonce_field( 'aux-setup' ); ?>
529 </div>
530 </div>
531
532 <?php
533 } else { ?>
534
535 <?php $this->display_alerts( esc_html__( 'Good news! All plugins are already installed and up to date. Please continue.', 'auxin-elements' ) , 'success' ); ?>
536
537 <?php
538 } ?>
539 </div>
540 </div>
541 </div>
542 <?php
543 }
544
545 /**
546 * Output the tgmpa plugins list
547 */
548 private function get_plugins( $custom_list = array() ) {
549
550 $plugins = array(
551 'all' => array(), // Meaning: all plugins which still have open actions.
552 'install' => array(),
553 'update' => array(),
554 'activate' => array(),
555 );
556
557 foreach ( $this->tgmpa_instance->plugins as $slug => $plugin ) {
558
559 if( ! empty( $custom_list ) && ! in_array( $slug, $custom_list ) ){
560 // This condition is for custom requests lists
561 continue;
562 } elseif( $this->tgmpa_instance->is_plugin_active( $slug ) && false === $this->tgmpa_instance->does_plugin_have_update( $slug ) ) {
563 // No need to display plugins if they are installed, up-to-date and active.
564 continue;
565 } else {
566 $plugins['all'][ $slug ] = $plugin;
567
568 if ( ! $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
569 $plugins['install'][ $slug ] = $plugin;
570 } else {
571
572 if ( false !== $this->tgmpa_instance->does_plugin_have_update( $slug ) ) {
573 $plugins['update'][ $slug ] = $plugin;
574 }
575 if ( $this->tgmpa_instance->can_plugin_activate( $slug ) ) {
576 $plugins['activate'][ $slug ] = $plugin;
577 }
578
579 }
580 }
581 }
582
583 return $plugins;
584 }
585
586 /**
587 * Returns the plugin data from WP.org API
588 */
589 private function get_plugin_data_by_slug( $slug = '' ) {
590
591 if ( empty( $slug ) ) {
592 return false;
593 }
594
595 $key = sanitize_key( 'auxin_plugin_data_'.$slug );
596
597 if ( false === ( $plugins = auxin_get_transient( $key ) ) ) {
598 $args = array(
599 'slug' => $slug,
600 'fields' => array(
601 'short_description' => true
602 )
603 );
604 $response = wp_remote_post(
605 'http://api.wordpress.org/plugins/info/1.0/',
606 array(
607 'body' => array(
608 'action' => 'plugin_information',
609 'request' => serialize( (object) $args )
610 )
611 )
612 );
613 $data = unserialize( wp_remote_retrieve_body( $response ) );
614
615 $plugins = is_object( $data ) ? array( 'Description' => $data->short_description , 'Version' => $data->version ) : false;
616
617 // Set transient for next time... keep it for 24 hours
618 auxin_set_transient( $key, $plugins, 24 * HOUR_IN_SECONDS );
619
620 }
621
622 return $plugins;
623 }
624
625 /**
626 * Plugins AJAX Process
627 */
628 public function ajax_plugins() {
629 // Inputs validations
630 if ( ! check_ajax_referer( 'aux_setup_nonce', 'wpnonce' ) || ! isset( $_POST['slug'] ) || empty( $_POST['slug'] ) ) {
631 wp_send_json_error( array( 'message' => esc_html__( 'No Slug Found', 'auxin-elements' ) ) );
632 }
633 $request = array();
634 // send back some json we use to hit up TGM
635 $plugins = $this->get_plugins();
636 // what are we doing with this plugin?
637 foreach ( $plugins['activate'] as $slug => $plugin ) {
638 if ( $slug === 'related-posts-for-wp' ) {
639 update_option( 'rp4wp_do_install', false );
640 }
641 if ( $_POST['slug'] == $slug ) {
642 $request = array(
643 'url' => admin_url( $this->tgmpa_url ),
644 'plugin' => array( $slug ),
645 'tgmpa-page' => $this->tgmpa_menu_slug,
646 'plugin_status' => 'all',
647 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
648 'action' => 'tgmpa-bulk-activate',
649 'action2' => - 1,
650 'message' => esc_html__( 'Activating', 'auxin-elements' ),
651 );
652 break;
653 }
654 }
655 foreach ( $plugins['update'] as $slug => $plugin ) {
656 if ( $_POST['slug'] == $slug ) {
657 $request = array(
658 'url' => admin_url( $this->tgmpa_url ),
659 'plugin' => array( $slug ),
660 'tgmpa-page' => $this->tgmpa_menu_slug,
661 'plugin_status' => 'all',
662 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
663 'action' => 'tgmpa-bulk-update',
664 'action2' => - 1,
665 'message' => esc_html__( 'Updating', 'auxin-elements' ),
666 );
667 break;
668 }
669 }
670 foreach ( $plugins['install'] as $slug => $plugin ) {
671 if ( $_POST['slug'] == $slug ) {
672 $request = array(
673 'url' => admin_url( $this->tgmpa_url ),
674 'plugin' => array( $slug ),
675 'tgmpa-page' => $this->tgmpa_menu_slug,
676 'plugin_status' => 'all',
677 '_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
678 'action' => 'tgmpa-bulk-install',
679 'action2' => - 1,
680 'message' => esc_html__( 'Installing', 'auxin-elements' ),
681 );
682 break;
683 }
684 }
685
686 if ( ! empty( $request ) ) {
687 $request['hash'] = md5( serialize( $request ) ); // used for checking if duplicates happen, move to next plugin
688 wp_send_json_success( $request );
689 }
690
691 wp_send_json_success( array( 'message' => esc_html__( 'Activated', 'auxin-elements' ) ) );
692
693 }
694
695
696 /*-----------------------------------------------------------------------------------*/
697 /* Online Demo Importer
698 /*-----------------------------------------------------------------------------------*/
699
700 public function setup_templates(){
701 $template_list = $this->get_demo_list( 'templates' );
702
703 // Create subjects group by type
704 $subjects_group = array();
705
706 if( $template_list ){
707 foreach ( $template_list['templates'] as $key => $args ) {
708 // Convert subject JSON to Array
709 $categoryStack = json_decode( $args['subject'], true );
710 // Set group type
711 if( ! isset( $subjects_group[ $args['type'] ] ) ) {
712 $subjects_group[ $args['type'] ] = array();
713 }
714 // Pass items to group type
715 $subjects_group[ $args['type'] ] = array_unique( array_merge( $subjects_group[ $args['type'] ], $categoryStack ), SORT_REGULAR );
716 }
717 }
718
719 $activeIsoGroup = get_option( 'aux_isotope_group_templates_kit', 'page' );
720 ?>
721
722 <div class="aux-setup-template">
723
724 <div class="aux-fadein-animation">
725
726 <div class="aux-isotope-filters aux-filters aux-underline aux-clearfix aux-togglable aux-clearfix aux-center">
727 <div class="aux-isotope-group-wrapper">
728 <span>Pages</span>
729 <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 ); ?> />
730 <span>Sections</span>
731 </div>
732 <div class="aux-isotope-filters-wrapper">
733 <?php
734 foreach ( $subjects_group as $type => $subjects ) {
735 ?>
736 <ul class="aux-group-filter aux-grouping-<?php echo esc_attr( $type ); ?> <?php echo $activeIsoGroup !== $type ? 'aux-iso-hidden' : ''; ?>">
737 <li data-filter="all"><a href="#" class="aux-selected"><span data-select="<?php esc_attr_e('Recent', 'auxin-elements'); ?>"><?php esc_html_e('Recent', 'auxin-elements'); ?></span></a></li>
738 <?php
739 foreach ( $subjects as $filter_label ) {
740 $filter_data = preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $filter_label ) );
741 echo '<li data-filter="'. strtolower( str_replace( ' ', '-', $filter_data ) . '-subject' ) .'"><a href="#"><span data-select="'. esc_attr( $filter_label ) .'">'. esc_html( $filter_label ) .'</span></a></li>';
742 }
743 ?>
744 </ul>
745 <?php
746 }
747 ?>
748 </div>
749 <div class="aux-isotope-search-wrapper">
750 <input type="text" placeholder="<?php echo esc_html__( 'Search Templates', 'auxin-elements' ); ?>" class="aux-isotope-search">
751 </div>
752 </div>
753
754 <div class="aux-templates-list aux-grid-list aux-isotope-templates" data-search-filter="true" data-grouping="<?php echo esc_attr( $activeIsoGroup ); ?> ">
755 <?php
756 if( ! is_array( $template_list['templates'] ) ){
757 echo '<p class="aux-grid-item grid_12">'. esc_html__( 'An error occurred while downloading the list of templates. Please try again later.' ) .'</p>';
758 } else {
759 foreach ( $template_list['templates'] as $key => $args ) {
760
761 // Collect plugin filters for current item
762 $filter_categories = '';
763 if( ! empty( $args['subject'] ) ){
764 $categories = json_decode( $args['subject'], true );
765 foreach ( $categories as $num => $category ) {
766 $category_decode = preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $category ) );
767 $filter_categories .= strtolower( str_replace( ' ', '-', $category_decode ) . '-subject ' );
768 }
769 }
770
771 $filter_tags = '';
772 if( ! empty( $args['tags'] ) ){
773 $categories = json_decode( $args['tags'], true );
774 foreach ( $categories as $num => $tags ) {
775 $filter_tags .= strtolower( str_replace( ' ', '-', $tags ) . '-tag ' );
776 }
777 }
778
779 // Check demo license
780 $is_demo_allowed = auxin_is_activated() || ! $args['is_pro'];
781
782 echo '<div data-template-type="'. esc_attr( $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 ).'">';
783 echo '<div class="aux-grid-item-inner">';
784 echo '<div class="aux-grid-template-media">';
785 echo '<img class="template_thumbnail aux-preload aux-blank" data-src='.esc_url( $args['thumbnail'] ).' src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">';
786 if( ! $is_demo_allowed ) {
787 echo '<img class="premium_badge" alt="This is a premium demo" src="'. esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/pro-badge.png' ) .'">';
788 }
789 echo '</div>';
790 ?>
791 <div class="aux-grid-item-footer">
792 <h3 class="aux-item-title"><?php echo esc_html( $args['title'] ); ?></h3>
793 <div class="aux-grid-item-buttons aux-clearfix">
794 <?php
795
796 $template_status = 'import';
797 $more_btn_class = 'hide';
798
799 if( $is_demo_allowed ) {
800 $color_class = " aux-open-modal aux-import-template aux-has-next-action aux-iconic-action aux-green2";
801 $btn_label = __( 'Download', 'auxin-elements' );
802 $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' ) );
803
804 if( ! empty( $args['plugins'] ) ) {
805 $plugins = $this->get_plugins( json_decode( $args['plugins'], true ) );
806 if( ! empty( $plugins['all'] ) ) {
807 $color_class = " aux-open-modal aux-import-template aux-iconic-action aux-green2";
808 $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' ) );
809 }
810 }
811
812 if( false !== auxin_get_transient( sanitize_key( "auxin_template_kit_{$args['type']}_data_for_origin_id_{$args['id']}" ) ) ) {
813 $template_status = 'copy';
814 $btn_label = __( 'Copy to clipboard', 'auxin-elements' );
815 $color_class = " aux-copy-template aux-iconic-action aux-orange";
816 $import_btn_url = '#';
817 $more_btn_class = '';
818 }
819
820 } else {
821 $color_class = " aux-blue aux-pro-demo aux-locked-demo aux-iconic-action";
822 $btn_label = __( 'Unlock', 'auxin-elements' );
823 $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'] );
824
825 if( defined('THEME_PRO' ) && THEME_PRO ){
826 $color_class .= " aux-ajax-open-modal";
827 $import_btn_url = add_query_arg( array( 'action' => 'auxin_display_actvation_form', 'nonce' => wp_create_nonce( 'aux-activation-form' ) ), admin_url( 'admin-ajax.php' ) );
828 }
829 }
830
831
832 ?>
833 <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' ) ) ) ?>"
834 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>
835 <a href="<?php echo esc_url( $import_btn_url ); ?>"
836 class="aux-wl-button aux-outline aux-round aux-large <?php echo esc_attr( $color_class ); ?>"
837 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
838 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
839 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
840 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
841 data-status-type="<?php echo esc_attr( $template_status ); ?>"
842 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
843 ><span><?php echo esc_html( $btn_label ); ?></span></a>
844 <a href="#" class="aux-more-button <?php echo esc_attr( $more_btn_class ) ;?>">
845 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/more.svg' ); ?>" width="4" height="18" />
846 </a>
847 <ul class="aux-more-items">
848 <li>
849 <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' ) ) ); ?>"
850 class="aux-open-modal aux-has-next-action"
851 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
852 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
853 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
854 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
855 data-status-type="create_my_template"
856 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
857 ><span><?php echo esc_html__( 'Save to my templates', 'auxin-elements' ); ?></span></a>
858 </li>
859 <li>
860 <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' ) ) ); ?>"
861 class="aux-open-modal aux-has-next-action"
862 data-template-id="<?php echo esc_attr( $args['id'] ); ?>"
863 data-template-type="<?php echo esc_attr( $args['type'] ); ?>"
864 data-template-page-tmpl="<?php echo esc_attr( $args['page_tmpl'] ); ?>"
865 data-status-type="create_new_page"
866 data-template-title="<?php echo esc_attr( $args['title'] ); ?>"
867 data-nonce="<?php echo wp_create_nonce( 'aux-template-manager' ); ?>"
868 ><span><?php echo esc_html__( 'Create new page', 'auxin-elements' ); ?></span></a>
869 </li>
870 </ul>
871 </div>
872 </div>
873 </div>
874 <?php
875 echo '</div>';
876 }
877 }
878 ?>
879 </div>
880
881 <div class="clear"></div>
882
883 </div>
884
885 </div>
886
887 <?php
888 }
889
890 /*-----------------------------------------------------------------------------------*/
891 /* Online Demo Importer
892 /*-----------------------------------------------------------------------------------*/
893
894 public function setup_importer() {
895 // Get the available demos list from Averta API
896 $demo_list = $this->get_demo_list();
897 // Get last imported demo data
898 $last_demo_imported = get_option( 'auxin_last_imported_demo' );
899
900 ?>
901 <div class="aux-setup-content">
902
903 <div class="aux-demo-importer-step aux-fadein-animation">
904 <div class="aux-isotope-filters aux-filters aux-underline aux-clearfix aux-togglable aux-clearfix aux-center">
905 <?php
906 $categories_list = [];
907 foreach ( $demo_list['items'] as $key => $args ) {
908
909 if ( !empty( $args['category'] ) && $args['category'] != "[]" ) {
910 $categories = str_replace( '"', '', substr( $args['category'], 1, -1 ) );
911 } else {
912 $categories = '';
913 }
914
915 $categories_array = explode( ',', $categories );
916 foreach ( $categories_array as $index => $category ) {
917 $categories_list[ $category ] = isset( $categories_list[ $category ] ) ? ++$categories_list[ $category ] : 1;
918 }
919 }
920 ?>
921 <ul class="aux-group-filter">
922 <li data-filter="all"><a href="#" class="aux-selected"><span data-select="<?php esc_attr_e('All Templates', 'auxin-elements'); ?>"><?php esc_html_e('All Templates', 'auxin-elements'); ?><span>(<?php echo count( $demo_list['items']);?>)</span></span></a></li>
923 <?php
924
925 // move shop category to second position
926 $categories_list = auxin_array_insert_after( $categories_list, key( $categories_list ), [ "Shop" => $categories_list['Shop'] ] );
927 $categories_list = array_map( "unserialize", array_unique( array_map( "serialize", $categories_list ) ) );
928
929 foreach ( $categories_list as $category => $demos_count ) {
930 $filter = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $category ) ) );
931 if ( empty( $filter ) ) {
932 continue;
933 }
934 echo '<li data-filter="'. esc_attr( $filter ) .'-subject"><a href="#"><span data-select="'. esc_attr( $filter ) .'">'. esc_html( $category ) .'<span>(' . esc_html( $demos_count ) . ')</span></span></a></li>';
935 }
936 ?>
937 </ul>
938 <div class="aux-isotope-search-wrapper">
939 <input type="text" placeholder="<?php echo esc_html__( 'Search Templates', 'auxin-elements' ); ?>" class="aux-isotope-search">
940 </div>
941 </div>
942 <div class="aux-demo-list aux-grid-list aux-isotope-list" data-search-filter="true">
943 <?php
944 if( ! is_array( $demo_list ) ){
945 echo '<p class="aux-grid-item grid_12">'. esc_html__( 'An error occurred while downloading the list of demo sites. Please try again later.' ) .'</p>';
946 } else {
947 foreach ( $demo_list['items'] as $key => $args ) {
948 // Checking the last imported demo...
949 $is_active_demo = ! empty( $last_demo_imported ) && $last_demo_imported['id'] == $args['id'] ? 'aux-last-imported-demo' : '';
950
951 // Check demo license
952 $is_demo_allowed = auxin_is_activated() || !$args['is_pro'];
953
954 if ( !empty( $args['category'] ) && $args['category'] != "[]" ) {
955 $categories = str_replace( '"', '', substr( $args['category'], 1, -1 ) );
956 } else {
957 $categories = '';
958 }
959 $categories_array = explode( ',', $categories );
960 foreach( $categories_array as $cat_key => $category ) {
961 $categories_array[ $cat_key ] = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $category ) ) );
962 }
963 $categories_class = implode( '-subject ', $categories_array );
964 $categories_class = !empty( $categories_class ) ? $categories_class . '-subject' : '';
965
966 if ( !empty( $args['tags'] ) && $args['tags'] != "[]" ) {
967 $tags = str_replace( '"', '', substr( $args['tags'], 1, -1 ) );
968 } else {
969 $tags = '';
970 }
971 $tags_array = explode( ',', $tags );
972 foreach( $tags_array as $tag_key => $tag ) {
973 $tags_array[ $tag_key ] = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', wp_specialchars_decode( $tag ) ) );
974 }
975 $tags_class = implode( '-tag ', $tags_array );
976 $tags_class = !empty( $tags_class ) ? $tags_class . '-tag' : '';
977
978
979 echo '<div data-demo-id="demo-'. esc_attr( $args['id'] ) .'" class="aux-grid-item aux-iso-item grid_4 '. esc_attr( $is_active_demo ) . ' ' . esc_attr( $categories_class ) . ' ' . esc_attr( $tags_class ) . '">';
980 echo '<div class="aux-grid-item-inner">';
981 echo '<div class="aux-grid-item-media">';
982 echo '<img class="demo_thumbnail aux-preload aux-blank" data-src='. esc_url( $args['thumbnail'] ) .' src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">';
983 if( ! $is_demo_allowed ) {
984 echo '<img class="premium_badge" alt="This is a premium demo" src="'. esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/pro-badge.png' ) .'">';
985 }
986 echo '</div>';
987 ?>
988 <div class="aux-grid-item-footer">
989 <h3><?php echo esc_html( $args['title'] ); ?></h3>
990 <div class="aux-grid-item-buttons aux-clearfix">
991 <?php
992 if( $is_demo_allowed ) {
993 $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";
994 $btn_label = $is_active_demo ? __( 'Uninstall', 'auxin-elements' ) : __( 'Import', 'auxin-elements' );
995 $import_type = $is_active_demo ? 'uninstall' : 'install';
996 $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' ) );
997 } else {
998 $color_class = " aux-blue aux-pro-demo aux-locked-demo aux-iconic-action";
999 $btn_label = __( 'Unlock', 'auxin-elements' );
1000 $import_btn_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'];
1001 if( defined('THEME_PRO' ) && THEME_PRO ){
1002 $color_class .= " aux-ajax-open-modal";
1003 $import_btn_url = add_query_arg( array( 'action' => 'auxin_display_actvation_form', 'nonce' => wp_create_nonce( 'aux-activation-form' ) ), admin_url( 'admin-ajax.php' ) );
1004 }
1005 }
1006 ?>
1007 <a target="_blank" href="<?php echo esc_url( $import_btn_url ); ?>"
1008 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 esc_html( $btn_label ); ?></a>
1009 <a target="_blank" href="<?php echo ! empty( $args['url'] ) ? esc_url( $args['url'] .'&utm_term='.$args['id'] ) : '#'; ?>"
1010 class="aux-wl-button aux-outline aux-round aux-transparent aux-large aux-preview"><?php esc_html_e( 'Preview', 'auxin-elements' ); ?></a>
1011 </div>
1012 </div>
1013 </div>
1014 <?php
1015 echo '</div>';
1016 }
1017 }
1018 ?>
1019 </div>
1020
1021 <div class="clear"></div>
1022
1023 </div>
1024
1025 </div>
1026
1027 <?php
1028 }
1029
1030 /**
1031 * Parse the demos list API
1032 */
1033 public function get_demo_list( $type = 'demos', $url = 'http://demo.phlox.pro/api/v2/info/', $sanitize_key = 'auxin_cache_demo_library_items' ) {
1034
1035 if( $type === 'templates' ){
1036 $url = 'http://library.phlox.pro/info-api/';
1037 $sanitize_key = 'auxin_cache_template_library_items';
1038 }
1039
1040 $key = sanitize_key( $sanitize_key );
1041
1042 if ( ( false === $data = auxin_get_transient( $key ) ) || isset( $_GET['flush_transient'] ) ) {
1043
1044 $response = wp_remote_post( $url );
1045
1046 if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
1047 $response = wp_remote_retrieve_body( $response );
1048 } else {
1049 $error_message = "Something went wrong while connecting ($url): " . $response->get_error_message();
1050 echo '<div class="aux-admin-info-box aux-admin-info-warn aux-admin-welcome-info">' . esc_html( $error_message ) . '</div>';
1051 // if cUrl timeout error was thrown, increase the timeout to 15. Default is 5.
1052 if( false !== strpos( $error_message, 'cURL error 28') ){
1053 set_theme_mod('increasing_curl_timeout_is_required', 15);
1054 }
1055
1056 if ( wp_doing_ajax() ){
1057 die();
1058 } else {
1059 return;
1060 }
1061 }
1062
1063 // translate the JSON into Array
1064 $data = json_decode( $response, true );
1065
1066 if( ! is_array( $data ) ){
1067 if ( wp_doing_ajax() ){
1068 die();
1069 } else {
1070 return;
1071 }
1072 }
1073
1074 // Add transient
1075 auxin_set_transient( $key, $data, 24 * HOUR_IN_SECONDS );
1076 }
1077
1078 return $data;
1079 }
1080
1081
1082 /*-----------------------------------------------------------------------------------*/
1083 /* Step setup_updates
1084 /*-----------------------------------------------------------------------------------*/
1085
1086 public function setup_updates(){
1087 $last_update = auxin_get_update_list();
1088
1089 $has_response = isset( $last_update->total_updates ) ? $last_update->total_updates : false;
1090 ?>
1091 <div class="aux-setup-content">
1092 <div class="aux-updates-step aux-section-content-box">
1093
1094 <?php
1095 if( ! $has_response ){
1096 ?>
1097 <h3 class="aux-content-title"><?php esc_html_e('You have already the latest version.', 'auxin-elements' ); ?></h3>
1098 <?php
1099 } else {
1100 ?>
1101 <h3 class="aux-content-title"><?php esc_html_e('New updates are available.', 'auxin-elements' ); ?></h3>
1102 <p><?php esc_html_e( 'The following items require update, click update button to update them to the latest version.', 'auxin-elements' ); ?></p>
1103 <?php
1104 }
1105 ?>
1106 <div class="aux-fadein-animation">
1107 <?php
1108 if( ! $has_response ){
1109 $this->display_alerts( sprintf(
1110 '%s %s %s',
1111 esc_html__( 'Last checked ', 'auxin-elements' ),
1112 $last_update->last_checked,
1113 esc_html__( 'ago', 'auxin-elements' )
1114 ) , 'success' );
1115 } else {
1116 echo '<div class="aux-update-items">';
1117
1118 if( isset( $last_update->themes ) && is_array( $last_update->themes ) ) {
1119 ?>
1120 <ul class="aux-update-list aux-update-themes">
1121 <?php
1122 foreach ( $last_update->themes as $stylesheet => $args ) {
1123 $theme = wp_get_theme( $stylesheet );
1124 ?>
1125 <li class="aux-item" data-key="<?php echo esc_attr( $stylesheet ); ?>" data-type="themes">
1126 <label class="aux-control">
1127 <?php echo esc_html( $theme->get( 'Name' ) ); ?>
1128 <div class="aux-indicator"></div>
1129 <input name="theme[]" value="<?php echo esc_attr( $stylesheet ); ?>" type="hidden">
1130 </label>
1131 <div class="aux-status column-status">
1132 <span class="update">
1133 <?php echo esc_html__( 'Ready to update', 'auxin-elements' ); ?>
1134 </span>
1135 </div>
1136 </li>
1137 <?php
1138 }
1139 ?>
1140 </ul>
1141 <?php
1142 }
1143
1144 if( isset( $last_update->plugins ) && is_array( $last_update->plugins ) ) {
1145 ?>
1146 <div class="aux-headers">
1147 <span>Plugin Name</span>
1148 <span>Status</span>
1149 </div>
1150 <ul class="aux-update-list aux-update-plugins">
1151 <?php
1152 foreach ( $last_update->plugins as $path => $args ) {
1153 $plugin = get_plugin_data( WP_PLUGIN_DIR . '/' . $path );
1154 ?>
1155 <li class="aux-item" data-key="<?php echo esc_attr( $path ); ?>" data-type="plugins">
1156 <label class="aux-control">
1157 <?php echo esc_html( $plugin['Name'] ); ?>
1158 <div class="aux-indicator"></div>
1159 <input name="plugin[]" value="<?php echo esc_attr( $path ); ?>" type="hidden">
1160 </label>
1161 <div class="aux-status column-status">
1162 <span class="update">
1163 <?php echo esc_html__( 'Ready to update', 'auxin-elements' ); ?>
1164 </span>
1165 </div>
1166 </li>
1167 <?php
1168 }
1169 ?>
1170 </ul>
1171 <?php
1172 }
1173
1174 echo '</div>';
1175 }
1176
1177 ?>
1178 </div>
1179 <div class="aux-sticky">
1180 <div class="aux-setup-actions step">
1181 <?php if( $has_response ){ ?>
1182 <a href="#"
1183 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>
1184 <?php } ?>
1185 <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=auxin-welcome&tab=updates&force-check=1' ) ); ?>"
1186 class="aux-button aux-outline"><?php esc_html_e( 'Check Again', 'auxin-elements' ); ?></a>
1187 </div>
1188 </div>
1189 <div class="clear"></div>
1190 </div>
1191 </div>
1192 <?php
1193 }
1194
1195 /*-----------------------------------------------------------------------------------*/
1196 /* Step manager in modal
1197 /*-----------------------------------------------------------------------------------*/
1198
1199 /**
1200 * This function will removing the last imported demo
1201 */
1202 public function ajax_uninstall( $request_id = false, $nonce = '', $next_step = '' ){
1203 // Check Security Token
1204 if ( empty( $nonce ) ) {
1205 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'aux-demo-uninstall' ) ) {
1206 // This nonce is not valid.
1207 wp_send_json_error( esc_html__( 'Security Token Error!', 'auxin-elements' ) );
1208 }
1209 } else {
1210 if ( ! wp_verify_nonce( $nonce, 'aux-step-manager' ) ) {
1211 // This nonce is not valid.
1212 wp_send_json_error( esc_html__( 'Security Token Error!', 'auxin-elements' ) );
1213 }
1214 }
1215
1216 // Checking the Active Demo ID with requested one
1217 $last_demo = get_option( 'auxin_last_imported_demo' );
1218 $request_id = empty( $request_id ) && isset( $_POST['id'] ) ? sanitize_text_field( $_POST['id'] ) : $request_id;
1219 if( ! $request_id || ! $last_demo || $last_demo['id'] != $request_id ) {
1220 wp_send_json_error( esc_html__( 'You can\'t remove this demo.', 'auxin-elements' ) );
1221 }
1222
1223 // call WPDB class instance
1224 global $wpdb;
1225
1226 // Remove Attachments
1227 $attachments = get_posts( array(
1228 'post_type' => 'attachment',
1229 'posts_per_page' => -1,
1230 'post_status' => 'inherit',
1231 'meta_key' => 'auxin_import_id'
1232 ) );
1233 if ( $attachments ) {
1234 foreach ( $attachments as $attachment ) {
1235 wp_delete_attachment( $attachment->ID, true );
1236 }
1237 }
1238
1239 // Remove Posts
1240 $posts = get_posts( array(
1241 'post_type' => 'any',
1242 'posts_per_page' => -1,
1243 'post_status' => 'any',
1244 'meta_key' => 'auxin_import_post'
1245 ) );
1246 if ( $posts ) {
1247 foreach ( $posts as $post ) {
1248 wp_delete_post( $post->ID, true );
1249 }
1250 }
1251
1252 // Remove imported templates
1253 $posts = get_posts( array(
1254 'post_type' => 'elementor_library',
1255 'posts_per_page' => -1,
1256 'post_status' => 'any',
1257 'meta_key' => 'auxin_import_post'
1258 ) );
1259 if ( $posts ) {
1260 // bypass elementor confirm question for deleting imported kit
1261 $_GET['force_delete_kit'] = 1;
1262 foreach ( $posts as $post ) {
1263 wp_delete_post( $post->ID );
1264 }
1265
1266 $kit = Elementor\Plugin::$instance->kits_manager->get_active_kit();
1267
1268 if ( !$kit->get_id() ) {
1269 $created_default_kit = Elementor\Plugin::$instance->kits_manager->create_default();
1270 if ( $created_default_kit ) {
1271 update_option( Elementor\Core\Kits\Manager::OPTION_ACTIVE, $created_default_kit );
1272 }
1273 }
1274 }
1275
1276 // Remove Menus
1277 $menus = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_name LIKE '%auxin_demo_importer_menu_origin_id_%'", OBJECT );
1278 foreach ($menus as $key => $menu) {
1279 if( is_numeric( $menu->option_value ) ) {
1280 wp_delete_nav_menu( $menu->option_value );
1281 }
1282 }
1283
1284 // Remove Options
1285 delete_option( THEME_ID.'_theme_options' );
1286 update_option( 'show_on_front', 'page' );
1287 update_option( 'page_on_front', '0' );
1288 remove_theme_mod('custom_css_string');
1289 remove_theme_mod('custom_css_array');
1290 remove_theme_mod('custom_logo');
1291 remove_theme_mod('font_subsets');
1292
1293 // Remove all active widgets
1294 update_option( 'sidebars_widgets', array( 'array_version' => 3 ) );
1295
1296 // Disable all demo plugins other than auxin plugins...
1297 $data = $this->get_demo_list();
1298 $uninstall_demo = [];
1299 foreach( $data['items'] as $item ) {
1300 if ( $item['id'] == $request_id ) {
1301 $uninstall_demo = $item;
1302 break;
1303 }
1304 }
1305 $demo_plugins = isset( $uninstall_demo['plugins'] ) ? $uninstall_demo['plugins'] : '';
1306 if( ! empty( $demo_plugins ) ) {
1307 $demo_plugins = str_replace( '"', '', $demo_plugins );
1308 $demo_plugins = str_replace( '\\', '', $demo_plugins );
1309 $demo_plugins = explode( ',' , trim( $demo_plugins, '[]') );
1310
1311 $active_plugins = get_option( 'active_plugins' );
1312 foreach ( $active_plugins as $key => $name ) {
1313 if ( strpos( $name, 'auxin' ) !== false ) {
1314 continue;
1315 }
1316
1317 foreach( $demo_plugins as $plugin_key => $plugin ) {
1318 if( ( strpos( $name, $plugin ) === 0 || strpos( $name, $plugin ) ) && $plugin != 'elementor' ){
1319 unset( $active_plugins[$key] );
1320 }
1321 }
1322 }
1323 update_option( 'active_plugins', $active_plugins );
1324 }
1325
1326 // Remove Additional CSS data
1327 wp_update_custom_css_post('');
1328
1329 // Stores css content in custom css file
1330 auxin_save_custom_css();
1331 // Stores JavaScript content in custom js file
1332 auxin_save_custom_js();
1333
1334 // And finally remove the last imported demo info
1335 delete_option( 'auxin_last_imported_demo' );
1336
1337 if ( !empty( $nonce ) ) {
1338 return $this->step_manager( $next_step );
1339 }
1340
1341 ob_start();
1342 ?>
1343 <div class="aux-setup-demo-content aux-content-col aux-step-import-completed">
1344 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/completed.svg' ); ?>" />
1345 <div><h2 class="aux-step-import-title"><?php esc_html_e( 'Done!', 'auxin-elements' ); ?></h2></div>
1346 <p class="aux-step-description"><?php esc_html_e( "Demo has been successfully uninstalled.", 'auxin-elements' ); ?></p>
1347 </div>
1348 <div class="aux-setup-demo-actions">
1349 <div class="aux-return-back">
1350 <a href="<?php echo esc_url( home_url() ); ?>" class="aux-button aux-round aux-green aux-medium" target="_blank">
1351 <?php esc_html_e( 'Preview', 'auxin-elements' ); ?>
1352 </a>
1353 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1354 <?php esc_html_e( 'Close', 'auxin-elements' ); ?>
1355 </a>
1356 </div>
1357 </div>
1358 <?php
1359
1360 // Return Success Notification
1361 wp_send_json_success( array(
1362 'button' => __( 'Import', 'auxin-elements' ),
1363 'url' => add_query_arg( array( 'action' => 'aux_ajax_lightbox', 'key' => sanitize_text_field( $_POST['key'] ), 'type' => 'install' , 'nonce' => wp_create_nonce( 'aux-open-lightbox' ) ), admin_url( 'admin-ajax.php' ) ),
1364 'markup' => ob_get_clean(),
1365 ) );
1366 }
1367
1368 /**
1369 * Ajax modal box
1370 */
1371 public function ajax_lightbox() {
1372
1373 if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'aux-open-lightbox' ) ) {
1374 // This nonce is not valid.
1375 wp_die( esc_html__( 'Security Token Error!', 'auxin-elements' ) );
1376 }
1377
1378 $type = isset( $_GET['type'] ) ? sanitize_text_field( $_GET['type'] ) : 'progress';
1379
1380 ob_start();
1381
1382 if( $type == 'progress' ) {
1383 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(), '' ) );
1384 wp_die( ob_get_clean() );
1385 }
1386
1387 if( $type == 'preview' ) {
1388 if( isset( $_GET['preview'] ) ){
1389 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>', esc_url( $_GET['preview'] ), esc_html__( 'Close', 'auxin-elements' ) );
1390 wp_die( ob_get_clean() );
1391 }
1392 }
1393
1394 if( $type == 'plugins' ) {
1395 $data = $this->get_demo_list( 'templates' );
1396 $args = $data['templates'][ sanitize_text_field( $_GET['key'] ) ];
1397 $args = array(
1398 'plugins' => $args['plugins'],
1399 'next_action' => 'template_manager'
1400 );
1401 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' ) );
1402 wp_die( ob_get_clean() );
1403 }
1404
1405 $data = $this->get_demo_list();
1406
1407 if( ! isset( $_GET['key'] ) || empty( $data['items'] ) || ! array_key_exists( $_GET['key'] , $data['items'] ) ) {
1408 wp_die( esc_html__( 'An Error Occurred!', 'auxin-elements' ) );
1409 }
1410
1411 $args = $data['items'][ sanitize_text_field( $_GET['key'] ) ];
1412
1413 if( $type == 'install' ) :
1414 ?>
1415 <div id="demo-<?php echo esc_attr( $args['id'] ); ?>" class="aux-demo-lightbox">
1416 <div class="aux-modal-item clearfix aux-has-required-plugins">
1417 <div class="grid_5 no-gutter aux-media-col" style="background-image: url(<?php echo esc_url( $args['screen'] ); ?>);" >
1418 </div>
1419 <div class="grid_7 no-gutter aux-steps-col">
1420 <div class="aux-setup-demo-content aux-content-col aux-step-import-notice">
1421 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/import-notice.svg' ); ?>" />
1422 <div><h2 class="aux-step-import-title aux-iconic-title"><?php esc_html_e( 'Notice', 'auxin-elements' ); ?></h2></div>
1423 <p class="aux-step-description">
1424 <?php esc_html_e( "For better and faster result, it's recommended to install the demo on a clean WordPress website.", 'auxin-elements' ); ?>
1425 </p>
1426 </div>
1427 <div class="aux-setup-demo-actions">
1428 <div class="aux-return-back">
1429 <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' ); ?>">
1430 <?php esc_html_e( 'Continue', 'auxin-elements' ); ?>
1431 </a>
1432 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1433 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1434 </a>
1435 </div>
1436 </div>
1437 </div>
1438 </div>
1439 </div>
1440 <?php
1441 else :
1442 ?>
1443 <div id="demo-<?php echo esc_attr( $args['id'] ); ?>" class="aux-demo-lightbox">
1444 <div class="aux-modal-item clearfix aux-has-required-plugins">
1445 <div class="grid_5 no-gutter aux-media-col" style="background-image: url(<?php echo esc_url( $args['screen'] ); ?>);" >
1446 </div>
1447 <div class="grid_7 no-gutter aux-steps-col">
1448 <div class="aux-setup-demo-content aux-content-col aux-step-import-notice">
1449 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/warning.png' ); ?>" />
1450 <div><h2 class="aux-step-import-title aux-iconic-title"><?php esc_html_e( 'Warning!', 'auxin-elements' ); ?></h2></div>
1451 <p class="aux-step-description">
1452 <?php esc_html_e( "This process will erase all images, posts and settings of this demo...", 'auxin-elements' ); ?>
1453 </p>
1454 </div>
1455 <div class="aux-setup-demo-actions">
1456 <div class="aux-return-back">
1457 <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 esc_attr( $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' ); ?>">
1458 <?php esc_html_e( 'Uninstall', 'auxin-elements' ); ?>
1459 </a>
1460 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1461 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1462 </a>
1463 </div>
1464 <div class="aux-progress hide">
1465 <div class="aux-big">
1466 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;">
1467 <span class="aux-progress-label"><?php esc_html_e( 'Please wait, this may take several minutes ..', 'auxin-elements' ); ?></span>
1468 </div>
1469 </div>
1470 </div>
1471 </div>
1472 </div>
1473 </div>
1474 </div>
1475 <?php
1476 endif;
1477
1478 wp_die( ob_get_clean() );
1479 }
1480
1481
1482 public function step_manager( $next_step = '' ) {
1483 $next_step = empty( $next_step ) ? sanitize_text_field( $_POST['next_step'] ) : $next_step;
1484 $nonce = sanitize_text_field( $_POST['nonce'] );
1485 $args = auxin_sanitize_input( $_POST['args'] );
1486
1487 $steps = array(
1488 '1' => array(
1489 'method' => 'first_step',
1490 'next' => '2'
1491 ),
1492 '2' => array(
1493 'method' => 'second_step',
1494 'next' => '6'
1495 ),
1496 '3' => array(
1497 'method' => 'third_step',
1498 'next' => '4'
1499 ),
1500 '4' => array(
1501 'method' => 'fourth_step',
1502 'next' => ''
1503 ),
1504 '5' => array(
1505 'method' => 'progress_step',
1506 'next' => ''
1507 ),
1508 '6' => array(
1509 'method' => 'remove_watermark_step',
1510 'next' => '7'
1511 ),
1512 '7' => array(
1513 'method' => 'envato_elements_step',
1514 'next' => '3'
1515 ),
1516 '8' => array(
1517 'method' => 'get_user_email_step',
1518 'next' => '9'
1519 ),
1520 '9' => array(
1521 'method' => 'verify_envato_elements_step',
1522 'next' => '10'
1523 ),
1524 '10' => array(
1525 'method' => 'envato_elements_success_step',
1526 'next' => '3'
1527 ),
1528 '11' => array(
1529 'method' => 'uninstall_demo_through_wizard',
1530 'next' => '2'
1531 )
1532
1533 );
1534
1535 if ( ! wp_verify_nonce( $nonce, 'aux-step-manager' ) ) {
1536 // This nonce is not valid.
1537 wp_send_json_error( esc_html__( 'An error occurred!', 'auxin-elements' ) );
1538 } elseif( ! $next_step || $steps[$next_step]['method'] == '' ){
1539 wp_send_json_error( esc_html__( 'Method not exist!', 'auxin-elements' ) );
1540 }
1541
1542 wp_send_json_success(
1543 array(
1544 'markup' => call_user_func( array( $this, $steps[$next_step]['method'] ), $args, $steps[$next_step]['next'] )
1545 )
1546 );
1547 }
1548
1549 public function first_step( array $args, $next_step ) {
1550 ob_start();
1551 ?>
1552 <div class="aux-setup-demo-content aux-content-col">
1553 <h2><?php esc_html_e( 'Required Plugins for this demo.', 'auxin-elements' ); ?></h2>
1554 <p class="aux-step-description">
1555 <?php esc_html_e( "For better and faster install process it's recommended to install demo on a clean WordPress website.", 'auxin-elements' ); ?>
1556 </p>
1557 </div>
1558 <div class="aux-setup-demo-actions">
1559 <div class="aux-return-back">
1560 <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' ); ?>">
1561 <?php esc_html_e( 'Continue', 'auxin-elements' ); ?>
1562 </a>
1563 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1564 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1565 </a>
1566 </div>
1567 </div>
1568 <?php
1569 return ob_get_clean();
1570 }
1571
1572 public function second_step( array $args, $next_step ) {
1573 $last_demo_imported = get_option( 'auxin_last_imported_demo' );
1574 $is_active_demo = ! empty( $last_demo_imported ) && $last_demo_imported['id'];
1575 if ( $is_active_demo ) {
1576 return $this->uninstall_step( $last_demo_imported['id'], $args );
1577 }
1578
1579 // Goto next step, if no required plugins found
1580 if( ! isset( $args['plugins'] ) ) {
1581 return call_user_func( array( $this, 'remove_watermark_step' ), $args, '7' );
1582 }
1583
1584 $plugins_list = json_decode( stripslashes( $args['plugins'] ), true );
1585
1586 $plugins = $this->get_plugins( $plugins_list );
1587 $has_plugin_required = ! empty( $plugins_list ) && ! empty( $plugins['all'] );
1588
1589 if( $has_plugin_required ) :
1590 $next_step = Auxels_Envato_Elements::get_instance()->is_envato_element_enabled() ? '4' : $next_step;
1591 ob_start();
1592 ?>
1593 <div class="aux-setup-demo-content aux-content-col aux-install-plugins">
1594 <h2><?php esc_html_e( 'Required Plugins for this demo.', 'auxin-elements' ); ?></h2>
1595 <p class="aux-step-description"><?php esc_html_e( 'The following plugins are required to be installed for this demo.', 'auxin-elements' ); ?></p>
1596 <ul class="aux-wizard-plugins">
1597 <?php
1598 foreach ( $plugins['all'] as $slug => $plugin ) { ?>
1599 <li class="aux-plugin" data-slug="<?php echo esc_attr( $slug ); ?>">
1600 <label class="aux-control aux-checkbox">
1601 <?php echo esc_html( $plugin['name'] ); ?>
1602 <input name="plugin[]" value="<?php echo esc_attr($slug); ?>" type="checkbox" checked>
1603 <div class="aux-indicator"></div>
1604 </label>
1605 <div class="status column-status">
1606 <?php
1607 $keys = $class = '';
1608 if ( isset( $plugins['install'][ $slug ] ) ) {
1609 $keys = __( 'Ready to install', 'auxin-elements' );
1610 $class = 'install';
1611 }
1612 if ( isset( $plugins['activate'][ $slug ] ) ) {
1613 $keys = __( 'Not activated', 'auxin-elements' );
1614 $class = 'activate';
1615 }
1616 if ( isset( $plugins['update'][ $slug ] ) ) {
1617 $keys = __( 'Ready to update', 'auxin-elements' );
1618 $class = 'update';
1619 }
1620 ?>
1621 <span class="<?php echo esc_attr( $class ); ?>">
1622 <?php echo esc_html( $keys ); ?>
1623 </span>
1624 <div class="spinner"></div>
1625 </div>
1626 </li>
1627 <?php
1628 }
1629 ?>
1630 </ul>
1631 </div>
1632 <div class="aux-setup-demo-actions">
1633 <div class="aux-return-back">
1634 <a href="#"
1635 class="aux-button aux-medium install-plugins aux-primary"
1636 data-callback="install_plugins"
1637 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1638 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1639 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1640 data-next-action="<?php echo isset( $args['next_action'] ) ? esc_attr( $args['next_action'] ) : false; ?>"
1641 ><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
1642 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1643 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1644 </a>
1645 </div>
1646 </div>
1647 <?php
1648 return ob_get_clean();
1649 else :
1650 return Auxels_Envato_Elements::get_instance()->is_envato_element_enabled() ? call_user_func( array( $this, 'third_step' ), $args, '4' ) : call_user_func( array( $this, 'remove_watermark_step' ), $args, '7' ) ;
1651 return ;
1652 endif;
1653 }
1654
1655 public function uninstall_step( $demo_id, array $args ) {
1656 $data = $this->get_demo_list();
1657 $items = $data['items'];
1658 foreach( $items as $item ) {
1659 if ( $item['id'] == $demo_id ) {
1660 $uninstall_args = $item;
1661 break;
1662 }
1663 }
1664
1665 $args['plugins'] = stripslashes( $args['plugins'] );
1666 $args['tags'] = stripslashes( $args['tags'] );
1667 $args['category'] = stripslashes( $args['category'] );
1668
1669 ob_start();
1670 ?>
1671 <div class="aux-setup-demo-content aux-content-col aux-step-import-notice aux-uninstall-demo-content">
1672 <img src="<?php echo esc_url( $uninstall_args['screen'] ); ?>" />
1673 <div class="aux-installed-template">Installed Template</div>
1674 <div><h2 class="aux-step-import-title aux-iconic-title"><?php esc_html_e( 'You already have installed template!', 'auxin-elements' ); ?></h2></div>
1675 <p class="aux-step-description">
1676 <?php esc_html_e( "For better and faster install proccess it's recommanded to install demo on a clean wordpress website.", 'auxin-elements' ); ?>
1677 </p>
1678 </div>
1679 <div class="aux-setup-demo-actions">
1680 <div class="aux-return-back">
1681 <a href="#"
1682 class="aux-button aux-next-step aux-red aux-medium"
1683 data-next-step="11"
1684 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1685 data-demo-plugins="<?php echo htmlspecialchars( wp_json_encode( $args['plugins'] ), ENT_QUOTES, 'UTF-8' ); ?>"
1686 data-demo-id="<?php echo esc_attr( $demo_id ); ?>"
1687 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>">
1688 <?php esc_html_e( 'Unistall Template', 'auxin-elements' ); ?>
1689 </a>
1690 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1691 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1692 </a>
1693 </div>
1694 <div class="aux-progress hide">
1695 <div class="aux-big">
1696 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;">
1697 <span class="aux-progress-label"><?php esc_html_e( 'Please wait, this may take several minutes ..', 'auxin-elements' ); ?></span>
1698 </div>
1699 </div>
1700 </div>
1701 </div>
1702 <?php
1703 return ob_get_clean();
1704 }
1705
1706 public function uninstall_demo_through_wizard() {
1707 return $this->ajax_uninstall( sanitize_text_field( $_POST['demo_id'] ), sanitize_text_field( $_POST['nonce'] ), '2' );
1708 }
1709
1710 public function third_step( array $args, $next_step ) {
1711 ob_start();
1712 ?>
1713 <div class="aux-setup-demo-content aux-content-col aux-install-demos">
1714 <h2><?php esc_html_e( 'Import Demo Content of Phlox Theme.' ); ?></h2>
1715
1716 <form id="aux-import-data-<?php echo esc_attr( $args['id'] ); ?>" class="aux-import-parts">
1717 <div class="complete aux-border is-checked">
1718 <label class="aux-control aux-radio">
1719 <?php esc_html_e( 'Complete pre-build Website', 'auxin-elements' ); ?>
1720 <input type="radio" name="import" value="complete" checked="checked" />
1721 <div class="aux-indicator"></div>
1722 </label>
1723 <label class="aux-control aux-checkbox">
1724 <?php esc_html_e( 'Import media (images, videos, etc.)', 'auxin-elements' ); ?>
1725 <input type="checkbox" name="import-media" checked="checked" />
1726 <div class="aux-indicator"></div>
1727 </label>
1728 </div>
1729 <div class="custom aux-border">
1730 <label class="aux-control aux-radio">
1731 <?php esc_html_e( 'Selected Data Only', 'auxin-elements' ); ?>
1732 <input type="radio" name="import" value="custom" />
1733 <div class="aux-indicator"></div>
1734 </label>
1735 <div class="one_half no-gutter">
1736 <label class="aux-control aux-checkbox">
1737 <?php esc_html_e( 'Posts/Pages', 'auxin-elements' ); ?>
1738 <input type="checkbox" name="posts" />
1739 <div class="aux-indicator"></div>
1740 </label>
1741 <label class="aux-control aux-checkbox">
1742 <?php esc_html_e( 'Media', 'auxin-elements' ); ?>
1743 <input type="checkbox" name="media" />
1744 <div class="aux-indicator"></div>
1745 </label>
1746 <label class="aux-control aux-checkbox">
1747 <?php esc_html_e( 'Widgets', 'auxin-elements' ); ?>
1748 <input type="checkbox" name="widgets" />
1749 <div class="aux-indicator"></div>
1750 </label>
1751 </div>
1752 <div class="one_half no-gutter right-half">
1753 <label class="aux-control aux-checkbox">
1754 <?php esc_html_e( 'Menus', 'auxin-elements' ); ?>
1755 <input type="checkbox" name="menus" />
1756 <div class="aux-indicator"></div>
1757 </label>
1758 <label class="aux-control aux-checkbox">
1759 <?php esc_html_e( 'Theme Options', 'auxin-elements' ); ?>
1760 <input type="checkbox" name="options" />
1761 <div class="aux-indicator"></div>
1762 </label>
1763 <label class="aux-control aux-checkbox">
1764 <?php esc_html_e( 'MasterSlider (If Available)', 'auxin-elements' ); ?>
1765 <input type="checkbox" name="masterslider" />
1766 <div class="aux-indicator"></div>
1767 </label>
1768 </div>
1769 </div>
1770 </form>
1771 </div>
1772 <div class="aux-setup-demo-content aux-content-col aux-install-demos-waiting hide">
1773 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/importing-cloud.svg' ); ?>" />
1774 <h2><?php esc_html_e( 'Importing Demo Content is in Progress...' ); ?></h2>
1775 <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>
1776 </div>
1777 <div class="aux-setup-demo-actions">
1778 <div class="aux-return-back">
1779 <a href="#"
1780 class="aux-button aux-install-demo aux-medium aux-primary button-next"
1781 data-nonce="<?php echo wp_create_nonce( 'aux-import-demo-' . $args['id'] ); ?>"
1782 data-import-id="<?php echo esc_attr( $args['id'] ); ?>"
1783 data-callback="install_demos"
1784 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1785 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1786 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1787 ><?php esc_html_e( 'Import Content', 'auxin-elements' ); ?></a>
1788 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1789 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1790 </a>
1791 </div>
1792 <div class="aux-progress hide">
1793 <div class="aux-big">
1794 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;">
1795 <span class="aux-progress-label"><?php esc_html_e( 'Please wait, this may take several minutes ..', 'auxin-elements' ); ?></span>
1796 </div>
1797 </div>
1798 </div>
1799 </div>
1800 <?php
1801 return ob_get_clean();
1802 }
1803
1804 public function fourth_step( array $args, $next_step ) {
1805 ob_start();
1806 ?>
1807 <div class="aux-setup-demo-content aux-content-col aux-step-import-completed">
1808 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/completed.svg' ); ?>" />
1809 <div><h2 class="aux-step-import-title"><?php esc_html_e( 'Congratulations!' ); ?></h2></div>
1810 <p class="aux-step-description"><?php esc_html_e( "Demo has been successfully imported.", 'auxin-elements' ); ?></p>
1811 </div>
1812 <div class="aux-setup-demo-actions">
1813 <div class="aux-return-back">
1814 <a href="<?php echo esc_url( self_admin_url('customize.php') ); ?>" class="aux-button aux-primary aux-medium" target="_blank">
1815 <?php esc_html_e( 'Customize', 'auxin-elements' ); ?>
1816 </a>
1817 <a href="<?php echo home_url(); ?>" class="aux-button aux-round aux-green aux-medium" target="_blank">
1818 <?php esc_html_e( 'Preview', 'auxin-elements' ); ?>
1819 </a>
1820 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1821 <?php esc_html_e( 'Close', 'auxin-elements' ); ?>
1822 </a>
1823 </div>
1824 </div>
1825 <?php
1826 return ob_get_clean();
1827 }
1828
1829 public function progress_step( array $args, $next_step ) {
1830 ob_start();
1831 ?>
1832 <h3 class="aux-loading-title"><?php esc_html_e( 'Importing page content ...', 'auxin-elements' ); ?></h3>
1833 <div class="aux-progress">
1834 <div class="aux-big">
1835 <div class="aux-progress-bar aux-progress-info aux-progress-active" data-percent="100" style="transition: none; width: 100%;"></div>
1836 </div>
1837 </div>
1838 <?php
1839 return ob_get_clean();
1840 }
1841
1842 public function remove_watermark_step( array $args, $next_step ) {
1843 ob_start();
1844 ?>
1845 <div class="aux-setup-demo-content aux-content-col aux-step-remove-watermark">
1846 <div class="aux-watermark">
1847 <div class="locked">
1848 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/watermark-2.png' ); ?>" />
1849 <img class="lock-icon" src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/lock-icon.svg' ); ?>" />
1850 </div>
1851 <div class="unlocked">
1852 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/watermark.png' ); ?>" />
1853 <img class="check-icon" src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/check.svg' ); ?>" />
1854 </div>
1855 </div>
1856 <h2 class="aux-step-import-title"><?php esc_html_e( 'Remove Watermarks?', 'auxin-elements' ); ?></h2>
1857 <p class="aux-step-description"><?php esc_html_e( "Some images in this demo are copyrighted and watermarked, you can remove watermarks by authorizing your Envato Elements subscription.", 'auxin-elements' ); ?></p>
1858 <?php
1859 $skip_watermark_step = '3';
1860 ?>
1861 </div>
1862 <div class="aux-setup-demo-actions">
1863 <div class="aux-return-back">
1864 <a href="#"
1865 class="aux-button aux-medium aux-primary aux-next-step"
1866 data-callback="envato_elements_step"
1867 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1868 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1869 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1870 data-next-action="<?php echo isset( $args['next_action'] ) ? esc_attr( $args['next_action'] ) : false; ?>"
1871 ><?php esc_html_e( 'Remove Watermarks', 'auxin-elements' ); ?></a>
1872 <a href="#" data-next-step="<?php echo esc_attr( $skip_watermark_step ); ?>" class="aux-button aux-next-step aux-outline aux-round aux-transparent aux-medium aux-skip" data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>" data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>">
1873 <?php esc_html_e( 'Skip', 'auxin-elements' ); ?>
1874 </a>
1875 </div>
1876 </div>
1877 <?php
1878 return ob_get_clean();
1879 }
1880
1881 public function envato_elements_step( array $args, $next_step ) {
1882 ob_start();
1883 ?>
1884 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements">
1885 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/envato_elements.svg' ); ?>" />
1886 <h2 class="aux-step-import-title"><?php esc_html_e( 'Remove watermarks by authorizing your Envato Elements subscription', 'auxin-elements' ); ?></h2>
1887 <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>
1888 <a href="http://avt.li/elements" class="aux-button aux-primary aux-medium aux-explore-envato" target="_blank">
1889 <?php esc_html_e( 'Explore and Subscribe', 'auxin-elements' ); ?>
1890 </a>
1891 <?php
1892 $activate_step = '8';
1893 if ( ! empty( get_option( 'phlox_envato_elements_license_code', '' ) ) ) {
1894 $activate_step = '9';
1895 }
1896 ?>
1897 <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>
1898 </div>
1899 <div class="aux-setup-demo-actions">
1900 <div class="aux-return-back">
1901 <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' ); ?>">
1902 <?php esc_html_e( 'Skip', 'auxin-elements' ); ?>
1903 </a>
1904 </div>
1905 </div>
1906 <?php
1907 return ob_get_clean();
1908 }
1909
1910 public function get_user_email_step( array $args, $next_step) {
1911 ob_start();
1912 ?>
1913 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements aux-step-verify-envato-elements">
1914 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/activation.svg' ); ?>" />
1915 <h2 class="aux-step-import-title"><?php esc_html_e( 'Verify Your Envato Elements Subscription', 'auxin-elements' ); ?></h2>
1916 <p class="aux-step-description"><?php esc_html_e( "Enter your email below and click continue button", 'auxin-elements' ); ?></p>
1917 <div class="token-wrapper">
1918 <input type="text" class="email-field" placeholder="<?php esc_attr_e( 'Enter your email', 'auxin-elements' ); ?>">
1919 <p class="result"></p>
1920 </div>
1921 </div>
1922 <div class="aux-setup-demo-actions">
1923 <div class="aux-return-back">
1924 <a href="#"
1925 class="aux-button aux-medium aux-primary aux-verify-elements-email"
1926 data-callback="get_license_code"
1927 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1928 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1929 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1930 ><?php esc_html_e( 'Continue', 'auxin-elements' ); ?></a>
1931 <a href="#" class="aux-button aux-outline aux-round aux-transparent aux-medium aux-pp-close">
1932 <?php esc_html_e( 'Cancel', 'auxin-elements' ); ?>
1933 </a>
1934 </div>
1935 </div>
1936 <?php
1937 return ob_get_clean();
1938 }
1939
1940 public function verify_envato_elements_step( array $args, $next_step) {
1941 ob_start();
1942 ?>
1943 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements aux-step-verify-envato-elements">
1944 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/activation.svg' ); ?>" />
1945 <h2 class="aux-step-import-title"><?php esc_html_e( 'Verify Your Envato Elements Subscription', 'auxin-elements' ); ?></h2>
1946 <p class="aux-step-description"><?php esc_html_e( "Enter your token below to verify your Subscription", 'auxin-elements' ); ?></p>
1947 <div class="token-wrapper">
1948 <input type="text" class="token-field" placeholder="<?php esc_attr_e( 'Enter token here', 'auxin-elements' ); ?>">
1949 <p class="result"></p>
1950 </div>
1951 <div class="aux-info-links">
1952 <?php
1953 $token_link = '#';
1954 $extension_id = get_option( 'phlox_envato_elements_license_code', '' );
1955 if ( ! empty( $extension_id ) ) {
1956 $extension_description = get_bloginfo( 'name' ) . ' (' . get_home_url() . ')';
1957 $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';
1958 }
1959 ?>
1960 <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>
1961 <a href="http://avt.li/elements" target="_blank" class="aux-subscription" ><?php esc_html_e( 'Don\'t have subscription?', 'auxin-elements' );?></a>
1962 </div>
1963 </div>
1964 <div class="aux-setup-demo-actions">
1965 <div class="aux-return-back">
1966 <a href="#"
1967 class="aux-button aux-medium aux-primary button-next aux-verify-elements-token"
1968 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1969 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1970 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
1971 ><?php esc_html_e( 'Verify Token', 'auxin-elements' ); ?></a>
1972 <a href="#"
1973 class="aux-button aux-outline aux-round aux-transparent aux-medium aux-next-step aux-skip"
1974 data-next-step="3"
1975 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1976 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' );?>">
1977 <?php esc_html_e( 'Skip', 'auxin-elements' ); ?>
1978 </a>
1979 </div>
1980 </div>
1981 <?php
1982 return ob_get_clean();
1983 }
1984
1985 public function envato_elements_success_step( array $args, $next_step) {
1986 ob_start();
1987 ?>
1988 <div class="aux-setup-demo-content aux-content-col aux-step-envato-elements-success aux-step-import-notice">
1989 <img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/welcome/completed.svg' ); ?>" />
1990 <h2 class="aux-step-import-title"><?php esc_html_e( 'Succeed', 'auxin-elements' ); ?></h2>
1991 <p class="aux-step-description"><?php esc_html_e( "Congratulations! you have successfully authorized your Envato Elements subscription.", 'auxin-elements' ); ?></p>
1992 </div>
1993 <div class="aux-setup-demo-actions">
1994 <div class="aux-return-back">
1995 <a href="#"
1996 class="aux-button aux-medium aux-primary button-next aux-next-step"
1997 data-next-step="<?php echo esc_attr( $next_step ); ?>"
1998 data-args="<?php echo htmlspecialchars( wp_json_encode($args), ENT_QUOTES, 'UTF-8' ); ?>"
1999 data-step-nonce="<?php echo wp_create_nonce( 'aux-step-manager' ); ?>"
2000 ><?php esc_html_e( 'Continue', 'auxin-elements' ); ?></a>
2001 </div>
2002 </div>
2003 <?php
2004 return ob_get_clean();
2005 }
2006
2007 private function encode_url_parameter( $parameter ) {
2008 $parameter = html_entity_decode( $parameter, ENT_QUOTES | ENT_XML1, 'UTF-8' );
2009 $parameter = str_replace( '#', '', $parameter );
2010
2011 return urlencode( $parameter );
2012 }
2013 }
2014