WP Translitera - Version p1.2.1

Version Description



  • ""
    (https://wordpress.org/support/topic/%D0%BD%D0%B5%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BA%D1%82%D0%BD%D0%B0%D1%8F-%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%BB%D0%B8%D1%82%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D1%8F-%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%BE%D0%B9/)

  • mbstring
  • ---
  • fixed mobile version and interface
  • fixed work with some encodings
  • fixed work with "excess" and unprinted characters (https://wordpress.org/support/topic/%D0%BD%D0%B5%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BA%D1%82%D0%BD%D0%B0%D1%8F-%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%BB%D0%B8%D1%82%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D1%8F-%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%BE%D0%B9/)
  • fixed the path to connect transliteration tables
  • renouncement to use mbstring
Download this release

Release Info

Developer YurchenkoEV
Plugin Icon wp plugin WP Translitera
Version p1.2.1
Comparing to
See all releases

Code changes from version p1.2 to p1.2.1

Files changed (4) hide show
  1. admintmpl.php +3 -8
  2. readme.txt +16 -1
  3. tables.php +2 -2
  4. wp-translitera.php +13 -19
admintmpl.php CHANGED
@@ -3,15 +3,12 @@
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"] {width:120px; max-width:80%}
7
  .alertblock {border-color: red; color:red; font-weight:800}
 
8
  </style>
9
 
10
  <div class="mainbock">
11
- <?php if (!$mbstringactive) {?>
12
- <div class="groupblock alertblock">
13
- <span><?php echo __('Mbstring module is not installed on your server! Functionality is limited!','wp-translitera') ?></span>
14
- </div><?php }?>
15
  <div class="groupblock">
16
  <h1><?php echo __('Settings', 'wp-translitera')?></h1>
17
  <form method=POST>
@@ -30,9 +27,7 @@
30
  wp_translitera::get_template_object('typefiles','text',__('File extensions, separated by commas , titles that do not need to transliterate', 'wp-translitera'),'','size="80"',$extforform);
31
  ?>
32
  <h3><?php echo __('Transliteration tables','wp-translitera') ?></h3>
33
- <?php if ($mbstringactive) {
34
- 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);
35
- }
36
  wp_translitera::get_template_object('apply','submit',__('Apply', 'wp-translitera')); ?>
37
  </form>
38
  </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"] {width:150px; max-width:80%; margin: 15px}
7
  .alertblock {border-color: red; color:red; font-weight:800}
8
+ input {max-width: 100%}
9
  </style>
10
 
11
  <div class="mainbock">
 
 
 
 
12
  <div class="groupblock">
13
  <h1><?php echo __('Settings', 'wp-translitera')?></h1>
14
  <form method=POST>
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,21 @@ Automatical from repository or unzip in plugins and activate in ACP.
28
 
29
  == Changelog ==
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  = p1.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.1
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.1 =
32
+ * исправлна мобильная версия и поравлен интерфейс
33
+ * исправлена работа с некоторыми кодировками
34
+ * исправлна работа с "лишними" и непечатными символами
35
+ (https://wordpress.org/support/topic/%D0%BD%D0%B5%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BA%D1%82%D0%BD%D0%B0%D1%8F-%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%BB%D0%B8%D1%82%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D1%8F-%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%BE%D0%B9/)
36
+ * исправлены пути для подключения таблиц транслитерации
37
+ * отказ от использования mbstring
38
+ * ---
39
+ * fixed mobile version and interface
40
+ * fixed work with some encodings
41
+ * fixed work with "excess" and unprinted characters
42
+ (https://wordpress.org/support/topic/%D0%BD%D0%B5%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BA%D1%82%D0%BD%D0%B0%D1%8F-%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%BB%D0%B8%D1%82%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D1%8F-%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%BE%D0%B9/)
43
+ * fixed the path to connect transliteration tables
44
+ * renouncement to use mbstring
45
+
46
  = p1.2 =
47
  * таблицы транслитерации вынесены в отдельный файл
48
  * обновлен интерфейс
tables.php CHANGED
@@ -24,7 +24,7 @@ if ($loc == 'ru_RU') {//Русская локализация
24
  'С' => 'S', 'с' => 's', 'Т' => 'T', 'т' => 't', 'У' => 'U', 'у' => 'u', 'Ф' => 'F',
25
  'ф' => 'f', 'Х' => 'Kh', 'х' => 'kh', 'Ц' => 'Ts', 'ц' => 'ts', 'Ч' => 'Ch', 'ч' => 'ch',
26
  'Ш' => 'Sh', 'ш' => 'sh', 'Щ' => 'Shch', 'щ' => 'shch', 'Ь' => '', 'ь' => '', 'Ю' => 'Iu',
27
- 'ю' => 'iu', 'Я' => 'Ia', 'я' => 'ia', "'" => ''
28
  );
29
  } elseif ($loc == 'bg' || $loc == 'bg_BG') {//bulgarian locale добавлено 170114
30
  $ret = array(
@@ -53,6 +53,6 @@ $ret = $ret + array(
53
  'ч' => 'ch', 'Ш' => 'Sh', 'ш' => 'sh', 'Щ' => 'Shh', 'щ' => 'shh', 'Ъ' => '',
54
  'ъ' => '', 'Ы' => 'Y', 'ы' => 'y', 'Ь' => '', 'ь' => '', 'Э' => 'Je', 'э' => 'je',
55
  'Ю' => 'Ju', 'ю' => 'ju', 'Я' => 'Ja', 'я' => 'ja', 'Ґ' => 'G', 'ґ' => 'g', 'Є' => 'Ie',
56
- 'є' => 'ie', 'І' => 'I', 'і' => 'i', 'Ї' => 'I', 'ї' => 'i', "'" => ''
57
  );
58
 
24
  'С' => 'S', 'с' => 's', 'Т' => 'T', 'т' => 't', 'У' => 'U', 'у' => 'u', 'Ф' => 'F',
25
  'ф' => 'f', 'Х' => 'Kh', 'х' => 'kh', 'Ц' => 'Ts', 'ц' => 'ts', 'Ч' => 'Ch', 'ч' => 'ch',
26
  'Ш' => 'Sh', 'ш' => 'sh', 'Щ' => 'Shch', 'щ' => 'shch', 'Ь' => '', 'ь' => '', 'Ю' => 'Iu',
27
+ 'ю' => 'iu', 'Я' => 'Ia', 'я' => 'ia'
28
  );
29
  } elseif ($loc == 'bg' || $loc == 'bg_BG') {//bulgarian locale добавлено 170114
30
  $ret = array(
53
  'ч' => 'ch', 'Ш' => 'Sh', 'ш' => 'sh', 'Щ' => 'Shh', 'щ' => 'shh', 'Ъ' => '',
54
  'ъ' => '', 'Ы' => 'Y', 'ы' => 'y', 'Ь' => '', 'ь' => '', 'Э' => 'Je', 'э' => 'je',
55
  'Ю' => 'Ju', 'ю' => 'ju', 'Я' => 'Ja', 'я' => 'ja', 'Ґ' => 'G', 'ґ' => 'g', 'Є' => 'Ie',
56
+ 'є' => 'ie', 'І' => 'I', 'і' => 'i', 'Ї' => 'I', 'ї' => 'i'
57
  );
58
 
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/
@@ -36,7 +36,7 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
36
  $loc = get_locale();
37
  $ret = array();
38
 
39
- include_once 'tables.php'; //modified p1.1.1
40
 
41
  //Кстомные правила транслитерации
42
  // добавлено 170510
@@ -50,11 +50,9 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
50
  protected static function get_custom_rules_for_transliterate() {//wp=>3.2 php=>5.2.4
51
  $rules = json_decode(wp_translitera::getset('custom_rules', json_encode(array())),TRUE);
52
  $tr_rules = array();
53
- if (wp_translitera::mbstring_is_active()) {//добавлено p1.2
54
- foreach ($rules as $key => $value) {
55
- $tr_rules[$key] = $value;
56
- $tr_rules[mb_strtoupper($key,'UTF-8')] = mb_strtoupper($value{0},'UTF-8').substr($value, 1);
57
- }
58
  }
59
  return $tr_rules;
60
  }
@@ -112,7 +110,6 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
112
  foreach ($customrulesarray as $key => $value) {
113
  $customrulesstring .=$key.'='.$value.PHP_EOL;
114
  }
115
- $mbstringactive = wp_translitera::mbstring_is_active(); //
116
  include_once __DIR__.'/admintmpl.php';
117
  }
118
 
@@ -258,13 +255,6 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
258
  wp_translitera::updset('version', $from);
259
  }
260
  }
261
-
262
- //Проверяем активен ли модуль mbstring
263
- //добавлено p1.2
264
- //Возвращает БУЛЕВО
265
- protected static function mbstring_is_active() {//wp=>3.2 php=>5.2.4
266
- return extension_loaded('mbstring');
267
- }
268
 
269
  //Вызываемые дочерние функции
270
 
@@ -311,10 +301,14 @@ class wp_translitera {//wp=>3.2 php=>5.2.4
311
  return $title;
312
  }
313
  }
314
- if (wp_translitera::mbstring_is_active()) { //проверка на загрузку модуля php добавлен p1.2
315
- $title = mb_convert_encoding($title, 'UTF-8');
316
- }
317
- return strtr($title, wp_translitera::createlocale());
 
 
 
 
318
  }
319
 
320
  //Процедура преобразования символов форсированный режим
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.1
7
  Author: Evgen Yurchenko
8
  Text Domain: wp-translitera
9
  Domain Path: /languages/
36
  $loc = get_locale();
37
  $ret = array();
38
 
39
+ include_once __DIR__.'/tables.php'; //modified p1.1.1
40
 
41
  //Кстомные правила транслитерации
42
  // добавлено 170510
50
  protected static function get_custom_rules_for_transliterate() {//wp=>3.2 php=>5.2.4
51
  $rules = json_decode(wp_translitera::getset('custom_rules', json_encode(array())),TRUE);
52
  $tr_rules = array();
53
+ foreach ($rules as $key => $value) {
54
+ $tr_rules[$key] = $value;
55
+ $tr_rules[strtoupper($key)] = strtoupper($value{0}).substr($value, 1);
 
 
56
  }
57
  return $tr_rules;
58
  }
110
  foreach ($customrulesarray as $key => $value) {
111
  $customrulesstring .=$key.'='.$value.PHP_EOL;
112
  }
 
113
  include_once __DIR__.'/admintmpl.php';
114
  }
115
 
255
  wp_translitera::updset('version', $from);
256
  }
257
  }
 
 
 
 
 
 
 
258
 
259
  //Вызываемые дочерние функции
260
 
301
  return $title;
302
  }
303
  }
304
+ $title = strtr($title, wp_translitera::createlocale());
305
+ //add in p1.2.1 удаление непечатных и лишних символов
306
+ $title = preg_replace("/[^A-Za-z0-9'_\-\.]/", '-', $title);
307
+ $title = preg_replace('/\-+/', '-', $title);
308
+ $title = preg_replace('/^-+/', '', $title);
309
+ $title = preg_replace('/-+$/', '', $title);
310
+ //
311
+ return $title;
312
  }
313
 
314
  //Процедура преобразования символов форсированный режим