Version Description
- Added check for existing terms
Download this release
Release Info
Developer | SergeyBiryukov |
Plugin | Cyr-To-Lat |
Version | 2.0 |
Comparing to | |
See all releases |
Version 2.0
- cyr-to-lat.php +35 -0
- readme.txt +30 -0
cyr-to-lat.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Cyr-To-Lat
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/cyr2lat/
|
5 |
+
Description: This plugin converts Cyrillic characters in post taxonomy to Latin characters. Useful for creating human-readable URLs. Thanks to Alexander Shilyaev for the idea and to Anton Skorobogatov for the implementation.
|
6 |
+
Author: Sol
|
7 |
+
Author URI: http://ru.wordpress.org/
|
8 |
+
Version: 2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
function sanitize_term_translate ($title) {
|
12 |
+
$cyr2lat_table = array(
|
13 |
+
"Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
|
14 |
+
"і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
|
15 |
+
"ї"=>"yi","А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
16 |
+
"Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
17 |
+
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
18 |
+
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
19 |
+
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
|
20 |
+
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"YI","Ь"=>"",
|
21 |
+
"Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
|
22 |
+
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
|
23 |
+
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
|
24 |
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
25 |
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
|
26 |
+
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
|
27 |
+
"ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya"
|
28 |
+
);
|
29 |
+
|
30 |
+
global $wpdb;
|
31 |
+
if ($term = $wpdb->get_var("SELECT slug FROM $wpdb->terms WHERE name='$title'")) return $term; else return strtr($title,$cyr2lat_table);
|
32 |
+
}
|
33 |
+
|
34 |
+
add_action('sanitize_title', 'sanitize_term_translate', 0);
|
35 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Cyr-To-Lat ===
|
2 |
+
Contributors: Atrax
|
3 |
+
Tags: l10n, translations, transliteration, slugs, russian, rustolat
|
4 |
+
Requires at least: 2.3
|
5 |
+
Tested up to: 3.0
|
6 |
+
Stable tag: 2.1
|
7 |
+
|
8 |
+
Converts Cyrillic characters in post and term slugs to Latin characters.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
|
12 |
+
Converts Cyrillic characters in post and term slugs to Latin characters. Useful for creating human-readable URLs.
|
13 |
+
|
14 |
+
Based on the original Rus-To-Lat plugin by Anton Skorobogatov.
|
15 |
+
|
16 |
+
== Installation ==
|
17 |
+
|
18 |
+
1. Upload `cyr2lat` folder to the `/wp-content/plugins/` directory.
|
19 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
20 |
+
|
21 |
+
== Changelog ==
|
22 |
+
|
23 |
+
= 2.0 =
|
24 |
+
* Added check for existing terms
|
25 |
+
|
26 |
+
= 1.0.1 =
|
27 |
+
* Updated description
|
28 |
+
|
29 |
+
= 1.0 =
|
30 |
+
* Initial release
|