Version Description
(10/05/2019) = * Bugfix: Prevent errors due to the parser of the JSON-LD
Download this release
Release Info
Developer | remyb92 |
Plugin | Weglot Translate – Translate your WP website |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.3 to 3.0.4
- readme.txt +4 -1
- src/services/class-translate-json-ld.php +26 -15
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
- weglot.php +2 -2
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: translate, multilingual, language, translation, localization
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.1
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -153,6 +153,9 @@ See changelog for upgrade changes.
|
|
153 |
|
154 |
== Changelog ==
|
155 |
|
|
|
|
|
|
|
156 |
= 3.0.3 (09/05/2019) =
|
157 |
* Bugfix: Weglot switcher on menu
|
158 |
* Add : Translate all JSON-LD
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.1
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 3.0.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 3.0.4 (10/05/2019) =
|
157 |
+
* Bugfix: Prevent errors due to the parser of the JSON-LD
|
158 |
+
|
159 |
= 3.0.3 (09/05/2019) =
|
160 |
* Bugfix: Weglot switcher on menu
|
161 |
* Add : Translate all JSON-LD
|
src/services/class-translate-json-ld.php
CHANGED
@@ -197,24 +197,31 @@ class Translate_Json_Ld {
|
|
197 |
|
198 |
$array_keys_indexes = array_keys($this->indexes);
|
199 |
for ( $i= $this->index_json_collections[$key]; $i < $this->limit_json_collections[$key] ; $i++) {
|
200 |
-
|
201 |
-
|
202 |
-
$index = $this->indexes[ $path ];
|
203 |
-
$y = 0;
|
204 |
-
|
205 |
-
do {
|
206 |
-
if ( is_null( $input_words[ $y ] ) || is_null( $output_words[ $y ] ) ) {
|
207 |
-
$y++;
|
208 |
continue;
|
209 |
}
|
210 |
|
211 |
-
$
|
212 |
-
$
|
213 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
218 |
}
|
219 |
|
220 |
return json_decode( $json_object->getJson(), JSON_PRETTY_PRINT );
|
@@ -293,7 +300,11 @@ class Translate_Json_Ld {
|
|
293 |
}
|
294 |
|
295 |
|
296 |
-
|
|
|
|
|
|
|
|
|
297 |
|
298 |
return $dom->save();
|
299 |
}
|
197 |
|
198 |
$array_keys_indexes = array_keys($this->indexes);
|
199 |
for ( $i= $this->index_json_collections[$key]; $i < $this->limit_json_collections[$key] ; $i++) {
|
200 |
+
try {
|
201 |
+
if( !array_key_exists($i, $array_keys_indexes)){
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
continue;
|
203 |
}
|
204 |
|
205 |
+
$path = $array_keys_indexes[$i];
|
206 |
+
$index = $this->indexes[ $path ];
|
207 |
+
$y = 0;
|
208 |
+
|
209 |
+
do {
|
210 |
+
if ( is_null( $input_words[ $y ] ) || is_null( $output_words[ $y ] ) ) {
|
211 |
+
$y++;
|
212 |
+
continue;
|
213 |
+
}
|
214 |
+
|
215 |
+
$input_word = $input_words[ $y ]->getWord();
|
216 |
+
$output_word = $output_words[ $y ]->getWord();
|
217 |
+
$str = $json_object->get( $path )[0];
|
218 |
|
219 |
+
$json_object->set( $path, str_replace( $input_word, $output_word, $str ) );
|
220 |
+
$y++;
|
221 |
+
} while ( $y < $index['limit'] );
|
222 |
+
} catch (\Exception $e) {
|
223 |
+
continue;
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
return json_decode( $json_object->getJson(), JSON_PRETTY_PRINT );
|
300 |
}
|
301 |
|
302 |
|
303 |
+
try {
|
304 |
+
$translated_jsons = $this->replace_jsons_translated( $jsons, $translated_words );
|
305 |
+
} catch (\Exception $e) {
|
306 |
+
return $dom->save();
|
307 |
+
}
|
308 |
|
309 |
return $dom->save();
|
310 |
}
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitbf7b9589f81bc8286e1e2b3333897541::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb4e5615aa57ee5c377f456d80cee608d
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitb4e5615aa57ee5c377f456d80cee608d
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitbf7b9589f81bc8286e1e2b3333897541
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitbf7b9589f81bc8286e1e2b3333897541', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitbf7b9589f81bc8286e1e2b3333897541', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequirebf7b9589f81bc8286e1e2b3333897541($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequirebf7b9589f81bc8286e1e2b3333897541($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'6c200413eed8aeea54dbaf934a31b127' => __DIR__ . '/..' . '/weglot/simplehtmldom/src/simple_html_dom.php',
|
@@ -67,9 +67,9 @@ class ComposerStaticInitb4e5615aa57ee5c377f456d80cee608d
|
|
67 |
public static function getInitializer(ClassLoader $loader)
|
68 |
{
|
69 |
return \Closure::bind(function () use ($loader) {
|
70 |
-
$loader->prefixLengthsPsr4 =
|
71 |
-
$loader->prefixDirsPsr4 =
|
72 |
-
$loader->prefixesPsr0 =
|
73 |
|
74 |
}, null, ClassLoader::class);
|
75 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'6c200413eed8aeea54dbaf934a31b127' => __DIR__ . '/..' . '/weglot/simplehtmldom/src/simple_html_dom.php',
|
67 |
public static function getInitializer(ClassLoader $loader)
|
68 |
{
|
69 |
return \Closure::bind(function () use ($loader) {
|
70 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541::$prefixLengthsPsr4;
|
71 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541::$prefixDirsPsr4;
|
72 |
+
$loader->prefixesPsr0 = ComposerStaticInitbf7b9589f81bc8286e1e2b3333897541::$prefixesPsr0;
|
73 |
|
74 |
}, null, ClassLoader::class);
|
75 |
}
|
weglot.php
CHANGED
@@ -7,7 +7,7 @@ Author: Weglot Translate team
|
|
7 |
Author URI: https://weglot.com/
|
8 |
Text Domain: weglot
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 3.0.
|
11 |
*/
|
12 |
|
13 |
/**
|
@@ -22,7 +22,7 @@ if ( ! defined('ABSPATH')) {
|
|
22 |
define('WEGLOT_NAME', 'Weglot');
|
23 |
define('WEGLOT_SLUG', 'weglot-translate');
|
24 |
define('WEGLOT_OPTION_GROUP', 'group-weglot-translate');
|
25 |
-
define('WEGLOT_VERSION', '3.0.
|
26 |
define('WEGLOT_PHP_MIN', '5.4');
|
27 |
define('WEGLOT_BNAME', plugin_basename(__FILE__));
|
28 |
define('WEGLOT_DIR', __DIR__ );
|
7 |
Author URI: https://weglot.com/
|
8 |
Text Domain: weglot
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 3.0.4
|
11 |
*/
|
12 |
|
13 |
/**
|
22 |
define('WEGLOT_NAME', 'Weglot');
|
23 |
define('WEGLOT_SLUG', 'weglot-translate');
|
24 |
define('WEGLOT_OPTION_GROUP', 'group-weglot-translate');
|
25 |
+
define('WEGLOT_VERSION', '3.0.4');
|
26 |
define('WEGLOT_PHP_MIN', '5.4');
|
27 |
define('WEGLOT_BNAME', plugin_basename(__FILE__));
|
28 |
define('WEGLOT_DIR', __DIR__ );
|