WP Translitera - Version 160123

Version Description

  • Added multilanguage suport (pot file include)
Download this release

Release Info

Developer YurchenkoEV
Plugin Icon wp plugin WP Translitera
Version 160123
Comparing to
See all releases

Code changes from version 150712 to 160123

info.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ init 1.5.0
16
+ sanitize_title(*,*) 1.0.0
17
+ sanitize_title(*,*,*) 3.1.0 -
18
+ add_options_page 1.5.0
19
+ load_plugin_textdomain(*,false,*) 2.7.0
20
+ $wpdb 0.71
21
+
22
+ //****************************************************
23
+ Function PHP PHP ver
24
+ array 5.2.4
25
+ filter_input 5.2.4
26
+ foreach 5.2.4
27
+ empty 5.2.4
28
+ strtr 5.2.4
29
+ urldecode 5.2.4
languages/wp_translitera-ru_RU.mo ADDED
Binary file
languages/wp_translitera-ru_RU.po ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wp_translitera\n"
4
+ "POT-Creation-Date: 2016-01-23 14:09+0200\n"
5
+ "PO-Revision-Date: 2016-01-23 14:10+0200\n"
6
+ "Last-Translator: Evgenij Yurchenko <evgen@yur4enko.com>\n"
7
+ "Language-Team: \n"
8
+ "Language: ru_RU\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.6\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __\n"
18
+ "X-Poedit-SearchPath-0: wp-translitera.php\n"
19
+
20
+ #: wp-translitera.php:55
21
+ msgid "Convert existing"
22
+ msgstr "Преобразовать существующие"
23
+
24
+ #: wp-translitera.php:57
25
+ msgid "Pages and posts"
26
+ msgstr "Страницы и посты"
27
+
28
+ #: wp-translitera.php:58
29
+ msgid "Headings, tags etc..."
30
+ msgstr "Рубрики, теги и тд"
31
+
32
+ #: wp-translitera.php:59
33
+ msgid "Transliterate"
34
+ msgstr "Транслитерировать"
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
- === Plugin Name ===
2
  Contributors: YurchenkoEV
3
  Donate link: http://yur4enko.com/
4
- Tags: spam, mail, protection
5
- Requires at least: 1.2
6
- Tested up to: 4.2.2
7
- Stable tag: 4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Transliteration plugin
12
 
13
  == Description ==
14
 
15
- Transliteration plugin
16
 
17
  == Installation ==
18
 
@@ -23,15 +23,21 @@ Automatical from repository or unzip in plugins and activate in ACP.
23
  == Screenshots ==
24
 
25
  == Changelog ==
26
- all info:
27
- http://azbuki.info/viewforum.php?f=32
28
 
29
- == Upgrade Notice ==
30
- After update deactivate and activate plugin
 
 
 
 
 
 
31
 
32
- == Arbitrary section ==
33
- --
34
 
35
- == A brief Markdown Example ==
 
36
 
37
- `<?php code(); // goes in backticks ?>`
 
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
7
+ Stable tag: 160123
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
 
27
+ = 160123 =
28
+ * Added multilanguage suport (pot file include)
29
+
30
+ = 160119 =
31
+ * Update readme.txt
32
+ * Added info.txt
33
+ * Added ACP menu
34
+ * Added the ability to rename the old labels
35
 
36
+ = 150808 =
37
+ * Update for WordPress 4.4
38
 
39
+ = 150712 =
40
+ * Release
41
 
42
+ == Upgrade Notice ==
43
+ After update deactivate and activate plugin
wp-translitera.php CHANGED
@@ -1,10 +1,12 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Translitera
4
- Plugin URI: http://azbuki.info/viewforum.php?f=32
5
- Description: Protection from spam through your blog
6
- Version: 150712
7
  Author: Evgen Yurchenko
 
 
8
  Author URI: http://yur4enko.com/
9
  */
10
 
@@ -26,7 +28,8 @@ 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 +44,59 @@ class wp_translitera {
41
  );
42
  return strtr($title, $to);
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
- add_action('sanitize_title', array('wp_translitera','transliterate'), 0);
 
 
 
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: 160123
7
  Author: Evgen Yurchenko
8
+ Text Domain: wp_translitera
9
+ Domain Path: /languages/
10
  Author URI: http://yur4enko.com/
11
  */
12
 
28
  */
29
 
30
  class wp_translitera {
31
+ //Процедура преобразования символов
32
+ public static function transliterate($title) {//wp=>0.0.0 php=>5.2.4
33
  $to = array(
34
  'А'=>'A','а'=>'a','Б'=>'B','б'=>'b','В'=>'V','в'=>'v','Г'=>'G',
35
  'г'=>'g','Д'=>'D','д'=>'d','Е'=>'E','е'=>'e','Ё'=>'Jo','ё'=>'jo',
44
  );
45
  return strtr($title, $to);
46
  }
47
+
48
+ //Добавляем раздел в админку
49
+ public static function add_menu(){//wp=>1.5.0 php=>5.2.4
50
+ add_options_page('WP Translitera', 'Translitera', 'activate_plugins', __FILE__, array('wp_translitera','main_settings'));
51
+ }
52
+
53
+ //Форма админки
54
+ public static function GetForm() {//wp=>0.0.0 php=>5.2.4
55
+ $ret = '<h2>'.__('Convert existing','wp_translitera').':</h2></br>'
56
+ . '<form method=POST> '
57
+ . '<input type="checkbox" name="r1" value="1">'.__('Pages and posts','wp_translitera').'<br></br>'
58
+ . '<input type="checkbox" name="r2" value="1">'.__('Headings, tags etc...','wp_translitera').'<br></br>'
59
+ . '<input type="submit" value="'.__('Transliterate','wp_translitera').'" name="apply"></form>';
60
+ return $ret;
61
+ }
62
+
63
+ //Транслитерация в БД
64
+ public static function do_transliterte($table,$id,$name) {//wp=>0.71 php=>5.2.4
65
+ global $wpdb;
66
+ $rez = $wpdb->get_results("SELECT {$id}, {$name} FROM {$table} WHERE 1",ARRAY_A);
67
+ foreach ($rez as $value) {
68
+ $tmp_name = wp_translitera::transliterate(urldecode($value[$name]));
69
+ if ($tmp_name != $value[$name]) {
70
+ $wpdb->update($table,array($name=>$tmp_name),array($id=>$value[$id]));
71
+ }
72
+ }
73
+ }
74
+
75
+ //Модуль формы админки
76
+ public static function main_settings() {//wp=>0.71 php=>5.2.4
77
+ global $wpdb;
78
+ $act = filter_input(INPUT_POST,'apply');
79
+ if (!empty($act)) {
80
+ $r1 = filter_input(INPUT_POST, 'r1');
81
+ $r2 = filter_input(INPUT_POST, 'r2');
82
+ if (!empty($r1)) {
83
+ wp_translitera::do_transliterte($wpdb->posts, 'ID', 'post_name');
84
+ }
85
+ if (!empty($r2)){
86
+ wp_translitera::do_transliterte($wpdb->terms, 'term_id', 'slug');
87
+ }
88
+
89
+ }
90
+ echo wp_translitera::GetForm();
91
+ }
92
+
93
+ //Инициализация языка
94
+ public static function initlang() {//wp=>0.71 php=>5.2.4
95
+ load_plugin_textdomain('wp_translitera', false, dirname(plugin_basename(__FILE__)).'/languages');
96
+ }
97
  }
98
 
99
+ //wp=>1.5.2 php=>5.2.4
100
+ add_action('sanitize_title', array('wp_translitera','transliterate'), 0);
101
+ add_action('admin_menu', array('wp_translitera', 'add_menu'));
102
+ add_action('init', array('wp_translitera', 'initlang'));