Widget Importer & Exporter - Version 1.1

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.1

Files changed (2) hide show
  1. readme.txt +1 -1
  2. widget-importer-exporter.php +9 -11
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: stevengliebe, churchthemes
3
  Tags: widgets, widget, importer, exporter, import, export, backup
4
  Requires at least: 3.5
5
- Tested up to: 3.6
6
  Stable tag: trunk
7
  License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8
 
2
  Contributors: stevengliebe, churchthemes
3
  Tags: widgets, widget, importer, exporter, import, export, backup
4
  Requires at least: 3.5
5
+ Tested up to: 3.7
6
  Stable tag: trunk
7
  License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8
 
widget-importer-exporter.php CHANGED
@@ -3,10 +3,12 @@
3
  * Plugin Name: Widget Importer & Exporter
4
  * Plugin URI: https://github.com/stevengliebe/widget-importer-exporter
5
  * Description: Imports and exports widgets.
6
- * Version: 1.0.1
7
  * Author: Steven Gliebe
8
  * Author URI: http://stevengliebe.com
9
  * License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 
 
10
  *
11
  * @package Widget_Importer_Exporter
12
  * @copyright Copyright (c) 2013, DreamDolphin Media, LLC
@@ -123,11 +125,7 @@ class Widget_Importer_Exporter {
123
  *
124
  * First it will check to see if the MO file exists in wp-content/languages/plugins.
125
  * If not, then the 'languages' direcory inside the plugin will be used.
126
- * It is ideal to keep translation files outside of the plugin to avoid loss during updates.
127
- *
128
- * To Do: load_plugin_textdomain() will presumably be updated as load_theme_textdomain() was to
129
- * natively support external loading from WP_LANG_DIR. When this is so, simplify this function.
130
- * http://core.trac.wordpress.org/changeset/22346
131
  *
132
  * @since 0.1
133
  * @access public
@@ -140,15 +138,15 @@ class Widget_Importer_Exporter {
140
  // WordPress core locale filter
141
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
142
 
143
- // Does external MO file exist? Load it
144
- // This is ideal since it is not wiped out by plugin updates
145
  $external_mofile = WP_LANG_DIR . '/plugins/'. $domain . '-' . $locale . '.mo';
146
- if ( file_exists( $external_mofile ) ) {
147
  load_textdomain( $domain, $external_mofile );
148
  }
149
 
150
- // Otherwise use MO file stored in plugin
151
- // This is not ideal except for pre-made, unedited translations included with the plugin
152
  else {
153
  $languages_dir = WIE_DIR . '/' . trailingslashit( WIE_LANG_DIR ); // ensure trailing slash
154
  load_plugin_textdomain( $domain, false, $languages_dir );
3
  * Plugin Name: Widget Importer & Exporter
4
  * Plugin URI: https://github.com/stevengliebe/widget-importer-exporter
5
  * Description: Imports and exports widgets.
6
+ * Version: 1.1
7
  * Author: Steven Gliebe
8
  * Author URI: http://stevengliebe.com
9
  * License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
+ * Text Domain: widget-importer-exporter
11
+ * Domain Path: /languages
12
  *
13
  * @package Widget_Importer_Exporter
14
  * @copyright Copyright (c) 2013, DreamDolphin Media, LLC
125
  *
126
  * First it will check to see if the MO file exists in wp-content/languages/plugins.
127
  * If not, then the 'languages' direcory inside the plugin will be used.
128
+ * It is ideal to keep translation files outside of the plugin to avoid loss during updates.\
 
 
 
 
129
  *
130
  * @since 0.1
131
  * @access public
138
  // WordPress core locale filter
139
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
140
 
141
+ // WordPress 3.6 and earlier don't auto-load from wp-content/languages, so check and load manually
142
+ // http://core.trac.wordpress.org/changeset/22346
143
  $external_mofile = WP_LANG_DIR . '/plugins/'. $domain . '-' . $locale . '.mo';
144
+ if ( get_bloginfo( 'version' ) <= 3.6 && file_exists( $external_mofile ) ) { // external translation exists
145
  load_textdomain( $domain, $external_mofile );
146
  }
147
 
148
+ // Load normally
149
+ // Either using WordPress 3.7+ or older version with external translation
150
  else {
151
  $languages_dir = WIE_DIR . '/' . trailingslashit( WIE_LANG_DIR ); // ensure trailing slash
152
  load_plugin_textdomain( $domain, false, $languages_dir );