Version Description
Download this release
Release Info
Developer | codestyling |
Plugin | WP Native Dashboard |
Version | 1.3.11 |
Comparing to | |
See all releases |
Code changes from version 1.3.10 to 1.3.11
- automattic.php +75 -1
- readme.txt +6 -2
- wp-native-dashboard.php +32 -13
automattic.php
CHANGED
@@ -23,6 +23,47 @@ class wp_native_dashboard_automattic {
|
|
23 |
add_action('wp_ajax_wp_native_dashboard_download_language', array(&$this, 'on_ajax_wp_native_dashboard_download_language'));
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
function on_admin_head() {
|
27 |
?>
|
28 |
<script type="text/javascript">
|
@@ -258,7 +299,9 @@ class wp_native_dashboard_automattic {
|
|
258 |
$revision = 0;
|
259 |
$langs = $installed;
|
260 |
$url = 'http://svn.automattic.com/wordpress-i18n/';
|
|
|
261 |
$response = @wp_remote_get($url);
|
|
|
262 |
$error = is_wp_error($response);
|
263 |
if(!$error) {
|
264 |
$lines = split("\n",$response['body']);
|
@@ -295,13 +338,24 @@ class wp_native_dashboard_automattic {
|
|
295 |
}
|
296 |
|
297 |
function on_ajax_wp_native_dashboard_check_language() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
$lang = $_POST['language'];
|
299 |
$row = $_POST['row'];
|
300 |
$ver = isset($_POST['ver']) ? $_POST['ver'] : $this->root_tagged_version;
|
301 |
$installed = wp_native_dashboard_collect_installed_languages();
|
302 |
$url = "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$this->tagged_version."/messages/";
|
303 |
$url_root = "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$ver."/messages/";
|
|
|
304 |
$response_mo = @wp_remote_get($url);
|
|
|
305 |
$found = false;
|
306 |
$tagged = $this->tagged_version;
|
307 |
|
@@ -312,12 +366,26 @@ class wp_native_dashboard_automattic {
|
|
312 |
if ($found === false) {
|
313 |
$url = $url_root;
|
314 |
$tagged = $ver;
|
|
|
315 |
$response_mo = @wp_remote_get($url);
|
|
|
316 |
if (!is_wp_error($response_mo)&&($response_mo['response']['code'] != 404)){
|
317 |
if (preg_match("/href\s*=\s*\"".$lang."\.mo\"/", $response_mo['body']))
|
318 |
$found = true;
|
319 |
}
|
320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
if ($found === false) exit();
|
322 |
$url .= $lang.'.mo';
|
323 |
?>
|
@@ -450,8 +518,10 @@ class wp_native_dashboard_automattic {
|
|
450 |
if (preg_match('/\/tags\/(\d+\.\d+|\d+\.\d+\.\d+)\/messages/', $_POST['file'], $h)) {
|
451 |
$tagged = $h[1];
|
452 |
}
|
453 |
-
|
|
|
454 |
$response_mo = @wp_remote_get("http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/".$file);
|
|
|
455 |
if(!is_wp_error($response_mo) && ($response_mo['response']['code'] != 404)) {
|
456 |
ob_start();
|
457 |
if ( WP_Filesystem($credentials) && is_object($wp_filesystem) ) {
|
@@ -525,10 +595,14 @@ class wp_native_dashboard_automattic {
|
|
525 |
|
526 |
foreach($additional_download_files as $fsf => $desc) {
|
527 |
if (version_compare($wp_version, $desc['min-version'], '>=')) {
|
|
|
528 |
$response_additional = @wp_remote_get($desc['location']);
|
|
|
529 |
if(is_wp_error($response_additional)||($response_additional['response']['code'] == 404)) {
|
530 |
if ($desc['alternative'] !== false) {
|
|
|
531 |
$response_additional = @wp_remote_get($desc['alternative']);
|
|
|
532 |
}
|
533 |
}
|
534 |
if(!is_wp_error($response_additional)&&($response_additional['response']['code'] != 404)) {
|
23 |
add_action('wp_ajax_wp_native_dashboard_download_language', array(&$this, 'on_ajax_wp_native_dashboard_download_language'));
|
24 |
}
|
25 |
|
26 |
+
function _snitch_off() {
|
27 |
+
$snitch = remove_filter(
|
28 |
+
'pre_http_request',
|
29 |
+
array(
|
30 |
+
'Snitch_HTTP',
|
31 |
+
'inspect_request'
|
32 |
+
), 10
|
33 |
+
);
|
34 |
+
if ($snitch) {
|
35 |
+
remove_action(
|
36 |
+
'http_api_debug',
|
37 |
+
array(
|
38 |
+
'Snitch_HTTP',
|
39 |
+
'log_response'
|
40 |
+
),
|
41 |
+
10
|
42 |
+
);
|
43 |
+
}
|
44 |
+
return $snitch;
|
45 |
+
}
|
46 |
+
|
47 |
+
function _snitch_on() {
|
48 |
+
add_filter(
|
49 |
+
'pre_http_request',
|
50 |
+
array(
|
51 |
+
'Snitch_HTTP',
|
52 |
+
'inspect_request'
|
53 |
+
),
|
54 |
+
10,
|
55 |
+
3
|
56 |
+
);
|
57 |
+
remove_action(
|
58 |
+
'http_api_debug',
|
59 |
+
array(
|
60 |
+
'Snitch_HTTP',
|
61 |
+
'log_response'
|
62 |
+
),
|
63 |
+
10
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
function on_admin_head() {
|
68 |
?>
|
69 |
<script type="text/javascript">
|
299 |
$revision = 0;
|
300 |
$langs = $installed;
|
301 |
$url = 'http://svn.automattic.com/wordpress-i18n/';
|
302 |
+
$snitch = $this->_snitch_off();
|
303 |
$response = @wp_remote_get($url);
|
304 |
+
if ($snitch) $this->_snitch_on();
|
305 |
$error = is_wp_error($response);
|
306 |
if(!$error) {
|
307 |
$lines = split("\n",$response['body']);
|
338 |
}
|
339 |
|
340 |
function on_ajax_wp_native_dashboard_check_language() {
|
341 |
+
//disable snitch
|
342 |
+
$snitch = remove_filter(
|
343 |
+
'pre_http_request',
|
344 |
+
array(
|
345 |
+
'Snitch_HTTP',
|
346 |
+
'inspect_request'
|
347 |
+
), 10
|
348 |
+
);
|
349 |
+
|
350 |
$lang = $_POST['language'];
|
351 |
$row = $_POST['row'];
|
352 |
$ver = isset($_POST['ver']) ? $_POST['ver'] : $this->root_tagged_version;
|
353 |
$installed = wp_native_dashboard_collect_installed_languages();
|
354 |
$url = "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$this->tagged_version."/messages/";
|
355 |
$url_root = "http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$ver."/messages/";
|
356 |
+
$snitch = $this->_snitch_off();
|
357 |
$response_mo = @wp_remote_get($url);
|
358 |
+
if ($snitch) $this->_snitch_on();
|
359 |
$found = false;
|
360 |
$tagged = $this->tagged_version;
|
361 |
|
366 |
if ($found === false) {
|
367 |
$url = $url_root;
|
368 |
$tagged = $ver;
|
369 |
+
$snitch = $this->_snitch_off();
|
370 |
$response_mo = @wp_remote_get($url);
|
371 |
+
if($snitch) $this->_snitch_on();
|
372 |
if (!is_wp_error($response_mo)&&($response_mo['response']['code'] != 404)){
|
373 |
if (preg_match("/href\s*=\s*\"".$lang."\.mo\"/", $response_mo['body']))
|
374 |
$found = true;
|
375 |
}
|
376 |
}
|
377 |
+
//add snitch again if present
|
378 |
+
if ($snitch) {
|
379 |
+
add_filter(
|
380 |
+
'pre_http_request',
|
381 |
+
array(
|
382 |
+
'Snitch_HTTP',
|
383 |
+
'inspect_request'
|
384 |
+
),
|
385 |
+
10,
|
386 |
+
3
|
387 |
+
);
|
388 |
+
}
|
389 |
if ($found === false) exit();
|
390 |
$url .= $lang.'.mo';
|
391 |
?>
|
518 |
if (preg_match('/\/tags\/(\d+\.\d+|\d+\.\d+\.\d+)\/messages/', $_POST['file'], $h)) {
|
519 |
$tagged = $h[1];
|
520 |
}
|
521 |
+
//disable snitch
|
522 |
+
$snitch = $this->_snitch_off();
|
523 |
$response_mo = @wp_remote_get("http://svn.automattic.com/wordpress-i18n/".$lang."/tags/".$tagged."/messages/".$file);
|
524 |
+
if ($snitch) $this->_snitch_on();
|
525 |
if(!is_wp_error($response_mo) && ($response_mo['response']['code'] != 404)) {
|
526 |
ob_start();
|
527 |
if ( WP_Filesystem($credentials) && is_object($wp_filesystem) ) {
|
595 |
|
596 |
foreach($additional_download_files as $fsf => $desc) {
|
597 |
if (version_compare($wp_version, $desc['min-version'], '>=')) {
|
598 |
+
$snitch = $this->_snitch_off();
|
599 |
$response_additional = @wp_remote_get($desc['location']);
|
600 |
+
if($snitch) $this->_snitch_on();
|
601 |
if(is_wp_error($response_additional)||($response_additional['response']['code'] == 404)) {
|
602 |
if ($desc['alternative'] !== false) {
|
603 |
+
$snitch = $this->_snitch_off();
|
604 |
$response_additional = @wp_remote_get($desc['alternative']);
|
605 |
+
if($snitch) $this->_snitch_on();
|
606 |
}
|
607 |
}
|
608 |
if(!is_wp_error($response_additional)&&($response_additional['response']['code'] != 404)) {
|
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.
|
6 |
-
Stable tag: 1.3.
|
7 |
|
8 |
Enables selection of administration language either by logon, dashboard quick switcher or user profile setting.
|
9 |
|
@@ -49,6 +49,10 @@ Please visit [the official website](http://www.code-styling.de/english/developme
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= Version 1.3.10 =
|
53 |
* bugfix: ajax based login plugins (sidebar logins) did not work as expected
|
54 |
* bugfix: admin bar translations was broken, if WordPress is installed at sub folder
|
2 |
Contributors: codestyling
|
3 |
Tags: wordpress, dashboard, multi-lingual, languages, backend, localization, plugin
|
4 |
Requires at least: 2.7
|
5 |
+
Tested up to: 3.6
|
6 |
+
Stable tag: 1.3.11
|
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.11 =
|
53 |
+
* feature: showing page language at frontend admin bar, if admin bar should be displayed with backend language
|
54 |
+
* bugfix: compatibility with WordPress 3.6
|
55 |
+
|
56 |
= Version 1.3.10 =
|
57 |
* bugfix: ajax based login plugins (sidebar logins) did not work as expected
|
58 |
* bugfix: admin bar translations was broken, if WordPress is installed at sub folder
|
wp-native-dashboard.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-wp-n
|
|
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.
|
9 |
Text Domain: wp-native-dashboard
|
10 |
|
11 |
License:
|
@@ -134,7 +134,7 @@ class wp_native_dashboard {
|
|
134 |
preg_match("/^(\d+)\.(\d+)(\.\d+|)/", $wp_version, $hits);
|
135 |
$this->root_tagged_version = $hits[1].'.'.$hits[2];
|
136 |
$this->tagged_version = $this->root_tagged_version;
|
137 |
-
if (!empty($hits[3])) $this->tagged_version .=
|
138 |
|
139 |
//register at plugin activation/deactivation hooks
|
140 |
register_activation_hook(plugin_basename(__FILE__), array(&$this, 'activate_plugin'));
|
@@ -145,6 +145,7 @@ class wp_native_dashboard {
|
|
145 |
|
146 |
add_filter('locale', array(&$this, 'on_locale'), 9999);
|
147 |
add_action('init', array(&$this, 'on_init'));
|
|
|
148 |
add_action('admin_menu', array(&$this, 'on_admin_menu'));
|
149 |
//add filter for WordPress 2.8 changed backend box system !
|
150 |
add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
|
@@ -162,6 +163,8 @@ class wp_native_dashboard {
|
|
162 |
ob_start();
|
163 |
add_action('shutdown', array(&$this, 'on_shutdown_render_admin_bar'), 0);
|
164 |
}
|
|
|
|
|
165 |
|
166 |
}
|
167 |
|
@@ -228,8 +231,20 @@ class wp_native_dashboard {
|
|
228 |
}
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
//setup the correct user prefered language
|
232 |
function on_locale($loc) {
|
|
|
233 |
$skip = !$this->options->enable_login_selector && !$this->options->enable_profile_extension && !$this->options->enable_language_switcher && !$this->options->enable_adminbar_switcher;
|
234 |
if ((is_admin() && !$skip) || ($this->options->translate_front_adminbar && $this->user_agent_is_wp_native_dashboard)) {
|
235 |
if (function_exists('wp_get_current_user')) {
|
@@ -256,6 +271,19 @@ class wp_native_dashboard {
|
|
256 |
$this->i18n_loaded = true;
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
function on_init() {
|
260 |
//some modules need to be loaded here, because they have to support ajax or affect the login page :-)
|
261 |
//load the login selector module if it has been enabled to provide language choise at login screen
|
@@ -271,23 +299,14 @@ class wp_native_dashboard {
|
|
271 |
$this->_load_translation_file();
|
272 |
if (is_admin()) wp_enqueue_script('jquery');
|
273 |
}
|
274 |
-
|
275 |
-
if (is_admin()) {
|
276 |
-
//load the language switcher ajax module if it has been enabled to provide the dropdown extenstion
|
277 |
-
if ($this->options->enable_language_switcher || $this->options->enable_adminbar_switcher) {
|
278 |
-
require_once(dirname(__FILE__).'/langswitcher.php');
|
279 |
-
$this->langswitcher = new wp_native_dashboard_langswitcher($this->plugin_url, $this->options->enable_language_switcher || $this->options->enable_adminbar_switcher, $this->options->enable_adminbar_switcher);
|
280 |
-
$this->_load_translation_file();
|
281 |
-
wp_enqueue_script('jquery');
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
//front end admin bar handling
|
286 |
if($this->options->translate_front_adminbar && !is_admin() && is_user_logged_in() && !$this->user_agent_is_wp_native_dashboard) {
|
287 |
add_action('wp_before_admin_bar_render', array(&$this, 'on_start_suppress_admin_bar'), 0);
|
288 |
add_action('wp_after_admin_bar_render', array(&$this, 'on_request_suppressed_admin_bar_translated'),9999);
|
289 |
}
|
290 |
if($this->options->translate_front_adminbar && !is_admin() && is_user_logged_in() && $this->user_agent_is_wp_native_dashboard) {
|
|
|
291 |
add_action('wp_before_admin_bar_render', array(&$this, 'on_start_capture_admin_bar'), 0);
|
292 |
add_action('wp_after_admin_bar_render', array(&$this, 'on_end_capture_admin_bar'), 9999);
|
293 |
}
|
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.11
|
9 |
Text Domain: wp-native-dashboard
|
10 |
|
11 |
License:
|
134 |
preg_match("/^(\d+)\.(\d+)(\.\d+|)/", $wp_version, $hits);
|
135 |
$this->root_tagged_version = $hits[1].'.'.$hits[2];
|
136 |
$this->tagged_version = $this->root_tagged_version;
|
137 |
+
if (!empty($hits[3])) $this->tagged_version .= $hits[3];
|
138 |
|
139 |
//register at plugin activation/deactivation hooks
|
140 |
register_activation_hook(plugin_basename(__FILE__), array(&$this, 'activate_plugin'));
|
145 |
|
146 |
add_filter('locale', array(&$this, 'on_locale'), 9999);
|
147 |
add_action('init', array(&$this, 'on_init'));
|
148 |
+
add_action('admin_init', array(&$this, 'on_admin_init'));
|
149 |
add_action('admin_menu', array(&$this, 'on_admin_menu'));
|
150 |
//add filter for WordPress 2.8 changed backend box system !
|
151 |
add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
|
163 |
ob_start();
|
164 |
add_action('shutdown', array(&$this, 'on_shutdown_render_admin_bar'), 0);
|
165 |
}
|
166 |
+
|
167 |
+
$this->orig_locale = false;
|
168 |
|
169 |
}
|
170 |
|
231 |
}
|
232 |
}
|
233 |
|
234 |
+
//add the language if different
|
235 |
+
function on_admin_bar_page_lang() {
|
236 |
+
global $wp_admin_bar;
|
237 |
+
$wp_admin_bar->add_menu( array(
|
238 |
+
'id' => 'csl-current-locale',
|
239 |
+
'parent' => 'top-secondary',
|
240 |
+
'title' => '<i style="font-size: 10px;">'.__("Language", "wp-native-dashboard").': </i>'.wp_native_dashboard_get_name_of($this->orig_locale),
|
241 |
+
'meta' => array( 'class' => '' ),
|
242 |
+
) );
|
243 |
+
}
|
244 |
+
|
245 |
//setup the correct user prefered language
|
246 |
function on_locale($loc) {
|
247 |
+
if($this->orig_locale === false) $this->orig_locale = $loc;
|
248 |
$skip = !$this->options->enable_login_selector && !$this->options->enable_profile_extension && !$this->options->enable_language_switcher && !$this->options->enable_adminbar_switcher;
|
249 |
if ((is_admin() && !$skip) || ($this->options->translate_front_adminbar && $this->user_agent_is_wp_native_dashboard)) {
|
250 |
if (function_exists('wp_get_current_user')) {
|
271 |
$this->i18n_loaded = true;
|
272 |
}
|
273 |
|
274 |
+
function on_admin_init() {
|
275 |
+
//do all stuff while we are at admin center
|
276 |
+
if (is_admin()) {
|
277 |
+
//load the language switcher ajax module if it has been enabled to provide the dropdown extenstion
|
278 |
+
if ($this->options->enable_language_switcher || $this->options->enable_adminbar_switcher) {
|
279 |
+
require_once(dirname(__FILE__).'/langswitcher.php');
|
280 |
+
$this->langswitcher = new wp_native_dashboard_langswitcher($this->plugin_url, $this->options->enable_language_switcher || $this->options->enable_adminbar_switcher, $this->options->enable_adminbar_switcher);
|
281 |
+
$this->_load_translation_file();
|
282 |
+
wp_enqueue_script('jquery');
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
function on_init() {
|
288 |
//some modules need to be loaded here, because they have to support ajax or affect the login page :-)
|
289 |
//load the login selector module if it has been enabled to provide language choise at login screen
|
299 |
$this->_load_translation_file();
|
300 |
if (is_admin()) wp_enqueue_script('jquery');
|
301 |
}
|
302 |
+
////--------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
//front end admin bar handling
|
304 |
if($this->options->translate_front_adminbar && !is_admin() && is_user_logged_in() && !$this->user_agent_is_wp_native_dashboard) {
|
305 |
add_action('wp_before_admin_bar_render', array(&$this, 'on_start_suppress_admin_bar'), 0);
|
306 |
add_action('wp_after_admin_bar_render', array(&$this, 'on_request_suppressed_admin_bar_translated'),9999);
|
307 |
}
|
308 |
if($this->options->translate_front_adminbar && !is_admin() && is_user_logged_in() && $this->user_agent_is_wp_native_dashboard) {
|
309 |
+
add_action('admin_bar_menu', array(&$this, 'on_admin_bar_page_lang'), 999 );
|
310 |
add_action('wp_before_admin_bar_render', array(&$this, 'on_start_capture_admin_bar'), 0);
|
311 |
add_action('wp_after_admin_bar_render', array(&$this, 'on_end_capture_admin_bar'), 9999);
|
312 |
}
|