Shortcodes and extra features for Phlox theme - Version 1.0.6

Version Description

Download this release

Release Info

Developer averta
Plugin Icon 128x128 Shortcodes and extra features for Phlox theme
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.6

README.txt CHANGED
@@ -5,8 +5,8 @@ License: GPLv3
5
  License URI: http://www.gnu.org/licenses/gpl.html
6
  Tags: banner SEO, shortcode, page-builder, siteorigin, auxin, framework, widget, element, phlox, averta, fullwidth, masonry, timeline
7
  Requires at least: 4.3
8
- Tested up to: 4.6.0
9
- Stable tag: 1.0.3
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl.html
12
 
@@ -140,6 +140,9 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/auxin-ele
140
 
141
  == Changelog ==
142
 
 
 
 
143
  = Version 1.0.3 / (31.8.2016) =
144
  - [Update]: Description in profile page updated
145
 
@@ -150,5 +153,5 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/auxin-ele
150
 
151
  == Upgrade Notice ==
152
 
153
- = 1.0.3 =
154
- - [Update]: Description in profile page updated
5
  License URI: http://www.gnu.org/licenses/gpl.html
6
  Tags: banner SEO, shortcode, page-builder, siteorigin, auxin, framework, widget, element, phlox, averta, fullwidth, masonry, timeline
7
  Requires at least: 4.3
8
+ Tested up to: 4.6.1
9
+ Stable tag: 1.0.6
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl.html
12
 
140
 
141
  == Changelog ==
142
 
143
+ = Version 1.0.6 / (19.9.2016) =
144
+ - [New]: New features added
145
+
146
  = Version 1.0.3 / (31.8.2016) =
147
  - [Update]: Description in profile page updated
148
 
153
 
154
  == Upgrade Notice ==
155
 
156
+ = 1.0.6 =
157
+ - [Update]: New features added
admin/assets/images/saving.gif ADDED
Binary file
admin/includes/admin-ajax.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function auxin_ajax_send_feedback(){
4
+
5
+ // skip if the form data is not receiced
6
+ if( empty( $_POST['form'] ) ){
7
+ wp_send_json_error( __( 'Data cannot be delivered, please try again.', 'auxin-elements' ) );
8
+ }
9
+
10
+ $form_data = $_POST['form'];
11
+
12
+ // extract the form data
13
+ $rate = ! empty( $form_data['theme_rate'] ) ? $form_data['theme_rate'] : '';
14
+ $feedback = ! empty( $form_data['feedback'] ) ? $form_data['feedback'] : '';
15
+ $email = ! empty( $form_data['email'] ) ? $form_data['email'] : '';
16
+ $nonce = ! empty( $form_data['_wpnonce'] ) ? $form_data['_wpnonce'] : '';
17
+
18
+ if( ! wp_verify_nonce( $nonce, 'phlox_feedback' ) ){
19
+ wp_send_json_error( __( 'Authorization failed!', 'auxin-elements' ) );
20
+ }
21
+
22
+ if( $rate ){
23
+
24
+ global $wp_version;
25
+
26
+ $args = array(
27
+ 'user-agent' => 'WordPress/'.$wp_version.'; '. get_home_url(),
28
+ 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 5),
29
+ 'body' => array(
30
+ 'cat' => 'rating',
31
+ 'action' => 'submit',
32
+ 'item-slug' => 'phlox',
33
+ 'rate' => $rate
34
+ )
35
+ );
36
+ // send the rating through the api
37
+ $request = wp_remote_post( 'http://api.averta.net/envato/items/', $args );
38
+
39
+ // if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {}
40
+
41
+ // store the user rating on the website
42
+ auxin_update_option( 'user_rating', $rate );
43
+
44
+ // send the feedback via email
45
+ $message = 'Rate: '. $rate . "\r\n" . 'Email: <' . $email . ">\r\n\r\n" . $feedback;
46
+ wp_mail( 'feedbacks'.'@'.'averta.net', 'Feedback from phlox dashboard:', $message );
47
+
48
+ wp_send_json_success( __( 'Sent Successfully. Thanks for your feedback!', 'auxin-elements' ) );
49
+
50
+ } else{
51
+ wp_send_json_error( __( 'An error occurred. Feedback could not be delivered, please try again.', 'auxin-elements' ) );
52
+ }
53
+
54
+ }
55
+
56
+ add_action( 'wp_ajax_send_feedback', 'auxin_ajax_send_feedback' );
admin/includes/admin-hooks.php CHANGED
@@ -47,7 +47,6 @@ function auxin_register_mce_buttons_style(){
47
  add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
48
 
49
 
50
-
51
  /*-----------------------------------------------------------------------------------*/
52
  /* Adds system status tab in theme about (welcome) page
53
  /*-----------------------------------------------------------------------------------*/
@@ -66,6 +65,95 @@ function auxin_about_system_status( $sections ){
66
  add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
67
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  /*-----------------------------------------------------------------------------------*/
71
  /* Adds subtitle meta field to 'Title setting' tab
@@ -77,8 +165,8 @@ function auxin_add_metabox_field_to_title_setting_tab( $fields, $id, $type ){
77
  array_unshift(
78
  $fields,
79
  array(
80
- 'title' => __('Subtitle', THEME_DOMAIN),
81
- 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', THEME_DOMAIN),
82
  'id' => 'page_subtitle',
83
  'type' => 'editor',
84
  'default' => ''
@@ -99,9 +187,9 @@ function auxin_add_metabox_field_to_advanced_setting_tab( $fields, $id, $type ){
99
 
100
  if( 'general-advanced' == $id ){
101
  $fields[] = array(
102
- 'title' => __('Custom JavaScript Code', THEME_DOMAIN),
103
- 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', THEME_DOMAIN).'<br />'.
104
- __('For defining global JavaScript roles, please use custom javaScript field on option panel.', THEME_DOMAIN ),
105
  'id' => 'aux_page_custom_js',
106
  'type' => 'code',
107
  'mode' => 'javascript',
@@ -175,3 +263,43 @@ function auxin_add_widget_tabs($tabs) {
175
  add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
176
 
177
  // =============================================================================
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
48
 
49
 
 
50
  /*-----------------------------------------------------------------------------------*/
51
  /* Adds system status tab in theme about (welcome) page
52
  /*-----------------------------------------------------------------------------------*/
65
  add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
66
 
67
 
68
+ /*-----------------------------------------------------------------------------------*/
69
+ /* Adds feedback tab in theme about (welcome) page
70
+ /*-----------------------------------------------------------------------------------*/
71
+
72
+ function auxin_welcome_page_display_section_feedback(){
73
+ // the previous rate of the client
74
+ $previous_rate = auxin_get_option( 'user_rating' );
75
+ $support_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=support' );
76
+ ?>
77
+
78
+ <div class="changelog feature-section two-col feedback">
79
+
80
+ <form class="aux-feedback-form" action="<?php echo admin_url( 'admin.php?page=auxin-welcome&tab=feedback'); ?>" method="post" >
81
+
82
+ <div class="aux-rating-section">
83
+ <h2 class="aux-featur"><?php _e('How likely are you to recommend Phlox to a friend?', 'auxin-elements' ); ?></h2>
84
+ <div class="aux-theme-ratings">
85
+ <?php
86
+ for( $i = 1; $i <= 5; $i++ ){
87
+ printf(
88
+ '<div class="aux-rate-cell"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>',
89
+ $i, checked( $previous_rate, $i, false )
90
+ );
91
+ }
92
+ ?>
93
+
94
+ </div>
95
+ <div class="aux-ratings-measure">
96
+ <p>Don't like it</p>
97
+ <p>Like it so much</p>
98
+ </div>
99
+ </div>
100
+
101
+ <div class="aux-feedback-section aux-hide">
102
+ <h2 class="aux-featur"><?php _e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h2>
103
+ <h4 class="aux-featur feedback-subtitle">
104
+ <?php
105
+ printf( __( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ),
106
+ '<a href="' . $support_tab_url . '">', '</a>' ); ?>
107
+ </h4>
108
+ <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea>
109
+ <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" />
110
+ <?php wp_nonce_field( 'phlox_feedback' ); ?>
111
+
112
+ <input type="submit" class="button button-primary aux-button" value="Submit feedback" />
113
+
114
+ <div class="aux-sending-status">
115
+ <img class="ajax-progress aux-hide" src="<?php echo AUX_URL; ?>/css/images/elements/saving.gif" />
116
+ <span class="ajax-response aux-hide" ><?php _e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span>
117
+ </div>
118
+
119
+ </div>
120
+
121
+ <?php auxin_send_feedback_mail(); ?>
122
+ </form>
123
+ </div>
124
+
125
+ <?php
126
+ }
127
+
128
+ function auxin_welcome_add_section_feedback( $sections ){
129
+
130
+ $sections['feedback'] = array(
131
+ 'label' => __( 'Feedback', 'auxin-elements' ),
132
+ 'description' => sprintf(__( 'Please leave a feedback and help us to improve %s theme.', 'auxin-elements'), THEME_NAME_I18N ),
133
+ 'callback' => 'auxin_welcome_page_display_section_feedback'
134
+ );
135
+
136
+ return $sections;
137
+ }
138
+
139
+ add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_feedback', 90 );
140
+
141
+ function auxin_send_feedback_mail(){
142
+ if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) {
143
+
144
+ $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty';
145
+ $feedback = ! empty( $_POST["feedback"] ) ? esc_textarea( $_POST["feedback"] ) : '';
146
+
147
+ if( $feedback ){
148
+ wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email );
149
+ $text = __( 'Thanks for your feedback', 'auxin-elements' );
150
+ } else{
151
+ $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements');
152
+ }
153
+
154
+ printf('<p class="notification">%s</p>', $text);
155
+ }
156
+ }
157
 
158
  /*-----------------------------------------------------------------------------------*/
159
  /* Adds subtitle meta field to 'Title setting' tab
165
  array_unshift(
166
  $fields,
167
  array(
168
+ 'title' => __('Subtitle', 'auxin-elements'),
169
+ 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', 'auxin-elements'),
170
  'id' => 'page_subtitle',
171
  'type' => 'editor',
172
  'default' => ''
187
 
188
  if( 'general-advanced' == $id ){
189
  $fields[] = array(
190
+ 'title' => __('Custom JavaScript Code', 'auxin-elements'),
191
+ 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', 'auxin-elements').'<br />'.
192
+ __('For defining global JavaScript roles, please use custom javaScript field on option panel.', 'auxin-elements' ),
193
  'id' => 'aux_page_custom_js',
194
  'type' => 'code',
195
  'mode' => 'javascript',
263
  add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
264
 
265
  // =============================================================================
266
+
267
+
268
+ function auxin_admin_footer_text( $footer_text ) {
269
+
270
+ // the admin pages that we intent to display theme footer text on
271
+ $admin_pages = array(
272
+ 'toplevel_page_auxin',
273
+ 'appearance_page_auxin',
274
+ 'toplevel_page_auxin-welcome',
275
+ 'appearance_page_auxin-welcome',
276
+ 'page',
277
+ 'post',
278
+ 'widgets',
279
+ 'dashboard',
280
+ 'edit-post',
281
+ 'edit-page',
282
+ 'edit-portfolio'
283
+ );
284
+
285
+ if( ! ( function_exists('auxin_is_theme_admin_page') && auxin_is_theme_admin_page( $admin_pages ) ) ){
286
+ return $footer_text;
287
+ }
288
+
289
+ $welcome_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=' );
290
+
291
+ $auxin_text = sprintf(
292
+ __( 'Quick access to %sdashboard%s, %soptions%s, %ssupport%s and %sfeedback%s page.', 'auxin-elements' ),
293
+ '<a href="'. $welcome_tab_url .'features" title="Version ' . THEME_NAME_I18N . '" >' . THEME_NAME_I18N . ' ',
294
+ '</a>',
295
+ '<a href="'. admin_url( 'customize.php' ). '?url=' . $welcome_tab_url .'features" title="'. __('Theme Customizer', 'auxin-elements' ) .'" >',
296
+ '</a>',
297
+ '<a href="'. $welcome_tab_url .'support">',
298
+ '</a>',
299
+ '<a href="'. $welcome_tab_url .'feedback">',
300
+ '</a>'
301
+ );
302
+
303
+ return '<span id="footer-thankyou">' . $auxin_text . '</span>';
304
+ }
305
+ add_filter( 'admin_footer_text', 'auxin_admin_footer_text' );
admin/includes/classes/class-auxels-import-parser.php ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress eXtended RSS file parser implementations
4
+ *
5
+ * @package WordPress
6
+ * @subpackage Importer
7
+ */
8
+
9
+ /**
10
+ * WordPress Importer class for managing parsing of WXR files.
11
+ */
12
+ class AUXELS_Import_Parser {
13
+ function parse( $file ) {
14
+ // Attempt to use proper XML parsers first
15
+ if ( extension_loaded( 'simplexml' ) ) {
16
+ $parser = new AUXELS_WXR_Parser_SimpleXML;
17
+ $result = $parser->parse( $file );
18
+
19
+ // If SimpleXML succeeds or this is an invalid WXR file then return the results
20
+ if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() )
21
+ return $result;
22
+ } else if ( extension_loaded( 'xml' ) ) {
23
+ $parser = new AUXELS_WXR_Parser_XML;
24
+ $result = $parser->parse( $file );
25
+
26
+ // If XMLParser succeeds or this is an invalid WXR file then return the results
27
+ if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() )
28
+ return $result;
29
+ }
30
+
31
+ // We have a malformed XML file, so display the error and fallthrough to regex
32
+ if ( isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG ) {
33
+ echo '<pre>';
34
+ if ( 'SimpleXML_parse_error' == $result->get_error_code() ) {
35
+ foreach ( $result->get_error_data() as $error )
36
+ echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n";
37
+ } else if ( 'XML_parse_error' == $result->get_error_code() ) {
38
+ $error = $result->get_error_data();
39
+ echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
40
+ }
41
+ echo '</pre>';
42
+ echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'wordpress-importer' ) . '</strong><br />';
43
+ echo __( 'Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer' ) . '</p>';
44
+ }
45
+
46
+ // use regular expressions if nothing else available or this is bad XML
47
+ $parser = new AUXELS_WXR_Parser_Regex;
48
+ return $parser->parse( $file );
49
+ }
50
+ }
51
+
52
+ /**
53
+ * WXR Parser that makes use of the SimpleXML PHP extension.
54
+ */
55
+ class AUXELS_WXR_Parser_SimpleXML {
56
+
57
+ function parse( $file ) {
58
+
59
+ $options = $option = array();
60
+
61
+ $internal_errors = libxml_use_internal_errors(true);
62
+
63
+ $dom = new DOMDocument;
64
+ $old_value = null;
65
+ if ( function_exists( 'libxml_disable_entity_loader' ) ) {
66
+ $old_value = libxml_disable_entity_loader( true );
67
+ }
68
+ $success = $dom->loadXML( file_get_contents( $file ) );
69
+ if ( ! is_null( $old_value ) ) {
70
+ libxml_disable_entity_loader( $old_value );
71
+ }
72
+
73
+ if ( ! $success || isset( $dom->doctype ) ) {
74
+ return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
75
+ }
76
+
77
+ $xml = simplexml_import_dom( $dom );
78
+ unset( $dom );
79
+
80
+ // halt if loading produces an error
81
+ if ( ! $xml )
82
+ return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
83
+
84
+ $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
85
+ if ( ! $wxr_version )
86
+ return new WP_Error( 'AUXELS_WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
87
+
88
+ $wxr_version = (string) trim( $wxr_version[0] );
89
+ // confirm that we are dealing with the correct file format
90
+ if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
91
+ return new WP_Error( 'AUXELS_WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
92
+
93
+ $base_url = $xml->xpath('/rss/channel/wp:base_site_url');
94
+ $base_url = (string) trim( $base_url[0] );
95
+
96
+ $namespaces = $xml->getDocNamespaces();
97
+ if ( ! isset( $namespaces['wp'] ) )
98
+ $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
99
+ if ( ! isset( $namespaces['excerpt'] ) )
100
+ $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
101
+
102
+ $wp = $xml->channel->children( $namespaces['wp'] );
103
+ // grab cats, tags and terms
104
+
105
+ foreach ( $wp->option as $option ) {
106
+ $options[ $option->option_key[0]->__toString() ] = $option->option_value[0]->__toString();
107
+ }
108
+
109
+ return $options;
110
+ }
111
+
112
+ }
113
+
114
+ /**
115
+ * WXR Parser that makes use of the XML Parser PHP extension.
116
+ */
117
+ class AUXELS_WXR_Parser_XML {
118
+
119
+ var $wp_tags = array(
120
+ 'wp:option'
121
+ );
122
+ var $wp_sub_tags = array(
123
+ 'wp:option_name', 'wp:option_value'
124
+ );
125
+
126
+ function parse( $file ) {
127
+
128
+ $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false;
129
+ $this->authors = $this->posts = $this->term = $this->category = $this->tag = array();
130
+
131
+ $xml = xml_parser_create( 'UTF-8' );
132
+ xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 );
133
+ xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 );
134
+ xml_set_object( $xml, $this );
135
+ xml_set_character_data_handler( $xml, 'cdata' );
136
+ xml_set_element_handler( $xml, 'tag_open', 'tag_close' );
137
+
138
+ if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
139
+ $current_line = xml_get_current_line_number( $xml );
140
+ $current_column = xml_get_current_column_number( $xml );
141
+ $error_code = xml_get_error_code( $xml );
142
+ $error_string = xml_error_string( $error_code );
143
+ return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
144
+ }
145
+ xml_parser_free( $xml );
146
+
147
+ if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) )
148
+ return new WP_Error( 'AUXELS_WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
149
+
150
+ return array(
151
+ 'authors' => $this->authors,
152
+ 'posts' => $this->posts,
153
+ 'categories' => $this->category,
154
+ 'tags' => $this->tag,
155
+ 'terms' => $this->term,
156
+ 'base_url' => $this->base_url,
157
+ 'version' => $this->wxr_version
158
+ );
159
+ }
160
+
161
+ function tag_open( $parse, $tag, $attr ) {
162
+ if ( in_array( $tag, $this->wp_tags ) ) {
163
+ $this->in_tag = substr( $tag, 3 );
164
+ return;
165
+ }
166
+
167
+ if ( in_array( $tag, $this->wp_sub_tags ) ) {
168
+ $this->in_sub_tag = substr( $tag, 3 );
169
+ return;
170
+ }
171
+
172
+ switch ( $tag ) {
173
+ case 'category':
174
+ if ( isset($attr['domain'], $attr['nicename']) ) {
175
+ $this->sub_data['domain'] = $attr['domain'];
176
+ $this->sub_data['slug'] = $attr['nicename'];
177
+ }
178
+ break;
179
+ case 'item': $this->in_post = true;
180
+ case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break;
181
+ case 'guid': $this->in_tag = 'guid'; break;
182
+ case 'dc:creator': $this->in_tag = 'post_author'; break;
183
+ case 'content:encoded': $this->in_tag = 'post_content'; break;
184
+ case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break;
185
+
186
+ case 'wp:term_slug': $this->in_tag = 'slug'; break;
187
+ case 'wp:meta_key': $this->in_sub_tag = 'key'; break;
188
+ case 'wp:meta_value': $this->in_sub_tag = 'value'; break;
189
+ }
190
+ }
191
+
192
+ function cdata( $parser, $cdata ) {
193
+ if ( ! trim( $cdata ) )
194
+ return;
195
+
196
+ if ( false !== $this->in_tag || false !== $this->in_sub_tag ) {
197
+ $this->cdata .= $cdata;
198
+ } else {
199
+ $this->cdata .= trim( $cdata );
200
+ }
201
+ }
202
+
203
+ function tag_close( $parser, $tag ) {
204
+ switch ( $tag ) {
205
+ case 'wp:option':
206
+ $n = substr( $tag, 3 );
207
+ array_push( $this->$n, $this->data );
208
+ $this->data = false;
209
+ break;
210
+ }
211
+
212
+ $this->cdata = false;
213
+ }
214
+ }
215
+
216
+ /**
217
+ * WXR Parser that uses regular expressions. Fallback for installs without an XML parser.
218
+ */
219
+ class AUXELS_WXR_Parser_Regex {
220
+
221
+ var $options = array();
222
+
223
+ function __construct() {
224
+ $this->has_gzip = is_callable( 'gzopen' );
225
+ }
226
+
227
+ function parse( $file ) {
228
+ $wxr_version = $in_post = false;
229
+
230
+ $fp = $this->fopen( $file, 'r' );
231
+ if ( $fp ) {
232
+ while ( ! $this->feof( $fp ) ) {
233
+ $importline = rtrim( $this->fgets( $fp ) );
234
+
235
+ if ( false !== strpos( $importline, '<wp:option>' ) ) {
236
+ preg_match( '|<wp:option>(.*?)</wp:option>|is', $importline, $option );
237
+ $this->options[] = $this->process_option( $option[1] );
238
+ continue;
239
+ }
240
+ if ( $in_post ) {
241
+ $post .= $importline . "\n";
242
+ }
243
+ }
244
+
245
+ $this->fclose($fp);
246
+ }
247
+
248
+ if ( ! $wxr_version )
249
+ return new WP_Error( 'AUXELS_WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
250
+
251
+ return array(
252
+ 'options' => $this->options
253
+ );
254
+ }
255
+
256
+ function get_tag( $string, $tag ) {
257
+ preg_match( "|<$tag.*?>(.*?)</$tag>|is", $string, $return );
258
+ if ( isset( $return[1] ) ) {
259
+ if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
260
+ if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) {
261
+ preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
262
+ $return = '';
263
+ foreach( $matches[1] as $match )
264
+ $return .= $match;
265
+ } else {
266
+ $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );
267
+ }
268
+ } else {
269
+ $return = $return[1];
270
+ }
271
+ } else {
272
+ $return = '';
273
+ }
274
+ return $return;
275
+ }
276
+
277
+ function process_option( $t ) {
278
+ return array(
279
+ 'option_name' => $this->get_tag( $t, 'wp:option_name' ),
280
+ 'option_value' => $this->get_tag( $t, 'wp:option_value' )
281
+ );
282
+ }
283
+
284
+ function _normalize_tag( $matches ) {
285
+ return '<' . strtolower( $matches[1] );
286
+ }
287
+
288
+ function fopen( $filename, $mode = 'r' ) {
289
+ if ( $this->has_gzip )
290
+ return gzopen( $filename, $mode );
291
+ return fopen( $filename, $mode );
292
+ }
293
+
294
+ function feof( $fp ) {
295
+ if ( $this->has_gzip )
296
+ return gzeof( $fp );
297
+ return feof( $fp );
298
+ }
299
+
300
+ function fgets( $fp, $len = 8192 ) {
301
+ if ( $this->has_gzip )
302
+ return gzgets( $fp, $len );
303
+ return fgets( $fp, $len );
304
+ }
305
+
306
+ function fclose( $fp ) {
307
+ if ( $this->has_gzip )
308
+ return gzclose( $fp );
309
+ return fclose( $fp );
310
+ }
311
+
312
+ }
admin/includes/classes/class-auxels-import.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class for importing and exporting theme options
4
+ */
5
+
6
+ class Auxels_Import {
7
+
8
+ /**
9
+ * Instance of this class.
10
+ *
11
+ * @var object
12
+ */
13
+ protected static $instance = null;
14
+
15
+
16
+ function __construct(){
17
+ // Add a radio option for exporting auxin options to wp export options.
18
+ add_action( 'export_filters', array( $this, 'export_filters' ) );
19
+ // Process the check field for auxin options while export submited
20
+ add_filter( 'export_args', array( $this, 'export_args' ) );
21
+
22
+ // adding options to export file
23
+ add_action( 'rss2_head', array( $this, 'add_xml_tag_option_in_export' ) );
24
+ // Import the options based on parsed data from xml file
25
+ add_action( 'import_start', array( $this, 'import_start' ) );
26
+ }
27
+
28
+ /**
29
+ * Add a radio option for exporting auxin options to available export options.
30
+ *
31
+ * @return void
32
+ */
33
+ public function export_filters() {
34
+ ?>
35
+ <hr />
36
+ <p><label>
37
+ <input type="checkbox" name="auxin-options" checked="checked" aria-describedby="all-content-desc" />
38
+ <?php _e( 'Include theme options', 'auxin-elements' ); ?>
39
+ </label></p>
40
+ <?php
41
+ }
42
+
43
+ /**
44
+ * Process the check field for auxin options
45
+ *
46
+ * @param [type] $args [description]
47
+ * @return [type] [description]
48
+ */
49
+ public function export_args( $args ){
50
+
51
+ if ( ! empty( $_GET['auxin-options'] ) ) {
52
+ $args['auxin-options'] = true;
53
+ return $args;
54
+ }
55
+
56
+ return $args;
57
+ }
58
+
59
+
60
+ /**
61
+ * Generate option page for wp options in xml format
62
+ */
63
+ public function add_xml_tag_option_in_export(){
64
+ global $wpdb;
65
+
66
+ $options_ref = $this->get_export_option_list();
67
+
68
+ foreach ( $options_ref as $option_export_name => $option_import_name ) {
69
+ $sql = $wpdb->prepare("SELECT option_name, option_value FROM $wpdb->options WHERE option_name = %s", $option_import_name );
70
+ $result = $wpdb->get_results( $sql );
71
+
72
+ if( ! empty( $result[0]->option_value ) ){
73
+ ?>
74
+ <wp:option>
75
+ <wp:option_key><?php echo $this->wxr_cdata( $option_export_name ); ?></wp:option_key>
76
+ <wp:option_value><?php echo $this->wxr_cdata( $result[0]->option_value ); ?></wp:option_value>
77
+ </wp:option>
78
+ <?php
79
+ }
80
+
81
+ }
82
+ }
83
+
84
+
85
+ /**
86
+ * Import the options based on parsed data from xml file
87
+ */
88
+ public function import_start(){
89
+ global $wp_import;
90
+
91
+ $options_ref = $this->get_export_option_list();
92
+
93
+ $file = get_attached_file( $wp_import->id );
94
+ // if export file is not uploaded and is a link to a file in theme files
95
+ if( empty( $file ) && property_exists( $wp_import, 'import_file' ) ){
96
+ $file = $wp_import->import_file;
97
+ }
98
+
99
+ include 'class-auxels-import-parser.php';
100
+
101
+ $parser = new AUXELS_Import_Parser;
102
+ $options = $parser->parse( $file );
103
+
104
+ foreach ( $options as $option_key => $option_value ){
105
+ if( ! empty( $options_ref[ $option_key ] ) ){
106
+ update_option( $options_ref[ $option_key ], maybe_unserialize( $option_value ) );
107
+ }
108
+ }
109
+
110
+ }
111
+
112
+
113
+ /**
114
+ * Retrieves the list of options we intended to include in export file
115
+ */
116
+ public function get_export_option_list(){
117
+ return array(
118
+ 'formatted_options' => THEME_ID . '_formatted_options'
119
+ );
120
+ }
121
+
122
+
123
+ /**
124
+ * Print the data in cdata and utf8 format
125
+ * @param string $str
126
+ */
127
+ function wxr_cdata( $str ) {
128
+ if ( ! seems_utf8( $str ) ) {
129
+ $str = utf8_encode( $str );
130
+ }
131
+
132
+ $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
133
+
134
+ return $str;
135
+ }
136
+
137
+
138
+ /**
139
+ * Return an instance of this class.
140
+ *
141
+ * @return object A single instance of this class.
142
+ */
143
+ public static function get_instance() {
144
+
145
+ // If the single instance hasn't been set, set it now.
146
+ if ( null == self::$instance ) {
147
+ self::$instance = new self;
148
+ }
149
+
150
+ return self::$instance;
151
+ }
152
+
153
+ }
154
+
155
+ new Auxels_Import();
admin/includes/index.php CHANGED
@@ -5,7 +5,7 @@ include_once( 'admin-the-functions.php' );
5
 
6
  // load admin related classes
7
  include_once( 'classes/class-auxels-admin-assets.php' );
8
-
9
 
10
  do_action( 'auxels_admin_classes_loaded' );
11
 
5
 
6
  // load admin related classes
7
  include_once( 'classes/class-auxels-admin-assets.php' );
8
+ include_once( 'classes/class-auxels-import.php' );
9
 
10
  do_action( 'auxels_admin_classes_loaded' );
11
 
auxin-elements.php CHANGED
@@ -11,8 +11,8 @@
11
  *
12
  * Plugin Name: Auxin Elements
13
  * Plugin URI: https://wordpress.org/plugins/auxin-elements/
14
- * Description: Extra features, shortcodes and widgets for PHLOX theme.
15
- * Version: 1.0.3
16
  * Author: averta
17
  * Author URI: http://averta.net
18
  * Text Domain: auxin-elements
11
  *
12
  * Plugin Name: Auxin 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.0.6
16
  * Author: averta
17
  * Author URI: http://averta.net
18
  * Text Domain: auxin-elements
includes/classes/class-auxin-siteorigin-widget.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * A class for creating SiteOrigin widgets from the master widgets list
4
+ *
5
+ *
6
+ * @package auxin-elements
7
+ * @license LICENSE.txt
8
+ * @author
9
+ * @link https://bitbucket.org/averta/
10
+ * @copyright (c) 2010-2016
11
+ */
12
+
13
+ // no direct access allowed
14
+ if ( ! defined('ABSPATH') ) exit;
15
+
16
+ /*--------------------------------*/
17
+
18
+ if( ! class_exists( 'Auxin_SiteOrigin_Widget' ) && class_exists( 'SiteOrigin_Widget') ) :
19
+
20
+ class Auxin_SiteOrigin_Widget extends SiteOrigin_Widget {
21
+
22
+
23
+ private $widget_info = array();
24
+ private $widget_fields = array();
25
+ public $widget_fun_name;
26
+
27
+ /**
28
+ * Setups new SiteOrigin Widget
29
+ * @param Array $widget_info
30
+ */
31
+ function __construct( $widget_info ) {
32
+
33
+ $this->widget_info = $widget_info;
34
+ $this->widget_fields = $widget_info['params'];
35
+ $this->widget_fun_name = $widget_info['auxin_output_callback'];
36
+
37
+ parent::__construct(
38
+ // The unique id for your widget.
39
+ $widget_info['base'],
40
+
41
+ // The name of the widget for display purposes.
42
+ $widget_info['name'],
43
+
44
+ // The $widget_options array, which is passed through to WP_Widget.
45
+ // It has a couple of extras like the optional help URL, which should link to your sites help or support page.
46
+ array(
47
+ 'description' => $widget_info['description'],
48
+ 'has_preview' => false
49
+ //'help' => 'http://example.com/hello-world-widget-docs',
50
+ ),
51
+
52
+ //The $control_options array, which is passed through to WP_Widget
53
+ array(
54
+ ),
55
+
56
+ //The $form_options array, which describes the form fields used to configure SiteOrigin widgets. We'll explain these in more detail later.
57
+ false,
58
+ // array(
59
+ // 'text' => array(
60
+ // 'type' => 'text',
61
+ // 'label' => __('Hello world! goes here.', 'siteorigin-widgets'),
62
+ // 'default' => 'Hello world!'
63
+ // ),
64
+ // ),
65
+
66
+ //The $base_folder path string.
67
+ plugin_dir_path(__FILE__)
68
+ );
69
+
70
+ // we don't want to use template files for site origin widgets
71
+ add_filter( 'siteorigin_widgets_template_file_' . $widget_info['base'] , array( $this, 'get_widget_template_file' ) );
72
+ // override the widget template html
73
+ add_filter( 'siteorigin_widgets_template_html_' . $widget_info['base'] , array( $this, 'get_widget_html' ), 10, 2 );
74
+
75
+
76
+ }
77
+
78
+ function initialize_form(){
79
+
80
+ $so_fields = array();
81
+ $so_fields_sections = array();
82
+
83
+ foreach ( $this->widget_fields as $field ) {
84
+
85
+ $so_field = array(
86
+ 'label' => $field['heading'],
87
+ 'default' => ! empty( $field['value'] ) ? $field['value'] : '',
88
+ 'description' => ! empty( $field['description'] ) ? $field['description'] : ''
89
+ );
90
+
91
+ switch ( $field['type'] ) {
92
+ case 'iconpicker':
93
+ case 'aux_iconpicker':
94
+ // TODO: add icon picker to so builder
95
+ break;
96
+ case 'textarea_html':
97
+ $so_field['type'] = 'tinymce';
98
+ $so_field['rows'] = 20;
99
+ break;
100
+
101
+ case 'textbox':
102
+ case 'textfield':
103
+ $so_field['type'] = 'text';
104
+ break;
105
+
106
+ case 'dropdown':
107
+ case 'select':
108
+ $so_field['type'] = 'select';
109
+ $so_field['options'] = $field['value'];
110
+
111
+ if ( !empty( $field['def_value'] ) ) {
112
+ $so_field['default'] = $field['def_value'];
113
+ }
114
+ break;
115
+
116
+ // TODO: IT should change and now is just for test
117
+ case 'aux_multiple_selector' :
118
+ $so_field['type'] = 'select';
119
+ $so_field['options'] = $field['value'];
120
+ $so_field['multiple'] = true;
121
+
122
+ if ( !empty( $field['def_value'] ) ) {
123
+ $so_field['default'] = $field['def_value'];
124
+ }
125
+
126
+ break;
127
+
128
+ case 'aux_visual_select':
129
+ // TODO: add visual select field to so
130
+ break;
131
+
132
+ case 'checkbox':
133
+ case 'aux_switch':
134
+ // TODO: add switch box to so
135
+ $so_field['type'] = 'checkbox';
136
+ break;
137
+
138
+ case 'color':
139
+ case 'colorpicker':
140
+ // TODO: add color picker to so
141
+ $so_field['type'] = 'color';
142
+ break;
143
+
144
+ case 'aux_select_image':
145
+ case 'attach_image':
146
+ $so_field['type'] = 'media';
147
+ $so_field['library'] = 'image';
148
+ break;
149
+
150
+ case 'aux_select_images':
151
+ case 'attach_images':
152
+ $so_field['type'] = 'media';
153
+ $so_field['library'] = 'image';
154
+ break;
155
+
156
+ case 'aux_select_video':
157
+ case 'attach_video':
158
+ $so_field['type'] = 'media';
159
+ $so_field['library'] = 'video';
160
+ break;
161
+
162
+ case 'aux_select_audio':
163
+ case 'attach_audio':
164
+ $so_field['type'] = 'media';
165
+ $so_field['library'] = 'audio';
166
+ default:
167
+ continue;
168
+ break;
169
+ }
170
+
171
+
172
+ if ( ! empty( $field['repeater'] ) ) {
173
+ $repeater_name = $this->sanitize_field_name( $field['repeater'] );
174
+
175
+ if ( ! isset( $so_fields[ $repeater_name ] ) ) {
176
+ $so_fields[ $repeater_name ] = array(
177
+ 'type' => 'repeater',
178
+ 'label' => $field['repeater'],
179
+ 'hide' => true,
180
+ 'fields' => array()
181
+ );
182
+ }
183
+
184
+ $so_fields[ $repeater_name ]['fields'][ $field['param_name'] ] = $so_field;
185
+ } elseif ( ! empty( $field['group'] ) ) {
186
+ $section_name = $this->sanitize_field_name( $field['group'] );
187
+
188
+ if ( ! isset( $so_fields[ $section_name ] ) ) {
189
+ $so_fields[ $section_name ] = array(
190
+ 'type' => 'section',
191
+ 'label' => $field['group'],
192
+ 'hide' => true,
193
+ 'fields' => array()
194
+ );
195
+ }
196
+
197
+ $so_fields[ $section_name ]['fields'][ $field['param_name'] ] = $so_field;
198
+ } else {
199
+ $so_fields[$field['param_name']] = $so_field;
200
+ }
201
+
202
+ }
203
+
204
+ return $so_fields;
205
+ }
206
+
207
+ private function sanitize_field_name( $field_label ) {
208
+ return str_replace( ' ', '_', strtolower( $field_label ) );
209
+ }
210
+
211
+ /**
212
+ * get the widget output
213
+ */
214
+ function get_widget_html( $template_html, $instance ) {
215
+
216
+ // make sure to pass same class name for wrapper to widget too
217
+ if( isset( $this->widget_info['base_class'] ) ){
218
+ $args['base_class'] = $this->widget_info['base_class'];
219
+ }
220
+
221
+ $instance['widget_info'] = $args;
222
+
223
+ if( function_exists( $this->widget_fun_name ) ){
224
+ return call_user_func( $this->widget_fun_name, $instance );
225
+ } else {
226
+ auxin_error( __('The callback for widget does not exists.', THEME_DOMAIN) );
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Auxin elements doesn't support template files
232
+ */
233
+ function get_widget_template_file( $template_path ) {
234
+ return '';
235
+ }
236
+
237
+ function get_template_name( $instance ) {
238
+ return '';
239
+ }
240
+
241
+ function get_template_dir( $instance ) {
242
+ return '';
243
+ }
244
+
245
+ }
246
+
247
+ endif;
includes/classes/class-auxin-widget-shortcode-map.php CHANGED
@@ -300,8 +300,27 @@ class Auxin_Widget_Shortcode_Map {
300
  'icon' => $element_info['icon']
301
  );
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  // remove the widget from SO if displaying widget in SO is not allowed
304
- } elseif( ! $element_info['is_so'] ){
305
  if( isset( $widgets[ $element_info['base'] ] ) ){
306
  unset( $widgets[ $element_info['base'] ] );
307
  }
@@ -320,19 +339,22 @@ class Auxin_Widget_Shortcode_Map {
320
  */
321
  function add_siteorigin_widget_object( $object, $widget ) {
322
 
323
- // We can skip this if there's already an object
324
- if ( ! empty( $object ) ){
 
325
  return $object;
 
 
326
  }
327
 
328
- $master_array = $this->get_master_array();
329
-
330
- if ( isset( $master_array[ $widget ] ) ) {
331
- $widget_instance = $this->generate_widget_array( $master_array[ $widget ] );
332
- $object = new Auxin_Widget( $widget_instance );
 
333
  }
334
 
335
- return $object;
336
  }
337
 
338
 
300
  'icon' => $element_info['icon']
301
  );
302
 
303
+
304
+ $screen = get_current_screen();
305
+
306
+ if ( isset( $element_info['so_api'] ) && $element_info['so_api'] ) {
307
+
308
+ // render widget to enqueue scripts
309
+ // this method is used in site origin panels too (siteorigin-panels.php:420)
310
+ if( $screen->base != 'widgets' ) {
311
+ $original_post = isset($GLOBALS['post']) ? $GLOBALS['post'] : null; // Make sure widgets don't change the global post.
312
+ ob_start();
313
+ $widget_obj = new Auxin_SiteOrigin_Widget( $element_info );
314
+ $widget_obj->form( array() );
315
+ ob_clean();
316
+
317
+ $GLOBALS['post'] = $original_post;
318
+ }
319
+
320
+ }
321
+
322
  // remove the widget from SO if displaying widget in SO is not allowed
323
+ } elseif ( ! $element_info['is_so'] ) {
324
  if( isset( $widgets[ $element_info['base'] ] ) ){
325
  unset( $widgets[ $element_info['base'] ] );
326
  }
339
  */
340
  function add_siteorigin_widget_object( $object, $widget ) {
341
 
342
+ $master_array = $this->get_master_array();
343
+
344
+ if ( ! isset( $master_array[ $widget ] ) ) {
345
  return $object;
346
+ } else {
347
+ $element_info = $master_array[ $widget ];
348
  }
349
 
350
+ if ( isset( $element_info['so_api'] ) && $element_info['so_api'] ) {
351
+ return new Auxin_SiteOrigin_Widget( $element_info );
352
+ } elseif ( ! empty( $object ) ) {
353
+ return $object;
354
+ } else {
355
+ return new Auxin_Widget( $this->generate_widget_array( $element_info ) );
356
  }
357
 
 
358
  }
359
 
360
 
includes/define.php CHANGED
@@ -12,7 +12,7 @@ if( ! defined( 'THEME_NAME' ) ){
12
  }
13
 
14
 
15
- define( 'AUXELS_VERSION' , '1.0.3' );
16
 
17
  define( 'AUXELS_SLUG' , 'auxin-elements' );
18
  define( 'AUXELS_TEXT_DOMAIN' , 'auxin-elements' );
12
  }
13
 
14
 
15
+ define( 'AUXELS_VERSION' , '1.0.6' );
16
 
17
  define( 'AUXELS_SLUG' , 'auxin-elements' );
18
  define( 'AUXELS_TEXT_DOMAIN' , 'auxin-elements' );
includes/elements/accordion.php CHANGED
@@ -36,13 +36,13 @@ function auxin_get_new_accordion_master_array( $master_array ) {
36
  'as_child' => '',
37
  'params' => array(
38
  array(
 
 
39
  'param_name' => 'title',
40
  'type' => 'textfield',
41
  'value' => '',
42
  'holder' => 'textfield',
43
  'class' => 'title',
44
- 'heading' => __('Title','auxin-elements'),
45
- 'description' => __('Accordion title, leave it empty if you don`t need title.', 'auxin-elements'),
46
  'admin_label' => true,
47
  'dependency' => '',
48
  'weight' => '',
@@ -50,10 +50,12 @@ function auxin_get_new_accordion_master_array( $master_array ) {
50
  'edit_field_class' => ''
51
  ),
52
  array(
 
 
53
  'param_name' => 'type',
54
  'type' => 'aux_visual_select',
55
  'def_value' => 'accordion',
56
- 'choices' => array(
57
  'false' => array(
58
  'label' => __('Toggle', 'auxin-elements'),
59
  'image' => AUX_URL . 'images/visual-select/toggle.svg'
@@ -65,8 +67,6 @@ function auxin_get_new_accordion_master_array( $master_array ) {
65
  ),
66
  'holder' => 'dropdown',
67
  'class' => 'type',
68
- 'heading' => __('Type','auxin-elements'),
69
- 'description' => __('Select accordion to show only 1 element opens at a time.','auxin-elements'),
70
  'admin_label' => true,
71
  'dependency' => '',
72
  'weight' => '',
@@ -74,14 +74,14 @@ function auxin_get_new_accordion_master_array( $master_array ) {
74
  'edit_field_class' => ''
75
  ),
76
  array(
 
 
77
  'param_name' => 'content',
78
  'type' => 'textarea_html',
79
  'value' => '',
80
  'def_value' => '',
81
  'holder' => 'div',
82
  'class' => 'content',
83
- 'heading' => __('Content','auxin-elements'),
84
- 'description' => __('Please use below sample for each accordion item.<br>[accordion_section label="Accordion label here" ] accordion content here [/accordion_section]', 'auxin-elements'),
85
  'admin_label' => true,
86
  'dependency' => '',
87
  'weight' => '',
@@ -89,14 +89,14 @@ function auxin_get_new_accordion_master_array( $master_array ) {
89
  'edit_field_class' => ''
90
  ),
91
  array(
 
 
92
  'param_name' => 'extra_classes',
93
  'type' => 'textfield',
94
  'value' => '',
95
  'def_value' => '',
96
  'holder' => 'textfield',
97
  'class' => 'extra_classes',
98
- 'heading' => __('Extra class name','auxin-elements'),
99
- 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'),
100
  'admin_label' => true,
101
  'dependency' => '',
102
  'weight' => '',
36
  'as_child' => '',
37
  'params' => array(
38
  array(
39
+ 'heading' => __('Title','auxin-elements'),
40
+ 'description' => __('Accordion title, leave it empty if you don`t need title.', 'auxin-elements'),
41
  'param_name' => 'title',
42
  'type' => 'textfield',
43
  'value' => '',
44
  'holder' => 'textfield',
45
  'class' => 'title',
 
 
46
  'admin_label' => true,
47
  'dependency' => '',
48
  'weight' => '',
50
  'edit_field_class' => ''
51
  ),
52
  array(
53
+ 'heading' => __('Type','auxin-elements'),
54
+ 'description' => __('Whether to show only 1 element opens at a time or multiple.','auxin-elements'),
55
  'param_name' => 'type',
56
  'type' => 'aux_visual_select',
57
  'def_value' => 'accordion',
58
+ 'choices' => array(
59
  'false' => array(
60
  'label' => __('Toggle', 'auxin-elements'),
61
  'image' => AUX_URL . 'images/visual-select/toggle.svg'
67
  ),
68
  'holder' => 'dropdown',
69
  'class' => 'type',
 
 
70
  'admin_label' => true,
71
  'dependency' => '',
72
  'weight' => '',
74
  'edit_field_class' => ''
75
  ),
76
  array(
77
+ 'heading' => __('Content','auxin-elements'),
78
+ 'description' => sprintf(__('Please use below sample for each accordion item.%s[accordion_section label="Accordion label here" ] accordion content here [/accordion_section]', 'auxin-elements'), '<br>'),
79
  'param_name' => 'content',
80
  'type' => 'textarea_html',
81
  'value' => '',
82
  'def_value' => '',
83
  'holder' => 'div',
84
  'class' => 'content',
 
 
85
  'admin_label' => true,
86
  'dependency' => '',
87
  'weight' => '',
89
  'edit_field_class' => ''
90
  ),
91
  array(
92
+ 'heading' => __('Extra class name','auxin-elements'),
93
+ 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'),
94
  'param_name' => 'extra_classes',
95
  'type' => 'textfield',
96
  'value' => '',
97
  'def_value' => '',
98
  'holder' => 'textfield',
99
  'class' => 'extra_classes',
 
 
100
  'admin_label' => true,
101
  'dependency' => '',
102
  'weight' => '',
includes/elements/audio.php CHANGED
@@ -40,66 +40,68 @@ function auxin_get_audio_master_array( $master_array ) {
40
  'as_child' => '',
41
  'params' => array(
42
  array(
43
- 'param_name' => 'title',
44
- 'type' => 'textfield',
45
- 'value' => '',
46
- 'holder' => 'textfield',
47
- 'class' => 'title',
48
- 'heading' => __('Title','auxin-elements' ),
49
- 'description' => __('The title of audio element.','auxin-elements' ),
50
- 'admin_label' => true,
51
- 'dependency' => '',
52
- 'weight' => '',
53
- 'group' => '' ,
54
- 'edit_field_class' => ''
55
  ),
56
  array(
57
- 'param_name' => 'src',
58
- 'type' => 'aux_select_audio',
59
- 'value' => '',
60
- 'holder' => 'aux_select_audio',
61
- 'class' => 'audio_src',
62
- 'heading' => __('Audio file(MP3 or ogg)','auxin-elements' ),
63
- 'description' => '',
64
- 'admin_label' => true,
65
- 'dependency' => '',
66
- 'weight' => '',
67
- 'group' => '' ,
68
- 'edit_field_class' => ''
69
  ),
70
  array(
 
 
71
  'param_name' => 'loop',
72
  'type' => 'aux_switch',
73
  'def_value' => '0',
74
  'value' => '0',
75
  'class' => '',
76
- 'heading' => __('Repeat the audio','auxin-elements' ),
77
- 'description' => '',
78
  'admin_label' => true,
79
  'dependency' => '',
80
  'weight' => '',
81
- 'group' => '',
82
  'edit_field_class' => ''
83
  ),
84
  array(
 
 
85
  'param_name' => 'autoplay',
86
  'type' => 'aux_switch',
87
  'def_value' => '0',
88
  'value' => '0',
89
  'class' => '',
90
- 'heading' => __('AutoPlay','auxin-elements' ),
91
- 'description' => __('Play the audio file automatically.','auxin-elements' ),
92
  'admin_label' => true,
93
  'dependency' => '',
94
  'weight' => '',
95
- 'group' => '',
96
  'edit_field_class' => ''
97
  ),
98
  array(
 
 
99
  'param_name' => 'skin',
100
  'type' => 'aux_visual_select',
101
  'def_value' => 'dark',
102
- 'choices' => array(
103
  'dark' => array(
104
  'label' => __('Dark', 'auxin-elements'),
105
  'image' => AUX_URL . 'images/visual-select/audio-player-dark.svg'
@@ -111,8 +113,6 @@ function auxin_get_audio_master_array( $master_array ) {
111
  ),
112
  'holder' => 'dropdown',
113
  'class' => 'skin',
114
- 'heading' => __('Skin','auxin-elements' ),
115
- 'description' => __('The skin of audio element','auxin-elements' ),
116
  'admin_label' => true,
117
  'dependency' => '',
118
  'weight' => '',
@@ -120,18 +120,18 @@ function auxin_get_audio_master_array( $master_array ) {
120
  'edit_field_class' => ''
121
  ),
122
  array(
 
 
123
  'param_name' => 'extra_classes',
124
  'type' => 'textfield',
125
  'value' => '',
126
  'def_value' => '',
127
  'holder' => 'textfield',
128
  'class' => 'extra_classes',
129
- 'heading' => __('Extra class name','auxin-elements' ),
130
- 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ),
131
  'admin_label' => true,
132
  'dependency' => '',
133
  'weight' => '',
134
- 'group' => '' ,
135
  'edit_field_class' => ''
136
  )
137
 
40
  'as_child' => '',
41
  'params' => array(
42
  array(
43
+ 'heading' => __('Title','auxin-elements' ),
44
+ 'description' => __('Audio title, leave it empty if you don`t need title.', 'auxin-elements'),
45
+ 'param_name' => 'title',
46
+ 'type' => 'textfield',
47
+ 'value' => '',
48
+ 'holder' => 'textfield',
49
+ 'class' => 'title',
50
+ 'admin_label' => true,
51
+ 'dependency' => '',
52
+ 'weight' => '',
53
+ 'group' => '' ,
54
+ 'edit_field_class' => ''
55
  ),
56
  array(
57
+ 'heading' => __('Audio file(MP3 or ogg)','auxin-elements' ),
58
+ 'description' => '',
59
+ 'param_name' => 'src',
60
+ 'type' => 'aux_select_audio',
61
+ 'value' => '',
62
+ 'holder' => 'aux_select_audio',
63
+ 'class' => 'audio_src',
64
+ 'admin_label' => true,
65
+ 'dependency' => '',
66
+ 'weight' => '',
67
+ 'group' => '' ,
68
+ 'edit_field_class' => ''
69
  ),
70
  array(
71
+ 'heading' => __('Repeat the audio','auxin-elements' ),
72
+ 'description' => '',
73
  'param_name' => 'loop',
74
  'type' => 'aux_switch',
75
  'def_value' => '0',
76
  'value' => '0',
77
  'class' => '',
 
 
78
  'admin_label' => true,
79
  'dependency' => '',
80
  'weight' => '',
81
+ 'group' => 'Extras',
82
  'edit_field_class' => ''
83
  ),
84
  array(
85
+ 'heading' => __('AutoPlay','auxin-elements' ),
86
+ 'description' => __('Play the audio file automatically.','auxin-elements' ),
87
  'param_name' => 'autoplay',
88
  'type' => 'aux_switch',
89
  'def_value' => '0',
90
  'value' => '0',
91
  'class' => '',
 
 
92
  'admin_label' => true,
93
  'dependency' => '',
94
  'weight' => '',
95
+ 'group' => 'Extras',
96
  'edit_field_class' => ''
97
  ),
98
  array(
99
+ 'heading' => __('Skin','auxin-elements' ),
100
+ 'description' => __('The skin of audio element.','auxin-elements' ),
101
  'param_name' => 'skin',
102
  'type' => 'aux_visual_select',
103
  'def_value' => 'dark',
104
+ 'choices' => array(
105
  'dark' => array(
106
  'label' => __('Dark', 'auxin-elements'),
107
  'image' => AUX_URL . 'images/visual-select/audio-player-dark.svg'
113
  ),
114
  'holder' => 'dropdown',
115
  'class' => 'skin',
 
 
116
  'admin_label' => true,
117
  'dependency' => '',
118
  'weight' => '',
120
  'edit_field_class' => ''
121
  ),
122
  array(
123
+ 'heading' => __('Extra class name','auxin-elements' ),
124
+ 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ),
125
  'param_name' => 'extra_classes',
126
  'type' => 'textfield',
127
  'value' => '',
128
  'def_value' => '',
129
  'holder' => 'textfield',
130
  'class' => 'extra_classes',
 
 
131
  'admin_label' => true,
132
  'dependency' => '',
133
  'weight' => '',
134
+ 'group' => 'Extras' ,
135
  'edit_field_class' => ''
136
  )
137
 
includes/elements/button.php CHANGED
@@ -40,20 +40,22 @@ function auxin_get_button_master_array( $master_array ) {
40
  'as_child' => '',
41
  'params' => array(
42
  array(
43
- 'param_name' => 'label',
44
- 'type' => 'textfield',
45
- 'value' => 'Button',
46
- 'holder' => 'textfield',
47
- 'class' => 'label',
48
- 'heading' => __('Button Label','auxin-elements' ),
49
- 'description' => __('The label of button','auxin-elements' ),
50
- 'admin_label' => true,
51
- 'dependency' => '',
52
- 'weight' => '',
53
- 'group' => '' ,
54
- 'edit_field_class' => ''
55
  ),
56
  array(
 
 
57
  'param_name' => 'size',
58
  'type' => 'dropdown',
59
  'def_value' => 'medium',
@@ -66,8 +68,6 @@ function auxin_get_button_master_array( $master_array ) {
66
  ),
67
  'holder' => 'dropdown',
68
  'class' => 'round',
69
- 'heading' => __('Button Size','auxin-elements' ),
70
- 'description' => '',
71
  'admin_label' => true,
72
  'dependency' => '',
73
  'weight' => '',
@@ -76,20 +76,20 @@ function auxin_get_button_master_array( $master_array ) {
76
  ),
77
 
78
  array(
 
 
79
  'param_name' => 'border',
80
  'type' => 'aux_visual_select',
81
  'value' => '',
82
  'holder' => 'dropdown',
83
  'class' => 'border',
84
- 'heading' => __('Button shape style','auxin-elements' ),
85
- 'description' => '',
86
  'admin_label' => true,
87
  'dependency' => '',
88
  'weight' => '',
89
- 'group' => '' ,
90
  'edit_field_class' => '',
91
- 'choices' => array(
92
- '' => array(
93
  'label' => __('Box', 'auxin-elements' ),
94
  'image' => AUX_URL . 'images/visual-select/button-normal.svg'
95
  ),
@@ -105,24 +105,24 @@ function auxin_get_button_master_array( $master_array ) {
105
  ),
106
 
107
  array(
 
 
108
  'param_name' => 'style',
109
  'type' => 'aux_visual_select',
110
  'value' => '',
111
  'holder' => 'dropdown',
112
  'class' => 'style',
113
- 'heading' => __('Button style','auxin-elements' ),
114
- 'description' => '',
115
  'admin_label' => true,
116
  'dependency' => '',
117
  'weight' => '',
118
- 'group' => '' ,
119
  'edit_field_class' => '',
120
  'choices' => array(
121
- '' => array(
122
  'label' => __('Normal', 'auxin-elements' ),
123
  'image' => AUX_URL . 'images/visual-select/button-normal.svg'
124
  ),
125
- '3d' => array(
126
  'label' => __('3D', 'auxin-elements' ),
127
  'image' => AUX_URL . 'images/visual-select/button-3d.svg'
128
  ),
@@ -134,14 +134,14 @@ function auxin_get_button_master_array( $master_array ) {
134
  ),
135
 
136
  array(
 
 
137
  'param_name' => 'uppercase',
138
  'type' => 'aux_switch',
139
  'def_value' => '',
140
- 'value' => '0',
141
  'holder' => 'dropdown',
142
  'class' => 'showheader',
143
- 'heading' => __('Uppercase label','auxin-elements' ),
144
- 'description' => '',
145
  'admin_label' => true,
146
  'dependency' => '',
147
  'weight' => '',
@@ -149,14 +149,14 @@ function auxin_get_button_master_array( $master_array ) {
149
  'edit_field_class' => ''
150
  ),
151
  array(
 
 
152
  'param_name' => 'dark',
153
  'type' => 'aux_switch',
154
  'def_value' => '',
155
  'value' => '0',
156
  'holder' => 'dropdown',
157
  'class' => 'showheader',
158
- 'heading' => __('Darken the label','auxin-elements' ),
159
- 'description' => __('Darken label of button while mouse over it.','auxin-elements' ),
160
  'admin_label' => true,
161
  'dependency' => '',
162
  'weight' => '',
@@ -165,14 +165,14 @@ function auxin_get_button_master_array( $master_array ) {
165
  ),
166
 
167
  array(
 
 
168
  'param_name' => 'icon',
169
  'type' => 'iconpicker',
170
  'def_value' => '',
171
  'value' => '',
172
  'holder' => 'icon',
173
  'class' => 'icon-name',
174
- 'heading' => __('Icon for button','auxin-elements' ),
175
- 'description' => '',
176
  'admin_label' => true,
177
  'dependency' => '',
178
  'weight' => '',
@@ -180,21 +180,21 @@ function auxin_get_button_master_array( $master_array ) {
180
  'edit_field_class' => ''
181
  ),
182
  array(
 
 
183
  'param_name' => 'icon_align',
184
  'type' => 'dropdown',
185
  'def_value' => '',
186
  'value' => array(
187
- '' => __('Default' , 'auxin-elements' ),
188
- 'left' => __('Left' , 'auxin-elements' ),
189
- 'right' => __('Right' , 'auxin-elements' ),
190
- 'over' => __('Over' , 'auxin-elements' ),
191
- 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
192
- 'right-animate' => __('Animate from Right' , 'auxin-elements' )
193
  ),
194
  'holder' => 'dropdown',
195
  'class' => 'icon-align',
196
- 'heading' => __('Icon alignment','auxin-elements' ),
197
- 'description' => '',
198
  'admin_label' => true,
199
  'dependency' => '',
200
  'weight' => '',
@@ -202,47 +202,47 @@ function auxin_get_button_master_array( $master_array ) {
202
  'edit_field_class' => ''
203
  ),
204
  array(
205
- 'param_name' => 'color_name',
206
- 'type' => 'dropdown',
207
- 'def_value' => 'carmine-pink',
208
- 'value' => auxin_get_famous_colors_list(),
209
- 'holder' => '',
210
- 'class' => 'color',
211
- 'heading' => __('Color of Button','auxin-elements' ),
212
- 'description' => '',
213
- 'admin_label' => true,
214
- 'dependency' => '',
215
- 'weight' => '',
216
- 'group' => '' ,
217
  'edit_field_class' => ''
218
  ),
219
  array(
220
- 'param_name' => 'link',
221
- 'type' => 'textfield',
222
- 'value' => '',
223
- 'def_value' => '',
224
- 'holder' => 'textfield',
225
- 'class' => 'link',
226
- 'heading' => __('Link','auxin-elements' ),
227
- 'description' => '',
228
- 'admin_label' => true,
229
- 'dependency' => '',
230
- 'weight' => '',
231
- 'group' => '' ,
232
  'edit_field_class' => ''
233
  ),
234
  array(
 
 
235
  'param_name' => 'target',
236
  'type' => 'dropdown',
237
  'def_value' => '_self',
238
  'value' => array(
239
- '_self' => __('Current page' , 'auxin-elements' ),
240
  '_blank' => __('New page', 'auxin-elements' )
241
  ),
242
  'holder' => 'dropdown',
243
  'class' => 'target',
244
- 'heading' => __('Open link in','auxin-elements' ),
245
- 'description' => '',
246
  'admin_label' => true,
247
  'dependency' => '',
248
  'weight' => '',
@@ -262,11 +262,11 @@ function auxin_widget_button_callback( $atts, $shortcode_content = null ){
262
 
263
  // Defining default attributes
264
  $default_atts = array(
265
- 'label' => '',
266
  'size' => 'medium',
267
  'border' => '',
268
  'style' => '',
269
- 'uppercase' => '0',
270
  'dark' => '0',
271
  'icon' => '',
272
  'icon_align' => '',
40
  'as_child' => '',
41
  'params' => array(
42
  array(
43
+ 'heading' => __('Button Label','auxin-elements' ),
44
+ 'description' => __('The label of button.','auxin-elements' ),
45
+ 'param_name' => 'label',
46
+ 'type' => 'textfield',
47
+ 'value' => 'Button',
48
+ 'holder' => 'textfield',
49
+ 'class' => 'label',
50
+ 'admin_label' => true,
51
+ 'dependency' => '',
52
+ 'weight' => '',
53
+ 'group' => '' ,
54
+ 'edit_field_class' => ''
55
  ),
56
  array(
57
+ 'heading' => __('Button Size','auxin-elements' ),
58
+ 'description' => '',
59
  'param_name' => 'size',
60
  'type' => 'dropdown',
61
  'def_value' => 'medium',
68
  ),
69
  'holder' => 'dropdown',
70
  'class' => 'round',
 
 
71
  'admin_label' => true,
72
  'dependency' => '',
73
  'weight' => '',
76
  ),
77
 
78
  array(
79
+ 'heading' => __('Button shape style','auxin-elements' ),
80
+ 'description' => '',
81
  'param_name' => 'border',
82
  'type' => 'aux_visual_select',
83
  'value' => '',
84
  'holder' => 'dropdown',
85
  'class' => 'border',
 
 
86
  'admin_label' => true,
87
  'dependency' => '',
88
  'weight' => '',
89
+ 'group' => 'Style' ,
90
  'edit_field_class' => '',
91
+ 'choices' => array(
92
+ '' => array(
93
  'label' => __('Box', 'auxin-elements' ),
94
  'image' => AUX_URL . 'images/visual-select/button-normal.svg'
95
  ),
105
  ),
106
 
107
  array(
108
+ 'heading' => __('Button style','auxin-elements' ),
109