Widget Importer & Exporter - Version 1.6

Version Description

Download this release

Release Info

Developer stevengliebe
Plugin Icon 128x128 Widget Importer & Exporter
Version 1.6
Comparing to
See all releases

Code changes from version 1.5.5 to 1.6

css/style.css CHANGED
@@ -67,4 +67,14 @@
67
  float: none;
68
  }
69
 
70
- }
 
 
 
 
 
 
 
 
 
 
67
  float: none;
68
  }
69
 
70
+ }
71
+
72
+ /* Forms */
73
+
74
+ textarea {
75
+ max-width: 100%;
76
+ }
77
+
78
+ #wie-import-data {
79
+ display: none;
80
+ }
includes/admin.php CHANGED
@@ -6,16 +6,13 @@
6
  *
7
  * @package Widget_Importer_Exporter
8
  * @subpackage Functions
9
- * @copyright Copyright (c) 2017, ChurchThemes.com
10
  * @link https://churchthemes.com/plugins/widget-importer-exporter/
11
- * @license GPLv2 or later
12
  * @since 1.4
13
  */
14
 
15
- // No direct access.
16
- if ( ! defined( 'ABSPATH' ) ) {
17
- exit;
18
- }
19
 
20
  /**
21
  * Enqueue admin styles.
@@ -23,21 +20,39 @@ if ( ! defined( 'ABSPATH' ) ) {
23
  * @since 1.5
24
  */
25
  function wie_enqueue_styles() {
26
-
27
  // Get current screen.
28
  $screen = get_current_screen();
29
 
30
  // Only on WIE and Dashboard screens.
31
- if ( ! in_array( $screen->base, array( 'dashboard', 'tools_page_widget-importer-exporter' ), true ) ) {
32
  return;
33
  }
34
 
35
  // Enqueue styles
36
- wp_enqueue_style( 'wie-main', WIE_URL . '/' . WIE_CSS_DIR . '/style.css', false, WIE_VERSION ); // Bust cache on update.
 
 
 
 
 
 
 
 
 
 
 
 
37
 
 
 
 
 
 
 
 
38
  }
39
 
40
- add_action( 'admin_enqueue_scripts', 'wie_enqueue_styles' ); // admin-end only.
41
 
42
  /**
43
  * Add plugin action link.
@@ -48,30 +63,27 @@ add_action( 'admin_enqueue_scripts', 'wie_enqueue_styles' ); // admin-end only.
48
  * @param array $links Existing action links.
49
  * @return array Modified action links
50
  */
51
- function wie_add_plugin_action_link( $links ) {
52
-
53
  // If has permission.
54
- if ( ! current_user_can( 'edit_theme_options' ) ) {
55
  return array();
56
  }
57
 
58
  // Have links array?
59
- if ( is_array( $links ) ) {
60
-
61
  // Append "Settings" link.
62
  $links[] = sprintf(
63
  '<a href="%1$s">%2$s</a>',
64
- esc_url( admin_url( 'tools.php?page=widget-importer-exporter' ) ),
65
- esc_html__( 'Import/Export', 'widget-importer-exporter' )
66
  );
67
-
68
  }
69
 
70
  return $links;
71
-
72
  }
73
 
74
- add_filter( 'plugin_action_links_' . plugin_basename( WIE_FILE ), 'wie_add_plugin_action_link' );
75
 
76
  /**
77
  * Add link on Widgets page
@@ -81,8 +93,8 @@ add_filter( 'plugin_action_links_' . plugin_basename( WIE_FILE ), 'wie_add_plugi
81
  *
82
  * @since 1.4
83
  */
84
- function wie_add_widgets_screen_link() {
85
-
86
  // Build link with same style as 'Manage with Live Preview'.
87
  $link_html = sprintf(
88
  wp_kses(
@@ -95,29 +107,24 @@ function wie_add_widgets_screen_link() {
95
  ),
96
  )
97
  ),
98
- esc_url( admin_url( 'tools.php?page=widget-importer-exporter' ) ),
99
- esc_html__( 'Import/Export', 'widget-importer-exporter' )
100
  );
101
 
102
  // Output JavaScript to insert link after 'Manage with Live Preview'.
103
  ?>
104
 
105
  <script type="text/javascript">
106
-
107
- jQuery( document ).ready( function ( $ ) {
108
-
109
  // Encode string for security
110
- var link_html = <?php echo wp_json_encode( $link_html ); ?>;
111
 
112
  // Insert after last button by title
113
- $( '.page-title-action' ).last().after( link_html );
114
-
115
- } );
116
-
117
  </script>
118
  <?php
119
-
120
  }
121
 
122
  // WP 4.6+.
123
- add_action( 'admin_print_footer_scripts-widgets.php', 'wie_add_widgets_screen_link' );
6
  *
7
  * @package Widget_Importer_Exporter
8
  * @subpackage Functions
9
+ * @copyright Copyright (c) 2017 - 2020, ChurchThemes.com, LLC
10
  * @link https://churchthemes.com/plugins/widget-importer-exporter/
11
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
12
  * @since 1.4
13
  */
14
 
15
+ defined('ABSPATH') || exit; // No direct access.
 
 
 
16
 
17
  /**
18
  * Enqueue admin styles.
20
  * @since 1.5
21
  */
22
  function wie_enqueue_styles() {
 
23
  // Get current screen.
24
  $screen = get_current_screen();
25
 
26
  // Only on WIE and Dashboard screens.
27
+ if (! in_array($screen->base, array('dashboard', 'tools_page_widget-importer-exporter'), true)) {
28
  return;
29
  }
30
 
31
  // Enqueue styles
32
+ wp_enqueue_style('wie-main', WIE_URL . '/' . WIE_CSS_DIR . '/style.css', false, WIE_VERSION); // Bust cache on update.
33
+ }
34
+
35
+ add_action('admin_enqueue_scripts', 'wie_enqueue_styles'); // admin-end only.
36
+
37
+ /**
38
+ * Enqueue admin scripts.
39
+ *
40
+ * @since 1.6
41
+ */
42
+ function wie_enqueue_scripts() {
43
+ // Get current screen.
44
+ $screen = get_current_screen();
45
 
46
+ // Only on WIE screen.
47
+ if (! in_array($screen->base, array('dashboard', 'tools_page_widget-importer-exporter'), true)) {
48
+ return;
49
+ }
50
+
51
+ // Enqueue script
52
+ wp_enqueue_script('wie-main', WIE_URL . '/' . WIE_JS_DIR . '/main.js', array('jquery'), WIE_VERSION, false); // bust cache on update.
53
  }
54
 
55
+ add_action('admin_enqueue_scripts', 'wie_enqueue_scripts'); // admin-end only.
56
 
57
  /**
58
  * Add plugin action link.
63
  * @param array $links Existing action links.
64
  * @return array Modified action links
65
  */
66
+ function wie_add_plugin_action_link($links)
67
+ {
68
  // If has permission.
69
+ if (! current_user_can('edit_theme_options')) {
70
  return array();
71
  }
72
 
73
  // Have links array?
74
+ if (is_array($links)) {
 
75
  // Append "Settings" link.
76
  $links[] = sprintf(
77
  '<a href="%1$s">%2$s</a>',
78
+ esc_url(admin_url('tools.php?page=widget-importer-exporter')),
79
+ esc_html__('Import/Export', 'widget-importer-exporter')
80
  );
 
81
  }
82
 
83
  return $links;
 
84
  }
85
 
86
+ add_filter('plugin_action_links_' . plugin_basename(WIE_FILE), 'wie_add_plugin_action_link');
87
 
88
  /**
89
  * Add link on Widgets page
93
  *
94
  * @since 1.4
95
  */
96
+ function wie_add_widgets_screen_link()
97
+ {
98
  // Build link with same style as 'Manage with Live Preview'.
99
  $link_html = sprintf(
100
  wp_kses(
107
  ),
108
  )
109
  ),
110
+ esc_url(admin_url('tools.php?page=widget-importer-exporter')),
111
+ esc_html__('Import/Export', 'widget-importer-exporter')
112
  );
113
 
114
  // Output JavaScript to insert link after 'Manage with Live Preview'.
115
  ?>
116
 
117
  <script type="text/javascript">
118
+ jQuery(document).ready(function ($) {
 
 
119
  // Encode string for security
120
+ var link_html = <?php echo wp_json_encode($link_html); ?>;
121
 
122
  // Insert after last button by title
123
+ $('.page-title-action').last().after(link_html);
124
+ });
 
 
125
  </script>
126
  <?php
 
127
  }
128
 
129
  // WP 4.6+.
130
+ add_action('admin_print_footer_scripts-widgets.php', 'wie_add_widgets_screen_link');
includes/export.php CHANGED
@@ -1,152 +1,133 @@
1
- <?php
2
- /**
3
- * Export Functions
4
- *
5
- * @package Widget_Importer_Exporter
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2013 - 2017, ChurchThemes.com
8
- * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
- * @license GPLv2 or later
10
- * @since 0.1
11
- */
12
-
13
- // No direct access.
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * Generate export data
20
- *
21
- * @since 0.1
22
- * @return string Export file contents
23
- */
24
- function wie_generate_export_data() {
25
-
26
- // Get all available widgets site supports.
27
- $available_widgets = wie_available_widgets();
28
-
29
- // Get all widget instances for each widget.
30
- $widget_instances = array();
31
-
32
- // Loop widgets.
33
- foreach ( $available_widgets as $widget_data ) {
34
-
35
- // Get all instances for this ID base.
36
- $instances = get_option( 'widget_' . $widget_data['id_base'] );
37
-
38
- // Have instances.
39
- if ( ! empty( $instances ) ) {
40
-
41
- // Loop instances.
42
- foreach ( $instances as $instance_id => $instance_data ) {
43
-
44
- // Key is ID (not _multiwidget).
45
- if ( is_numeric( $instance_id ) ) {
46
- $unique_instance_id = $widget_data['id_base'] . '-' . $instance_id;
47
- $widget_instances[ $unique_instance_id ] = $instance_data;
48
- }
49
-
50
- }
51
-
52
- }
53
-
54
- }
55
-
56
- // Gather sidebars with their widget instances.
57
- $sidebars_widgets = get_option( 'sidebars_widgets' );
58
- $sidebars_widget_instances = array();
59
- foreach ( $sidebars_widgets as $sidebar_id => $widget_ids ) {
60
-
61
- // Skip inactive widgets.
62
- if ( 'wp_inactive_widgets' === $sidebar_id ) {
63
- continue;
64
- }
65
-
66
- // Skip if no data or not an array (array_version).
67
- if ( ! is_array( $widget_ids ) || empty( $widget_ids ) ) {
68
- continue;
69
- }
70
-
71
- // Loop widget IDs for this sidebar.
72
- foreach ( $widget_ids as $widget_id ) {
73
-
74
- // Is there an instance for this widget ID?
75
- if ( isset( $widget_instances[ $widget_id ] ) ) {
76
-
77
- // Add to array.
78
- $sidebars_widget_instances[ $sidebar_id ][ $widget_id ] = $widget_instances[ $widget_id ];
79
-
80
- }
81
-
82
- }
83
-
84
- }
85
-
86
- // Filter pre-encoded data.
87
- $data = apply_filters( 'wie_unencoded_export_data', $sidebars_widget_instances );
88
-
89
- // Encode the data for file contents.
90
- $encoded_data = wp_json_encode( $data );
91
-
92
- // Return contents.
93
- return apply_filters( 'wie_generate_export_data', $encoded_data );
94
-
95
- }
96
-
97
- /**
98
- * Send export file to user
99
- *
100
- * Triggered by URL like /wp-admin/tools.php?page=widget-importer-exporter&export=1
101
- *
102
- * The data is JSON with .wie extension in order not to confuse export files with other plugins.
103
- *
104
- * @since 0.1
105
- */
106
- function wie_send_export_file() {
107
-
108
- // Export requested.
109
- if ( ! empty( $_GET['export'] ) ) {
110
-
111
- // Check referer before doing anything else.
112
- check_admin_referer( 'wie_export', 'wie_export_nonce' );
113
-
114
- // Build filename
115
- // Single Site: yoursite.com-widgets.wie
116
- // Multisite: site.multisite.com-widgets.wie or multisite.com-site-widgets.wie.
117
- $site_url = site_url( '', 'http' );
118
- $site_url = trim( $site_url, '/\\' ); // Remove trailing slash.
119
- $filename = str_replace( 'http://', '', $site_url ); // Remove http://.
120
- $filename = str_replace( array( '/', '\\' ), '-', $filename ); // Replace slashes with - .
121
- $filename .= '-widgets.wie'; // Append.
122
- $filename = apply_filters( 'wie_export_filename', $filename );
123
-
124
- // Generate export file contents.
125
- $file_contents = wie_generate_export_data();
126
- $filesize = strlen( $file_contents );
127
-
128
- // Headers to prompt "Save As".
129
- header( 'Content-Type: application/octet-stream' );
130
- header( 'Content-Disposition: attachment; filename=' . $filename );
131
- header( 'Expires: 0' );
132
- header( 'Cache-Control: must-revalidate' );
133
- header( 'Pragma: public' );
134
- header( 'Content-Length: ' . $filesize );
135
-
136
- // Clear buffering just in case.
137
- // @codingStandardsIgnoreLine
138
- @ob_end_clean();
139
- flush();
140
-
141
- // Output file contents.
142
- // @todo export or verify the output data. Or simply ignore the line.
143
- echo $file_contents;
144
-
145
- // Stop execution.
146
- exit;
147
-
148
- }
149
-
150
- }
151
-
152
- add_action( 'load-tools_page_widget-importer-exporter', 'wie_send_export_file' );
1
+ <?php
2
+ /**
3
+ * Export Functions
4
+ *
5
+ * @package Widget_Importer_Exporter
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
8
+ * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
10
+ * @since 0.1
11
+ */
12
+
13
+ defined('ABSPATH') || exit; // No direct access.
14
+
15
+ /**
16
+ * Generate export data
17
+ *
18
+ * @since 0.1
19
+ * @return string Export file contents
20
+ */
21
+ function wie_generate_export_data()
22
+ {
23
+ // Get all available widgets site supports.
24
+ $available_widgets = wie_available_widgets();
25
+
26
+ // Get all widget instances for each widget.
27
+ $widget_instances = array();
28
+
29
+ // Loop widgets.
30
+ foreach ($available_widgets as $widget_data) {
31
+ // Get all instances for this ID base.
32
+ $instances = get_option('widget_' . $widget_data['id_base']);
33
+
34
+ // Have instances.
35
+ if (! empty($instances)) {
36
+ // Loop instances.
37
+ foreach ($instances as $instance_id => $instance_data) {
38
+ // Key is ID (not _multiwidget).
39
+ if (is_numeric($instance_id)) {
40
+ $unique_instance_id = $widget_data['id_base'] . '-' . $instance_id;
41
+ $widget_instances[$unique_instance_id] = $instance_data;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ // Gather sidebars with their widget instances.
48
+ $sidebars_widgets = get_option('sidebars_widgets');
49
+ $sidebars_widget_instances = array();
50
+ foreach ($sidebars_widgets as $sidebar_id => $widget_ids) {
51
+ // Skip inactive widgets.
52
+ if ('wp_inactive_widgets' === $sidebar_id) {
53
+ continue;
54
+ }
55
+
56
+ // Skip if no data or not an array (array_version).
57
+ if (! is_array($widget_ids) || empty($widget_ids)) {
58
+ continue;
59
+ }
60
+
61
+ // Loop widget IDs for this sidebar.
62
+ foreach ($widget_ids as $widget_id) {
63
+ // Is there an instance for this widget ID?
64
+ if (isset($widget_instances[$widget_id])) {
65
+ // Add to array.
66
+ $sidebars_widget_instances[$sidebar_id][$widget_id] = $widget_instances[$widget_id];
67
+ }
68
+ }
69
+ }
70
+
71
+ // Filter pre-encoded data.
72
+ $data = apply_filters('wie_unencoded_export_data', $sidebars_widget_instances);
73
+
74
+ // Encode the data for file contents.
75
+ $encoded_data = wp_json_encode($data);
76
+
77
+ // Return contents.
78
+ return apply_filters('wie_generate_export_data', $encoded_data);
79
+ }
80
+
81
+ /**
82
+ * Send export file to user
83
+ *
84
+ * Triggered by URL like /wp-admin/tools.php?page=widget-importer-exporter&export=1
85
+ *
86
+ * The data is JSON with .wie extension in order not to confuse export files with other plugins.
87
+ *
88
+ * @since 0.1
89
+ */
90
+ function wie_send_export_file()
91
+ {
92
+ // Export requested.
93
+ if (! empty($_GET['export'])) {
94
+ // Check referer before doing anything else.
95
+ check_admin_referer('wie_export', 'wie_export_nonce');
96
+
97
+ // Build filename
98
+ // Single Site: yoursite.com-widgets.wie
99
+ // Multisite: site.multisite.com-widgets.wie or multisite.com-site-widgets.wie.
100
+ $site_url = site_url('', 'http');
101
+ $site_url = trim($site_url, '/\\'); // Remove trailing slash.
102
+ $filename = str_replace('http://', '', $site_url); // Remove http://.
103
+ $filename = str_replace(array('/', '\\'), '-', $filename); // Replace slashes with - .
104
+ $filename .= '-widgets.wie'; // Append.
105
+ $filename = apply_filters('wie_export_filename', $filename);
106
+
107
+ // Generate export file contents.
108
+ $file_contents = wie_generate_export_data();
109
+ $filesize = strlen($file_contents);
110
+
111
+ // Headers to prompt "Save As".
112
+ header('Content-Type: application/octet-stream');
113
+ header('Content-Disposition: attachment; filename=' . $filename);
114
+ header('Expires: 0');
115
+ header('Cache-Control: must-revalidate');
116
+ header('Pragma: public');
117
+ header('Content-Length: ' . $filesize);
118
+
119
+ // Clear buffering just in case.
120
+ // @codingStandardsIgnoreLine
121
+ @ob_end_clean();
122
+ flush();
123
+
124
+ // Output file contents.
125
+ // @codingStandardsIgnoreLine
126
+ echo $file_contents;
127
+
128
+ // Stop execution.
129
+ exit;
130
+ }
131
+ }
132
+
133
+ add_action('load-tools_page_widget-importer-exporter', 'wie_send_export_file');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/import.php CHANGED
@@ -1,347 +1,407 @@
1
- <?php
2
- /**
3
- * Import Functions
4
- *
5
- * @package Widget_Importer_Exporter
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2013 - 2018, ChurchThemes.com
8
- * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
- * @license GPLv2 or later
10
- * @since 0.3
11
- */
12
-
13
- // No direct access.
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * Upload import file
20
- *
21
- * @since 0.3
22
- */
23
- function wie_upload_import_file() {
24
-
25
- // Check nonce for security since form was posted.
26
- // check_admin_referer prints fail page and dies.
27
- if ( ! empty( $_POST ) && ! empty( $_FILES['wie_import_file'] ) && check_admin_referer( 'wie_import', 'wie_import_nonce' ) ) {
28
-
29
- // Workaround for .wie upload issue introduced by WordPress 4.9.9 / 5.0.1.
30
- add_filter( 'wp_check_filetype_and_ext', 'wie_allow_multiple_mime_types', 10, 4 );
31
-
32
- // Workaround for upload bug in WordPress 4.7.1.
33
- // This will only be applied for WordPress 4.7.1. Other versions are not affected.
34
- add_filter( 'wp_check_filetype_and_ext', 'wie_disable_real_mime_check', 10, 4 );
35
-
36
- // Uploaded file.
37
- $uploaded_file = $_FILES['wie_import_file'];
38
-
39
- // Check file type.
40
- // This will also fire if no file uploaded.
41
- $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
42
- if ( 'wie' !== $wp_filetype['ext'] && ! wp_match_mime_types( 'wie', $wp_filetype['type'] ) ) {
43
-
44
- wp_die(
45
- wp_kses(
46
- __( 'You must upload a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ),
47
- array(
48
- 'b' => array(),
49
- )
50
- ),
51
- '',
52
- array(
53
- 'back_link' => true,
54
- )
55
- );
56
-
57
- }
58
-
59
- // Check and move file to uploads dir, get file data
60
- // Will show die with WP errors if necessary (file too large, quota exceeded, etc.).
61
- $file_data = wp_handle_upload( $uploaded_file, array(
62
- 'test_form' => false,
63
- ) );
64
-
65
- if ( isset( $file_data['error'] ) ) {
66
- wp_die(
67
- esc_html( $file_data['error'] ),
68
- '',
69
- array(
70
- 'back_link' => true,
71
- )
72
- );
73
- }
74
-
75
- // Process import file.
76
- wie_process_import_file( $file_data['file'] );
77
-
78
- }
79
-
80
- }
81
-
82
- add_action( 'load-tools_page_widget-importer-exporter', 'wie_upload_import_file' );
83
-
84
- /**
85
- * Process import file
86
- *
87
- * This parses a file and triggers importation of its widgets.
88
- *
89
- * @since 0.3
90
- * @param string $file Path to .wie file uploaded.
91
- * @global string $wie_import_results
92
- */
93
- function wie_process_import_file( $file ) {
94
-
95
- global $wie_import_results;
96
-
97
- // File exists?
98
- if ( ! file_exists( $file ) ) {
99
-
100
- wp_die(
101
- esc_html__( 'Import file could not be found. Please try again.', 'widget-importer-exporter' ),
102
- '',
103
- array(
104
- 'back_link' => true,
105
- )
106
- );
107
-
108
- }
109
-
110
- // Get file contents and decode.
111
- $data = implode( '', file( $file ) );
112
- $data = json_decode( $data );
113
-
114
- // Delete import file.
115
- unlink( $file );
116
-
117
- // Import the widget data
118
- // Make results available for display on import/export page.
119
- $wie_import_results = wie_import_data( $data );
120
-
121
- }
122
-
123
- /**
124
- * Import widget JSON data
125
- *
126
- * @since 0.4
127
- * @global array $wp_registered_sidebars
128
- * @param object $data JSON widget data from .wie file.
129
- * @return array Results array
130
- */
131
- function wie_import_data( $data ) {
132
-
133
- global $wp_registered_sidebars;
134
-
135
- // Have valid data?
136
- // If no data or could not decode.
137
- if ( empty( $data ) || ! is_object( $data ) ) {
138
-
139
- wp_die(
140
- esc_html__( 'Import data could not be read. Please try a different file.', 'widget-importer-exporter' ),
141
- '',
142
- array(
143
- 'back_link' => true,
144
- )
145
- );
146
-
147
- }
148
-
149
- // Hook before import.
150
- do_action( 'wie_before_import' );
151
- $data = apply_filters( 'wie_import_data', $data );
152
-
153
- // Get all available widgets site supports.
154
- $available_widgets = wie_available_widgets();
155
-
156
- // Get all existing widget instances.
157
- $widget_instances = array();
158
- foreach ( $available_widgets as $widget_data ) {
159
- $widget_instances[ $widget_data['id_base'] ] = get_option( 'widget_' . $widget_data['id_base'] );
160
- }
161
-
162
- // Begin results.
163
- $results = array();
164
-
165
- // Loop import data's sidebars.
166
- foreach ( $data as $sidebar_id => $widgets ) {
167
-
168
- // Skip inactive widgets (should not be in export file).
169
- if ( 'wp_inactive_widgets' === $sidebar_id ) {
170
- continue;
171
- }
172
-
173
- // Check if sidebar is available on this site.
174
- // Otherwise add widgets to inactive, and say so.
175
- if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
176
- $sidebar_available = true;
177
- $use_sidebar_id = $sidebar_id;
178
- $sidebar_message_type = 'success';
179
- $sidebar_message = '';
180
- } else {
181
- $sidebar_available = false;
182
- $use_sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
183
- $sidebar_message_type = 'error';
184
- $sidebar_message = esc_html__( 'Widget area does not exist in theme (using Inactive)', 'widget-importer-exporter' );
185
- }
186
-
187
- // Result for sidebar
188
- // Sidebar name if theme supports it; otherwise ID.
189
- $results[ $sidebar_id ]['name'] = ! empty( $wp_registered_sidebars[ $sidebar_id ]['name'] ) ? $wp_registered_sidebars[ $sidebar_id ]['name'] : $sidebar_id;
190
- $results[ $sidebar_id ]['message_type'] = $sidebar_message_type;
191
- $results[ $sidebar_id ]['message'] = $sidebar_message;
192
- $results[ $sidebar_id ]['widgets'] = array();
193
-
194
- // Loop widgets.
195
- foreach ( $widgets as $widget_instance_id => $widget ) {
196
-
197
- $fail = false;
198
-
199
- // Get id_base (remove -# from end) and instance ID number.
200
- $id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
201
- $instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
202
-
203
- // Does site support this widget?
204
- if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
205
- $fail = true;
206
- $widget_message_type = 'error';
207
- $widget_message = esc_html__( 'Site does not support widget', 'widget-importer-exporter' ); // Explain why widget not imported.
208
- }
209
-
210
- // Filter to modify settings object before conversion to array and import
211
- // Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below)
212
- // Ideally the newer wie_widget_settings_array below will be used instead of this.
213
- $widget = apply_filters( 'wie_widget_settings', $widget );
214
-
215
- // Convert multidimensional objects to multidimensional arrays
216
- // Some plugins like Jetpack Widget Visibility store settings as multidimensional arrays
217
- // Without this, they are imported as objects and cause fatal error on Widgets page
218
- // If this creates problems for plugins that do actually intend settings in objects then may need to consider other approach: https://wordpress.org/support/topic/problem-with-array-of-arrays
219
- // It is probably much more likely that arrays are used than objects, however.
220
- $widget = json_decode( wp_json_encode( $widget ), true );
221
-
222
- // Filter to modify settings array
223
- // This is preferred over the older wie_widget_settings filter above
224
- // Do before identical check because changes may make it identical to end result (such as URL replacements).
225
- $widget = apply_filters( 'wie_widget_settings_array', $widget );
226
-
227
- // Does widget with identical settings already exist in same sidebar?
228
- if ( ! $fail && isset( $widget_instances[ $id_base ] ) ) {
229
-
230
- // Get existing widgets in this sidebar.
231
- $sidebars_widgets = get_option( 'sidebars_widgets' );
232
- $sidebar_widgets = isset( $sidebars_widgets[ $use_sidebar_id ] ) ? $sidebars_widgets[ $use_sidebar_id ] : array(); // Check Inactive if that's where will go.
233
-
234
- // Loop widgets with ID base.
235
- $single_widget_instances = ! empty( $widget_instances[ $id_base ] ) ? $widget_instances[ $id_base ] : array();
236
- foreach ( $single_widget_instances as $check_id => $check_widget ) {
237
-
238
- // Is widget in same sidebar and has identical settings?
239
- if ( in_array( "$id_base-$check_id", $sidebar_widgets, true ) && (array) $widget === $check_widget ) {
240
-
241
- $fail = true;
242
- $widget_message_type = 'warning';
243
-
244
- // Explain why widget not imported.
245
- $widget_message = esc_html__( 'Widget already exists', 'widget-importer-exporter' );
246
-
247
- break;
248
-
249
- }
250
-
251
- }
252
-
253
- }
254
-
255
- // No failure.
256
- if ( ! $fail ) {
257
-
258
- // Add widget instance
259
- $single_widget_instances = get_option( 'widget_' . $id_base ); // All instances for that widget ID base, get fresh every time.
260
- $single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array(
261
- '_multiwidget' => 1, // Start fresh if have to.
262
- );
263
- $single_widget_instances[] = $widget; // Add it.
264
-
265
- // Get the key it was given.
266
- end( $single_widget_instances );
267
- $new_instance_id_number = key( $single_widget_instances );
268
-
269
- // If key is 0, make it 1
270
- // When 0, an issue can occur where adding a widget causes data from other widget to load,
271
- // and the widget doesn't stick (reload wipes it).
272
- if ( '0' === strval( $new_instance_id_number ) ) {
273
- $new_instance_id_number = 1;
274
- $single_widget_instances[ $new_instance_id_number ] = $single_widget_instances[0];
275
- unset( $single_widget_instances[0] );
276
- }
277
-
278
- // Move _multiwidget to end of array for uniformity.
279
- if ( isset( $single_widget_instances['_multiwidget'] ) ) {
280
- $multiwidget = $single_widget_instances['_multiwidget'];
281
- unset( $single_widget_instances['_multiwidget'] );
282
- $single_widget_instances['_multiwidget'] = $multiwidget;
283
- }
284
-
285
- // Update option with new widget.
286
- update_option( 'widget_' . $id_base, $single_widget_instances );
287
-
288
- // Assign widget instance to sidebar.
289
- // Which sidebars have which widgets, get fresh every time.
290
- $sidebars_widgets = get_option( 'sidebars_widgets' );
291
-
292
- // Avoid rarely fatal error when the option is an empty string
293
- // https://github.com/churchthemes/widget-importer-exporter/pull/11.
294
- if ( ! $sidebars_widgets ) {
295
- $sidebars_widgets = array();
296
- }
297
-
298
- // Use ID number from new widget instance.
299
- $new_instance_id = $id_base . '-' . $new_instance_id_number;
300
-
301
- // Add new instance to sidebar.
302
- $sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id;
303
-
304
- // Save the amended data.
305
- update_option( 'sidebars_widgets', $sidebars_widgets );
306
-
307
- // After widget import action.
308
- $after_widget_import = array(
309
- 'sidebar' => $use_sidebar_id,
310
- 'sidebar_old' => $sidebar_id,
311
- 'widget' => $widget,
312
- 'widget_type' => $id_base,
313
- 'widget_id' => $new_instance_id,
314
- 'widget_id_old' => $widget_instance_id,
315
- 'widget_id_num' => $new_instance_id_number,
316
- 'widget_id_num_old' => $instance_id_number,
317
- );
318
- do_action( 'wie_after_widget_import', $after_widget_import );
319
-
320
- // Success message.
321
- if ( $sidebar_available ) {
322
- $widget_message_type = 'success';
323
- $widget_message = esc_html__( 'Imported', 'widget-importer-exporter' );
324
- } else {
325
- $widget_message_type = 'warning';
326
- $widget_message = esc_html__( 'Imported to Inactive', 'widget-importer-exporter' );
327
- }
328
-
329
- }
330
-
331
- // Result for widget instance
332
- $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).
333
- $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.
334
- $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
335
- $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
336
-
337
- }
338
-
339
- }
340
-
341
- // Hook after import.
342
- do_action( 'wie_after_import' );
343
-
344
- // Return results.
345
- return apply_filters( 'wie_import_results', $results );
346
-
347
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Import Functions
4
+ *
5
+ * @package Widget_Importer_Exporter
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
8
+ * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
10
+ * @since 0.3
11
+ */
12
+
13
+ defined('ABSPATH') || exit; // No direct access.
14
+
15
+ /**
16
+ * Process submit
17
+ *
18
+ * Process uploaded file or pasted contents. If both, use pasted content.
19
+ * If neither, show an error telling to use one or the other method.
20
+ *
21
+ * @since 1.6
22
+ */
23
+ function wie_process_submit()
24
+ {
25
+ // Form not posted
26
+ if (empty($_POST)) {
27
+ return;
28
+ }
29
+
30
+ // Check nonce
31
+ check_admin_referer('wie_import', 'wie_import_nonce');
32
+
33
+ // Content pasted
34
+ if (! empty($_POST['wie_import_data'])) {
35
+ wie_submit_import_data();
36
+ }
37
+
38
+ // File uploaded (but not content pasted)
39
+ else if (! empty($_FILES['wie_import_file']['name'])) {
40
+ wie_upload_import_file();
41
+ }
42
+
43
+ // Nothing provided
44
+ else {
45
+ wp_die(
46
+ wp_kses(
47
+ __("You must choose a <b>.wie</b> file to upload or paste its contents.", 'widget-importer-exporter'),
48
+ array(
49
+ 'b' => array(),
50
+ )
51
+ ),
52
+ '',
53
+ array(
54
+ 'back_link' => true,
55
+ )
56
+ );
57
+ }
58
+ }
59
+
60
+ add_action('load-tools_page_widget-importer-exporter', 'wie_process_submit');
61
+
62
+ /**
63
+ * Submit import data (copy and paste from file)
64
+ *
65
+ * If file and content both provided, uses content.
66
+ *
67
+ * @since 1.6
68
+ * @global string $wie_import_results
69
+ */
70
+ function wie_submit_import_data()
71
+ {
72
+ global $wie_import_results;
73
+
74
+ check_admin_referer('wie_import', 'wie_import_nonce');
75
+
76
+ if (! empty($_POST['wie_import_data'])) {
77
+ $content = '';
78
+
79
+ // Get content pasted
80
+ $content = filter_var(wp_unslash($_POST['wie_import_data']), FILTER_DEFAULT);
81
+ $content = trim($content);
82
+
83
+ // Import the widget data
84
+ // Make results available for display on import/export page.
85
+ $data = json_decode($content); // Decode file contents to JSON data.
86
+ $wie_import_results = wie_import_data($data);
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Upload import file
92
+ *
93
+ * If file and content provided, uses content.
94
+ *
95
+ * @since 0.3
96
+ */
97
+ function wie_upload_import_file()
98
+ {
99
+ check_admin_referer('wie_import', 'wie_import_nonce');
100
+
101
+ if (! empty($_FILES['wie_import_file']['name'])) {
102
+
103
+ // Workaround for .wie upload issue introduced by WordPress 4.9.9 / 5.0.1.
104
+ add_filter('wp_check_filetype_and_ext', 'wie_allow_multiple_mime_types', 10, 4);
105
+
106
+ // Workaround for upload bug in WordPress 4.7.1.
107
+ // This will only be applied for WordPress 4.7.1. Other versions are not affected.
108
+ add_filter('wp_check_filetype_and_ext', 'wie_disable_real_mime_check', 10, 4);
109
+
110
+ // Uploaded file.
111
+ $uploaded_file = wp_unslash($_FILES['wie_import_file']); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
112
+ $uploaded_file_name = isset($uploaded_file['name']) ? filter_var($uploaded_file['name'], FILTER_SANITIZE_STRING) : '';
113
+ $uploaded_file_tmp_name = isset($uploaded_file['tmp_name']) ? filter_var($uploaded_file['tmp_name'], FILTER_SANITIZE_STRING) : '';
114
+
115
+ // Check file type.
116
+ // This will also fire if no file uploaded.
117
+ $wp_filetype = wp_check_filetype_and_ext($uploaded_file_tmp_name, $uploaded_file_name, false);
118
+ if ('wie' !== $wp_filetype['ext'] && ! wp_match_mime_types( 'wie', $wp_filetype['type'] )) {
119
+ wp_die(
120
+ wp_kses(
121
+ sprintf(
122
+ /* translators: %1$s is link to resource to help with error */
123
+ __('You must upload a <b>.wie</b> file generated by this plugin (<a href="%1$s" target="_blank">help</a>).', 'widget-importer-exporter'),
124
+ 'https://churchthemes.com/go/wie-import-sticky'
125
+ ),
126
+ array(
127
+ 'b' => array(),
128
+ 'a' => array(
129
+ 'href' => array(),
130
+ 'target' => array(),
131
+ )
132
+ )
133
+ ),
134
+ '',
135
+ array(
136
+ 'back_link' => true,
137
+ )
138
+ );
139
+ }
140
+
141
+ // Check and move file to uploads dir, get file data
142
+ // Will show die with WP errors if necessary (file too large, quota exceeded, etc.).
143
+ $file_data = wp_handle_upload($uploaded_file, array(
144
+ 'test_form' => false,
145
+ ));
146
+
147
+ if (isset($file_data['error'])) {
148
+ wp_die(
149
+ esc_html($file_data['error']),
150
+ '',
151
+ array(
152
+ 'back_link' => true,
153
+ )
154
+ );
155
+ }
156
+
157
+ // Process import file.
158
+ wie_process_import_file($file_data['file']);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Process import file
164
+ *
165
+ * This parses a file and triggers importation of its widgets.
166
+ *
167
+ * @since 0.3
168
+ * @param string $file Path to .wie file uploaded.
169
+ * @global string $wie_import_results
170
+ */
171
+ function wie_process_import_file($file)
172
+ {
173
+ global $wie_import_results;
174
+
175
+ // File exists?
176
+ if (! file_exists($file)) {
177
+ wp_die(
178
+ esc_html__('Import file could not be found. Please try again.', 'widget-importer-exporter'),
179
+ '',
180
+ array(
181
+ 'back_link' => true,
182
+ )
183
+ );
184
+ }
185
+
186
+ // Get file contents and decode.
187
+ $data = implode('', file($file));
188
+ $data = json_decode($data);
189
+
190
+ // Delete import file.
191
+ unlink($file);
192
+
193
+ // Import the widget data
194
+ // Make results available for display on import/export page.
195
+ $wie_import_results = wie_import_data($data);
196
+ }
197
+
198
+ /**
199
+ * Import widget JSON data
200
+ *
201
+ * @since 0.4
202
+ * @global array $wp_registered_sidebars
203
+ * @param object $data JSON widget data from .wie file.
204
+ * @return array Results array
205
+ */
206
+ function wie_import_data($data)
207
+ {
208
+ global $wp_registered_sidebars;
209
+
210
+ // Have valid data?
211
+ // If no data or could not decode.
212
+ if (empty($data) || ! is_object($data)) {
213
+ wp_die(
214
+ esc_html__('Import data is invalid.', 'widget-importer-exporter'),
215
+ '',
216
+ array(
217
+ 'back_link' => true,
218
+ )
219
+ );
220
+ }
221
+
222
+ // Hook before import.
223
+ do_action('wie_before_import');
224
+ $data = apply_filters('wie_import_data', $data);
225
+
226
+ // Get all available widgets site supports.
227
+ $available_widgets = wie_available_widgets();
228
+
229
+ // Get all existing widget instances.
230
+ $widget_instances = array();
231
+ foreach ($available_widgets as $widget_data) {
232
+ $widget_instances[$widget_data['id_base']] = get_option('widget_' . $widget_data['id_base']);
233
+ }
234
+
235
+ // Begin results.
236
+ $results = array();
237
+
238
+ // Loop import data's sidebars.
239
+ foreach ($data as $sidebar_id => $widgets) {
240
+ // Skip inactive widgets (should not be in export file).
241
+ if ('wp_inactive_widgets' === $sidebar_id) {
242
+ continue;
243
+ }
244
+
245
+ // Check if sidebar is available on this site.
246
+ // Otherwise add widgets to inactive, and say so.
247
+ if (isset($wp_registered_sidebars[$sidebar_id])) {
248
+ $sidebar_available = true;
249
+ $use_sidebar_id = $sidebar_id;
250
+ $sidebar_message_type = 'success';
251
+ $sidebar_message = '';
252
+ } else {
253
+ $sidebar_available = false;
254
+ $use_sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
255
+ $sidebar_message_type = 'error';
256
+ $sidebar_message = esc_html__('Widget area does not exist in theme (using Inactive)', 'widget-importer-exporter');
257
+ }
258
+
259
+ // Result for sidebar
260
+ // Sidebar name if theme supports it; otherwise ID.
261
+ $results[$sidebar_id]['name'] = ! empty($wp_registered_sidebars[$sidebar_id]['name']) ? $wp_registered_sidebars[$sidebar_id]['name'] : $sidebar_id;
262
+ $results[$sidebar_id]['message_type'] = $sidebar_message_type;
263
+ $results[$sidebar_id]['message'] = $sidebar_message;
264
+ $results[$sidebar_id]['widgets'] = array();
265
+
266
+ // Loop widgets.
267
+ foreach ($widgets as $widget_instance_id => $widget) {
268
+ $fail = false;
269
+
270
+ // Get id_base (remove -# from end) and instance ID number.
271
+ $id_base = preg_replace('/-[0-9]+$/', '', $widget_instance_id);
272
+ $instance_id_number = str_replace($id_base . '-', '', $widget_instance_id);
273
+
274
+ // Does site support this widget?
275
+ if (! $fail && ! isset($available_widgets[$id_base])) {
276
+ $fail = true;
277
+ $widget_message_type = 'error';
278
+ $widget_message = esc_html__('Site does not support widget', 'widget-importer-exporter'); // Explain why widget not imported.
279
+ }
280
+
281
+ // Filter to modify settings object before conversion to array and import
282
+ // Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below)
283
+ // Ideally the newer wie_widget_settings_array below will be used instead of this.
284
+ $widget = apply_filters('wie_widget_settings', $widget);
285
+
286
+ // Convert multidimensional objects to multidimensional arrays
287
+ // Some plugins like Jetpack Widget Visibility store settings as multidimensional arrays
288
+ // Without this, they are imported as objects and cause fatal error on Widgets page
289
+ // If this creates problems for plugins that do actually intend settings in objects then may need to consider other approach: https://wordpress.org/support/topic/problem-with-array-of-arrays
290
+ // It is probably much more likely that arrays are used than objects, however.
291
+ $widget = json_decode(wp_json_encode($widget), true);
292
+
293
+ // Filter to modify settings array
294
+ // This is preferred over the older wie_widget_settings filter above
295
+ // Do before identical check because changes may make it identical to end result (such as URL replacements).
296
+ $widget = apply_filters('wie_widget_settings_array', $widget);
297
+
298
+ // Does widget with identical settings already exist in same sidebar?
299
+ if (! $fail && isset($widget_instances[$id_base])) {
300
+ // Get existing widgets in this sidebar.
301
+ $sidebars_widgets = get_option('sidebars_widgets');
302
+ $sidebar_widgets = isset($sidebars_widgets[$use_sidebar_id]) ? $sidebars_widgets[$use_sidebar_id] : array(); // Check Inactive if that's where will go.
303
+
304
+ // Loop widgets with ID base.
305
+ $single_widget_instances = ! empty($widget_instances[$id_base]) ? $widget_instances[$id_base] : array();
306
+ foreach ($single_widget_instances as $check_id => $check_widget) {
307
+ // Is widget in same sidebar and has identical settings?
308
+ if (in_array("$id_base-$check_id", $sidebar_widgets, true) && (array) $widget === $check_widget) {
309
+ $fail = true;
310
+ $widget_message_type = 'warning';
311
+
312
+ // Explain why widget not imported.
313
+ $widget_message = esc_html__('Widget already exists', 'widget-importer-exporter');
314
+
315
+ break;
316
+ }
317
+ }
318
+ }
319
+
320
+ // No failure.
321
+ if (! $fail) {
322
+ // Add widget instance
323
+ $single_widget_instances = get_option('widget_' . $id_base); // All instances for that widget ID base, get fresh every time.
324
+ $single_widget_instances = ! empty($single_widget_instances) ? $single_widget_instances : array(
325
+ '_multiwidget' => 1, // Start fresh if have to.
326
+ );
327
+ $single_widget_instances[] = $widget; // Add it.
328
+
329
+ // Get the key it was given.
330
+ end($single_widget_instances);
331
+ $new_instance_id_number = key($single_widget_instances);
332
+
333
+ // If key is 0, make it 1
334
+ // When 0, an issue can occur where adding a widget causes data from other widget to load,
335
+ // and the widget doesn't stick (reload wipes it).
336
+ if ('0' === strval($new_instance_id_number)) {
337
+ $new_instance_id_number = 1;
338
+ $single_widget_instances[$new_instance_id_number] = $single_widget_instances[0];
339
+ unset($single_widget_instances[0]);
340
+ }
341
+
342
+ // Move _multiwidget to end of array for uniformity.
343
+ if (isset($single_widget_instances['_multiwidget'])) {
344
+ $multiwidget = $single_widget_instances['_multiwidget'];
345
+ unset($single_widget_instances['_multiwidget']);
346
+ $single_widget_instances['_multiwidget'] = $multiwidget;
347
+ }
348
+
349
+ // Update option with new widget.
350
+ update_option('widget_' . $id_base, $single_widget_instances);
351
+
352
+ // Assign widget instance to sidebar.
353
+ // Which sidebars have which widgets, get fresh every time.
354
+ $sidebars_widgets = get_option('sidebars_widgets');
355
+
356
+ // Avoid rarely fatal error when the option is an empty string
357
+ // https://github.com/churchthemes/widget-importer-exporter/pull/11.
358
+ if (! $sidebars_widgets) {
359
+ $sidebars_widgets = array();
360
+ }
361
+
362
+ // Use ID number from new widget instance.
363
+ $new_instance_id = $id_base . '-' . $new_instance_id_number;
364
+
365
+ // Add new instance to sidebar.
366
+ $sidebars_widgets[$use_sidebar_id][] = $new_instance_id;
367
+
368
+ // Save the amended data.
369
+ update_option('sidebars_widgets', $sidebars_widgets);
370
+
371
+ // After widget import action.
372
+ $after_widget_import = array(
373
+ 'sidebar' => $use_sidebar_id,
374
+ 'sidebar_old' => $sidebar_id,
375
+ 'widget' => $widget,
376
+ 'widget_type' => $id_base,
377
+ 'widget_id' => $new_instance_id,
378
+ 'widget_id_old' => $widget_instance_id,
379
+ 'widget_id_num' => $new_instance_id_number,
380
+ 'widget_id_num_old' => $instance_id_number,
381
+ );
382
+ do_action('wie_after_widget_import', $after_widget_import);
383
+
384
+ // Success message.
385
+ if ($sidebar_available) {
386
+ $widget_message_type = 'success';
387
+ $widget_message = esc_html__('Imported', 'widget-importer-exporter');
388
+ } else {
389
+ $widget_message_type = 'warning';
390
+ $widget_message = esc_html__('Imported to Inactive', 'widget-importer-exporter');
391
+ }
392
+ }
393
+
394
+ // Result for widget instance
395
+ $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).
396
+ $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.
397
+ $results[$sidebar_id]['widgets'][$widget_instance_id]['message_type'] = $widget_message_type;
398
+ $results[$sidebar_id]['widgets'][$widget_instance_id]['message'] = $widget_message;
399
+ }
400
+ }
401
+
402
+ // Hook after import.
403
+ do_action('wie_after_import');
404
+
405
+ // Return results.
406
+ return apply_filters('wie_import_results', $results);
407
+ }
includes/mime-types.php CHANGED
@@ -4,16 +4,13 @@
4
  *
5
  * @package Widget_Importer_Exporter
6
  * @subpackage Functions
7
- * @copyright Copyright (c) 2013 - 2018, ChurchThemes.com
8
  * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
- * @license GPLv2 or later
10
  * @since 0.1
11
  */
12
 
13
- // No direct access.
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
 
18
  /**
19
  * Add mime type for upload
@@ -24,17 +21,14 @@ if ( ! defined( 'ABSPATH' ) ) {
24
  * @param array $mime_types Currently uploadable mime types.
25
  * @return array Mime types with additions
26
  */
27
- function wie_add_mime_types( $mime_types ) {
28
-
29
  //$mime_types['wie'] = 'application/json'; // 5.0.1 breaking change: https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/
30
  $mime_types['wie'] = 'text/plain';
31
 
32
  return $mime_types;
33
-
34
  }
35
 
36
- add_filter( 'upload_mimes', 'wie_add_mime_types' );
37
-
38
 
39
  /**
40
  * Allow .wie as text/html for 4.9.9 / 5.0.1
@@ -51,33 +45,32 @@ add_filter( 'upload_mimes', 'wie_add_mime_types' );
51
  * https://gist.github.com/rmpel/e1e2452ca06ab621fe061e0fde7ae150
52
  *
53
  * This is called in includes/import.php by wie_upload_import_file() so that it only happens during upload via this
54
- * plugin. add_filter( 'wp_check_filetype_and_ext', 'wie_allow_multiple_mime_types', 10, 4 );
55
  */
56
- function wie_allow_multiple_mime_types( $values, $file, $filename, $mimes ) {
57
-
58
- if ( extension_loaded( 'fileinfo' ) ) {
59
-
60
- $finfo = finfo_open( FILEINFO_MIME_TYPE );
61
- $real_mime = finfo_file( $finfo, $file );
62
-
63
- finfo_close( $finfo );
64
-
65
- if ( 'text/html' === $real_mime && preg_match( '/\.(wie)$/i', $filename ) ) {
 
 
66
  $values['ext'] = 'wie';
67
  $values['type'] = 'text/plain';
68
  }
69
 
70
  } else {
71
-
72
- if ( preg_match( '/\.(wie)$/i', $filename ) ) {
73
  $values['ext'] = 'wie';
74
  $values['type'] = 'text/plain';
75
  }
76
-
77
  }
78
 
79
  return $values;
80
-
81
  }
82
 
83
  /**
@@ -87,28 +80,28 @@ function wie_allow_multiple_mime_types( $values, $file, $filename, $mimes ) {
87
  * This workaround will only take effect on installs of 4.7.1 and only during import.
88
  *
89
  * This is called in includes/import.php by wie_upload_import_file() so that it only happens during upload via this
90
- * plugin. add_filter( 'wp_check_filetype_and_ext', 'wie_disable_real_mime_check', 10, 4 );
91
  *
92
  * Based on the Disable Real MIME Check plugin by Sergey Biryukov:
93
  * https://wordpress.org/plugins/disable-real-mime-check/ More information:
94
  * https://wordpress.org/support/topic/solution-for-wp-4-7-1-bug-causing-you-must-upload-a-wie-file-generated-by/
95
  */
96
- function wie_disable_real_mime_check( $data, $file, $filename, $mimes ) {
97
-
98
- $wp_version = get_bloginfo( 'version' );
 
99
 
100
  // WordPress 4.7.1 - 4.7.3 are affected only.
101
  // 4.7.2 and 4.7.3 were rushed out as security updates without the upload bug being fixed.
102
- if ( ! in_array( $wp_version, array( '4.7.1', '4.7.2', '4.7.3' ), true ) ) {
103
  return $data;
104
  }
105
 
106
- $wp_filetype = wp_check_filetype( $filename, $mimes );
107
 
108
  $ext = $wp_filetype['ext'];
109
  $type = $wp_filetype['type'];
110
  $proper_filename = $data['proper_filename'];
111
 
112
- return compact( 'ext', 'type', 'proper_filename' );
113
-
114
  }
4
  *
5
  * @package Widget_Importer_Exporter
6
  * @subpackage Functions
7
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
8
  * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
10
  * @since 0.1
11
  */
12
 
13
+ defined('ABSPATH') || exit; // No direct access.
 
 
 
14
 
15
  /**
16
  * Add mime type for upload
21
  * @param array $mime_types Currently uploadable mime types.
22
  * @return array Mime types with additions
23
  */
24
+ function wie_add_mime_types($mime_types) {
 
25
  //$mime_types['wie'] = 'application/json'; // 5.0.1 breaking change: https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/
26
  $mime_types['wie'] = 'text/plain';
27
 
28
  return $mime_types;
 
29
  }
30
 
31
+ add_filter('upload_mimes', 'wie_add_mime_types');
 
32
 
33
  /**
34
  * Allow .wie as text/html for 4.9.9 / 5.0.1
45
  * https://gist.github.com/rmpel/e1e2452ca06ab621fe061e0fde7ae150
46
  *
47
  * This is called in includes/import.php by wie_upload_import_file() so that it only happens during upload via this
48
+ * plugin. add_filter('wp_check_filetype_and_ext', 'wie_allow_multiple_mime_types', 10, 4);
49
  */
50
+ //@phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
51
+ function wie_allow_multiple_mime_types($values, $file, $filename, $mimes) {
52
+ if (extension_loaded('fileinfo')) {
53
+ // @codingStandardsIgnoreLine
54
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
55
+ // @codingStandardsIgnoreLine
56
+ $real_mime = finfo_file($finfo, $file);
57
+
58
+ // @codingStandardsIgnoreLine
59
+ finfo_close($finfo);
60
+
61
+ if ('text/html' === $real_mime && preg_match('/\.(wie)$/i', $filename)) {
62
  $values['ext'] = 'wie';
63
  $values['type'] = 'text/plain';
64
  }
65
 
66
  } else {
67
+ if (preg_match('/\.(wie)$/i', $filename)) {
 
68
  $values['ext'] = 'wie';
69
  $values['type'] = 'text/plain';
70
  }
 
71
  }
72
 
73
  return $values;
 
74
  }
75
 
76
  /**
80
  * This workaround will only take effect on installs of 4.7.1 and only during import.
81
  *
82
  * This is called in includes/import.php by wie_upload_import_file() so that it only happens during upload via this
83
+ * plugin. add_filter('wp_check_filetype_and_ext', 'wie_disable_real_mime_check', 10, 4);
84
  *
85
  * Based on the Disable Real MIME Check plugin by Sergey Biryukov:
86
  * https://wordpress.org/plugins/disable-real-mime-check/ More information:
87
  * https://wordpress.org/support/topic/solution-for-wp-4-7-1-bug-causing-you-must-upload-a-wie-file-generated-by/
88
  */
89
+ //@phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
90
+ function wie_disable_real_mime_check($data, $file, $filename, $mimes)
91
+ {
92
+ $wp_version = get_bloginfo('version');
93
 
94
  // WordPress 4.7.1 - 4.7.3 are affected only.
95
  // 4.7.2 and 4.7.3 were rushed out as security updates without the upload bug being fixed.
96
+ if (! in_array($wp_version, array('4.7.1', '4.7.2', '4.7.3'), true)) {
97
  return $data;
98
  }
99
 
100
+ $wp_filetype = wp_check_filetype($filename, $mimes);
101
 
102
  $ext = $wp_filetype['ext'];
103
  $type = $wp_filetype['type'];
104
  $proper_filename = $data['proper_filename'];
105
 
106
+ return compact('ext', 'type', 'proper_filename');
 
107
  }
includes/page.php CHANGED
@@ -1,233 +1,257 @@
1
- <?php
2
- /**
3
- * Admin Page Functions
4
- *
5
- * @package Widget_Importer_Exporter
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2013 - 2017, ChurchThemes.com
8
- * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
- * @license GPLv2 or later
10
- * @since 0.1
11
- */
12
-
13
- // No direct access.
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * Add import/export page under Tools
20
- *
21
- * @since 0.1
22
- */
23
- function wie_add_import_export_page() {
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
- 'edit_theme_options', // Capability (can manage Appearance > Widgets).
30
- 'widget-importer-exporter', // Menu Slug.
31
- 'wie_import_export_page_content' // Callback for displaying page content.
32
- );
33
-
34
- }
35
-
36
- add_action( 'admin_menu', 'wie_add_import_export_page' );
37
-
38
- /**
39
- * Import/export page content
40
- *
41
- * @since 0.1
42
- */
43
- function wie_import_export_page_content() {
44
-
45
- ?>
46
- <div class="wrap">
47
-
48
- <h2><?php esc_html_e( 'Widget Importer & Exporter', 'widget-importer-exporter' ); ?></h2>
49
-
50
- <?php
51
-
52
- // Show import results if have them.
53
- if ( wie_have_import_results() ) {
54
-
55
- wie_show_import_results();
56
-
57
- // Don't show content below.
58
- return;
59
-
60
- }
61
-
62
- ?>
63
-
64
- <h3 class="title"><?php echo esc_html_x( 'Import Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
65
-
66
- <p>
67
-
68
- <?php
69
-
70
- echo wp_kses(
71
- __( 'Please select a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ),
72
- array(
73
- 'b' => array(),
74
- )
75
- );
76
-
77
- ?>
78
-
79
- </p>
80
-
81
- <form method="post" enctype="multipart/form-data">
82
- <?php wp_nonce_field( 'wie_import', 'wie_import_nonce' ); ?>
83
- <input type="file" name="wie_import_file" id="wie-import-file"/>
84
- <?php submit_button( esc_html_x( 'Import Widgets', 'button', 'widget-importer-exporter' ) ); ?>
85
- </form>
86
-
87
- <?php if ( ! empty( $wie_import_results ) ) : ?>
88
- <p id="wie-import-results">
89
- <?php echo wp_kses_post( $wie_import_results ); ?>
90
- </p>
91
- <br/>
92
- <?php endif; ?>
93
-
94
- <h3 class="title"><?php echo esc_html_x( 'Export Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
95
-
96
- <p>
97
- <?php
98
- echo wp_kses(
99
- __( 'Click below to generate a <b>.wie</b> file for all active widgets.', 'widget-importer-exporter' ),
100
- array(
101
- 'b' => array(),
102
- )
103
- );
104
- ?>
105
- </p>
106
-
107
- <p class="submit">
108
-
109
- <a href="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] . '&export=1&wie_export_nonce=' . wp_create_nonce( 'wie_export' ) ) ); ?>" id="wie-export-button" class="button button-primary">
110
- <?php echo esc_html_x( 'Export Widgets', 'button', 'widget-importer-exporter' ); ?>
111
- </a>
112
-
113
- </p>
114
-
115
- </div>
116
-
117
- <?php
118
-
119
- }
120
-
121
- /**
122
- * Have import results to show?
123
- *
124
- * @since 0.3
125
- * @global string $wie_import_results
126
- * @return bool True if have import results to show
127
- */
128
- function wie_have_import_results() {
129
-
130
- global $wie_import_results;
131
-
132
- if ( ! empty( $wie_import_results ) ) {
133
- return true;
134
- }
135
-
136
- return false;
137
-
138
- }
139
-
140
- /**
141
- * Show import results
142
- *
143
- * This is shown in place of import/export page's regular content.
144
- *
145
- * @since 0.3
146
- * @global string $wie_import_results
147
- */
148
- function wie_show_import_results() {
149
-
150
- global $wie_import_results;
151
-
152
- ?>
153
-
154
- <h3 class="title"><?php echo esc_html_x( 'Import Results', 'heading', 'widget-importer-exporter' ); ?></h3>
155
-
156
- <p>
157
- <?php
158
- printf(
159
- wp_kses(
160
- /* translators: %1$s is URL for widgets screen, %2$s is URL to go back */
161
- __( 'You can manage your <a href="%1$s">Widgets</a> or <a href="%2$s">Go Back</a>.', 'widget-importer-exporter' ),
162
- array(
163
- 'a' => array(
164
- 'href' => array(),
165
- ),
166
- )
167
- ),
168
- esc_url( admin_url( 'widgets.php' ) ),
169
- esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] ) )
170
- );
171
- ?>
172
- </p>
173
-
174
- <table id="wie-import-results">
175
-
176
- <?php
177
- // Loop sidebars.
178
- $results = $wie_import_results;
179
- foreach ( $results as $sidebar ) :
180
- ?>
181
-
182
- <tr class="wie-import-results-sidebar">
183
- <td colspan="2" class="wie-import-results-sidebar-name">
184
- <?php
185
- // Sidebar name if theme supports it; otherwise ID.
186
- echo esc_html( $sidebar['name'] );
187
- ?>
188
- </td>
189
- <td class="wie-import-results-sidebar-message wie-import-results-message wie-import-results-message-<?php echo esc_attr( $sidebar['message_type'] ); ?>">
190
- <?php
191
- // Sidebar may not exist in theme.
192
- echo esc_html( $sidebar['message'] );
193
- ?>
194
- </td>
195
- </tr>
196
-
197
- <?php
198
- // Loop widgets.
199
- foreach ( $sidebar['widgets'] as $widget ) :
200
- ?>
201
-
202
- <tr class="wie-import-results-widget">
203
- <td class="wie-import-results-widget-name">
204
- <?php
205
- // Widget name or ID if name not available (not supported by site).
206
- echo esc_html( $widget['name'] );
207
- ?>
208
- </td>
209
- <td class="wie-import-results-widget-title">
210
- <?php
211
- // Shows "No Title" if widget instance is untitled.
212
- echo esc_html( $widget['title'] );
213
- ?>
214
- </td>
215
- <td class="wie-import-results-widget-message wie-import-results-message wie-import-results-message-<?php echo esc_attr( $widget['message_type'] ); ?>">
216
- <?php
217
- // Sidebar may not exist in theme.
218
- echo esc_html( $widget['message'] );
219
- ?>
220
- </td>
221
- </tr>
222
-
223
- <?php endforeach; ?>
224
-
225
- <tr class="wie-import-results-space">
226
- <td colspan="100%"></td>
227
- </tr>
228
-
229
- <?php endforeach; ?>
230
-
231
- </table>
232
- <?php
233
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Page Functions
4
+ *
5
+ * @package Widget_Importer_Exporter
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
8
+ * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
10
+ * @since 0.1
11
+ */
12
+
13
+ defined('ABSPATH') || exit; // No direct access.
14
+
15
+ /**
16
+ * Add import/export page under Tools
17
+ *
18
+ * @since 0.1
19
+ */
20
+ function wie_add_import_export_page()
21
+ {
22
+ // Add page.
23
+ $page_hook = add_management_page(
24
+ esc_html__('Widget Importer & Exporter', 'widget-importer-exporter'), // Page title.
25
+ esc_html__('Widget Importer & Exporter', 'widget-importer-exporter'), // Menu title.
26
+ 'edit_theme_options', // Capability (can manage Appearance > Widgets).
27
+ 'widget-importer-exporter', // Menu Slug.
28
+ 'wie_import_export_page_content' // Callback for displaying page content.
29
+ );
30
+ }
31
+
32
+ add_action('admin_menu', 'wie_add_import_export_page');
33
+
34
+ /**
35
+ * Import/export page content
36
+ *
37
+ * @since 0.1
38
+ */
39
+ function wie_import_export_page_content()
40
+ {
41
+ global $wie_import_results;
42
+
43
+ ?>
44
+ <div class="wrap">
45
+
46
+ <h2><?php esc_html_e('Widget Importer & Exporter', 'widget-importer-exporter'); ?></h2>
47
+
48
+ <?php
49
+
50
+ // Show import results if have them.
51
+ if (wie_have_import_results()) {
52
+ wie_show_import_results();
53
+
54
+ // Don't show content below.
55
+ return;
56
+ }
57
+
58
+ $self = isset($_SERVER['PHP_SELF']) ? filter_var(wp_unslash($_SERVER['PHP_SELF']), FILTER_SANITIZE_STRING) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
59
+ $page = isset($_GET['page']) ? filter_var(wp_unslash($_GET['page']), FILTER_SANITIZE_STRING) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
60
+
61
+ ?>
62
+
63
+ <h3 class="title"><?php echo esc_html_x('Import Widgets', 'heading', 'widget-importer-exporter'); ?></h3>
64
+
65
+ <form method="post" enctype="multipart/form-data">
66
+
67
+ <?php wp_nonce_field('wie_import', 'wie_import_nonce'); ?>
68
+
69
+ <p>
70
+
71
+ <?php
72
+
73
+ echo wp_kses(
74
+ __('Please select a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter'),
75
+ array(
76
+ 'b' => array(),
77
+ )
78
+ );
79
+
80
+ ?>
81
+
82
+ </p>
83
+
84
+ <input type="file" name="wie_import_file" id="wie-import-file"/>
85
+
86
+ <p>
87
+
88
+ <?php
89
+
90
+ echo wp_kses(
91
+ __('Or, <a href="#" id="wie-content-toggle">copy and paste</a> the contents of your <b>.wie</b> file.', 'widget-importer-exporter'),
92
+ array(
93
+ 'b' => array(),
94
+ 'a' => array(
95
+ 'href' => array(),
96
+ 'id' => array(),
97
+ ),
98
+ )
99
+ );
100
+
101
+ ?>
102
+
103
+ </p>
104
+
105
+ <textarea name="wie_import_data" id="wie-import-data" cols="80" rows="6"></textarea>
106
+
107
+ <?php submit_button(esc_html_x('Import Widgets', 'button', 'widget-importer-exporter')); ?>
108
+
109
+ </form>
110
+
111
+ <?php if (! empty($wie_import_results)) : ?>
112
+ <p id="wie-import-results">
113
+ <?php echo wp_kses_post($wie_import_results); ?>
114
+ </p>
115
+ <br/>
116
+ <?php endif; ?>
117
+
118
+ <h3 class="title"><?php echo esc_html_x('Export Widgets', 'heading', 'widget-importer-exporter'); ?></h3>
119
+
120
+ <p>
121
+ <?php
122
+ echo wp_kses(
123
+ __('Click below to generate a <b>.wie</b> file for all active widgets.', 'widget-importer-exporter'),
124
+ array(
125
+ 'b' => array(),
126
+ )
127
+ );
128
+ ?>
129
+ </p>
130
+
131
+ <p class="submit">
132
+ <a href="<?php echo esc_url(admin_url(basename($self) . '?page=' . $page . '&export=1&wie_export_nonce=' . wp_create_nonce('wie_export'))); ?>" id="wie-export-button" class="button button-primary">
133
+ <?php echo esc_html_x('Export Widgets', 'button', 'widget-importer-exporter'); ?>
134
+ </a>
135
+ </p>
136
+
137
+ </div>
138
+
139
+ <?php
140
+
141
+ }
142
+
143
+ /**
144
+ * Have import results to show?
145
+ *
146
+ * @since 0.3
147
+ * @global string $wie_import_results
148
+ * @return bool True if have import results to show
149
+ */
150
+ function wie_have_import_results()
151
+ {
152
+ global $wie_import_results;
153
+
154
+ if (! empty($wie_import_results)) {
155
+ return true;
156
+ }
157
+
158
+ return false;
159
+ }
160
+
161
+ /**
162
+ * Show import results
163
+ *
164
+ * This is shown in place of import/export page's regular content.
165
+ *
166
+ * @since 0.3
167
+ * @global string $wie_import_results
168
+ */
169
+ function wie_show_import_results()
170
+ {
171
+ global $wie_import_results;
172
+
173
+ $self = isset($_SERVER['PHP_SELF']) ? filter_var(wp_unslash($_SERVER['PHP_SELF']), FILTER_SANITIZE_STRING) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
174
+ $page = isset($_GET['page']) ? filter_var(wp_unslash($_GET['page']), FILTER_SANITIZE_STRING) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
175
+
176
+ ?>
177
+
178
+ <h3 class="title"><?php echo esc_html_x('Import Results', 'heading', 'widget-importer-exporter'); ?></h3>
179
+
180
+ <p>
181
+ <?php
182
+ printf(
183
+ wp_kses(
184
+ /* translators: %1$s is URL for widgets screen, %2$s is URL to go back */
185
+ __('You can manage your <a href="%1$s">Widgets</a> or <a href="%2$s">Go Back</a>.', 'widget-importer-exporter'),
186
+ array(
187
+ 'a' => array(
188
+ 'href' => array(),
189
+ ),
190
+ )
191
+ ),
192
+ esc_url(admin_url('widgets.php')),
193
+ esc_url(admin_url(basename($self) . '?page=' . $page))
194
+ );
195
+ ?>
196
+ </p>
197
+
198
+ <table id="wie-import-results">
199
+
200
+ <?php
201
+ // Loop sidebars.
202
+ $results = $wie_import_results;
203
+ foreach ($results as $sidebar) :
204
+ ?>
205
+
206
+ <tr class="wie-import-results-sidebar">
207
+ <td colspan="2" class="wie-import-results-sidebar-name">
208
+ <?php
209
+ // Sidebar name if theme supports it; otherwise ID.
210
+ echo esc_html($sidebar['name']);
211
+ ?>
212
+ </td>
213
+ <td class="wie-import-results-sidebar-message wie-import-results-message wie-import-results-message-<?php echo esc_attr($sidebar['message_type']); ?>">
214
+ <?php
215
+ // Sidebar may not exist in theme.
216
+ echo esc_html($sidebar['message']);
217
+ ?>
218
+ </td>
219
+ </tr>
220
+
221
+ <?php
222
+ // Loop widgets.
223
+ foreach ($sidebar['widgets'] as $widget) :
224
+ ?>
225
+
226
+ <tr class="wie-import-results-widget">
227
+ <td class="wie-import-results-widget-name">
228
+ <?php
229
+ // Widget name or ID if name not available (not supported by site).
230
+ echo esc_html($widget['name']);
231
+ ?>
232
+ </td>
233
+ <td class="wie-import-results-widget-title">
234
+ <?php
235
+ // Shows "No Title" if widget instance is untitled.
236
+ echo esc_html($widget['title']);
237
+ ?>
238
+ </td>
239
+ <td class="wie-import-results-widget-message wie-import-results-message wie-import-results-message-<?php echo esc_attr($widget['message_type']); ?>">
240
+ <?php
241
+ // Sidebar may not exist in theme.
242
+ echo esc_html($widget['message']);
243
+ ?>
244
+ </td>
245
+ </tr>
246
+
247
+ <?php endforeach; ?>
248
+
249
+ <tr class="wie-import-results-space">
250
+ <td colspan="100%"></td>
251
+ </tr>
252
+
253
+ <?php endforeach; ?>
254
+
255
+ </table>
256
+ <?php
257
+ }
includes/widgets.php CHANGED
@@ -1,48 +1,42 @@
1
- <?php
2
- /**
3
- * Widget Functions
4
- *
5
- * @package Widget_Importer_Exporter
6
- * @subpackage Functions
7
- * @copyright Copyright (c) 2013 - 2017, ChurchThemes.com
8
- * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
- * @license GPLv2 or later
10
- * @since 0.4
11
- */
12
-
13
- // No direct access.
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * Available widgets
20
- *
21
- * Gather site's widgets into array with ID base, name, etc.
22
- * Used by export and import functions.
23
- *
24
- * @since 0.4
25
- * @global array $wp_registered_widget_updates
26
- * @return array Widget information
27
- */
28
- function wie_available_widgets() {
29
-
30
- global $wp_registered_widget_controls;
31
-
32
- $widget_controls = $wp_registered_widget_controls;
33
-
34
- $available_widgets = array();
35
-
36
- foreach ( $widget_controls as $widget ) {
37
-
38
- // No duplicates.
39
- if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) {
40
- $available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
41
- $available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
42
- }
43
-
44
- }
45
-
46
- return apply_filters( 'wie_available_widgets', $available_widgets );
47
-
48
- }
1
+ <?php
2
+ /**
3
+ * Widget Functions
4
+ *
5
+ * @package Widget_Importer_Exporter
6
+ * @subpackage Functions
7
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
8
+ * @link https://churchthemes.com/plugins/widget-importer-exporter/
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
10
+ * @since 0.4
11
+ */
12
+
13
+ defined('ABSPATH') || exit; // No direct access.
14
+
15
+ /**
16
+ * Available widgets
17
+ *
18
+ * Gather site's widgets into array with ID base, name, etc.
19
+ * Used by export and import functions.
20
+ *
21
+ * @since 0.4
22
+ * @global array $wp_registered_widget_updates
23
+ * @return array Widget information
24
+ */
25
+ function wie_available_widgets()
26
+ {
27
+ global $wp_registered_widget_controls;
28
+
29
+ $widget_controls = $wp_registered_widget_controls;
30
+
31
+ $available_widgets = array();
32
+
33
+ foreach ($widget_controls as $widget) {
34
+ // No duplicates.
35
+ if (! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] )) {
36
+ $available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
37
+ $available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
38
+ }
39
+ }
40
+
41
+ return apply_filters( 'wie_available_widgets', $available_widgets );
42
+ }
 
 
 
 
 
 
js/main.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+
3
+ // Show textarea when click "copy and paste"
4
+ $('#wie-content-toggle').on('click', function () {
5
+ $('#wie-import-data').fadeIn('fast').focus();
6
+ });
7
+
8
+ });
languages/widget-importer-exporter-de_DE.mo CHANGED
Binary file
languages/widget-importer-exporter-de_DE.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
- "POT-Creation-Date: 2018-01-19 14:03-0600\n"
5
- "PO-Revision-Date: 2018-01-19 14:03-0600\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: \n"
8
  "Language: de_DE\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.4\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c\n"
@@ -18,96 +18,116 @@ msgstr ""
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
- #: ../includes/admin.php:65 ../includes/admin.php:99
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
- #: ../includes/import.php:43
26
- msgid "You must upload a <b>.wie</b> file generated by this plugin."
 
 
 
 
27
  msgstr ""
28
  "Eine von diesem Plugin erstellte <b>.wie</b>-Datei muss hochgeladen werden."
29
 
30
- #: ../includes/import.php:98
 
 
 
 
 
 
 
31
  msgid "Import file could not be found. Please try again."
32
  msgstr ""
33
  "Importierte Datei konnte nicht gefunden werden. Bitte nochmals versuchen."
34
 
35
- #: ../includes/import.php:137
36
- msgid "Import data could not be read. Please try a different file."
37
  msgstr ""
38
- "Importierte Datei konnte nicht gelesen werden. Bitte eine andere Datei "
39
- "versuchen."
40
 
41
- #: ../includes/import.php:181
42
  msgid "Widget area does not exist in theme (using Inactive)"
43
  msgstr ""
44
 
45
- #: ../includes/import.php:204
46
  msgid "Site does not support widget"
47
- msgstr "Seite unterstützt Widgets nicht."
48
 
49
- #: ../includes/import.php:242
50
  msgid "Widget already exists"
51
  msgstr "Widget existiert schon"
52
 
53
- #: ../includes/import.php:320
54
  msgid "Imported"
55
  msgstr "Importiert"
56
 
57
- #: ../includes/import.php:323
58
  msgid "Imported to Inactive"
59
  msgstr "Nach \"inaktiv\" importiert"
60
 
61
- #: ../includes/import.php:330
62
  msgid "No Title"
63
  msgstr "Kein Titel"
64
 
65
- #: ../includes/page.php:27 ../includes/page.php:28 ../includes/page.php:48
66
  msgid "Widget Importer & Exporter"
67
  msgstr "Widget Importer & Exporter"
68
 
69
- #: ../includes/page.php:64
70
  msgctxt "heading"
71
  msgid "Import Widgets"
72
  msgstr "Importiere Widgets"
73
 
74
- #: ../includes/page.php:71
75
  msgid "Please select a <b>.wie</b> file generated by this plugin."
76
  msgstr "Bitte eine von diesem Plugin erstellte <b>.wie</b>-Datei auswählen."
77
 
78
- #: ../includes/page.php:84
 
 
 
 
 
 
79
  msgctxt "button"
80
  msgid "Import Widgets"
81
  msgstr "Importiere Widgets"
82
 
83
- #: ../includes/page.php:94
84
  msgctxt "heading"
85
  msgid "Export Widgets"
86
  msgstr "Exportiere Widgets"
87
 
88
- #: ../includes/page.php:99
89
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
90
  msgstr ""
91
  "Unten klicken um eine <b>.wie</b>-Datei für alle aktiven Widgets zu "
92
  "erstellen."
93
 
94
- #: ../includes/page.php:110
95
  msgctxt "button"
96
  msgid "Export Widgets"
97
  msgstr "Exportiere Widgets"
98
 
99
- #: ../includes/page.php:154
100
  msgctxt "heading"
101
  msgid "Import Results"
102
  msgstr "Import-Ergebnis"
103
 
104
- #: ../includes/page.php:161
105
  #, php-format
106
  msgid ""
107
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
108
  "Back</a>."
109
  msgstr ""
110
 
 
 
 
 
 
111
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
112
  #~ msgstr "Seitenleiste existiert nicht in diesem Theme (nutze \"inaktiv\")"
113
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
+ "POT-Creation-Date: 2020-05-18 11:35-0500\n"
5
+ "PO-Revision-Date: 2020-05-18 11:36-0500\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: \n"
8
  "Language: de_DE\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.3.1\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
+ #: ../includes/admin.php:78 ../includes/admin.php:109
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
+ #: ../includes/import.php:45
26
+ #, fuzzy, php-format
27
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
28
+ msgid ""
29
+ "You must upload a <b>.wie</b> file generated by this plugin (<a href=\"%1$s"
30
+ "\" target=\"_blank\">help</a>)."
31
  msgstr ""
32
  "Eine von diesem Plugin erstellte <b>.wie</b>-Datei muss hochgeladen werden."
33
 
34
+ #: ../includes/import.php:114
35
+ #, fuzzy
36
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
37
+ msgid "You must choose a <b>.wie</b> file to upload or paste its contents."
38
+ msgstr ""
39
+ "Eine von diesem Plugin erstellte <b>.wie</b>-Datei muss hochgeladen werden."
40
+
41
+ #: ../includes/import.php:152
42
  msgid "Import file could not be found. Please try again."
43
  msgstr ""
44
  "Importierte Datei konnte nicht gefunden werden. Bitte nochmals versuchen."
45
 
46
+ #: ../includes/import.php:187
47
+ msgid "Import data is invalid."
48
  msgstr ""
 
 
49
 
50
+ #: ../includes/import.php:229
51
  msgid "Widget area does not exist in theme (using Inactive)"
52
  msgstr ""
53
 
54
+ #: ../includes/import.php:251
55
  msgid "Site does not support widget"
56
+ msgstr "Seite unterstützt Widgets nicht"
57
 
58
+ #: ../includes/import.php:286
59
  msgid "Widget already exists"
60
  msgstr "Widget existiert schon"
61
 
62
+ #: ../includes/import.php:360
63
  msgid "Imported"
64
  msgstr "Importiert"
65
 
66
+ #: ../includes/import.php:363
67
  msgid "Imported to Inactive"
68
  msgstr "Nach \"inaktiv\" importiert"
69
 
70
+ #: ../includes/import.php:369
71
  msgid "No Title"
72
  msgstr "Kein Titel"
73
 
74
+ #: ../includes/page.php:23 ../includes/page.php:24 ../includes/page.php:44
75
  msgid "Widget Importer & Exporter"
76
  msgstr "Widget Importer & Exporter"
77
 
78
+ #: ../includes/page.php:61
79
  msgctxt "heading"
80
  msgid "Import Widgets"
81
  msgstr "Importiere Widgets"
82
 
83
+ #: ../includes/page.php:72
84
  msgid "Please select a <b>.wie</b> file generated by this plugin."
85
  msgstr "Bitte eine von diesem Plugin erstellte <b>.wie</b>-Datei auswählen."
86
 
87
+ #: ../includes/page.php:89
88
+ msgid ""
89
+ "Or, <a href=\"#\" id=\"wie-content-toggle\">copy and paste</a> the contents "
90
+ "of your <b>.wie</b> file."
91
+ msgstr ""
92
+
93
+ #: ../includes/page.php:105
94
  msgctxt "button"
95
  msgid "Import Widgets"
96
  msgstr "Importiere Widgets"
97
 
98
+ #: ../includes/page.php:116
99
  msgctxt "heading"
100
  msgid "Export Widgets"
101
  msgstr "Exportiere Widgets"
102
 
103
+ #: ../includes/page.php:121
104
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
105
  msgstr ""
106
  "Unten klicken um eine <b>.wie</b>-Datei für alle aktiven Widgets zu "
107
  "erstellen."
108
 
109
+ #: ../includes/page.php:131
110
  msgctxt "button"
111
  msgid "Export Widgets"
112
  msgstr "Exportiere Widgets"
113
 
114
+ #: ../includes/page.php:174
115
  msgctxt "heading"
116
  msgid "Import Results"
117
  msgstr "Import-Ergebnis"
118
 
119
+ #: ../includes/page.php:181
120
  #, php-format
121
  msgid ""
122
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
123
  "Back</a>."
124
  msgstr ""
125
 
126
+ #~ msgid "Import data could not be read. Please try a different file."
127
+ #~ msgstr ""
128
+ #~ "Importierte Datei konnte nicht gelesen werden. Bitte eine andere Datei "
129
+ #~ "versuchen."
130
+
131
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
132
  #~ msgstr "Seitenleiste existiert nicht in diesem Theme (nutze \"inaktiv\")"
133
 
languages/widget-importer-exporter-es_ES.mo CHANGED
Binary file
languages/widget-importer-exporter-es_ES.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
- "POT-Creation-Date: 2018-01-19 14:03-0600\n"
5
- "PO-Revision-Date: 2018-01-19 14:03-0600\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: PNTE <blogs@educacion.navarra.es>\n"
8
  "Language: es_ES\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.4\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c;_c\n"
@@ -18,97 +18,116 @@ msgstr ""
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: includes/admin.php:65 includes/admin.php:99
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
- #: includes/import.php:43
26
- msgid "You must upload a <b>.wie</b> file generated by this plugin."
 
 
 
 
 
 
 
 
 
 
27
  msgstr "Debes subir un fichero <b>.wie</b>, generado por este plugin."
28
 
29
- #: includes/import.php:98
30
  msgid "Import file could not be found. Please try again."
31
  msgstr ""
32
  "El fichero de importación no ha podido ser encontrado. Por favor, inténtalo "
33
  "de nuevo."
34
 
35
- #: includes/import.php:137
36
- msgid "Import data could not be read. Please try a different file."
37
  msgstr ""
38
- "El fichero de importación no ha podido ser leído. Por favor, inténtalo de "
39
- "nuevo con un fichero diferente."
40
 
41
- #: includes/import.php:181
42
  msgid "Widget area does not exist in theme (using Inactive)"
43
  msgstr ""
44
 
45
- #: includes/import.php:204
46
  msgid "Site does not support widget"
47
  msgstr "El sitio no soporta este widget"
48
 
49
- #: includes/import.php:242
50
  msgid "Widget already exists"
51
  msgstr "El widget ya existe"
52
 
53
- #: includes/import.php:320
54
  msgid "Imported"
55
  msgstr "Importado"
56
 
57
- #: includes/import.php:323
58
  msgid "Imported to Inactive"
59
  msgstr "Importado como inactivo"
60
 
61
- #: includes/import.php:330
62
  msgid "No Title"
63
  msgstr "Sin título"
64
 
65
- #: includes/page.php:27 includes/page.php:28 includes/page.php:48
66
  msgid "Widget Importer & Exporter"
67
  msgstr "Widget Importer & Exporter"
68
 
69
- #: includes/page.php:64
70
  msgctxt "heading"
71
  msgid "Import Widgets"
72
  msgstr "Importar widgets"
73
 
74
- #: includes/page.php:71
75
  msgid "Please select a <b>.wie</b> file generated by this plugin."
76
  msgstr ""
77
  "Por favor, selecciona un fichero <b>.wie</b>, generado por este plugin."
78
 
79
- #: includes/page.php:84
 
 
 
 
 
 
80
  msgctxt "button"
81
  msgid "Import Widgets"
82
  msgstr "Importar widgets"
83
 
84
- #: includes/page.php:94
85
  msgctxt "heading"
86
  msgid "Export Widgets"
87
  msgstr "Exportar widgets"
88
 
89
- #: includes/page.php:99
90
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
91
  msgstr ""
92
  "Haz clic el el botón que tienes a continuación, para generar un fichero <b>."
93
  "wie</b>, para todos los widgets activos."
94
 
95
- #: includes/page.php:110
96
  msgctxt "button"
97
  msgid "Export Widgets"
98
  msgstr "Exportar widgets"
99
 
100
- #: includes/page.php:154
101
  msgctxt "heading"
102
  msgid "Import Results"
103
  msgstr "Resultados de la exportación"
104
 
105
- #: includes/page.php:161
106
  #, php-format
107
  msgid ""
108
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
109
  "Back</a>."
110
  msgstr ""
111
 
 
 
 
 
 
112
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
113
  #~ msgstr ""
114
  #~ "La barra lateral no existe en el tema (sus widgets se importarán como "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
+ "POT-Creation-Date: 2020-05-18 11:35-0500\n"
5
+ "PO-Revision-Date: 2020-05-18 11:35-0500\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: PNTE <blogs@educacion.navarra.es>\n"
8
  "Language: es_ES\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.3.1\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c;_c\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: includes/admin.php:78 includes/admin.php:109
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
+ #: includes/import.php:45
26
+ #, fuzzy, php-format
27
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
28
+ msgid ""
29
+ "You must upload a <b>.wie</b> file generated by this plugin (<a href=\"%1$s"
30
+ "\" target=\"_blank\">help</a>)."
31
+ msgstr "Debes subir un fichero <b>.wie</b>, generado por este plugin."
32
+
33
+ #: includes/import.php:114
34
+ #, fuzzy
35
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
36
+ msgid "You must choose a <b>.wie</b> file to upload or paste its contents."
37
  msgstr "Debes subir un fichero <b>.wie</b>, generado por este plugin."
38
 
39
+ #: includes/import.php:152
40
  msgid "Import file could not be found. Please try again."
41
  msgstr ""
42
  "El fichero de importación no ha podido ser encontrado. Por favor, inténtalo "
43
  "de nuevo."
44
 
45
+ #: includes/import.php:187
46
+ msgid "Import data is invalid."
47
  msgstr ""
 
 
48
 
49
+ #: includes/import.php:229
50
  msgid "Widget area does not exist in theme (using Inactive)"
51
  msgstr ""
52
 
53
+ #: includes/import.php:251
54
  msgid "Site does not support widget"
55
  msgstr "El sitio no soporta este widget"
56
 
57
+ #: includes/import.php:286
58
  msgid "Widget already exists"
59
  msgstr "El widget ya existe"
60
 
61
+ #: includes/import.php:360
62
  msgid "Imported"
63
  msgstr "Importado"
64
 
65
+ #: includes/import.php:363
66
  msgid "Imported to Inactive"
67
  msgstr "Importado como inactivo"
68
 
69
+ #: includes/import.php:369
70
  msgid "No Title"
71
  msgstr "Sin título"
72
 
73
+ #: includes/page.php:23 includes/page.php:24 includes/page.php:44
74
  msgid "Widget Importer & Exporter"
75
  msgstr "Widget Importer & Exporter"
76
 
77
+ #: includes/page.php:61
78
  msgctxt "heading"
79
  msgid "Import Widgets"
80
  msgstr "Importar widgets"
81
 
82
+ #: includes/page.php:72
83
  msgid "Please select a <b>.wie</b> file generated by this plugin."
84
  msgstr ""
85
  "Por favor, selecciona un fichero <b>.wie</b>, generado por este plugin."
86
 
87
+ #: includes/page.php:89
88
+ msgid ""
89
+ "Or, <a href=\"#\" id=\"wie-content-toggle\">copy and paste</a> the contents "
90
+ "of your <b>.wie</b> file."
91
+ msgstr ""
92
+
93
+ #: includes/page.php:105
94
  msgctxt "button"
95
  msgid "Import Widgets"
96
  msgstr "Importar widgets"
97
 
98
+ #: includes/page.php:116
99
  msgctxt "heading"
100
  msgid "Export Widgets"
101
  msgstr "Exportar widgets"
102
 
103
+ #: includes/page.php:121
104
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
105
  msgstr ""
106
  "Haz clic el el botón que tienes a continuación, para generar un fichero <b>."
107
  "wie</b>, para todos los widgets activos."
108
 
109
+ #: includes/page.php:131
110
  msgctxt "button"
111
  msgid "Export Widgets"
112
  msgstr "Exportar widgets"
113
 
114
+ #: includes/page.php:174
115
  msgctxt "heading"
116
  msgid "Import Results"
117
  msgstr "Resultados de la exportación"
118
 
119
+ #: includes/page.php:181
120
  #, php-format
121
  msgid ""
122
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
123
  "Back</a>."
124
  msgstr ""
125
 
126
+ #~ msgid "Import data could not be read. Please try a different file."
127
+ #~ msgstr ""
128
+ #~ "El fichero de importación no ha podido ser leído. Por favor, inténtalo de "
129
+ #~ "nuevo con un fichero diferente."
130
+
131
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
132
  #~ msgstr ""
133
  #~ "La barra lateral no existe en el tema (sus widgets se importarán como "
languages/widget-importer-exporter-nl_NL.mo CHANGED
Binary file
languages/widget-importer-exporter-nl_NL.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
- "POT-Creation-Date: 2018-01-19 14:03-0600\n"
5
- "PO-Revision-Date: 2018-01-19 14:03-0600\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.4\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c\n"
@@ -18,93 +18,115 @@ msgstr ""
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
- #: ../includes/admin.php:65 ../includes/admin.php:99
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
- #: ../includes/import.php:43
26
- msgid "You must upload a <b>.wie</b> file generated by this plugin."
 
 
 
 
 
 
 
 
 
 
 
 
27
  msgstr ""
28
  "U dient een <b>.wie</b> bestand te uploaden dat is gegenereerd door deze "
29
  "plugin."
30
 
31
- #: ../includes/import.php:98
32
  msgid "Import file could not be found. Please try again."
33
  msgstr "Importbestand niet gevonden. Probeer het opnieuw."
34
 
35
- #: ../includes/import.php:137
36
- msgid "Import data could not be read. Please try a different file."
37
- msgstr "Importgegevens kunnen niet gelezen worden. Probeer een ander bestand."
38
 
39
- #: ../includes/import.php:181
40
  msgid "Widget area does not exist in theme (using Inactive)"
41
  msgstr ""
42
 
43
- #: ../includes/import.php:204
44
  msgid "Site does not support widget"
45
  msgstr "Website ondersteund geen widgets"
46
 
47
- #: ../includes/import.php:242
48
  msgid "Widget already exists"
49
  msgstr "Widget bestaat reeds"
50
 
51
- #: ../includes/import.php:320
52
  msgid "Imported"
53
  msgstr "Geïmporteerd"
54
 
55
- #: ../includes/import.php:323
56
  msgid "Imported to Inactive"
57
  msgstr "Geïmporteerd naar inactief"
58
 
59
- #: ../includes/import.php:330
60
  msgid "No Title"
61
  msgstr "Geen titel"
62
 
63
- #: ../includes/page.php:27 ../includes/page.php:28 ../includes/page.php:48
64
  msgid "Widget Importer & Exporter"
65
  msgstr "Widget Importeer & Exporteer"
66
 
67
- #: ../includes/page.php:64
68
  msgctxt "heading"
69
  msgid "Import Widgets"
70
  msgstr "Importeer Widgets"
71
 
72
- #: ../includes/page.php:71
73
  msgid "Please select a <b>.wie</b> file generated by this plugin."
74
  msgstr "Selecteer aub een <b>.wie</b> bestand gegenereerd door deze plugin."
75
 
76
- #: ../includes/page.php:84
 
 
 
 
 
 
77
  msgctxt "button"
78
  msgid "Import Widgets"
79
  msgstr "Importeer Widgets"
80
 
81
- #: ../includes/page.php:94
82
  msgctxt "heading"
83
  msgid "Export Widgets"
84
  msgstr "Exporteer Widgets"
85
 
86
- #: ../includes/page.php:99
87
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
88
  msgstr ""
89
  "Click hier beneden om een <b>.wie</b> te genereren voor alle actieve widgets."
90
 
91
- #: ../includes/page.php:110
92
  msgctxt "button"
93
  msgid "Export Widgets"
94
  msgstr "Exporteer Widgets"
95
 
96
- #: ../includes/page.php:154
97
  msgctxt "heading"
98
  msgid "Import Results"
99
  msgstr "Import Resultaten"
100
 
101
- #: ../includes/page.php:161
102
  #, php-format
103
  msgid ""
104
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
105
  "Back</a>."
106
  msgstr ""
107
 
 
 
 
 
108
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
109
  #~ msgstr "Zijbalk container bestaat niet in deze Template (gebruik inactief)"
110
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
+ "POT-Creation-Date: 2020-05-18 11:35-0500\n"
5
+ "PO-Revision-Date: 2020-05-18 11:35-0500\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.3.1\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
+ #: ../includes/admin.php:78 ../includes/admin.php:109
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
+ #: ../includes/import.php:45
26
+ #, fuzzy, php-format
27
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
28
+ msgid ""
29
+ "You must upload a <b>.wie</b> file generated by this plugin (<a href=\"%1$s"
30
+ "\" target=\"_blank\">help</a>)."
31
+ msgstr ""
32
+ "U dient een <b>.wie</b> bestand te uploaden dat is gegenereerd door deze "
33
+ "plugin."
34
+
35
+ #: ../includes/import.php:114
36
+ #, fuzzy
37
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
38
+ msgid "You must choose a <b>.wie</b> file to upload or paste its contents."
39
  msgstr ""
40
  "U dient een <b>.wie</b> bestand te uploaden dat is gegenereerd door deze "
41
  "plugin."
42
 
43
+ #: ../includes/import.php:152
44
  msgid "Import file could not be found. Please try again."
45
  msgstr "Importbestand niet gevonden. Probeer het opnieuw."
46
 
47
+ #: ../includes/import.php:187
48
+ msgid "Import data is invalid."
49
+ msgstr ""
50
 
51
+ #: ../includes/import.php:229
52
  msgid "Widget area does not exist in theme (using Inactive)"
53
  msgstr ""
54
 
55
+ #: ../includes/import.php:251
56
  msgid "Site does not support widget"
57
  msgstr "Website ondersteund geen widgets"
58
 
59
+ #: ../includes/import.php:286
60
  msgid "Widget already exists"
61
  msgstr "Widget bestaat reeds"
62
 
63
+ #: ../includes/import.php:360
64
  msgid "Imported"
65
  msgstr "Geïmporteerd"
66
 
67
+ #: ../includes/import.php:363
68
  msgid "Imported to Inactive"
69
  msgstr "Geïmporteerd naar inactief"
70
 
71
+ #: ../includes/import.php:369
72
  msgid "No Title"
73
  msgstr "Geen titel"
74
 
75
+ #: ../includes/page.php:23 ../includes/page.php:24 ../includes/page.php:44
76
  msgid "Widget Importer & Exporter"
77
  msgstr "Widget Importeer & Exporteer"
78
 
79
+ #: ../includes/page.php:61
80
  msgctxt "heading"
81
  msgid "Import Widgets"
82
  msgstr "Importeer Widgets"
83
 
84
+ #: ../includes/page.php:72
85
  msgid "Please select a <b>.wie</b> file generated by this plugin."
86
  msgstr "Selecteer aub een <b>.wie</b> bestand gegenereerd door deze plugin."
87
 
88
+ #: ../includes/page.php:89
89
+ msgid ""
90
+ "Or, <a href=\"#\" id=\"wie-content-toggle\">copy and paste</a> the contents "
91
+ "of your <b>.wie</b> file."
92
+ msgstr ""
93
+
94
+ #: ../includes/page.php:105
95
  msgctxt "button"
96
  msgid "Import Widgets"
97
  msgstr "Importeer Widgets"
98
 
99
+ #: ../includes/page.php:116
100
  msgctxt "heading"
101
  msgid "Export Widgets"
102
  msgstr "Exporteer Widgets"
103
 
104
+ #: ../includes/page.php:121
105
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
106
  msgstr ""
107
  "Click hier beneden om een <b>.wie</b> te genereren voor alle actieve widgets."
108
 
109
+ #: ../includes/page.php:131
110
  msgctxt "button"
111
  msgid "Export Widgets"
112
  msgstr "Exporteer Widgets"
113
 
114
+ #: ../includes/page.php:174
115
  msgctxt "heading"
116
  msgid "Import Results"
117
  msgstr "Import Resultaten"
118
 
119
+ #: ../includes/page.php:181
120
  #, php-format
121
  msgid ""
122
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
123
  "Back</a>."
124
  msgstr ""
125
 
126
+ #~ msgid "Import data could not be read. Please try a different file."
127
+ #~ msgstr ""
128
+ #~ "Importgegevens kunnen niet gelezen worden. Probeer een ander bestand."
129
+
130
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
131
  #~ msgstr "Zijbalk container bestaat niet in deze Template (gebruik inactief)"
132
 
languages/widget-importer-exporter-sr_RS.mo CHANGED
Binary file
languages/widget-importer-exporter-sr_RS.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
- "POT-Creation-Date: 2018-01-19 14:03-0600\n"
5
- "PO-Revision-Date: 2018-01-19 14:03-0600\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: PNTE <blogs@educacion.navarra.es>\n"
8
  "Language: sr_RS\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.4\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c;_c\n"
@@ -18,95 +18,114 @@ msgstr ""
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- #: includes/admin.php:65 includes/admin.php:99
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
- #: includes/import.php:43
26
- msgid "You must upload a <b>.wie</b> file generated by this plugin."
 
 
 
 
 
 
 
 
 
 
27
  msgstr "Morate otpremiti <b>.wie</b> datoteku koju je generisao ovaj plugin."
28
 
29
- #: includes/import.php:98
30
  msgid "Import file could not be found. Please try again."
31
  msgstr "Datoteka za uvoz nije nađena. Molimo vas, pokušajte ponovo."
32
 
33
- #: includes/import.php:137
34
- msgid "Import data could not be read. Please try a different file."
35
  msgstr ""
36
- "Podaci za uvoz ne mogu da se pročitaju. Molimo vas da isprobate drugu "
37
- "datoteku."
38
 
39
- #: includes/import.php:181
40
  msgid "Widget area does not exist in theme (using Inactive)"
41
  msgstr ""
42
 
43
- #: includes/import.php:204
44
  msgid "Site does not support widget"
45
  msgstr "Site ne podržava widget"
46
 
47
- #: includes/import.php:242
48
  msgid "Widget already exists"
49
  msgstr "Widget već postoji"
50
 
51
- #: includes/import.php:320
52
  msgid "Imported"
53
  msgstr "Uvezen"
54
 
55
- #: includes/import.php:323
56
  msgid "Imported to Inactive"
57
  msgstr "Uvezen u Neaktivne"
58
 
59
- #: includes/import.php:330
60
  msgid "No Title"
61
  msgstr "Nema naslova"
62
 
63
- #: includes/page.php:27 includes/page.php:28 includes/page.php:48
64
  msgid "Widget Importer & Exporter"
65
  msgstr "Widget Importer & Exporter"
66
 
67
- #: includes/page.php:64
68
  msgctxt "heading"
69
  msgid "Import Widgets"
70
  msgstr "Uvezi widget-e"
71
 
72
- #: includes/page.php:71
73
  msgid "Please select a <b>.wie</b> file generated by this plugin."
74
  msgstr ""
75
  "Molimo vas, odaberite <b>.wie</b> datoteku koju je generisao ovaj plugin."
76
 
77
- #: includes/page.php:84
 
 
 
 
 
 
78
  msgctxt "button"
79
  msgid "Import Widgets"
80
  msgstr "Uvezi widget-e"
81
 
82
- #: includes/page.php:94
83
  msgctxt "heading"
84
  msgid "Export Widgets"
85
  msgstr "Izvezi widget-e"
86
 
87
- #: includes/page.php:99
88
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
89
  msgstr ""
90
  "Kliknite ispod da biste generisali <b>.wie</b> datoteku za sve aktivne "
91
  "widget-e."
92
 
93
- #: includes/page.php:110
94
  msgctxt "button"
95
  msgid "Export Widgets"
96
  msgstr "Izvezi widget-e."
97
 
98
- #: includes/page.php:154
99
  msgctxt "heading"
100
  msgid "Import Results"
101
  msgstr "Uvezi rezultate"
102
 
103
- #: includes/page.php:161
104
  #, php-format
105
  msgid ""
106
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
107
  "Back</a>."
108
  msgstr ""
109
 
 
 
 
 
 
110
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
111
  #~ msgstr "Bočni meni ne postoji u temi (nije aktiviran)"
112
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Widget Importer & Exporter\n"
4
+ "POT-Creation-Date: 2020-05-18 11:35-0500\n"
5
+ "PO-Revision-Date: 2020-05-18 11:35-0500\n"
6
  "Last-Translator: churchthemes.com <contact@churchthemes.com>\n"
7
  "Language-Team: PNTE <blogs@educacion.navarra.es>\n"
8
  "Language: sr_RS\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.3.1\n"
13
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
14
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
15
  "_nx_noop:1,2,3c;_c\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ #: includes/admin.php:78 includes/admin.php:109
22
  msgid "Import/Export"
23
  msgstr ""
24
 
25
+ #: includes/import.php:45
26
+ #, fuzzy, php-format
27
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
28
+ msgid ""
29
+ "You must upload a <b>.wie</b> file generated by this plugin (<a href=\"%1$s"
30
+ "\" target=\"_blank\">help</a>)."
31
+ msgstr "Morate otpremiti <b>.wie</b> datoteku koju je generisao ovaj plugin."
32
+
33
+ #: includes/import.php:114
34
+ #, fuzzy
35
+ #| msgid "You must upload a <b>.wie</b> file generated by this plugin."
36
+ msgid "You must choose a <b>.wie</b> file to upload or paste its contents."
37
  msgstr "Morate otpremiti <b>.wie</b> datoteku koju je generisao ovaj plugin."
38
 
39
+ #: includes/import.php:152
40
  msgid "Import file could not be found. Please try again."
41
  msgstr "Datoteka za uvoz nije nađena. Molimo vas, pokušajte ponovo."
42
 
43
+ #: includes/import.php:187
44
+ msgid "Import data is invalid."
45
  msgstr ""
 
 
46
 
47
+ #: includes/import.php:229
48
  msgid "Widget area does not exist in theme (using Inactive)"
49
  msgstr ""
50
 
51
+ #: includes/import.php:251
52
  msgid "Site does not support widget"
53
  msgstr "Site ne podržava widget"
54
 
55
+ #: includes/import.php:286
56
  msgid "Widget already exists"
57
  msgstr "Widget već postoji"
58
 
59
+ #: includes/import.php:360
60
  msgid "Imported"
61
  msgstr "Uvezen"
62
 
63
+ #: includes/import.php:363
64
  msgid "Imported to Inactive"
65
  msgstr "Uvezen u Neaktivne"
66
 
67
+ #: includes/import.php:369
68
  msgid "No Title"
69
  msgstr "Nema naslova"
70
 
71
+ #: includes/page.php:23 includes/page.php:24 includes/page.php:44
72
  msgid "Widget Importer & Exporter"
73
  msgstr "Widget Importer & Exporter"
74
 
75
+ #: includes/page.php:61
76
  msgctxt "heading"
77
  msgid "Import Widgets"
78
  msgstr "Uvezi widget-e"
79
 
80
+ #: includes/page.php:72
81
  msgid "Please select a <b>.wie</b> file generated by this plugin."
82
  msgstr ""
83
  "Molimo vas, odaberite <b>.wie</b> datoteku koju je generisao ovaj plugin."
84
 
85
+ #: includes/page.php:89
86
+ msgid ""
87
+ "Or, <a href=\"#\" id=\"wie-content-toggle\">copy and paste</a> the contents "
88
+ "of your <b>.wie</b> file."
89
+ msgstr ""
90
+
91
+ #: includes/page.php:105
92
  msgctxt "button"
93
  msgid "Import Widgets"
94
  msgstr "Uvezi widget-e"
95
 
96
+ #: includes/page.php:116
97
  msgctxt "heading"
98
  msgid "Export Widgets"
99
  msgstr "Izvezi widget-e"
100
 
101
+ #: includes/page.php:121
102
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
103
  msgstr ""
104
  "Kliknite ispod da biste generisali <b>.wie</b> datoteku za sve aktivne "
105
  "widget-e."
106
 
107
+ #: includes/page.php:131
108
  msgctxt "button"
109
  msgid "Export Widgets"
110
  msgstr "Izvezi widget-e."
111
 
112
+ #: includes/page.php:174
113
  msgctxt "heading"
114
  msgid "Import Results"
115
  msgstr "Uvezi rezultate"
116
 
117
+ #: includes/page.php:181
118
  #, php-format
119
  msgid ""
120
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go "
121
  "Back</a>."
122
  msgstr ""
123
 
124
+ #~ msgid "Import data could not be read. Please try a different file."
125
+ #~ msgstr ""
126
+ #~ "Podaci za uvoz ne mogu da se pročitaju. Molimo vas da isprobate drugu "
127
+ #~ "datoteku."
128
+
129
  #~ msgid "Sidebar does not exist in theme (using Inactive)"
130
  #~ msgstr "Bočni meni ne postoji u temi (nije aktiviran)"
131
 
languages/widget-importer-exporter.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Widget Importer & Exporter\n"
5
- "POT-Creation-Date: 2018-01-19 14:03-0600\n"
6
  "PO-Revision-Date: 2015-02-23 09:31-0600\n"
7
  "Last-Translator: churchthemes.com\n"
8
  "Language-Team: \n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 2.0.4\n"
14
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
15
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
16
  "_nx_noop:1,2,3c\n"
@@ -19,84 +19,97 @@ msgstr ""
19
  "X-Poedit-SourceCharset: UTF-8\n"
20
  "X-Poedit-SearchPath-0: ..\n"
21
 
22
- #: ../includes/admin.php:65 ../includes/admin.php:99
23
  msgid "Import/Export"
24
  msgstr ""
25
 
26
- #: ../includes/import.php:43
27
- msgid "You must upload a <b>.wie</b> file generated by this plugin."
 
 
 
 
 
 
 
28
  msgstr ""
29
 
30
- #: ../includes/import.php:98
31
  msgid "Import file could not be found. Please try again."
32
  msgstr ""
33
 
34
- #: ../includes/import.php:137
35
- msgid "Import data could not be read. Please try a different file."
36
  msgstr ""
37
 
38
- #: ../includes/import.php:181
39
  msgid "Widget area does not exist in theme (using Inactive)"
40
  msgstr ""
41
 
42
- #: ../includes/import.php:204
43
  msgid "Site does not support widget"
44
  msgstr ""
45
 
46
- #: ../includes/import.php:242
47
  msgid "Widget already exists"
48
  msgstr ""
49
 
50
- #: ../includes/import.php:320
51
  msgid "Imported"
52
  msgstr ""
53
 
54
- #: ../includes/import.php:323
55
  msgid "Imported to Inactive"
56
  msgstr ""
57
 
58
- #: ../includes/import.php:330
59
  msgid "No Title"
60
  msgstr ""
61
 
62
- #: ../includes/page.php:27 ../includes/page.php:28 ../includes/page.php:48
63
  msgid "Widget Importer & Exporter"
64
  msgstr ""
65
 
66
- #: ../includes/page.php:64
67
  msgctxt "heading"
68
  msgid "Import Widgets"
69
  msgstr ""
70
 
71
- #: ../includes/page.php:71
72
  msgid "Please select a <b>.wie</b> file generated by this plugin."
73
  msgstr ""
74
 
75
- #: ../includes/page.php:84
 
 
 
 
 
 
76
  msgctxt "button"
77
  msgid "Import Widgets"
78
  msgstr ""
79
 
80
- #: ../includes/page.php:94
81
  msgctxt "heading"
82
  msgid "Export Widgets"
83
  msgstr ""
84
 
85
- #: ../includes/page.php:99
86
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
87
  msgstr ""
88
 
89
- #: ../includes/page.php:110
90
  msgctxt "button"
91
  msgid "Export Widgets"
92
  msgstr ""
93
 
94
- #: ../includes/page.php:154
95
  msgctxt "heading"
96
  msgid "Import Results"
97
  msgstr ""
98
 
99
- #: ../includes/page.php:161
100
  #, php-format
101
  msgid ""
102
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go Back</"
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Widget Importer & Exporter\n"
5
+ "POT-Creation-Date: 2020-05-18 11:35-0500\n"
6
  "PO-Revision-Date: 2015-02-23 09:31-0600\n"
7
  "Last-Translator: churchthemes.com\n"
8
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.3.1\n"
14
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
15
  "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
16
  "_nx_noop:1,2,3c\n"
19
  "X-Poedit-SourceCharset: UTF-8\n"
20
  "X-Poedit-SearchPath-0: ..\n"
21
 
22
+ #: ../includes/admin.php:78 ../includes/admin.php:109
23
  msgid "Import/Export"
24
  msgstr ""
25
 
26
+ #: ../includes/import.php:45
27
+ #, php-format
28
+ msgid ""
29
+ "You must upload a <b>.wie</b> file generated by this plugin (<a href=\"%1$s\" "
30
+ "target=\"_blank\">help</a>)."
31
+ msgstr ""
32
+
33
+ #: ../includes/import.php:114
34
+ msgid "You must choose a <b>.wie</b> file to upload or paste its contents."
35
  msgstr ""
36
 
37
+ #: ../includes/import.php:152
38
  msgid "Import file could not be found. Please try again."
39
  msgstr ""
40
 
41
+ #: ../includes/import.php:187
42
+ msgid "Import data is invalid."
43
  msgstr ""
44
 
45
+ #: ../includes/import.php:229
46
  msgid "Widget area does not exist in theme (using Inactive)"
47
  msgstr ""
48
 
49
+ #: ../includes/import.php:251
50
  msgid "Site does not support widget"
51
  msgstr ""
52
 
53
+ #: ../includes/import.php:286
54
  msgid "Widget already exists"
55
  msgstr ""
56
 
57
+ #: ../includes/import.php:360
58
  msgid "Imported"
59
  msgstr ""
60
 
61
+ #: ../includes/import.php:363
62
  msgid "Imported to Inactive"
63
  msgstr ""
64
 
65
+ #: ../includes/import.php:369
66
  msgid "No Title"
67
  msgstr ""
68
 
69
+ #: ../includes/page.php:23 ../includes/page.php:24 ../includes/page.php:44
70
  msgid "Widget Importer & Exporter"
71
  msgstr ""
72
 
73
+ #: ../includes/page.php:61
74
  msgctxt "heading"
75
  msgid "Import Widgets"
76
  msgstr ""
77
 
78
+ #: ../includes/page.php:72
79
  msgid "Please select a <b>.wie</b> file generated by this plugin."
80
  msgstr ""
81
 
82
+ #: ../includes/page.php:89
83
+ msgid ""
84
+ "Or, <a href=\"#\" id=\"wie-content-toggle\">copy and paste</a> the contents "
85
+ "of your <b>.wie</b> file."
86
+ msgstr ""
87
+
88
+ #: ../includes/page.php:105
89
  msgctxt "button"
90
  msgid "Import Widgets"
91
  msgstr ""
92
 
93
+ #: ../includes/page.php:116
94
  msgctxt "heading"
95
  msgid "Export Widgets"
96
  msgstr ""
97
 
98
+ #: ../includes/page.php:121
99
  msgid "Click below to generate a <b>.wie</b> file for all active widgets."
100
  msgstr ""
101
 
102
+ #: ../includes/page.php:131
103
  msgctxt "button"
104
  msgid "Export Widgets"
105
  msgstr ""
106
 
107
+ #: ../includes/page.php:174
108
  msgctxt "heading"
109
  msgid "Import Results"
110
  msgstr ""
111
 
112
+ #: ../includes/page.php:181
113
  #, php-format
114
  msgid ""
115
  "You can manage your <a href=\"%1$s\">Widgets</a> or <a href=\"%2$s\">Go Back</"
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: churchthemes, stevengliebe, mauryaratan, wido
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: 5.0.2
6
  Requires PHP: 5.2.4
7
- Stable tag: 1.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -26,7 +26,7 @@ Widget Importer & Exporter can create an export file (in JSON format with .wie e
26
 
27
  = Developers =
28
 
29
- The ``wie_before_import`` action fires after a file is uploaded but before the data is imported. ``wie_after_import`` fires after the data is imported. The ``wie_import_data`` filter can be used to filter data before it is imported. Other filters are used throughout. Submit an issue on GitHub if you need more hooks (pull requests encouraged).
30
 
31
  Please jump on [GitHub](https://github.com/churchthemes/widget-importer-exporter) to report issues and follow development.
32
 
@@ -38,6 +38,10 @@ After activation, go to *Tools > Widget Importer & Exporter*
38
 
39
  == Frequently Asked Questions ==
40
 
 
 
 
 
41
  = Why does the JSON export file use a .wie extension? =
42
 
43
  The export file contains JSON data that is not compatible with any other plugin. Therefore it has a proprietary file extension. This keeps people from confusing export files from other widget import/export plugins.
@@ -49,4 +53,4 @@ The export file contains JSON data that is not compatible with any other plugin.
49
 
50
  == Changelog ==
51
 
52
- See [releases](https://github.com/churchthemes/widget-importer-exporter/releases) on GitHub.
2
  Contributors: churchthemes, stevengliebe, mauryaratan, wido
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: 5.4
6
  Requires PHP: 5.2.4
7
+ Stable tag: 1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
26
 
27
  = Developers =
28
 
29
+ The ``wie_before_import`` action fires after a file is uploaded but before the data is imported. ``wie_after_import`` fires after the data is imported. The ``wie_import_data`` filter can be used to filter data before it is imported. Other filters are used throughout. Make a pull request on GitHub if you need another hook.
30
 
31
  Please jump on [GitHub](https://github.com/churchthemes/widget-importer-exporter) to report issues and follow development.
32
 
38
 
39
  == Frequently Asked Questions ==
40
 
41
+ = How do I fix: "You must upload a .wie file generated by this plugin"
42
+
43
+ Please see [this support thread](https://wordpress.org/support/topic/seeing-this-error-you-must-upload-a-wie-file-generated-by-this-plugin-2/).
44
+
45
  = Why does the JSON export file use a .wie extension? =
46
 
47
  The export file contains JSON data that is not compatible with any other plugin. Therefore it has a proprietary file extension. This keeps people from confusing export files from other widget import/export plugins.
53
 
54
  == Changelog ==
55
 
56
+ See [releases](https://github.com/churchthemes/widget-importer-exporter/releases) on GitHub.
widget-importer-exporter.php CHANGED
@@ -1,260 +1,244 @@
1
- <?php
2
- /**
3
- * Plugin Name: Widget Importer & Exporter
4
- * Plugin URI: https://churchthemes.com/plugins/widget-importer-exporter/
5
- * Description: Imports and exports widgets.
6
- * Version: 1.5.5
7
- * Author: ChurchThemes.com
8
- * Author URI: https://churchthemes.com
9
- * License: GPLv2 or later
10
- * Text Domain: widget-importer-exporter
11
- * Domain Path: /languages
12
- *
13
- * @package Widget_Importer_Exporter
14
- * @copyright Copyright (c) 2013 - 2018, ChurchThemes.com
15
- * @link https://churchthemes.com/plugins/widget-importer-exporter/
16
- * @license GPLv2 or later
17
- */
18
-
19
- // No direct access.
20
- if ( ! defined( 'ABSPATH' ) ) {
21
- exit;
22
- }
23
-
24
- /**
25
- * Main class
26
- *
27
- * @since 0.1
28
- */
29
- class Widget_Importer_Exporter {
30
-
31
- /**
32
- * Plugin data from get_plugins()
33
- *
34
- * @since 0.1
35
- * @var object
36
- */
37
- public $plugin_data;
38
-
39
- /**
40
- * Includes to load
41
- *
42
- * @since 0.1
43
- * @var array
44
- */
45
- public $includes;
46
-
47
- /**
48
- * Constructor
49
- *
50
- * Add actions for methods that define constants, load translation and load includes.
51
- *
52
- * @since 0.1
53
- * @access public
54
- */
55
- public function __construct() {
56
-
57
- // Set plugin data.
58
- add_action( 'plugins_loaded', array( &$this, 'set_plugin_data' ), 1 );
59
-
60
- // Define constants.
61
- add_action( 'plugins_loaded', array( &$this, 'define_constants' ), 1 );
62
-
63
- // Load language file.
64
- add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ), 1 );
65
-
66
- // Set includes.
67
- add_action( 'plugins_loaded', array( &$this, 'set_includes' ), 1 );
68
-
69
- // Load includes.
70
- add_action( 'plugins_loaded', array( &$this, 'load_includes' ), 1 );
71
-
72
- }
73
-
74
- /**
75
- * Set plugin data
76
- *
77
- * This data is used by constants.
78
- *
79
- * @since 0.1
80
- * @access public
81
- */
82
- public function set_plugin_data() {
83
-
84
- // Load plugin.php if get_plugins() not available.
85
- if ( ! function_exists( 'get_plugins' ) ) {
86
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
87
- }
88
-
89
- // Get path to plugin's directory.
90
- $plugin_dir = plugin_basename( dirname( __FILE__ ) );
91
-
92
- // Get plugin data.
93
- $plugin_data = current( get_plugins( '/' . $plugin_dir ) );
94
-
95
- // Set plugin data.
96
- $this->plugin_data = apply_filters( 'wie_plugin_data', $plugin_data );
97
-
98
- }
99
-
100
- /**
101
- * Define constants
102
- *
103
- * @since 0.1
104
- * @access public
105
- */
106
- public function define_constants() {
107
-
108
- // Plugin version.
109
- define( 'WIE_VERSION', $this->plugin_data['Version'] );
110
-
111
- // Plugin's main file path.
112
- define( 'WIE_FILE', __FILE__ );
113
-
114
- // Plugin's directory.
115
- define( 'WIE_DIR', dirname( plugin_basename( WIE_FILE ) ) );
116
-
117
- // Plugin's directory path.
118
- define( 'WIE_PATH', untrailingslashit( plugin_dir_path( WIE_FILE ) ) );
119
-
120
- // Plugin's directory URL.
121
- define( 'WIE_URL', untrailingslashit( plugin_dir_url( WIE_FILE ) ) );
122
-
123
- // Includes directory.
124
- define( 'WIE_INC_DIR', 'includes' );
125
-
126
- // Stylesheets directory.
127
- define( 'WIE_CSS_DIR', 'css' );
128
-
129
- // Image directory.
130
- define( 'WIE_IMG_DIR', 'img' );
131
-
132
- // Languages directory.
133
- define( 'WIE_LANG_DIR', 'languages' );
134
-
135
- }
136
-
137
- /**
138
- * Load language file
139
- *
140
- * This will load the MO file for the current locale.
141
- * The translation file must be named widget-importer-exporter-$locale.mo.
142
- *
143
- * First it will check to see if the MO file exists in wp-content/languages/plugins.
144
- * If not, then the 'languages' directory inside the plugin will be used.
145
- * It is ideal to keep translation files outside of the plugin to avoid loss during updates.\
146
- *
147
- * @since 0.1
148
- * @access public
149
- */
150
- public function load_textdomain() {
151
-
152
- // Text-domain.
153
- $domain = 'widget-importer-exporter';
154
-
155
- // WordPress core locale filter.
156
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
157
-
158
- // WordPress 3.6 and earlier don't auto-load from wp-content/languages, so check and load manually
159
- // http://core.trac.wordpress.org/changeset/22346.
160
- $external_mofile = WP_LANG_DIR . '/plugins/' . $domain . '-' . $locale . '.mo';
161
-
162
- // External translation exists.
163
- if ( get_bloginfo( 'version' ) <= 3.6 && file_exists( $external_mofile ) ) {
164
- load_textdomain( $domain, $external_mofile );
165
- } else {
166
-
167
- // Load normally. Either using WordPress 3.7+ or older version with external translation.
168
- $languages_dir = WIE_DIR . '/' . trailingslashit( WIE_LANG_DIR ); // ensure trailing slash.
169
- load_plugin_textdomain( $domain, false, $languages_dir );
170
-
171
- }
172
-
173
- }
174
-
175
- /**
176
- * Set includes
177
- *
178
- * @since 0.1
179
- * @access public
180
- */
181
- public function set_includes() {
182
-
183
- $this->includes = apply_filters( 'wie_includes', array(
184
-
185
- // Admin only.
186
- 'admin' => array(
187
-
188
- // Functions.
189
- WIE_INC_DIR . '/admin.php',
190
- WIE_INC_DIR . '/export.php',
191
- WIE_INC_DIR . '/import.php',
192
- WIE_INC_DIR . '/mime-types.php',
193
- WIE_INC_DIR . '/page.php',
194
- WIE_INC_DIR . '/widgets.php',
195
-
196
- ),
197
-
198
- ) );
199
- }
200
-
201
- /**
202
- * Load includes
203
- *
204
- * Include files based on whether or not condition is met.
205
- *
206
- * @since 0.1
207
- * @access public
208
- */
209
- public function load_includes() {
210
-
211
- // Get includes.
212
- $includes = $this->includes;
213
-
214
- // Loop conditions.
215
- foreach ( $includes as $condition => $files ) {
216
-
217
- $do_includes = false;
218
-
219
- // Check condition.
220
- // Change this to for statement so can use new lines without warning from wpcs - more readable.
221
- switch ( $condition ) {
222
-
223
- // Admin Only.
224
- case 'admin':
225
- if ( is_admin() ) {
226
- $do_includes = true;
227
- }
228
- break;
229
-
230
- // Frontend Only.
231
- case 'frontend':
232
- if ( ! is_admin() ) {
233
- $do_includes = true;
234
- }
235
- break;
236
-
237
- // Admin or Frontend (always).
238
- default:
239
- $do_includes = true;
240
- break;
241
-
242
- }
243
-
244
- // Loop files if condition met.
245
- if ( $do_includes ) {
246
-
247
- foreach ( $files as $file ) {
248
- require_once trailingslashit( WIE_PATH ) . $file;
249
- }
250
-
251
- }
252
-
253
- }
254
-
255
- }
256
-
257
- }
258
-
259
- // Instantiate the main class.
260
- new Widget_Importer_Exporter();
1
+ <?php
2
+ /**
3
+ * Plugin Name: Widget Importer & Exporter
4
+ * Plugin URI: https://churchthemes.com/plugins/widget-importer-exporter/
5
+ * Description: Imports and exports widgets.
6
+ * Version: 1.6
7
+ * Author: ChurchThemes.com
8
+ * Author URI: https://churchthemes.com
9
+ * License: GPLv2 or later
10
+ * Text Domain: widget-importer-exporter
11
+ * Domain Path: /languages
12
+ *
13
+ * @package Widget_Importer_Exporter
14
+ * @copyright Copyright (c) 2013 - 2020, ChurchThemes.com, LLC
15
+ * @link https://churchthemes.com/plugins/widget-importer-exporter/
16
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
17
+ *
18
+ * TODO: Move from procedural to OOP and require same minimum PHP as WordPress.
19
+ */
20
+
21
+ defined('ABSPATH') || exit; // No direct access.
22
+
23
+ /**
24
+ * Main class
25
+ *
26
+ * @since 0.1
27
+ */
28
+ class Widget_Importer_Exporter
29
+ {
30
+ /**
31
+ * Plugin data from get_plugins()
32
+ *
33
+ * @since 0.1
34
+ * @var object
35
+ */
36
+ public $plugin_data;
37
+
38
+ /**
39
+ * Includes to load
40
+ *
41
+ * @since 0.1
42
+ * @var array
43
+ */
44
+ public $includes;
45
+
46
+ /**
47
+ * Constructor
48
+ *
49
+ * Add actions for methods that define constants, load translation and load includes.
50
+ *
51
+ * @since 0.1
52
+ * @access public
53
+ */
54
+ public function __construct()
55
+ {
56
+ // Set plugin data.
57
+ add_action('plugins_loaded', array(&$this, 'setPluginData'), 1);
58
+
59
+ // Define constants.
60
+ add_action('plugins_loaded', array(&$this, 'defineConstants'), 1);
61
+
62
+ // Load language file.
63
+ add_action('plugins_loaded', array(&$this, 'loadTextdomain'), 1);
64
+
65
+ // Set includes.
66
+ add_action('plugins_loaded', array(&$this, 'setIncludes'), 1);
67
+
68
+ // Load includes.
69
+ add_action('plugins_loaded', array(&$this, 'loadIncludes'), 1);
70
+ }
71
+
72
+ /**
73
+ * Set plugin data
74
+ *
75
+ * This data is used by constants.
76
+ *
77
+ * @since 0.1
78
+ * @access public
79
+ */
80
+ public function setPluginData()
81
+ {
82
+ // Load plugin.php if get_plugins() not available.
83
+ if (! function_exists('get_plugins')) {
84
+ // @codingStandardsIgnoreLine
85
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
86
+ }
87
+
88
+ // Get path to plugin's directory.
89
+ $plugin_dir = plugin_basename(dirname(__FILE__));
90
+
91
+ // Get plugin data.
92
+ $plugin_data = current(get_plugins('/' . $plugin_dir));
93
+
94
+ // Set plugin data.
95
+ $this->plugin_data = apply_filters('wie_plugin_data', $plugin_data);
96
+ }
97
+
98
+ /**
99
+ * Define constants
100
+ *
101
+ * @since 0.1
102
+ * @access public
103
+ */
104
+ public function defineConstants()
105
+ {
106
+ // Plugin version.
107
+ define('WIE_VERSION', $this->plugin_data['Version']);
108
+
109
+ // Plugin's main file path.
110
+ define('WIE_FILE', __FILE__);
111
+
112
+ // Plugin's directory.
113
+ define('WIE_DIR', dirname(plugin_basename(WIE_FILE)));
114
+
115
+ // Plugin's directory path.
116
+ define('WIE_PATH', untrailingslashit(plugin_dir_path(WIE_FILE)));
117
+
118
+ // Plugin's directory URL.
119
+ define('WIE_URL', untrailingslashit(plugin_dir_url(WIE_FILE)));
120
+
121
+ // Includes directory.
122
+ define('WIE_INC_DIR', 'includes');
123
+
124
+ // Stylesheets directory.
125
+ define('WIE_CSS_DIR', 'css');
126
+
127
+ // JavaScript directory.
128
+ define('WIE_JS_DIR', 'js');
129
+
130
+ // Image directory.
131
+ define('WIE_IMG_DIR', 'img');
132
+
133
+ // Languages directory.
134
+ define('WIE_LANG_DIR', 'languages');
135
+ }
136
+
137
+ /**
138
+ * Load language file
139
+ *
140
+ * This will load the MO file for the current locale.
141
+ * The translation file must be named widget-importer-exporter-$locale.mo.
142
+ *
143
+ * First it will check to see if the MO file exists in wp-content/languages/plugins.
144
+ * If not, then the 'languages' directory inside the plugin will be used.
145
+ * It is ideal to keep translation files outside of the plugin to avoid loss during updates.\
146
+ *
147
+ * @since 0.1
148
+ * @access public
149
+ */
150
+ public function loadTextdomain()
151
+ {
152
+ // Text-domain.
153
+ $domain = 'widget-importer-exporter';
154
+
155
+ // WordPress core locale filter.
156
+ $locale = apply_filters('plugin_locale', get_locale(), $domain);
157
+
158
+ // WordPress 3.6 and earlier don't auto-load from wp-content/languages, so check and load manually
159
+ // http://core.trac.wordpress.org/changeset/22346.
160
+ $external_mofile = WP_LANG_DIR . '/plugins/' . $domain . '-' . $locale . '.mo';
161
+
162
+ // External translation exists.
163
+ if (get_bloginfo('version') <= 3.6 && file_exists($external_mofile)) {
164
+ load_textdomain($domain, $external_mofile);
165
+ } else {
166
+ // Load normally. Either using WordPress 3.7+ or older version with external translation.
167
+ $languages_dir = WIE_DIR . '/' . trailingslashit(WIE_LANG_DIR); // ensure trailing slash.
168
+ load_plugin_textdomain($domain, false, $languages_dir);
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Set includes
174
+ *
175
+ * @since 0.1
176
+ * @access public
177
+ */
178
+ public function setIncludes()
179
+ {
180
+ $this->includes = apply_filters('wie_includes', array(
181
+ // Admin only.
182
+ 'admin' => array(
183
+ WIE_INC_DIR . '/admin.php',
184
+ WIE_INC_DIR . '/export.php',
185
+ WIE_INC_DIR . '/import.php',
186
+ WIE_INC_DIR . '/mime-types.php',
187
+ WIE_INC_DIR . '/page.php',
188
+ WIE_INC_DIR . '/widgets.php',
189
+ ),
190
+ ));
191
+ }
192
+
193
+ /**
194
+ * Load includes
195
+ *
196
+ * Include files based on whether or not condition is met.
197
+ *
198
+ * @since 0.1
199
+ * @access public
200
+ */
201
+ public function loadIncludes()
202
+ {
203
+ // Get includes.
204
+ $includes = $this->includes;
205
+
206
+ // Loop conditions.
207
+ foreach ($includes as $condition => $files) {
208
+ $do_includes = false;
209
+
210
+ // Check condition.
211
+ // Change this to for statement so can use new lines without warning from wpcs - more readable.
212
+ switch ($condition) {
213
+ // Admin Only.
214
+ case 'admin':
215
+ if (is_admin()) {
216
+ $do_includes = true;
217
+ }
218
+ break;
219
+
220
+ // Frontend Only.
221
+ case 'frontend':
222
+ if (! is_admin()) {
223
+ $do_includes = true;
224
+ }
225
+ break;
226
+
227
+ // Admin or Frontend (always).
228
+ default:
229
+ $do_includes = true;
230
+ break;
231
+ }
232
+
233
+ // Loop files if condition met.
234
+ if ($do_includes) {
235
+ foreach ($files as $file) {
236
+ require_once trailingslashit(WIE_PATH) . $file;
237
+ }
238
+ }
239
+ }
240
+ }
241
+ }
242
+
243
+ // Instantiate the main class.
244
+ new Widget_Importer_Exporter();