Version Description
(21.02.2021) = * Fix bug with attachment post type filtered by 'ctl_post_types' * Fix bug with background conversion of product attribute terms
Download this release
Release Info
Developer | mihdan |
Plugin | Cyr-To-Lat |
Version | 4.6.3 |
Comparing to | |
See all releases |
Code changes from version 4.6.2 to 4.6.3
- classes/class-converter.php +8 -5
- classes/class-main.php +2 -0
- cyr-to-lat.php +3 -3
- readme.txt +82 -3
- vendor/autoload.php +1 -1
- vendor/composer/InstalledVersions.php +6 -6
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
- vendor/composer/installed.php +6 -6
classes/class-converter.php
CHANGED
@@ -187,13 +187,16 @@ class Converter {
|
|
187 |
|
188 |
$regexp = $wpdb->prepare( '%s', self::ALLOWED_CHARS_REGEX );
|
189 |
|
190 |
-
$post_sql
|
191 |
'post_status IN (' . $this->main->prepare_in( $parsed_args['post_status'] ) . ')' .
|
192 |
' AND post_type IN (' . $this->main->prepare_in( $parsed_args['post_type'] ) . ')';
|
193 |
-
$media_sql = "post_status = 'inherit' AND post_type = 'attachment'";
|
194 |
-
$all_posts_sql = '(' . $post_sql . ') OR (' . $media_sql . ')';
|
195 |
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
199 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
@@ -232,7 +235,7 @@ class Converter {
|
|
232 |
$terms = $wpdb->get_results(
|
233 |
$wpdb->prepare(
|
234 |
"SELECT t.term_id, slug, tt.taxonomy, tt.term_taxonomy_id FROM $wpdb->terms t, $wpdb->term_taxonomy tt
|
235 |
-
WHERE LOWER(t.slug) NOT REGEXP(%s) AND tt.term_id = t.term_id",
|
236 |
self::ALLOWED_CHARS_REGEX
|
237 |
)
|
238 |
);
|
187 |
|
188 |
$regexp = $wpdb->prepare( '%s', self::ALLOWED_CHARS_REGEX );
|
189 |
|
190 |
+
$post_sql =
|
191 |
'post_status IN (' . $this->main->prepare_in( $parsed_args['post_status'] ) . ')' .
|
192 |
' AND post_type IN (' . $this->main->prepare_in( $parsed_args['post_type'] ) . ')';
|
|
|
|
|
193 |
|
194 |
+
if ( isset( $parsed_args['post_type']['attachment'] ) ) {
|
195 |
+
$media_sql = "post_status = 'inherit' AND post_type = 'attachment'";
|
196 |
+
$post_sql = '(' . $post_sql . ') OR (' . $media_sql . ')';
|
197 |
+
}
|
198 |
+
|
199 |
+
$sql = "SELECT ID, post_name, post_type FROM $wpdb->posts WHERE LOWER(post_name) NOT REGEXP($regexp) AND ($post_sql)";
|
200 |
|
201 |
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
202 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
235 |
$terms = $wpdb->get_results(
|
236 |
$wpdb->prepare(
|
237 |
"SELECT t.term_id, slug, tt.taxonomy, tt.term_taxonomy_id FROM $wpdb->terms t, $wpdb->term_taxonomy tt
|
238 |
+
WHERE LOWER(t.slug) NOT REGEXP(%s) AND tt.taxonomy NOT REGEXP ('^pa_.*$') AND tt.term_id = t.term_id",
|
239 |
self::ALLOWED_CHARS_REGEX
|
240 |
)
|
241 |
);
|
classes/class-main.php
CHANGED
@@ -196,6 +196,8 @@ class Main {
|
|
196 |
return false;
|
197 |
}
|
198 |
|
|
|
|
|
199 |
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
200 |
|
201 |
foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
|
196 |
return false;
|
197 |
}
|
198 |
|
199 |
+
$title = str_replace( 'pa_', '', $title );
|
200 |
+
|
201 |
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
202 |
|
203 |
foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
|
cyr-to-lat.php
CHANGED
@@ -9,8 +9,8 @@
|
|
9 |
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
|
10 |
* Requires at least: 5.1
|
11 |
* Tested up to: 5.6
|
12 |
-
* Version: 4.6.
|
13 |
-
* Stable tag: 4.6.
|
14 |
*
|
15 |
* Text Domain: cyr2lat
|
16 |
* Domain Path: /languages/
|
@@ -34,7 +34,7 @@ if ( defined( 'CYR_TO_LAT_VERSION' ) ) {
|
|
34 |
/**
|
35 |
* Plugin version.
|
36 |
*/
|
37 |
-
define( 'CYR_TO_LAT_VERSION', '4.6.
|
38 |
|
39 |
/**
|
40 |
* Path to the plugin dir.
|
9 |
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
|
10 |
* Requires at least: 5.1
|
11 |
* Tested up to: 5.6
|
12 |
+
* Version: 4.6.3
|
13 |
+
* Stable tag: 4.6.3
|
14 |
*
|
15 |
* Text Domain: cyr2lat
|
16 |
* Domain Path: /languages/
|
34 |
/**
|
35 |
* Plugin version.
|
36 |
*/
|
37 |
+
define( 'CYR_TO_LAT_VERSION', '4.6.3' );
|
38 |
|
39 |
/**
|
40 |
* 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.6
|
6 |
-
Stable tag: 4.6.
|
7 |
Requires PHP: 5.6.20
|
8 |
|
9 |
Converts Cyrillic characters in post, page and term slugs to Latin characters.
|
@@ -52,6 +52,7 @@ function my_ctl_table( $table ) {
|
|
52 |
|
53 |
return $table;
|
54 |
}
|
|
|
55 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
56 |
`
|
57 |
|
@@ -75,12 +76,86 @@ function my_ctl_table( $table ) {
|
|
75 |
|
76 |
return $table;
|
77 |
}
|
|
|
78 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
79 |
`
|
80 |
|
81 |
-
= How can I
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
`
|
86 |
wp cyr2lat regenerate [--post_type=<post_type>] [--post_status=<post_status>]
|
@@ -99,6 +174,10 @@ Yes you can!
|
|
99 |
|
100 |
== Changelog ==
|
101 |
|
|
|
|
|
|
|
|
|
102 |
= 4.6.2 (11.02.2021) =
|
103 |
* Fix bug with non-existing function PLL().
|
104 |
|
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.6
|
6 |
+
Stable tag: 4.6.3
|
7 |
Requires PHP: 5.6.20
|
8 |
|
9 |
Converts Cyrillic characters in post, page and term slugs to Latin characters.
|
52 |
|
53 |
return $table;
|
54 |
}
|
55 |
+
|
56 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
57 |
`
|
58 |
|
76 |
|
77 |
return $table;
|
78 |
}
|
79 |
+
|
80 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
81 |
`
|
82 |
|
83 |
+
= How can I define own transliteration of titles? =
|
84 |
+
|
85 |
+
Add similar code to your theme's `functions.php` file:
|
86 |
+
|
87 |
+
`
|
88 |
+
/**
|
89 |
+
* Filter title before sanitizing.
|
90 |
+
*
|
91 |
+
* @param string|false $result Sanitized title.
|
92 |
+
* @param string $title Title.
|
93 |
+
*
|
94 |
+
* @return string|false
|
95 |
+
*/
|
96 |
+
function my_ctl_pre_sanitize_title( $result, $title ) {
|
97 |
+
if ( 'пиво' === $title ) {
|
98 |
+
return 'beer';
|
99 |
+
}
|
100 |
+
|
101 |
+
return $result;
|
102 |
+
}
|
103 |
+
|
104 |
+
add_filter( 'ctl_pre_sanitize_title', 10, 2 );
|
105 |
+
`
|
106 |
+
|
107 |
+
= How can I define own transliteration of filenames? =
|
108 |
|
109 |
+
Add similar code to your theme's `functions.php` file:
|
110 |
+
|
111 |
+
`
|
112 |
+
/**
|
113 |
+
* Filter filename before sanitizing.
|
114 |
+
*
|
115 |
+
* @param string|false $result Sanitized filename.
|
116 |
+
* @param string $filename Title.
|
117 |
+
*
|
118 |
+
* @return string|false
|
119 |
+
*/
|
120 |
+
function my_ctl_pre_sanitize_filename( $result, $filename ) {
|
121 |
+
if ( 'пиво' === $filename ) {
|
122 |
+
return 'beer';
|
123 |
+
}
|
124 |
+
|
125 |
+
return $result;
|
126 |
+
}
|
127 |
+
|
128 |
+
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
|
129 |
+
`
|
130 |
+
|
131 |
+
= How can I limit post types for background conversion? =
|
132 |
+
|
133 |
+
Add similar code to your theme's `functions.php` file:
|
134 |
+
|
135 |
+
`
|
136 |
+
/**
|
137 |
+
* Filter post types allowed for background conversion.
|
138 |
+
*
|
139 |
+
* @param array $post_types Allowed post types.
|
140 |
+
*
|
141 |
+
* @return array
|
142 |
+
*/
|
143 |
+
function my_ctl_post_types( $post_types ) {
|
144 |
+
return [
|
145 |
+
'post' => 'post',
|
146 |
+
'page' => 'page',
|
147 |
+
'attachment' => 'attachment',
|
148 |
+
'product' => 'product',
|
149 |
+
'nav_menu_item' => 'nav_menu_item',
|
150 |
+
];
|
151 |
+
}
|
152 |
+
|
153 |
+
add_filter( 'ctl_post_types', 'my_ctl_post_types' );
|
154 |
+
`
|
155 |
+
|
156 |
+
= How can I convert many posts/terms using wp-cli? =
|
157 |
+
|
158 |
+
Use the following command in the console:
|
159 |
|
160 |
`
|
161 |
wp cyr2lat regenerate [--post_type=<post_type>] [--post_status=<post_status>]
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 4.6.3 (21.02.2021) =
|
178 |
+
* Fix bug with attachment post type filtered by 'ctl_post_types'
|
179 |
+
* Fix bug with background conversion of product attribute terms
|
180 |
+
|
181 |
= 4.6.2 (11.02.2021) =
|
182 |
* Fix bug with non-existing function PLL().
|
183 |
|
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 ComposerAutoloaderInit76c1b68253769f5eb2ea461037e5396c::getLoader();
|
vendor/composer/InstalledVersions.php
CHANGED
@@ -25,12 +25,12 @@ class InstalledVersions
|
|
25 |
private static $installed = array (
|
26 |
'root' =>
|
27 |
array (
|
28 |
-
'pretty_version' => '4.6.
|
29 |
-
'version' => '4.6.
|
30 |
'aliases' =>
|
31 |
array (
|
32 |
),
|
33 |
-
'reference' => '
|
34 |
'name' => 'mihdan/cyr2lat',
|
35 |
),
|
36 |
'versions' =>
|
@@ -46,12 +46,12 @@ private static $installed = array (
|
|
46 |
),
|
47 |
'mihdan/cyr2lat' =>
|
48 |
array (
|
49 |
-
'pretty_version' => '4.6.
|
50 |
-
'version' => '4.6.
|
51 |
'aliases' =>
|
52 |
array (
|
53 |
),
|
54 |
-
'reference' => '
|
55 |
),
|
56 |
'roundcube/plugin-installer' =>
|
57 |
array (
|
25 |
private static $installed = array (
|
26 |
'root' =>
|
27 |
array (
|
28 |
+
'pretty_version' => '4.6.3',
|
29 |
+
'version' => '4.6.3.0',
|
30 |
'aliases' =>
|
31 |
array (
|
32 |
),
|
33 |
+
'reference' => 'ce2a10f8815d84a2dda023dd8a77b476fe5d5121',
|
34 |
'name' => 'mihdan/cyr2lat',
|
35 |
),
|
36 |
'versions' =>
|
46 |
),
|
47 |
'mihdan/cyr2lat' =>
|
48 |
array (
|
49 |
+
'pretty_version' => '4.6.3',
|
50 |
+
'version' => '4.6.3.0',
|
51 |
'aliases' =>
|
52 |
array (
|
53 |
),
|
54 |
+
'reference' => 'ce2a10f8815d84a2dda023dd8a77b476fe5d5121',
|
55 |
),
|
56 |
'roundcube/plugin-installer' =>
|
57 |
array (
|
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 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit437e2a96121c77eb6fbabee43b9db9ba
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
27 |
-
spl_autoload_unregister(array('
|
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\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit437e2a96121c77eb6fbabee43b9db9ba
|
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
-
$includeFiles = Composer\Autoload\
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
-
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
function
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit76c1b68253769f5eb2ea461037e5396c
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit76c1b68253769f5eb2ea461037e5396c', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit76c1b68253769f5eb2ea461037e5396c', '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\ComposerStaticInit76c1b68253769f5eb2ea461037e5396c::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\ComposerStaticInit76c1b68253769f5eb2ea461037e5396c::$files;
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequire76c1b68253769f5eb2ea461037e5396c($fileIdentifier, $file);
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
function composerRequire76c1b68253769f5eb2ea461037e5396c($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
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
|
@@ -45,9 +45,9 @@ class ComposerStaticInit437e2a96121c77eb6fbabee43b9db9ba
|
|
45 |
public static function getInitializer(ClassLoader $loader)
|
46 |
{
|
47 |
return \Closure::bind(function () use ($loader) {
|
48 |
-
$loader->prefixLengthsPsr4 =
|
49 |
-
$loader->prefixDirsPsr4 =
|
50 |
-
$loader->classMap =
|
51 |
|
52 |
}, null, ClassLoader::class);
|
53 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit76c1b68253769f5eb2ea461037e5396c
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
|
45 |
public static function getInitializer(ClassLoader $loader)
|
46 |
{
|
47 |
return \Closure::bind(function () use ($loader) {
|
48 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit76c1b68253769f5eb2ea461037e5396c::$prefixLengthsPsr4;
|
49 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit76c1b68253769f5eb2ea461037e5396c::$prefixDirsPsr4;
|
50 |
+
$loader->classMap = ComposerStaticInit76c1b68253769f5eb2ea461037e5396c::$classMap;
|
51 |
|
52 |
}, null, ClassLoader::class);
|
53 |
}
|
vendor/composer/installed.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php return array (
|
2 |
'root' =>
|
3 |
array (
|
4 |
-
'pretty_version' => '4.6.
|
5 |
-
'version' => '4.6.
|
6 |
'aliases' =>
|
7 |
array (
|
8 |
),
|
9 |
-
'reference' => '
|
10 |
'name' => 'mihdan/cyr2lat',
|
11 |
),
|
12 |
'versions' =>
|
@@ -22,12 +22,12 @@
|
|
22 |
),
|
23 |
'mihdan/cyr2lat' =>
|
24 |
array (
|
25 |
-
'pretty_version' => '4.6.
|
26 |
-
'version' => '4.6.
|
27 |
'aliases' =>
|
28 |
array (
|
29 |
),
|
30 |
-
'reference' => '
|
31 |
),
|
32 |
'roundcube/plugin-installer' =>
|
33 |
array (
|
1 |
<?php return array (
|
2 |
'root' =>
|
3 |
array (
|
4 |
+
'pretty_version' => '4.6.3',
|
5 |
+
'version' => '4.6.3.0',
|
6 |
'aliases' =>
|
7 |
array (
|
8 |
),
|
9 |
+
'reference' => 'ce2a10f8815d84a2dda023dd8a77b476fe5d5121',
|
10 |
'name' => 'mihdan/cyr2lat',
|
11 |
),
|
12 |
'versions' =>
|
22 |
),
|
23 |
'mihdan/cyr2lat' =>
|
24 |
array (
|
25 |
+
'pretty_version' => '4.6.3',
|
26 |
+
'version' => '4.6.3.0',
|
27 |
'aliases' =>
|
28 |
array (
|
29 |
),
|
30 |
+
'reference' => 'ce2a10f8815d84a2dda023dd8a77b476fe5d5121',
|
31 |
),
|
32 |
'roundcube/plugin-installer' =>
|
33 |
array (
|