Version Description
- Update readme.txt
- Added info.txt
- Added ACP menu
- Added the ability to rename the old labels
Download this release
Release Info
Developer | YurchenkoEV |
Plugin | WP Translitera |
Version | 160119 |
Comparing to | |
See all releases |
Code changes from version 150712 to 160119
- info.txt +27 -0
- readme.txt +18 -16
- wp-translitera.php +56 -5
info.txt
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//****************************************************
|
2 |
+
PluginFunction WP ver PHP ver
|
3 |
+
transliterate 0.0.0 5.2.4
|
4 |
+
add_menu 1.5.0 5.2.4
|
5 |
+
GetForm 0.0.0 5.2.4
|
6 |
+
do_transliterte 0.71 5.2.4
|
7 |
+
main_settings 0.71 5.2.4
|
8 |
+
|
9 |
+
hook 1.5.2 5.2.4
|
10 |
+
|
11 |
+
//****************************************************
|
12 |
+
FunctionWP WP ver
|
13 |
+
add_action 1.2.0
|
14 |
+
admin_menu 1.5.2
|
15 |
+
sanitize_title(*,*) 1.0.0
|
16 |
+
sanitize_title(*,*,*) 3.1.0 -
|
17 |
+
add_options_page 1.5.0
|
18 |
+
$wpdb 0.71
|
19 |
+
|
20 |
+
//****************************************************
|
21 |
+
Function PHP PHP ver
|
22 |
+
array 5.2.4
|
23 |
+
filter_input 5.2.4
|
24 |
+
foreach 5.2.4
|
25 |
+
empty 5.2.4
|
26 |
+
strtr 5.2.4
|
27 |
+
urldecode 5.2.4
|
readme.txt
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
Contributors: YurchenkoEV
|
3 |
Donate link: http://yur4enko.com/
|
4 |
-
Tags:
|
5 |
-
Requires at least: 1.2
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
|
16 |
|
17 |
== Installation ==
|
18 |
|
@@ -23,15 +23,17 @@ Automatical from repository or unzip in plugins and activate in ACP.
|
|
23 |
== Screenshots ==
|
24 |
|
25 |
== Changelog ==
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
== Arbitrary section ==
|
33 |
-
--
|
34 |
|
35 |
-
|
|
|
36 |
|
37 |
-
|
|
1 |
+
=== Plugin Name ===
|
2 |
Contributors: YurchenkoEV
|
3 |
Donate link: http://yur4enko.com/
|
4 |
+
Tags: translate, rus-to-lat, Seo, tag, record, page
|
5 |
+
Requires at least: 1.5.2
|
6 |
+
Tested up to: 4.5-alpha
|
7 |
+
Stable tag: 4.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Plug-in for transliteration permanent permalink records , pages, and tag
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Plug-in for transliteration permanent permalink records , pages, and tag
|
16 |
|
17 |
== Installation ==
|
18 |
|
23 |
== Screenshots ==
|
24 |
|
25 |
== Changelog ==
|
26 |
+
= 160119 =
|
27 |
+
* Update readme.txt
|
28 |
+
* Added info.txt
|
29 |
+
* Added ACP menu
|
30 |
+
* Added the ability to rename the old labels
|
31 |
|
32 |
+
= 150808 =
|
33 |
+
* Update for WordPress 4.4
|
|
|
|
|
|
|
34 |
|
35 |
+
= 150712 =
|
36 |
+
* Release
|
37 |
|
38 |
+
== Upgrade Notice ==
|
39 |
+
After update deactivate and activate plugin
|
wp-translitera.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP Translitera
|
4 |
-
Plugin URI: http://
|
5 |
-
Description:
|
6 |
-
Version:
|
7 |
Author: Evgen Yurchenko
|
8 |
Author URI: http://yur4enko.com/
|
9 |
*/
|
@@ -26,7 +26,7 @@ Author URI: http://yur4enko.com/
|
|
26 |
*/
|
27 |
|
28 |
class wp_translitera {
|
29 |
-
public static function transliterate($title) {
|
30 |
$to = array(
|
31 |
'А'=>'A','а'=>'a','Б'=>'B','б'=>'b','В'=>'V','в'=>'v','Г'=>'G',
|
32 |
'г'=>'g','Д'=>'D','д'=>'d','Е'=>'E','е'=>'e','Ё'=>'Jo','ё'=>'jo',
|
@@ -41,6 +41,57 @@ class wp_translitera {
|
|
41 |
);
|
42 |
return strtr($title, $to);
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
-
|
|
|
|
1 |
<?php
|
2 |
/*
|
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: 160119
|
7 |
Author: Evgen Yurchenko
|
8 |
Author URI: http://yur4enko.com/
|
9 |
*/
|
26 |
*/
|
27 |
|
28 |
class wp_translitera {
|
29 |
+
public static function transliterate($title) {//wp=>0.0.0 php=>5.2.4
|
30 |
$to = array(
|
31 |
'А'=>'A','а'=>'a','Б'=>'B','б'=>'b','В'=>'V','в'=>'v','Г'=>'G',
|
32 |
'г'=>'g','Д'=>'D','д'=>'d','Е'=>'E','е'=>'e','Ё'=>'Jo','ё'=>'jo',
|
41 |
);
|
42 |
return strtr($title, $to);
|
43 |
}
|
44 |
+
|
45 |
+
public static function add_menu(){//wp=>1.5.0 php=>5.2.4
|
46 |
+
add_options_page('WP Translitera', 'Translitera', 'activate_plugins', __FILE__, array('wp_translitera','main_settings'));
|
47 |
+
}
|
48 |
+
|
49 |
+
public static function GetForm() {//wp=>0.0.0 php=>5.2.4
|
50 |
+
$ret = '<h2>Настройки:</h2></br>'
|
51 |
+
. '<form method=POST> '
|
52 |
+
. '<input type="checkbox" name="r1" value="1">Страницы и посты<br></br>'
|
53 |
+
. '<input type="checkbox" name="r2" value="1">Рубрики теги и тд<br></br>'
|
54 |
+
. '<input type="submit" value="Транслитерировать" name="apply"></form>';
|
55 |
+
return $ret;
|
56 |
+
}
|
57 |
+
|
58 |
+
public static function do_transliterte($table,$id,$name) {//wp=>0.71 php=>5.2.4
|
59 |
+
global $wpdb;
|
60 |
+
$rez = $wpdb->get_results("SELECT {$id}, {$name} FROM {$table} WHERE 1",ARRAY_A);
|
61 |
+
foreach ($rez as $value) {
|
62 |
+
$tmp_name = wp_translitera::transliterate(urldecode($value[$name]));
|
63 |
+
if ($tmp_name != $value[$name]) {
|
64 |
+
$wpdb->update($table,array($name=>$tmp_name),array($id=>$value[$id]));
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
public static function main_settings() {//wp=>0.71 php=>5.2.4
|
70 |
+
global $wpdb;
|
71 |
+
$act = filter_input(INPUT_POST,'apply');
|
72 |
+
if (!empty($act)) {
|
73 |
+
$r1 = filter_input(INPUT_POST, 'r1');
|
74 |
+
$r2 = filter_input(INPUT_POST, 'r2');
|
75 |
+
if (!empty($r1)) {
|
76 |
+
wp_translitera::do_transliterte($wpdb->posts, 'ID', 'post_name');
|
77 |
+
//$rez = $wpdb->get_results("SELECT ID, post_name FROM {$wpdb->posts} WHERE 1",ARRAY_A);
|
78 |
+
//foreach ($rez as $value) {
|
79 |
+
// $wpdb->update($wpdb->posts,array('post_name'=>wp_translitera::prepare_cont($value['post_name'])),array('ID'=>$value['ID']));
|
80 |
+
//}
|
81 |
+
}
|
82 |
+
if (!empty($r2)){
|
83 |
+
wp_translitera::do_transliterte($wpdb->terms, 'term_id', 'slug');
|
84 |
+
//$rez = $wpdb->get_results("SELECT term_id, slug FROM {$wpdb->terms} WHERE 1",ARRAY_A);
|
85 |
+
//foreach ($rez as $value) {
|
86 |
+
// $wpdb->update($wpdb->terms,array('slug'=>wp_translitera::prepare_cont($value['slug'])),array('term_id'=>$value['term_id']));
|
87 |
+
//}
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
echo wp_translitera::GetForm();
|
92 |
+
}
|
93 |
}
|
94 |
|
95 |
+
//wp=>1.5.2 php=>5.2.4
|
96 |
+
add_action('sanitize_title', array('wp_translitera','transliterate'), 0);
|
97 |
+
add_action('admin_menu', array('wp_translitera', 'add_menu'));
|