Widget Settings Importer/Exporter - Version 1.3

Version Description

  • Adding support for PHP 5.2
  • Swapping registration order of pages
Download this release

Release Info

Developer kevinlangleyjr
Plugin Icon wp plugin Widget Settings Importer/Exporter
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

Files changed (3) hide show
  1. class-widget-data.php +15 -10
  2. readme.txt +6 -3
  3. widget-data.php +3 -15
class-widget-data.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  class Widget_Data {
4
 
 
 
 
5
  /**
6
  * initialize
7
  */
@@ -18,19 +21,21 @@ class Widget_Data {
18
  * Register admin pages
19
  */
20
  public static function add_admin_menus() {
21
- // export
22
- $export_page = add_management_page( 'Widget Settings Export', 'Widget Settings Export', 'manage_options', 'widget-settings-export', array( __CLASS__, 'export_settings_page' ) );
23
  //import
24
- $import_page = add_management_page( 'Widget Settings Import', 'Widget Settings Import', 'manage_options', 'widget-settings-import', array( __CLASS__, 'import_settings_page' ) );
 
 
25
 
26
- add_action( 'admin_enqueue_scripts', function($hook) use ($export_page, $import_page){
27
- if( !in_array( $hook, array( $export_page, $import_page ) ) )
28
- return;
 
 
 
29
 
30
- wp_enqueue_style( 'widget_data', plugins_url( '/widget-data.css', __FILE__ ) );
31
- wp_enqueue_script( 'widget_data', plugins_url( '/widget-data.js', __FILE__ ), array( 'jquery', 'wp-ajax-response' ) );
32
- wp_localize_script( 'widget_data', 'widgets_url', get_admin_url( false, 'widgets.php' ) );
33
- } );
34
  }
35
 
36
  /**
2
 
3
  class Widget_Data {
4
 
5
+ static $export_page;
6
+ static $import_page;
7
+
8
  /**
9
  * initialize
10
  */
21
  * Register admin pages
22
  */
23
  public static function add_admin_menus() {
 
 
24
  //import
25
+ self::$import_page = add_management_page( 'Widget Settings Import', 'Widget Settings Import', 'manage_options', 'widget-settings-import', array( __CLASS__, 'import_settings_page' ) );
26
+ // export
27
+ self::$export_page = add_management_page( 'Widget Settings Export', 'Widget Settings Export', 'manage_options', 'widget-settings-export', array( __CLASS__, 'export_settings_page' ) );
28
 
29
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_scripts' ) );
30
+ }
31
+
32
+ public static function enqueue_admin_scripts( $hook ) {
33
+ if( !in_array( $hook, array( self::$export_page, self::$import_page ) ) )
34
+ return;
35
 
36
+ wp_enqueue_style( 'widget_data', plugins_url( '/widget-data.css', __FILE__ ) );
37
+ wp_enqueue_script( 'widget_data', plugins_url( '/widget-data.js', __FILE__ ), array( 'jquery', 'wp-ajax-response' ) );
38
+ wp_localize_script( 'widget_data', 'widgets_url', get_admin_url( false, 'widgets.php' ) );
 
39
  }
40
 
41
  /**
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: kevinlangleyjr, smccafferty, markparolisi, voceplatforms
3
  Tags: widget, import, export
4
  Requires at least: 2.8
5
- Tested up to: 3.5.2
6
- Stable tag: 1.2
7
 
8
  Allows you to export and import widgets settings.
9
 
@@ -13,7 +13,7 @@ Gives the user the ability to export the current widget settings and states as a
13
 
14
  ** Please note that the plugin currently does not import anything if that particular sidebar is unavailable during the import.
15
 
16
- *** This plugin requires at least PHP 5.3.0
17
 
18
  == Installation ==
19
 
@@ -26,6 +26,9 @@ Gives the user the ability to export the current widget settings and states as a
26
  2. Upload JSON export file
27
 
28
  == Changelog ==
 
 
 
29
 
30
  = 1.2 =
31
  * Adding PHP version check to avoid errors upon activation.
2
  Contributors: kevinlangleyjr, smccafferty, markparolisi, voceplatforms
3
  Tags: widget, import, export
4
  Requires at least: 2.8
5
+ Tested up to: 3.9.1
6
+ Stable tag: 1.3
7
 
8
  Allows you to export and import widgets settings.
9
 
13
 
14
  ** Please note that the plugin currently does not import anything if that particular sidebar is unavailable during the import.
15
 
16
+ *** This plugin requires at least PHP 5.2.0
17
 
18
  == Installation ==
19
 
26
  2. Upload JSON export file
27
 
28
  == Changelog ==
29
+ = 1.3 =
30
+ * Adding support for PHP 5.2
31
+ * Swapping registration order of pages
32
 
33
  = 1.2 =
34
  * Adding PHP version check to avoid errors upon activation.
widget-data.php CHANGED
@@ -4,7 +4,7 @@
4
  Description: Adds functionality to export and import widget data
5
  Author: Voce Communications - Kevin Langley, Sean McCafferty, Mark Parolisi
6
  Author URI: http://vocecommunications.com
7
- Version: 1.2
8
  * ******************************************************************
9
  Copyright 2011-2011 Voce Communications
10
 
@@ -23,17 +23,5 @@
23
  * ******************************************************************
24
  */
25
 
26
- define( "WIDGET_DATA_MIN_PHP_VER", '5.3.0' );
27
-
28
- register_activation_hook( __FILE__, 'widget_data_activation' );
29
-
30
- function widget_data_activation() {
31
- if ( version_compare( phpversion(), WIDGET_DATA_MIN_PHP_VER, '<' ) ) {
32
- die( sprintf( "The minimum PHP version required for this plugin is %s", WIDGET_DATA_MIN_PHP_VER ) );
33
- }
34
- }
35
-
36
- if ( version_compare( phpversion(), WIDGET_DATA_MIN_PHP_VER, '>=' ) ) {
37
- require( __DIR__ . '/class-widget-data.php' );
38
- add_action( 'init', array( 'Widget_Data', 'init' ) );
39
- }
4
  Description: Adds functionality to export and import widget data
5
  Author: Voce Communications - Kevin Langley, Sean McCafferty, Mark Parolisi
6
  Author URI: http://vocecommunications.com
7
+ Version: 1.3
8
  * ******************************************************************
9
  Copyright 2011-2011 Voce Communications
10
 
23
  * ******************************************************************
24
  */
25
 
26
+ require( __DIR__ . '/class-widget-data.php' );
27
+ add_action( 'init', array( 'Widget_Data', 'init' ) );