Widget Importer & Exporter - Version 1.5.2

Version Description

Download this release

Release Info

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

Code changes from version 1.5.1 to 1.5.2

includes/notices.php DELETED
@@ -1,384 +0,0 @@
1
- <?php
2
- /**
3
- * Notice Functions
4
- *
5
- * Admin notice functions.
6
- *
7
- * @package Widget_Importer_Exporter
8
- * @subpackage Functions
9
- * @copyright Copyright (c) 2017, WP Ultimate
10
- * @link https://wpultimate.com/widget-importer-exporter
11
- * @license GPLv2 or later
12
- * @since 1.5
13
- */
14
-
15
- // No direct access.
16
- if ( ! defined( 'ABSPATH' ) ) {
17
- exit;
18
- }
19
-
20
- /**
21
- * Activate security notices.
22
- *
23
- * To Do: Make this into a class that other plugins can use similarly.
24
- *
25
- * @since 1.5
26
- */
27
- function wie_security_notices() {
28
-
29
- $notices = array();
30
-
31
- // Outdated PHP notice.
32
- $notices[] = 'wie_php_notice';
33
-
34
- // HTTP notice.
35
- $notices[] = 'wie_http_notice';
36
-
37
- // Filter notices.
38
- $notices = apply_filters( 'wie_security_notices', $notices );
39
-
40
- // Loop notices to activate.
41
- foreach ( $notices as $notice ) {
42
- add_action( 'admin_notices', $notice );
43
- }
44
-
45
- }
46
-
47
- add_action( 'admin_init', 'wie_security_notices' );
48
-
49
- /**
50
- * Show security notice?
51
- *
52
- * Return true or false for a notice type if certain conditions are met.
53
- *
54
- * @since 1.5
55
- * @param string $type php or http.
56
- * @return bool True if notice should be shown.
57
- */
58
- function wie_show_security_notice( $type ) {
59
-
60
- // Show unless there is reason not to.
61
- $show = true;
62
-
63
- // Prepare for "Remind Later" link.
64
- $current_time = current_time( 'timestamp' );
65
- $reminder_days = 7; // show notice X days after "Remind Later" is clicked.
66
-
67
- // Get current screen.
68
- $screen = get_current_screen();
69
-
70
- // Only on WIE and Dashboard screens.
71
- if ( ! in_array( $screen->base, array( 'dashboard', 'tools_page_widget-importer-exporter' ), true ) ) {
72
- $show = false;
73
- }
74
-
75
- // Only if user is Administrator.
76
- if ( ! current_user_can( 'administrator' ) ) {
77
- $show = false;
78
- }
79
-
80
- // Type of notice.
81
- $option_prefix = '';
82
- if ( 'php' === $type ) {
83
-
84
- // PHP version.
85
- $php_version_used = phpversion();
86
- $php_version_required = '5.6'; // notice shows if lower than this version.
87
-
88
- // Only if PHP version is outdated.
89
- if ( version_compare( $php_version_used, $php_version_required, '>=' ) ) {
90
- $show = false;
91
- }
92
-
93
- // Set option prefix.
94
- $option_prefix = 'wie_php_notice';
95
-
96
- } elseif ( 'http' === $type ) {
97
-
98
- // Only if HTTPS is not used.
99
- // is_ssl() not reliable with load balancers (may return false when using SSL) so instead check if Settings > General is using an https URL.
100
- // But, some users will have SSL installed and access via https but forget to update URL settings.
101
- // To avoid a false positive in this case, also check is_ssl() - to keep those users from being confused.
102
- // The only false positive now should be user who forgot to update URL settings while behind load balancer.
103
- // Basically we check two conditions because neither is totally reliable.
104
- $site_url = get_bloginfo( 'url' );
105
- $is_ssl = is_ssl();
106
- if ( preg_match( '/^https:.*/', $site_url ) || $is_ssl ) {
107
- $show = false;
108
- }
109
-
110
- // Set option prefix.
111
- $option_prefix = 'wie_http_notice';
112
-
113
- } else { // invalid type.
114
- $show = false;
115
- }
116
-
117
- // Only if not already dismissed.
118
- if ( $option_prefix && get_option( $option_prefix . '_dismissed' ) ) {
119
- $show = false;
120
- }
121
-
122
- // Only if X days has not passed since time "Remind Later" was clicked
123
- $reminder_time = get_option( $option_prefix . '_reminder' ); // timestamp for moment "Remind Later" was set.
124
- if ( $reminder_time ) { // Only check if a reminder was set.
125
-
126
- $reminder_seconds = $reminder_days * DAY_IN_SECONDS; // Seconds to wait until notice shows again.
127
- $reminder_time_end = $reminder_time + $reminder_seconds; // Timestamp that must be in past for notice to show again.
128
-
129
- if ( $reminder_time && $current_time < $reminder_time_end ) {
130
- $show = false;
131
- }
132
-
133
- }
134
-
135
- return $show;
136
-
137
- }
138
-
139
- /**
140
- * PHP outdated notice
141
- *
142
- * @since 1.5
143
- */
144
- function wie_php_notice() {
145
-
146
- // Only on certain conditions.
147
- if ( ! wie_show_security_notice( 'php' ) ) {
148
- return;
149
- }
150
-
151
- // Output notice.
152
- ?>
153
-
154
- <div id="wie-security-notice" class="notice notice-warning is-dismissible" data-type="php">
155
-
156
- <p>
157
-
158
- <span id="wie-notice-message">
159
-
160
- <?php
161
- printf(
162
- wp_kses(
163
- /* translators: %1$s is PHP version used, %2$s is URL to guide with instructions for fixing */
164
- __( '<b>PHP Security Warning:</b> Your version of PHP is %1$s which is outdated and insecure. <b><a href="%2$s" target="_blank">Fix This Now</a></b>', 'widget-importer-exporter' ),
165
- array(
166
- 'b' => array(),
167
- 'a' => array(
168
- 'href' => array(),
169
- 'target' => array(),
170
- 'id' => array(),
171
- ),
172
- )
173
- ),
174
- esc_html( phpversion() ),
175
- 'https://wpultimate.com/update-php-wordpress'
176
- );
177
- ?>
178
-
179
- </span>
180
-
181
- <span id="wie-notice-remind">
182
- <a href="#" id="wie-notice-remind-link">
183
- <?php esc_html_e( 'Remind Later', 'widget-importer-exporter' ); ?>
184
- </a>
185
- </span>
186
-
187
- </p>
188
-
189
- </div>
190
-
191
- <?php
192
-
193
- }
194
-
195
- /**
196
- * HTTP notice
197
- *
198
- * @since 1.5
199
- */
200
- function wie_http_notice() {
201
-
202
- // Only if showing a notice.
203
- if ( ! wie_show_security_notice( 'http' ) ) {
204
- return;
205
- }
206
-
207
- // Output notice.
208
- ?>
209
-
210
- <div id="wie-security-notice" class="notice notice-warning is-dismissible" data-type="http">
211
-
212
- <p>
213
-
214
- <span id="wie-notice-message">
215
-
216
- <?php
217
- printf(
218
- wp_kses(
219
- /* translators: %1$s is URL to guide with instructions for fixing */
220
- __( '<b>HTTP Security Warning:</b> Your website is not using HTTPS/SSL. This is a security risk. <b><a href="%1$s" target="_blank">Fix This Now</a></b>', 'widget-importer-exporter' ),
221
- array(
222
- 'b' => array(),
223
- 'a' => array(
224
- 'href' => array(),
225
- 'target' => array(),
226
- 'id' => array(),
227
- ),
228
- )
229
- ),
230
- 'https://wpultimate.com/ssl-https-wordpress'
231
- );
232
- ?>
233
-
234
- </span>
235
-
236
- <span id="wie-notice-remind">
237
- <a href="#" id="wie-notice-remind-link">
238
- <?php esc_html_e( 'Remind Later', 'widget-importer-exporter' ); ?>
239
- </a>
240
- </span>
241
-
242
- </p>
243
-
244
- </div>
245
-
246
- <?php
247
-
248
- }
249
-
250
- /**
251
- * JavaScript for remembering notice was dismissed
252
- *
253
- * Since normally the dismiss button only closes notice for current page view.
254
- * this uses AJAX to set an option so that the notice can be hidden indefinitely.
255
- *
256
- * @since 1.5
257
- */
258
- function wie_dismiss_notice_js() {
259
-
260
- // Only when a notice is being shown.
261
- if ( ! wie_show_security_notice( 'php' ) && ! wie_show_security_notice( 'http' ) ) {
262
- return;
263
- }
264
-
265
- // Nonce.
266
- $ajax_nonce = wp_create_nonce( 'wie_dismiss_notice' );
267
-
268
- // JavaScript for detecting click on dismiss icon.
269
- ?>
270
-
271
- <script type="text/javascript">
272
-
273
- jQuery( document ).ready( function( $ ) {
274
-
275
- // Dismiss icon
276
- $( document ).on( 'click', '#wie-security-notice .notice-dismiss', function() {
277
-
278
- // Notice container
279
- var $container = $( this ).parents( '#wie-security-notice' );
280
-
281
- // Get data-type attribute
282
- var type = $container.data( 'type' );
283
-
284
- // Send request.
285
- if ( 'php' === type || 'http' === type ) {
286
-
287
- $.ajax( {
288
- url: ajaxurl,
289
- data: {
290
- action: 'wie_dismiss_notice',
291
- security: '<?php echo esc_js( $ajax_nonce ); ?>',
292
- type: type,
293
- },
294
- } );
295
-
296
- }
297
-
298
- } );
299
-
300
- // Remind later link
301
- $( document ).on( 'click', '#wie-notice-remind-link', function() {
302
-
303
- // Stop click to URL.
304
- event.preventDefault();
305
-
306
- // Notice container
307
- var $container = $( this ).parents( '#wie-security-notice' );
308
-
309
- // Get data-type attribute
310
- var type = $container.data( 'type' );
311
-
312
- // Send request.
313
- if ( 'php' == type || 'http' == type ) {
314
-
315
- $.ajax( {
316
- url: ajaxurl,
317
- data: {
318
- action: 'wie_dismiss_notice',
319
- security: '<?php echo esc_js( $ajax_nonce ); ?>',
320
- type: type,
321
- reminder: true,
322
- },
323
- } );
324
-
325
- }
326
-
327
- // Fade out notice.
328
- $container.fadeOut( 'fast' );
329
-
330
- } );
331
-
332
- } );
333
-
334
- </script>
335
-
336
- <?php
337
-
338
- }
339
-
340
- // JavaScript for remembering notice was dismissed.
341
- add_action( 'admin_print_footer_scripts', 'wie_dismiss_notice_js' );
342
-
343
- /**
344
- * Set option to prevent notice from showing again.
345
- *
346
- * This is called by AJAX in wie_dismiss_notice_js()
347
- *
348
- * @since 1.5
349
- */
350
- function wie_dismiss_notice() {
351
-
352
- // Only if is AJAX request.
353
- if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
354
- return;
355
- }
356
-
357
- // Check nonce.
358
- check_ajax_referer( 'wie_dismiss_notice', 'security' );
359
-
360
- // Only if user is Administrator.
361
- if ( ! current_user_can( 'administrator' ) ) {
362
- return;
363
- }
364
-
365
- // Get type.
366
- if ( ! empty( $_GET['type'] ) && in_array( $_GET['type'], array( 'php', 'http' ), true ) ) {
367
- $type = wp_unslash( $_GET['type'] );
368
- } else {
369
- return;
370
- }
371
-
372
- // Option prefix.
373
- $option_prefix = 'wie_' . $type . '_notice';
374
-
375
- // Update option so notice is not shown again.
376
- if ( ! empty( $_GET['reminder'] ) ) {
377
- update_option( $option_prefix . '_reminder', current_time( 'timestamp' ) );
378
- } else {
379
- update_option( $option_prefix . '_dismissed', '1' );
380
- }
381
-
382
- }
383
-
384
- add_action( 'wp_ajax_wie_dismiss_notice', 'wie_dismiss_notice' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/page.php CHANGED
@@ -258,7 +258,7 @@ function wie_header() {
258
 
259
  <?php
260
  echo wp_kses(
261
- __( '<b>Keep it Free</b> - There are costs to cover with 1,000,000+ downloads and free support. Keep this plugin going by trying our WordPress hosting.', 'widget-importer-exporter' ),
262
  array(
263
  'b' => array(),
264
  )
258
 
259
  <?php
260
  echo wp_kses(
261
+ __( '<b>Keep it Free</b> - There are costs to cover with 1,500,000+ downloads and free support. Keep this plugin going by trying our WordPress hosting.', 'widget-importer-exporter' ),
262
  array(
263
  'b' => array(),
264
  )
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: wpultimate, 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: 4.8.1
6
- Stable tag: 1.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
2
  Contributors: wpultimate, 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: 4.9
6
+ Stable tag: 1.5.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
widget-importer-exporter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Widget Importer & Exporter
4
  * Plugin URI: https://wpultimate.com/widget-importer-exporter
5
  * Description: Imports and exports widgets.
6
- * Version: 1.5.1
7
  * Author: WP Ultimate
8
  * Author URI: https://wpultimate.com
9
  * License: GPLv2 or later
@@ -190,7 +190,6 @@ class Widget_Importer_Exporter {
190
  WIE_INC_DIR . '/export.php',
191
  WIE_INC_DIR . '/import.php',
192
  WIE_INC_DIR . '/mime-types.php',
193
- WIE_INC_DIR . '/notices.php',
194
  WIE_INC_DIR . '/page.php',
195
  WIE_INC_DIR . '/widgets.php',
196
 
3
  * Plugin Name: Widget Importer & Exporter
4
  * Plugin URI: https://wpultimate.com/widget-importer-exporter
5
  * Description: Imports and exports widgets.
6
+ * Version: 1.5.2
7
  * Author: WP Ultimate
8
  * Author URI: https://wpultimate.com
9
  * License: GPLv2 or later
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