Version Description
Download this release
Release Info
Developer | csloisel |
Plugin | Widget Settings Importer/Exporter |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.5.0
- class-widget-data.php +25 -0
- readme.txt +2 -2
- widget-data.js +3 -2
- widget-data.php +1 -1
class-widget-data.php
CHANGED
@@ -17,6 +17,21 @@ class Widget_Data {
|
|
17 |
add_action( 'wp_ajax_import_widget_data', array( __CLASS__, 'ajax_import_widget_data' ) );
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Register admin pages
|
22 |
*/
|
@@ -186,6 +201,11 @@ class Widget_Data {
|
|
186 |
<?php endforeach; ?>
|
187 |
<?php endif; ?>
|
188 |
</div> <!-- end sidebars -->
|
|
|
|
|
|
|
|
|
|
|
189 |
<input class="button-bottom button-primary" type="submit" name="import-widgets" id="import-widgets" value="Import Widget Settings" />
|
190 |
</form>
|
191 |
</div>
|
@@ -342,6 +362,11 @@ class Widget_Data {
|
|
342 |
$response->send();
|
343 |
}
|
344 |
|
|
|
|
|
|
|
|
|
|
|
345 |
$json_data = file_get_contents( $import_file );
|
346 |
$json_data = json_decode( $json_data, true );
|
347 |
$sidebar_data = $json_data[0];
|
17 |
add_action( 'wp_ajax_import_widget_data', array( __CLASS__, 'ajax_import_widget_data' ) );
|
18 |
}
|
19 |
|
20 |
+
private static function clear_widgets() {
|
21 |
+
$sidebars = wp_get_sidebars_widgets();
|
22 |
+
$inactive = isset($sidebars['wp_inactive_widgets']) ? $sidebars['wp_inactive_widgets'] : array();
|
23 |
+
|
24 |
+
unset($sidebars['wp_inactive_widgets']);
|
25 |
+
|
26 |
+
foreach ( $sidebars as $sidebar => $widgets ) {
|
27 |
+
$inactive = array_merge($inactive, $widgets);
|
28 |
+
$sidebars[$sidebar] = array();
|
29 |
+
}
|
30 |
+
|
31 |
+
$sidebars['wp_inactive_widgets'] = $inactive;
|
32 |
+
wp_set_sidebars_widgets( $sidebars );
|
33 |
+
}
|
34 |
+
|
35 |
/**
|
36 |
* Register admin pages
|
37 |
*/
|
201 |
<?php endforeach; ?>
|
202 |
<?php endif; ?>
|
203 |
</div> <!-- end sidebars -->
|
204 |
+
<p>
|
205 |
+
<input type="checkbox" name="clear_current" id="clear-current" checked=checked value="true" />
|
206 |
+
<label for="clear-current">Clear Current Widgets Before Import</label><br/>
|
207 |
+
<span class="description">All active widgets will be moved to inactive</span>
|
208 |
+
</p>
|
209 |
<input class="button-bottom button-primary" type="submit" name="import-widgets" id="import-widgets" value="Import Widget Settings" />
|
210 |
</form>
|
211 |
</div>
|
362 |
$response->send();
|
363 |
}
|
364 |
|
365 |
+
$clear_current = isset( $_POST['clear_current'] );
|
366 |
+
|
367 |
+
if ( $clear_current )
|
368 |
+
self::clear_widgets();
|
369 |
+
|
370 |
$json_data = file_get_contents( $import_file );
|
371 |
$json_data = json_decode( $json_data, true );
|
372 |
$sidebar_data = $json_data[0];
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: kevinlangleyjr, smccafferty, markparolisi, voceplatforms
|
3 |
Tags: widget, import, export
|
4 |
Requires at least: 2.8
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
2 |
Contributors: kevinlangleyjr, smccafferty, markparolisi, voceplatforms
|
3 |
Tags: widget, import, export
|
4 |
Requires at least: 2.8
|
5 |
+
Tested up to: 4.1
|
6 |
+
Stable tag: 1.5.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
widget-data.js
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
*/
|
72 |
$('form#import-widget-data').submit(function(e){
|
73 |
e.preventDefault();
|
74 |
-
|
75 |
if (widgetCheckboxes.filter(':checked').length === 0) {
|
76 |
widgetSelectionError.fadeIn('slow').delay(2000).fadeOut('slow');
|
77 |
return false;
|
@@ -91,7 +91,7 @@
|
|
91 |
});
|
92 |
|
93 |
/**
|
94 |
-
*
|
95 |
*/
|
96 |
fileInput.change(function(){
|
97 |
var outputText = $('#upload-widget-data .file-name'),
|
@@ -100,5 +100,6 @@
|
|
100 |
|
101 |
outputText.val(filename);
|
102 |
});
|
|
|
103 |
});
|
104 |
}(window.jQuery);
|
71 |
*/
|
72 |
$('form#import-widget-data').submit(function(e){
|
73 |
e.preventDefault();
|
74 |
+
|
75 |
if (widgetCheckboxes.filter(':checked').length === 0) {
|
76 |
widgetSelectionError.fadeIn('slow').delay(2000).fadeOut('slow');
|
77 |
return false;
|
91 |
});
|
92 |
|
93 |
/**
|
94 |
+
*
|
95 |
*/
|
96 |
fileInput.change(function(){
|
97 |
var outputText = $('#upload-widget-data .file-name'),
|
100 |
|
101 |
outputText.val(filename);
|
102 |
});
|
103 |
+
|
104 |
});
|
105 |
}(window.jQuery);
|
widget-data.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Description: Adds functionality to export and import widget data
|
5 |
Author: Voce Communications - Kevin Langley, Sean McCafferty, Mark Parolisi
|
6 |
Author URI: http://vocecommunications.com
|
7 |
-
Version: 1.
|
8 |
* ******************************************************************
|
9 |
Copyright 2011-2011 Voce Communications
|
10 |
|
4 |
Description: Adds functionality to export and import widget data
|
5 |
Author: Voce Communications - Kevin Langley, Sean McCafferty, Mark Parolisi
|
6 |
Author URI: http://vocecommunications.com
|
7 |
+
Version: 1.5.0
|
8 |
* ******************************************************************
|
9 |
Copyright 2011-2011 Voce Communications
|
10 |
|