Version Description
(17.04.2021) = * Fix bug in converter without saved options
Download this release
Release Info
| Developer | mihdan |
| Plugin | |
| Version | 5.0.4 |
| Comparing to | |
| See all releases | |
Code changes from version 5.0.3 to 5.0.4
- cyr-to-lat.php +2 -2
- readme.txt +36 -38
- src/php/Settings/Abstracts/SettingsBase.php +14 -4
- src/php/Settings/Converter.php +38 -27
- src/php/Settings/Settings.php +32 -9
- src/php/class-converter.php +12 -8
- 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
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.0.
|
| 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.0.
|
| 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.0.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.0.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.7
|
| 6 |
-
Stable tag: 5.0.
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
|
| 9 |
Convert Non-Latin characters in post, page and term slugs to Latin characters.
|
|
@@ -62,22 +62,21 @@ function my_ctl_table( $table ) {
|
|
| 62 |
|
| 63 |
return $table;
|
| 64 |
}
|
| 65 |
-
|
| 66 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
| 67 |
`
|
| 68 |
|
| 69 |
-
= How can I redefine non-standard locale
|
| 70 |
|
| 71 |
For instance, if your non-standard locale is uk_UA, you can redefine it to `uk` by adding the following code to your theme's `function.php` file:
|
| 72 |
|
| 73 |
`
|
| 74 |
/**
|
| 75 |
-
* Use non-standard locale.
|
| 76 |
-
*
|
| 77 |
-
* @param string $locale Current locale.
|
| 78 |
-
*
|
| 79 |
-
* @return string
|
| 80 |
-
*/
|
| 81 |
function my_ctl_locale( $locale ) {
|
| 82 |
if ( 'uk_UA' === $locale ) {
|
| 83 |
return 'uk';
|
|
@@ -85,7 +84,6 @@ function my_ctl_locale( $locale ) {
|
|
| 85 |
|
| 86 |
return $locale;
|
| 87 |
}
|
| 88 |
-
|
| 89 |
add_filter( 'ctl_locale', 'my_ctl_locale' );
|
| 90 |
`
|
| 91 |
|
|
@@ -95,13 +93,13 @@ Add similar code to your theme's `functions.php` file:
|
|
| 95 |
|
| 96 |
`
|
| 97 |
/**
|
| 98 |
-
* Filter title before sanitizing.
|
| 99 |
-
*
|
| 100 |
-
* @param string|false $result Sanitized title.
|
| 101 |
-
* @param string $title Title.
|
| 102 |
-
*
|
| 103 |
-
* @return string|false
|
| 104 |
-
*/
|
| 105 |
function my_ctl_pre_sanitize_title( $result, $title ) {
|
| 106 |
if ( 'пиво' === $title ) {
|
| 107 |
return 'beer';
|
|
@@ -109,7 +107,6 @@ function my_ctl_pre_sanitize_title( $result, $title ) {
|
|
| 109 |
|
| 110 |
return $result;
|
| 111 |
}
|
| 112 |
-
|
| 113 |
add_filter( 'ctl_pre_sanitize_title', 10, 2 );
|
| 114 |
`
|
| 115 |
|
|
@@ -119,13 +116,13 @@ Add similar code to your theme's `functions.php` file:
|
|
| 119 |
|
| 120 |
`
|
| 121 |
/**
|
| 122 |
-
* Filter filename before sanitizing.
|
| 123 |
-
*
|
| 124 |
-
* @param string|false $result Sanitized filename.
|
| 125 |
-
* @param string $filename Title.
|
| 126 |
-
*
|
| 127 |
-
* @return string|false
|
| 128 |
-
*/
|
| 129 |
function my_ctl_pre_sanitize_filename( $result, $filename ) {
|
| 130 |
if ( 'пиво' === $filename ) {
|
| 131 |
return 'beer';
|
|
@@ -133,7 +130,6 @@ function my_ctl_pre_sanitize_filename( $result, $filename ) {
|
|
| 133 |
|
| 134 |
return $result;
|
| 135 |
}
|
| 136 |
-
|
| 137 |
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
|
| 138 |
`
|
| 139 |
|
|
@@ -143,22 +139,21 @@ Add similar code to your theme's `functions.php` file:
|
|
| 143 |
|
| 144 |
`
|
| 145 |
/**
|
| 146 |
-
* Filter post types allowed for background conversion.
|
| 147 |
-
*
|
| 148 |
-
* @param array $post_types Allowed post types.
|
| 149 |
-
*
|
| 150 |
-
* @return array
|
| 151 |
-
*/
|
| 152 |
function my_ctl_post_types( $post_types ) {
|
| 153 |
return [
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
];
|
| 160 |
}
|
| 161 |
-
|
| 162 |
add_filter( 'ctl_post_types', 'my_ctl_post_types' );
|
| 163 |
`
|
| 164 |
|
|
@@ -183,6 +178,9 @@ Yes you can!
|
|
| 183 |
|
| 184 |
== Changelog ==
|
| 185 |
|
|
|
|
|
|
|
|
|
|
| 186 |
= 5.0.3 (03.04.2021) =
|
| 187 |
* Add filter 'ctl_locale'
|
| 188 |
* Fix translation of tabs on settings pages
|
| 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.7
|
| 6 |
+
Stable tag: 5.0.4
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
|
| 9 |
Convert Non-Latin characters in post, page and term slugs to Latin characters.
|
| 62 |
|
| 63 |
return $table;
|
| 64 |
}
|
|
|
|
| 65 |
add_filter( 'ctl_table', 'my_ctl_table' );
|
| 66 |
`
|
| 67 |
|
| 68 |
+
= How can I redefine non-standard locale? =
|
| 69 |
|
| 70 |
For instance, if your non-standard locale is uk_UA, you can redefine it to `uk` by adding the following code to your theme's `function.php` file:
|
| 71 |
|
| 72 |
`
|
| 73 |
/**
|
| 74 |
+
* Use non-standard locale.
|
| 75 |
+
*
|
| 76 |
+
* @param string $locale Current locale.
|
| 77 |
+
*
|
| 78 |
+
* @return string
|
| 79 |
+
*/
|
| 80 |
function my_ctl_locale( $locale ) {
|
| 81 |
if ( 'uk_UA' === $locale ) {
|
| 82 |
return 'uk';
|
| 84 |
|
| 85 |
return $locale;
|
| 86 |
}
|
|
|
|
| 87 |
add_filter( 'ctl_locale', 'my_ctl_locale' );
|
| 88 |
`
|
| 89 |
|
| 93 |
|
| 94 |
`
|
| 95 |
/**
|
| 96 |
+
* Filter title before sanitizing.
|
| 97 |
+
*
|
| 98 |
+
* @param string|false $result Sanitized title.
|
| 99 |
+
* @param string $title Title.
|
| 100 |
+
*
|
| 101 |
+
* @return string|false
|
| 102 |
+
*/
|
| 103 |
function my_ctl_pre_sanitize_title( $result, $title ) {
|
| 104 |
if ( 'пиво' === $title ) {
|
| 105 |
return 'beer';
|
| 107 |
|
| 108 |
return $result;
|
| 109 |
}
|
|
|
|
| 110 |
add_filter( 'ctl_pre_sanitize_title', 10, 2 );
|
| 111 |
`
|
| 112 |
|
| 116 |
|
| 117 |
`
|
| 118 |
/**
|
| 119 |
+
* Filter filename before sanitizing.
|
| 120 |
+
*
|
| 121 |
+
* @param string|false $result Sanitized filename.
|
| 122 |
+
* @param string $filename Title.
|
| 123 |
+
*
|
| 124 |
+
* @return string|false
|
| 125 |
+
*/
|
| 126 |
function my_ctl_pre_sanitize_filename( $result, $filename ) {
|
| 127 |
if ( 'пиво' === $filename ) {
|
| 128 |
return 'beer';
|
| 130 |
|
| 131 |
return $result;
|
| 132 |
}
|
|
|
|
| 133 |
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
|
| 134 |
`
|
| 135 |
|
| 139 |
|
| 140 |
`
|
| 141 |
/**
|
| 142 |
+
* Filter post types allowed for background conversion.
|
| 143 |
+
*
|
| 144 |
+
* @param array $post_types Allowed post types.
|
| 145 |
+
*
|
| 146 |
+
* @return array
|
| 147 |
+
*/
|
| 148 |
function my_ctl_post_types( $post_types ) {
|
| 149 |
return [
|
| 150 |
+
'post' => 'post',
|
| 151 |
+
'page' => 'page',
|
| 152 |
+
'attachment' => 'attachment',
|
| 153 |
+
'product' => 'product',
|
| 154 |
+
'nav_menu_item' => 'nav_menu_item',
|
| 155 |
];
|
| 156 |
}
|
|
|
|
| 157 |
add_filter( 'ctl_post_types', 'my_ctl_post_types' );
|
| 158 |
`
|
| 159 |
|
| 178 |
|
| 179 |
== Changelog ==
|
| 180 |
|
| 181 |
+
= 5.0.4 (17.04.2021) =
|
| 182 |
+
* Fix bug in converter without saved options
|
| 183 |
+
|
| 184 |
= 5.0.3 (03.04.2021) =
|
| 185 |
* Add filter 'ctl_locale'
|
| 186 |
* Fix translation of tabs on settings pages
|
src/php/Settings/Abstracts/SettingsBase.php
CHANGED
|
@@ -167,9 +167,7 @@ abstract class SettingsBase {
|
|
| 167 |
add_action( 'current_screen', [ $this, 'setup_tabs_section' ], 9 );
|
| 168 |
}
|
| 169 |
|
| 170 |
-
|
| 171 |
-
$this->init();
|
| 172 |
-
}
|
| 173 |
}
|
| 174 |
|
| 175 |
/**
|
|
@@ -178,7 +176,10 @@ abstract class SettingsBase {
|
|
| 178 |
public function init() {
|
| 179 |
$this->init_form_fields();
|
| 180 |
$this->init_settings();
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
| 182 |
}
|
| 183 |
|
| 184 |
/**
|
|
@@ -456,6 +457,15 @@ abstract class SettingsBase {
|
|
| 456 |
return strtolower( $tab->get_class_name() ) === $current_tab_name;
|
| 457 |
}
|
| 458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
/**
|
| 460 |
* Get active tab.
|
| 461 |
*
|
| 167 |
add_action( 'current_screen', [ $this, 'setup_tabs_section' ], 9 );
|
| 168 |
}
|
| 169 |
|
| 170 |
+
$this->init();
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
|
| 173 |
/**
|
| 176 |
public function init() {
|
| 177 |
$this->init_form_fields();
|
| 178 |
$this->init_settings();
|
| 179 |
+
|
| 180 |
+
if ( $this->is_tab_active( $this ) ) {
|
| 181 |
+
$this->init_hooks();
|
| 182 |
+
}
|
| 183 |
}
|
| 184 |
|
| 185 |
/**
|
| 457 |
return strtolower( $tab->get_class_name() ) === $current_tab_name;
|
| 458 |
}
|
| 459 |
|
| 460 |
+
/**
|
| 461 |
+
* Get tabs.
|
| 462 |
+
*
|
| 463 |
+
* @return array|null
|
| 464 |
+
*/
|
| 465 |
+
public function get_tabs() {
|
| 466 |
+
return $this->tabs;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
/**
|
| 470 |
* Get active tab.
|
| 471 |
*
|
src/php/Settings/Converter.php
CHANGED
|
@@ -111,36 +111,12 @@ class Converter extends PluginSettingsBase {
|
|
| 111 |
*/
|
| 112 |
public function init_form_fields() {
|
| 113 |
$this->form_fields = [];
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/**
|
| 117 |
-
* Empty method. Do stuff in the delayed_init_settings.
|
| 118 |
-
*/
|
| 119 |
-
public function init_settings() {
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
/**
|
| 123 |
-
* Get convertible post types.
|
| 124 |
-
*
|
| 125 |
-
* @return array
|
| 126 |
-
*/
|
| 127 |
-
public static function get_convertible_post_types() {
|
| 128 |
-
$post_types = get_post_types( [ 'public' => true ] );
|
| 129 |
|
| 130 |
-
return array_merge( $post_types, [ 'nav_menu_item' => 'nav_menu_item' ] );
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
/**
|
| 134 |
-
* Init form fields.
|
| 135 |
-
*/
|
| 136 |
-
public function delayed_init_form_fields() {
|
| 137 |
$default_post_types = [ 'post', 'page', 'nav_menu_item' ];
|
| 138 |
|
| 139 |
-
$post_types =
|
| 140 |
-
|
| 141 |
-
$filtered_post_types = apply_filters( 'ctl_post_types', $post_types );
|
| 142 |
|
| 143 |
-
$
|
| 144 |
|
| 145 |
$this->form_fields['background_post_types'] = [
|
| 146 |
'label' => __( 'Post Types', 'cyr2lat' ),
|
|
@@ -158,7 +134,8 @@ class Converter extends PluginSettingsBase {
|
|
| 158 |
$this->form_fields['background_post_types']['options'][ $post_type ] = $label;
|
| 159 |
}
|
| 160 |
|
| 161 |
-
$this->form_fields['background_post_types']['default']
|
|
|
|
| 162 |
$this->form_fields['background_post_types']['disabled'] = array_diff( $default_post_types, $filtered_post_types );
|
| 163 |
|
| 164 |
$default_post_statuses = [ 'publish', 'future', 'private' ];
|
|
@@ -183,6 +160,40 @@ class Converter extends PluginSettingsBase {
|
|
| 183 |
$this->form_fields['background_post_statuses']['default'] = $default_post_statuses;
|
| 184 |
}
|
| 185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
/**
|
| 187 |
* Init form fields and settings late, on 'init' hook with PHP_INT_MAX priority,
|
| 188 |
* to allow all plugins to register post types.
|
| 111 |
*/
|
| 112 |
public function init_form_fields() {
|
| 113 |
$this->form_fields = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
$default_post_types = [ 'post', 'page', 'nav_menu_item' ];
|
| 116 |
|
| 117 |
+
$post_types = $default_post_types;
|
|
|
|
|
|
|
| 118 |
|
| 119 |
+
$filtered_post_types = array_filter( (array) apply_filters( 'ctl_post_types', $post_types ) );
|
| 120 |
|
| 121 |
$this->form_fields['background_post_types'] = [
|
| 122 |
'label' => __( 'Post Types', 'cyr2lat' ),
|
| 134 |
$this->form_fields['background_post_types']['options'][ $post_type ] = $label;
|
| 135 |
}
|
| 136 |
|
| 137 |
+
$this->form_fields['background_post_types']['default'] = $default_post_types;
|
| 138 |
+
// @todo Mark as disabled.
|
| 139 |
$this->form_fields['background_post_types']['disabled'] = array_diff( $default_post_types, $filtered_post_types );
|
| 140 |
|
| 141 |
$default_post_statuses = [ 'publish', 'future', 'private' ];
|
| 160 |
$this->form_fields['background_post_statuses']['default'] = $default_post_statuses;
|
| 161 |
}
|
| 162 |
|
| 163 |
+
/**
|
| 164 |
+
* Get convertible post types.
|
| 165 |
+
*
|
| 166 |
+
* @return array
|
| 167 |
+
*/
|
| 168 |
+
public static function get_convertible_post_types() {
|
| 169 |
+
$post_types = get_post_types( [ 'public' => true ] );
|
| 170 |
+
|
| 171 |
+
return array_merge( $post_types, [ 'nav_menu_item' => 'nav_menu_item' ] );
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Init form fields.
|
| 176 |
+
*/
|
| 177 |
+
public function delayed_init_form_fields() {
|
| 178 |
+
$post_types = self::get_convertible_post_types();
|
| 179 |
+
|
| 180 |
+
$filtered_post_types = array_filter( (array) apply_filters( 'ctl_post_types', $post_types ) );
|
| 181 |
+
|
| 182 |
+
$this->form_fields['background_post_types']['options'] = [];
|
| 183 |
+
|
| 184 |
+
foreach ( $post_types as $post_type ) {
|
| 185 |
+
$label = $post_type;
|
| 186 |
+
|
| 187 |
+
$this->form_fields['background_post_types']['options'][ $post_type ] = $label;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
// @todo Mark as disabled.
|
| 191 |
+
$this->form_fields['background_post_types']['disabled'] = array_diff(
|
| 192 |
+
$this->form_fields['background_post_types']['default'],
|
| 193 |
+
$filtered_post_types
|
| 194 |
+
);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
/**
|
| 198 |
* Init form fields and settings late, on 'init' hook with PHP_INT_MAX priority,
|
| 199 |
* to allow all plugins to register post types.
|
src/php/Settings/Settings.php
CHANGED
|
@@ -90,16 +90,39 @@ class Settings implements SettingsInterface {
|
|
| 90 |
* @return string|array The value specified for the option or a default value for the option.
|
| 91 |
*/
|
| 92 |
public function get( $key, $empty_value = null ) {
|
| 93 |
-
|
| 94 |
-
}
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
/**
|
| 90 |
* @return string|array The value specified for the option or a default value for the option.
|
| 91 |
*/
|
| 92 |
public function get( $key, $empty_value = null ) {
|
| 93 |
+
$value = '';
|
|
|
|
| 94 |
|
| 95 |
+
foreach ( $this->menu_pages as $menu_page ) {
|
| 96 |
+
/**
|
| 97 |
+
* Menu page.
|
| 98 |
+
*
|
| 99 |
+
* @var SettingsBase $menu_page
|
| 100 |
+
*/
|
| 101 |
+
$value = $menu_page->get( $key, $empty_value );
|
| 102 |
+
if ( ! empty( $value ) ) {
|
| 103 |
+
break;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
$tabs = $menu_page->get_tabs();
|
| 107 |
+
|
| 108 |
+
foreach ( $tabs as $tab ) {
|
| 109 |
+
/**
|
| 110 |
+
* Tab.
|
| 111 |
+
*
|
| 112 |
+
* @var SettingsBase $tab
|
| 113 |
+
*/
|
| 114 |
+
$value = $tab->get( $key, $empty_value );
|
| 115 |
+
if ( ! empty( $value ) ) {
|
| 116 |
+
break 2;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
if ( '' === $value && ! is_null( $empty_value ) ) {
|
| 122 |
+
$value = $empty_value;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
return $value;
|
| 126 |
}
|
| 127 |
|
| 128 |
/**
|
src/php/class-converter.php
CHANGED
|
@@ -179,12 +179,12 @@ class Converter {
|
|
| 179 |
|
| 180 |
$post_types = array_intersect(
|
| 181 |
\Cyr_To_Lat\Settings\Converter::get_convertible_post_types(),
|
| 182 |
-
$this->settings->get( 'background_post_types' )
|
| 183 |
);
|
| 184 |
-
$post_statuses = $this->settings->get( 'background_post_statuses' );
|
| 185 |
|
| 186 |
$defaults = [
|
| 187 |
-
'post_type' => apply_filters( 'ctl_post_types', $post_types ),
|
| 188 |
'post_status' => $post_statuses,
|
| 189 |
];
|
| 190 |
|
|
@@ -192,16 +192,20 @@ class Converter {
|
|
| 192 |
|
| 193 |
$regexp = $wpdb->prepare( '%s', self::ALLOWED_CHARS_REGEX );
|
| 194 |
|
| 195 |
-
$
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
if ( in_array( 'attachment', $parsed_args['post_type'], true ) ) {
|
| 200 |
$media_sql = "post_status = 'inherit' AND post_type = 'attachment'";
|
| 201 |
-
$post_sql = '(' . $
|
| 202 |
}
|
| 203 |
|
| 204 |
-
$sql = "SELECT ID, post_name, post_type FROM $wpdb->posts WHERE LOWER(post_name) NOT REGEXP($regexp)
|
| 205 |
|
| 206 |
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
| 207 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
| 179 |
|
| 180 |
$post_types = array_intersect(
|
| 181 |
\Cyr_To_Lat\Settings\Converter::get_convertible_post_types(),
|
| 182 |
+
array_filter( (array) $this->settings->get( 'background_post_types' ) )
|
| 183 |
);
|
| 184 |
+
$post_statuses = array_filter( (array) $this->settings->get( 'background_post_statuses' ) );
|
| 185 |
|
| 186 |
$defaults = [
|
| 187 |
+
'post_type' => array_filter( (array) apply_filters( 'ctl_post_types', $post_types ) ),
|
| 188 |
'post_status' => $post_statuses,
|
| 189 |
];
|
| 190 |
|
| 192 |
|
| 193 |
$regexp = $wpdb->prepare( '%s', self::ALLOWED_CHARS_REGEX );
|
| 194 |
|
| 195 |
+
$post_status_in = $this->main->prepare_in( $parsed_args['post_status'] );
|
| 196 |
+
$post_status_in = $post_status_in ? 'post_status IN (' . $post_status_in . ')' : '';
|
| 197 |
+
$post_type_in = $this->main->prepare_in( $parsed_args['post_type'] );
|
| 198 |
+
$post_type_in = $post_type_in ? 'post_type IN (' . $post_type_in . ')' : '';
|
| 199 |
+
$and = $post_status_in && $post_type_in ? ' AND ' : '';
|
| 200 |
+
$post_sql = $post_status_in . $and . $post_type_in;
|
| 201 |
+
$post_sql = $post_sql ? 'AND (' . $post_sql . ')' : '';
|
| 202 |
|
| 203 |
if ( in_array( 'attachment', $parsed_args['post_type'], true ) ) {
|
| 204 |
$media_sql = "post_status = 'inherit' AND post_type = 'attachment'";
|
| 205 |
+
$post_sql = $post_sql ? $post_sql . ' OR (' . $media_sql . ')' : 'AND (' . $media_sql . ')';
|
| 206 |
}
|
| 207 |
|
| 208 |
+
$sql = "SELECT ID, post_name, post_type FROM $wpdb->posts WHERE LOWER(post_name) NOT REGEXP($regexp) $post_sql";
|
| 209 |
|
| 210 |
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
| 211 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
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 ComposerAutoloaderInit0c6bffce0ae3be551c79741eef762d0b::getLoader();
|
vendor/composer/InstalledVersions.php
CHANGED
|
@@ -25,12 +25,12 @@ class InstalledVersions
|
|
| 25 |
private static $installed = array (
|
| 26 |
'root' =>
|
| 27 |
array (
|
| 28 |
-
'pretty_version' => '5.0.
|
| 29 |
-
'version' => '5.0.
|
| 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' => '5.0.
|
| 50 |
-
'version' => '5.0.
|
| 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' => '5.0.4',
|
| 29 |
+
'version' => '5.0.4.0',
|
| 30 |
'aliases' =>
|
| 31 |
array (
|
| 32 |
),
|
| 33 |
+
'reference' => 'b8b728c89d6ca99f07f0f3d2777adcd46a6f629a',
|
| 34 |
'name' => 'mihdan/cyr2lat',
|
| 35 |
),
|
| 36 |
'versions' =>
|
| 46 |
),
|
| 47 |
'mihdan/cyr2lat' =>
|
| 48 |
array (
|
| 49 |
+
'pretty_version' => '5.0.4',
|
| 50 |
+
'version' => '5.0.4.0',
|
| 51 |
'aliases' =>
|
| 52 |
array (
|
| 53 |
),
|
| 54 |
+
'reference' => 'b8b728c89d6ca99f07f0f3d2777adcd46a6f629a',
|
| 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 ComposerAutoloaderInit33e8bee773e45737380b52bc3231ec4b
|
|
| 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 ComposerAutoloaderInit33e8bee773e45737380b52bc3231ec4b
|
|
| 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 ComposerAutoloaderInit0c6bffce0ae3be551c79741eef762d0b
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
| 22 |
return self::$loader;
|
| 23 |
}
|
| 24 |
|
| 25 |
+
spl_autoload_register(array('ComposerAutoloaderInit0c6bffce0ae3be551c79741eef762d0b', 'loadClassLoader'), true, true);
|
| 26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
| 27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit0c6bffce0ae3be551c79741eef762d0b', '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\ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b::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\ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b::$files;
|
| 55 |
} else {
|
| 56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
| 57 |
}
|
| 58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
| 59 |
+
composerRequire0c6bffce0ae3be551c79741eef762d0b($fileIdentifier, $file);
|
| 60 |
}
|
| 61 |
|
| 62 |
return $loader;
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
| 66 |
+
function composerRequire0c6bffce0ae3be551c79741eef762d0b($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',
|
|
@@ -50,9 +50,9 @@ class ComposerStaticInit33e8bee773e45737380b52bc3231ec4b
|
|
| 50 |
public static function getInitializer(ClassLoader $loader)
|
| 51 |
{
|
| 52 |
return \Closure::bind(function () use ($loader) {
|
| 53 |
-
$loader->prefixLengthsPsr4 =
|
| 54 |
-
$loader->prefixDirsPsr4 =
|
| 55 |
-
$loader->classMap =
|
| 56 |
|
| 57 |
}, null, ClassLoader::class);
|
| 58 |
}
|
| 4 |
|
| 5 |
namespace Composer\Autoload;
|
| 6 |
|
| 7 |
+
class ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b
|
| 8 |
{
|
| 9 |
public static $files = array (
|
| 10 |
'344a0f93a05b8ca362c22e39586db500' => __DIR__ . '/../..' . '/lib/polyfill-mbstring/bootstrap.php',
|
| 50 |
public static function getInitializer(ClassLoader $loader)
|
| 51 |
{
|
| 52 |
return \Closure::bind(function () use ($loader) {
|
| 53 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b::$prefixLengthsPsr4;
|
| 54 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b::$prefixDirsPsr4;
|
| 55 |
+
$loader->classMap = ComposerStaticInit0c6bffce0ae3be551c79741eef762d0b::$classMap;
|
| 56 |
|
| 57 |
}, null, ClassLoader::class);
|
| 58 |
}
|
vendor/composer/installed.php
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
<?php return array (
|
| 2 |
'root' =>
|
| 3 |
array (
|
| 4 |
-
'pretty_version' => '5.0.
|
| 5 |
-
'version' => '5.0.
|
| 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' => '5.0.
|
| 26 |
-
'version' => '5.0.
|
| 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' => '5.0.4',
|
| 5 |
+
'version' => '5.0.4.0',
|
| 6 |
'aliases' =>
|
| 7 |
array (
|
| 8 |
),
|
| 9 |
+
'reference' => 'b8b728c89d6ca99f07f0f3d2777adcd46a6f629a',
|
| 10 |
'name' => 'mihdan/cyr2lat',
|
| 11 |
),
|
| 12 |
'versions' =>
|
| 22 |
),
|
| 23 |
'mihdan/cyr2lat' =>
|
| 24 |
array (
|
| 25 |
+
'pretty_version' => '5.0.4',
|
| 26 |
+
'version' => '5.0.4.0',
|
| 27 |
'aliases' =>
|
| 28 |
array (
|
| 29 |
),
|
| 30 |
+
'reference' => 'b8b728c89d6ca99f07f0f3d2777adcd46a6f629a',
|
| 31 |
),
|
| 32 |
'roundcube/plugin-installer' =>
|
| 33 |
array (
|
