Version Description
Download this release
Release Info
Developer | stevengliebe |
Plugin | Widget Importer & Exporter |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.3.1
- includes/import.php +15 -10
- includes/page.php +32 -11
- readme.txt +9 -8
- widget-importer-exporter.php +1 -1
includes/import.php
CHANGED
@@ -31,8 +31,13 @@ function wie_upload_import_file() {
|
|
31 |
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
32 |
if ( 'wie' != $wp_filetype['ext'] && ! wp_match_mime_types( 'wie', $wp_filetype['type'] ) ) {
|
33 |
wp_die(
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
36 |
array( 'back_link' => true )
|
37 |
);
|
38 |
}
|
@@ -74,7 +79,7 @@ function wie_process_import_file( $file ) {
|
|
74 |
// File exists?
|
75 |
if ( ! file_exists( $file ) ) {
|
76 |
wp_die(
|
77 |
-
|
78 |
'',
|
79 |
array( 'back_link' => true )
|
80 |
);
|
@@ -109,7 +114,7 @@ function wie_import_data( $data ) {
|
|
109 |
// If no data or could not decode
|
110 |
if ( empty( $data ) || ! is_object( $data ) ) {
|
111 |
wp_die(
|
112 |
-
|
113 |
'',
|
114 |
array( 'back_link' => true )
|
115 |
);
|
@@ -151,7 +156,7 @@ function wie_import_data( $data ) {
|
|
151 |
$sidebar_available = false;
|
152 |
$use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme
|
153 |
$sidebar_message_type = 'error';
|
154 |
-
$sidebar_message =
|
155 |
}
|
156 |
|
157 |
// Result for sidebar
|
@@ -173,7 +178,7 @@ function wie_import_data( $data ) {
|
|
173 |
if ( ! $fail && ! isset( $available_widgets[$id_base] ) ) {
|
174 |
$fail = true;
|
175 |
$widget_message_type = 'error';
|
176 |
-
$widget_message =
|
177 |
}
|
178 |
|
179 |
// Filter to modify settings object before conversion to array and import
|
@@ -209,7 +214,7 @@ function wie_import_data( $data ) {
|
|
209 |
|
210 |
$fail = true;
|
211 |
$widget_message_type = 'warning';
|
212 |
-
$widget_message =
|
213 |
|
214 |
break;
|
215 |
|
@@ -271,17 +276,17 @@ function wie_import_data( $data ) {
|
|
271 |
// Success message
|
272 |
if ( $sidebar_available ) {
|
273 |
$widget_message_type = 'success';
|
274 |
-
$widget_message =
|
275 |
} else {
|
276 |
$widget_message_type = 'warning';
|
277 |
-
$widget_message =
|
278 |
}
|
279 |
|
280 |
}
|
281 |
|
282 |
// Result for widget instance
|
283 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['name'] = isset( $available_widgets[$id_base]['name'] ) ? $available_widgets[$id_base]['name'] : $id_base; // widget name or ID if name not available (not supported by site)
|
284 |
-
$results[$sidebar_id]['widgets'][$widget_instance_id]['title'] = ! empty( $widget['title'] ) ? $widget['title'] :
|
285 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['message_type'] = $widget_message_type;
|
286 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['message'] = $widget_message;
|
287 |
|
31 |
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
32 |
if ( 'wie' != $wp_filetype['ext'] && ! wp_match_mime_types( 'wie', $wp_filetype['type'] ) ) {
|
33 |
wp_die(
|
34 |
+
wp_kses(
|
35 |
+
__( 'You must upload a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ),
|
36 |
+
array(
|
37 |
+
'b' => array()
|
38 |
+
)
|
39 |
+
),
|
40 |
+
'',
|
41 |
array( 'back_link' => true )
|
42 |
);
|
43 |
}
|
79 |
// File exists?
|
80 |
if ( ! file_exists( $file ) ) {
|
81 |
wp_die(
|
82 |
+
esc_html__( 'Import file could not be found. Please try again.', 'widget-importer-exporter' ),
|
83 |
'',
|
84 |
array( 'back_link' => true )
|
85 |
);
|
114 |
// If no data or could not decode
|
115 |
if ( empty( $data ) || ! is_object( $data ) ) {
|
116 |
wp_die(
|
117 |
+
esc_html__( 'Import data could not be read. Please try a different file.', 'widget-importer-exporter' ),
|
118 |
'',
|
119 |
array( 'back_link' => true )
|
120 |
);
|
156 |
$sidebar_available = false;
|
157 |
$use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme
|
158 |
$sidebar_message_type = 'error';
|
159 |
+
$sidebar_message = esc_html__( 'Sidebar does not exist in theme (using Inactive)', 'widget-importer-exporter' );
|
160 |
}
|
161 |
|
162 |
// Result for sidebar
|
178 |
if ( ! $fail && ! isset( $available_widgets[$id_base] ) ) {
|
179 |
$fail = true;
|
180 |
$widget_message_type = 'error';
|
181 |
+
$widget_message = esc_html__( 'Site does not support widget', 'widget-importer-exporter' ); // explain why widget not imported
|
182 |
}
|
183 |
|
184 |
// Filter to modify settings object before conversion to array and import
|
214 |
|
215 |
$fail = true;
|
216 |
$widget_message_type = 'warning';
|
217 |
+
$widget_message = esc_html__( 'Widget already exists', 'widget-importer-exporter' ); // explain why widget not imported
|
218 |
|
219 |
break;
|
220 |
|
276 |
// Success message
|
277 |
if ( $sidebar_available ) {
|
278 |
$widget_message_type = 'success';
|
279 |
+
$widget_message = esc_html__( 'Imported', 'widget-importer-exporter' );
|
280 |
} else {
|
281 |
$widget_message_type = 'warning';
|
282 |
+
$widget_message = esc_html__( 'Imported to Inactive', 'widget-importer-exporter' );
|
283 |
}
|
284 |
|
285 |
}
|
286 |
|
287 |
// Result for widget instance
|
288 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['name'] = isset( $available_widgets[$id_base]['name'] ) ? $available_widgets[$id_base]['name'] : $id_base; // widget name or ID if name not available (not supported by site)
|
289 |
+
$results[$sidebar_id]['widgets'][$widget_instance_id]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : esc_html__( 'No Title', 'widget-importer-exporter' ); // show "No Title" if widget instance is untitled
|
290 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['message_type'] = $widget_message_type;
|
291 |
$results[$sidebar_id]['widgets'][$widget_instance_id]['message'] = $widget_message;
|
292 |
|
includes/page.php
CHANGED
@@ -24,8 +24,8 @@ function wie_add_import_export_page() {
|
|
24 |
|
25 |
// Add page
|
26 |
$page_hook = add_management_page(
|
27 |
-
|
28 |
-
|
29 |
'manage_options', // capability
|
30 |
'widget-importer-exporter', // menu slug
|
31 |
'wie_import_export_page_content' // callback for displaying page content
|
@@ -60,7 +60,7 @@ function wie_import_export_page_content() {
|
|
60 |
|
61 |
<?php screen_icon(); ?>
|
62 |
|
63 |
-
<h2><?php
|
64 |
|
65 |
<?php
|
66 |
// Show import results if have them
|
@@ -70,10 +70,17 @@ function wie_import_export_page_content() {
|
|
70 |
}
|
71 |
?>
|
72 |
|
73 |
-
<h3 class="title"><?php
|
74 |
|
75 |
<p>
|
76 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</p>
|
78 |
|
79 |
<form method="post" enctype="multipart/form-data">
|
@@ -82,7 +89,7 @@ function wie_import_export_page_content() {
|
|
82 |
|
83 |
<input type="file" name="wie_import_file" id="wie-import-file" />
|
84 |
|
85 |
-
<?php submit_button(
|
86 |
|
87 |
</form>
|
88 |
|
@@ -93,14 +100,21 @@ function wie_import_export_page_content() {
|
|
93 |
<br />
|
94 |
<?php endif; ?>
|
95 |
|
96 |
-
<h3 class="title"><?php
|
97 |
|
98 |
<p>
|
99 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
</p>
|
101 |
|
102 |
<p class="submit">
|
103 |
-
<a href="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] . '&export=1' ) ); ?>" id="wie-export-button" class="button button-primary"><?php
|
104 |
</p>
|
105 |
|
106 |
</div>
|
@@ -142,12 +156,19 @@ function wie_show_import_results() {
|
|
142 |
|
143 |
?>
|
144 |
|
145 |
-
<h3 class="title"><?php
|
146 |
|
147 |
<p>
|
148 |
<?php
|
149 |
printf(
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
admin_url( 'widgets.php' ),
|
152 |
admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] )
|
153 |
);
|
24 |
|
25 |
// Add page
|
26 |
$page_hook = add_management_page(
|
27 |
+
esc_html__( 'Widget Importer & Exporter', 'widget-importer-exporter' ), // page title
|
28 |
+
esc_html__( 'Widget Importer & Exporter', 'widget-importer-exporter' ), // menu title
|
29 |
'manage_options', // capability
|
30 |
'widget-importer-exporter', // menu slug
|
31 |
'wie_import_export_page_content' // callback for displaying page content
|
60 |
|
61 |
<?php screen_icon(); ?>
|
62 |
|
63 |
+
<h2><?php esc_html_e( 'Widget Importer & Exporter', 'widget-importer-exporter' ); ?></h2>
|
64 |
|
65 |
<?php
|
66 |
// Show import results if have them
|
70 |
}
|
71 |
?>
|
72 |
|
73 |
+
<h3 class="title"><?php echo esc_html_x( 'Import Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
|
74 |
|
75 |
<p>
|
76 |
+
<?php
|
77 |
+
echo wp_kses(
|
78 |
+
__( 'Please select a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ),
|
79 |
+
array(
|
80 |
+
'b' => array()
|
81 |
+
)
|
82 |
+
);
|
83 |
+
?>
|
84 |
</p>
|
85 |
|
86 |
<form method="post" enctype="multipart/form-data">
|
89 |
|
90 |
<input type="file" name="wie_import_file" id="wie-import-file" />
|
91 |
|
92 |
+
<?php submit_button( esc_html_x( 'Import Widgets', 'button', 'widget-importer-exporter' ) ); ?>
|
93 |
|
94 |
</form>
|
95 |
|
100 |
<br />
|
101 |
<?php endif; ?>
|
102 |
|
103 |
+
<h3 class="title"><?php echo esc_html_x( 'Export Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
|
104 |
|
105 |
<p>
|
106 |
+
<?php
|
107 |
+
echo wp_kses(
|
108 |
+
__( 'Click below to generate a <b>.wie</b> file for all active widgets.', 'widget-importer-exporter' ),
|
109 |
+
array(
|
110 |
+
'b' => array()
|
111 |
+
)
|
112 |
+
);
|
113 |
+
?>
|
114 |
</p>
|
115 |
|
116 |
<p class="submit">
|
117 |
+
<a href="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] . '&export=1' ) ); ?>" id="wie-export-button" class="button button-primary"><?php echo esc_html_x( 'Export Widgets', 'button', 'widget-importer-exporter' ); ?></a>
|
118 |
</p>
|
119 |
|
120 |
</div>
|
156 |
|
157 |
?>
|
158 |
|
159 |
+
<h3 class="title"><?php echo esc_html_x( 'Import Results', 'heading', 'widget-importer-exporter' ); ?></h3>
|
160 |
|
161 |
<p>
|
162 |
<?php
|
163 |
printf(
|
164 |
+
wp_kses(
|
165 |
+
__( 'You can manage your <a href="%s">Widgets</a> or <a href="%s">Go Back</a>.', 'widget-importer-exporter' ),
|
166 |
+
array(
|
167 |
+
'a' => array(
|
168 |
+
'href' => array()
|
169 |
+
)
|
170 |
+
)
|
171 |
+
),
|
172 |
admin_url( 'widgets.php' ),
|
173 |
admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] )
|
174 |
);
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Widget Importer & Exporter ===
|
2 |
Contributors: stevengliebe, churchthemes
|
3 |
-
Tags: widgets, widget, importer, exporter, import, export, backup
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -28,11 +28,12 @@ Widget Importer & Exporter can create an export file (in JSON format with .wie e
|
|
28 |
The following translations are available.
|
29 |
|
30 |
* English (default)
|
31 |
-
* Spanish
|
32 |
-
* French
|
33 |
-
* German
|
34 |
-
*
|
35 |
-
*
|
|
|
36 |
* More at [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/widget-importer-exporter)
|
37 |
|
38 |
= Developers =
|
1 |
=== Widget Importer & Exporter ===
|
2 |
Contributors: stevengliebe, churchthemes
|
3 |
+
Tags: widgets, widget, importer, exporter, import, export, widget import, widget export, widget importer, widget exporter, backup, migration
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.6
|
6 |
+
Stable tag: 1.3.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
28 |
The following translations are available.
|
29 |
|
30 |
* English (default)
|
31 |
+
* Spanish by [Eduardo Larequi](http://www.labitacoradeltigre.com/)
|
32 |
+
* French by [French Translation Team](https://make.wordpress.org/polyglots/teams/?locale=fr_FR)
|
33 |
+
* German by [Alexander Kesting](http://alex-dune.de)
|
34 |
+
* Italian by [venerdi](https://profiles.wordpress.org/venerdi/)
|
35 |
+
* Dutch by [Paul Backus](http://backups.nl/)
|
36 |
+
* Serbian by Borisa Djuraskovic of [Web Hosting Hub](http://www.webhostinghub.com)
|
37 |
* More at [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/widget-importer-exporter)
|
38 |
|
39 |
= Developers =
|
widget-importer-exporter.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Widget Importer & Exporter
|
4 |
* Plugin URI: https://github.com/stevengliebe/widget-importer-exporter
|
5 |
* Description: Imports and exports widgets.
|
6 |
-
* Version: 1.3
|
7 |
* Author: Steven Gliebe
|
8 |
* Author URI: http://stevengliebe.com
|
9 |
* License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
3 |
* Plugin Name: Widget Importer & Exporter
|
4 |
* Plugin URI: https://github.com/stevengliebe/widget-importer-exporter
|
5 |
* Description: Imports and exports widgets.
|
6 |
+
* Version: 1.3.1
|
7 |
* Author: Steven Gliebe
|
8 |
* Author URI: http://stevengliebe.com
|
9 |
* License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|