Cyr-To-Lat - Version 5.4.0

Version Description

(15.12.2022) = * Tested with WordPress 6.1 and WooCommerce 7.2. * Added compatibility with WC High-Performance order storage (COT) feature.

Download this release

Release Info

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

Code changes from version 5.3.0 to 5.4.0

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.3.0
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
@@ -22,7 +22,7 @@
22
  *
23
  *
24
  * WC requires at least: 3.0
25
- * WC tested up to: 6.5
26
  */
27
 
28
  namespace Cyr_To_Lat;
@@ -40,7 +40,7 @@ if ( defined( 'CYR_TO_LAT_VERSION' ) ) {
40
  /**
41
  * Plugin version.
42
  */
43
- define( 'CYR_TO_LAT_VERSION', '5.3.0' );
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.4.0
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6.20
16
  * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
22
  *
23
  *
24
  * WC requires at least: 3.0
25
+ * WC tested up to: 7.2
26
  */
27
 
28
  namespace Cyr_To_Lat;
40
  /**
41
  * Plugin version.
42
  */
43
+ define( 'CYR_TO_LAT_VERSION', '5.4.0' );
44
 
45
  /**
46
  * Path to the plugin dir.
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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: 6.0
6
- Stable tag: 5.3.0
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -194,6 +194,10 @@ Yes you can!
194
 
195
  == Changelog ==
196
 
 
 
 
 
197
  = 5.3.0 (23.05.2022) =
198
  * Tested with WordPress 6.0 and WooCommerce 6.5.
199
 
2
  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: 6.1
6
+ Stable tag: 5.4.0
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
194
 
195
  == Changelog ==
196
 
197
+ = 5.4.0 (15.12.2022) =
198
+ * Tested with WordPress 6.1 and WooCommerce 7.2.
199
+ * Added compatibility with WC High-Performance order storage (COT) feature.
200
+
201
  = 5.3.0 (23.05.2022) =
202
  * Tested with WordPress 6.0 and WooCommerce 6.5.
203
 
src/php/Settings/Abstracts/SettingsBase.php CHANGED
@@ -378,6 +378,10 @@ abstract class SettingsBase {
378
  * Setup settings sections.
379
  */
380
  public function setup_sections() {
 
 
 
 
381
  $tab = $this->get_active_tab();
382
 
383
  foreach ( $this->form_fields as $form_field ) {
@@ -395,12 +399,7 @@ abstract class SettingsBase {
395
  * Setup tabs section.
396
  */
397
  public function setup_tabs_section() {
398
- /**
399
- * Protection from the bug in \Automattic\Jetpack\Sync\Sender::get_items_to_send(),
400
- * which sets screen without loading of wp-admin/includes/template.php,
401
- * where add_settings_section() is defined.
402
- */
403
- if ( ! function_exists( 'add_settings_section' ) ) {
404
  return;
405
  }
406
 
378
  * Setup settings sections.
379
  */
380
  public function setup_sections() {
381
+ if ( ! $this->is_options_screen() ) {
382
+ return;
383
+ }
384
+
385
  $tab = $this->get_active_tab();
386
 
387
  foreach ( $this->form_fields as $form_field ) {
399
  * Setup tabs section.
400
  */
401
  public function setup_tabs_section() {
402
+ if ( ! $this->is_options_screen() ) {
 
 
 
 
 
403
  return;
404
  }
405
 
src/php/Settings/Tables.php CHANGED
@@ -24,7 +24,7 @@ class Tables extends PluginSettingsBase {
24
  /**
25
  * Script localization object.
26
  */
27
- const OBJECT = ' Cyr2LatTablesObject';
28
 
29
  /**
30
  * Served locales.
@@ -207,7 +207,7 @@ class Tables extends PluginSettingsBase {
207
  </h2>
208
  <a
209
  target="_blank"
210
- href="https://wordpress.org/support/view/plugin-reviews/cyr2lat?rate=5#postform">
211
  <?php echo esc_html( __( 'Leave a ★★★★★ plugin review on WordPress.org', 'cyr2lat' ) ); ?>
212
  </a>
213
  </div>
24
  /**
25
  * Script localization object.
26
  */
27
+ const OBJECT = 'Cyr2LatTablesObject';
28
 
29
  /**
30
  * Served locales.
207
  </h2>
208
  <a
209
  target="_blank"
210
+ href="https://wordpress.org/support/view/plugin-reviews/cyr2lat?rate=5#new-post">
211
  <?php echo esc_html( __( 'Leave a ★★★★★ plugin review on WordPress.org', 'cyr2lat' ) ); ?>
212
  </a>
213
  </div>
src/php/class-main.php CHANGED
@@ -6,11 +6,13 @@
6
  */
7
 
8
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
 
9
  /** @noinspection PhpUndefinedClassInspection */
10
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
11
 
12
  namespace Cyr_To_Lat;
13
 
 
14
  use Polylang;
15
  use SitePress;
16
  use WP_Error;
@@ -201,6 +203,8 @@ class Main {
201
 
202
  add_action( 'wpml_language_has_switched', [ $this, 'wpml_language_has_switched' ], 10, 3 );
203
  }
 
 
204
  }
205
 
206
  /**
@@ -674,6 +678,21 @@ class Main {
674
  null;
675
  }
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  /**
678
  * Changes array of items into string of items, separated by comma and sql-escaped
679
  *
6
  */
7
 
8
  // phpcs:disable Generic.Commenting.DocComment.MissingShort
9
+ /** @noinspection PhpUndefinedNamespaceInspection */
10
  /** @noinspection PhpUndefinedClassInspection */
11
  // phpcs:enable Generic.Commenting.DocComment.MissingShort
12
 
13
  namespace Cyr_To_Lat;
14
 
15
+ use Automattic\WooCommerce\Utilities\FeaturesUtil;
16
  use Polylang;
17
  use SitePress;
18
  use WP_Error;
203
 
204
  add_action( 'wpml_language_has_switched', [ $this, 'wpml_language_has_switched' ], 10, 3 );
205
  }
206
+
207
+ add_action( 'before_woocommerce_init', [ $this, 'declare_wc_compatibility' ] );
208
  }
209
 
210
  /**
678
  null;
679
  }
680
 
681
+ /**
682
+ * Declare compatibility with custom order tables for WooCommerce.
683
+ *
684
+ * @return void
685
+ */
686
+ public function declare_wc_compatibility() {
687
+ if ( class_exists( FeaturesUtil::class ) ) {
688
+ FeaturesUtil::declare_compatibility(
689
+ 'custom_order_tables',
690
+ constant( 'CYR_TO_LAT_FILE' ),
691
+ true
692
+ );
693
+ }
694
+ }
695
+
696
  /**
697
  * Changes array of items into string of items, separated by comma and sql-escaped
698
  *
vendor/autoload.php CHANGED
@@ -3,10 +3,23 @@
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
- echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
- exit(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4::getLoader();
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
+ if (!headers_sent()) {
7
+ header('HTTP/1.1 500 Internal Server Error');
8
+ }
9
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
+ if (!ini_get('display_errors')) {
11
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
+ fwrite(STDERR, $err);
13
+ } elseif (!headers_sent()) {
14
+ echo $err;
15
+ }
16
+ }
17
+ trigger_error(
18
+ $err,
19
+ E_USER_ERROR
20
+ );
21
  }
22
 
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
 
25
+ return ComposerAutoloaderInit579f4726ad613eb0109dd44a8e9fdb01::getLoader();
vendor/composer/InstalledVersions.php CHANGED
@@ -28,7 +28,7 @@ class InstalledVersions
28
  {
29
  /**
30
  * @var mixed[]|null
31
- * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
32
  */
33
  private static $installed;
34
 
@@ -39,7 +39,7 @@ class InstalledVersions
39
 
40
  /**
41
  * @var array[]
42
- * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
@@ -243,7 +243,7 @@ class InstalledVersions
243
 
244
  /**
245
  * @return array
246
- * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
247
  */
248
  public static function getRootPackage()
249
  {
@@ -257,7 +257,7 @@ class InstalledVersions
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
- * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
261
  */
262
  public static function getRawData()
263
  {
@@ -280,7 +280,7 @@ class InstalledVersions
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
- * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
284
  */
285
  public static function getAllRawData()
286
  {
@@ -303,7 +303,7 @@ class InstalledVersions
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
- * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
307
  */
308
  public static function reload($data)
309
  {
@@ -313,7 +313,7 @@ class InstalledVersions
313
 
314
  /**
315
  * @return array[]
316
- * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
317
  */
318
  private static function getInstalled()
319
  {
28
  {
29
  /**
30
  * @var mixed[]|null
31
+ * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
32
  */
33
  private static $installed;
34
 
39
 
40
  /**
41
  * @var array[]
42
+ * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
243
 
244
  /**
245
  * @return array
246
+ * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247
  */
248
  public static function getRootPackage()
249
  {
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
+ * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
261
  */
262
  public static function getRawData()
263
  {
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
+ * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
284
  */
285
  public static function getAllRawData()
286
  {
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
+ * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
307
  */
308
  public static function reload($data)
309
  {
313
 
314
  /**
315
  * @return array[]
316
+ * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
317
  */
318
  private static function getInstalled()
319
  {
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4
6
  {
7
  private static $loader;
8
 
@@ -22,18 +22,18 @@ class ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit0714ade671e040cd271d9ffc07e5f3a4::getInitializer($loader));
31
 
32
  $loader->register(true);
33
 
34
- $includeFiles = \Composer\Autoload\ComposerStaticInit0714ade671e040cd271d9ffc07e5f3a4::$files;
35
  foreach ($includeFiles as $fileIdentifier => $file) {
36
- composerRequire0714ade671e040cd271d9ffc07e5f3a4($fileIdentifier, $file);
37
  }
38
 
39
  return $loader;
@@ -45,7 +45,7 @@ class ComposerAutoloaderInit0714ade671e040cd271d9ffc07e5f3a4
45
  * @param string $file
46
  * @return void
47
  */
48
- function composerRequire0714ade671e040cd271d9ffc07e5f3a4($fileIdentifier, $file)
49
  {
50
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
51
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit579f4726ad613eb0109dd44a8e9fdb01
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit579f4726ad613eb0109dd44a8e9fdb01', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit579f4726ad613eb0109dd44a8e9fdb01', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit579f4726ad613eb0109dd44a8e9fdb01::getInitializer($loader));
31
 
32
  $loader->register(true);
33
 
34
+ $includeFiles = \Composer\Autoload\ComposerStaticInit579f4726ad613eb0109dd44a8e9fdb01::$files;
35
  foreach ($includeFiles as $fileIdentifier => $file) {
36
+ composerRequire579f4726ad613eb0109dd44a8e9fdb01($fileIdentifier, $file);
37
  }
38
 
39
  return $loader;
45
  * @param string $file
46
  * @return void
47
  */
48
+ function composerRequire579f4726ad613eb0109dd44a8e9fdb01($fileIdentifier, $file)
49
  {
50
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
51
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit0714ade671e040cd271d9ffc07e5f3a4
8
  {
9
  public static $files = array (
10
  '344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
@@ -37,7 +37,7 @@ class ComposerStaticInit0714ade671e040cd271d9ffc07e5f3a4
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
- $loader->classMap = ComposerStaticInit0714ade671e040cd271d9ffc07e5f3a4::$classMap;
41
 
42
  }, null, ClassLoader::class);
43
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit579f4726ad613eb0109dd44a8e9fdb01
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 = ComposerStaticInit579f4726ad613eb0109dd44a8e9fdb01::$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.3.0',
4
- 'version' => '5.3.0.0',
 
 
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => '5753831154667bde5b997318a06d63d3f37517ef',
9
- 'name' => 'mihdan/cyr2lat',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
- 'pretty_version' => '5.3.0',
15
- 'version' => '5.3.0.0',
 
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => '5753831154667bde5b997318a06d63d3f37517ef',
20
  'dev_requirement' => false,
21
  ),
22
  ),
1
  <?php return array(
2
  'root' => array(
3
+ 'name' => 'mihdan/cyr2lat',
4
+ 'pretty_version' => '5.4.0',
5
+ 'version' => '5.4.0.0',
6
+ 'reference' => '950f0e4e2317d2781524cecad0c54c2a2cc5999c',
7
  'type' => 'wordpress-plugin',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
 
 
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'mihdan/cyr2lat' => array(
14
+ 'pretty_version' => '5.4.0',
15
+ 'version' => '5.4.0.0',
16
+ 'reference' => '950f0e4e2317d2781524cecad0c54c2a2cc5999c',
17
  'type' => 'wordpress-plugin',
18
  'install_path' => __DIR__ . '/../../',
19
  'aliases' => array(),
 
20
  'dev_requirement' => false,
21
  ),
22
  ),