Version Description
- Added GOST 16876-71 standard
- Added options page
Download this release
Release Info
Developer | SergeyBiryukov |
Plugin | Rus-To-Lat |
Version | 0.2 |
Comparing to | |
See all releases |
Version 0.2
- readme.txt +29 -0
- rus-to-lat.php +99 -0
readme.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Rus-To-Lat ===
|
2 |
+
Contributors: Anton Skorobogatov, Andrey Serebryakov
|
3 |
+
Tags: l10n, translations, transliteration, slugs, russian, rustolat
|
4 |
+
Requires at least: 1.5
|
5 |
+
Tested up to: 2.1.3
|
6 |
+
Stable tag: 0.2
|
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 |
+
|
15 |
+
Thanks to Alexander Shilyaev for the idea.
|
16 |
+
|
17 |
+
== Installation ==
|
18 |
+
|
19 |
+
1. Upload `rustolat` folder to the `/wp-content/plugins/` directory.
|
20 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
21 |
+
|
22 |
+
== Changelog ==
|
23 |
+
|
24 |
+
= 0.2 =
|
25 |
+
* Added GOST 16876-71 standard
|
26 |
+
* Added options page
|
27 |
+
|
28 |
+
= 0.1 =
|
29 |
+
* Initial release
|
rus-to-lat.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: RusToLat
|
4 |
+
Plugin URI: http://mywordpress.ru/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 |
+
Author URI: http://skorobogatov.ru/
|
9 |
+
Version: 0.2
|
10 |
+
*/
|
11 |
+
$gost = array(
|
12 |
+
"Г"=>"G","Ё"=>"JO","Є"=>"EH","Ы"=>"Y","І"=>"I",
|
13 |
+
"і"=>"i","г"=>"g","ё"=>"jo","№"=>"#","є"=>"eh",
|
14 |
+
"ы"=>"y","А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
15 |
+
"Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
16 |
+
"Й"=>"JJ","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
17 |
+
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
18 |
+
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"C","Ч"=>"CH",
|
19 |
+
"Ш"=>"SH","Щ"=>"SHH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
|
20 |
+
"Э"=>"EH","Ю"=>"JU","Я"=>"JA","а"=>"a","б"=>"b",
|
21 |
+
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
|
22 |
+
"з"=>"z","и"=>"i","й"=>"jj","к"=>"k","л"=>"l",
|
23 |
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
24 |
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
|
25 |
+
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"'",
|
26 |
+
"ы"=>"y","ь"=>"","э"=>"eh","ю"=>"ju","я"=>"ja"
|
27 |
+
);
|
28 |
+
|
29 |
+
$original = array(
|
30 |
+
"Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
|
31 |
+
"і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
|
32 |
+
"ї"=>"yi","А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
33 |
+
"Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
34 |
+
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
35 |
+
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
36 |
+
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
|
37 |
+
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"YI","Ь"=>"",
|
38 |
+
"Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
|
39 |
+
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
|
40 |
+
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
|
41 |
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
42 |
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
|
43 |
+
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
|
44 |
+
"ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya"
|
45 |
+
);
|
46 |
+
|
47 |
+
function sanitize_title_with_translit($title) {
|
48 |
+
global $gost, $original;
|
49 |
+
$rtl_standard = get_option('rtl_standard');
|
50 |
+
switch ($rtl_standard) {
|
51 |
+
case 'off':
|
52 |
+
return $title;
|
53 |
+
case 'gost':
|
54 |
+
return strtr($title, $gost);
|
55 |
+
default:
|
56 |
+
return strtr($title, $original);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
function rtl_options_page() {
|
61 |
+
?>
|
62 |
+
<div class="wrap">
|
63 |
+
<h2>Настройки RusToLat</h2>
|
64 |
+
<p>Вы можете выбрать стандарт, по которому будет производиться транслитерация заголовков.</p>
|
65 |
+
<?php
|
66 |
+
if($_POST['rtl_standard']) {
|
67 |
+
// set the post formatting options
|
68 |
+
update_option('rtl_standard', $_POST['rtl_standard']);
|
69 |
+
echo '<div class="updated"><p>Настройки обновлены.</p></div>';
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
|
73 |
+
<form method="post">
|
74 |
+
<fieldset class="options">
|
75 |
+
<legend>Производить транслитерацию в стандарте:</legend>
|
76 |
+
<?php
|
77 |
+
$rtl_standard = get_option('rtl_standard');
|
78 |
+
?>
|
79 |
+
<select name="rtl_standard">
|
80 |
+
<option value="off"<?php if($rtl_standard == 'off'){ echo(' selected="selected"');}?>>Отключена</option>
|
81 |
+
<option value="original"<?php if($rtl_standard == 'original' OR $rtl_standard == ''){ echo(' selected="selected"');}?>>По умолчанию</option>
|
82 |
+
<option value="gost"<?php if($rtl_standard == 'gost'){ echo(' selected="selected"');}?>>ГОСТ 16876-71</option>
|
83 |
+
</select>
|
84 |
+
|
85 |
+
<input type="submit" value="Изменить стандарт" />
|
86 |
+
|
87 |
+
</fieldset>
|
88 |
+
</form>
|
89 |
+
</div>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
|
93 |
+
function rtl_add_menu() {
|
94 |
+
add_options_page('RusToLat', 'RusToLat', 8, __FILE__, 'rtl_options_page');
|
95 |
+
}
|
96 |
+
|
97 |
+
add_action('admin_menu', 'rtl_add_menu');
|
98 |
+
add_action('sanitize_title', 'sanitize_title_with_translit', 0);
|
99 |
+
?>
|