Cyr-To-Lat - Version 5.2.4

Version Description

(07.09.2021) = * Fix issue with not showing WooCommerce variable product attributes. * Fix issue with Elementor and WPML, endless loop.

Download this release

Release Info

Developer mihdan
Plugin Icon 128x128 Cyr-To-Lat
Version 5.2.4
Comparing to
See all releases

Code changes from version 5.2.3 to 5.2.4

auth.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
  "github-oauth": {
3
- "github.com": "ghs_CuZ06oKLqUCaAItddkclQwl7YhhUJk1fW8PL"
4
  }
5
  }
1
  {
2
  "github-oauth": {
3
+ "github.com": "ghs_kHeFMe0qlndEpzx5HtB9BFgDqW1EHm1sIzc0"
4
  }
5
  }
cyr-to-lat.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Cyr-To-Lat
11
  * Plugin URI: https://wordpress.org/plugins/cyr2lat/
12
  * Description: Convert Non-Latin characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
13
- * Version: 5.2.3
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
@@ -36,7 +36,7 @@ if ( defined( 'CYR_TO_LAT_VERSION' ) ) {
36
  /**
37
  * Plugin version.
38
  */
39
- define( 'CYR_TO_LAT_VERSION', '5.2.3' );
40
 
41
  /**
42
  * Path to the plugin dir.
10
  * Plugin Name: Cyr-To-Lat
11
  * Plugin URI: https://wordpress.org/plugins/cyr2lat/
12
  * Description: Convert Non-Latin characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
13
+ * Version: 5.2.4
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
36
  /**
37
  * Plugin version.
38
  */
39
+ define( 'CYR_TO_LAT_VERSION', '5.2.4' );
40
 
41
  /**
42
  * Path to the plugin dir.
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 5.1
5
  Tested up to: 5.8
6
- Stable tag: 5.2.3
7
  Requires PHP: 5.6.20
8
 
9
  Convert Non-Latin characters in post, page and term slugs to Latin characters.
@@ -188,6 +188,10 @@ Yes you can!
188
 
189
  == Changelog ==
190
 
 
 
 
 
191
  = 5.2.3 (07.09.2021) =
192
  * Fix issue with WP Foro plugin - transliterate topic slug when created on frontend.
193
  * Fix bug with Polylang on REST request.
3
  Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration
4
  Requires at least: 5.1
5
  Tested up to: 5.8
6
+ Stable tag: 5.2.4
7
  Requires PHP: 5.6.20
8
 
9
  Convert Non-Latin characters in post, page and term slugs to Latin characters.
188
 
189
  == Changelog ==
190
 
191
+ = 5.2.4 (07.09.2021) =
192
+ * Fix issue with not showing WooCommerce variable product attributes.
193
+ * Fix issue with Elementor and WPML, endless loop.
194
+
195
  = 5.2.3 (07.09.2021) =
196
  * Fix issue with WP Foro plugin - transliterate topic slug when created on frontend.
197
  * Fix bug with Polylang on REST request.
src/php/class-main.php CHANGED
@@ -108,16 +108,18 @@ class Main {
108
  */
109
  protected $wpml_locale;
110
 
 
 
 
 
 
 
 
111
  /**
112
  * Main constructor.
113
  */
114
  public function __construct() {
115
- $this->request = new Request();
116
-
117
- if ( ! $this->request->is_allowed() ) {
118
- return;
119
- }
120
-
121
  $this->settings = new Settings();
122
  $this->admin_notices = new Admin_Notices();
123
  $requirements = new Requirements( $this->settings, $this->admin_notices );
@@ -149,10 +151,6 @@ class Main {
149
  * @noinspection PhpUndefinedClassInspection
150
  */
151
  public function init() {
152
- if ( ! $this->request->is_allowed() ) {
153
- return;
154
- }
155
-
156
  if ( $this->request->is_cli() ) {
157
  try {
158
  /**
@@ -177,7 +175,10 @@ class Main {
177
  add_filter( 'sanitize_file_name', [ $this, 'sanitize_filename' ], 10, 2 );
178
  add_filter( 'wp_insert_post_data', [ $this, 'sanitize_post_name' ], 10, 2 );
179
  add_filter( 'pre_insert_term', [ $this, 'pre_insert_term_filter' ], PHP_INT_MAX, 2 );
180
- add_filter( 'get_terms_args', [ $this, 'get_terms_args_filter' ], PHP_INT_MAX, 2 );
 
 
 
181
 
182
  if ( class_exists( Polylang::class ) ) {
183
  add_filter( 'locale', [ $this, 'pll_locale_filter' ] );
@@ -372,8 +373,6 @@ class Main {
372
  * @link https://kagg.eu/how-to-catch-gutenberg/
373
  *
374
  * @return bool
375
- *
376
- * @noinspection PhpIncludeInspection
377
  */
378
  private function is_classic_editor_plugin_active() {
379
  // @codeCoverageIgnoreStart
@@ -633,10 +632,14 @@ class Main {
633
  * @return string|null
634
  */
635
  protected function get_wpml_locale() {
636
- $language_code = wpml_get_current_language();
637
- $languages = apply_filters( 'wpml_active_languages', null );
638
 
639
- return isset( $languages[ $language_code ] ) ? $languages[ $language_code ]['default_locale'] : null;
 
 
 
 
640
  }
641
 
642
  /**
@@ -649,9 +652,12 @@ class Main {
649
  * @noinspection PhpUnusedParameterInspection
650
  */
651
  public function wpml_language_has_switched( $language_code, $cookie_lang, $original_language ) {
652
- $languages = apply_filters( 'wpml_active_languages', null );
653
 
654
- $this->wpml_locale = isset( $languages[ $language_code ] ) ? $languages[ $language_code ]['default_locale'] : null;
 
 
 
655
  }
656
 
657
  /**
108
  */
109
  protected $wpml_locale;
110
 
111
+ /**
112
+ * WPML languages.
113
+ *
114
+ * @var array
115
+ */
116
+ protected $wpml_languages;
117
+
118
  /**
119
  * Main constructor.
120
  */
121
  public function __construct() {
122
+ $this->request = new Request();
 
 
 
 
 
123
  $this->settings = new Settings();
124
  $this->admin_notices = new Admin_Notices();
125
  $requirements = new Requirements( $this->settings, $this->admin_notices );
151
  * @noinspection PhpUndefinedClassInspection
152
  */
153
  public function init() {
 
 
 
 
154
  if ( $this->request->is_cli() ) {
155
  try {
156
  /**
175
  add_filter( 'sanitize_file_name', [ $this, 'sanitize_filename' ], 10, 2 );
176
  add_filter( 'wp_insert_post_data', [ $this, 'sanitize_post_name' ], 10, 2 );
177
  add_filter( 'pre_insert_term', [ $this, 'pre_insert_term_filter' ], PHP_INT_MAX, 2 );
178
+
179
+ if ( ! $this->request->is_frontend() ) {
180
+ add_filter( 'get_terms_args', [ $this, 'get_terms_args_filter' ], PHP_INT_MAX, 2 );
181
+ }
182
 
183
  if ( class_exists( Polylang::class ) ) {
184
  add_filter( 'locale', [ $this, 'pll_locale_filter' ] );
373
  * @link https://kagg.eu/how-to-catch-gutenberg/
374
  *
375
  * @return bool
 
 
376
  */
377
  private function is_classic_editor_plugin_active() {
378
  // @codeCoverageIgnoreStart
632
  * @return string|null
633
  */
634
  protected function get_wpml_locale() {
635
+ $language_code = wpml_get_current_language();
636
+ $this->wpml_languages = (array) apply_filters( 'wpml_active_languages', [] );
637
 
638
+ return (
639
+ isset( $this->wpml_languages[ $language_code ] ) ?
640
+ $this->wpml_languages[ $language_code ]['default_locale'] :
641
+ null
642
+ );
643
  }
644
 
645
  /**
652
  * @noinspection PhpUnusedParameterInspection
653
  */
654
  public function wpml_language_has_switched( $language_code, $cookie_lang, $original_language ) {
655
+ $language_code = (string) $language_code;
656
 
657
+ $this->wpml_locale =
658
+ isset( $this->wpml_languages[ $language_code ] ) ?
659
+ $this->wpml_languages[ $language_code ]['default_locale'] :
660
+ null;
661
  }
662
 
663
  /**
src/php/class-request.php CHANGED
@@ -14,15 +14,6 @@ use WP_Rewrite;
14
  */
15
  class Request {
16
 
17
- /**
18
- * Is allowed request for plugin to work.
19
- *
20
- * @return bool
21
- */
22
- public function is_allowed() {
23
- return ! $this->is_frontend() || ( $this->is_frontend() && $this->is_post() );
24
- }
25
-
26
  /**
27
  * Is frontend.
28
  *
@@ -97,18 +88,4 @@ class Request {
97
 
98
  return $is_rest ? substr( $current_path, strlen( $rest_path ) ) : '';
99
  }
100
-
101
- /**
102
- * If current request is POST.
103
- *
104
- * @return bool
105
- */
106
- public function is_post() {
107
- $request_method = filter_var(
108
- isset( $_SERVER['REQUEST_METHOD'] ) ? wp_unslash( $_SERVER['REQUEST_METHOD'] ) : '',
109
- FILTER_SANITIZE_STRING
110
- );
111
-
112
- return 'POST' === $request_method;
113
- }
114
  }
14
  */
15
  class Request {
16
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Is frontend.
19
  *
88
 
89
  return $is_rest ? substr( $current_path, strlen( $rest_path ) ) : '';
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit3d54a3353dd436950b823670ec0bade0::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit200ed858b85e7f58bdada4cb2f7139e9::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit200ed858b85e7f58bdada4cb2f7139e9
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit200ed858b85e7f58bdada4cb2f7139e9::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire200ed858b85e7f58bdada4cb2f7139e9($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire200ed858b85e7f58bdada4cb2f7139e9($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit3d54a3353dd436950b823670ec0bade0
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit3d54a3353dd436950b823670ec0bade0', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit3d54a3353dd436950b823670ec0bade0', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit3d54a3353dd436950b823670ec0bade0::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit3d54a3353dd436950b823670ec0bade0::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire3d54a3353dd436950b823670ec0bade0($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire3d54a3353dd436950b823670ec0bade0($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit200ed858b85e7f58bdada4cb2f7139e9
8
  {
9
  public static $files = array (
10
  '344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
@@ -37,7 +37,7 @@ class ComposerStaticInit200ed858b85e7f58bdada4cb2f7139e9
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
- $loader->classMap = ComposerStaticInit200ed858b85e7f58bdada4cb2f7139e9::$classMap;
41
 
42
  }, null, ClassLoader::class);
43
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit3d54a3353dd436950b823670ec0bade0
8
  {
9
  public static $files = array (
10
  '344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
+ $loader->classMap = ComposerStaticInit3d54a3353dd436950b823670ec0bade0::$classMap;
41
 
42
  }, null, ClassLoader::class);
43
  }
vendor/composer/installed.php CHANGED
@@ -1,22 +1,22 @@
1
  <?php return array(
2
  'root' => array(
3
- 'pretty_version' => '5.2.3',
4
- 'version' => '5.2.3.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => '06c64978b72b42ab29890563960c65378737cab1',
9
  'name' => 'mihdan/cyr2lat',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
- 'pretty_version' => '5.2.3',
15
- 'version' => '5.2.3.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => '06c64978b72b42ab29890563960c65378737cab1',
20
  'dev_requirement' => false,
21
  ),
22
  ),
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => '5.2.4',
4
+ 'version' => '5.2.4.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '3aad025265c84a9de0f83b5b236f7c564d293491',
9
  'name' => 'mihdan/cyr2lat',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
+ 'pretty_version' => '5.2.4',
15
+ 'version' => '5.2.4.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => '3aad025265c84a9de0f83b5b236f7c564d293491',
20
  'dev_requirement' => false,
21
  ),
22
  ),