WP Native Dashboard - Version 1.3.8

Version Description

Download this release

Release Info

Developer codestyling
Plugin Icon wp plugin WP Native Dashboard
Version 1.3.8
Comparing to
See all releases

Code changes from version 1.3.7 to 1.3.8

Files changed (4) hide show
  1. automattic.php +22 -4
  2. langswitcher.php +1 -1
  3. readme.txt +7 -2
  4. wp-native-dashboard.php +55 -7
automattic.php CHANGED
@@ -386,8 +386,14 @@ class wp_native_dashboard_automattic {
386
  ob_start();
387
  if ( WP_Filesystem($credentials) && is_object($wp_filesystem) ) {
388
  if($wp_filesystem->delete($filename)) {
389
- $wp_filesystem->delete(substr($filename, 0, -2).'php');
390
  $wp_filesystem->delete($dir.'continents-cities-'.$file);
 
 
 
 
 
 
 
391
  ob_end_clean();
392
  exit();
393
  }
@@ -481,6 +487,18 @@ class wp_native_dashboard_automattic {
481
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/ms-".$file,
482
  'alternative' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/ms-".$file
483
  ),
 
 
 
 
 
 
 
 
 
 
 
 
484
  //RTL or language adjustment support
485
  $dir.$lang.'.php' => array(
486
  'min-version' => '2.0',
@@ -488,12 +506,12 @@ class wp_native_dashboard_automattic {
488
  'alternative' => false
489
  ),
490
  //language related stylesheet extensions
491
- $dir.$lang.'.css' => array(
492
  'min-version' => '3.0',
493
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/".$lang.'.css',
494
  'alternative' => false
495
  ),
496
- $dir.$lang.'-ie.css' => array(
497
  'min-version' => '3.0',
498
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/".$lang.'-ie.css',
499
  'alternative' => false
@@ -518,7 +536,7 @@ class wp_native_dashboard_automattic {
518
  }else {
519
  //special turn for required but not yet provided RTL extension files
520
  //enables RTL support for affected languages anyway
521
- if (($fsf == $dir.$lang.'.php') && wp_native_dashboard_is_rtl_language($lang)) {
522
  $wp_filesystem->put_contents($fsf, wp_native_dashboard_rtl_extension_file_content());
523
  }
524
  }
386
  ob_start();
387
  if ( WP_Filesystem($credentials) && is_object($wp_filesystem) ) {
388
  if($wp_filesystem->delete($filename)) {
 
389
  $wp_filesystem->delete($dir.'continents-cities-'.$file);
390
+ $wp_filesystem->delete($dir.'ms-'.$file);
391
+ $wp_filesystem->delete($dir.'admin-'.$file);
392
+ $wp_filesystem->delete($dir.'admin-network-'.$file);
393
+ $wp_filesystem->delete(substr($filename, 0, -2).'php');
394
+ $wp_filesystem->delete(substr($filename, 0, -2).'css');
395
+ $wp_filesystem->delete(substr($filename, 0, -3).'-ie.css');
396
+ $wp_filesystem->delete($dir.'ms-'.substr($file, 0, -2).'css');
397
  ob_end_clean();
398
  exit();
399
  }
487
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/ms-".$file,
488
  'alternative' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/ms-".$file
489
  ),
490
+ //admin file (3.4)
491
+ $dir.'admin-'.$file => array(
492
+ 'min-version' => '3.4',
493
+ 'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/admin-".$file,
494
+ 'alternative' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/admin-".$file
495
+ ),
496
+ //admin network file (3.4)
497
+ $dir.'admin-network-'.$file => array(
498
+ 'min-version' => '3.4',
499
+ 'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/admin-network-".$file,
500
+ 'alternative' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/admin-network-".$file
501
+ ),
502
  //RTL or language adjustment support
503
  $dir.$lang.'.php' => array(
504
  'min-version' => '2.0',
506
  'alternative' => false
507
  ),
508
  //language related stylesheet extensions
509
+ $dir.$lang.'.css' => array(
510
  'min-version' => '3.0',
511
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/".$lang.'.css',
512
  'alternative' => false
513
  ),
514
+ $dir.$lang.'-ie.css' => array(
515
  'min-version' => '3.0',
516
  'location' => "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/dist/wp-content/languages/".$lang.'-ie.css',
517
  'alternative' => false
536
  }else {
537
  //special turn for required but not yet provided RTL extension files
538
  //enables RTL support for affected languages anyway
539
+ if (($fsf == $dir.$lang.'.php') && wp_native_dashboard_is_rtl_language($lang) && version_compare($wp_version, '3.4-alpha', '<')) {
540
  $wp_filesystem->put_contents($fsf, wp_native_dashboard_rtl_extension_file_content());
541
  }
542
  }
langswitcher.php CHANGED
@@ -45,7 +45,7 @@ class wp_native_dashboard_langswitcher {
45
  global $wp_version;
46
  $this->no_dashboard_headline = version_compare($wp_version, '3.0', '>=');
47
  }
48
-
49
  function bp_adminbar_switcher_menu() {
50
  $langs = wp_native_dashboard_collect_installed_languages();
51
  $loc = get_locale();
45
  global $wp_version;
46
  $this->no_dashboard_headline = version_compare($wp_version, '3.0', '>=');
47
  }
48
+
49
  function bp_adminbar_switcher_menu() {
50
  $langs = wp_native_dashboard_collect_installed_languages();
51
  $loc = get_locale();
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: codestyling
3
  Tags: wordpress, dashboard, multi-lingual, languages, backend, localization, plugin
4
  Requires at least: 2.7
5
- Tested up to: 3.4-beta4-20838
6
- Stable tag: 1.3.7
7
 
8
  Enables selection of administration language either by logon, dashboard quick switcher or user profile setting.
9
 
@@ -49,6 +49,11 @@ Please visit [the official website](http://www.code-styling.de/english/developme
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
52
  = Version 1.3.7 =
53
  * bugfix: stylesheet correction for admin bar integration
54
  * bugfix: svn download doesn't work at some installations but doesn't show the error for
2
  Contributors: codestyling
3
  Tags: wordpress, dashboard, multi-lingual, languages, backend, localization, plugin
4
  Requires at least: 2.7
5
+ Tested up to: 3.4-RC1
6
+ Stable tag: 1.3.8
7
 
8
  Enables selection of administration language either by logon, dashboard quick switcher or user profile setting.
9
 
49
 
50
  == Changelog ==
51
 
52
+ = Version 1.3.8 =
53
+ * bugfix: build in language "en_US" could not longer be selected, if WPLANG explicitely defined.
54
+ * feature: supports new translation files introduced with WordPress 3.4 version
55
+ * feature: frontend admin bar can be shown translated with current users backend language (new settings option)
56
+
57
  = Version 1.3.7 =
58
  * bugfix: stylesheet correction for admin bar integration
59
  * bugfix: svn download doesn't work at some installations but doesn't show the error for
wp-native-dashboard.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Native Dashboard
4
- Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-wp-native-dashboard-en
5
  Description: You can configure your blog working at administration with different languages depends on users choice and capabilities the admin has been enabled.
6
  Author: Heiko Rabe
7
  Author URI: http://www.code-styling.de/
8
- Version: 1.3.7
9
 
10
  License:
11
  ==============================================================================
12
- Copyright 2009 Heiko Rabe (email : info@code-styling.de)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -95,6 +95,7 @@ class wp_native_dashboard {
95
  $this->defaults->enable_profile_extension = false;
96
  $this->defaults->enable_language_switcher = false;
97
  $this->defaults->enable_adminbar_switcher = false;
 
98
  $this->defaults->cleanup_on_deactivate = false;
99
 
100
  //try to get the options now
@@ -102,6 +103,7 @@ class wp_native_dashboard {
102
 
103
  //compat
104
  if (!isset($this->options->enable_adminbar_switcher)) $this->options->enable_adminbar_switcher = false;
 
105
 
106
  //keep it for later use
107
  $this->plugin_url = WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__));
@@ -191,7 +193,7 @@ class wp_native_dashboard {
191
  //setup the correct user prefered language
192
  function on_locale($loc) {
193
  $skip = !$this->options->enable_login_selector && !$this->options->enable_profile_extension && !$this->options->enable_language_switcher && !$this->options->enable_adminbar_switcher;
194
- if (is_admin() && !$skip) {
195
  if (function_exists('wp_get_current_user')) {
196
  $u = wp_get_current_user();
197
  if (!isset($u->wp_native_dashboard_language)) {
@@ -200,7 +202,8 @@ class wp_native_dashboard {
200
  else
201
  $u->wp_native_dashboard_language = 'en_US';
202
  }
203
- if(!@file_exists(WP_LANG_DIR.'/' . $u->wp_native_dashboard_language.'.mo'))
 
204
  return $loc ? $loc : 'en_US';
205
  return $u->wp_native_dashboard_language;
206
  }
@@ -239,6 +242,47 @@ class wp_native_dashboard {
239
  wp_enqueue_script('jquery');
240
  }
241
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  }
243
 
244
  function on_admin_menu() {
@@ -322,7 +366,11 @@ class wp_native_dashboard {
322
  <?php if (function_exists('is_admin_bar_showing')) : ?>
323
  <p>
324
  <input id="enable_adminbar_switcher" type="checkbox" value="1" name="enable_adminbar_switcher"<?php if ($this->options->enable_adminbar_switcher) echo ' checked="checked"'; ?> />
325
- <?php _e('extend <em>WordPress Admin Bar</em> with a language quick selector.', "wp-native-dashboard"); ?>
 
 
 
 
326
  </p>
327
  <?php endif; ?>
328
  <p class="csp-read-more">
@@ -430,7 +478,7 @@ class wp_native_dashboard {
430
  <?php do_meta_boxes($this->pagehook, 'normal', $data); ?>
431
  <br/>
432
  <p class="csp-read-more">
433
- <span class="alignright csp-copyright">copyright &copy 2008 - 2009 by Heiko Rabe</span>
434
  <label for="cleanup_on_deactivate" class="alignleft">
435
  <input id="cleanup_on_deactivate" type="checkbox" value="1" name="cleanup_on_deactivate"<?php if ($this->options->cleanup_on_deactivate) echo ' checked="checked"'; ?> />
436
  <span class="csp-warning"><?php _e('cleanup all settings at plugin deactivation.', 'wp-native-dashboard'); ?></span>
1
  <?php
2
  /*
3
  Plugin Name: WP Native Dashboard
4
+ Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-wp-native-dashboard-en
5
  Description: You can configure your blog working at administration with different languages depends on users choice and capabilities the admin has been enabled.
6
  Author: Heiko Rabe
7
  Author URI: http://www.code-styling.de/
8
+ Version: 1.3.8
9
 
10
  License:
11
  ==============================================================================
12
+ Copyright 2009-2012 Heiko Rabe (email : info@code-styling.de)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
95
  $this->defaults->enable_profile_extension = false;
96
  $this->defaults->enable_language_switcher = false;
97
  $this->defaults->enable_adminbar_switcher = false;
98
+ $this->defaults->translate_front_adminbar = false;
99
  $this->defaults->cleanup_on_deactivate = false;
100
 
101
  //try to get the options now
103
 
104
  //compat
105
  if (!isset($this->options->enable_adminbar_switcher)) $this->options->enable_adminbar_switcher = false;
106
+ if (!isset($this->options->translate_front_adminbar)) $this->options->translate_front_adminbar = false;
107
 
108
  //keep it for later use
109
  $this->plugin_url = WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__));
193
  //setup the correct user prefered language
194
  function on_locale($loc) {
195
  $skip = !$this->options->enable_login_selector && !$this->options->enable_profile_extension && !$this->options->enable_language_switcher && !$this->options->enable_adminbar_switcher;
196
+ if ((is_admin() && !$skip) || ($this->options->translate_front_adminbar && isset($_REQUEST['wpnd']) && $_REQUEST['wpnd'] == 'translate_front_adminbar')) {
197
  if (function_exists('wp_get_current_user')) {
198
  $u = wp_get_current_user();
199
  if (!isset($u->wp_native_dashboard_language)) {
202
  else
203
  $u->wp_native_dashboard_language = 'en_US';
204
  }
205
+
206
+ if(($u->wp_native_dashboard_language != 'en_US') && !@file_exists(WP_LANG_DIR.'/' . $u->wp_native_dashboard_language.'.mo'))
207
  return $loc ? $loc : 'en_US';
208
  return $u->wp_native_dashboard_language;
209
  }
242
  wp_enqueue_script('jquery');
243
  }
244
  }
245
+
246
+ //front end admin bar handling
247
+ if($this->options->translate_front_adminbar && !is_admin() && is_user_logged_in()) {
248
+ wp_enqueue_script('jquery');
249
+ if (isset($_REQUEST['wpnd']) && $_REQUEST['wpnd'] == 'translate_front_adminbar') {
250
+ ob_start(array(&$this, 'on_translated_frontend_adminbar'));
251
+ add_action('wp_before_admin_bar_render', array(&$this, 'on_before_admin_bar_render_rip_on'), 0);
252
+ add_action('wp_after_admin_bar_render', array(&$this, 'on_after_admin_bar_render_park_content'),9999);
253
+ }else{
254
+ add_action('wp_before_admin_bar_render', array(&$this, 'on_before_admin_bar_render_rip_on'), 0);
255
+ add_action('wp_after_admin_bar_render', array(&$this, 'on_after_admin_bar_render_rip_off'),9999);
256
+ }
257
+ }
258
+ }
259
+
260
+ function on_before_admin_bar_render_rip_on() {
261
+ ob_start();
262
+ }
263
+
264
+ function on_after_admin_bar_render_rip_off() {
265
+ ob_end_clean();
266
+ //replace frontend admin bar markup and script with jquery loader, that is abel to translate the bar
267
+ global $wp, $wp_rewrite;
268
+ $query_string = $wp_rewrite->using_permalinks() ? '' : $wp->query_string;
269
+ $query_string = (empty($query_string) ? $query_string.'?' : $query_string.'&').'wpnd=translate_front_adminbar';
270
+ $current_url = add_query_arg( $query_string, '', home_url( $wp->request ) );
271
+ ?>
272
+ <script type="text/javascript">
273
+ jQuery.get("<?php echo $current_url; ?>", function(data) {
274
+ jQuery('body').append(data);
275
+ });
276
+ </script>
277
+ <?php
278
+ }
279
+
280
+ function on_after_admin_bar_render_park_content() {
281
+ $this->parked_admin_bar = ob_get_clean();
282
+ }
283
+
284
+ function on_translated_frontend_adminbar($content) {
285
+ return $this->parked_admin_bar;
286
  }
287
 
288
  function on_admin_menu() {
366
  <?php if (function_exists('is_admin_bar_showing')) : ?>
367
  <p>
368
  <input id="enable_adminbar_switcher" type="checkbox" value="1" name="enable_adminbar_switcher"<?php if ($this->options->enable_adminbar_switcher) echo ' checked="checked"'; ?> />
369
+ <?php _e('extend <em>Backend Admin Bar</em> with a language quick selector.', "wp-native-dashboard"); ?>
370
+ </p>
371
+ <p>
372
+ <input id="translate_front_adminbar" type="checkbox" value="1" name="translate_front_adminbar"<?php if ($this->options->translate_front_adminbar) echo ' checked="checked"'; ?> />
373
+ <?php _e('translate <em>Frontend Admin Bar</em> using backend selected language.', "wp-native-dashboard"); ?>
374
  </p>
375
  <?php endif; ?>
376
  <p class="csp-read-more">
478
  <?php do_meta_boxes($this->pagehook, 'normal', $data); ?>
479
  <br/>
480
  <p class="csp-read-more">
481
+ <span class="alignright csp-copyright">copyright &copy 2008 - 2012 by Heiko Rabe</span>
482
  <label for="cleanup_on_deactivate" class="alignleft">
483
  <input id="cleanup_on_deactivate" type="checkbox" value="1" name="cleanup_on_deactivate"<?php if ($this->options->cleanup_on_deactivate) echo ' checked="checked"'; ?> />
484
  <span class="csp-warning"><?php _e('cleanup all settings at plugin deactivation.', 'wp-native-dashboard'); ?></span>