Version Description
- Added ISO 9-95 standard
Download this release
Release Info
Developer | SergeyBiryukov |
Plugin | Rus-To-Lat |
Version | 0.3 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.3
- readme.txt +14 -3
- rus-to-lat.php +90 -21
readme.txt
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
=== Rus-To-Lat ===
|
2 |
-
Contributors: Anton Skorobogatov
|
3 |
Tags: l10n, translations, transliteration, slugs, russian, rustolat
|
4 |
Requires at least: 1.5
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 0.
|
7 |
|
8 |
Converts Cyrillic characters in post slugs to Latin characters.
|
9 |
|
10 |
== Description ==
|
11 |
|
|
|
|
|
|
|
|
|
12 |
Converts Cyrillic characters in post slugs to Latin characters. Very useful for Russian-speaking users of WordPress.
|
13 |
You can use this plugin for creating human-readable links.
|
14 |
|
@@ -21,5 +25,12 @@ Thanks to Alexander Shilyaev for the idea.
|
|
21 |
|
22 |
== Changelog ==
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
= 0.1 =
|
25 |
* Initial release
|
1 |
=== Rus-To-Lat ===
|
2 |
+
Contributors: Anton Skorobogatov, Andrey Serebryakov, SergeyBiryukov
|
3 |
Tags: l10n, translations, transliteration, slugs, russian, rustolat
|
4 |
Requires at least: 1.5
|
5 |
+
Tested up to: 2.2.3
|
6 |
+
Stable tag: 0.3
|
7 |
|
8 |
Converts Cyrillic characters in post slugs to Latin characters.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
**This plugin is available for reference only. Its functionality has been replaced and extended by [Cyr-To-Lat](http://wordpress.org/extend/plugins/cyr2lat/).**
|
13 |
+
|
14 |
+
*The original author of this plugin is Anton Skorobogatov, who passed away prematurely in 2007. I decided to make it available for installation through the Plugin Browser/Installer. I take no credit for the creation of this plugin.*
|
15 |
+
|
16 |
Converts Cyrillic characters in post slugs to Latin characters. Very useful for Russian-speaking users of WordPress.
|
17 |
You can use this plugin for creating human-readable links.
|
18 |
|
25 |
|
26 |
== Changelog ==
|
27 |
|
28 |
+
= 0.3 =
|
29 |
+
* Added ISO 9-95 standard
|
30 |
+
|
31 |
+
= 0.2 =
|
32 |
+
* Added GOST 16876-71 standard
|
33 |
+
* Added options page
|
34 |
+
|
35 |
= 0.1 =
|
36 |
* Initial release
|
rus-to-lat.php
CHANGED
@@ -1,34 +1,103 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: RusToLat
|
4 |
-
Plugin URI: http://
|
5 |
Description: This plugin converts Cyrillic characters in post slugs to Latin characters. Very useful for Russian-speaking users of WordPress. You can use this plugin for creating human-readable links. Thanks to Alexander Shilyaev for the idea. Send your suggestions and critics to <a href="mailto:skorobogatov@gmail.com">skorobogatov@gmail.com</a>.
|
6 |
-
Author: Anton Skorobogatov
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
*/
|
10 |
-
|
11 |
-
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
"
|
|
|
22 |
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
23 |
-
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"
|
24 |
-
"ц"=>"
|
25 |
-
"ы"=>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
);
|
27 |
|
28 |
function sanitize_title_with_translit($title) {
|
29 |
-
global $
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
|
|
33 |
add_action('sanitize_title', 'sanitize_title_with_translit', 0);
|
34 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: RusToLat
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/rustolat/
|
5 |
Description: This plugin converts Cyrillic characters in post slugs to Latin characters. Very useful for Russian-speaking users of WordPress. You can use this plugin for creating human-readable links. Thanks to Alexander Shilyaev for the idea. Send your suggestions and critics to <a href="mailto:skorobogatov@gmail.com">skorobogatov@gmail.com</a>.
|
6 |
+
Author: Anton Skorobogatov <skorobogatov@gmail.com>
|
7 |
+
Contributor: Andrey Serebryakov <saahov@gmail.com>
|
8 |
+
Contributor: Sergey Biryukov <sergeybiryukov.ru@gmail.com>
|
9 |
+
Author URI: http://skorobogatov.ru/
|
10 |
+
Version: 0.3
|
11 |
*/
|
12 |
+
|
13 |
+
$gost = array(
|
14 |
+
"Є"=>"EH","І"=>"I","і"=>"i","№"=>"#","є"=>"eh",
|
15 |
+
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D",
|
16 |
+
"Е"=>"E","Ё"=>"JO","Ж"=>"ZH",
|
17 |
+
"З"=>"Z","И"=>"I","Й"=>"JJ","К"=>"K","Л"=>"L",
|
18 |
+
"М"=>"M","Н"=>"N","О"=>"O","П"=>"P","Р"=>"R",
|
19 |
+
"С"=>"S","Т"=>"T","У"=>"U","Ф"=>"F","Х"=>"KH",
|
20 |
+
"Ц"=>"C","Ч"=>"CH","Ш"=>"SH","Щ"=>"SHH","Ъ"=>"'",
|
21 |
+
"Ы"=>"Y","Ь"=>"","Э"=>"EH","Ю"=>"YU","Я"=>"YA",
|
22 |
+
"а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d",
|
23 |
+
"е"=>"e","ё"=>"jo","ж"=>"zh",
|
24 |
+
"з"=>"z","и"=>"i","й"=>"jj","к"=>"k","л"=>"l",
|
25 |
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
26 |
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"kh",
|
27 |
+
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"",
|
28 |
+
"ы"=>"y","ь"=>"","э"=>"eh","ю"=>"yu","я"=>"ya",
|
29 |
+
"—"=>"-","«"=>"","»"=>"","…"=>""
|
30 |
+
);
|
31 |
+
|
32 |
+
$iso = array(
|
33 |
+
"Є"=>"YE","І"=>"I","Ѓ"=>"G","і"=>"i","№"=>"#","є"=>"ye","ѓ"=>"g",
|
34 |
+
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D",
|
35 |
+
"Е"=>"E","Ё"=>"YO","Ж"=>"ZH",
|
36 |
+
"З"=>"Z","И"=>"I","Й"=>"J","К"=>"K","Л"=>"L",
|
37 |
+
"М"=>"M","Н"=>"N","О"=>"O","П"=>"P","Р"=>"R",
|
38 |
+
"С"=>"S","Т"=>"T","У"=>"U","Ф"=>"F","Х"=>"X",
|
39 |
+
"Ц"=>"C","Ч"=>"CH","Ш"=>"SH","Щ"=>"SHH","Ъ"=>"'",
|
40 |
+
"Ы"=>"Y","Ь"=>"","Э"=>"E","Ю"=>"YU","Я"=>"YA",
|
41 |
+
"а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d",
|
42 |
+
"е"=>"e","ё"=>"yo","ж"=>"zh",
|
43 |
+
"з"=>"z","и"=>"i","й"=>"j","к"=>"k","л"=>"l",
|
44 |
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
45 |
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"x",
|
46 |
+
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"",
|
47 |
+
"ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
|
48 |
+
"—"=>"-","«"=>"","»"=>"","…"=>""
|
49 |
);
|
50 |
|
51 |
function sanitize_title_with_translit($title) {
|
52 |
+
global $gost, $iso;
|
53 |
+
$rtl_standard = get_option('rtl_standard');
|
54 |
+
switch ($rtl_standard) {
|
55 |
+
case 'off':
|
56 |
+
return $title;
|
57 |
+
case 'gost':
|
58 |
+
return strtr($title, $gost);
|
59 |
+
default:
|
60 |
+
return strtr($title, $iso);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
function rtl_options_page() {
|
65 |
+
?>
|
66 |
+
<div class="wrap">
|
67 |
+
<h2>Настройки RusToLat</h2>
|
68 |
+
<p>Вы можете выбрать стандарт, по которому будет производиться транслитерация заголовков.</p>
|
69 |
+
<?php
|
70 |
+
if($_POST['rtl_standard']) {
|
71 |
+
// set the post formatting options
|
72 |
+
update_option('rtl_standard', $_POST['rtl_standard']);
|
73 |
+
echo '<div class="updated"><p>Настройки обновлены.</p></div>';
|
74 |
+
}
|
75 |
+
?>
|
76 |
+
|
77 |
+
<form method="post">
|
78 |
+
<fieldset class="options">
|
79 |
+
<legend>Производить транслитерацию в стандарте:</legend>
|
80 |
+
<?php
|
81 |
+
$rtl_standard = get_option('rtl_standard');
|
82 |
+
?>
|
83 |
+
<select name="rtl_standard">
|
84 |
+
<option value="off"<?php if($rtl_standard == 'off'){ echo(' selected="selected"');}?>>Отключена</option>
|
85 |
+
<option value="gost"<?php if($rtl_standard == 'gost'){ echo(' selected="selected"');}?>>ГОСТ 16876-71</option>
|
86 |
+
<option value="iso"<?php if($rtl_standard == 'iso' OR $rtl_standard == ''){ echo(' selected="selected"');}?>>ISO 9-95</option>
|
87 |
+
</select>
|
88 |
+
|
89 |
+
<input type="submit" value="Изменить стандарт" />
|
90 |
+
|
91 |
+
</fieldset>
|
92 |
+
</form>
|
93 |
+
</div>
|
94 |
+
<?php
|
95 |
+
}
|
96 |
+
|
97 |
+
function rtl_add_menu() {
|
98 |
+
add_options_page('RusToLat', 'RusToLat', 8, __FILE__, 'rtl_options_page');
|
99 |
}
|
100 |
|
101 |
+
add_action('admin_menu', 'rtl_add_menu');
|
102 |
add_action('sanitize_title', 'sanitize_title_with_translit', 0);
|
103 |
?>
|