Version Description
(28.03.2020) = * Tested up to WordPress 5.4 * Fixed bug with disappearing of WooCommerce attributes
Download this release
Release Info
Developer | mihdan |
Plugin | Cyr-To-Lat |
Version | 4.3.5 |
Comparing to | |
See all releases |
Code changes from version 4.3.4 to 4.3.5
- classes/background-processes/class-conversion-process.php +4 -3
- classes/background-processes/class-post-conversion-process.php +3 -1
- classes/background-processes/class-term-conversion-process.php +3 -1
- classes/class-acf.php +2 -2
- classes/class-converter.php +6 -20
- classes/class-main.php +62 -30
- classes/class-requirements.php +9 -15
- classes/class-settings.php +6 -6
- classes/class-wp-cli.php +1 -1
- cyr-to-lat.php +46 -69
- readme.txt +6 -2
classes/background-processes/class-conversion-process.php
CHANGED
@@ -19,7 +19,7 @@ class Conversion_Process extends WP_Background_Process {
|
|
19 |
*
|
20 |
* @var string
|
21 |
*/
|
22 |
-
protected $prefix
|
23 |
|
24 |
/**
|
25 |
* Plugin main class
|
@@ -34,7 +34,8 @@ class Conversion_Process extends WP_Background_Process {
|
|
34 |
* @param Main $main Plugin main class.
|
35 |
*/
|
36 |
public function __construct( $main ) {
|
37 |
-
$this->main
|
|
|
38 |
|
39 |
parent::__construct();
|
40 |
}
|
@@ -93,7 +94,7 @@ class Conversion_Process extends WP_Background_Process {
|
|
93 |
* @param string $message Message to log.
|
94 |
*/
|
95 |
protected function log( $message ) {
|
96 |
-
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
|
97 |
// @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
98 |
error_log( 'Cyr To Lat: ' . $message );
|
99 |
// @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
19 |
*
|
20 |
* @var string
|
21 |
*/
|
22 |
+
protected $prefix;
|
23 |
|
24 |
/**
|
25 |
* Plugin main class
|
34 |
* @param Main $main Plugin main class.
|
35 |
*/
|
36 |
public function __construct( $main ) {
|
37 |
+
$this->main = $main;
|
38 |
+
$this->prefix = constant( 'CYR_TO_LAT_PREFIX' );
|
39 |
|
40 |
parent::__construct();
|
41 |
}
|
94 |
* @param string $message Message to log.
|
95 |
*/
|
96 |
protected function log( $message ) {
|
97 |
+
if ( defined( 'WP_DEBUG_LOG' ) && constant( 'WP_DEBUG_LOG' ) ) {
|
98 |
// @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
99 |
error_log( 'Cyr To Lat: ' . $message );
|
100 |
// @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
classes/background-processes/class-post-conversion-process.php
CHANGED
@@ -33,7 +33,7 @@ class Post_Conversion_Process extends Conversion_Process {
|
|
33 |
*
|
34 |
* @var string
|
35 |
*/
|
36 |
-
protected $action
|
37 |
|
38 |
/**
|
39 |
* Post_Conversion_Process constructor.
|
@@ -42,6 +42,8 @@ class Post_Conversion_Process extends Conversion_Process {
|
|
42 |
*/
|
43 |
public function __construct( $main ) {
|
44 |
parent::__construct( $main );
|
|
|
|
|
45 |
$this->locale = get_locale();
|
46 |
}
|
47 |
|
33 |
*
|
34 |
* @var string
|
35 |
*/
|
36 |
+
protected $action;
|
37 |
|
38 |
/**
|
39 |
* Post_Conversion_Process constructor.
|
42 |
*/
|
43 |
public function __construct( $main ) {
|
44 |
parent::__construct( $main );
|
45 |
+
|
46 |
+
$this->action = constant( 'CYR_TO_LAT_POST_CONVERSION_ACTION' );
|
47 |
$this->locale = get_locale();
|
48 |
}
|
49 |
|
classes/background-processes/class-term-conversion-process.php
CHANGED
@@ -33,7 +33,7 @@ class Term_Conversion_Process extends Conversion_Process {
|
|
33 |
*
|
34 |
* @var string
|
35 |
*/
|
36 |
-
protected $action
|
37 |
|
38 |
/**
|
39 |
* Term_Conversion_Process constructor.
|
@@ -42,6 +42,8 @@ class Term_Conversion_Process extends Conversion_Process {
|
|
42 |
*/
|
43 |
public function __construct( $main ) {
|
44 |
parent::__construct( $main );
|
|
|
|
|
45 |
$this->locale = get_locale();
|
46 |
}
|
47 |
|
33 |
*
|
34 |
* @var string
|
35 |
*/
|
36 |
+
protected $action;
|
37 |
|
38 |
/**
|
39 |
* Term_Conversion_Process constructor.
|
42 |
*/
|
43 |
public function __construct( $main ) {
|
44 |
parent::__construct( $main );
|
45 |
+
|
46 |
+
$this->action = constant( 'CYR_TO_LAT_TERM_CONVERSION_ACTION' );
|
47 |
$this->locale = get_locale();
|
48 |
}
|
49 |
|
classes/class-acf.php
CHANGED
@@ -45,9 +45,9 @@ class ACF {
|
|
45 |
|
46 |
wp_enqueue_script(
|
47 |
'cyr-to-lat-acf-field-group',
|
48 |
-
CYR_TO_LAT_URL . '/js/acf-field-group.js',
|
49 |
[],
|
50 |
-
CYR_TO_LAT_VERSION,
|
51 |
true
|
52 |
);
|
53 |
|
45 |
|
46 |
wp_enqueue_script(
|
47 |
'cyr-to-lat-acf-field-group',
|
48 |
+
constant( 'CYR_TO_LAT_URL' ) . '/js/acf-field-group.js',
|
49 |
[],
|
50 |
+
constant( 'CYR_TO_LAT_VERSION' ),
|
51 |
true
|
52 |
);
|
53 |
|
classes/class-converter.php
CHANGED
@@ -70,27 +70,13 @@ class Converter {
|
|
70 |
* @param Term_Conversion_Process $process_all_terms Term conversion process.
|
71 |
* @param Admin_Notices $admin_notices Admin notices.
|
72 |
*/
|
73 |
-
public function __construct(
|
74 |
-
$main
|
75 |
-
|
76 |
-
$this->
|
77 |
-
$this->settings = $settings;
|
78 |
-
$this->option_group = Settings::OPTION_GROUP;
|
79 |
-
|
80 |
$this->process_all_posts = $process_all_posts;
|
81 |
-
if ( ! $this->process_all_posts ) {
|
82 |
-
$this->process_all_posts = new Post_Conversion_Process( $main );
|
83 |
-
}
|
84 |
-
|
85 |
$this->process_all_terms = $process_all_terms;
|
86 |
-
|
87 |
-
$this->process_all_terms = new Term_Conversion_Process( $main );
|
88 |
-
}
|
89 |
-
|
90 |
-
$this->admin_notices = $admin_notices;
|
91 |
-
if ( ! $this->admin_notices ) {
|
92 |
-
$this->admin_notices = new Admin_Notices();
|
93 |
-
}
|
94 |
|
95 |
$this->init_hooks();
|
96 |
}
|
@@ -257,7 +243,7 @@ class Converter {
|
|
257 |
* @param string $message Message to log.
|
258 |
*/
|
259 |
protected function log( $message ) {
|
260 |
-
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
|
261 |
// @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
262 |
error_log( 'Cyr To Lat: ' . $message );
|
263 |
// @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
70 |
* @param Term_Conversion_Process $process_all_terms Term conversion process.
|
71 |
* @param Admin_Notices $admin_notices Admin notices.
|
72 |
*/
|
73 |
+
public function __construct( $main, $settings, $process_all_posts, $process_all_terms, $admin_notices ) {
|
74 |
+
$this->main = $main;
|
75 |
+
$this->settings = $settings;
|
76 |
+
$this->option_group = Settings::OPTION_GROUP;
|
|
|
|
|
|
|
77 |
$this->process_all_posts = $process_all_posts;
|
|
|
|
|
|
|
|
|
78 |
$this->process_all_terms = $process_all_terms;
|
79 |
+
$this->admin_notices = $admin_notices;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
$this->init_hooks();
|
82 |
}
|
243 |
* @param string $message Message to log.
|
244 |
*/
|
245 |
protected function log( $message ) {
|
246 |
+
if ( defined( 'WP_DEBUG_LOG' ) && constant( 'WP_DEBUG_LOG' ) ) {
|
247 |
// @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
248 |
error_log( 'Cyr To Lat: ' . $message );
|
249 |
// @phpcs:enable WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
classes/class-main.php
CHANGED
@@ -31,6 +31,27 @@ class Main {
|
|
31 |
*/
|
32 |
protected $settings;
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Converter instance.
|
36 |
*
|
@@ -54,34 +75,25 @@ class Main {
|
|
54 |
|
55 |
/**
|
56 |
* Main constructor.
|
57 |
-
*
|
58 |
-
* @param Settings $settings Plugin settings.
|
59 |
-
* @param Converter $converter Converter instance.
|
60 |
-
* @param WP_CLI $cli CLI instance.
|
61 |
-
* @param ACF $acf ACF instance.
|
62 |
*/
|
63 |
-
public function __construct(
|
64 |
-
$this->settings
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
-
$this->
|
70 |
-
if ( ! $this->converter ) {
|
71 |
-
$this->converter = new Converter( $this, $this->settings );
|
72 |
-
}
|
73 |
-
|
74 |
-
$this->cli = $cli;
|
75 |
-
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
76 |
-
if ( ! $this->cli ) {
|
77 |
-
$this->cli = new WP_CLI( $this->converter );
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
$this->acf = $acf;
|
82 |
-
if ( ! $this->acf ) {
|
83 |
-
$this->acf = new ACF( $this->settings );
|
84 |
-
}
|
85 |
|
86 |
$this->init();
|
87 |
}
|
@@ -90,7 +102,7 @@ class Main {
|
|
90 |
* Init class.
|
91 |
*/
|
92 |
public function init() {
|
93 |
-
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
94 |
try {
|
95 |
/**
|
96 |
* Method WP_CLI::add_command() accepts class as callable.
|
@@ -161,12 +173,35 @@ class Main {
|
|
161 |
if ( ! empty( $term ) ) {
|
162 |
$title = $term;
|
163 |
} else {
|
164 |
-
$title = $this->transliterate( $title );
|
165 |
}
|
166 |
|
167 |
return $title;
|
168 |
}
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
/**
|
171 |
* Sanitize filename.
|
172 |
*
|
@@ -278,9 +313,6 @@ class Main {
|
|
278 |
private function ctl_is_classic_editor_plugin_active() {
|
279 |
if ( ! function_exists( 'is_plugin_active' ) ) {
|
280 |
// @codeCoverageIgnoreStart
|
281 |
-
/**
|
282 |
-
* Do not inspect include path.
|
283 |
-
*/
|
284 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
285 |
// @codeCoverageIgnoreEnd
|
286 |
}
|
31 |
*/
|
32 |
protected $settings;
|
33 |
|
34 |
+
/**
|
35 |
+
* Process posts instance.
|
36 |
+
*
|
37 |
+
* @var Post_Conversion_Process
|
38 |
+
*/
|
39 |
+
protected $process_all_posts;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Process terms instance.
|
43 |
+
*
|
44 |
+
* @var Term_Conversion_Process
|
45 |
+
*/
|
46 |
+
protected $process_all_terms;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Admin Notices instance.
|
50 |
+
*
|
51 |
+
* @var Admin_Notices
|
52 |
+
*/
|
53 |
+
protected $admin_notices;
|
54 |
+
|
55 |
/**
|
56 |
* Converter instance.
|
57 |
*
|
75 |
|
76 |
/**
|
77 |
* Main constructor.
|
|
|
|
|
|
|
|
|
|
|
78 |
*/
|
79 |
+
public function __construct() {
|
80 |
+
$this->settings = new Settings();
|
81 |
+
$this->process_all_posts = new Post_Conversion_Process( $this );
|
82 |
+
$this->process_all_terms = new Term_Conversion_Process( $this );
|
83 |
+
$this->admin_notices = new Admin_Notices();
|
84 |
+
$this->converter = new Converter(
|
85 |
+
$this,
|
86 |
+
$this->settings,
|
87 |
+
$this->process_all_posts,
|
88 |
+
$this->process_all_terms,
|
89 |
+
$this->admin_notices
|
90 |
+
);
|
91 |
+
|
92 |
+
if ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ) {
|
93 |
+
$this->cli = new WP_CLI( $this->converter );
|
94 |
}
|
95 |
|
96 |
+
$this->acf = new ACF( $this->settings );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
$this->init();
|
99 |
}
|
102 |
* Init class.
|
103 |
*/
|
104 |
public function init() {
|
105 |
+
if ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ) {
|
106 |
try {
|
107 |
/**
|
108 |
* Method WP_CLI::add_command() accepts class as callable.
|
173 |
if ( ! empty( $term ) ) {
|
174 |
$title = $term;
|
175 |
} else {
|
176 |
+
$title = $this->is_wc_attribute_taxonomy( $title ) ? $title : $this->transliterate( $title );
|
177 |
}
|
178 |
|
179 |
return $title;
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
* Check if title is an attribute taxonomy.
|
184 |
+
*
|
185 |
+
* @param string $title Title.
|
186 |
+
*
|
187 |
+
* @return bool
|
188 |
+
*/
|
189 |
+
protected function is_wc_attribute_taxonomy( $title ) {
|
190 |
+
if ( ! function_exists( 'wc_get_attribute_taxonomies' ) ) {
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
195 |
+
|
196 |
+
foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
|
197 |
+
if ( $title === $attribute_taxonomy->attribute_name ) {
|
198 |
+
return true;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
|
205 |
/**
|
206 |
* Sanitize filename.
|
207 |
*
|
313 |
private function ctl_is_classic_editor_plugin_active() {
|
314 |
if ( ! function_exists( 'is_plugin_active' ) ) {
|
315 |
// @codeCoverageIgnoreStart
|
|
|
|
|
|
|
316 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
317 |
// @codeCoverageIgnoreEnd
|
318 |
}
|
classes/class-requirements.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
|
8 |
namespace Cyr_To_Lat;
|
9 |
|
10 |
-
use RuntimeException;
|
11 |
use WP_Filesystem_Direct;
|
12 |
|
13 |
if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
@@ -54,11 +53,6 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
54 |
|
55 |
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
56 |
// @codeCoverageIgnoreStart
|
57 |
-
/**
|
58 |
-
* Do not inspect require path.
|
59 |
-
*
|
60 |
-
* @noinspection PhpIncludeInspection
|
61 |
-
*/
|
62 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
63 |
// @codeCoverageIgnoreEnd
|
64 |
}
|
@@ -93,8 +87,8 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
93 |
* Deactivate plugin.
|
94 |
*/
|
95 |
public function deactivate_plugin() {
|
96 |
-
if ( is_plugin_active( plugin_basename( CYR_TO_LAT_FILE ) ) ) {
|
97 |
-
deactivate_plugins( plugin_basename( CYR_TO_LAT_FILE ) );
|
98 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
99 |
if ( isset( $_GET['activate'] ) ) {
|
100 |
unset( $_GET['activate'] );
|
@@ -114,9 +108,9 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
114 |
* @return bool
|
115 |
*/
|
116 |
private function is_php_version_required() {
|
117 |
-
if ( version_compare( CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION, phpversion(), '>' ) ) {
|
118 |
/* translators: 1: Current PHP version number, 2: Cyr To Lat version, 3: Minimum required PHP version number */
|
119 |
-
$message = sprintf( __( 'Your server is running PHP version %1$s but Cyr To Lat %2$s requires at least %3$s.', 'cyr2lat' ), phpversion(), CYR_TO_LAT_VERSION, CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION );
|
120 |
|
121 |
$this->admin_notices->add_notice( $message, 'notice notice-error' );
|
122 |
|
@@ -132,7 +126,7 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
132 |
* @return bool
|
133 |
*/
|
134 |
private function is_max_input_vars_required() {
|
135 |
-
if ( CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS > ini_get( 'max_input_vars' ) ) {
|
136 |
if ( $this->wp_filesystem ) {
|
137 |
$this->try_to_fix_max_input_vars();
|
138 |
} else {
|
@@ -147,14 +141,14 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
147 |
}
|
148 |
}
|
149 |
|
150 |
-
if ( CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS > ini_get( 'max_input_vars' ) ) {
|
151 |
$mtime = $this->wp_filesystem->mtime( $this->get_user_ini_filename() );
|
152 |
$ini_ttl = intval( ini_get( 'user_ini.cache_ttl' ) );
|
153 |
$time_left = ( $mtime + $ini_ttl ) - time();
|
154 |
|
155 |
if ( 0 < $time_left ) {
|
156 |
/* translators: 1: max_input_vars value, 2: Cyr To Lat version, 3: Minimum required max_input_vars */
|
157 |
-
$message = sprintf( __( 'Your server is running PHP with max_input_vars=%1$d but Cyr To Lat %2$s requires at least %3$d.', 'cyr2lat' ), ini_get( 'max_input_vars' ), CYR_TO_LAT_VERSION, CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS );
|
158 |
|
159 |
$message .= '<br>';
|
160 |
/* translators: 1: .user.ini filename */
|
@@ -195,7 +189,7 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
195 |
$content_arr
|
196 |
);
|
197 |
|
198 |
-
if ( $value >= CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS ) {
|
199 |
return;
|
200 |
}
|
201 |
|
@@ -208,7 +202,7 @@ if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
|
208 |
if ( [ '' ] === $content_arr ) {
|
209 |
$content_arr = [];
|
210 |
}
|
211 |
-
$content_arr[] = 'max_input_vars = ' . CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS;
|
212 |
$content = implode( PHP_EOL, $content_arr );
|
213 |
|
214 |
$this->wp_filesystem->put_contents( $user_ini_filename, $content );
|
7 |
|
8 |
namespace Cyr_To_Lat;
|
9 |
|
|
|
10 |
use WP_Filesystem_Direct;
|
11 |
|
12 |
if ( ! class_exists( __NAMESPACE__ . '\Requirements' ) ) {
|
53 |
|
54 |
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
55 |
// @codeCoverageIgnoreStart
|
|
|
|
|
|
|
|
|
|
|
56 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
57 |
// @codeCoverageIgnoreEnd
|
58 |
}
|
87 |
* Deactivate plugin.
|
88 |
*/
|
89 |
public function deactivate_plugin() {
|
90 |
+
if ( is_plugin_active( plugin_basename( constant( 'CYR_TO_LAT_FILE' ) ) ) ) {
|
91 |
+
deactivate_plugins( plugin_basename( constant( 'CYR_TO_LAT_FILE' ) ) );
|
92 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
93 |
if ( isset( $_GET['activate'] ) ) {
|
94 |
unset( $_GET['activate'] );
|
108 |
* @return bool
|
109 |
*/
|
110 |
private function is_php_version_required() {
|
111 |
+
if ( version_compare( constant( 'CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION' ), phpversion(), '>' ) ) {
|
112 |
/* translators: 1: Current PHP version number, 2: Cyr To Lat version, 3: Minimum required PHP version number */
|
113 |
+
$message = sprintf( __( 'Your server is running PHP version %1$s but Cyr To Lat %2$s requires at least %3$s.', 'cyr2lat' ), phpversion(), constant( 'CYR_TO_LAT_VERSION' ), constant( 'CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION' ) );
|
114 |
|
115 |
$this->admin_notices->add_notice( $message, 'notice notice-error' );
|
116 |
|
126 |
* @return bool
|
127 |
*/
|
128 |
private function is_max_input_vars_required() {
|
129 |
+
if ( constant( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS' ) > ini_get( 'max_input_vars' ) ) {
|
130 |
if ( $this->wp_filesystem ) {
|
131 |
$this->try_to_fix_max_input_vars();
|
132 |
} else {
|
141 |
}
|
142 |
}
|
143 |
|
144 |
+
if ( constant( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS' ) > ini_get( 'max_input_vars' ) ) {
|
145 |
$mtime = $this->wp_filesystem->mtime( $this->get_user_ini_filename() );
|
146 |
$ini_ttl = intval( ini_get( 'user_ini.cache_ttl' ) );
|
147 |
$time_left = ( $mtime + $ini_ttl ) - time();
|
148 |
|
149 |
if ( 0 < $time_left ) {
|
150 |
/* translators: 1: max_input_vars value, 2: Cyr To Lat version, 3: Minimum required max_input_vars */
|
151 |
+
$message = sprintf( __( 'Your server is running PHP with max_input_vars=%1$d but Cyr To Lat %2$s requires at least %3$d.', 'cyr2lat' ), ini_get( 'max_input_vars' ), constant( 'CYR_TO_LAT_VERSION' ), constant( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS' ) );
|
152 |
|
153 |
$message .= '<br>';
|
154 |
/* translators: 1: .user.ini filename */
|
189 |
$content_arr
|
190 |
);
|
191 |
|
192 |
+
if ( $value >= constant( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS' ) ) {
|
193 |
return;
|
194 |
}
|
195 |
|
202 |
if ( [ '' ] === $content_arr ) {
|
203 |
$content_arr = [];
|
204 |
}
|
205 |
+
$content_arr[] = 'max_input_vars = ' . constant( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS' );
|
206 |
$content = implode( PHP_EOL, $content_arr );
|
207 |
|
208 |
$this->wp_filesystem->put_contents( $user_ini_filename, $content );
|
classes/class-settings.php
CHANGED
@@ -87,7 +87,7 @@ class Settings {
|
|
87 |
*/
|
88 |
public function init_hooks() {
|
89 |
add_filter(
|
90 |
-
'plugin_action_links_' . plugin_basename( CYR_TO_LAT_FILE ),
|
91 |
[ $this, 'add_settings_link' ],
|
92 |
10,
|
93 |
4
|
@@ -722,17 +722,17 @@ class Settings {
|
|
722 |
|
723 |
wp_enqueue_script(
|
724 |
'cyr-to-lat-settings',
|
725 |
-
CYR_TO_LAT_URL . '/dist/js/settings/app.js',
|
726 |
[],
|
727 |
-
CYR_TO_LAT_VERSION,
|
728 |
true
|
729 |
);
|
730 |
|
731 |
wp_enqueue_style(
|
732 |
'cyr-to-lat-admin',
|
733 |
-
CYR_TO_LAT_URL . '/css/cyr-to-lat-admin.css',
|
734 |
[],
|
735 |
-
CYR_TO_LAT_VERSION
|
736 |
);
|
737 |
}
|
738 |
|
@@ -743,7 +743,7 @@ class Settings {
|
|
743 |
load_plugin_textdomain(
|
744 |
'cyr2lat',
|
745 |
false,
|
746 |
-
dirname( plugin_basename( CYR_TO_LAT_FILE ) ) . '/languages/'
|
747 |
);
|
748 |
}
|
749 |
|
87 |
*/
|
88 |
public function init_hooks() {
|
89 |
add_filter(
|
90 |
+
'plugin_action_links_' . plugin_basename( constant( 'CYR_TO_LAT_FILE' ) ),
|
91 |
[ $this, 'add_settings_link' ],
|
92 |
10,
|
93 |
4
|
722 |
|
723 |
wp_enqueue_script(
|
724 |
'cyr-to-lat-settings',
|
725 |
+
constant( 'CYR_TO_LAT_URL' ) . '/dist/js/settings/app.js',
|
726 |
[],
|
727 |
+
constant( 'CYR_TO_LAT_VERSION' ),
|
728 |
true
|
729 |
);
|
730 |
|
731 |
wp_enqueue_style(
|
732 |
'cyr-to-lat-admin',
|
733 |
+
constant( 'CYR_TO_LAT_URL' ) . '/css/cyr-to-lat-admin.css',
|
734 |
[],
|
735 |
+
constant( 'CYR_TO_LAT_VERSION' )
|
736 |
);
|
737 |
}
|
738 |
|
743 |
load_plugin_textdomain(
|
744 |
'cyr2lat',
|
745 |
false,
|
746 |
+
dirname( plugin_basename( constant( 'CYR_TO_LAT_FILE' ) ) ) . '/languages/'
|
747 |
);
|
748 |
}
|
749 |
|
classes/class-wp-cli.php
CHANGED
@@ -83,7 +83,7 @@ class WP_CLI extends WP_CLI_Command {
|
|
83 |
*
|
84 |
* @return Bar|NoOp
|
85 |
*/
|
86 |
-
|
87 |
return make_progress_bar( 'Regenerate existing slugs', 1 );
|
88 |
}
|
89 |
}
|
83 |
*
|
84 |
* @return Bar|NoOp
|
85 |
*/
|
86 |
+
public function make_progress_bar() {
|
87 |
return make_progress_bar( 'Regenerate existing slugs', 1 );
|
88 |
}
|
89 |
}
|
cyr-to-lat.php
CHANGED
@@ -8,9 +8,9 @@
|
|
8 |
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
|
9 |
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
|
10 |
* Requires at least: 5.1
|
11 |
-
* Tested up to: 5.
|
12 |
-
* Version: 4.3.
|
13 |
-
* Stable tag: 4.3.
|
14 |
*
|
15 |
* Text Domain: cyr2lat
|
16 |
* Domain Path: /languages/
|
@@ -25,90 +25,67 @@ namespace Cyr_To_Lat;
|
|
25 |
if ( ! defined( 'ABSPATH' ) ) {
|
26 |
exit; // Exit if accessed directly.
|
27 |
}
|
|
|
28 |
|
29 |
-
if (
|
30 |
-
|
31 |
-
* Plugin version.
|
32 |
-
*/
|
33 |
-
define( 'CYR_TO_LAT_VERSION', '4.3.4' );
|
34 |
}
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
define( 'CYR_TO_LAT_PATH', dirname( __FILE__ ) );
|
41 |
-
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
define( 'CYR_TO_LAT_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
48 |
-
}
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
define( 'CYR_TO_LAT_FILE', __FILE__ );
|
55 |
-
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
define( 'CYR_TO_LAT_PREFIX', 'cyr_to_lat' );
|
62 |
-
}
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
define( 'CYR_TO_LAT_POST_CONVERSION_ACTION', 'post_conversion_action' );
|
69 |
-
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
define( 'CYR_TO_LAT_TERM_CONVERSION_ACTION', 'term_conversion_action' );
|
76 |
-
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
define( 'CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION', '5.6' );
|
83 |
-
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
define( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS', 1000 );
|
90 |
-
}
|
91 |
-
// @codeCoverageIgnoreEnd
|
92 |
|
93 |
/**
|
94 |
-
*
|
95 |
*/
|
96 |
-
|
97 |
-
static $cyr_to_lat_plugin;
|
98 |
|
99 |
-
|
100 |
-
|
|
|
|
|
101 |
|
102 |
-
|
103 |
-
}
|
104 |
|
105 |
if ( ! $cyr_to_lat_requirements->are_requirements_met() ) {
|
106 |
-
$cyr_to_lat_plugin = false;
|
107 |
-
|
108 |
return;
|
109 |
}
|
110 |
|
111 |
-
|
112 |
-
$cyr_to_lat_plugin = new Main();
|
113 |
-
}
|
114 |
|
8 |
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
|
9 |
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
|
10 |
* Requires at least: 5.1
|
11 |
+
* Tested up to: 5.4
|
12 |
+
* Version: 4.3.5
|
13 |
+
* Stable tag: 4.3.5
|
14 |
*
|
15 |
* Text Domain: cyr2lat
|
16 |
* Domain Path: /languages/
|
25 |
if ( ! defined( 'ABSPATH' ) ) {
|
26 |
exit; // Exit if accessed directly.
|
27 |
}
|
28 |
+
// @codeCoverageIgnoreEnd
|
29 |
|
30 |
+
if ( defined( 'CYR_TO_LAT_VERSION' ) ) {
|
31 |
+
return;
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Plugin version.
|
36 |
+
*/
|
37 |
+
define( 'CYR_TO_LAT_VERSION', '4.3.5' );
|
|
|
|
|
38 |
|
39 |
+
/**
|
40 |
+
* Path to the plugin dir.
|
41 |
+
*/
|
42 |
+
define( 'CYR_TO_LAT_PATH', dirname( __FILE__ ) );
|
|
|
|
|
43 |
|
44 |
+
/**
|
45 |
+
* Plugin dir url.
|
46 |
+
*/
|
47 |
+
define( 'CYR_TO_LAT_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
|
|
|
|
48 |
|
49 |
+
/**
|
50 |
+
* Main plugin file.
|
51 |
+
*/
|
52 |
+
define( 'CYR_TO_LAT_FILE', __FILE__ );
|
|
|
|
|
53 |
|
54 |
+
/**
|
55 |
+
* Plugin prefix.
|
56 |
+
*/
|
57 |
+
define( 'CYR_TO_LAT_PREFIX', 'cyr_to_lat' );
|
|
|
|
|
58 |
|
59 |
+
/**
|
60 |
+
* Post conversion action.
|
61 |
+
*/
|
62 |
+
define( 'CYR_TO_LAT_POST_CONVERSION_ACTION', 'post_conversion_action' );
|
|
|
|
|
63 |
|
64 |
+
/**
|
65 |
+
* Term conversion action.
|
66 |
+
*/
|
67 |
+
define( 'CYR_TO_LAT_TERM_CONVERSION_ACTION', 'term_conversion_action' );
|
|
|
|
|
68 |
|
69 |
+
/**
|
70 |
+
* Minimum required php version.
|
71 |
+
*/
|
72 |
+
define( 'CYR_TO_LAT_MINIMUM_PHP_REQUIRED_VERSION', '5.6' );
|
|
|
|
|
|
|
73 |
|
74 |
/**
|
75 |
+
* Minimum required max_input_vars value.
|
76 |
*/
|
77 |
+
define( 'CYR_TO_LAT_REQUIRED_MAX_INPUT_VARS', 1000 );
|
|
|
78 |
|
79 |
+
/**
|
80 |
+
* Init plugin on plugin load.
|
81 |
+
*/
|
82 |
+
require_once constant( 'CYR_TO_LAT_PATH' ) . '/vendor/autoload.php';
|
83 |
|
84 |
+
$cyr_to_lat_requirements = new Requirements();
|
|
|
85 |
|
86 |
if ( ! $cyr_to_lat_requirements->are_requirements_met() ) {
|
|
|
|
|
87 |
return;
|
88 |
}
|
89 |
|
90 |
+
$cyr_to_lat_plugin = new Main();
|
|
|
|
|
91 |
|
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: 5.
|
6 |
-
Stable tag: 4.3.
|
7 |
Requires PHP: 5.6.20
|
8 |
|
9 |
Converts Cyrillic characters in post, page and term slugs to Latin characters.
|
@@ -91,6 +91,10 @@ Yes you can!
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
94 |
= 4.3.4 (22.02.2020) =
|
95 |
* Fixed non-conversion of slugs with WPML
|
96 |
* Restricted conversion of post to public and nav_menu_item
|
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: 5.4
|
6 |
+
Stable tag: 4.3.5
|
7 |
Requires PHP: 5.6.20
|
8 |
|
9 |
Converts Cyrillic characters in post, page and term slugs to Latin characters.
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 4.3.5 (28.03.2020) =
|
95 |
+
* Tested up to WordPress 5.4
|
96 |
+
* Fixed bug with disappearing of WooCommerce attributes
|
97 |
+
|
98 |
= 4.3.4 (22.02.2020) =
|
99 |
* Fixed non-conversion of slugs with WPML
|
100 |
* Restricted conversion of post to public and nav_menu_item
|