Cyr-To-Lat - Version 5.2.6

Version Description

(25.12.2021) = * Revert fix made in 5.2.5 for 404 with WPML, as it created several issues on the frontend. * Fix again 404 on archives created with WPML before activation of cyr2lat.

Download this release

Release Info

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

Code changes from version 5.2.5 to 5.2.6

auth.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
  "github-oauth": {
3
- "github.com": "ghs_xDvaALB7S6Td9OB1Ci87JSrLzBJiIK104jLD"
4
  }
5
  }
1
  {
2
  "github-oauth": {
3
+ "github.com": "ghs_hWpnR4KTnNQjRiA3a6PjRZyflBMMfG1fpnvH"
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.5
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
@@ -40,7 +40,7 @@ if ( defined( 'CYR_TO_LAT_VERSION' ) ) {
40
  /**
41
  * Plugin version.
42
  */
43
- define( 'CYR_TO_LAT_VERSION', '5.2.5' );
44
 
45
  /**
46
  * 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.6
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
40
  /**
41
  * Plugin version.
42
  */
43
+ define( 'CYR_TO_LAT_VERSION', '5.2.6' );
44
 
45
  /**
46
  * 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.9
6
- Stable tag: 5.2.5
7
  Requires PHP: 5.6.20
8
 
9
  Convert Non-Latin characters in post, page and term slugs to Latin characters.
@@ -188,11 +188,15 @@ Yes you can!
188
 
189
  == Changelog ==
190
 
 
 
 
 
191
  = 5.2.5 (19.12.2021) =
192
  * Tested up to WordPress 5.9 and WooCommerce 6.0.
193
  * Fix issue with Polylang - do not modify admin language when editing a post.
194
  * Fix issue with JetPack - fatal error on synchronisation.
195
- * Fix 404 on archives created with wpml before activation of cyr2lat.
196
 
197
  = 5.2.4 (07.09.2021) =
198
  * Fix issue with not showing WooCommerce variable product attributes.
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.9
6
+ Stable tag: 5.2.6
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.6 (25.12.2021) =
192
+ * Revert fix made in 5.2.5 for 404 with WPML, as it created several issues on the frontend.
193
+ * Fix again 404 on archives created with WPML before activation of cyr2lat.
194
+
195
  = 5.2.5 (19.12.2021) =
196
  * Tested up to WordPress 5.9 and WooCommerce 6.0.
197
  * Fix issue with Polylang - do not modify admin language when editing a post.
198
  * Fix issue with JetPack - fatal error on synchronisation.
199
+ * Fix 404 on archives created with WPML before activation of cyr2lat.
200
 
201
  = 5.2.4 (07.09.2021) =
202
  * Fix issue with not showing WooCommerce variable product attributes.
src/php/class-main.php CHANGED
@@ -184,7 +184,7 @@ class Main {
184
  add_filter( 'wp_insert_post_data', [ $this, 'sanitize_post_name' ], 10, 2 );
185
  add_filter( 'pre_insert_term', [ $this, 'pre_insert_term_filter' ], PHP_INT_MAX, 2 );
186
 
187
- if ( ! $this->is_frontend ) {
188
  add_filter( 'get_terms_args', [ $this, 'get_terms_args_filter' ], PHP_INT_MAX, 2 );
189
  }
190
 
@@ -232,8 +232,15 @@ class Main {
232
  return $pre;
233
  }
234
 
235
- $term = '';
236
  if ( $this->is_term ) {
 
 
 
 
 
 
 
 
237
  $sql = $wpdb->prepare(
238
  "SELECT slug FROM $wpdb->terms t LEFT JOIN $wpdb->term_taxonomy tt
239
  ON t.term_id = tt.term_id
@@ -250,19 +257,12 @@ class Main {
250
  $term = $wpdb->get_var( $sql );
251
  // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
252
 
253
- // Make sure we search in the db only once being called from wp_insert_term().
254
- $this->is_term = false;
255
- }
256
-
257
- if ( ! empty( $term ) ) {
258
- return $term;
259
- }
260
-
261
- if ( $this->is_frontend || $this->is_wc_attribute_taxonomy( $title ) ) {
262
- return $title;
263
  }
264
 
265
- return $this->transliterate( $title );
266
  }
267
 
268
  /**
184
  add_filter( 'wp_insert_post_data', [ $this, 'sanitize_post_name' ], 10, 2 );
185
  add_filter( 'pre_insert_term', [ $this, 'pre_insert_term_filter' ], PHP_INT_MAX, 2 );
186
 
187
+ if ( ! $this->is_frontend || class_exists( SitePress::class ) ) {
188
  add_filter( 'get_terms_args', [ $this, 'get_terms_args_filter' ], PHP_INT_MAX, 2 );
189
  }
190
 
232
  return $pre;
233
  }
234
 
 
235
  if ( $this->is_term ) {
236
+ // Make sure we search in the db only once being called from wp_insert_term().
237
+ $this->is_term = false;
238
+
239
+ // Fix case when showing previously created categories in cyrillic with WPML.
240
+ if ( $this->is_frontend && class_exists( SitePress::class ) ) {
241
+ return $title;
242
+ }
243
+
244
  $sql = $wpdb->prepare(
245
  "SELECT slug FROM $wpdb->terms t LEFT JOIN $wpdb->term_taxonomy tt
246
  ON t.term_id = tt.term_id
257
  $term = $wpdb->get_var( $sql );
258
  // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
259
 
260
+ if ( ! empty( $term ) ) {
261
+ return $term;
262
+ }
 
 
 
 
 
 
 
263
  }
264
 
265
+ return $this->is_wc_attribute_taxonomy( $title ) ? $title : $this->transliterate( $title );
266
  }
267
 
268
  /**
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48', '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\ComposerStaticInit00ef77ab4166736d044274bb205dcf48::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit00ef77ab4166736d044274bb205dcf48
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit00ef77ab4166736d044274bb205dcf48::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire00ef77ab4166736d044274bb205dcf48($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire00ef77ab4166736d044274bb205dcf48($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 ComposerAutoloaderInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c', '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\ComposerStaticInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c::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\ComposerStaticInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire3b59ba97ccebc4eb76c9a6aa0f0c9a1c($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire3b59ba97ccebc4eb76c9a6aa0f0c9a1c($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 ComposerStaticInit00ef77ab4166736d044274bb205dcf48
8
  {
9
  public static $files = array (
10
  '344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
@@ -37,7 +37,7 @@ class ComposerStaticInit00ef77ab4166736d044274bb205dcf48
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
- $loader->classMap = ComposerStaticInit00ef77ab4166736d044274bb205dcf48::$classMap;
41
 
42
  }, null, ClassLoader::class);
43
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c
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 = ComposerStaticInit3b59ba97ccebc4eb76c9a6aa0f0c9a1c::$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.5',
4
- 'version' => '5.2.5.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'a25a9d6abd5d90c32f3bb1c8d01e0e8a44c3b0e3',
9
  'name' => 'mihdan/cyr2lat',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
- 'pretty_version' => '5.2.5',
15
- 'version' => '5.2.5.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => 'a25a9d6abd5d90c32f3bb1c8d01e0e8a44c3b0e3',
20
  'dev_requirement' => false,
21
  ),
22
  ),
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => '5.2.6',
4
+ 'version' => '5.2.6.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '461a4b632baf61dce66e8f300cea7b242f55269a',
9
  'name' => 'mihdan/cyr2lat',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
+ 'pretty_version' => '5.2.6',
15
+ 'version' => '5.2.6.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => '461a4b632baf61dce66e8f300cea7b242f55269a',
20
  'dev_requirement' => false,
21
  ),
22
  ),