Version Description
- Added support for Windows servers
- Removed incomplete config warning on bundle overview
Download this release
Release Info
Developer | timwhitlock |
Plugin | Loco Translate |
Version | 2.0.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.0.3
- loco.php +2 -2
- readme.txt +7 -3
- src/ajax/FsReferenceController.php +1 -1
- src/config/Model.php +1 -1
- src/fs/File.php +97 -30
- src/fs/FileFinder.php +2 -2
- src/gettext/Metadata.php +1 -1
- src/mvc/AdminController.php +1 -0
- tpl/admin/bundle/view.php +2 -2
loco.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Loco Translate
|
|
4 |
Plugin URI: https://wordpress.org/plugins/loco-translate/
|
5 |
Description: Translate themes and plugins directly in WordPress
|
6 |
Author: Tim Whitlock
|
7 |
-
Version: 2.0.
|
8 |
Author URI: https://localise.biz/wordpress/plugin
|
9 |
Text Domain: loco
|
10 |
Domain Path: /languages/
|
@@ -45,7 +45,7 @@ function loco_plugin_file(){
|
|
45 |
* @return string
|
46 |
*/
|
47 |
function loco_plugin_version(){
|
48 |
-
return '2.0.
|
49 |
}
|
50 |
|
51 |
|
4 |
Plugin URI: https://wordpress.org/plugins/loco-translate/
|
5 |
Description: Translate themes and plugins directly in WordPress
|
6 |
Author: Tim Whitlock
|
7 |
+
Version: 2.0.3
|
8 |
Author URI: https://localise.biz/wordpress/plugin
|
9 |
Text Domain: loco
|
10 |
Domain Path: /languages/
|
45 |
* @return string
|
46 |
*/
|
47 |
function loco_plugin_version(){
|
48 |
+
return '2.0.3';
|
49 |
}
|
50 |
|
51 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: timwhitlock
|
|
3 |
Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, PO, MO, productivity
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -85,6 +85,10 @@ Help is provided via the [plugin support forum](https://wordpress.org/support/pl
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
88 |
= 2.0.2 =
|
89 |
* Fixed bug when absolute path used to get plugins
|
90 |
* Added loco_plugins_data filter
|
@@ -103,8 +107,8 @@ Help is provided via the [plugin support forum](https://wordpress.org/support/pl
|
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
-
= 2.0.
|
107 |
-
*
|
108 |
|
109 |
|
110 |
== More info ==
|
3 |
Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, PO, MO, productivity
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 2.0.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.0.3 =
|
89 |
+
* Added support for Windows servers
|
90 |
+
* Removed incomplete config warning on bundle overview
|
91 |
+
|
92 |
= 2.0.2 =
|
93 |
* Fixed bug when absolute path used to get plugins
|
94 |
* Added loco_plugins_data filter
|
107 |
|
108 |
== Upgrade Notice ==
|
109 |
|
110 |
+
= 2.0.3 =
|
111 |
+
* Various bug fixes and improvements
|
112 |
|
113 |
|
114 |
== More info ==
|
src/ajax/FsReferenceController.php
CHANGED
@@ -12,7 +12,7 @@ class Loco_ajax_FsReferenceController extends Loco_ajax_common_BundleController
|
|
12 |
private function findSourceFile( $refpath ){
|
13 |
|
14 |
/*/ absolute file path means no search paths required
|
15 |
-
if(
|
16 |
$srcfile = new Loco_fs_File( $refpath );
|
17 |
if( $srcfile->exists() ){
|
18 |
return $srcfile;
|
12 |
private function findSourceFile( $refpath ){
|
13 |
|
14 |
/*/ absolute file path means no search paths required
|
15 |
+
if( Loco_fs_File::abs($refpath) ){
|
16 |
$srcfile = new Loco_fs_File( $refpath );
|
17 |
if( $srcfile->exists() ){
|
18 |
return $srcfile;
|
src/config/Model.php
CHANGED
@@ -93,7 +93,7 @@ abstract class Loco_config_Model {
|
|
93 |
$relpath = $file->getRelativePath( $this->base );
|
94 |
// Map to a configured base path if target is not under our root. This makes XML more portable
|
95 |
// matching order is most specific first, resulting in shortest path
|
96 |
-
if( $relpath && (
|
97 |
$bases = array( 'LOCO_LANG_DIR', 'WP_LANG_DIR', 'WP_PLUGIN_DIR', 'WPMU_PLUGIN_DIR', 'WP_CONTENT_DIR', 'ABSPATH' );
|
98 |
foreach( $bases as $key ){
|
99 |
if( ( $base = $this->getDirectoryPath($key) ) && $base !== $this->base ){
|
93 |
$relpath = $file->getRelativePath( $this->base );
|
94 |
// Map to a configured base path if target is not under our root. This makes XML more portable
|
95 |
// matching order is most specific first, resulting in shortest path
|
96 |
+
if( $relpath && ( Loco_fs_File::abs($relpath) || '..' === substr($relpath,0,2) || $this->base === $this->getDirectoryPath('ABSPATH') ) ){
|
97 |
$bases = array( 'LOCO_LANG_DIR', 'WP_LANG_DIR', 'WP_PLUGIN_DIR', 'WPMU_PLUGIN_DIR', 'WP_CONTENT_DIR', 'ABSPATH' );
|
98 |
foreach( $bases as $key ){
|
99 |
if( ( $base = $this->getDirectoryPath($key) ) && $base !== $this->base ){
|
src/fs/File.php
CHANGED
@@ -26,13 +26,73 @@ class Loco_fs_File {
|
|
26 |
* @var string
|
27 |
*/
|
28 |
private $base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
|
|
|
31 |
public function __construct( $path ){
|
32 |
-
$this->
|
33 |
}
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
/**
|
38 |
* @internal
|
@@ -291,47 +351,54 @@ class Loco_fs_File {
|
|
291 |
* @return string
|
292 |
*/
|
293 |
public function normalize( $base = '' ){
|
|
|
|
|
|
|
294 |
if( $base !== $this->base ){
|
295 |
$path = $this->path;
|
296 |
if( '' === $path ){
|
297 |
-
$this->
|
298 |
}
|
299 |
else {
|
300 |
-
$
|
301 |
-
if( ! $base || '' === $a[0] ){
|
302 |
$b = array();
|
303 |
}
|
304 |
-
else if( '/' === $base ){
|
305 |
-
$b = array('');
|
306 |
-
}
|
307 |
else {
|
308 |
-
$b = explode(
|
309 |
}
|
310 |
-
|
311 |
-
|
312 |
-
if( $b ){
|
313 |
-
continue;
|
314 |
-
}
|
315 |
-
}
|
316 |
-
if( '.' === $s ){
|
317 |
-
continue;
|
318 |
-
}
|
319 |
-
if( '..' === $s ){
|
320 |
-
if( array_pop($b) ){
|
321 |
-
continue;
|
322 |
-
}
|
323 |
-
}
|
324 |
-
$b[] = $s;
|
325 |
-
}
|
326 |
-
$this->path = implode('/',$b);
|
327 |
}
|
328 |
-
$this->info = null;
|
329 |
$this->base = $base;
|
330 |
}
|
331 |
return $this->path;
|
332 |
}
|
333 |
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
|
336 |
/**
|
337 |
* Get path relative to given location, unless path is already relative
|
@@ -339,7 +406,7 @@ class Loco_fs_File {
|
|
339 |
*/
|
340 |
public function getRelativePath( $base ){
|
341 |
$path = $this->normalize();
|
342 |
-
if( $
|
343 |
// base may needs require normalizing
|
344 |
$file = new Loco_fs_File($base);
|
345 |
$base = $file->normalize();
|
26 |
* @var string
|
27 |
*/
|
28 |
private $base;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Flag set when current path is relative
|
32 |
+
* @var bool
|
33 |
+
*/
|
34 |
+
private $rel;
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Check if a path is absolute and return fixed slashes for readability
|
39 |
+
* @return string fixed path, or "" if not absolute
|
40 |
+
*/
|
41 |
+
public static function abs( $path ){
|
42 |
+
if( $path = (string) $path ){
|
43 |
+
$chr1 = $path{0};
|
44 |
+
// return unmodified path if starts "/"
|
45 |
+
if( '/' === $chr1 ){
|
46 |
+
return $path;
|
47 |
+
}
|
48 |
+
// Windows drive path if "X:" or network path if "\\"
|
49 |
+
if( isset($path{1}) ){
|
50 |
+
$chr2 = $path{1};
|
51 |
+
if( ':' === $chr2 || ( '\\' === $chr1 && '\\' === $chr2 ) ){
|
52 |
+
return strtoupper($chr1).$chr2.strtr( substr($path,2), '\\', '/' );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
// else path is relative, so return falsey string
|
57 |
+
return '';
|
58 |
+
}
|
59 |
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @internal
|
63 |
+
*/
|
64 |
public function __construct( $path ){
|
65 |
+
$this->setPath( $path );
|
66 |
}
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Internally set path value and flag whether relative or absolute
|
71 |
+
*/
|
72 |
+
private function setPath( $path ){
|
73 |
+
$path = (string) $path;
|
74 |
+
if( $fixed = self::abs($path) ){
|
75 |
+
$path = $fixed;
|
76 |
+
$this->rel = false;
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
$this->rel = true;
|
80 |
+
}
|
81 |
+
if( $path !== $this->path ){
|
82 |
+
$this->path = $path;
|
83 |
+
$this->info = null;
|
84 |
+
}
|
85 |
+
return $path;
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return array
|
91 |
+
*/
|
92 |
+
public function isAbsolute(){
|
93 |
+
return ! $this->rel;
|
94 |
+
}
|
95 |
+
|
96 |
|
97 |
/**
|
98 |
* @internal
|
351 |
* @return string
|
352 |
*/
|
353 |
public function normalize( $base = '' ){
|
354 |
+
if( $path = self::abs($base) ){
|
355 |
+
$base = $path;
|
356 |
+
}
|
357 |
if( $base !== $this->base ){
|
358 |
$path = $this->path;
|
359 |
if( '' === $path ){
|
360 |
+
$this->setPath($base);
|
361 |
}
|
362 |
else {
|
363 |
+
if( ! $this->rel || ! $base ){
|
|
|
364 |
$b = array();
|
365 |
}
|
|
|
|
|
|
|
366 |
else {
|
367 |
+
$b = self::explode( $base, array() );
|
368 |
}
|
369 |
+
$b = self::explode( $path, $b );
|
370 |
+
$this->setPath( implode('/',$b) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
}
|
|
|
372 |
$this->base = $base;
|
373 |
}
|
374 |
return $this->path;
|
375 |
}
|
376 |
|
377 |
|
378 |
+
/**
|
379 |
+
*
|
380 |
+
*/
|
381 |
+
private static function explode( $path, array $b ){
|
382 |
+
$a = explode( '/', $path );
|
383 |
+
foreach( $a as $i => $s ){
|
384 |
+
if( '' === $s ){
|
385 |
+
if( 0 !== $i ){
|
386 |
+
continue;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
if( '.' === $s ){
|
390 |
+
continue;
|
391 |
+
}
|
392 |
+
if( '..' === $s ){
|
393 |
+
if( array_pop($b) ){
|
394 |
+
continue;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
$b[] = $s;
|
398 |
+
}
|
399 |
+
return $b;
|
400 |
+
}
|
401 |
+
|
402 |
|
403 |
/**
|
404 |
* Get path relative to given location, unless path is already relative
|
406 |
*/
|
407 |
public function getRelativePath( $base ){
|
408 |
$path = $this->normalize();
|
409 |
+
if( $abspath = self::abs($path) ){
|
410 |
// base may needs require normalizing
|
411 |
$file = new Loco_fs_File($base);
|
412 |
$base = $file->normalize();
|
src/fs/FileFinder.php
CHANGED
@@ -202,9 +202,9 @@ class Loco_fs_FileFinder implements Iterator, Countable, Loco_fs_FileListInterfa
|
|
202 |
public function exclude(){
|
203 |
$this->invalidate();
|
204 |
foreach( func_get_args() as $path ){
|
|
|
205 |
// if path is absolute, add straight onto list
|
206 |
-
if( $
|
207 |
-
$file = new Loco_fs_File($path);
|
208 |
$file->normalize();
|
209 |
$this->excluded[] = $file;
|
210 |
}
|
202 |
public function exclude(){
|
203 |
$this->invalidate();
|
204 |
foreach( func_get_args() as $path ){
|
205 |
+
$file = new Loco_fs_File($path);
|
206 |
// if path is absolute, add straight onto list
|
207 |
+
if( $file->isAbsolute() ){
|
|
|
208 |
$file->normalize();
|
209 |
$this->excluded[] = $file;
|
210 |
}
|
src/gettext/Metadata.php
CHANGED
@@ -215,7 +215,7 @@ class Loco_gettext_Metadata extends Loco_data_Transient {
|
|
215 |
|
216 |
public function getPath( $absolute ){
|
217 |
$path = $this['rpath'];
|
218 |
-
if( $absolute &&
|
219 |
$path = trailingslashit( loco_constant('WP_CONTENT_DIR') ).$path;
|
220 |
}
|
221 |
return $path;
|
215 |
|
216 |
public function getPath( $absolute ){
|
217 |
$path = $this['rpath'];
|
218 |
+
if( $absolute && ! Loco_fs_File::abs($path) ){
|
219 |
$path = trailingslashit( loco_constant('WP_CONTENT_DIR') ).$path;
|
220 |
}
|
221 |
return $path;
|
src/mvc/AdminController.php
CHANGED
@@ -167,6 +167,7 @@ abstract class Loco_mvc_AdminController extends Loco_mvc_Controller {
|
|
167 |
}
|
168 |
|
169 |
|
|
|
170 |
/**
|
171 |
* Shortcut for rending template from a simple array of arguments
|
172 |
* @return string
|
167 |
}
|
168 |
|
169 |
|
170 |
+
|
171 |
/**
|
172 |
* Shortcut for rending template from a simple array of arguments
|
173 |
* @return string
|
tpl/admin/bundle/view.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
$this->extend('../layout');
|
6 |
|
7 |
|
8 |
-
if( $warning ):?>
|
9 |
<div class="notice inline notice-warning">
|
10 |
<p>
|
11 |
<strong class="has-icon">Not fully configured</strong><br />
|
@@ -13,7 +13,7 @@ if( $warning ):?>
|
|
13 |
<span>Click the <a href="<?php $tabs[1]->e('href')?>">setup</a> tab for more information.</span>
|
14 |
</p>
|
15 |
</div><?php
|
16 |
-
endif
|
17 |
|
18 |
|
19 |
/* @var $p Loco_mvc_ViewParams */
|
5 |
$this->extend('../layout');
|
6 |
|
7 |
|
8 |
+
/*if( $warning ):?>
|
9 |
<div class="notice inline notice-warning">
|
10 |
<p>
|
11 |
<strong class="has-icon">Not fully configured</strong><br />
|
13 |
<span>Click the <a href="<?php $tabs[1]->e('href')?>">setup</a> tab for more information.</span>
|
14 |
</p>
|
15 |
</div><?php
|
16 |
+
endif;*/
|
17 |
|
18 |
|
19 |
/* @var $p Loco_mvc_ViewParams */
|