Version Description
Download this release
Release Info
Developer | averta |
Plugin | Shortcodes and extra features for Phlox theme |
Version | 1.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.6.0
- README.txt +8 -4
- admin/assets/images/button.png +0 -0
- admin/assets/images/preview/Button1.webm +0 -0
- admin/assets/images/preview/Button2.webm +0 -0
- admin/assets/images/preview/Button3.webm +0 -0
- admin/assets/images/preview/Button4.webm +0 -0
- admin/assets/images/preview/Button5.webm +0 -0
- admin/assets/images/wizard/customizer.png +0 -0
- admin/assets/images/wizard/frontpage-1.png +0 -0
- admin/assets/images/wizard/frontpage-2.png +0 -0
- admin/assets/images/wizard/frontpage-3.png +0 -0
- admin/assets/images/wizard/publish.png +0 -0
- admin/assets/images/wizard/start.png +0 -0
- admin/includes/admin-hooks.php +45 -44
- admin/includes/compatibility/gopricing/images/signs/badge-popular-blue.png +0 -0
- admin/includes/compatibility/gopricing/images/signs/circle-sale-blue.png +0 -0
- admin/includes/compatibility/gopricing/images/signs/rectangle-mostpopular-blue.png +0 -0
- admin/includes/compatibility/gopricing/images/signs/ribbon-popular-blue.png +0 -0
- admin/includes/compatibility/gopricing/images/signs/small-rectangle-mostpopular-blue.png +0 -0
- admin/includes/compatibility/gopricing/images/templates/circle.png +0 -0
- admin/includes/compatibility/gopricing/images/templates/classic.png +0 -0
- admin/includes/compatibility/gopricing/images/templates/host-normal.png +0 -0
- admin/includes/compatibility/gopricing/images/templates/host-start.png +0 -0
- admin/includes/compatibility/gopricing/images/templates/modern.png +0 -0
- auxin-elements.php +3 -3
- includes/classes/class-auxin-demo-importer.php +553 -0
- includes/classes/class-auxin-widget.php +6 -6
- includes/classes/class-auxin-wizard.php +1137 -0
- includes/define.php +1 -1
- includes/elements/button.php +27 -8
- includes/elements/latest-items.php +0 -2
- includes/elements/recent-posts-timeline.php +11 -11
- includes/elements/testomonial.php +238 -0
- includes/general-functions.php +2 -2
- includes/general-hooks.php +15 -3
- includes/index.php +1 -1
- public/assets/js/jquery-blockUI.js +619 -0
- public/assets/js/wizard.js +327 -0
- public/includes/frontend-ajax.php +14 -0
README.txt
CHANGED
@@ -6,8 +6,8 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
6 |
Tags: banner SEO, shortcode, page-builder, siteorigin, auxin, phlox, averta, framework, widget, element, fullwidth, masonry, timeline
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.6
|
9 |
-
Tested up to: 4.8.
|
10 |
-
Stable tag: 1.
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl.html
|
13 |
|
@@ -141,6 +141,10 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/auxin-ele
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
|
|
144 |
= Version 1.5.2 / (18.09.2017) =
|
145 |
- [New]: Load more option and button for blog elements.
|
146 |
- [Fix]: Fixing the category field option in blog elements.
|
@@ -215,5 +219,5 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/auxin-ele
|
|
215 |
|
216 |
== Upgrade Notice ==
|
217 |
|
218 |
-
= 1.
|
219 |
-
- [New]:
|
6 |
Tags: banner SEO, shortcode, page-builder, siteorigin, auxin, phlox, averta, framework, widget, element, fullwidth, masonry, timeline
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.6
|
9 |
+
Tested up to: 4.8.3
|
10 |
+
Stable tag: 1.6.0
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl.html
|
13 |
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= Version 1.6.0 / (11.10.2017) =
|
145 |
+
- [New]: Introducing setup Wizard for importing demo content and installing recommended plugins.
|
146 |
+
- [New]: New Testimonial Widget added
|
147 |
+
|
148 |
= Version 1.5.2 / (18.09.2017) =
|
149 |
- [New]: Load more option and button for blog elements.
|
150 |
- [Fix]: Fixing the category field option in blog elements.
|
219 |
|
220 |
== Upgrade Notice ==
|
221 |
|
222 |
+
= 1.6.0 =
|
223 |
+
- [New]: Introducing setup Wizard for importing demo content and installing recommended plugins.
|
admin/assets/images/button.png
ADDED
Binary file
|
admin/assets/images/preview/Button1.webm
ADDED
Binary file
|
admin/assets/images/preview/Button2.webm
ADDED
Binary file
|
admin/assets/images/preview/Button3.webm
ADDED
Binary file
|
admin/assets/images/preview/Button4.webm
ADDED
Binary file
|
admin/assets/images/preview/Button5.webm
ADDED
Binary file
|
admin/assets/images/wizard/customizer.png
ADDED
Binary file
|
admin/assets/images/wizard/frontpage-1.png
ADDED
Binary file
|
admin/assets/images/wizard/frontpage-2.png
ADDED
Binary file
|
admin/assets/images/wizard/frontpage-3.png
ADDED
Binary file
|
admin/assets/images/wizard/publish.png
ADDED
Binary file
|
admin/assets/images/wizard/start.png
ADDED
Binary file
|
admin/includes/admin-hooks.php
CHANGED
@@ -27,14 +27,54 @@ function auxin_add_elements_tinymce_plugin( $plugin_array ) {
|
|
27 |
}
|
28 |
|
29 |
|
30 |
-
function
|
31 |
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
32 |
return;
|
33 |
|
34 |
add_filter( 'mce_external_plugins', 'auxin_add_elements_tinymce_plugin' );
|
35 |
add_filter( 'mce_buttons', 'auxin_register_shortcode_button' );
|
36 |
}
|
37 |
-
add_action("init", "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
/*-----------------------------------------------------------------------------------*/
|
40 |
/* Add Editor styles
|
@@ -52,51 +92,12 @@ add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
|
|
52 |
/* Adds demos tab in theme about (welcome) page
|
53 |
/*-----------------------------------------------------------------------------------*/
|
54 |
|
55 |
-
function auxin_welcome_page_display_section_demos(){
|
56 |
-
// all the demos information should add into this array
|
57 |
-
$demo_list = get_transient( 'auxin_'. THEME_ID .'_demo_list' );
|
58 |
-
|
59 |
-
if ( empty( $demo_list ) ){
|
60 |
-
|
61 |
-
$request = wp_remote_get( 'http://averta.net/phlox/wordpress-theme/demo/wp-content/list.json' );
|
62 |
-
|
63 |
-
if( is_wp_error( $request ) ) {
|
64 |
-
return false;
|
65 |
-
}
|
66 |
-
|
67 |
-
$body = wp_remote_retrieve_body( $request );
|
68 |
-
$demo_list = json_decode( $body );
|
69 |
-
|
70 |
-
set_transient( 'auxin_'. THEME_ID .'_demo_list', $demo_list, DAY_IN_SECONDS );
|
71 |
-
}
|
72 |
-
|
73 |
-
?>
|
74 |
-
<h2 class="aux-featur"><?php esc_html_e( 'Choose the demo you want.', 'auxin-elements' ); ?></h2>
|
75 |
-
<h4 class="aux-featur demos-subtitle"><?php esc_html_e('Please note that, it is recommended to import a demo on a clean WordPress installation.', 'auxin-elements'); ?></h4>
|
76 |
-
<div class="changelog feature-section three-col">
|
77 |
-
<?php foreach ( $demo_list as $demo ) { ?>
|
78 |
-
<div class="col" id="<?php echo esc_attr( $demo->site_id ); ?>">
|
79 |
-
<img class="demos-img" src="<?php echo esc_url( $demo->thumbnail ) ; ?>" alt="<?php echo esc_attr( $demo->title ); ?>">
|
80 |
-
<h3><?php echo esc_html( $demo->title ); ?></h3>
|
81 |
-
<p><?php echo $demo->excerpt ; ?></p>
|
82 |
-
|
83 |
-
<a href="<?php echo esc_url( $demo->url ); ?>" class="button button-primary aux-button" target="_blank"><?php esc_html_e('Preview', 'auxin-elements'); ?></a>
|
84 |
-
<a href="" class="button button-primary aux-button import-demo">
|
85 |
-
<?php _e( 'Import Demo', 'auxin-elements' ); ?>
|
86 |
-
</a>
|
87 |
-
</div>
|
88 |
-
<?php } ?>
|
89 |
-
|
90 |
-
</div>
|
91 |
-
<?php
|
92 |
-
}
|
93 |
-
|
94 |
function auxin_welcome_add_section_demos( $sections ){
|
95 |
|
96 |
$sections['demos'] = array(
|
97 |
-
'label' => __( '
|
98 |
-
'description' =>
|
99 |
-
'
|
100 |
);
|
101 |
|
102 |
return $sections;
|
27 |
}
|
28 |
|
29 |
|
30 |
+
function auxels_init_shortcode_manager(){
|
31 |
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
32 |
return;
|
33 |
|
34 |
add_filter( 'mce_external_plugins', 'auxin_add_elements_tinymce_plugin' );
|
35 |
add_filter( 'mce_buttons', 'auxin_register_shortcode_button' );
|
36 |
}
|
37 |
+
add_action("init", "auxels_init_shortcode_manager");
|
38 |
+
|
39 |
+
|
40 |
+
/*-----------------------------------------------------------------------------------*/
|
41 |
+
/* Wizard admin notice
|
42 |
+
/*-----------------------------------------------------------------------------------*/
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Skip the notice for running the setup wizard
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
function auxels_hide_wizard_notice() {
|
50 |
+
if ( isset( $_GET['auxels-hide-wizard-notice'] ) && isset( $_GET['_notice_nonce'] ) ) {
|
51 |
+
if ( ! wp_verify_nonce( $_GET['_notice_nonce'], 'auxels_hide_notices_nonce' ) ) {
|
52 |
+
wp_die( __( 'Authorization failed. Please refresh the page and try again.', 'auxin-elements' ) );
|
53 |
+
}
|
54 |
+
auxin_update_option( 'auxels_hide_wizard_notice', 1 );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
add_action( 'wp_loaded', 'auxels_hide_wizard_notice' );
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Display a notice for running the setup wizard
|
62 |
+
*
|
63 |
+
* @return void
|
64 |
+
*/
|
65 |
+
function auxels_wizard_notice(){
|
66 |
+
if( auxin_get_option( 'auxels_hide_wizard_notice' ) ){
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
?>
|
70 |
+
<div id="message" class="updated auxin-message">
|
71 |
+
<p><?php _e( '<strong>Welcome to Phlox</strong> – You can import demo content and install recommended plugins using setup wizard.', 'auxin-elements' ); ?></p>
|
72 |
+
<p class="submit"><a href="<?php echo esc_url( Auxin_Wizard::get_instance()->get_page_link() ); ?>" class="button-primary"><?php _e( 'Run Setup Wizard', 'auxin-elements' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'auxels-hide-wizard-notice', 'install' ), 'auxels_hide_notices_nonce', '_notice_nonce' ) ); ?>"><?php _e( 'Skip Setup', 'auxin-elements' ); ?></a></p>
|
73 |
+
</div>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
|
77 |
+
add_action( 'admin_notices', 'auxels_wizard_notice' );
|
78 |
|
79 |
/*-----------------------------------------------------------------------------------*/
|
80 |
/* Add Editor styles
|
92 |
/* Adds demos tab in theme about (welcome) page
|
93 |
/*-----------------------------------------------------------------------------------*/
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
function auxin_welcome_add_section_demos( $sections ){
|
96 |
|
97 |
$sections['demos'] = array(
|
98 |
+
'label' => __( 'Setup Wizard', 'auxin-elements' ),
|
99 |
+
'description' => '',
|
100 |
+
'url' => Auxin_Wizard::get_instance()->get_page_link()
|
101 |
);
|
102 |
|
103 |
return $sections;
|
admin/includes/compatibility/gopricing/images/signs/badge-popular-blue.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/signs/circle-sale-blue.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/signs/rectangle-mostpopular-blue.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/signs/ribbon-popular-blue.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/signs/small-rectangle-mostpopular-blue.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/templates/circle.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/templates/classic.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/templates/host-normal.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/templates/host-start.png
ADDED
Binary file
|
admin/includes/compatibility/gopricing/images/templates/modern.png
ADDED
Binary file
|
auxin-elements.php
CHANGED
@@ -12,14 +12,14 @@
|
|
12 |
* Plugin Name: Phlox Core Elements
|
13 |
* Plugin URI: https://wordpress.org/plugins/auxin-elements/
|
14 |
* Description: Powerful and comprehensive plugin that extends the functionality of Phlox theme by adding new shortcodes, widgets and options
|
15 |
-
* Version: 1.
|
16 |
* Author: averta
|
17 |
* Author URI: http://averta.net
|
18 |
* Text Domain: auxin-elements
|
19 |
* License: GPL2
|
20 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
21 |
* Domain Path: /languages
|
22 |
-
* Tested up to: 4.8.
|
23 |
*/
|
24 |
|
25 |
// If this file is called directly, abort.
|
@@ -68,7 +68,7 @@ if( is_admin() || false === get_transient( 'auxels_plugin_requirements_check' )
|
|
68 |
'themes' => array(
|
69 |
array(
|
70 |
'name' => __('Phlox', 'auxin-elements'), // The theme name.
|
71 |
-
'version' => '1.
|
72 |
'is_callable' => '', // If set, this callable will be be checked for availability to determine if a theme is active.
|
73 |
'file_exists' => get_template_directory() . '/auxin/auxin-include/auxin.php' // If set, this file will be checked for availability to determine if a theme is active.
|
74 |
)
|
12 |
* Plugin Name: Phlox Core Elements
|
13 |
* Plugin URI: https://wordpress.org/plugins/auxin-elements/
|
14 |
* Description: Powerful and comprehensive plugin that extends the functionality of Phlox theme by adding new shortcodes, widgets and options
|
15 |
+
* Version: 1.6.0
|
16 |
* Author: averta
|
17 |
* Author URI: http://averta.net
|
18 |
* Text Domain: auxin-elements
|
19 |
* License: GPL2
|
20 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
21 |
* Domain Path: /languages
|
22 |
+
* Tested up to: 4.8.3
|
23 |
*/
|
24 |
|
25 |
// If this file is called directly, abort.
|
68 |
'themes' => array(
|
69 |
array(
|
70 |
'name' => __('Phlox', 'auxin-elements'), // The theme name.
|
71 |
+
'version' => '1.8.0', // E.g. 1.0.0. If set, the active theme must be this version or higher.
|
72 |
'is_callable' => '', // If set, this callable will be be checked for availability to determine if a theme is active.
|
73 |
'file_exists' => get_template_directory() . '/auxin/auxin-include/auxin.php' // If set, this file will be checked for availability to determine if a theme is active.
|
74 |
)
|
includes/classes/class-auxin-demo-importer.php
ADDED
@@ -0,0 +1,553 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Demo Importer for auxin framework
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @package Auxin
|
7 |
+
* @license LICENSE.txt
|
8 |
+
* @author
|
9 |
+
* @link http://averta.net/phlox/
|
10 |
+
* @copyright (c) 2010-2017
|
11 |
+
*/
|
12 |
+
|
13 |
+
// no direct access allowed
|
14 |
+
if ( ! defined('ABSPATH') ) exit;
|
15 |
+
|
16 |
+
class Auxin_Demo_Importer {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance of this class.
|
20 |
+
*
|
21 |
+
* @var object
|
22 |
+
*/
|
23 |
+
protected static $instance = null;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return an instance of this class.
|
27 |
+
*
|
28 |
+
* @return object A single instance of this class.
|
29 |
+
*/
|
30 |
+
public static function get_instance() {
|
31 |
+
|
32 |
+
// If the single instance hasn't been set, set it now.
|
33 |
+
if ( null == self::$instance ) {
|
34 |
+
self::$instance = new self;
|
35 |
+
}
|
36 |
+
|
37 |
+
return self::$instance;
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
function __construct() {
|
42 |
+
|
43 |
+
add_action( 'wp_ajax_auxin_demo_data' , array( $this, 'import') );
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Main Import
|
49 |
+
*
|
50 |
+
*
|
51 |
+
* @return JSON
|
52 |
+
*/
|
53 |
+
public function import() {
|
54 |
+
|
55 |
+
$demo_ID = $_POST['ID'];
|
56 |
+
|
57 |
+
if ( ! wp_verify_nonce( $_POST['verify'], 'aux-import-demo-' . $demo_ID ) ) {
|
58 |
+
// This nonce is not valid.
|
59 |
+
wp_send_json_error();
|
60 |
+
}
|
61 |
+
|
62 |
+
$data = $this->parse( 'http://averta.net/phlox/wordpress-theme/demo/api/?demo=' . $demo_ID, $demo_ID );
|
63 |
+
|
64 |
+
if( ! empty( $data ) ) {
|
65 |
+
|
66 |
+
$get_options = $_POST['options'];
|
67 |
+
|
68 |
+
foreach ($get_options as $key => $value) {
|
69 |
+
$option[ $value['name'] ] = $value['value'];
|
70 |
+
}
|
71 |
+
|
72 |
+
$status = array();
|
73 |
+
|
74 |
+
if ( $option['import'] == 'complete' ) {
|
75 |
+
|
76 |
+
if( isset( $option['import-media'] ) && isset( $data['medias'] ) ){
|
77 |
+
$status[] = $this->import_medias( $data['medias'] );
|
78 |
+
}
|
79 |
+
if( isset( $data['content'] ) ){
|
80 |
+
$status[] = $this->import_posts( $data['content'] );
|
81 |
+
}
|
82 |
+
if( isset( $data['widgets'] ) ){
|
83 |
+
$status[] = $this->import_widgets( $data['widgets'] );
|
84 |
+
}
|
85 |
+
if( isset( $data['menus'] ) ){
|
86 |
+
$status[] = $this->import_menus( $data['menus'] );
|
87 |
+
}
|
88 |
+
if( isset( $data['auxin_options'] ) ){
|
89 |
+
$status[] = $this->import_auxin_options( $data['auxin_options'] );
|
90 |
+
}
|
91 |
+
if( isset( $data['site_options'] ) ){
|
92 |
+
$status[] = $this->import_site_options( $data['site_options'] );
|
93 |
+
}
|
94 |
+
|
95 |
+
} else {
|
96 |
+
|
97 |
+
if( isset( $option['medias'] ) && isset( $data['medias'] ) ){
|
98 |
+
$status[] = $this->import_medias( $data['medias'] );
|
99 |
+
}
|
100 |
+
if( isset( $option['posts'] ) && isset( $data['content'] ) ){
|
101 |
+
$status[] = $this->import_posts( $data['content'] );
|
102 |
+
}
|
103 |
+
if( isset( $option['widgets'] ) && isset( $data['widgets'] ) ){
|
104 |
+
$status[] = $this->import_widgets( $data['widgets'] );
|
105 |
+
}
|
106 |
+
if( isset( $option['menus'] ) && isset( $data['menus'] ) ){
|
107 |
+
$status[] = $this->import_menus( $data['menus'] );
|
108 |
+
}
|
109 |
+
if( isset( $option['options'] ) ){
|
110 |
+
if( isset( $data['auxin_options'] ) ){
|
111 |
+
$status[] = $this->import_auxin_options( $data['auxin_options'] );
|
112 |
+
}
|
113 |
+
if( isset( $data['site_options'] ) ){
|
114 |
+
$status[] = $this->import_site_options( $data['site_options'] );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
wp_send_json_success( $status );
|
121 |
+
|
122 |
+
} else {
|
123 |
+
|
124 |
+
wp_send_json_error();
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Parse url
|
132 |
+
*
|
133 |
+
* @param String $url
|
134 |
+
*
|
135 |
+
* @return Array
|
136 |
+
*/
|
137 |
+
public function parse( $url, $id ) {
|
138 |
+
|
139 |
+
$key = sanitize_key( 'auxin_demo_item_' . $id );
|
140 |
+
|
141 |
+
if ( ! get_transient( $key ) ) {
|
142 |
+
//Get JSON
|
143 |
+
$request = wp_remote_get( $url );
|
144 |
+
//If the remote request fails, wp_remote_get() will return a WP_Error
|
145 |
+
if( is_wp_error( $request ) || ! current_user_can( 'import' ) ) wp_die();
|
146 |
+
//proceed to retrieving the data
|
147 |
+
$body = wp_remote_retrieve_body( $request );
|
148 |
+
//translate the JSON into Array
|
149 |
+
$data = json_decode( $body, true );
|
150 |
+
//Add transient
|
151 |
+
set_transient( $key, $data, 2 * HOUR_IN_SECONDS );
|
152 |
+
}
|
153 |
+
|
154 |
+
return get_transient( $key );
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
// Importers
|
159 |
+
// =====================================================================
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Import auxin customizer options data
|
163 |
+
*
|
164 |
+
* @param array $args
|
165 |
+
*
|
166 |
+
* @return String
|
167 |
+
*/
|
168 |
+
public function import_auxin_options( array $args ) {
|
169 |
+
|
170 |
+
foreach ( $args as $key => $value ) {
|
171 |
+
|
172 |
+
// if ( empty( $value ) ) continue;
|
173 |
+
|
174 |
+
auxin_update_option( $key , $value);
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
return 'auxin options dones';
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Import site options data
|
184 |
+
*
|
185 |
+
* @param array $args
|
186 |
+
*
|
187 |
+
* @return String
|
188 |
+
*/
|
189 |
+
public function import_site_options( array $args ) {
|
190 |
+
|
191 |
+
foreach ( $args as $key => $value ) {
|
192 |
+
|
193 |
+
if ( empty( $value ) ) continue;
|
194 |
+
|
195 |
+
if( $key === 'page_on_front' || $key === 'page_for_posts' ) {
|
196 |
+
// Retrieves page object given its title.
|
197 |
+
$page = get_page_by_title( $value );
|
198 |
+
// Set $value to page ID
|
199 |
+
$value = $page->ID;
|
200 |
+
}
|
201 |
+
|
202 |
+
update_option( $key, $value );
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
return 'site options dones';
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Import widgets data
|
212 |
+
*
|
213 |
+
* @param array $args
|
214 |
+
*
|
215 |
+
* @return String
|
216 |
+
*/
|
217 |
+
public function import_widgets( array $args ) {
|
218 |
+
|
219 |
+
$default_widgets = get_option( 'sidebars_widgets' );
|
220 |
+
|
221 |
+
foreach ( $default_widgets as $key => $value ) {
|
222 |
+
|
223 |
+
if (array_key_exists( $key, $args)) {
|
224 |
+
$value = $args[$key];
|
225 |
+
}
|
226 |
+
$default_widgets[$key] = $value;
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
update_option( 'sidebars_widgets' , $default_widgets );
|
231 |
+
|
232 |
+
return 'widgets dones';
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Import menus data
|
238 |
+
*
|
239 |
+
* @param array $args
|
240 |
+
*
|
241 |
+
* @return Boolean
|
242 |
+
*/
|
243 |
+
public function import_menus( array $args ) {
|
244 |
+
|
245 |
+
foreach ($args as $menu_name => $menu_data) {
|
246 |
+
|
247 |
+
$menu_exists = wp_get_nav_menu_object( $menu_name );
|
248 |
+
|
249 |
+
// If it doesn't exist, let's create it.
|
250 |
+
if( ! $menu_exists ) {
|
251 |
+
|
252 |
+
$menu_id = wp_create_nav_menu( $menu_name );
|
253 |
+
|
254 |
+
if( is_wp_error( $menu_id ) ) return 'menus failed!';
|
255 |
+
|
256 |
+
// Create menu items
|
257 |
+
foreach ( $menu_data['items'] as $item_key => $item_value ) {
|
258 |
+
//Keep 'menu-meta' in a variable
|
259 |
+
$meta_data = $item_value['menu-meta'];
|
260 |
+
//remove Non-standard 'menu-meta' from array
|
261 |
+
array_pop( $item_value );
|
262 |
+
//add new menu item
|
263 |
+
$item_id = wp_update_nav_menu_item($menu_id, 0, $item_value);
|
264 |
+
//Add 'meta-data' options for menu items
|
265 |
+
foreach ($meta_data as $meta_key => $meta_value) {
|
266 |
+
|
267 |
+
switch ( $meta_key ) {
|
268 |
+
case '_menu_item_object_id':
|
269 |
+
add_option( 'auxin-menu-item-old-parent-id-' . $meta_value, $item_id );
|
270 |
+
$meta_value = $item_id;
|
271 |
+
break;
|
272 |
+
|
273 |
+
case '_menu_item_menu_item_parent':
|
274 |
+
if( (int) $meta_value != 0 ) {
|
275 |
+
$meta_value = get_option( 'auxin-menu-item-old-parent-id-' . $meta_value );
|
276 |
+
}
|
277 |
+
break;
|
278 |
+
}
|
279 |
+
|
280 |
+
update_post_meta( $item_id, $meta_key, $meta_value );
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
// Putting up menu locations on theme_mods_phlox
|
285 |
+
$locations = get_theme_mod( 'nav_menu_locations' );
|
286 |
+
foreach ( $menu_data['location'] as $location_id => $location_name ) {
|
287 |
+
$locations[$location_name] = $menu_id;
|
288 |
+
}
|
289 |
+
set_theme_mod( 'nav_menu_locations', $locations );
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
return 'menus dones';
|
296 |
+
|
297 |
+
}
|
298 |
+
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Import posts data
|
302 |
+
*
|
303 |
+
* @param array $args
|
304 |
+
*
|
305 |
+
* @return String
|
306 |
+
*/
|
307 |
+
public function import_posts( array $args ) {
|
308 |
+
|
309 |
+
foreach ($args as $slug => $post) {
|
310 |
+
|
311 |
+
$title = sanitize_text_field( $post['post_title'] ); // remove any junk
|
312 |
+
$post_type = post_type_exists( $post['post_type'] ) ? $post['post_type'] : 'post';
|
313 |
+
|
314 |
+
// If the page doesn't already exist, then create it (check by title)
|
315 |
+
if ( ! get_page_by_title( $title, 'OBJECT', $post_type ) ) {
|
316 |
+
|
317 |
+
$content = base64_decode( $post['post_content'] );
|
318 |
+
$author_id = get_current_user_id();
|
319 |
+
|
320 |
+
$post_id = wp_insert_post(
|
321 |
+
array(
|
322 |
+
'post_title' => $title,
|
323 |
+
'post_content' => $content,
|
324 |
+
'post_excerpt' => $post['post_excerpt'],
|
325 |
+
'post_date' => $post['post_date'],
|
326 |
+
'post_password' => $post['post_password'],
|
327 |
+
'post_parent' => $post['post_parent'],
|
328 |
+
'post_type' => $post_type,
|
329 |
+
'post_author' => $author_id,
|
330 |
+
'post_status' => 'publish',
|
331 |
+
)
|
332 |
+
);
|
333 |
+
|
334 |
+
if ( ! is_wp_error( $post_id ) ) {
|
335 |
+
|
336 |
+
//Add post terms
|
337 |
+
foreach ( $post['post_terms'] as $tax => $term ) {
|
338 |
+
|
339 |
+
if( taxonomy_exists( $tax ) ){
|
340 |
+
|
341 |
+
foreach ($term as $key => $value) {
|
342 |
+
|
343 |
+
$term = term_exists( $value, $tax );
|
344 |
+
|
345 |
+
// If the taxonomy doesn't exist, then we create it
|
346 |
+
if ( 0 === $term || null === $term ) {
|
347 |
+
|
348 |
+
$term = wp_insert_term(
|
349 |
+
$value,
|
350 |
+
$tax,
|
351 |
+
array(
|
352 |
+
'slug' => strtolower( str_ireplace( ' ', '-', $value ) )
|
353 |
+
)
|
354 |
+
);
|
355 |
+
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
wp_set_post_terms( $post_id, $term, $tax );
|
360 |
+
|
361 |
+
}
|
362 |
+
|
363 |
+
}
|
364 |
+
|
365 |
+
foreach ( $post['post_meta'] as $meta_key => $meta_value ) {
|
366 |
+
update_post_meta( $post_id, $meta_key, $meta_value );
|
367 |
+
}
|
368 |
+
|
369 |
+
//Add auxin meta flag
|
370 |
+
add_post_meta( $post_id, 'auxin_import_post', 'demo' );
|
371 |
+
|
372 |
+
if( $post['post_thumb'] != "" ){
|
373 |
+
/* Get Attachment ID */
|
374 |
+
$attachment_id = $this->get_attachment_id( 'auxin_import_id', $post['post_thumb'] );
|
375 |
+
|
376 |
+
if ( $attachment_id ) {
|
377 |
+
set_post_thumbnail( $post_id, $attachment_id );
|
378 |
+
}
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
} else {
|
383 |
+
|
384 |
+
return 'posts faild!';
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
}
|
389 |
+
|
390 |
+
}
|
391 |
+
|
392 |
+
return 'posts dones';
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Import media data
|
399 |
+
*
|
400 |
+
* @param array $args
|
401 |
+
*
|
402 |
+
* @return String
|
403 |
+
*/
|
404 |
+
public function import_medias( array $args ) {
|
405 |
+
|
406 |
+
foreach ( $args as $import_id => $import_url ) {
|
407 |
+
|
408 |
+
$import = $this->insert_attachment( $import_id, $import_url['url'] );
|
409 |
+
|
410 |
+
}
|
411 |
+
|
412 |
+
return 'medias dones';
|
413 |
+
|
414 |
+
}
|
415 |
+
|
416 |
+
// Custom Functionalities
|
417 |
+
// =====================================================================
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Get the attachment ID
|
421 |
+
*
|
422 |
+
* @param string $key
|
423 |
+
* @param string $value
|
424 |
+
*
|
425 |
+
* @return ID | false
|
426 |
+
*/
|
427 |
+
public function get_attachment_id( $key, $value ) {
|
428 |
+
|
429 |
+
global $wpdb;
|
430 |
+
|
431 |
+
$meta = $wpdb->get_results( "
|
432 |
+
SELECT *
|
433 |
+
FROM $wpdb->postmeta
|
434 |
+
WHERE
|
435 |
+
meta_key='".$key."'
|
436 |
+
AND
|
437 |
+
meta_value='".$value."'
|
438 |
+
");
|
439 |
+
|
440 |
+
if ( is_array($meta) && !empty($meta) && isset($meta[0]) ) {
|
441 |
+
$meta = $meta[0];
|
442 |
+
}
|
443 |
+
|
444 |
+
if ( is_object( $meta ) ) {
|
445 |
+
return $meta->post_id;
|
446 |
+
} else {
|
447 |
+
return false;
|
448 |
+
}
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Insert attachment from url
|
454 |
+
*
|
455 |
+
* @param integer $import_id
|
456 |
+
* @param string $url
|
457 |
+
* @param integer $post_id
|
458 |
+
*
|
459 |
+
* @return Integer
|
460 |
+
*/
|
461 |
+
public function insert_attachment( $import_id, $url, $post_id = null ) {
|
462 |
+
|
463 |
+
//Check media existence
|
464 |
+
if ( $this->attachment_exist( pathinfo( $url, PATHINFO_FILENAME ) ) ) return;
|
465 |
+
|
466 |
+
if( !class_exists( 'WP_Http' ) ){
|
467 |
+
include_once( ABSPATH . WPINC . '/class-http.php' );
|
468 |
+
}
|
469 |
+
|
470 |
+
// $http = new WP_Http();
|
471 |
+
// $response = $http->request( $url );
|
472 |
+
|
473 |
+
// if( $response['response']['code'] != 200 ) {
|
474 |
+
// return false;
|
475 |
+
// }
|
476 |
+
|
477 |
+
// Retrieve the raw response from the HTTP request using the GET method for our image URL.
|
478 |
+
$response = wp_remote_get( $url );
|
479 |
+
|
480 |
+
if ( ! is_array( $response ) ) return false;
|
481 |
+
|
482 |
+
$upload = wp_upload_bits( basename($url), null, $response['body'] );
|
483 |
+
|
484 |
+
if( ! empty( $upload['error'] ) ) {
|
485 |
+
return false;
|
486 |
+
}
|
487 |
+
|
488 |
+
$file_path = $upload['file'];
|
489 |
+
$file_name = basename( $file_path );
|
490 |
+
$file_type = wp_check_filetype( $file_name, null );
|
491 |
+
$attachment_title = sanitize_file_name( pathinfo( $file_name, PATHINFO_FILENAME ) );
|
492 |
+
$wp_upload_dir = wp_upload_dir();
|
493 |
+
|
494 |
+
$post_info = array(
|
495 |
+
'guid' => $wp_upload_dir['url'] . '/' . $file_name,
|
496 |
+
'post_mime_type' => $file_type['type'],
|
497 |
+
'post_title' => $attachment_title,
|
498 |
+
'post_content' => '',
|
499 |
+
'post_status' => 'inherit',
|
500 |
+
);
|
501 |
+
|
502 |
+
// Create the attachment
|
503 |
+
$attach_id = wp_insert_attachment( $post_info, $file_path, $post_id );
|
504 |
+
|
505 |
+
// Include image.php
|
506 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
507 |
+
|
508 |
+
// Define attachment metadata
|
509 |
+
$attach_data = wp_generate_attachment_metadata( $attach_id, $file_path );
|
510 |
+
|
511 |
+
// Assign metadata to attachment
|
512 |
+
wp_update_attachment_metadata( $attach_id, $attach_data );
|
513 |
+
|
514 |
+
//Add auxin meta flag
|
515 |
+
update_post_meta( $attach_id, 'auxin_import_id', $import_id );
|
516 |
+
|
517 |
+
return $attach_id;
|
518 |
+
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Check media existence
|
523 |
+
*
|
524 |
+
* @param string $filename
|
525 |
+
*
|
526 |
+
* @return boolean
|
527 |
+
*/
|
528 |
+
public function attachment_exist( $filename ) {
|
529 |
+
|
530 |
+
global $wpdb;
|
531 |
+
|
532 |
+
$query = $wpdb->get_var( "
|
533 |
+
SELECT COUNT(*)
|
534 |
+
FROM
|
535 |
+
$wpdb->posts AS p,
|
536 |
+
$wpdb->postmeta AS m
|
537 |
+
WHERE
|
538 |
+
p.ID = m.post_ID
|
539 |
+
AND p.post_type = 'attachment'
|
540 |
+
AND m.meta_key = 'auxin_import_id'
|
541 |
+
AND p.guid LIKE '%".$filename."%'
|
542 |
+
");
|
543 |
+
|
544 |
+
if ( $query ) {
|
545 |
+
return true;
|
546 |
+
} else {
|
547 |
+
return false;
|
548 |
+
}
|
549 |
+
|
550 |
+
}
|
551 |
+
|
552 |
+
|
553 |
+
}//End class
|
includes/classes/class-auxin-widget.php
CHANGED
@@ -316,12 +316,12 @@ class Auxin_Widget extends WP_Widget {
|
|
316 |
$att_ids = explode( ',', $instance[$id] );
|
317 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
318 |
if(!empty($att_ids)) {
|
319 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
320 |
}
|
321 |
}
|
322 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
323 |
'<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
|
324 |
-
'<input type="text" class="white" name="'
|
325 |
'" data-media-type="image" data-limit="1" data-multiple="0"
|
326 |
data-add-to-list="'.__('Add Image', 'auxin-elements').'"
|
327 |
data-uploader-submit="'.__('Add Image', 'auxin-elements').'"
|
@@ -339,7 +339,7 @@ class Auxin_Widget extends WP_Widget {
|
|
339 |
$att_ids = explode( ',', $instance[$id] );
|
340 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
341 |
if(!empty($att_ids)) {
|
342 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
343 |
}
|
344 |
}
|
345 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
@@ -363,7 +363,7 @@ class Auxin_Widget extends WP_Widget {
|
|
363 |
$att_ids = explode( ',', $instance[$id] );
|
364 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
365 |
if(!empty($att_ids)) {
|
366 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
367 |
}
|
368 |
}
|
369 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
@@ -387,7 +387,7 @@ class Auxin_Widget extends WP_Widget {
|
|
387 |
$att_ids = explode( ',', $instance[$id] );
|
388 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
389 |
if(!empty($att_ids)) {
|
390 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
391 |
}
|
392 |
}
|
393 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
@@ -460,7 +460,7 @@ class Auxin_Widget extends WP_Widget {
|
|
460 |
auxin.elements.%3$s.dependencies = %2$s;
|
461 |
auxin.elements.%3$s.baseid = "%1$s";</script>',
|
462 |
$this->widget_info['base_ID'],
|
463 |
-
|
464 |
$this->defaults[ '__uid' ]
|
465 |
);
|
466 |
}
|
316 |
$att_ids = explode( ',', $instance[$id] );
|
317 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
318 |
if(!empty($att_ids)) {
|
319 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
320 |
}
|
321 |
}
|
322 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
323 |
'<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
|
324 |
+
'<input type="text" class="white" name="'. esc_attr( $this->get_field_name( $id ) ).'" ' . 'id="'. esc_attr( $this->get_field_id( $id ) ).'" ' . 'value="' . $instance[$id] .
|
325 |
'" data-media-type="image" data-limit="1" data-multiple="0"
|
326 |
data-add-to-list="'.__('Add Image', 'auxin-elements').'"
|
327 |
data-uploader-submit="'.__('Add Image', 'auxin-elements').'"
|
339 |
$att_ids = explode( ',', $instance[$id] );
|
340 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
341 |
if(!empty($att_ids)) {
|
342 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
343 |
}
|
344 |
}
|
345 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
363 |
$att_ids = explode( ',', $instance[$id] );
|
364 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
365 |
if(!empty($att_ids)) {
|
366 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
367 |
}
|
368 |
}
|
369 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
387 |
$att_ids = explode( ',', $instance[$id] );
|
388 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
389 |
if(!empty($att_ids)) {
|
390 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
391 |
}
|
392 |
}
|
393 |
echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
|
460 |
auxin.elements.%3$s.dependencies = %2$s;
|
461 |
auxin.elements.%3$s.baseid = "%1$s";</script>',
|
462 |
$this->widget_info['base_ID'],
|
463 |
+
wp_json_encode( $this->dependency_list ),
|
464 |
$this->defaults[ '__uid' ]
|
465 |
);
|
466 |
}
|
includes/classes/class-auxin-wizard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