Weglot Translate – Translate your WP website - Version 3.0.2

Version Description

(24/04/2019) = * Bugfix: Fixed saving custom CSS * Bugfix: Auto detection of a bot (google, bing,...) * Bugfix: Compatibility with caldera forms

Download this release

Release Info

Developer remyb92
Plugin Icon 128x128 Weglot Translate – Translate your WP website
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -68,7 +68,7 @@ You can help translate Weglot Translate plugin on [__translate.wordpress.org__](
68
  = Installation steps for Weglot Translate =
69
  Weglot Translate is easy to set up:
70
 
71
- 1. Go to [https://weglot.com/register-wordpress](https://weglot.com/register-wordpress) to set up an account.
72
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
73
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
74
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
@@ -131,7 +131,7 @@ Weglot Translate is easy to set up:
131
 
132
  [youtube http://www.youtube.com/watch?v=cdoBED8p3HQ]
133
 
134
- 1. Go to [https://weglot.com/register-wordpress](https://weglot.com/register-wordpress) to set up an account
135
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
136
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
137
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
@@ -153,6 +153,11 @@ See changelog for upgrade changes.
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
156
  = 3.0.1 (17/04/2019) =
157
  * Bugfix: API key check only if it does not exist
158
  * Bugfix: prevent array_key_exists on private languages for older installations
4
  Requires at least: 4.5
5
  Tested up to: 5.1
6
  Requires PHP: 5.4
7
+ Stable tag: 3.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
68
  = Installation steps for Weglot Translate =
69
  Weglot Translate is easy to set up:
70
 
71
+ 1. Go to [https://dashboard.weglot.com/register-wordpress](https://dashboard.weglot.com/register-wordpress) to set up an account.
72
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
73
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
74
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
131
 
132
  [youtube http://www.youtube.com/watch?v=cdoBED8p3HQ]
133
 
134
+ 1. Go to [https://dashboard.weglot.com/register-wordpress](https://dashboard.weglot.com/register-wordpress) to set up an account
135
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
136
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
137
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
153
 
154
  == Changelog ==
155
 
156
+ = 3.0.2 (24/04/2019) =
157
+ * Bugfix: Fixed saving custom CSS
158
+ * Bugfix: Auto detection of a bot (google, bing,...)
159
+ * Bugfix: Compatibility with caldera forms
160
+
161
  = 3.0.1 (17/04/2019) =
162
  * Bugfix: API key check only if it does not exist
163
  * Bugfix: prevent array_key_exists on private languages for older installations
src/actions/admin/class-customize-menu-weglot.php CHANGED
@@ -99,7 +99,7 @@ class Customize_Menu_Weglot implements Hooks_Interface_Weglot {
99
  wp_enqueue_script( 'weglot_nav_menu', WEGLOT_URL_DIST . '/nav-js.js', [ 'jquery' ], WEGLOT_VERSION );
100
 
101
  $data['title'] = __( 'Weglot switcher', 'weglot' );
102
- $data['options'] = $this->option_services->get_option( 'menu_switcher' );
103
  $data['list_options'] = $this->menu_options_services->get_list_options_menu_switcher();
104
 
105
  wp_localize_script( 'weglot_nav_menu', 'weglot_data', $data );
99
  wp_enqueue_script( 'weglot_nav_menu', WEGLOT_URL_DIST . '/nav-js.js', [ 'jquery' ], WEGLOT_VERSION );
100
 
101
  $data['title'] = __( 'Weglot switcher', 'weglot' );
102
+ $data['options'] = $this->option_services->get_option_by_key_v3( 'menu_switcher' );
103
  $data['list_options'] = $this->menu_options_services->get_list_options_menu_switcher();
104
 
105
  wp_localize_script( 'weglot_nav_menu', 'weglot_data', $data );
src/actions/admin/class-options-weglot.php CHANGED
@@ -69,12 +69,12 @@ class Options_Weglot implements Hooks_Interface_Weglot {
69
  return;
70
  }
71
 
72
- $tab = $_GET[ 'tab' ]; //phpcs:ignore
 
 
73
  switch ( $tab ) {
74
  case Helper_Tabs_Admin_Weglot::SETTINGS:
75
- $options = $_POST[ WEGLOT_SLUG ]; //phpcs:ignore
76
 
77
- $options_bdd = $this->option_services->get_options_bdd_v3();
78
  $has_first_settings = $this->option_services->get_has_first_settings();
79
  $options = $this->sanitize_options_settings( $options, $has_first_settings );
80
  $response = $this->option_services->save_options_to_weglot( $options, $has_first_settings );
@@ -107,6 +107,30 @@ class Options_Weglot implements Hooks_Interface_Weglot {
107
  update_option( sprintf( '%s-%s', WEGLOT_SLUG, 'api_key' ), $response['result']['api_key'] );
108
  }
109
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
 
112
  wp_redirect( $redirect_url ); //phpcs:ignore
@@ -150,7 +174,7 @@ class Options_Weglot implements Hooks_Interface_Weglot {
150
  $options['custom_settings']['button_style']['with_name'] = $default_options['custom_settings']['button_style']['with_name'];
151
  }
152
 
153
- $options['custom_settings']['button_style']['custom_css'] = isset( $options['custom_settings']['button_style']['custom_css'] ) ? $options['custom_settings']['button_style']['custom_css'] : '';
154
 
155
  $options['custom_settings']['button_style']['flag_type'] = isset( $options['custom_settings']['button_style']['flag_type'] ) ? $options['custom_settings']['button_style']['flag_type'] : Helper_Flag_Type::RECTANGLE_MAT;
156
 
@@ -176,6 +200,9 @@ class Options_Weglot implements Hooks_Interface_Weglot {
176
  if ( empty( $item['value'] ) ) {
177
  unset( $options['excluded_paths'][ $key ] );
178
  }
 
 
 
179
  }
180
 
181
  if ( ! isset( $options['excluded_blocks'] ) ) {
69
  return;
70
  }
71
 
72
+ $tab = $_GET[ 'tab' ]; //phpcs:ignore
73
+ $options = $_POST[ WEGLOT_SLUG ]; //phpcs:ignore
74
+ $options_bdd = $this->option_services->get_options_bdd_v3();
75
  switch ( $tab ) {
76
  case Helper_Tabs_Admin_Weglot::SETTINGS:
 
77
 
 
78
  $has_first_settings = $this->option_services->get_has_first_settings();
79
  $options = $this->sanitize_options_settings( $options, $has_first_settings );
80
  $response = $this->option_services->save_options_to_weglot( $options, $has_first_settings );
107
  update_option( sprintf( '%s-%s', WEGLOT_SLUG, 'api_key' ), $response['result']['api_key'] );
108
  }
109
  break;
110
+ case Helper_Tabs_Admin_Weglot::SUPPORT:
111
+ if ( array_key_exists( 'active_wc_reload', $options ) && $options['active_wc_reload'] === 'on' ) {
112
+ $options_bdd['active_wc_reload'] = true;
113
+ }
114
+ else {
115
+ $options_bdd['active_wc_reload'] = false;
116
+ }
117
+
118
+ $this->option_services->set_options( $options_bdd );
119
+ break;
120
+ case Helper_Tabs_Admin_Weglot::CUSTOM_URLS:
121
+ if (null === $options_bdd) {
122
+ $options_bdd['custom_urls'] = [];
123
+ }
124
+
125
+ if ( array_key_exists( 'custom_urls', $options ) ) {
126
+ $options_bdd['custom_urls'] = $options['custom_urls'];
127
+ }
128
+ else {
129
+ $options_bdd['custom_urls'] = [];
130
+ }
131
+
132
+ $this->option_services->set_options( $options_bdd );
133
+ break;
134
  }
135
 
136
  wp_redirect( $redirect_url ); //phpcs:ignore
174
  $options['custom_settings']['button_style']['with_name'] = $default_options['custom_settings']['button_style']['with_name'];
175
  }
176
 
177
+ $options['custom_settings']['button_style']['custom_css'] = isset( $options['custom_settings']['button_style']['custom_css'] ) ? stripcslashes( $options['custom_settings']['button_style']['custom_css'] ) : '';
178
 
179
  $options['custom_settings']['button_style']['flag_type'] = isset( $options['custom_settings']['button_style']['flag_type'] ) ? $options['custom_settings']['button_style']['flag_type'] : Helper_Flag_Type::RECTANGLE_MAT;
180
 
200
  if ( empty( $item['value'] ) ) {
201
  unset( $options['excluded_paths'][ $key ] );
202
  }
203
+ else {
204
+ $options['excluded_paths'][ $key ]['value'] = stripcslashes( $item['value'] );
205
+ }
206
  }
207
 
208
  if ( ! isset( $options['excluded_blocks'] ) ) {
src/models/class-schema-option-v3.php CHANGED
@@ -103,6 +103,7 @@ class Schema_Option_V3 {
103
  ],
104
  'flag_css' => 'flag_css',
105
  'menu_switcher' => 'menu_switcher',
 
106
  ];
107
 
108
  return $schema;
103
  ],
104
  'flag_css' => 'flag_css',
105
  'menu_switcher' => 'menu_switcher',
106
+ 'active_wc_reload' => 'active_wc_reload',
107
  ];
108
 
109
  return $schema;
src/services/class-option-service-weglot.php CHANGED
@@ -66,6 +66,7 @@ class Option_Service_Weglot {
66
  'menu_switcher' => [],
67
  'custom_urls' => [],
68
  'flag_css' => '',
 
69
  ];
70
 
71
  /**
@@ -185,7 +186,6 @@ class Option_Service_Weglot {
185
  $menu_options_services = weglot_get_service( 'Menu_Options_Service_Weglot' );
186
  $options['custom_settings']['menu_switcher'] = $menu_options_services->get_options_default();
187
  }
188
-
189
  $this->options_from_api = $options;
190
 
191
  return [
@@ -302,7 +302,7 @@ class Option_Service_Weglot {
302
  */
303
  public function save_options_to_weglot( $options ) {
304
  $response = wp_remote_post( sprintf( '%s/projects/settings?api_key=%s', Helper_API::get_api_url(), $options['api_key_private'] ), [
305
- 'body' => json_encode( $options ), //phpcs:ignore
306
  'headers' => [
307
  'technology' => 'wordpress',
308
  'Content-Type' => 'application/json; charset=utf-8',
@@ -326,10 +326,10 @@ class Option_Service_Weglot {
326
  * @param string $key
327
  * @return string|null
328
  */
329
- public function get_option_custom_settings( $key ){
330
  $options = $this->get_options();
331
 
332
- if( ! array_key_exists( 'custom_settings', $options ) ){
333
  return $this->get_option( $key );
334
  }
335
 
@@ -494,4 +494,17 @@ class Option_Service_Weglot {
494
  $this->set_options( $options );
495
  return $this;
496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  }
66
  'menu_switcher' => [],
67
  'custom_urls' => [],
68
  'flag_css' => '',
69
+ 'active_wc_reload' => false,
70
  ];
71
 
72
  /**
186
  $menu_options_services = weglot_get_service( 'Menu_Options_Service_Weglot' );
187
  $options['custom_settings']['menu_switcher'] = $menu_options_services->get_options_default();
188
  }
 
189
  $this->options_from_api = $options;
190
 
191
  return [
302
  */
303
  public function save_options_to_weglot( $options ) {
304
  $response = wp_remote_post( sprintf( '%s/projects/settings?api_key=%s', Helper_API::get_api_url(), $options['api_key_private'] ), [
305
+ 'body' => json_encode( $options ), //phpcs: ignore
306
  'headers' => [
307
  'technology' => 'wordpress',
308
  'Content-Type' => 'application/json; charset=utf-8',
326
  * @param string $key
327
  * @return string|null
328
  */
329
+ public function get_option_custom_settings( $key ) {
330
  $options = $this->get_options();
331
 
332
+ if( ! array_key_exists( 'custom_settings', $options ) ) {
333
  return $this->get_option( $key );
334
  }
335
 
494
  $this->set_options( $options );
495
  return $this;
496
  }
497
+ /**
498
+ * @param string $key
499
+ * @return any
500
+ */
501
+ public function get_option_by_key_v3( $key ) {
502
+ $options = $this->get_options_bdd_v3();
503
+
504
+ if( ! array_key_exists( $key, $options ) ) {
505
+ return null;
506
+ }
507
+
508
+ return $options[ $key ];
509
+ }
510
  }
src/services/class-parser-service-weglot.php CHANGED
@@ -77,6 +77,10 @@ class Parser_Service_Weglot {
77
  $config = new ServerConfigProvider();
78
  }
79
 
 
 
 
 
80
  $client = $this->get_client();
81
 
82
  if ( '2' === WEGLOT_LIB_PARSER ) {
77
  $config = new ServerConfigProvider();
78
  }
79
 
80
+ if( method_exists( $config, 'loadFromServer') ){
81
+ $config->loadFromServer();
82
+ }
83
+
84
  $client = $this->get_client();
85
 
86
  if ( '2' === WEGLOT_LIB_PARSER ) {
src/services/class-private-language-service-weglot.php CHANGED
@@ -62,6 +62,10 @@ class Private_Language_Service_Weglot {
62
  return false;
63
  }
64
 
 
 
 
 
65
  if ( ! array_key_exists( 'active', $private_mode_languages ) ) {
66
  return false;
67
  }
62
  return false;
63
  }
64
 
65
+ if ( ! is_array( $private_mode_languages ) ) {
66
+ return false;
67
+ }
68
+
69
  if ( ! array_key_exists( 'active', $private_mode_languages ) ) {
70
  return false;
71
  }
src/third/calderaforms/class-caldera-translate.php CHANGED
@@ -55,7 +55,7 @@ class Caldera_Translate {
55
  $word_collection->addOne( new WordEntry( $value, WordType::TEXT ) );
56
  }
57
 
58
- $client = $this->parser_services->get_client();
59
  $translate = new Translate( $translate, $client );
60
 
61
  return $translate->handle();
55
  $word_collection->addOne( new WordEntry( $value, WordType::TEXT ) );
56
  }
57
 
58
+ $client = weglot_get_service( 'Parser_Service_Weglot' )->get_client();
59
  $translate = new Translate( $translate, $client );
60
 
61
  return $translate->handle();
templates/admin/pages/tabs/settings.php CHANGED
@@ -9,7 +9,7 @@ $options_available = [
9
  'api_key_private' => [
10
  'key' => 'api_key_private',
11
  'label' => __( 'API Key', 'weglot' ),
12
- 'description' => __( 'Log in to <a target="_blank" href="https://weglot.com/register-wordpress">Weglot</a> to get your API key.', 'weglot' ),
13
  ],
14
  'language_from' => [
15
  'key' => 'original_language',
@@ -103,6 +103,9 @@ $plans = $this->user_api_services->get_plans();
103
  <?php foreach ( $this->options[ $options_available['languages']['key'] ] as $language ) :
104
 
105
  $language = $languages[ $language ];
 
 
 
106
  ?>
107
  <option
108
  value="<?php echo esc_attr( $language->getIso639() ); ?>"
9
  'api_key_private' => [
10
  'key' => 'api_key_private',
11
  'label' => __( 'API Key', 'weglot' ),
12
+ 'description' => __( 'Log in to <a target="_blank" href="https://dashboard.weglot.com/register-wordpress">Weglot</a> to get your API key.', 'weglot' ),
13
  ],
14
  'language_from' => [
15
  'key' => 'original_language',
103
  <?php foreach ( $this->options[ $options_available['languages']['key'] ] as $language ) :
104
 
105
  $language = $languages[ $language ];
106
+ if( ! $language ) {
107
+ continue;
108
+ }
109
  ?>
110
  <option
111
  value="<?php echo esc_attr( $language->getIso639() ); ?>"
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit4d1d13c56b817ee29d5e8e760c5618e4::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f', '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\ComposerStaticInit865457f1d3d9514fc24c719235c2f59f::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit865457f1d3d9514fc24c719235c2f59f
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit865457f1d3d9514fc24c719235c2f59f::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire865457f1d3d9514fc24c719235c2f59f($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire865457f1d3d9514fc24c719235c2f59f($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit4d1d13c56b817ee29d5e8e760c5618e4
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit4d1d13c56b817ee29d5e8e760c5618e4', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit4d1d13c56b817ee29d5e8e760c5618e4', '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\ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4::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\ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire4d1d13c56b817ee29d5e8e760c5618e4($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire4d1d13c56b817ee29d5e8e760c5618e4($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 ComposerStaticInit865457f1d3d9514fc24c719235c2f59f
8
  {
9
  public static $files = array (
10
  '6c200413eed8aeea54dbaf934a31b127' => __DIR__ . '/..' . '/weglot/simplehtmldom/src/simple_html_dom.php',
@@ -67,9 +67,9 @@ class ComposerStaticInit865457f1d3d9514fc24c719235c2f59f
67
  public static function getInitializer(ClassLoader $loader)
68
  {
69
  return \Closure::bind(function () use ($loader) {
70
- $loader->prefixLengthsPsr4 = ComposerStaticInit865457f1d3d9514fc24c719235c2f59f::$prefixLengthsPsr4;
71
- $loader->prefixDirsPsr4 = ComposerStaticInit865457f1d3d9514fc24c719235c2f59f::$prefixDirsPsr4;
72
- $loader->prefixesPsr0 = ComposerStaticInit865457f1d3d9514fc24c719235c2f59f::$prefixesPsr0;
73
 
74
  }, null, ClassLoader::class);
75
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4
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 = ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4::$prefixLengthsPsr4;
71
+ $loader->prefixDirsPsr4 = ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4::$prefixDirsPsr4;
72
+ $loader->prefixesPsr0 = ComposerStaticInit4d1d13c56b817ee29d5e8e760c5618e4::$prefixesPsr0;
73
 
74
  }, null, ClassLoader::class);
75
  }
vendor/composer/installed.json CHANGED
@@ -183,17 +183,17 @@
183
  },
184
  {
185
  "name": "weglot/weglot-php",
186
- "version": "0.5.22",
187
- "version_normalized": "0.5.22.0",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/weglot/weglot-php.git",
191
- "reference": "30d870d0cce0d8fff2829c260465369b2245d1f7"
192
  },
193
  "dist": {
194
  "type": "zip",
195
- "url": "https://api.github.com/repos/weglot/weglot-php/zipball/30d870d0cce0d8fff2829c260465369b2245d1f7",
196
- "reference": "30d870d0cce0d8fff2829c260465369b2245d1f7",
197
  "shasum": ""
198
  },
199
  "require": {
@@ -205,7 +205,7 @@
205
  "codeception/codeception": "^2.4",
206
  "vlucas/phpdotenv": "^2.4"
207
  },
208
- "time": "2019-03-19T12:51:48+00:00",
209
  "type": "library",
210
  "installation-source": "dist",
211
  "autoload": {
183
  },
184
  {
185
  "name": "weglot/weglot-php",
186
+ "version": "0.5.23",
187
+ "version_normalized": "0.5.23.0",
188
  "source": {
189
  "type": "git",
190
  "url": "https://github.com/weglot/weglot-php.git",
191
+ "reference": "bf09ff1dbb21e694b65518153c78593608a61f74"
192
  },
193
  "dist": {
194
  "type": "zip",
195
+ "url": "https://api.github.com/repos/weglot/weglot-php/zipball/bf09ff1dbb21e694b65518153c78593608a61f74",
196
+ "reference": "bf09ff1dbb21e694b65518153c78593608a61f74",
197
  "shasum": ""
198
  },
199
  "require": {
205
  "codeception/codeception": "^2.4",
206
  "vlucas/phpdotenv": "^2.4"
207
  },
208
+ "time": "2019-03-19T13:24:47+00:00",
209
  "type": "library",
210
  "installation-source": "dist",
211
  "autoload": {
vendor/weglot/weglot-php/tests/unit/Util/RegexTest.php CHANGED
@@ -27,9 +27,10 @@ class RegexTest extends \Codeception\Test\Unit {
27
  ];
28
 
29
  $regex = $this->_regexInstance($option);
 
30
 
31
- $this->assertEquals('#^http:\/\/#', $regex->getRegex());
32
- $this->assertRegExp($regex->getRegex(), 'http://');
33
  }
34
 
35
  public function testRegexEndWith() {
@@ -39,9 +40,10 @@ class RegexTest extends \Codeception\Test\Unit {
39
  ];
40
 
41
  $regex = $this->_regexInstance($option);
 
42
 
43
- $this->assertEquals('#http:\/\/$#', $regex->getRegex());
44
- $this->assertRegExp($regex->getRegex(), 'test string http://');
45
  }
46
 
47
  public function testRegexContain() {
@@ -51,9 +53,10 @@ class RegexTest extends \Codeception\Test\Unit {
51
  ];
52
 
53
  $regex = $this->_regexInstance($option);
 
54
 
55
- $this->assertEquals('#http:\/\/#', $regex->getRegex());
56
- $this->assertRegExp($regex->getRegex(), 'test http:// string');
57
  }
58
 
59
  public function testRegexIsExactly() {
@@ -63,19 +66,20 @@ class RegexTest extends \Codeception\Test\Unit {
63
  ];
64
 
65
  $regex = $this->_regexInstance($option);
 
66
 
67
- $this->assertEquals('#^http:\/\/$#', $regex->getRegex());
68
- $this->assertRegExp($regex->getRegex(), 'http://');
69
  }
70
  public function testMatchRegex() {
71
  $option = [
72
  'type' => RegexEnum::MATCH_REGEX,
73
- 'value' => '#^http:\/\/#',
74
  ];
75
 
76
- $regex = $this->_regexInstance($option);
77
 
78
- $this->assertEquals('#^http:\/\/#', $regex->getRegex());
79
- $this->assertRegExp($regex->getRegex(), 'http://weglot.com');
80
  }
81
  }
27
  ];
28
 
29
  $regex = $this->_regexInstance($option);
30
+ $regex = str_replace('/', '\/', $regex->getRegex());
31
 
32
+ $this->assertEquals('^http:\/\/', $regex);
33
+ $this->assertRegExp("#" . $regex . "#", 'http://');
34
  }
35
 
36
  public function testRegexEndWith() {
40
  ];
41
 
42
  $regex = $this->_regexInstance($option);
43
+ $regex = str_replace('/', '\/', $regex->getRegex());
44
 
45
+ $this->assertEquals('http:\/\/$', $regex);
46
+ $this->assertRegExp("#" . $regex . "#", 'test string http://');
47
  }
48
 
49
  public function testRegexContain() {
53
  ];
54
 
55
  $regex = $this->_regexInstance($option);
56
+ $regex = str_replace('/', '\/', $regex->getRegex());
57
 
58
+ $this->assertEquals('http:\/\/', $regex);
59
+ $this->assertRegExp("#" . $regex . "#", 'test http:// string');
60
  }
61
 
62
  public function testRegexIsExactly() {
66
  ];
67
 
68
  $regex = $this->_regexInstance($option);
69
+ $regex = str_replace('/', '\/', $regex->getRegex());
70
 
71
+ $this->assertEquals('^http:\/\/$', $regex);
72
+ $this->assertRegExp("#" . $regex . "#", 'http://');
73
  }
74
  public function testMatchRegex() {
75
  $option = [
76
  'type' => RegexEnum::MATCH_REGEX,
77
+ 'value' => '^http:\/\/',
78
  ];
79
 
80
+ $regex = $this->_regexInstance($option)->getRegex();
81
 
82
+ $this->assertEquals('^http:\/\/', $regex);
83
+ $this->assertRegExp("#" . $regex . "#", 'http://weglot.com');
84
  }
85
  }
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.1
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.1');
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.2
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.2');
26
  define('WEGLOT_PHP_MIN', '5.4');
27
  define('WEGLOT_BNAME', plugin_basename(__FILE__));
28
  define('WEGLOT_DIR', __DIR__ );