Version Description
- 404
- ---
- Fixed a bug in the work of custom transliteration rules
- fixed template
- Fixed bug in transliteration mode 404
Download this release
Release Info
Developer | YurchenkoEV |
Plugin | WP Translitera |
Version | p1.2.3 |
Comparing to | |
See all releases |
Code changes from version p1.2.2 to p1.2.3
- admintmpl.php +2 -2
- readme.txt +10 -1
- wp-translitera.php +20 -13
admintmpl.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
.groupblock {border: 1px solid #aaa; margin: 5px; padding: 5px 10px; border-radius: 10px}
|
4 |
.red label {color: red; font-weight:800}
|
5 |
.groupblock h2 {margin-top: 5px;}
|
6 |
-
.groupblock input[type="submit"] {
|
7 |
.alertblock {border-color: red; color:red; font-weight:800}
|
8 |
input {max-width: 100%}
|
9 |
</style>
|
@@ -27,7 +27,7 @@
|
|
27 |
wp_translitera::get_template_object('typefiles','text',__('File extensions, separated by commas , titles that do not need to transliterate', 'wp-translitera'),'','size="80"',$extforform);
|
28 |
?>
|
29 |
<h3><?php echo __('Transliteration tables','wp-translitera') ?></h3>
|
30 |
-
<?php wp_translitera::get_template_object('customrules','textarea',__('Custom transliteration rules, in format я=ja (Everyone ruled from a new line!)', 'wp-translitera'),'','cols="30" rows="10"',$customrulesstring);
|
31 |
wp_translitera::get_template_object('apply','submit',__('Apply', 'wp-translitera')); ?>
|
32 |
</form>
|
33 |
</div>
|
3 |
.groupblock {border: 1px solid #aaa; margin: 5px; padding: 5px 10px; border-radius: 10px}
|
4 |
.red label {color: red; font-weight:800}
|
5 |
.groupblock h2 {margin-top: 5px;}
|
6 |
+
.groupblock input[type="submit"] {max-width:80%; margin: 15px; padding: 4px 7px 7px 7px;}
|
7 |
.alertblock {border-color: red; color:red; font-weight:800}
|
8 |
input {max-width: 100%}
|
9 |
</style>
|
27 |
wp_translitera::get_template_object('typefiles','text',__('File extensions, separated by commas , titles that do not need to transliterate', 'wp-translitera'),'','size="80"',$extforform);
|
28 |
?>
|
29 |
<h3><?php echo __('Transliteration tables','wp-translitera') ?></h3>
|
30 |
+
<?php wp_translitera::get_template_object('customrules','textarea',__('Custom transliteration rules, in format я=ja (Everyone ruled from a new line!). Достаточно создать только нижний регистр.', 'wp-translitera'),'','cols="30" rows="10"',$customrulesstring);
|
31 |
wp_translitera::get_template_object('apply','submit',__('Apply', 'wp-translitera')); ?>
|
32 |
</form>
|
33 |
</div>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yur4enko.com/
|
|
4 |
Tags: translate, rus-to-lat, cyr-to-lat, Seo, tag, record, page, transliterate, transliteration, bg, bulgarian
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: p1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -28,6 +28,15 @@ Automatical from repository or unzip in plugins and activate in ACP.
|
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
= p1.2.2 =
|
32 |
* исправлена ошибка при повторном вызове
|
33 |
* оптимизирован вызов локализации
|
4 |
Tags: translate, rus-to-lat, cyr-to-lat, Seo, tag, record, page, transliterate, transliteration, bg, bulgarian
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: p1.2.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= p1.2.3 =
|
32 |
+
* исправлена ошибка в работе кастомных правил транслитерации
|
33 |
+
* поправлен шаблон
|
34 |
+
* исправлена ошибка в режиме транслитерации 404
|
35 |
+
* ---
|
36 |
+
* Fixed a bug in the work of custom transliteration rules
|
37 |
+
* fixed template
|
38 |
+
* Fixed bug in transliteration mode 404
|
39 |
+
|
40 |
= p1.2.2 =
|
41 |
* исправлена ошибка при повторном вызове
|
42 |
* оптимизирован вызов локализации
|
wp-translitera.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Translitera
|
4 |
Plugin URI: http://yur4enko.com/category/moi-proekty/wp-translitera
|
5 |
Description: Plug-in for transliteration permanent permalink records , pages, and tag
|
6 |
-
Version: p1.2.
|
7 |
Author: Evgen Yurchenko
|
8 |
Text Domain: wp-translitera
|
9 |
Domain Path: /languages/
|
@@ -106,7 +106,11 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
106 |
$tr_rules = array();
|
107 |
foreach ($rules as $key => $value) {
|
108 |
$tr_rules[$key] = $value;
|
109 |
-
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
return $tr_rules;
|
112 |
}
|
@@ -160,7 +164,7 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
160 |
}
|
161 |
$customrulesinjson = wp_translitera::getset('custom_rules', json_encode(array()));
|
162 |
$customrulesarray = json_decode($customrulesinjson, TRUE);
|
163 |
-
$customrulesstring = '';
|
164 |
foreach ($customrulesarray as $key => $value) {
|
165 |
$customrulesstring .=$key.'='.$value.PHP_EOL;
|
166 |
}
|
@@ -210,7 +214,6 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
210 |
return (array_key_exists($name,$set))?$set[$name]:FALSE;
|
211 |
}
|
212 |
|
213 |
-
|
214 |
////Получаем значение настройки
|
215 |
// добалено 160128
|
216 |
// принимает: - name СТРОКА с названием настройки плагина
|
@@ -378,6 +381,7 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
378 |
$rulesrawarray = explode(PHP_EOL, $rulesstring);
|
379 |
$rulesarray = array();
|
380 |
foreach ($rulesrawarray as $value) {
|
|
|
381 |
if (empty($value) || $value == '=') {
|
382 |
continue;
|
383 |
}
|
@@ -402,11 +406,12 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
402 |
}
|
403 |
|
404 |
//Вызываемые функции
|
|
|
405 |
//Процедура преобразования символов
|
406 |
// добавлено в 150712
|
407 |
// принимает : title - СТРОКА которую необходимо транслитерировать
|
408 |
// возвращает : СТРОКА
|
409 |
-
public static function transliterate($title) {//wp=>3.2 php=>5.2.4
|
410 |
//Отбрасывает файлы с расширениями для который отключена трнаслитерация
|
411 |
// добавлено 161011
|
412 |
$type = substr(filter_input(INPUT_POST, 'name'),-3);
|
@@ -416,12 +421,14 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
416 |
}
|
417 |
}
|
418 |
$title = strtr($title, wp_translitera::createlocale());
|
419 |
-
|
420 |
-
$
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
|
|
|
|
425 |
return $title;
|
426 |
}
|
427 |
|
@@ -455,8 +462,8 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
|
|
455 |
|
456 |
if ($this404){
|
457 |
if (wp_translitera::getset('tranliterate_404')){
|
458 |
-
$thisurl =
|
459 |
-
$trurl = wp_translitera::transliterate($thisurl);
|
460 |
if ($thisurl != $trurl) {
|
461 |
wp_redirect($trurl,301);
|
462 |
}
|
3 |
Plugin Name: WP Translitera
|
4 |
Plugin URI: http://yur4enko.com/category/moi-proekty/wp-translitera
|
5 |
Description: Plug-in for transliteration permanent permalink records , pages, and tag
|
6 |
+
Version: p1.2.3
|
7 |
Author: Evgen Yurchenko
|
8 |
Text Domain: wp-translitera
|
9 |
Domain Path: /languages/
|
106 |
$tr_rules = array();
|
107 |
foreach ($rules as $key => $value) {
|
108 |
$tr_rules[$key] = $value;
|
109 |
+
if (strlen($value) > 0) {
|
110 |
+
$tr_rules[strtoupper($key)] = strtoupper($value{0}).substr($value, 1);
|
111 |
+
} else {
|
112 |
+
$tr_rules[strtoupper($key)] = $value;
|
113 |
+
}
|
114 |
}
|
115 |
return $tr_rules;
|
116 |
}
|
164 |
}
|
165 |
$customrulesinjson = wp_translitera::getset('custom_rules', json_encode(array()));
|
166 |
$customrulesarray = json_decode($customrulesinjson, TRUE);
|
167 |
+
$customrulesstring = '';
|
168 |
foreach ($customrulesarray as $key => $value) {
|
169 |
$customrulesstring .=$key.'='.$value.PHP_EOL;
|
170 |
}
|
214 |
return (array_key_exists($name,$set))?$set[$name]:FALSE;
|
215 |
}
|
216 |
|
|
|
217 |
////Получаем значение настройки
|
218 |
// добалено 160128
|
219 |
// принимает: - name СТРОКА с названием настройки плагина
|
381 |
$rulesrawarray = explode(PHP_EOL, $rulesstring);
|
382 |
$rulesarray = array();
|
383 |
foreach ($rulesrawarray as $value) {
|
384 |
+
$value = trim($value);
|
385 |
if (empty($value) || $value == '=') {
|
386 |
continue;
|
387 |
}
|
406 |
}
|
407 |
|
408 |
//Вызываемые функции
|
409 |
+
|
410 |
//Процедура преобразования символов
|
411 |
// добавлено в 150712
|
412 |
// принимает : title - СТРОКА которую необходимо транслитерировать
|
413 |
// возвращает : СТРОКА
|
414 |
+
public static function transliterate($title,$UseSpecSimbol=TRUE) {//wp=>3.2 php=>5.2.4
|
415 |
//Отбрасывает файлы с расширениями для который отключена трнаслитерация
|
416 |
// добавлено 161011
|
417 |
$type = substr(filter_input(INPUT_POST, 'name'),-3);
|
421 |
}
|
422 |
}
|
423 |
$title = strtr($title, wp_translitera::createlocale());
|
424 |
+
|
425 |
+
if ($UseSpecSimbol) { // add p1.2.3 игнор спецсимволов для корректной работы 404
|
426 |
+
//add in p1.2.1 удаление непечатных и лишних символов
|
427 |
+
$title = preg_replace("/[^A-Za-z0-9'_\-\.]/", '-', $title);
|
428 |
+
$title = preg_replace('/\-+/', '-', $title);
|
429 |
+
$title = preg_replace('/^-+/', '', $title);
|
430 |
+
$title = preg_replace('/-+$/', '', $title);
|
431 |
+
}
|
432 |
return $title;
|
433 |
}
|
434 |
|
462 |
|
463 |
if ($this404){
|
464 |
if (wp_translitera::getset('tranliterate_404')){
|
465 |
+
$thisurl = $_SERVER['REQUEST_URI'];
|
466 |
+
$trurl = wp_translitera::transliterate(urldecode($thisurl),FALSE);
|
467 |
if ($thisurl != $trurl) {
|
468 |
wp_redirect($trurl,301);
|
469 |
}
|