Astra Customizer Reset - Version 1.0.1

Version Description

  • Fix: The stored version number of the theme is not resetted now. This will still be retained after reset.
Download this release

Release Info

Developer Nikschavan
Plugin Icon 128x128 Astra Customizer Reset
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

assets/js/customizer-reset.js CHANGED
@@ -1,72 +1,72 @@
1
- /**
2
- * Astra Theme Customizer Reset
3
- *
4
- * @package Astra Customizer Reset
5
- * @since 1.0.0
6
- */
7
-
8
- (function($) {
9
-
10
- /**
11
- * Theme Customizer enhancements for a better user experience.
12
- *
13
- * Contains handlers to make Theme Customizer preview reload changes asynchronously.
14
- *
15
- * => Contents
16
- *
17
- * - Site title and description.
18
- * - Colors
19
- */
20
-
21
- /**
22
- * Reset "Astra Theme" Customizer Options
23
- */
24
- jQuery(document).ready(function($) {
25
-
26
- var container = jQuery('#customize-header-actions'),
27
- button = jQuery('<input type="submit" name="astra-reset" id="astra-reset" class="button-secondary button">')
28
- .attr('value', astraThemeCustomizerReset.customizer.reset.stringReset)
29
- .css({
30
- 'float': 'right',
31
- 'margin-top': '9px'
32
- });
33
-
34
- // Process on click.
35
- button.on('click', function(event) {
36
- event.preventDefault();
37
-
38
- // Reset all confirm?
39
- if (confirm(astraThemeCustomizerReset.customizer.reset.stringConfirm)) {
40
-
41
- // Enable loader.
42
- container.find('.spinner').addClass('is-active');
43
-
44
- var data = {
45
- wp_customize: 'on',
46
- action: 'astra_theme_customizer_reset',
47
- nonce: astraThemeCustomizerReset.customizer.reset.nonce
48
- };
49
-
50
- // Disable button.
51
- button.attr('disabled', 'disabled');
52
-
53
- // Process AJAX.
54
- jQuery.post(ajaxurl, data, function(result) {
55
-
56
- // If pass then trigger the state 'saved'.
57
- if ('pass' === result.data) {
58
- wp.customize.state('saved').set(true);
59
- }
60
-
61
- var Url = window.location.href;
62
- Url = Url.split("?")[0];
63
- window.location.href = Url;
64
-
65
- });
66
- }
67
- });
68
-
69
- container.append(button);
70
- });
71
-
72
- })(jQuery);
1
+ /**
2
+ * Astra Theme Customizer Reset
3
+ *
4
+ * @package Astra Customizer Reset
5
+ * @since 1.0.0
6
+ */
7
+
8
+ (function($) {
9
+
10
+ /**
11
+ * Theme Customizer enhancements for a better user experience.
12
+ *
13
+ * Contains handlers to make Theme Customizer preview reload changes asynchronously.
14
+ *
15
+ * => Contents
16
+ *
17
+ * - Site title and description.
18
+ * - Colors
19
+ */
20
+
21
+ /**
22
+ * Reset "Astra Theme" Customizer Options
23
+ */
24
+ jQuery(document).ready(function($) {
25
+
26
+ var container = jQuery('#customize-header-actions'),
27
+ button = jQuery('<input type="submit" name="astra-reset" id="astra-reset" class="button-secondary button">')
28
+ .attr('value', astraThemeCustomizerReset.customizer.reset.stringReset)
29
+ .css({
30
+ 'float': 'right',
31
+ 'margin-top': '9px'
32
+ });
33
+
34
+ // Process on click.
35
+ button.on('click', function(event) {
36
+ event.preventDefault();
37
+
38
+ // Reset all confirm?
39
+ if (confirm(astraThemeCustomizerReset.customizer.reset.stringConfirm)) {
40
+
41
+ // Enable loader.
42
+ container.find('.spinner').addClass('is-active');
43
+
44
+ var data = {
45
+ wp_customize: 'on',
46
+ action: 'astra_theme_customizer_reset',
47
+ nonce: astraThemeCustomizerReset.customizer.reset.nonce
48
+ };
49
+
50
+ // Disable button.
51
+ button.attr('disabled', 'disabled');
52
+
53
+ // Process AJAX.
54
+ jQuery.post(ajaxurl, data, function(result) {
55
+
56
+ // If pass then trigger the state 'saved'.
57
+ if ('pass' === result.data) {
58
+ wp.customize.state('saved').set(true);
59
+ }
60
+
61
+ var Url = window.location.href;
62
+ Url = Url.split("?")[0];
63
+ window.location.href = Url;
64
+
65
+ });
66
+ }
67
+ });
68
+
69
+ container.append(button);
70
+ });
71
+
72
+ })(jQuery);
class-astra-theme-customizer-reset.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Plugin Name: Reset Astra Customizer
4
  * Plugin URI: https://wpastra.com/
5
  * Description: Reset the Astra theme customizer options from customizer interface.
6
  * Version: 1.0.0
@@ -8,7 +8,7 @@
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-customizer-reset
10
  *
11
- * @package Reset Astra Customizer
12
  */
13
 
14
  define( 'ASTRA_THEME_CUSTOMIZER_RESET_URI', plugins_url( '/', __FILE__ ) );
@@ -60,9 +60,9 @@ if ( ! class_exists( 'Astra_Theme_Customizer_Reset' ) ) :
60
  */
61
  public function __construct() {
62
 
63
- add_action( 'wp_ajax_astra_theme_customizer_reset', array( $this, 'ajax_customizer_reset' ) );
64
- add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) );
65
- add_action( 'customize_register', array( $this, 'customize_register' ) );
66
 
67
  }
68
 
@@ -94,8 +94,21 @@ if ( ! class_exists( 'Astra_Theme_Customizer_Reset' ) ) :
94
  check_ajax_referer( 'astra-theme-customizer-reset', 'nonce' );
95
 
96
  // Reset option 'astra-settings'.
97
- if( defined('ASTRA_THEME_SETTINGS') ) {
98
- delete_option( ASTRA_THEME_SETTINGS );
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
  wp_send_json_error( 'pass' );
1
  <?php
2
  /**
3
+ * Plugin Name: Astra Customizer Reset
4
  * Plugin URI: https://wpastra.com/
5
  * Description: Reset the Astra theme customizer options from customizer interface.
6
  * Version: 1.0.0
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-customizer-reset
10
  *
11
+ * @package Astra Customizer Reset
12
  */
13
 
14
  define( 'ASTRA_THEME_CUSTOMIZER_RESET_URI', plugins_url( '/', __FILE__ ) );
60
  */
61
  public function __construct() {
62
 
63
+ add_action( 'wp_ajax_astra_theme_customizer_reset', array( $this, 'ajax_customizer_reset' ) );
64
+ add_action( 'customize_controls_enqueue_scripts', array( $this, 'controls_scripts' ) );
65
+ add_action( 'customize_register', array( $this, 'customize_register' ) );
66
 
67
  }
68
 
94
  check_ajax_referer( 'astra-theme-customizer-reset', 'nonce' );
95
 
96
  // Reset option 'astra-settings'.
97
+ if ( defined( 'ASTRA_THEME_SETTINGS' ) ) {
98
+
99
+ $default_setting = array();
100
+ if ( defined( 'ASTRA_THEME_VERSION' ) ) {
101
+ $default_setting['theme-auto-version'] = ASTRA_THEME_VERSION;
102
+ }
103
+ if ( defined( 'ASTRA_EXT_VER' ) ) {
104
+ $default_setting['astra-addon-auto-version'] = ASTRA_EXT_VER;
105
+ }
106
+
107
+ if ( ! empty( $default_setting ) ) {
108
+ update_option( ASTRA_THEME_SETTINGS, $default_setting );
109
+ } else {
110
+ delete_option( ASTRA_THEME_SETTINGS );
111
+ }
112
  }
113
 
114
  wp_send_json_error( 'pass' );
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
- === Reset Astra Customizer ===
2
- Contributors: brainstormforce, Mahesh901122, dineshc
3
  Tags: astra theme, customizer reset, reset astra customizer
4
- Tested up to: 4.8
5
- Stable tag: trunk
6
  Requires at least: 4.4
7
 
8
  Reset the Astra theme customizer options from customizer interface.
@@ -12,6 +12,9 @@ The Customizer Astra Theme Customizer reset plugin allows you to reset your Astr
12
 
13
  == Changelog ==
14
 
 
 
 
15
  = 1.0.0 =
16
  * Initial release.
17
 
1
+ === Astra Customizer Reset ===
2
+ Contributors: brainstormforce
3
  Tags: astra theme, customizer reset, reset astra customizer
4
+ Tested up to: 5.1
5
+ Stable tag: 1.0.1
6
  Requires at least: 4.4
7
 
8
  Reset the Astra theme customizer options from customizer interface.
12
 
13
  == Changelog ==
14
 
15
+ = 1.0.1 =
16
+ * Fix: The stored version number of the theme is not resetted now. This will still be retained after reset.
17
+
18
  = 1.0.0 =
19
  * Initial release.
20