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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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// no direct access allowed
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Auxin_Wizard class
|
8 |
+
*/
|
9 |
+
class Auxin_Wizard {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The class version number.
|
13 |
+
*
|
14 |
+
* @since 1.0
|
15 |
+
* @access private
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $version = '1.1';
|
20 |
+
|
21 |
+
/** @var string Current theme name, used as namespace in actions. */
|
22 |
+
protected $theme_id = '';
|
23 |
+
|
24 |
+
/** @var string Current Step */
|
25 |
+
protected $step = '';
|
26 |
+
|
27 |
+
/** @var array Steps for the setup wizard */
|
28 |
+
protected $steps = array();
|
29 |
+
|
30 |
+
/**
|
31 |
+
* The slug name to refer to this menu
|
32 |
+
*
|
33 |
+
* @since 1.0
|
34 |
+
*
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
protected $page_slug;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* TGMPA instance storage
|
41 |
+
*
|
42 |
+
* @var object
|
43 |
+
*/
|
44 |
+
protected $tgmpa_instance;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* TGMPA Menu slug
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
protected $tgmpa_menu_slug = 'tgmpa-install-plugins';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* TGMPA Menu url
|
55 |
+
*
|
56 |
+
* @var string
|
57 |
+
*/
|
58 |
+
protected $tgmpa_url = 'themes.php?page=tgmpa-install-plugins';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Holds the current instance of the theme manager
|
62 |
+
*
|
63 |
+
* @since 1.0
|
64 |
+
* @var Auxin_Wizard
|
65 |
+
*/
|
66 |
+
private static $instance = null;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @since 1.0
|
70 |
+
*
|
71 |
+
* @return Auxin_Wizard
|
72 |
+
*/
|
73 |
+
public static function get_instance() {
|
74 |
+
if ( ! self::$instance ) {
|
75 |
+
self::$instance = new self;
|
76 |
+
}
|
77 |
+
|
78 |
+
return self::$instance;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* A dummy constructor to prevent this class from being loaded more than once.
|
84 |
+
*
|
85 |
+
* @see Auxin_Wizard::instance()
|
86 |
+
*
|
87 |
+
* @since 1.0
|
88 |
+
* @access private
|
89 |
+
*/
|
90 |
+
public function __construct() {
|
91 |
+
$this->init_globals();
|
92 |
+
$this->init_actions();
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Setup the class globals.
|
97 |
+
*
|
98 |
+
* @since 1.0
|
99 |
+
* @access public
|
100 |
+
*/
|
101 |
+
public function init_globals() {
|
102 |
+
$this->theme_id = THEME_ID;
|
103 |
+
$this->page_slug = 'auxin-wizard';
|
104 |
+
$this->parent_slug = 'auxin-welcome';
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Setup the hooks, actions and filters.
|
109 |
+
*
|
110 |
+
* @uses add_action() To add actions.
|
111 |
+
* @uses add_filter() To add filters.
|
112 |
+
*
|
113 |
+
* @since 1.0
|
114 |
+
* @access public
|
115 |
+
*/
|
116 |
+
public function init_actions() {
|
117 |
+
if ( current_user_can( 'manage_options' ) ) {
|
118 |
+
|
119 |
+
if ( class_exists( 'TGM_Plugin_Activation' ) && isset( $GLOBALS['tgmpa'] ) ) {
|
120 |
+
add_action( 'init' , array( $this, 'get_tgmpa_instanse' ), 30 );
|
121 |
+
add_action( 'init' , array( $this, 'set_tgmpa_url' ), 40 );
|
122 |
+
}
|
123 |
+
|
124 |
+
if( ! class_exists( 'Auxin_Demo_Importer' ) ){
|
125 |
+
require_once( 'class-auxin-demo-importer.php' );
|
126 |
+
}
|
127 |
+
// Get instance of Auxin_Demo_Importer Class
|
128 |
+
Auxin_Demo_Importer::get_instance();
|
129 |
+
|
130 |
+
add_action( 'admin_menu' , array( $this, 'admin_menus' ), 19 );
|
131 |
+
add_action( 'admin_enqueue_scripts' , array( $this, 'enqueue_scripts' ) );
|
132 |
+
add_action( 'admin_init' , array( $this, 'init_wizard_steps' ), 30 );
|
133 |
+
add_filter( 'tgmpa_load' , array( $this, 'tgmpa_load' ), 10, 1 );
|
134 |
+
add_action( 'wp_ajax_aux_setup_plugins' , array( $this, 'ajax_plugins' ) );
|
135 |
+
add_action( 'admin_enqueue_scripts' , array( $this, 'maybe_add_body_class_name' ) );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Checks and adds a constant class names to body on wizard page
|
141 |
+
*/
|
142 |
+
public function maybe_add_body_class_name(){
|
143 |
+
$screen = get_current_screen();
|
144 |
+
if( is_object( $screen ) && false !== strpos( $screen->id, '_' . $this->page_slug ) ){
|
145 |
+
add_action( 'admin_body_class', array( $this, 'add_body_class_name' ) );
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Adds a constant class names to body on wizard page
|
151 |
+
*/
|
152 |
+
public function add_body_class_name( $classes ){
|
153 |
+
$classes .= ' auxin-wizard-panel';
|
154 |
+
return $classes;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Enqueue admin scripts
|
159 |
+
*
|
160 |
+
* @since 1.0
|
161 |
+
* @access public
|
162 |
+
*/
|
163 |
+
public function enqueue_scripts() {
|
164 |
+
|
165 |
+
wp_enqueue_script( 'jquery-blockui' , AUXELS_PUB_URL . '/assets/js/jquery-blockUI.js' , array(
|
166 |
+
'jquery'
|
167 |
+
), '2.70', true );
|
168 |
+
|
169 |
+
wp_enqueue_script( 'auxin-wizard' , AUXELS_PUB_URL . '/assets/js/wizard.js' , array(
|
170 |
+
'jquery',
|
171 |
+
'jquery-blockui'
|
172 |
+
), $this->version );
|
173 |
+
|
174 |
+
wp_localize_script( 'auxin-wizard' , 'aux_setup_params' , array(
|
175 |
+
'tgm_plugin_nonce' => array(
|
176 |
+
'update' => wp_create_nonce( 'tgmpa-update' ),
|
177 |
+
'install' => wp_create_nonce( 'tgmpa-install' ),
|
178 |
+
),
|
179 |
+
'tgm_bulk_url' => admin_url( $this->tgmpa_url ),
|
180 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
181 |
+
'wpnonce' => wp_create_nonce( 'aux_setup_nonce' ),
|
182 |
+
'imported_done' => esc_html__( 'This demo has been successfully imported.', 'auxin-elements' ),
|
183 |
+
'imported_fail' => esc_html__( 'Whoops! There was a problem in demo importing.', 'auxin-elements' ),
|
184 |
+
'progress_text' => esc_html__( 'Processing: Download', 'auxin-elements' ),
|
185 |
+
'nextstep_text' => esc_html__( 'Next Step', 'auxin-elements' ),
|
186 |
+
'activate_text' => esc_html__( 'Install Plugins', 'auxin-elements' ),
|
187 |
+
'makedemo_text' => esc_html__( 'Install Demo', 'auxin-elements' ),
|
188 |
+
'btnworks_text' => esc_html__( 'Work In Progress...', 'auxin-elements' )
|
189 |
+
) );
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Check for TGMPA load
|
195 |
+
*/
|
196 |
+
public function tgmpa_load( $status ) {
|
197 |
+
return is_admin() || current_user_can( 'install_themes' );
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Get configured TGMPA instance
|
202 |
+
*
|
203 |
+
* @access public
|
204 |
+
* @since 1.0
|
205 |
+
*/
|
206 |
+
public function get_tgmpa_instanse() {
|
207 |
+
$this->tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Update $tgmpa_menu_slug and $tgmpa_parent_slug from TGMPA instance
|
212 |
+
*
|
213 |
+
* @access public
|
214 |
+
* @since 1.0
|
215 |
+
*/
|
216 |
+
public function set_tgmpa_url() {
|
217 |
+
|
218 |
+
$this->tgmpa_menu_slug = ( property_exists( $this->tgmpa_instance, 'menu' ) ) ? $this->tgmpa_instance->menu : $this->tgmpa_menu_slug;
|
219 |
+
$this->tgmpa_menu_slug = apply_filters( $this->theme_id . '_theme_setup_wizard_tgmpa_menu_slug', $this->tgmpa_menu_slug );
|
220 |
+
|
221 |
+
$tgmpa_parent_slug = ( property_exists( $this->tgmpa_instance, 'parent_slug' ) && $this->tgmpa_instance->parent_slug !== 'themes.php' ) ? 'admin.php' : 'themes.php';
|
222 |
+
|
223 |
+
$this->tgmpa_url = apply_filters( $this->theme_id . '_theme_setup_wizard_tgmpa_url', $tgmpa_parent_slug . '?page=' . $this->tgmpa_menu_slug );
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Add admin menus/screens.
|
229 |
+
*/
|
230 |
+
public function admin_menus() {
|
231 |
+
|
232 |
+
if ( $this->is_appearance_submenu() ) {
|
233 |
+
add_theme_page(
|
234 |
+
sprintf( esc_attr__( 'Setup Wizard' , 'auxin-elements' ), THEME_NAME_I18N ),
|
235 |
+
sprintf( esc_attr__( '%s Setup Wizard' , 'auxin-elements' ), THEME_NAME_I18N ),
|
236 |
+
apply_filters( 'auxin_theme_wizard_capability', 'manage_options' ),
|
237 |
+
$this->page_slug,
|
238 |
+
array( $this, 'setup_wizard' )
|
239 |
+
);
|
240 |
+
|
241 |
+
} else {
|
242 |
+
add_submenu_page(
|
243 |
+
$this->parent_slug,
|
244 |
+
sprintf( esc_attr__( 'Setup Wizard' , 'auxin-elements' ), THEME_NAME_I18N ),
|
245 |
+
sprintf( esc_attr__( '%s Setup Wizard' , 'auxin-elements' ), THEME_NAME_I18N ),
|
246 |
+
apply_filters( 'auxin_theme_wizard_capability', 'manage_options' ),
|
247 |
+
$this->page_slug,
|
248 |
+
array( $this, 'setup_wizard')
|
249 |
+
);
|
250 |
+
}
|
251 |
+
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Whether the parent menu is appearance submenu or not
|
256 |
+
*
|
257 |
+
* @return boolean
|
258 |
+
*/
|
259 |
+
public function is_appearance_submenu() {
|
260 |
+
|
261 |
+
if ( empty ( $GLOBALS['admin_page_hooks'][$this->parent_slug] ) ) {
|
262 |
+
return true;
|
263 |
+
} else {
|
264 |
+
return false;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Retrieves the wizard page url
|
270 |
+
*
|
271 |
+
* @return string Page url
|
272 |
+
*/
|
273 |
+
public function get_page_link(){
|
274 |
+
return $this->is_appearance_submenu() ? admin_url( 'themes.php?page=' . $this->page_slug ) : admin_url( 'admin.php?page=' . $this->page_slug );
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Setup steps.
|
279 |
+
*
|
280 |
+
* @since 1.0
|
281 |
+
* @access public
|
282 |
+
* @return array
|
283 |
+
*/
|
284 |
+
public function init_wizard_steps() {
|
285 |
+
// First Step (Welcome)
|
286 |
+
$this->steps = array(
|
287 |
+
'introduction' => array(
|
288 |
+
'name' => esc_html__( 'Welcome', 'auxin-elements' ),
|
289 |
+
'view' => array( $this, 'setup_introduction' ),
|
290 |
+
'handler' => array( $this, '' ),
|
291 |
+
),
|
292 |
+
);
|
293 |
+
// Second Step (Tutorials)
|
294 |
+
$this->steps['tutorial_tour'] = array(
|
295 |
+
'name' => esc_html__( 'General Setup', 'auxin-elements' ),
|
296 |
+
'view' => array( $this, 'setup_tutorial' ),
|
297 |
+
'handler' => '',
|
298 |
+
);
|
299 |
+
// Third step (Plugin installation)
|
300 |
+
if ( class_exists( 'TGM_Plugin_Activation' ) && isset( $GLOBALS['tgmpa'] ) ) {
|
301 |
+
$this->steps['default_plugins'] = array(
|
302 |
+
'name' => esc_html__( 'Plugins', 'auxin-elements' ),
|
303 |
+
'view' => array( $this, 'setup_plugins' ),
|
304 |
+
'handler' => '',
|
305 |
+
);
|
306 |
+
}
|
307 |
+
// Fourth step (Online Demo Importer)
|
308 |
+
$this->steps['default_content'] = array(
|
309 |
+
'name' => esc_html__( 'Demo Importer', 'auxin-elements' ),
|
310 |
+
'view' => array( $this, 'setup_importer' ),
|
311 |
+
'handler' => '',
|
312 |
+
);
|
313 |
+
// Fifth step (Final message)
|
314 |
+
$this->steps['final_step'] = array(
|
315 |
+
'name' => esc_html__( 'Ready!', 'auxin-elements' ),
|
316 |
+
'view' => array( $this, 'setup_ready' ),
|
317 |
+
'handler' => '',
|
318 |
+
);
|
319 |
+
|
320 |
+
// $this->steps = apply_filters( $this->theme_id . '_theme_setup_wizard_steps', $this->steps );
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
/*-----------------------------------------------------------------------------------*/
|
325 |
+
/* Start Setup Wizard
|
326 |
+
/*-----------------------------------------------------------------------------------*/
|
327 |
+
public function setup_wizard() {
|
328 |
+
|
329 |
+
if ( empty( $_GET['page'] ) || $this->page_slug !== $_GET['page'] ) {
|
330 |
+
return;
|
331 |
+
}
|
332 |
+
|
333 |
+
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
334 |
+
|
335 |
+
echo '<div class="auxin-wizard-wrap">';
|
336 |
+
|
337 |
+
$this->setup_wizard_steps();
|
338 |
+
|
339 |
+
$show_content = true;
|
340 |
+
echo '<div class="aux-setup-content">';
|
341 |
+
if ( ! empty( $_REQUEST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
|
342 |
+
$show_content = call_user_func( $this->steps[ $this->step ]['handler'] );
|
343 |
+
}
|
344 |
+
if ( $show_content ) {
|
345 |
+
$this->setup_wizard_content();
|
346 |
+
}
|
347 |
+
echo '</div>';
|
348 |
+
|
349 |
+
echo '</div>';
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Get step URL
|
354 |
+
*/
|
355 |
+
public function get_step_link( $step ) {
|
356 |
+
return add_query_arg( 'step', $step, $this->get_page_link() );
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Get next step URL
|
361 |
+
*/
|
362 |
+
public function get_next_step_link() {
|
363 |
+
$keys = array_keys( $this->steps );
|
364 |
+
|
365 |
+
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ], remove_query_arg( 'translation_updated' ) );
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Get next step URL
|
370 |
+
*/
|
371 |
+
public function get_prev_step_link() {
|
372 |
+
$keys = array_keys( $this->steps );
|
373 |
+
|
374 |
+
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) - 1 ], remove_query_arg( 'translation_updated' ) );
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Output the steps
|
379 |
+
*/
|
380 |
+
public function setup_wizard_steps() {
|
381 |
+
$ouput_steps = $this->steps;
|
382 |
+
?>
|
383 |
+
<ol class="aux-setup-steps">
|
384 |
+
<?php foreach ( $ouput_steps as $step_key => $step ) : ?>
|
385 |
+
<li class="<?php
|
386 |
+
$show_link = false;
|
387 |
+
if ( $step_key === $this->step ) {
|
388 |
+
echo 'active';
|
389 |
+
} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
|
390 |
+
echo 'done';
|
391 |
+
$show_link = true;
|
392 |
+
} else {
|
393 |
+
echo 'queue';
|
394 |
+
}
|
395 |
+
?>"><?php
|
396 |
+
if ( $show_link ) {
|
397 |
+
?>
|
398 |
+
<a href="<?php echo esc_url( $this->get_step_link( $step_key ) ); ?>"><?php echo esc_html( $step['name'] ); ?></a>
|
399 |
+
<?php
|
400 |
+
} else {
|
401 |
+
echo esc_html( $step['name'] );
|
402 |
+
}
|
403 |
+
?></li>
|
404 |
+
<?php endforeach; ?>
|
405 |
+
</ol>
|
406 |
+
<?php
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Output the content for the current step
|
411 |
+
*/
|
412 |
+
public function setup_wizard_content() {
|
413 |
+
isset( $this->steps[ $this->step ] ) ? call_user_func( $this->steps[ $this->step ]['view'] ) : false;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Display Alert Message
|
418 |
+
*/
|
419 |
+
public function display_alerts( $message_body = '', $class_name = '' ){
|
420 |
+
?>
|
421 |
+
<div class="aux-alert <?php echo esc_attr( $class_name ); ?>">
|
422 |
+
<p>
|
423 |
+
<?php
|
424 |
+
if( empty($message_body ) ) {
|
425 |
+
echo sprintf("<strong>%s</strong> %s", esc_html__( 'Note:', 'auxin-elements' ), __( 'You are recommended to install Phlox exclusive plugins in order to enable all features.', 'auxin-elements' ) );
|
426 |
+
} else {
|
427 |
+
echo esc_html( $message_body );
|
428 |
+
}
|
429 |
+
?>
|
430 |
+
</p>
|
431 |
+
</div>
|
432 |
+
<?php
|
433 |
+
}
|
434 |
+
|
435 |
+
|
436 |
+
/*-----------------------------------------------------------------------------------*/
|
437 |
+
/* First Step (Welcome)
|
438 |
+
/*-----------------------------------------------------------------------------------*/
|
439 |
+
public function setup_introduction() {
|
440 |
+
if ( 0 && get_option( 'aux_setup_complete', false ) ) {
|
441 |
+
?>
|
442 |
+
<div class="aux-welcome-step">
|
443 |
+
<h1><?php printf( __( 'Beautiful Portfolio %s Websites, Free with %s Phlox Theme.', 'auxin-elements' ), '<br />', '<br />' ); ?></h1>
|
444 |
+
<p><?php esc_html_e( 'It looks like you have already run the setup.', 'auxin-elements' ); ?><br><?php esc_html_e( 'Would you like to continue this step?', 'auxin-elements' ); ?></p>
|
445 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/start.png' ); ?>" width="1012" height="875">
|
446 |
+
<div class="aux-setup-actions step">
|
447 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
448 |
+
class="aux-button aux-primary button-next"><?php esc_html_e( 'Yes & keep going', 'auxin-elements' ); ?></a>
|
449 |
+
</div>
|
450 |
+
</div>
|
451 |
+
<?php
|
452 |
+
} else {
|
453 |
+
?>
|
454 |
+
<div class="aux-welcome-step">
|
455 |
+
<h1><?php printf( __( 'Beautiful Portfolio %s Websites, Free with %s Phlox Theme.', 'auxin-elements' ), '<br />', '<br />' ); ?></h1>
|
456 |
+
<p><?php esc_html_e( 'Start Building Your Website in a few Simple Steps', 'auxin-elements' ); ?></p>
|
457 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/start.png' ); ?>" width="1012" height="875">
|
458 |
+
<div class="aux-setup-actions left step">
|
459 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
460 |
+
class="aux-button aux-primary button-next"><?php esc_html_e( 'Get Started', 'auxin-elements' ); ?></a>
|
461 |
+
|
462 |
+
</div>
|
463 |
+
</div>
|
464 |
+
<?php
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
/*-----------------------------------------------------------------------------------*/
|
469 |
+
/* Second Step (Tutorials)
|
470 |
+
/*-----------------------------------------------------------------------------------*/
|
471 |
+
public function setup_tutorial() {
|
472 |
+
?>
|
473 |
+
<div class="aux-tutorial-step">
|
474 |
+
|
475 |
+
<div class="aux-section">
|
476 |
+
<h2><?php esc_html_e( '1. Child Theme (Optional)' ); ?></h2>
|
477 |
+
<p>
|
478 |
+
If you are going to make changes to the theme source code please use a Child Theme rather than modifying the main theme HTML/CSS/PHP code. This allows the parent theme to get updates without overwriting your source code changes.
|
479 |
+
</p>
|
480 |
+
<?php
|
481 |
+
/* Use the form below to create and activate the Child Theme.
|
482 |
+
<a href="#"
|
483 |
+
class="aux-button aux-left aux-primary"><?php esc_html_e( 'Download Child Theme' ); ?></a>
|
484 |
+
<a href="#"
|
485 |
+
class="aux-button aux-left aux-outline"><?php esc_html_e( 'Quick Tour' ); ?></a>
|
486 |
+
*/
|
487 |
+
?>
|
488 |
+
</div>
|
489 |
+
|
490 |
+
<div class="clear"></div>
|
491 |
+
|
492 |
+
<div class="aux-section">
|
493 |
+
<h2><?php esc_html_e( '2. Theme Customizer' ); ?></h2>
|
494 |
+
<p>
|
495 |
+
<?php printf( __('%1$s theme is extremely customizable by plenty of theme options. You can simply customize your theme by changing the options in WordPress Customizer and preview your changes instantly without affecting your live website. Just navigate to %2$s Appearance > Customize %3$s in order to change logo, colors, sizes and so on. You can almost customize everything in %1$s theme!', 'auxin-elements' ), __('Phlox', 'auxin-elements'), '<a href="'. admin_url('customize.php') .'" target="_blank">', '</a>' ); ?>
|
496 |
+
</p>
|
497 |
+
<div class="aux-grid">
|
498 |
+
<div class="grid_6 first">
|
499 |
+
<div class="media-container">
|
500 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/customizer.png' ); ?>" width="667" height="379">
|
501 |
+
</div>
|
502 |
+
</div>
|
503 |
+
|
504 |
+
</div>
|
505 |
+
</div>
|
506 |
+
|
507 |
+
<div class="clear"></div>
|
508 |
+
|
509 |
+
<div class="aux-section">
|
510 |
+
<h2><?php esc_html_e( '2. Front Page Setup' ); ?></h2>
|
511 |
+
<p>
|
512 |
+
<?php printf( __('Front page is the main page of your website that includes many content blocks such as call to action, contact form, recent posts, services, recent projects and many other content blocks.', 'auxin-elements' ) );
|
513 |
+
echo "<br />";
|
514 |
+
_e( 'Here is how to setup your front page:', 'auxin-elements' );
|
515 |
+
?>
|
516 |
+
</p>
|
517 |
+
<br /><br />
|
518 |
+
|
519 |
+
<h3><?php esc_html_e( 'a. Create Front Page' ); ?></h3>
|
520 |
+
<div class="aux-grid">
|
521 |
+
<div class="grid_6 first">
|
522 |
+
<div class="media-container">
|
523 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/frontpage-1.png' ); ?>" width="667" height="379">
|
524 |
+
</div>
|
525 |
+
</div>
|
526 |
+
<div class="grid_6 aux-middle">
|
527 |
+
<ol>
|
528 |
+
<li>Create New Page</li>
|
529 |
+
<li>Name it “Home“ or “Front Page“</li>
|
530 |
+
<li>Choose "Front Page“ template</li>
|
531 |
+
<li>Press Publish button
</li>
|
532 |
+
</ol>
|
533 |
+
</div>
|
534 |
+
</div>
|
535 |
+
|
536 |
+
<div class="clear"></div>
|
537 |
+
|
538 |
+
<h3><?php esc_html_e( 'b. Set Front Page' ); ?></h3>
|
539 |
+
<div class="aux-grid">
|
540 |
+
<div class="grid_6 first">
|
541 |
+
<div class="media-container">
|
542 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/frontpage-2.png' ); ?>" width="667" height="379">
|
543 |
+
</div>
|
544 |
+
</div>
|
545 |
+
<div class="grid_6 aux-middle">
|
546 |
+
<ol>
|
547 |
+
<li>Navigate to Setting > Reading</li>
|
548 |
+
<li>Set "Front page display" to "A static page"</li>
|
549 |
+
<li>Set "Front Page“ to "Home" or "Front page" you have created in first step.</li>
|
550 |
+
<li>Click save button to save changes.</li>
|
551 |
+
</ol>
|
552 |
+
</div>
|
553 |
+
</div>
|
554 |
+
|
555 |
+
<div class="clear"></div>
|
556 |
+
|
557 |
+
<h3><?php esc_html_e( 'c. Set Posts/Blog Page' ); ?></h3>
|
558 |
+
<div class="aux-grid">
|
559 |
+
<div class="grid_6 first">
|
560 |
+
<div class="media-container">
|
561 |
+
<img src="<?php echo esc_url( AUXELS_ADMIN_URL . '/assets/images/wizard/frontpage-3.png' ); ?>" width="667" height="379">
|
562 |
+
</div>
|
563 |
+
</div>
|
564 |
+
<div class="grid_6 aux-middle">
|
565 |
+
<ol>
|
566 |
+
<li>Create a page and name it "Blog"</li>
|
567 |
+
<li>In Setting > Reading Set "Posts Page" to "Blog"</li>
|
568 |
+
<li>Click save button to save changes.</li>
|
569 |
+
</ol>
|
570 |
+
</div>
|
571 |
+
</div>
|
572 |
+
|
573 |
+
<div class="clear"></div>
|
574 |
+
|
575 |
+
</div>
|
576 |
+
|
577 |
+
<div class="clear"></div>
|
578 |
+
|
579 |
+
<div class="aux-sticky">
|
580 |
+
|
581 |
+
<div class="aux-setup-actions step">
|
582 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>"
|
583 |
+
class="aux-button aux-left aux-outline button-next"><?php esc_html_e( 'Previous Step', 'auxin-elements' ); ?></a>
|
584 |
+
|
585 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
586 |
+
class="aux-button aux-primary button-next"><?php esc_html_e( 'Next Step', 'auxin-elements' ); ?></a>
|
587 |
+
</div>
|
588 |
+
|
589 |
+
</div>
|
590 |
+
|
591 |
+
</div>
|
592 |
+
|
593 |
+
<?php
|
594 |
+
}
|
595 |
+
|
596 |
+
/*-----------------------------------------------------------------------------------*/
|
597 |
+
/* Third step (Plugin installation)
|
598 |
+
/*-----------------------------------------------------------------------------------*/
|
599 |
+
public function setup_plugins() {
|
600 |
+
|
601 |
+
tgmpa_load_bulk_installer();
|
602 |
+
// install plugins with TGM.
|
603 |
+
if ( ! class_exists( 'TGM_Plugin_Activation' ) || ! isset( $GLOBALS['tgmpa'] ) ) {
|
604 |
+
die( 'Failed to find TGM' );
|
605 |
+
}
|
606 |
+
$url = wp_nonce_url( add_query_arg( array( 'plugins' => 'go' ) ), 'aux-setup' );
|
607 |
+
$plugins = $this->get_plugins();
|
608 |
+
|
609 |
+
// copied from TGM
|
610 |
+
|
611 |
+
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
|
612 |
+
$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
|
613 |
+
|
614 |
+
if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
|
615 |
+
return true; // Stop the normal page form from displaying, credential request form will be shown.
|
616 |
+
}
|
617 |
+
|
618 |
+
// Now we have some credentials, setup WP_Filesystem.
|
619 |
+
if ( ! WP_Filesystem( $creds ) ) {
|
620 |
+
// Our credentials were no good, ask the user for them again.
|
621 |
+
request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
|
622 |
+
|
623 |
+
return true;
|
624 |
+
}
|
625 |
+
|
626 |
+
/* If we arrive here, we have the filesystem */
|
627 |
+
|
628 |
+
?>
|
629 |
+
<div class="aux-plugins-step aux-has-required-plugins">
|
630 |
+
<h2><?php esc_html_e( 'Recommended Plugins', 'auxin-elements' ); ?></h2>
|
631 |
+
|
632 |
+
<?php
|
633 |
+
if ( count( $plugins['all'] ) ) {
|
634 |
+
?>
|
635 |
+
<p><?php esc_html_e( 'You can install exclusive and recommended plugins for Phlox theme here, and add or remove them later on WordPress plugins page.', 'auxin-elements' ); ?></p>
|
636 |
+
|
637 |
+
<div class="aux-table">
|
638 |
+
<table class="auxin-list-table widefat">
|
639 |
+
<thead>
|
640 |
+
<tr>
|
641 |
+
<td id="cb" class="manage-column column-cb check-column" width="10%">
|
642 |
+
<label class="screen-reader-text"
|
643 |
+
for="cb-select-all"><?php esc_html_e( 'Select All', 'auxin-elements' ); ?></label>
|
644 |
+
<input
|
645 |
+
id="cb-select-all" type="checkbox">
|
646 |
+
</td>
|
647 |
+
<th class="manage-column column-thumbnail"></th>
|
648 |
+
<th scope="col" id="name"
|
649 |
+
class="manage-column column-name" width="15%"><?php esc_html_e( 'Name', 'auxin-elements' ); ?></th>
|
650 |
+
<th scope="col" id="description"
|
651 |
+
class="manage-column column-description" width="50%"><?php esc_html_e( 'Description', 'auxin-elements' ); ?></th>
|
652 |
+
<th scope="col" id="status"
|
653 |
+
class="manage-column column-status" width="17%"><?php esc_html_e( 'Status', 'auxin-elements' ); ?></th>
|
654 |
+
<th scope="col" id="version"
|
655 |
+
class="manage-column column-version" width="8%"><?php esc_html_e( 'Version', 'auxin-elements' ); ?></th>
|
656 |
+
</tr>
|
657 |
+
</thead>
|
658 |
+
<tbody class="aux-wizard-plugins">
|
659 |
+
<?php
|
660 |
+
foreach ( $plugins['all'] as $slug => $plugin ) {
|
661 |
+
if( $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
|
662 |
+
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin['file_path'] );
|
663 |
+
} else {
|
664 |
+
$plugin_data = $this->get_plugin_data_by_slug( $slug );
|
665 |
+
}
|
666 |
+
?>
|
667 |
+
<tr class="aux-plugin" data-slug="<?php echo esc_attr( $slug ); ?>">
|
668 |
+
<th scope="row" class="check-column">
|
669 |
+
<input name="plugin[]" value="<?php echo esc_attr($slug); ?>" type="checkbox">
|
670 |
+
<div class="spinner"></div>
|
671 |
+
</th>
|
672 |
+
<td class="thumbnail column-thumbnail"
|
673 |
+
data-colname="Thumbnail">
|
674 |
+
<?php
|
675 |
+
$thumbnail_size = '128x128';
|
676 |
+
if( 'instagram-feed' == $plugin['slug'] || 'yellow-pencil-visual-theme-customizer' == $plugin['slug'] ){
|
677 |
+
$thumbnail_size = '128x128';
|
678 |
+
}
|
679 |
+
if( in_array( $plugin['slug'], array("js_composer", "Ultimate_VC_Addons", "masterslider", "go_pricing") ) ) {
|
680 |
+
$thumbnail = AUXIN_URL . 'images/welcome/' . $plugin['slug'] . '-plugin.png';
|
681 |
+
}
|
682 |
+
elseif( in_array( $plugin['slug'], array("autoptimize", "custom-facebook-feed", "flickr-justified-gallery", "wp-smushit", "wordpress-importer", "customizer-export-import") ) ) {
|
683 |
+
$thumbnail = AUXIN_URL . 'images/welcome/def-plugin.png';
|
684 |
+
} else{
|
685 |
+
$thumbnail = 'https://ps.w.org/'. $plugin['slug'] .'/assets/icon-'. $thumbnail_size .'.png';
|
686 |
+
}
|
687 |
+
|
688 |
+
?>
|
689 |
+
<img src="<?php echo esc_url( $thumbnail ); ?>" width="64" height="64">
|
690 |
+
</td>
|
691 |
+
<td class="name column-name"
|
692 |
+
data-colname="Plugin">
|
693 |
+
<?php echo esc_html( $plugin['name'] ); ?>
|
694 |
+
</td>
|
695 |
+
<td class="description column-description"
|
696 |
+
data-colname="Description">
|
697 |
+
<?php
|
698 |
+
echo '<p>' . $plugin_data['Description'] . '</p>';
|
699 |
+
if (strpos($slug, 'auxin') !== false) {
|
700 |
+
echo '<div class="aux-label">' . esc_html__('Exclusive', 'auxin-elements') . '</div>';
|
701 |
+
}
|
702 |
+
?>
|
703 |
+
</td>
|
704 |
+
<td class="status column-status"
|
705 |
+
data-colname="Status">
|
706 |
+
<span>
|
707 |
+
<?php
|
708 |
+
if ( isset( $plugins['install'][ $slug ] ) ) {
|
709 |
+
echo esc_html__( 'Not Installed', 'auxin-elements' );
|
710 |
+
} elseif ( isset( $plugins['activate'][ $slug ] ) ) {
|
711 |
+
echo esc_html__( 'Not Activated', 'auxin-elements' );
|
712 |
+
}
|
713 |
+
?>
|
714 |
+
</span>
|
715 |
+
</td>
|
716 |
+
<td class="version column-version"
|
717 |
+
data-colname="Version">
|
718 |
+
<span><?php echo esc_html( $plugin_data['Version'] ); ?></span>
|
719 |
+
</td>
|
720 |
+
</tr>
|
721 |
+
<?php } ?>
|
722 |
+
</tbody>
|
723 |
+
</table>
|
724 |
+
</div>
|
725 |
+
|
726 |
+
<div class="clear"></div>
|
727 |
+
|
728 |
+
<div class="aux-sticky">
|
729 |
+
|
730 |
+
<div class="aux-setup-actions step">
|
731 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>"
|
732 |
+
class="aux-button aux-left aux-outline button-next"><?php esc_html_e( 'Previous Step', 'auxin-elements' ); ?></a>
|
733 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
734 |
+
class="aux-button aux-outline skip-next button-next"><?php esc_html_e( 'Next Step', 'auxin-elements' ); ?></a>
|
735 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
736 |
+
class="aux-button aux-primary install-plugins disabled button-next"
|
737 |
+
data-callback="install_plugins"><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
|
738 |
+
<?php wp_nonce_field( 'aux-setup' ); ?>
|
739 |
+
</div>
|
740 |
+
|
741 |
+
</div>
|
742 |
+
|
743 |
+
<?php
|
744 |
+
} else { ?>
|
745 |
+
|
746 |
+
<?php $this->display_alerts( esc_html__( 'Good news! All plugins are already installed and up to date. Please continue.', 'auxin-elements' ) , 'success' ); ?>
|
747 |
+
|
748 |
+
<div class="clear"></div>
|
749 |
+
|
750 |
+
<div class="aux-setup-actions step">
|
751 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
752 |
+
class="aux-button aux-primary button-next"><?php esc_html_e( 'Continue', 'auxin-elements' ); ?></a>
|
753 |
+
</div>
|
754 |
+
<?php
|
755 |
+
} ?>
|
756 |
+
</div>
|
757 |
+
<?php
|
758 |
+
}
|
759 |
+
|
760 |
+
/**
|
761 |
+
* Output the tgmpa plugins list
|
762 |
+
*/
|
763 |
+
private function get_plugins( $custom_list = array() ) {
|
764 |
+
|
765 |
+
$plugins = array(
|
766 |
+
'all' => array(), // Meaning: all plugins which still have open actions.
|
767 |
+
'install' => array(),
|
768 |
+
'update' => array(),
|
769 |
+
'activate' => array(),
|
770 |
+
);
|
771 |
+
|
772 |
+
foreach ( $this->tgmpa_instance->plugins as $slug => $plugin ) {
|
773 |
+
|
774 |
+
if( ! empty( $custom_list ) && ! in_array( $slug, $custom_list ) ){
|
775 |
+
// This condition is for custom requests lists
|
776 |
+
continue;
|
777 |
+
} elseif( $this->tgmpa_instance->is_plugin_active( $slug ) ) {
|
778 |
+
// No need to display plugins if they are installed, up-to-date and active.
|
779 |
+
continue;
|
780 |
+
} else {
|
781 |
+
$plugins['all'][ $slug ] = $plugin;
|
782 |
+
|
783 |
+
if ( ! $this->tgmpa_instance->is_plugin_installed( $slug ) ) {
|
784 |
+
$plugins['install'][ $slug ] = $plugin;
|
785 |
+
} else {
|
786 |
+
|
787 |
+
if ( $this->tgmpa_instance->can_plugin_activate( $slug ) ) {
|
788 |
+
$plugins['activate'][ $slug ] = $plugin;
|
789 |
+
}
|
790 |
+
}
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
+
return $plugins;
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* Returns the plugin data from WP.org API
|
799 |
+
*/
|
800 |
+
private function get_plugin_data_by_slug( $slug = '' ) {
|
801 |
+
|
802 |
+
if ( empty( $slug ) )
|
803 |
+
return false;
|
804 |
+
|
805 |
+
$key = sanitize_key( 'auxin_plugin_data_'.$slug );
|
806 |
+
|
807 |
+
if ( false === ( $plugins = get_transient( $key ) ) ) {
|
808 |
+
$args = array(
|
809 |
+
'slug' => $slug,
|
810 |
+
'fields' => array(
|
811 |
+
'short_description' => true
|
812 |
+
)
|
813 |
+
);
|
814 |
+
$response = wp_remote_post(
|
815 |
+
'http://api.wordpress.org/plugins/info/1.0/',
|
816 |
+
array(
|
817 |
+
'body' => array(
|
818 |
+
'action' => 'plugin_information',
|
819 |
+
'request' => serialize( (object) $args )
|
820 |
+
)
|
821 |
+
)
|
822 |
+
);
|
823 |
+
$data = unserialize( wp_remote_retrieve_body( $response ) );
|
824 |
+
$plugins = array( 'Description' => $data->short_description , 'Version' => $data->version );
|
825 |
+
|
826 |
+
// Set transient for next time... keep it for 24 hours
|
827 |
+
set_transient( $key, $plugins, 24 * HOUR_IN_SECONDS );
|
828 |
+
}
|
829 |
+
|
830 |
+
return $plugins;
|
831 |
+
}
|
832 |
+
|
833 |
+
/**
|
834 |
+
* Plugins AJAX Process
|
835 |
+
*/
|
836 |
+
public function ajax_plugins() {
|
837 |
+
if ( ! check_ajax_referer( 'aux_setup_nonce', 'wpnonce' ) || empty( $_POST['slug'] ) ) {
|
838 |
+
wp_send_json_error( array( 'error' => 1, 'message' => esc_html__( 'No Slug Found', 'auxin-elements' ) ) );
|
839 |
+
}
|
840 |
+
$json = array();
|
841 |
+
// send back some json we use to hit up TGM
|
842 |
+
$plugins = $this->get_plugins();
|
843 |
+
// what are we doing with this plugin?
|
844 |
+
foreach ( $plugins['activate'] as $slug => $plugin ) {
|
845 |
+
if ( $_POST['slug'] == $slug ) {
|
846 |
+
$json = array(
|
847 |
+
'url' => admin_url( $this->tgmpa_url ),
|
848 |
+
'plugin' => array( $slug ),
|
849 |
+
'tgmpa-page' => $this->tgmpa_menu_slug,
|
850 |
+
'plugin_status' => 'all',
|
851 |
+
'_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
|
852 |
+
'action' => 'tgmpa-bulk-activate',
|
853 |
+
'action2' => - 1,
|
854 |
+
'message' => esc_html__( 'Activating...', 'auxin-elements' ),
|
855 |
+
);
|
856 |
+
break;
|
857 |
+
}
|
858 |
+
}
|
859 |
+
foreach ( $plugins['install'] as $slug => $plugin ) {
|
860 |
+
if ( $_POST['slug'] == $slug ) {
|
861 |
+
$json = array(
|
862 |
+
'url' => admin_url( $this->tgmpa_url ),
|
863 |
+
'plugin' => array( $slug ),
|
864 |
+
'tgmpa-page' => $this->tgmpa_menu_slug,
|
865 |
+
'plugin_status' => 'all',
|
866 |
+
'_wpnonce' => wp_create_nonce( 'bulk-plugins' ),
|
867 |
+
'action' => 'tgmpa-bulk-install',
|
868 |
+
'action2' => - 1,
|
869 |
+
'message' => esc_html__( 'Installing...', 'auxin-elements' ),
|
870 |
+
);
|
871 |
+
break;
|
872 |
+
}
|
873 |
+
}
|
874 |
+
|
875 |
+
if ( $json ) {
|
876 |
+
$json['hash'] = md5( serialize( $json ) ); // used for checking if duplicates happen, move to next plugin
|
877 |
+
wp_send_json( $json );
|
878 |
+
} else {
|
879 |
+
wp_send_json( array( 'done' => 1, 'message' => esc_html__( 'Activated', 'auxin-elements' ) ) );
|
880 |
+
}
|
881 |
+
exit;
|
882 |
+
|
883 |
+
}
|
884 |
+
|
885 |
+
|
886 |
+
/*-----------------------------------------------------------------------------------*/
|
887 |
+
/* Fourth step (Online Demo Importer)
|
888 |
+
/*-----------------------------------------------------------------------------------*/
|
889 |
+
public function setup_importer() {
|
890 |
+
// Ensure that ThickBox is loaded
|
891 |
+
add_thickbox();
|
892 |
+
// Get the available demos list from Averta API
|
893 |
+
$data = $this->parse_json( 'http://averta.net/phlox/wordpress-theme/demo/wp-content/list.json' );
|
894 |
+
?>
|
895 |
+
<div class="aux-demo-importer-step">
|
896 |
+
<div class="aux-section">
|
897 |
+
<h2><?php esc_html_e( 'Demo Importer', 'auxin-elements' ); ?></h2>
|
898 |
+
<p>
|
899 |
+
<?php esc_html_e( 'You can select & import demo content for Phlox theme from the following list. Please click on a demo to start.', 'auxin-elements' ); ?>
|
900 |
+
</p>
|
901 |
+
</div>
|
902 |
+
|
903 |
+
<div class="aux-demo-list">
|
904 |
+
<?php
|
905 |
+
foreach ( $data as $key => $args ) {
|
906 |
+
echo '<div data-demo-id="demo-'.$args['site_id'].'" class="aux-demo-item grid_4">';
|
907 |
+
echo '<img src='.$args['thumbnail'].'>';
|
908 |
+
echo '<h2>' . $args['title'] . '</h2>';
|
909 |
+
|
910 |
+
$plugins = $this->get_plugins( $args['plugins'] );
|
911 |
+
$has_plugin_required = ! empty($args['plugins'] ) && ! empty( $plugins['all'] );
|
912 |
+
?>
|
913 |
+
<div id="demo-<?php echo esc_attr( $args['site_id'] ); ?>" style="display:none;">
|
914 |
+
<div class="aux-modal-item aux-has-required-plugins">
|
915 |
+
<div class="grid_5 no-gutter">
|
916 |
+
<img src="<?php echo esc_url( $args['screen'] ); ?>">
|
917 |
+
</div>
|
918 |
+
<div class="grid_7 no-gutter">
|
919 |
+
<div class="aux-setup-demo-content">
|
920 |
+
<?php if ( $has_plugin_required ) : ?>
|
921 |
+
<div class="first-step">
|
922 |
+
<h2><?php esc_html_e( 'The Following Plugins Are Required To Import.' ); ?></h2>
|
923 |
+
<ul class="aux-wizard-plugins">
|
924 |
+
<?php
|
925 |
+
foreach ( $plugins['all'] as $slug => $plugin ) { ?>
|
926 |
+
<li class="aux-plugin" data-slug="<?php echo esc_attr( $slug ); ?>">
|
927 |
+
<label class="aux-control aux-checkbox">
|
928 |
+
<?php echo esc_html( $plugin['name'] ); ?>
|
929 |
+
<input name="plugin[]" value="<?php echo esc_attr($slug); ?>" type="checkbox" checked>
|
930 |
+
<div class="aux-indicator"></div>
|
931 |
+
</label>
|
932 |
+
<div class="status column-status">
|
933 |
+
<?php
|
934 |
+
$keys = $class = '';
|
935 |
+
if ( isset( $plugins['install'][ $slug ] ) ) {
|
936 |
+
$keys = esc_html__( 'Not Installed', 'auxin-elements' );
|
937 |
+
$class = 'install';
|
938 |
+
}
|
939 |
+
if ( isset( $plugins['activate'][ $slug ] ) ) {
|
940 |
+
$keys = esc_html__( 'Not Activated', 'auxin-elements' );
|
941 |
+
$class = 'activate';
|
942 |
+
}
|
943 |
+
?>
|
944 |
+
<span class="<?php echo $class ?>">
|
945 |
+
<?php echo $keys; ?>
|
946 |
+
</span>
|
947 |
+
<div class="spinner"></div>
|
948 |
+
</div>
|
949 |
+
</li>
|
950 |
+
<?php
|
951 |
+
}
|
952 |
+
?>
|
953 |
+
</ul>
|
954 |
+
</div>
|
955 |
+
<?php endif; ?>
|
956 |
+
<div class="second-step <?php if ( $has_plugin_required ) echo 'hide'; ?>">
|
957 |
+
<h2><?php esc_html_e( 'Import Demo Content of Phlox Theme.' ); ?></h2>
|
958 |
+
|
959 |
+
<form id="aux-import-data-<?php echo esc_attr( $args['site_id'] ); ?>">
|
960 |
+
<div class="complete aux-border is-checked">
|
961 |
+
<label class="aux-control aux-radio">
|
962 |
+
<?php esc_html_e( 'Complete pre-build Website', 'auxin-elements' ); ?>
|
963 |
+
<input type="radio" name="import" value="complete" checked />
|
964 |
+
<div class="aux-indicator"></div>
|
965 |
+
</label>
|
966 |
+
<label class="aux-control aux-checkbox">
|
967 |
+
<?php esc_html_e( 'Import media (images, videos, etc.)', 'auxin-elements' ); ?>
|
968 |
+
<input type="checkbox" name="import-media" checked="checked" />
|
969 |
+
<div class="aux-indicator"></div>
|
970 |
+
</label>
|
971 |
+
</div>
|
972 |
+
<div class="custom aux-border">
|
973 |
+
<label class="aux-control aux-radio">
|
974 |
+
<?php esc_html_e( 'Selected Data Only', 'auxin-elements' ); ?>
|
975 |
+
<input type="radio" name="import" value="custom" />
|
976 |
+
<div class="aux-indicator"></div>
|
977 |
+
</label>
|
978 |
+
<div class="one_half no-gutter">
|
979 |
+
<label class="aux-control aux-checkbox">
|
980 |
+
<?php esc_html_e( 'Posts', 'auxin-elements' ); ?>
|
981 |
+
<input type="checkbox" name="posts" />
|
982 |
+
<div class="aux-indicator"></div>
|
983 |
+
</label>
|
984 |
+
<label class="aux-control aux-checkbox">
|
985 |
+
<?php esc_html_e( 'Medias', 'auxin-elements' ); ?>
|
986 |
+
<input type="checkbox" name="medias" />
|
987 |
+
<div class="aux-indicator"></div>
|
988 |
+
</label>
|
989 |
+
<label class="aux-control aux-checkbox">
|
990 |
+
<?php esc_html_e( 'Widgets', 'auxin-elements' ); ?>
|
991 |
+
<input type="checkbox" name="widgets" />
|
992 |
+
<div class="aux-indicator"></div>
|
993 |
+
</label>
|
994 |
+
</div>
|
995 |
+
<div class="one_half no-gutter">
|
996 |
+
<label class="aux-control aux-checkbox">
|
997 |
+
<?php esc_html_e( 'Menus', 'auxin-elements' ); ?>
|
998 |
+
<input type="checkbox" name="menus" />
|
999 |
+
<div class="aux-indicator"></div>
|
1000 |
+
</label>
|
1001 |
+
<label class="aux-control aux-checkbox">
|
1002 |
+
<?php esc_html_e( 'Theme Options', 'auxin-elements' ); ?>
|
1003 |
+
<input type="checkbox" name="options" />
|
1004 |
+
<div class="aux-indicator"></div>
|
1005 |
+
</label>
|
1006 |
+
</div>
|
1007 |
+
</div>
|
1008 |
+
</form>
|
1009 |
+
</div>
|
1010 |
+
</div>
|
1011 |
+
<div class="aux-setup-demo-actions">
|
1012 |
+
<div class="aux-return-back">
|
1013 |
+
<?php if ( $has_plugin_required ) : ?>
|
1014 |
+
<div class="aux-alert">
|
1015 |
+
<p><?php esc_html_e( 'You need to active all plugins.', 'auxin-elements' ); ?></p>
|
1016 |
+
</div>
|
1017 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
1018 |
+
class="aux-button aux-medium aux-primary button-next"
|
1019 |
+
data-callback="install_plugins"
|
1020 |
+
data-nonce="<?php echo wp_create_nonce( 'aux-import-demo-' . $args['site_id'] ); ?>"
|
1021 |
+
data-import-id="<?php echo esc_attr( $args['site_id'] ); ?>"
|
1022 |
+
><?php esc_html_e( 'Install Plugins', 'auxin-elements' ); ?></a>
|
1023 |
+
<?php else: ?>
|
1024 |
+
<div class="aux-alert" style="display: none;"></div>
|
1025 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
1026 |
+
class="aux-button aux-medium aux-primary button-next"
|
1027 |
+
data-callback="install_demos"
|
1028 |
+
data-nonce="<?php echo wp_create_nonce( 'aux-import-demo-' . $args['site_id'] ); ?>"
|
1029 |
+
data-import-id="<?php echo esc_attr( $args['site_id'] ); ?>"
|
1030 |
+
><?php esc_html_e( 'Install Demo', 'auxin-elements' ); ?></a>
|
1031 |
+
<?php endif; ?>
|
1032 |
+
</div>
|
1033 |
+
<div class="progressbar hide"></div>
|
1034 |
+
</div>
|
1035 |
+
</div>
|
1036 |
+
</div>
|
1037 |
+
</div>
|
1038 |
+
<?php
|
1039 |
+
echo '</div>';
|
1040 |
+
}
|
1041 |
+
?>
|
1042 |
+
</div>
|
1043 |
+
|
1044 |
+
<div class="clear"></div>
|
1045 |
+
|
1046 |
+
<div class="aux-sticky">
|
1047 |
+
|
1048 |
+
<div class="aux-setup-actions step">
|
1049 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>"
|
1050 |
+
class="aux-button aux-left aux-outline button-next"><?php esc_html_e( 'Previous Step', 'auxin-elements' ); ?></a>
|
1051 |
+
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
|
1052 |
+
class="aux-button aux-outline button-next"><?php esc_html_e( 'Next Step', 'auxin-elements' ); ?></a>
|
1053 |
+
<a href="#TB_inline?width=640&height=450&inlineId="
|
1054 |
+
class="aux-button aux-install-demo aux-primary thickbox" style="display:none;"><?php esc_html_e( 'Install Demo', 'auxin-elements' ); ?></a>
|
1055 |
+
</div>
|
1056 |
+
|
1057 |
+
</div>
|
1058 |
+
|
1059 |
+
</div>
|
1060 |
+
|
1061 |
+
<?php
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
/**
|
1065 |
+
* Parse the demos list API
|
1066 |
+
*/
|
1067 |
+
public function parse_json( $url ) {
|
1068 |
+
|
1069 |
+
$key = sanitize_key('auxin_available_demos');
|
1070 |
+
|
1071 |
+
if ( ! get_transient( $key ) ) {
|
1072 |
+
//Get JSON
|
1073 |
+
$request = wp_remote_get( $url );
|
1074 |
+
//If the remote request fails, wp_remote_get() will return a WP_Error
|
1075 |
+
if( is_wp_error( $request ) || ! current_user_can( 'import' ) ) wp_die();
|
1076 |
+
//proceed to retrieving the data
|
1077 |
+
$body = wp_remote_retrieve_body( $request );
|
1078 |
+
//translate the JSON into Array
|
1079 |
+
$data = json_decode( $body, true );
|
1080 |
+
//Add transient
|
1081 |
+
set_transient( $key, $data, 24 * HOUR_IN_SECONDS );
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
return get_transient( $key );
|
1085 |
+
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
|
1089 |
+
/*-----------------------------------------------------------------------------------*/
|
1090 |
+
/* Fifth step (Final message)
|
1091 |
+
/*-----------------------------------------------------------------------------------*/
|
1092 |
+
public function setup_ready() {
|
1093 |
+
|
1094 |
+
update_option( 'aux_setup_complete', time() );
|
1095 |
+
?>
|
1096 |
+
|
1097 |
+
<div class="aux-final-step">
|
1098 |
+
<i class="auxicon-big auxicon-check-mark-circle-outline"></i>
|
1099 |
+
<h2><?php esc_html_e( 'Your Website is Ready!', 'auxin-elements' ); ?></h2>
|
1100 |
+
<p><?php esc_html_e( 'Congratulations! You website has been successfully configured.', 'auxin-elements' ); ?></p>
|
1101 |
+
<div class="aux-group">
|
1102 |
+
<a target="_blank" href="http://support.averta.net/en/e-item/phlox-wordpress-theme/?b=33826,34922"
|
1103 |
+
class="aux-button aux-center aux-outline"><?php esc_html_e( 'Documentaion' , 'auxin-elements' ); ?></a>
|
1104 |
+
<a target="_blank" href="<?php echo get_home_url(); ?>"
|
1105 |
+
class="aux-button aux-center aux-primary"><?php esc_html_e( 'Visit Your Site', 'auxin-elements' ); ?></a>
|
1106 |
+
</div>
|
1107 |
+
|
1108 |
+
<div class="aux-social">
|
1109 |
+
<p><?php esc_html_e( 'If you have any questions read our documentation. also follow us at:', 'auxin-elements' ); ?></p>
|
1110 |
+
<ul>
|
1111 |
+
<li>
|
1112 |
+
<a target="_blank" class="twitter" href="http://www.twitter.com/averta_ltd">
|
1113 |
+
<i class="axicon-twitter"></i>
|
1114 |
+
</a>
|
1115 |
+
</li>
|
1116 |
+
<li>
|
1117 |
+
<a target="_blank" class="facebook" href="http://www.facebook.com/averta">
|
1118 |
+
<i class="axicon-facebook"></i>
|
1119 |
+
</a>
|
1120 |
+
</li>
|
1121 |
+
<li>
|
1122 |
+
<a target="_blank" class="youtube" href="http://www.youtube.com/averta.cast">
|
1123 |
+
<i class="axicon-youtube"></i>
|
1124 |
+
</a>
|
1125 |
+
</li>
|
1126 |
+
<li>
|
1127 |
+
<a target="_blank" class="link" href="http://averta.net/">
|
1128 |
+
<i class="axicon-link"></i>
|
1129 |
+
</a>
|
1130 |
+
</li>
|
1131 |
+
</ul>
|
1132 |
+
</div>
|
1133 |
+
</div>
|
1134 |
+
<?php
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
}
|
includes/define.php
CHANGED
@@ -12,7 +12,7 @@ if( ! defined( 'THEME_NAME' ) ){
|
|
12 |
}
|
13 |
|
14 |
|
15 |
-
define( 'AUXELS_VERSION' , '1.
|
16 |
|
17 |
define( 'AUXELS_SLUG' , 'auxin-elements' );
|
18 |
|
12 |
}
|
13 |
|
14 |
|
15 |
+
define( 'AUXELS_VERSION' , '1.6.0' );
|
16 |
|
17 |
define( 'AUXELS_SLUG' , 'auxin-elements' );
|
18 |
|
includes/elements/button.php
CHANGED
@@ -171,15 +171,34 @@ function auxin_get_button_master_array( $master_array ) {
|
|
171 |
'heading' => __('Icon alignment','auxin-elements' ),
|
172 |
'description' => '',
|
173 |
'param_name' => 'icon_align',
|
174 |
-
'type' => '
|
175 |
'def_value' => 'default',
|
176 |
-
'
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
),
|
184 |
'holder' => '',
|
185 |
'class' => 'icon-align',
|
171 |
'heading' => __('Icon alignment','auxin-elements' ),
|
172 |
'description' => '',
|
173 |
'param_name' => 'icon_align',
|
174 |
+
'type' => 'aux_visual_select',
|
175 |
'def_value' => 'default',
|
176 |
+
'choices' => array(
|
177 |
+
// default template
|
178 |
+
'default' => array(
|
179 |
+
'label' => __('Default' , 'auxin-elements'),
|
180 |
+
'image' => AUXELS_ADMIN_URL . '/assets/images/button.png'
|
181 |
+
),
|
182 |
+
'left' => array(
|
183 |
+
'label' => __('Left' , 'auxin-elements'),
|
184 |
+
'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm'
|
185 |
+
),
|
186 |
+
'right' => array(
|
187 |
+
'label' => __('Right' , 'auxin-elements'),
|
188 |
+
'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button1.webm webm'
|
189 |
+
),
|
190 |
+
'over' => array(
|
191 |
+
'label' => __('Over', 'auxin-elements'),
|
192 |
+
'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm'
|
193 |
+
),
|
194 |
+
'left-animate' => array(
|
195 |
+
'label' => __('Animate from Left', 'auxin-elements'),
|
196 |
+
'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm'
|
197 |
+
),
|
198 |
+
'right-animate' => array(
|
199 |
+
'label' => __('Animate from Righ', 'auxin-elements'),
|
200 |
+
'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm'
|
201 |
+
),
|
202 |
),
|
203 |
'holder' => '',
|
204 |
'class' => 'icon-align',
|
includes/elements/latest-items.php
CHANGED
@@ -4,8 +4,6 @@
|
|
4 |
* Auxin callout widget you can set all the options of this widget here like widget definitation,
|
5 |
* its element on siteorigin page builder, visual composer and under appearance/ widgets
|
6 |
*/
|
7 |
-
// const THEME_NAME = "PHLOX";
|
8 |
-
// TODO: item should change to portfolio
|
9 |
function get_auxin_latest_items_vc( $master_array ) {
|
10 |
|
11 |
$auxin_latest_items_vc = array( // shortcode info here
|
4 |
* Auxin callout widget you can set all the options of this widget here like widget definitation,
|
5 |
* its element on siteorigin page builder, visual composer and under appearance/ widgets
|
6 |
*/
|
|
|
|
|
7 |
function get_auxin_latest_items_vc( $master_array ) {
|
8 |
|
9 |
$auxin_latest_items_vc = array( // shortcode info here
|
includes/elements/recent-posts-timeline.php
CHANGED
@@ -210,7 +210,7 @@ function auxin_get_recent_posts_timeline_master_array( $master_array ) {
|
|
210 |
'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
|
211 |
)
|
212 |
)
|
213 |
-
),
|
214 |
array(
|
215 |
'heading' => __('Order by', 'auxin-elements'),
|
216 |
'description' => '',
|
@@ -468,14 +468,14 @@ function auxin_widget_recent_posts_timeline_callback( $atts, $shortcode_content
|
|
468 |
'custom_el_id' => '',
|
469 |
|
470 |
'template_part_file' => 'theme-parts/entry/post-column',
|
471 |
-
'extra_template_path' => '',
|
472 |
|
473 |
-
'universal_id' => '',
|
474 |
'reset_query' => true,
|
475 |
'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query
|
476 |
'wp_query_args' => array(), // additional wp_query args
|
477 |
'loadmore_type' => '', // 'next' (more button), 'scroll', 'next-prev'
|
478 |
-
'loadmore_per_page' => '',
|
479 |
'base' => 'aux_recent_posts_timeline',
|
480 |
'base_class' => 'aux-widget-recent-posts-timeline aux-column-post-entry'
|
481 |
);
|
@@ -564,7 +564,7 @@ function auxin_widget_recent_posts_timeline_callback( $atts, $shortcode_content
|
|
564 |
|
565 |
if( ! empty( $loadmore_type ) ) {
|
566 |
$item_class .= ' aux-ajax-item';
|
567 |
-
}
|
568 |
|
569 |
// calculate the media width
|
570 |
$media_width = 'center' == $timeline_alignment ? $aux_content_width / 2 : $aux_content_width;
|
@@ -610,28 +610,28 @@ function auxin_widget_recent_posts_timeline_callback( $atts, $shortcode_content
|
|
610 |
$the_format = get_post_format( $post );
|
611 |
|
612 |
// get current post month
|
613 |
-
$post_month =
|
614 |
|
615 |
// add month label on timeline main line
|
616 |
if( $post_month != $previous_post_month ){
|
617 |
-
?><span class="aux-date-label"><?php
|
618 |
}
|
619 |
|
620 |
printf( '<div class="%s post-%s">', esc_attr( $item_class ), esc_attr( $post->ID ) );
|
621 |
include auxin_get_template_file( $template_part_file, '', $extra_template_path );
|
622 |
-
echo '</div>';
|
623 |
|
624 |
-
$previous_post_month = $post_month;
|
625 |
}
|
626 |
|
627 |
if( ! $skip_wrappers ) {
|
628 |
// End tag for aux-ajax-view wrapper & Execute load more functionality
|
629 |
echo '</div>' . auxin_get_load_more_controller( $loadmore_type );
|
630 |
-
|
631 |
} else {
|
632 |
// Get post counter in the query
|
633 |
echo '<span class="aux-post-count hidden">'.$wp_query->post_count.'</span>';
|
634 |
-
}
|
635 |
|
636 |
}
|
637 |
|
210 |
'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
|
211 |
)
|
212 |
)
|
213 |
+
),
|
214 |
array(
|
215 |
'heading' => __('Order by', 'auxin-elements'),
|
216 |
'description' => '',
|
468 |
'custom_el_id' => '',
|
469 |
|
470 |
'template_part_file' => 'theme-parts/entry/post-column',
|
471 |
+
'extra_template_path' => '',
|
472 |
|
473 |
+
'universal_id' => '',
|
474 |
'reset_query' => true,
|
475 |
'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query
|
476 |
'wp_query_args' => array(), // additional wp_query args
|
477 |
'loadmore_type' => '', // 'next' (more button), 'scroll', 'next-prev'
|
478 |
+
'loadmore_per_page' => '',
|
479 |
'base' => 'aux_recent_posts_timeline',
|
480 |
'base_class' => 'aux-widget-recent-posts-timeline aux-column-post-entry'
|
481 |
);
|
564 |
|
565 |
if( ! empty( $loadmore_type ) ) {
|
566 |
$item_class .= ' aux-ajax-item';
|
567 |
+
}
|
568 |
|
569 |
// calculate the media width
|
570 |
$media_width = 'center' == $timeline_alignment ? $aux_content_width / 2 : $aux_content_width;
|
610 |
$the_format = get_post_format( $post );
|
611 |
|
612 |
// get current post month
|
613 |
+
$post_month = get_the_date('m');
|
614 |
|
615 |
// add month label on timeline main line
|
616 |
if( $post_month != $previous_post_month ){
|
617 |
+
?><span class="aux-date-label"><?php the_date('F'); ?></span><?php
|
618 |
}
|
619 |
|
620 |
printf( '<div class="%s post-%s">', esc_attr( $item_class ), esc_attr( $post->ID ) );
|
621 |
include auxin_get_template_file( $template_part_file, '', $extra_template_path );
|
622 |
+
echo '</div>';
|
623 |
|
624 |
+
$previous_post_month = $post_month;
|
625 |
}
|
626 |
|
627 |
if( ! $skip_wrappers ) {
|
628 |
// End tag for aux-ajax-view wrapper & Execute load more functionality
|
629 |
echo '</div>' . auxin_get_load_more_controller( $loadmore_type );
|
630 |
+
|
631 |
} else {
|
632 |
// Get post counter in the query
|
633 |
echo '<span class="aux-post-count hidden">'.$wp_query->post_count.'</span>';
|
634 |
+
}
|
635 |
|
636 |
}
|
637 |
|
includes/elements/testomonial.php
ADDED
@@ -0,0 +1,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+
* @package Auxin
|
7 |
+
* @license LICENSE.txt
|
8 |
+
* @author
|
9 |
+
* @link http://averta.net/phlox/
|
10 |
+
* @copyright (c) 2010-2017
|
11 |
+
*/
|
12 |
+
|
13 |
+
function auxin_get_testomonial_master_array( $master_array ) {
|
14 |
+
|
15 |
+
$master_array['aux_testomonial'] = array(
|
16 |
+
'name' => __('[Phlox] Testomonial ', 'auxin-elements'),
|
17 |
+
'auxin_output_callback' => 'auxin_widget_testomonial_callback',
|
18 |
+
'base' => 'aux_testomonial',
|
19 |
+
'description' => __('Testomonial Element', 'auxin-elements'),
|
20 |
+
'class' => 'aux-widget-testomonial',
|
21 |
+
'show_settings_on_create' => true,
|
22 |
+
'weight' => 1,
|
23 |
+
'is_widget' => true,
|
24 |
+
'is_shortcode' => true,
|
25 |
+
'is_so' => false,
|
26 |
+
'is_vc' => false,
|
27 |
+
'category' => THEME_NAME,
|
28 |
+
'group' => '',
|
29 |
+
'so_api' => false,
|
30 |
+
'admin_enqueue_js' => '',
|
31 |
+
'admin_enqueue_css' => '',
|
32 |
+
'front_enqueue_js' => '',
|
33 |
+
'front_enqueue_css' => '',
|
34 |
+
'icon' => 'auxin-element auxin-testomonial',
|
35 |
+
'custom_markup' => '',
|
36 |
+
'js_view' => '',
|
37 |
+
'html_template' => '',
|
38 |
+
'deprecated' => '',
|
39 |
+
'content_element' => '',
|
40 |
+
'as_parent' => '',
|
41 |
+
'as_child' => '',
|
42 |
+
'params' => array(
|
43 |
+
array(
|
44 |
+
'heading' => __( 'Testomonial Templates','auxin-elements' ),
|
45 |
+
'description' => '',
|
46 |
+
'param_name' => 'template',
|
47 |
+
'type' => 'aux_visual_select',
|
48 |
+
'def_value' => 'default',
|
49 |
+
'holder' => '',
|
50 |
+
'class' => 'template',
|
51 |
+
'admin_label' => false,
|
52 |
+
'dependency' => '',
|
53 |
+
'weight' => '',
|
54 |
+
'group' => '',
|
55 |
+
'edit_field_class' => '',
|
56 |
+
'choices' => array(
|
57 |
+
'default' => array(
|
58 |
+
'label' => __( 'Default Template', 'auxin-elements' ),
|
59 |
+
'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
|
60 |
+
),
|
61 |
+
'def-img' => array(
|
62 |
+
'label' => __( 'Default Template With Image', 'auxin-elements' ),
|
63 |
+
'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
|
64 |
+
),
|
65 |
+
'bordered' => array(
|
66 |
+
'label' => __( 'Bordered On Content', 'auxin-elements' ),
|
67 |
+
'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
|
68 |
+
),
|
69 |
+
'qoute' => array(
|
70 |
+
'label' => __( 'Quotation Mark ln Top of the Content', 'auxin-elements' ),
|
71 |
+
'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
|
72 |
+
),
|
73 |
+
'info-top' => array(
|
74 |
+
'label' => __( 'Show Info on Top of Widget', 'auxin-elements' ),
|
75 |
+
'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
|
76 |
+
),
|
77 |
+
)
|
78 |
+
),
|
79 |
+
array(
|
80 |
+
'heading' => __('Customer Name','auxin-elements'),
|
81 |
+
'description' => __('Customer Name, leave it empty if you don`t need title.', 'auxin-elements'),
|
82 |
+
'param_name' => 'title',
|
83 |
+
'type' => 'textfield',
|
84 |
+
'value' => '',
|
85 |
+
'holder' => 'textfield',
|
86 |
+
'class' => 'title',
|
87 |
+
'admin_label' => true,
|
88 |
+
'dependency' => '',
|
89 |
+
'weight' => '',
|
90 |
+
'group' => '' ,
|
91 |
+
'edit_field_class' => ''
|
92 |
+
),
|
93 |
+
array(
|
94 |
+
'heading' => __('Customer Link','auxin-elements'),
|
95 |
+
'description' => __('Customer Link, leave it empty if you don`t need it', 'auxin-elements'),
|
96 |
+
'param_name' => 'link',
|
97 |
+
'type' => 'textfield',
|
98 |
+
'value' => '',
|
99 |
+
'holder' => 'textfield',
|
100 |
+
'class' => 'title',
|
101 |
+
'admin_label' => true,
|
102 |
+
'dependency' => '',
|
103 |
+
'weight' => '',
|
104 |
+
'group' => '' ,
|
105 |
+
'edit_field_class' => ''
|
106 |
+
),
|
107 |
+
array(
|
108 |
+
'heading' => __('Customer Occupation','auxin-elements'),
|
109 |
+
'description' => __('Customer Occupation, leave it empty if you don`t need it.', 'auxin-elements'),
|
110 |
+
'param_name' => 'subtitle',
|
111 |
+
'type' => 'textfield',
|
112 |
+
'value' => '',
|
113 |
+
'holder' => 'textfield',
|
114 |
+
'class' => 'subtitle',
|
115 |
+
'admin_label' => true,
|
116 |
+
'dependency' => '',
|
117 |
+
'weight' => '',
|
118 |
+
'group' => '' ,
|
119 |
+
'edit_field_class' => ''
|
120 |
+
),
|
121 |
+
array(
|
122 |
+
'heading' => __('Customer Image', 'auxin-elements'),
|
123 |
+
'description' => '',
|
124 |
+
'param_name' => 'customer_img',
|
125 |
+
'type' => 'attach_image',
|
126 |
+
'def_value' => '',
|
127 |
+
'value' => '',
|
128 |
+
'holder' => '',
|
129 |
+
'class' => 'customer-img',
|
130 |
+
'admin_label' => true,
|
131 |
+
'dependency' => array(
|
132 |
+
'element' => 'template',
|
133 |
+
'value' => array('bordered', 'def-img', 'info-top')
|
134 |
+
),
|
135 |
+
'weight' => '',
|
136 |
+
'group' => '',
|
137 |
+
'edit_field_class' => ''
|
138 |
+
),
|
139 |
+
array(
|
140 |
+
'heading' => __('Content','auxin-elements'),
|
141 |
+
'description' => __('Enter a text as a text content.','auxin-elements'),
|
142 |
+
'param_name' => 'content',
|
143 |
+
'type' => 'textarea_html',
|
144 |
+
'value' => '',
|
145 |
+
'def_value' => '',
|
146 |
+
'holder' => 'div',
|
147 |
+
'class' => 'content',
|
148 |
+
'admin_label' => true,
|
149 |
+
'dependency' => '',
|
150 |
+
'weight' => '',
|
151 |
+
'group' => '' ,
|
152 |
+
'edit_field_class' => ''
|
153 |
+
),
|
154 |
+
)
|
155 |
+
);
|
156 |
+
|
157 |
+
return $master_array;
|
158 |
+
}
|
159 |
+
|
160 |
+
add_filter( 'auxin_master_array_shortcodes', 'auxin_get_testomonial_master_array', 10, 1 );
|
161 |
+
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Testomonial Widget Markup
|
165 |
+
*
|
166 |
+
* The front-end output of this element is returned by the following function
|
167 |
+
*
|
168 |
+
* @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
|
169 |
+
* @param string $shortcode_content The shorcode content
|
170 |
+
* @return string The output of element markup
|
171 |
+
*/
|
172 |
+
function auxin_widget_testomonial_callback( $atts, $shortcode_content = null ){
|
173 |
+
|
174 |
+
// Defining default attributes
|
175 |
+
$default_atts = array(
|
176 |
+
|
177 |
+
'template' => 'default',
|
178 |
+
'title' => '',
|
179 |
+
'subtitle' => '',
|
180 |
+
'link' => '',
|
181 |
+
'customer_img' => '',
|
182 |
+
'content' => '',
|
183 |
+
'extra_classes' => '', // custom css class names for this element
|
184 |
+
'custom_el_id' => '', // custom id attribute for this element
|
185 |
+
'base_class' => 'aux-widget-testomonial' // base class name for container
|
186 |
+
|
187 |
+
);
|
188 |
+
|
189 |
+
$result = auxin_get_widget_scafold( $atts, $default_atts );
|
190 |
+
|
191 |
+
extract( $result['parsed_atts'] );
|
192 |
+
|
193 |
+
$image = wp_get_attachment_image( $customer_img, 'thumbnail', "", array( "class" => "img-square" ) );
|
194 |
+
$content = empty( $content ) ? $shortcode_content : $content ;
|
195 |
+
$template = ' aux-testomonial-' . $template ;
|
196 |
+
$main_class = $base_class . $template;
|
197 |
+
|
198 |
+
ob_start();
|
199 |
+
|
200 |
+
// widget header ------------------------------
|
201 |
+
echo $result['widget_header'];
|
202 |
+
?>
|
203 |
+
<div class=" <?php echo esc_attr( $main_class );?> ">
|
204 |
+
<?php if( ! empty( $content ) ) { ?>
|
205 |
+
<div class="aux-testomonial-content">
|
206 |
+
<div class="entry-content">
|
207 |
+
<?php $encoding_flag = defined('ENT_HTML401') ? ENT_HTML401 : ENT_QUOTES; ?>
|
208 |
+
<?php echo do_shortcode( html_entity_decode( $content, $encoding_flag, 'UTF-8') ); ?>
|
209 |
+
</div>
|
210 |
+
</div>
|
211 |
+
<?php } ?>
|
212 |
+
<div class="aux-testomonial-infobox">
|
213 |
+
<?php if ( !empty( $image ) ) { ?>
|
214 |
+
<div class="aux-testomonial-image">
|
215 |
+
<?php echo $image ;?>
|
216 |
+
</div>
|
217 |
+
<?php } ?>
|
218 |
+
<div class="aux-testomonial-info">
|
219 |
+
<?php if( ! empty( $title ) && empty( $link ) ) { ?>
|
220 |
+
<h4 class="col-title"><?php echo $title; ?></h4>
|
221 |
+
<?php } elseif( ! empty( $title ) && ! empty( $link ) ) {?>
|
222 |
+
<h4 class="col-title"><a href="<?php echo esc_url( $link ); ?>">
|
223 |
+
<?php echo $title; ?></a>
|
224 |
+
</h4>
|
225 |
+
<?php } if( ! empty( $subtitle ) ) { ?>
|
226 |
+
<h5 class="col-subtitle"><?php echo $subtitle; ?></h5>
|
227 |
+
<?php } ?>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
|
232 |
+
<?php
|
233 |
+
|
234 |
+
// widget footer ------------------------------
|
235 |
+
echo $result['widget_footer'];
|
236 |
+
return ob_get_clean();
|
237 |
+
|
238 |
+
}
|
includes/general-functions.php
CHANGED
@@ -380,7 +380,7 @@ function auxin_get_big_grid_pattern( $pattern = 'default', $index, $column_media
|
|
380 |
case 0:
|
381 |
case 7:
|
382 |
$return_value = array(
|
383 |
-
'classname' => 'aux-big-grid-6-6 aux-t-
|
384 |
'size' => array( 'width' => 2 * $column_media_width, 'height' => 2 * $column_media_width ),
|
385 |
'image_sizes' => array(
|
386 |
array( 'min' => '' , 'max' => '992px', 'width' => '100vw' ),
|
@@ -414,7 +414,7 @@ function auxin_get_big_grid_pattern( $pattern = 'default', $index, $column_media
|
|
414 |
// small squares
|
415 |
default:
|
416 |
$return_value = array(
|
417 |
-
'classname' => 'aux-big-grid-3-3 aux-t-
|
418 |
'size' => array( 'width' => $column_media_width, 'height' => $column_media_width ),
|
419 |
'image_sizes' => array(
|
420 |
array( 'min' => '', 'max' => '767px', 'width' => '100vw' ),
|
380 |
case 0:
|
381 |
case 7:
|
382 |
$return_value = array(
|
383 |
+
'classname' => 'aux-big-grid-6-6 aux-t-big-grid-4-2 aux-m-big-grid-4-2',
|
384 |
'size' => array( 'width' => 2 * $column_media_width, 'height' => 2 * $column_media_width ),
|
385 |
'image_sizes' => array(
|
386 |
array( 'min' => '' , 'max' => '992px', 'width' => '100vw' ),
|
414 |
// small squares
|
415 |
default:
|
416 |
$return_value = array(
|
417 |
+
'classname' => 'aux-big-grid-3-3 aux-t-big-grid-2-2 aux-m-big-grid--4-2',
|
418 |
'size' => array( 'width' => $column_media_width, 'height' => $column_media_width ),
|
419 |
'image_sizes' => array(
|
420 |
array( 'min' => '', 'max' => '767px', 'width' => '100vw' ),
|
includes/general-hooks.php
CHANGED
@@ -73,8 +73,9 @@ function auxin_add_vc_field_types(){
|
|
73 |
$active_attr = ( $id == esc_attr( $value ) ) ? 'selected' : '';
|
74 |
$data_class = isset( $option_info['css_class'] ) && ! empty( $option_info['css_class'] ) ? 'data-class="'. $option_info['css_class'].'"' : '';
|
75 |
$data_symbol = empty( $data_class ) && isset( $option_info['image'] ) && ! empty( $option_info['image'] ) ? 'data-symbol="'. $option_info['image'].'"' : '';
|
|
|
76 |
$css_classs = 'class="'. ($id) .'"';
|
77 |
-
$output .= sprintf( '<option value="%s" %s %s %s %s>%s</option>', $id,$css_classs, $active_attr, $data_symbol, $data_class, $option_info['label'] );
|
78 |
}
|
79 |
$output .= '</select>';
|
80 |
|
@@ -90,7 +91,7 @@ function auxin_add_vc_field_types(){
|
|
90 |
$att_ids = explode( ',', $value );
|
91 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
92 |
if(!empty($att_ids)) {
|
93 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
94 |
}
|
95 |
}
|
96 |
$output = '';
|
@@ -114,7 +115,7 @@ function auxin_add_vc_field_types(){
|
|
114 |
$att_ids = explode( ',', $value );
|
115 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
116 |
if(!empty($att_ids)) {
|
117 |
-
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>",
|
118 |
}
|
119 |
}
|
120 |
$output = '';
|
@@ -1664,3 +1665,14 @@ if( ! defined( 'WPSEO_VERSION') ){
|
|
1664 |
|
1665 |
add_filter( 'wp_title', 'auxin_wp_title', 10, 3 );
|
1666 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$active_attr = ( $id == esc_attr( $value ) ) ? 'selected' : '';
|
74 |
$data_class = isset( $option_info['css_class'] ) && ! empty( $option_info['css_class'] ) ? 'data-class="'. $option_info['css_class'].'"' : '';
|
75 |
$data_symbol = empty( $data_class ) && isset( $option_info['image'] ) && ! empty( $option_info['image'] ) ? 'data-symbol="'. $option_info['image'].'"' : '';
|
76 |
+
$data_video = ! empty( $option_info['video_src'] ) ? 'data-video-src="'. esc_attr( $option_info['video_src'] ).'"' : '';
|
77 |
$css_classs = 'class="'. ($id) .'"';
|
78 |
+
$output .= sprintf( '<option value="%s" %s %s %s %s %s>%s</option>', $id,$css_classs, $active_attr, $data_symbol, $data_video, $data_class, $option_info['label'] );
|
79 |
}
|
80 |
$output .= '</select>';
|
81 |
|
91 |
$att_ids = explode( ',', $value );
|
92 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
93 |
if(!empty($att_ids)) {
|
94 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
95 |
}
|
96 |
}
|
97 |
$output = '';
|
115 |
$att_ids = explode( ',', $value );
|
116 |
$attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
|
117 |
if(!empty($att_ids)) {
|
118 |
+
printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
|
119 |
}
|
120 |
}
|
121 |
$output = '';
|
1665 |
|
1666 |
add_filter( 'wp_title', 'auxin_wp_title', 10, 3 );
|
1667 |
}
|
1668 |
+
|
1669 |
+
/*-----------------------------------------------------------------------------------*/
|
1670 |
+
/* Make wizard setup ready
|
1671 |
+
/*-----------------------------------------------------------------------------------*/
|
1672 |
+
|
1673 |
+
function auxin_theme_setup_wizard() {
|
1674 |
+
Auxin_Wizard::get_instance();
|
1675 |
+
}
|
1676 |
+
add_action( 'auxin_admin_loaded', 'auxin_theme_setup_wizard' );
|
1677 |
+
|
1678 |
+
/*-----------------------------------------------------------------------------------*/
|
includes/index.php
CHANGED
@@ -29,7 +29,7 @@ if( auxin_is_plugin_active( 'so-widgets-bundle/so-widgets-bundle.php' ) ) {
|
|
29 |
if( defined( 'WPB_VC_VERSION' ) || auxin_is_plugin_active( 'js_composer/js_composer.php' ) ){
|
30 |
|
31 |
}
|
32 |
-
|
33 |
include_once( 'elements/staff.php' );
|
34 |
include_once( 'elements/text.php' );
|
35 |
include_once( 'elements/recent-posts-tiles.php' );
|
29 |
if( defined( 'WPB_VC_VERSION' ) || auxin_is_plugin_active( 'js_composer/js_composer.php' ) ){
|
30 |
|
31 |
}
|
32 |
+
include_once( 'elements/testomonial.php' );
|
33 |
include_once( 'elements/staff.php' );
|
34 |
include_once( 'elements/text.php' );
|
35 |
include_once( 'elements/recent-posts-tiles.php' );
|
public/assets/js/jquery-blockUI.js
ADDED
@@ -0,0 +1,619 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery blockUI plugin
|
3 |
+
* Version 2.70.0-2014.11.23
|
4 |
+
* Requires jQuery v1.7 or later
|
5 |
+
*
|
6 |
+
* Examples at: http://malsup.com/jquery/block/
|
7 |
+
* Copyright (c) 2007-2013 M. Alsup
|
8 |
+
* Dual licensed under the MIT and GPL licenses:
|
9 |
+
* http://www.opensource.org/licenses/mit-license.php
|
10 |
+
* http://www.gnu.org/licenses/gpl.html
|
11 |
+
*
|
12 |
+
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
13 |
+
*/
|
14 |
+
;(function() {
|
15 |
+
/*jshint eqeqeq:false curly:false latedef:false */
|
16 |
+
"use strict";
|
17 |
+
|
18 |
+
function setup($) {
|
19 |
+
$.fn._fadeIn = $.fn.fadeIn;
|
20 |
+
|
21 |
+
var noOp = $.noop || function() {};
|
22 |
+
|
23 |
+
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
|
24 |
+
// confusing userAgent strings on Vista)
|
25 |
+
var msie = /MSIE/.test(navigator.userAgent);
|
26 |
+
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
|
27 |
+
var mode = document.documentMode || 0;
|
28 |
+
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
|
29 |
+
|
30 |
+
// global $ methods for blocking/unblocking the entire page
|
31 |
+
$.blockUI = function(opts) { install(window, opts); };
|
32 |
+
$.unblockUI = function(opts) { remove(window, opts); };
|
33 |
+
|
34 |
+
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
|
35 |
+
$.growlUI = function(title, message, timeout, onClose) {
|
36 |
+
var $m = $('<div class="growlUI"></div>');
|
37 |
+
if (title) $m.append('<h1>'+title+'</h1>');
|
38 |
+
if (message) $m.append('<h2>'+message+'</h2>');
|
39 |
+
if (timeout === undefined) timeout = 3000;
|
40 |
+
|
41 |
+
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
|
42 |
+
var callBlock = function(opts) {
|
43 |
+
opts = opts || {};
|
44 |
+
|
45 |
+
$.blockUI({
|
46 |
+
message: $m,
|
47 |
+
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
|
48 |
+
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
|
49 |
+
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
|
50 |
+
centerY: false,
|
51 |
+
showOverlay: false,
|
52 |
+
onUnblock: onClose,
|
53 |
+
css: $.blockUI.defaults.growlCSS
|
54 |
+
});
|
55 |
+
};
|
56 |
+
|
57 |
+
callBlock();
|
58 |
+
var nonmousedOpacity = $m.css('opacity');
|
59 |
+
$m.mouseover(function() {
|
60 |
+
callBlock({
|
61 |
+
fadeIn: 0,
|
62 |
+
timeout: 30000
|
63 |
+
});
|
64 |
+
|
65 |
+
var displayBlock = $('.blockMsg');
|
66 |
+
displayBlock.stop(); // cancel fadeout if it has started
|
67 |
+
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
|
68 |
+
}).mouseout(function() {
|
69 |
+
$('.blockMsg').fadeOut(1000);
|
70 |
+
});
|
71 |
+
// End konapun additions
|
72 |
+
};
|
73 |
+
|
74 |
+
// plugin method for blocking element content
|
75 |
+
$.fn.block = function(opts) {
|
76 |
+
if ( this[0] === window ) {
|
77 |
+
$.blockUI( opts );
|
78 |
+
return this;
|
79 |
+
}
|
80 |
+
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
|
81 |
+
this.each(function() {
|
82 |
+
var $el = $(this);
|
83 |
+
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
|
84 |
+
return;
|
85 |
+
$el.unblock({ fadeOut: 0 });
|
86 |
+
});
|
87 |
+
|
88 |
+
return this.each(function() {
|
89 |
+
if ($.css(this,'position') == 'static') {
|
90 |
+
this.style.position = 'relative';
|
91 |
+
$(this).data('blockUI.static', true);
|
92 |
+
}
|
93 |
+
this.style.zoom = 1; // force 'hasLayout' in ie
|
94 |
+
install(this, opts);
|
95 |
+
});
|
96 |
+
};
|
97 |
+
|
98 |
+
// plugin method for unblocking element content
|
99 |
+
$.fn.unblock = function(opts) {
|
100 |
+
if ( this[0] === window ) {
|
101 |
+
$.unblockUI( opts );
|
102 |
+
return this;
|
103 |
+
}
|
104 |
+
return this.each(function() {
|
105 |
+
remove(this, opts);
|
106 |
+
});
|
107 |
+
};
|
108 |
+
|
109 |
+
$.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
|
110 |
+
|
111 |
+
// override these in your code to change the default behavior and style
|
112 |
+
$.blockUI.defaults = {
|
113 |
+
// message displayed when blocking (use null for no message)
|
114 |
+
message: '<h1>Please wait...</h1>',
|
115 |
+
|
116 |
+
title: null, // title string; only used when theme == true
|
117 |
+
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
|
118 |
+
|
119 |
+
theme: false, // set to true to use with jQuery UI themes
|
120 |
+
|
121 |
+
// styles for the message when blocking; if you wish to disable
|
122 |
+
// these and use an external stylesheet then do this in your code:
|
123 |
+
// $.blockUI.defaults.css = {};
|
124 |
+
css: {
|
125 |
+
padding: 0,
|
126 |
+
margin: 0,
|
127 |
+
width: '30%',
|
128 |
+
top: '40%',
|
129 |
+
left: '35%',
|
130 |
+
textAlign: 'center',
|
131 |
+
color: '#000',
|
132 |
+
border: '3px solid #aaa',
|
133 |
+
backgroundColor:'#fff',
|
134 |
+
cursor: 'wait'
|
135 |
+
},
|
136 |
+
|
137 |
+
// minimal style set used when themes are used
|
138 |
+
themedCSS: {
|
139 |
+
width: '30%',
|
140 |
+
top: '40%',
|
141 |
+
left: '35%'
|
142 |
+
},
|
143 |
+
|
144 |
+
// styles for the overlay
|
145 |
+
overlayCSS: {
|
146 |
+
backgroundColor: '#000',
|
147 |
+
opacity: 0.6,
|
148 |
+
cursor: 'wait'
|
149 |
+
},
|
150 |
+
|
151 |
+
// style to replace wait cursor before unblocking to correct issue
|
152 |
+
// of lingering wait cursor
|
153 |
+
cursorReset: 'default',
|
154 |
+
|
155 |
+
// styles applied when using $.growlUI
|
156 |
+
growlCSS: {
|
157 |
+
width: '350px',
|
158 |
+
top: '10px',
|
159 |
+
left: '',
|
160 |
+
right: '10px',
|
161 |
+
border: 'none',
|
162 |
+
padding: '5px',
|
163 |
+
opacity: 0.6,
|
164 |
+
cursor: 'default',
|
165 |
+
color: '#fff',
|
166 |
+
backgroundColor: '#000',
|
167 |
+
'-webkit-border-radius':'10px',
|
168 |
+
'-moz-border-radius': '10px',
|
169 |
+
'border-radius': '10px'
|
170 |
+
},
|
171 |
+
|
172 |
+
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
|
173 |
+
// (hat tip to Jorge H. N. de Vasconcelos)
|
174 |
+
/*jshint scripturl:true */
|
175 |
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
|
176 |
+
|
177 |
+
// force usage of iframe in non-IE browsers (handy for blocking applets)
|
178 |
+
forceIframe: false,
|
179 |
+
|
180 |
+
// z-index for the blocking overlay
|
181 |
+
baseZ: 1000,
|
182 |
+
|
183 |
+
// set these to true to have the message automatically centered
|
184 |
+
centerX: true, // <-- only effects element blocking (page block controlled via css above)
|
185 |
+
centerY: true,
|
186 |
+
|
187 |
+
// allow body element to be stetched in ie6; this makes blocking look better
|
188 |
+
// on "short" pages. disable if you wish to prevent changes to the body height
|
189 |
+
allowBodyStretch: true,
|
190 |
+
|
191 |
+
// enable if you want key and mouse events to be disabled for content that is blocked
|
192 |
+
bindEvents: true,
|
193 |
+
|
194 |
+
// be default blockUI will supress tab navigation from leaving blocking content
|
195 |
+
// (if bindEvents is true)
|
196 |
+
constrainTabKey: true,
|
197 |
+
|
198 |
+
// fadeIn time in millis; set to 0 to disable fadeIn on block
|
199 |
+
fadeIn: 200,
|
200 |
+
|
201 |
+
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
|
202 |
+
fadeOut: 400,
|
203 |
+
|
204 |
+
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
|
205 |
+
timeout: 0,
|
206 |
+
|
207 |
+
// disable if you don't want to show the overlay
|
208 |
+
showOverlay: true,
|
209 |
+
|
210 |
+
// if true, focus will be placed in the first available input field when
|
211 |
+
// page blocking
|
212 |
+
focusInput: true,
|
213 |
+
|
214 |
+
// elements that can receive focus
|
215 |
+
focusableElements: ':input:enabled:visible',
|
216 |
+
|
217 |
+
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
|
218 |
+
// no longer needed in 2012
|
219 |
+
// applyPlatformOpacityRules: true,
|
220 |
+
|
221 |
+
// callback method invoked when fadeIn has completed and blocking message is visible
|
222 |
+
onBlock: null,
|
223 |
+
|
224 |
+
// callback method invoked when unblocking has completed; the callback is
|
225 |
+
// passed the element that has been unblocked (which is the window object for page
|
226 |
+
// blocks) and the options that were passed to the unblock call:
|
227 |
+
// onUnblock(element, options)
|
228 |
+
onUnblock: null,
|
229 |
+
|
230 |
+
// callback method invoked when the overlay area is clicked.
|
231 |
+
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
|
232 |
+
onOverlayClick: null,
|
233 |
+
|
234 |
+
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
|
235 |
+
quirksmodeOffsetHack: 4,
|
236 |
+
|
237 |
+
// class name of the message block
|
238 |
+
blockMsgClass: 'blockMsg',
|
239 |
+
|
240 |
+
// if it is already blocked, then ignore it (don't unblock and reblock)
|
241 |
+
ignoreIfBlocked: false
|
242 |
+
};
|
243 |
+
|
244 |
+
// private data and functions follow...
|
245 |
+
|
246 |
+
var pageBlock = null;
|
247 |
+
var pageBlockEls = [];
|
248 |
+
|
249 |
+
function install(el, opts) {
|
250 |
+
var css, themedCSS;
|
251 |
+
var full = (el == window);
|
252 |
+
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
|
253 |
+
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
254 |
+
|
255 |
+
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
|
256 |
+
return;
|
257 |
+
|
258 |
+
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
|
259 |
+
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
|
260 |
+
if (opts.onOverlayClick)
|
261 |
+
opts.overlayCSS.cursor = 'pointer';
|
262 |
+
|
263 |
+
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
|
264 |
+
msg = msg === undefined ? opts.message : msg;
|
265 |
+
|
266 |
+
// remove the current block (if there is one)
|
267 |
+
if (full && pageBlock)
|
268 |
+
remove(window, {fadeOut:0});
|
269 |
+
|
270 |
+
// if an existing element is being used as the blocking content then we capture
|
271 |
+
// its current place in the DOM (and current display style) so we can restore
|
272 |
+
// it when we unblock
|
273 |
+
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
|
274 |
+
var node = msg.jquery ? msg[0] : msg;
|
275 |
+
var data = {};
|
276 |
+
$(el).data('blockUI.history', data);
|
277 |
+
data.el = node;
|
278 |
+
data.parent = node.parentNode;
|
279 |
+
data.display = node.style.display;
|
280 |
+
data.position = node.style.position;
|
281 |
+
if (data.parent)
|
282 |
+
data.parent.removeChild(node);
|
283 |
+
}
|
284 |
+
|
285 |
+
$(el).data('blockUI.onUnblock', opts.onUnblock);
|
286 |
+
var z = opts.baseZ;
|
287 |
+
|
288 |
+
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
|
289 |
+
// layer1 is the iframe layer which is used to supress bleed through of underlying content
|
290 |
+
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
|
291 |
+
// layer3 is the message content that is displayed while blocking
|
292 |
+
var lyr1, lyr2, lyr3, s;
|
293 |
+
if (msie || opts.forceIframe)
|
294 |
+
lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
|
295 |
+
else
|
296 |
+
lyr1 = $('<div class="blockUI" style="display:none"></div>');
|
297 |
+
|
298 |
+
if (opts.theme)
|
299 |
+
lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
|
300 |
+
else
|
301 |
+
lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
|
302 |
+
|
303 |
+
if (opts.theme && full) {
|
304 |
+
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
|
305 |
+
if ( opts.title ) {
|
306 |
+
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
307 |
+
}
|
308 |
+
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
309 |
+
s += '</div>';
|
310 |
+
}
|
311 |
+
else if (opts.theme) {
|
312 |
+
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
|
313 |
+
if ( opts.title ) {
|
314 |
+
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
|
315 |
+
}
|
316 |
+
s += '<div class="ui-widget-content ui-dialog-content"></div>';
|
317 |
+
s += '</div>';
|
318 |
+
}
|
319 |
+
else if (full) {
|
320 |
+
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
|
321 |
+
}
|
322 |
+
else {
|
323 |
+
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
|
324 |
+
}
|
325 |
+
lyr3 = $(s);
|
326 |
+
|
327 |
+
// if we have a message, style it
|
328 |
+
if (msg) {
|
329 |
+
if (opts.theme) {
|
330 |
+
lyr3.css(themedCSS);
|
331 |
+
lyr3.addClass('ui-widget-content');
|
332 |
+
}
|
333 |
+
else
|
334 |
+
lyr3.css(css);
|
335 |
+
}
|
336 |
+
|
337 |
+
// style the overlay
|
338 |
+
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
|
339 |
+
lyr2.css(opts.overlayCSS);
|
340 |
+
lyr2.css('position', full ? 'fixed' : 'absolute');
|
341 |
+
|
342 |
+
// make iframe layer transparent in IE
|
343 |
+
if (msie || opts.forceIframe)
|
344 |
+
lyr1.css('opacity',0.0);
|
345 |
+
|
346 |
+
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
|
347 |
+
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
|
348 |
+
$.each(layers, function() {
|
349 |
+
this.appendTo($par);
|
350 |
+
});
|
351 |
+
|
352 |
+
if (opts.theme && opts.draggable && $.fn.draggable) {
|
353 |
+
lyr3.draggable({
|
354 |
+
handle: '.ui-dialog-titlebar',
|
355 |
+
cancel: 'li'
|
356 |
+
});
|
357 |
+
}
|
358 |
+
|
359 |
+
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
|
360 |
+
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
|
361 |
+
if (ie6 || expr) {
|
362 |
+
// give body 100% height
|
363 |
+
if (full && opts.allowBodyStretch && $.support.boxModel)
|
364 |
+
$('html,body').css('height','100%');
|
365 |
+
|
366 |
+
// fix ie6 issue when blocked element has a border width
|
367 |
+
if ((ie6 || !$.support.boxModel) && !full) {
|
368 |
+
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
|
369 |
+
var fixT = t ? '(0 - '+t+')' : 0;
|
370 |
+
var fixL = l ? '(0 - '+l+')' : 0;
|
371 |
+
}
|
372 |
+
|
373 |
+
// simulate fixed position
|
374 |
+
$.each(layers, function(i,o) {
|
375 |
+
var s = o[0].style;
|
376 |
+
s.position = 'absolute';
|
377 |
+
if (i < 2) {
|
378 |
+
if (full)
|
379 |
+
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
|
380 |
+
else
|
381 |
+
s.setExpression('height','this.parentNode.offsetHeight + "px"');
|
382 |
+
if (full)
|
383 |
+
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
|
384 |
+
else
|
385 |
+
s.setExpression('width','this.parentNode.offsetWidth + "px"');
|
386 |
+
if (fixL) s.setExpression('left', fixL);
|
387 |
+
if (fixT) s.setExpression('top', fixT);
|
388 |
+
}
|
389 |
+
else if (opts.centerY) {
|
390 |
+
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
|
391 |
+
s.marginTop = 0;
|
392 |
+
}
|
393 |
+
else if (!opts.centerY && full) {
|
394 |
+
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
|
395 |
+
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
|
396 |
+
s.setExpression('top',expression);
|
397 |
+
}
|
398 |
+
});
|
399 |
+
}
|
400 |
+
|
401 |
+
// show the message
|
402 |
+
if (msg) {
|
403 |
+
if (opts.theme)
|
404 |
+
lyr3.find('.ui-widget-content').append(msg);
|
405 |
+
else
|
406 |
+
lyr3.append(msg);
|
407 |
+
if (msg.jquery || msg.nodeType)
|
408 |
+
$(msg).show();
|
409 |
+
}
|
410 |
+
|
411 |
+
if ((msie || opts.forceIframe) && opts.showOverlay)
|
412 |
+
lyr1.show(); // opacity is zero
|
413 |
+
if (opts.fadeIn) {
|
414 |
+
var cb = opts.onBlock ? opts.onBlock : noOp;
|
415 |
+
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
|
416 |
+
var cb2 = msg ? cb : noOp;
|
417 |
+
if (opts.showOverlay)
|
418 |
+
lyr2._fadeIn(opts.fadeIn, cb1);
|
419 |
+
if (msg)
|
420 |
+
lyr3._fadeIn(opts.fadeIn, cb2);
|
421 |
+
}
|
422 |
+
else {
|
423 |
+
if (opts.showOverlay)
|
424 |
+
lyr2.show();
|
425 |
+
if (msg)
|
426 |
+
lyr3.show();
|
427 |
+
if (opts.onBlock)
|
428 |
+
opts.onBlock.bind(lyr3)();
|
429 |
+
}
|
430 |
+
|
431 |
+
// bind key and mouse events
|
432 |
+
bind(1, el, opts);
|
433 |
+
|
434 |
+
if (full) {
|
435 |
+
pageBlock = lyr3[0];
|
436 |
+
pageBlockEls = $(opts.focusableElements,pageBlock);
|
437 |
+
if (opts.focusInput)
|
438 |
+
setTimeout(focus, 20);
|
439 |
+
}
|
440 |
+
else
|
441 |
+
center(lyr3[0], opts.centerX, opts.centerY);
|
442 |
+
|
443 |
+
if (opts.timeout) {
|
444 |
+
// auto-unblock
|
445 |
+
var to = setTimeout(function() {
|
446 |
+
if (full)
|
447 |
+
$.unblockUI(opts);
|
448 |
+
else
|
449 |
+
$(el).unblock(opts);
|
450 |
+
}, opts.timeout);
|
451 |
+
$(el).data('blockUI.timeout', to);
|
452 |
+
}
|
453 |
+
}
|
454 |
+
|
455 |
+
// remove the block
|
456 |
+
function remove(el, opts) {
|
457 |
+
var count;
|
458 |
+
var full = (el == window);
|
459 |
+
var $el = $(el);
|
460 |
+
var data = $el.data('blockUI.history');
|
461 |
+
var to = $el.data('blockUI.timeout');
|
462 |
+
if (to) {
|
463 |
+
clearTimeout(to);
|
464 |
+
$el.removeData('blockUI.timeout');
|
465 |
+
}
|
466 |
+
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
467 |
+
bind(0, el, opts); // unbind events
|
468 |
+
|
469 |
+
if (opts.onUnblock === null) {
|
470 |
+
opts.onUnblock = $el.data('blockUI.onUnblock');
|
471 |
+
$el.removeData('blockUI.onUnblock');
|
472 |
+
}
|
473 |
+
|
474 |
+
var els;
|
475 |
+
if (full) // crazy selector to handle odd field errors in ie6/7
|
476 |
+
els = $(document.body).children().filter('.blockUI').add('body > .blockUI');
|
477 |
+
else
|
478 |
+
els = $el.find('>.blockUI');
|
479 |
+
|
480 |
+
// fix cursor issue
|
481 |
+
if ( opts.cursorReset ) {
|
482 |
+
if ( els.length > 1 )
|
483 |
+
els[1].style.cursor = opts.cursorReset;
|
484 |
+
if ( els.length > 2 )
|
485 |
+
els[2].style.cursor = opts.cursorReset;
|
486 |
+
}
|
487 |
+
|
488 |
+
if (full)
|
489 |
+
pageBlock = pageBlockEls = null;
|
490 |
+
|
491 |
+
if (opts.fadeOut) {
|
492 |
+
count = els.length;
|
493 |
+
els.stop().fadeOut(opts.fadeOut, function() {
|
494 |
+
if ( --count === 0)
|
495 |
+
reset(els,data,opts,el);
|
496 |
+
});
|
497 |
+
}
|
498 |
+
else
|
499 |
+
reset(els, data, opts, el);
|
500 |
+
}
|
501 |
+
|
502 |
+
// move blocking element back into the DOM where it started
|
503 |
+
function reset(els,data,opts,el) {
|
504 |
+
var $el = $(el);
|
505 |
+
if ( $el.data('blockUI.isBlocked') )
|
506 |
+
return;
|
507 |
+
|
508 |
+
els.each(function(i,o) {
|
509 |
+
// remove via DOM calls so we don't lose event handlers
|
510 |
+
if (this.parentNode)
|
511 |
+
this.parentNode.removeChild(this);
|
512 |
+
});
|
513 |
+
|
514 |
+
if (data && data.el) {
|
515 |
+
data.el.style.display = data.display;
|
516 |
+
data.el.style.position = data.position;
|
517 |
+
data.el.style.cursor = 'default'; // #59
|
518 |
+
if (data.parent)
|
519 |
+
data.parent.appendChild(data.el);
|
520 |
+
$el.removeData('blockUI.history');
|
521 |
+
}
|
522 |
+
|
523 |
+
if ($el.data('blockUI.static')) {
|
524 |
+
$el.css('position', 'static'); // #22
|
525 |
+
}
|
526 |
+
|
527 |
+
if (typeof opts.onUnblock == 'function')
|
528 |
+
opts.onUnblock(el,opts);
|
529 |
+
|
530 |
+
// fix issue in Safari 6 where block artifacts remain until reflow
|
531 |
+
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
|
532 |
+
body.width(w-1).width(w);
|
533 |
+
body[0].style.width = cssW;
|
534 |
+
}
|
535 |
+
|
536 |
+
// bind/unbind the handler
|
537 |
+
function bind(b, el, opts) {
|
538 |
+
var full = el == window, $el = $(el);
|
539 |
+
|
540 |
+
// don't bother unbinding if there is nothing to unbind
|
541 |
+
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
|
542 |
+
return;
|
543 |
+
|
544 |
+
$el.data('blockUI.isBlocked', b);
|
545 |
+
|
546 |
+
// don't bind events when overlay is not in use or if bindEvents is false
|
547 |
+
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
|
548 |
+
return;
|
549 |
+
|
550 |
+
// bind anchors and inputs for mouse and key events
|
551 |
+
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
|
552 |
+
if (b)
|
553 |
+
$(document).bind(events, opts, handler);
|
554 |
+
else
|
555 |
+
$(document).unbind(events, handler);
|
556 |
+
|
557 |
+
// former impl...
|
558 |
+
// var $e = $('a,:input');
|
559 |
+
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
|
560 |
+
}
|
561 |
+
|
562 |
+
// event handler to suppress keyboard/mouse events when blocking
|
563 |
+
function handler(e) {
|
564 |
+
// allow tab navigation (conditionally)
|
565 |
+
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
|
566 |
+
if (pageBlock && e.data.constrainTabKey) {
|
567 |
+
var els = pageBlockEls;
|
568 |
+
var fwd = !e.shiftKey && e.target === els[els.length-1];
|
569 |
+
var back = e.shiftKey && e.target === els[0];
|
570 |
+
if (fwd || back) {
|
571 |
+
setTimeout(function(){focus(back);},10);
|
572 |
+
return false;
|
573 |
+
}
|
574 |
+
}
|
575 |
+
}
|
576 |
+
var opts = e.data;
|
577 |
+
var target = $(e.target);
|
578 |
+
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
|
579 |
+
opts.onOverlayClick(e);
|
580 |
+
|
581 |
+
// allow events within the message content
|
582 |
+
if (target.parents('div.' + opts.blockMsgClass).length > 0)
|
583 |
+
return true;
|
584 |
+
|
585 |
+
// allow events for content that is not being blocked
|
586 |
+
return target.parents().children().filter('div.blockUI').length === 0;
|
587 |
+
}
|
588 |
+
|
589 |
+
function focus(back) {
|
590 |
+
if (!pageBlockEls)
|
591 |
+
return;
|
592 |
+
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
|
593 |
+
if (e)
|
594 |
+
e.focus();
|
595 |
+
}
|
596 |
+
|
597 |
+
function center(el, x, y) {
|
598 |
+
var p = el.parentNode, s = el.style;
|
599 |
+
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
|
600 |
+
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
|
601 |
+
if (x) s.left = l > 0 ? (l+'px') : '0';
|
602 |
+
if (y) s.top = t > 0 ? (t+'px') : '0';
|
603 |
+
}
|
604 |
+
|
605 |
+
function sz(el, p) {
|
606 |
+
return parseInt($.css(el,p),10)||0;
|
607 |
+
}
|
608 |
+
|
609 |
+
}
|
610 |
+
|
611 |
+
|
612 |
+
/*global define:true */
|
613 |
+
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
|
614 |
+
define(['jquery'], setup);
|
615 |
+
} else {
|
616 |
+
setup(jQuery);
|
617 |
+
}
|
618 |
+
|
619 |
+
})();
|
public/assets/js/wiz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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jQuery Line Progressbar
|
3 |
+
*/
|
4 |
+
(function($){
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
$.fn.Progressbar = function(custom){
|
8 |
+
|
9 |
+
var options = $.extend({
|
10 |
+
percentage : null,
|
11 |
+
ShowProgressCount : true,
|
12 |
+
duration : 1000,
|
13 |
+
backgroundColor : '',
|
14 |
+
processText : aux_setup_params.progress_text
|
15 |
+
}, custom);
|
16 |
+
|
17 |
+
return this.each(function(index, el) {
|
18 |
+
// Markup
|
19 |
+
$(el).html('<div class="proggress"></div><div class="percentCount"></div>');
|
20 |
+
|
21 |
+
var progressFill = $(el).find('.proggress');
|
22 |
+
var progressBar= $(el).find('.progressbar');
|
23 |
+
|
24 |
+
// Progressing
|
25 |
+
progressFill.animate(
|
26 |
+
{
|
27 |
+
width: options.percentage + "%"
|
28 |
+
},
|
29 |
+
{
|
30 |
+
step: function(x) {
|
31 |
+
if(options.ShowProgressCount){
|
32 |
+
$(el).find(".percentCount").text( options.processText + ' ' + Math.round(x) + "%" );
|
33 |
+
}
|
34 |
+
},
|
35 |
+
duration: options.duration
|
36 |
+
}
|
37 |
+
);
|
38 |
+
});
|
39 |
+
};
|
40 |
+
})(jQuery);
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* AuxWizard functionality
|
45 |
+
*/
|
46 |
+
(function( $ ){
|
47 |
+
$.fn.AuxWizard = function( element ) {
|
48 |
+
// callbacks from form button clicks.
|
49 |
+
var callbacks = {
|
50 |
+
install_plugins: function(btn){
|
51 |
+
var plugins = new pluginManager();
|
52 |
+
plugins.init(btn);
|
53 |
+
},
|
54 |
+
install_demos: function(btn){
|
55 |
+
var content = new demoManager();
|
56 |
+
content.init(btn);
|
57 |
+
}
|
58 |
+
};
|
59 |
+
|
60 |
+
function window_loaded(){
|
61 |
+
// init button clicks:
|
62 |
+
$('.button-next').click( function( e ) {
|
63 |
+
if($(this).data('callback') && typeof callbacks[$(this).data('callback')] != 'undefined'){
|
64 |
+
// we have to process a callback before continue with form submission
|
65 |
+
callbacks[$(this).data('callback')](this);
|
66 |
+
return false;
|
67 |
+
}else{
|
68 |
+
loading_content();
|
69 |
+
return true;
|
70 |
+
}
|
71 |
+
});
|
72 |
+
|
73 |
+
// init plugins border effect
|
74 |
+
$('.aux-wizard-plugins input[name="plugin[]"]').each(function() {
|
75 |
+
if($(this).is(':checked')) {
|
76 |
+
$(this).closest('th').addClass('is-checked');
|
77 |
+
} else {
|
78 |
+
$(this).closest('th').removeClass('is-checked');
|
79 |
+
}
|
80 |
+
$(this).click(function() {
|
81 |
+
if($(this).is(':checked')) {
|
82 |
+
$(this).closest('th').addClass('is-checked');
|
83 |
+
} else {
|
84 |
+
$(this).closest('th').removeClass('is-checked');
|
85 |
+
}
|
86 |
+
});
|
87 |
+
});
|
88 |
+
|
89 |
+
// Install plugins button display depends on user's checkbox selection
|
90 |
+
$('.aux-plugins-step input[type=checkbox]').change(function(){
|
91 |
+
if ($('.aux-wizard-plugins input[name="plugin[]"]').filter(':checked').length > 0) {
|
92 |
+
$('.install-plugins').removeClass('disabled');
|
93 |
+
} else {
|
94 |
+
$('.install-plugins').addClass('disabled');
|
95 |
+
}
|
96 |
+
});
|
97 |
+
|
98 |
+
// Install demos button display depends on user's checkbox selection
|
99 |
+
$('.aux-setup-demo-content input[type=checkbox]').change(function () {
|
100 |
+
if ($('#TB_ajaxContent').find('input[type=checkbox]').filter(':checked').length > 0) {
|
101 |
+
$('#TB_ajaxContent').find('.button-next').data('callback', 'install_demos').attr('data-callback', 'install_demos').text(aux_setup_params.makedemo_text);
|
102 |
+
} else {
|
103 |
+
$('#TB_ajaxContent').find('.button-next').text(aux_setup_params.nextstep_text).data('callback', null).removeAttr('data-callback');
|
104 |
+
}
|
105 |
+
});
|
106 |
+
|
107 |
+
// init plugins select all border effect
|
108 |
+
$('#cb-select-all').click(function(e) {
|
109 |
+
if($(this).is(':checked')) {
|
110 |
+
$('.aux-wizard-plugins .check-column').addClass('is-checked');
|
111 |
+
} else {
|
112 |
+
$('.aux-wizard-plugins .check-column').removeClass('is-checked');
|
113 |
+
}
|
114 |
+
});
|
115 |
+
|
116 |
+
// init demo manager step
|
117 |
+
$('.aux-demo-item').click(function() {
|
118 |
+
$('.aux-demo-item').find('.is-active').removeClass('is-active');
|
119 |
+
$(this).find('img').addClass('is-active');
|
120 |
+
$('.aux-install-demo').attr("href", "#TB_inline?width=640&height=450&inlineId=" + $(this).data('demo-id') ).fadeIn();
|
121 |
+
});
|
122 |
+
|
123 |
+
// init plugins select all border effect
|
124 |
+
$('.aux-radio').click(function() {
|
125 |
+
$(this).closest('form').find('.aux-border').removeClass('is-checked');
|
126 |
+
$(this).parent('.aux-border').addClass('is-checked');
|
127 |
+
});
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
function loading_content(){
|
132 |
+
$('.aux-setup-content').block({
|
133 |
+
message: null,
|
134 |
+
overlayCSS: {
|
135 |
+
background: '#ffffff',
|
136 |
+
opacity: 0.6
|
137 |
+
}
|
138 |
+
});
|
139 |
+
}
|
140 |
+
|
141 |
+
function pluginManager(){
|
142 |
+
|
143 |
+
var parentElement;
|
144 |
+
var selectedPlugins;
|
145 |
+
var complete;
|
146 |
+
var items_completed = 0;
|
147 |
+
var current_item = '';
|
148 |
+
var $current_node;
|
149 |
+
var current_item_hash = '';
|
150 |
+
|
151 |
+
function ajax_callback(response){
|
152 |
+
if(typeof response == 'object' && typeof response.message != 'undefined'){
|
153 |
+
$current_node.find('.column-status span').text(response.message);
|
154 |
+
if(typeof response.url != 'undefined'){
|
155 |
+
// we have an ajax url action to perform.
|
156 |
+
if(response.hash == current_item_hash){
|
157 |
+
$current_node.find('.column-status span').text("failed");
|
158 |
+
find_next();
|
159 |
+
}else {
|
160 |
+
current_item_hash = response.hash;
|
161 |
+
jQuery.post(response.url, response, function(response2) {
|
162 |
+
process_current();
|
163 |
+
$current_node.find('.column-status span').text( response.message );
|
164 |
+
}).fail(ajax_callback);
|
165 |
+
}
|
166 |
+
|
167 |
+
}else if(typeof response.done != 'undefined'){
|
168 |
+
// finished processing this plugin, move onto next
|
169 |
+
$current_node.addClass('aux-success').find('input').prop('checked', false);
|
170 |
+
find_next();
|
171 |
+
}else{
|
172 |
+
// error processing this plugin
|
173 |
+
find_next();
|
174 |
+
}
|
175 |
+
}else{
|
176 |
+
// error - try again with next plugin
|
177 |
+
$current_node.addClass('aux-error').find('.column-status span').text("Ajax Error!");
|
178 |
+
find_next();
|
179 |
+
}
|
180 |
+
}
|
181 |
+
function process_current(){
|
182 |
+
if(current_item){
|
183 |
+
var getPlugins = $(parentElement).find('.aux-wizard-plugins input[name="plugin[]"]:checked').map(function(){
|
184 |
+
return $(this).val();
|
185 |
+
}).get();
|
186 |
+
// query our ajax handler to get the ajax to send to TGM
|
187 |
+
// if we don't get a reply we can assume everything worked and continue onto the next one.
|
188 |
+
jQuery.post(aux_setup_params.ajaxurl, {
|
189 |
+
action: 'aux_setup_plugins',
|
190 |
+
wpnonce: aux_setup_params.wpnonce,
|
191 |
+
slug: current_item,
|
192 |
+
plugins: getPlugins,
|
193 |
+
}, ajax_callback).fail(ajax_callback);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
function find_next(){
|
197 |
+
var do_next = false;
|
198 |
+
if($current_node){
|
199 |
+
if(!$current_node.data('done_item')){
|
200 |
+
items_completed++;
|
201 |
+
$current_node.data('done_item',1);
|
202 |
+
}
|
203 |
+
$current_node.find('.spinner').css('visibility','hidden');
|
204 |
+
}
|
205 |
+
var $list = $(parentElement).find('.aux-plugin');
|
206 |
+
$list.each(function(){
|
207 |
+
if(current_item == '' || do_next){
|
208 |
+
if( $(this).find('input[name="plugin[]"]').is(":checked") ) {
|
209 |
+
$(this).addClass('work-in-progress');
|
210 |
+
current_item = $(this).data('slug');
|
211 |
+
$current_node = $(this);
|
212 |
+
$current_node.find('.spinner').css('visibility','visible');
|
213 |
+
process_current();
|
214 |
+
do_next = false;
|
215 |
+
}
|
216 |
+
}else if($(this).data('slug') == current_item){
|
217 |
+
$(this).removeClass('work-in-progress');
|
218 |
+
do_next = true;
|
219 |
+
}
|
220 |
+
});
|
221 |
+
if( items_completed >= selectedPlugins ){
|
222 |
+
// finished all plugins!
|
223 |
+
complete();
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
return {
|
228 |
+
init: function(btn){
|
229 |
+
parentElement = $(btn).closest('.aux-has-required-plugins');
|
230 |
+
$(parentElement).find('.aux-wizard-plugins').addClass('installing');
|
231 |
+
// Add disable class on button
|
232 |
+
var oldButtonText = $(btn).text();
|
233 |
+
selectedPlugins = $(parentElement).find('.aux-plugin input[name="plugin[]"]:checked').length;
|
234 |
+
$(btn).text(aux_setup_params.btnworks_text).addClass('disabled');
|
235 |
+
complete = function(){
|
236 |
+
// Remove disable class from button
|
237 |
+
$(btn).text(oldButtonText);
|
238 |
+
if( $(parentElement).find('.aux-plugin').not('.aux-success').length === 0 ){
|
239 |
+
// Change button text and data value if all required plugins has been installed & activated
|
240 |
+
if( $(parentElement).hasClass('aux-modal-item') ){
|
241 |
+
$(btn).data('callback', 'install_demos').attr('data-callback', 'install_demos').text(aux_setup_params.makedemo_text).removeClass('disabled');
|
242 |
+
$(btn).parent('.aux-return-back').find('.aux-alert').hide();
|
243 |
+
$(parentElement).find('.first-step').addClass('hide');
|
244 |
+
$(parentElement).find('.second-step').removeClass('hide');
|
245 |
+
} else {
|
246 |
+
loading_content();
|
247 |
+
window.location.href=btn.href;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
};
|
251 |
+
find_next();
|
252 |
+
}
|
253 |
+
};
|
254 |
+
}
|
255 |
+
|
256 |
+
function demoManager(){
|
257 |
+
|
258 |
+
function ajax_callback( btn ){
|
259 |
+
|
260 |
+
var demoID = $( btn ).data('import-id');
|
261 |
+
var modalElement = $( btn ).closest('.aux-modal-item ');
|
262 |
+
var parentElement = $( btn ).closest('.aux-setup-demo-actions');
|
263 |
+
var progressBar = $( parentElement ).find('.progressbar');
|
264 |
+
var nonceField = $( btn ).data('nonce');
|
265 |
+
var demoOptions = $( '#aux-import-data-' + demoID ).serializeArray();
|
266 |
+
|
267 |
+
$(parentElement).find('.aux-return-back').addClass('hide');
|
268 |
+
$(progressBar).removeClass('hide').Progressbar({ percentage: 1 });
|
269 |
+
|
270 |
+
$.ajax({
|
271 |
+
url : aux_setup_params.ajaxurl,
|
272 |
+
type : 'post',
|
273 |
+
data : {
|
274 |
+
action : 'auxin_demo_data',
|
275 |
+
verify : nonceField,
|
276 |
+
ID : demoID,
|
277 |
+
options: demoOptions
|
278 |
+
}
|
279 |
+
}).done(function(response) {
|
280 |
+
$(progressBar).Progressbar({
|
281 |
+
percentage: 100
|
282 |
+
});
|
283 |
+
setTimeout(function () {
|
284 |
+
// Hide Progressbar
|
285 |
+
$(progressBar).addClass('hide');
|
286 |
+
// Display control buttons
|
287 |
+
$(parentElement).find('.aux-return-back').removeClass('hide').find('.button-next').text(aux_setup_params.nextstep_text).data('callback', null).removeAttr('data-callback');
|
288 |
+
// Remove checked attributes
|
289 |
+
$(modalElement).find('input:checkbox').removeAttr('checked');
|
290 |
+
// Display Message
|
291 |
+
if( response.success ){
|
292 |
+
$(parentElement).find('.aux-alert').addClass('success').html('<p>' + aux_setup_params.imported_done + '</p>').show();
|
293 |
+
} else {
|
294 |
+
$(parentElement).find('.aux-alert').html('<p>' + aux_setup_params.imported_fail + '</p>').show();
|
295 |
+
}
|
296 |
+
}, 2000);
|
297 |
+
});
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
return {
|
302 |
+
init: function(btn){
|
303 |
+
ajax_callback( btn );
|
304 |
+
}
|
305 |
+
};
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
return {
|
310 |
+
init: function(){
|
311 |
+
$(window_loaded);
|
312 |
+
},
|
313 |
+
callback: function(func){
|
314 |
+
console.log(func);
|
315 |
+
console.log(this);
|
316 |
+
}
|
317 |
+
};
|
318 |
+
};
|
319 |
+
})( jQuery );
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Run the scripts
|
323 |
+
*/
|
324 |
+
(function( $ ) {
|
325 |
+
var wizard = $('.auxin-wizard-wrap').AuxWizard();
|
326 |
+
wizard.init();
|
327 |
+
})( jQuery );
|
public/includes/frontend-ajax.php
CHANGED
@@ -70,6 +70,20 @@ function auxels_ajax_handler_element_load_more(){
|
|
70 |
$element_markup = auxin_widget_recent_posts_timeline_callback( $ajax_args );
|
71 |
break;
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
default:
|
74 |
wp_send_json_error( __( 'Not a valid handler.', 'auxin-elements' ) );
|
75 |
break;
|
70 |
$element_markup = auxin_widget_recent_posts_timeline_callback( $ajax_args );
|
71 |
break;
|
72 |
|
73 |
+
case 'aux_recent_news':
|
74 |
+
require_once( AUXNEW_INC_DIR . '/elements/recent-news.php' );
|
75 |
+
|
76 |
+
// Get the element markup
|
77 |
+
$element_markup = auxin_widget_recent_news_callback( $ajax_args );
|
78 |
+
break;
|
79 |
+
|
80 |
+
case 'aux_recent_news_big_grid':
|
81 |
+
require_once( AUXNEW_INC_DIR . '/elements/recent-news-big-grid.php' );
|
82 |
+
|
83 |
+
// Get the element markup
|
84 |
+
$element_markup = auxin_widget_recent_news_big_grid_callback( $ajax_args );
|
85 |
+
break;
|
86 |
+
|
87 |
default:
|
88 |
wp_send_json_error( __( 'Not a valid handler.', 'auxin-elements' ) );
|
89 |
break;
|