qTranslate X - Version 2.9

Version Description

  • ability to enable "Custom Fields" by either "id" or "class" attribute.
  • ability to specify filters, which other theme or plugins define, to pass relevant data through the translation.
  • support for <!--more--> and <!--nextpage--> tags.
  • language cookie are renamed to minimize possible interference with other sites.
Download this release

Release Info

Developer johnclause
Plugin Icon wp plugin qTranslate X
Version 2.9
Comparing to
See all releases

Code changes from version 2.9.2 to 2.9

admin/xhaleera_addons.php DELETED
@@ -1,356 +0,0 @@
1
- <?php // encoding: utf-8
2
- /*
3
- Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program; if not, write to the Free Software
17
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
- */
19
-
20
- function mqtrans_import_settings_from_qtrans() {
21
- global $wpdb;
22
-
23
- $option_names = $wpdb->get_col("SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE 'qtranslate\_%'");
24
- foreach ($option_names as $name)
25
- {
26
- $opt = get_option($name);
27
-
28
- $nn = "m{$name}";
29
- if ( false !== get_option($nn) )
30
- update_option($nn, $opt);
31
- else
32
- add_option($nn, $opt);
33
- }
34
- }
35
-
36
- function mqtrans_export_setting_to_qtrans($updateOnly = false) {
37
- global $wpdb;
38
-
39
- $option_names = $wpdb->get_col("SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE 'mqtranslate\_%'");
40
- foreach ($option_names as $name)
41
- {
42
- $opt = get_option($name);
43
-
44
- $nn = substr($name, 1);
45
- if ( false !== get_option($nn) )
46
- update_option($nn, $opt);
47
- else if (!$updateOnly)
48
- add_option($nn, $opt);
49
- }
50
- }
51
-
52
- function mqtrans_currentUserCanEdit($lang) {
53
- global $q_config;
54
-
55
- $cu = wp_get_current_user();
56
- if ($cu->has_cap('edit_users') || empty($q_config['ul_lang_protection']))
57
- return true;
58
- else
59
- {
60
- $user_meta = get_user_meta($cu->ID);
61
- if (empty($user_meta) || !is_array($user_meta) || !array_key_exists('mqtranslate_language_access', $user_meta))
62
- $user_langs = $q_config['enabled_languages'];
63
- else
64
- $user_langs = explode(',', get_user_meta($cu->ID, 'mqtranslate_language_access', true));
65
- return in_array($lang, $user_langs);
66
- }
67
- }
68
-
69
- function mqtrans_currentUserCanView($lang) {
70
- global $q_config;
71
-
72
- $cu = wp_get_current_user();
73
- if ($cu->has_cap('edit_users') || empty($q_config['ul_lang_protection']))
74
- return true;
75
- else
76
- {
77
- $master_lang = get_user_meta($cu->ID, 'mqtranslate_master_language', true);
78
- if (empty($master_lang))
79
- return ($lang === $q_config['default_language']);
80
- else
81
- return ($lang === $master_lang || $lang === $q_config['default_language']);
82
- }
83
- }
84
-
85
- function mqtrans_userProfile($user) {
86
- global $q_config;
87
-
88
- if (empty($q_config['ul_lang_protection']))
89
- return;
90
-
91
- $cu = wp_get_current_user();
92
- $langs = qtrans_getSortedLanguages();
93
-
94
- echo '<h3>'.__('mqTranslate User Language Settings', 'mqtranslate') . "</h3>\n";
95
- echo "<table class=\"form-table\">\n<tbody>\n";
96
-
97
- // Editable languages
98
- $user_meta = get_user_meta($user->ID);
99
- if (empty($user_meta) || !is_array($user_meta) || !array_key_exists('mqtranslate_language_access', $user_meta))
100
- $user_langs = $q_config['enabled_languages'];
101
- else
102
- $user_langs = explode(',', get_user_meta($user->ID, 'mqtranslate_language_access', true));
103
- echo "<tr>\n";
104
- if ($cu->ID == $user->ID)
105
- echo '<th>'.__('You can edit posts in', 'mqtranslate') . "</th>\n";
106
- else
107
- echo '<th>'.__('This user can edit posts in', 'mqtranslate') . "</th>\n";
108
- echo "<td>";
109
- if ($user->has_cap('edit_users'))
110
- {
111
- if (empty($langs))
112
- _e('No language available', 'mqtranslate');
113
- else if ($cu->ID == $user->ID)
114
- _e('As an Administrator, you can edit posts in all languages.', 'mqtranslate');
115
- else
116
- _e('As an Administrator, this user can edit posts in all languages.', 'mqtranslate');
117
- }
118
- else if ($cu->has_cap('edit_users'))
119
- {
120
- if (empty($langs))
121
- _e('No language available', 'mqtranslate')."\n";
122
- else
123
- {
124
- $checkboxes = array();
125
- foreach ($langs as $l) {
126
- $name = "mqtrans_user_lang_{$l}";
127
- $checked = (in_array($l, $user_langs)) ? 'checked' : '';
128
- $checkboxes[] = "<label for=\"{$name}\"><input type=\"checkbox\" name=\"mqtrans_user_lang[]\" id=\"{$name}\" value=\"{$l}\" {$checked} /> {$q_config['language_name'][$l]}</label>\n";
129
- }
130
- echo implode("<br />\n", $checkboxes);
131
- }
132
- }
133
- else
134
- {
135
- $intersect = array_intersect($langs, $user_langs);
136
- if (empty($intersect))
137
- _e('No language selected', 'mqtranslate')."\n";
138
- else
139
- {
140
- $languages = array();
141
- foreach ($intersect as $l)
142
- $languages[] = $q_config['language_name'][$l];
143
- echo implode(', ', $languages);
144
- }
145
- }
146
- echo "</td>\n";
147
- echo "</tr>\n";
148
-
149
- // Master language
150
- $user_master_lang = get_user_meta($user->ID, 'mqtranslate_master_language', true);
151
- echo "<tr>\n";
152
- echo '<th>' . __('Master language', 'mqtranslate') . "</th>\n";
153
- echo "<td>\n";
154
- if ($user->has_cap('edit_users'))
155
- _e('Not applicable to Administrators', 'mqtranslate');
156
- else if ($cu->has_cap('edit_users'))
157
- {
158
- echo "<select name=\"mqtrans_master_lang\">\n";
159
- echo '<option value="">' . __('Default Language', 'mqtranslate') . "</option>\n";
160
- foreach ($langs as $l)
161
- {
162
- if ($l == $q_config['default_language'])
163
- continue;
164
- $selected = ($user_master_lang == $l) ? ' selected' : '';
165
- echo "<option value=\"{$l}\"{$selected}>{$q_config['language_name'][$l]}</option>\n";
166
- }
167
- echo "</select>\n";
168
- echo '<span class="description">' . __('Language from which texts should be translated by this user', 'mqtranslate') . "</span>\n";
169
- }
170
- else
171
- {
172
- if (empty($langs) || empty($user_master_lang) || !in_array($user_master_lang, $langs))
173
- _e('Default Language', 'mqtranslate');
174
- else
175
- echo $q_config['language_name'][$user_master_lang];
176
- }
177
- echo "</td>\n";
178
- echo "</tr>\n";
179
-
180
- echo "</tbody>\n</table>\n";
181
- }
182
-
183
- function mqtrans_userProfileUpdate($user_id) {
184
- global $q_config;
185
- $cu = wp_get_current_user();
186
- if ($cu->has_cap('edit_users') && !empty($q_config['ul_lang_protection'])) {
187
- // Editable languages
188
- $langs = (empty($_POST['mqtrans_user_lang'])) ? array() : $_POST['mqtrans_user_lang'];
189
- if (!is_array($langs))
190
- $langs = array();
191
- update_user_meta($user_id, 'mqtranslate_language_access', implode(',', $langs));
192
-
193
- // Master language
194
- if (empty($_POST['mqtrans_master_lang']))
195
- delete_user_meta($user_id, 'mqtranslate_master_language');
196
- else
197
- update_user_meta($user_id, 'mqtranslate_master_language', $_POST['mqtrans_master_lang']);
198
- }
199
- }
200
-
201
- function qtrans_isEmptyContent($value) {
202
- $str = trim(strip_tags($value, '<img>,<embed>,<object>'));
203
- return empty($str);
204
- }
205
-
206
- function mqtrans_postUpdated($post_ID, $after, $before) {
207
- global $wpdb, $q_config;
208
-
209
- // Don't handle custom post types
210
- if (!in_array($after->post_type, array( 'post', 'page' )) && !in_array($after->post_type, $q_config['allowed_custom_post_types']))
211
- return;
212
-
213
- $titleMap = array();
214
- $contentMap = array();
215
-
216
- $cu = wp_get_current_user();
217
- if ($cu->has_cap('edit_users') || empty($q_config['ul_lang_protection']))
218
- {
219
- $title = qtrans_split($after->post_title, true, $titleMap);
220
- foreach ($title as $k => $v) {
221
- if (qtrans_isEmptyContent($v))
222
- unset($title[$k]);
223
- }
224
- $content = qtrans_split($after->post_content, true, $contentMap);
225
- foreach ($content as $k => $v) {
226
- if (qtrans_isEmptyContent($v))
227
- unset($content[$k]);
228
- }
229
- }
230
- else
231
- {
232
- $titleBeforeMap = array();
233
- $titleBefore = qtrans_split($before->post_title, true, $titleBeforeMap);
234
- $titleAfter = qtrans_split($after->post_title, true, $titleMap);
235
- foreach ($titleAfter as $k => $v) {
236
- if (!mqtrans_currentUserCanEdit($k))
237
- unset($titleAfter[$k], $titleMap[$k]);
238
- }
239
- $title = array_merge($titleBefore, $titleAfter);
240
- $titleMap = array_merge($titleBeforeMap, $titleMap);
241
-
242
- $contentBeforeMap = array();
243
- $contentBefore = qtrans_split($before->post_content, true, $contentBeforeMap);
244
- $contentAfter = qtrans_split($after->post_content, true, $contentMap);
245
- foreach ($contentAfter as $k => $v) {
246
- if (qtrans_isEmptyContent($v) || !mqtrans_currentUserCanEdit($k))
247
- unset($contentAfter[$k], $contentMap[$k]);
248
- }
249
- $content = array_merge($contentBefore, $contentAfter);
250
- $contentMap = array_merge($contentBeforeMap, $contentMap);
251
- }
252
-
253
- $data = array('post_title' => qtrans_join($title, $titleMap), 'post_content' => qtrans_join($content, $contentMap));
254
- if (get_magic_quotes_gpc())
255
- $data = stripslashes_deep($data);
256
- $where = array('ID' => $post_ID);
257
-
258
- $wpdb->update($wpdb->posts, $data, $where);
259
- }
260
-
261
- function mqtrans_filterHomeURL($url, $path, $orig_scheme, $blog_id) {
262
- global $q_config;
263
- return ((empty($path) && $q_config['url_mode'] == QT_URL_PATH) || $path == '/' || !empty($q_config['url_info']['explicit_default_language'])) ? qtrans_convertURL($url, '', false, $q_config['url_info']['explicit_default_language']) : $url;
264
- }
265
-
266
- function mqtrans_filterPostMetaData($original_value, $object_id, $meta_key, $single) {
267
- if ($meta_key == '_menu_item_url')
268
- {
269
- $meta = wp_cache_get($object_id, 'post_meta');
270
- if (!empty($meta) && array_key_exists($meta_key, $meta) && !empty($meta[$meta_key]))
271
- {
272
- if ($single === false)
273
- {
274
- if (is_array($meta[$meta_key]))
275
- $meta = $meta[$meta_key];
276
- else
277
- $meta = array($meta[$meta_key]);
278
- $meta = array_map('qtrans_convertURL', $meta);
279
- }
280
- else
281
- {
282
- if (is_array($meta[$meta_key]))
283
- $meta = $meta[$meta_key][0];
284
- else
285
- $meta = $meta[$meta_key];
286
- $meta = qtrans_convertURL($meta);
287
- }
288
- return $meta;
289
- }
290
- }
291
- return null;
292
- }
293
-
294
- function mqtrans_team_options() {
295
- global $q_config;
296
- ?>
297
- <h3><?php _e('mqTranslate Team Settings', 'mqtranslate') ?><span id="mqtranslate-show-team"> (<a name="mqtranslate_team_settings" href="#" onclick="return showTeamSettings();"><?php _e('Show / Hide', 'mqtranslate'); ?></a>)</span></h3>
298
- <table class="form-table" id="mqtranslate-team" style="display: none">
299
- <tr>
300
- <th scope="row"><?php _e('User-level Language Protection', 'mqtranslate') ?></th>
301
- <td>
302
- <label for="ul_lang_protection"><input type="checkbox" name="ul_lang_protection" id="ul_lang_protection" value="1"<?php echo ($q_config['ul_lang_protection'])?' checked="checked"':''; ?>/> <?php _e('Enable user-level language protection', 'mqtranslate'); ?></label>
303
- <br />
304
- <small><?php _e('When enabled, this option allows you to select which language is editable on a user-level account basis.', 'mqtranslate') ?></small>
305
- </td>
306
- </tr>
307
- </table>
308
- <script type="text/javascript">
309
- // <![CDATA[
310
- function showTeamSettings() {
311
- var el = document.getElementById('mqtranslate-team');
312
- if (el.style.display == 'block')
313
- el.style.display = 'none';
314
- else
315
- el.style.display='block';
316
- return false;
317
- }
318
- // ]]>
319
- </script>
320
- <?php
321
- }
322
-
323
- function mqtrans_load_team_options() {
324
- global $q_config;
325
- $opt = get_option('mqtranslate_ul_lang_protection');
326
- if ($opt === false)
327
- $q_config['ul_lang_protection'] = true;
328
- else
329
- $q_config['ul_lang_protection'] = ($opt == '1');
330
- }
331
-
332
- function mqtrans_save_team_options() {
333
- qtrans_checkSetting('ul_lang_protection', true, QT_BOOLEAN);
334
- }
335
-
336
- function mqtrans_editorExpand() {
337
- return false;
338
- }
339
-
340
- if (!defined('WP_ADMIN'))
341
- {
342
- add_filter('home_url', 'mqtrans_filterHomeURL', 10, 4);
343
- add_filter('get_post_metadata', 'mqtrans_filterPostMetaData', 10, 4);
344
- }
345
- else
346
- add_filter('wp_editor_expand', 'mqtrans_editorExpand');
347
-
348
- add_action('edit_user_profile', 'mqtrans_userProfile');
349
- add_action('show_user_profile', 'mqtrans_userProfile');
350
- add_action('profile_update', 'mqtrans_userProfileUpdate');
351
- add_action('post_updated', 'mqtrans_postUpdated', 10, 3);
352
-
353
- add_action('mqtranslate_configuration', 'mqtrans_team_options', 9);
354
- add_action('mqtranslate_loadConfig', 'mqtrans_load_team_options');
355
- add_action('mqtranslate_saveConfig', 'mqtrans_save_team_options');
356
- ?>
qtranslate.js CHANGED
@@ -39,26 +39,18 @@ qtranxj_split = function(text)
39
blocks = text.xsplit(split_regex_b);
40
if(!qtranxj_isArray(blocks))
41
return result;
42
- if(blocks.length==1){//no language separator found, enter it to all languages
43
- var b=blocks[0];
44
- for(var j=0; j<qTranslateConfig.enabled_languages.length; ++j){
45
- var lang=qTranslateConfig.enabled_languages[j];
46
result[lang] += b;
47
- }
48
- }else{
49
- lang_regex = /\[:([a-z]{2})\]/gi;
50
- lang = false;
51
- for(var i = 0;i<blocks.length;++i){
52
- var b=blocks[i];
53
- //c('blocks['+i+']='+b+'; lang='+lang);
54
- if(lang){
55
- result[lang] += b;
56
- lang = false;
57
- }else{
58
- matches = lang_regex.exec(b); lang_regex.lastIndex=0;
59
- if(matches==null) continue;
60
- lang = matches[1];
61
- }
62
}
63
}
64
}
39
blocks = text.xsplit(split_regex_b);
40
if(!qtranxj_isArray(blocks))
41
return result;
42
+ lang_regex = /\[:([a-z]{2})\]/gi;
43
+ lang = false;
44
+ for(var i = 0;i<blocks.length;++i){
45
+ var b=blocks[i];
46
+ //c('blocks['+i+']='+b+'; lang='+lang);
47
+ if(lang){
48
result[lang] += b;
49
+ lang = false;
50
+ }else{
51
+ matches = lang_regex.exec(b); lang_regex.lastIndex=0;
52
+ if(matches==null) continue;
53
+ lang = matches[1];
54
}
55
}
56
}
qtranslate.min.js CHANGED
@@ -1 +1 @@
1
- function qtranxj_get_cookie(e){for(var n=document.cookie.split(";"),a=0;a<n.length;++a){var t=n[a],r=t.split("=");if(r[0].trim()==e&&!(n.length<2))return r[1].trim()}return""}function qtranxj_isArray(e){return e.constructor.toString().indexOf("Array")>=0}function qtranxj_ce(e,n,a,t){var r=document.createElement(e);if(n)for(prop in n)r[prop]=n[prop];return a&&(t&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r)),r}function LanguageSwitch(e,n){function a(){var e=this;if(!e.lang)return void alert("qTranslate-X: This should not have happened: Please, report this incident to the developers: !tabSwitch.lang");if(i!==e.lang){i&&l[i].classList.remove("active"),i=e.lang,e.classList.add("active");for(var n=0;n<s.length;++n)s[n].call(this)}}var t=qTranslateConfig.enabled_languages,r=qTranslateConfig.language_name,i=n,l={},s=[];location.pathname.indexOf();for(var o=0;o<t.length;++o){var g=qTranslateConfig.flag_location,u=t[o],c=qtranxj_ce("li",{lang:u,className:"qtranxs-lang-switch",onclick:a},e);qtranxj_ce("img",{src:g+qTranslateConfig.flag[u]},c),qtranxj_ce("span",{innerHTML:r[u]},c),l[u]=c,i==u&&c.classList.add("active")}this.getActiveLanguage=function(){return i},this.onSwitch=function(e){"function"==typeof e&&s.push(e)}}qtranxj_split=function(e){for(var n=new Object,a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a];n[t]=""}var r=/<!--:-->/gi,i=e.xsplit(r);if(!qtranxj_isArray(i))return n;var l,s,t;if(i.length>1){s=/<!--:([a-z]{2})-->/gi;for(var a=0;a<i.length;++a){var o=i[a];o.length&&(l=s.exec(o),s.lastIndex=0,null!=l&&(t=l[1],n[t]+=o.substring(10)))}}else{var g=/(\[:[a-z]{2}\])/gi;if(i=e.xsplit(g),!qtranxj_isArray(i))return n;if(1==i.length)for(var o=i[0],u=0;u<qTranslateConfig.enabled_languages.length;++u){var t=qTranslateConfig.enabled_languages[u];n[t]+=o}else{s=/\[:([a-z]{2})\]/gi,t=!1;for(var a=0;a<i.length;++a){var o=i[a];if(t)n[t]+=o,t=!1;else{if(l=s.exec(o),s.lastIndex=0,null==l)continue;t=l[1]}}}}return n},qtranxj_join_c=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="<!--:"+t+"-->",n+=r,n+="<!--:-->")}return n},qtranxj_join_b=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="[:"+t+"]",n+=r)}return n},String.prototype.xsplit=function(e){if(3==="a~b".split(/(~)/).length)return this.split(e);e.global||(e=new RegExp(e.source,"g"+(e.ignoreCase?"i":"")));for(var n,a=0,t=[];null!=(n=e.exec(this));)t.push(this.slice(a,n.index)),n.length>1&&t.push(n[1]),a=e.lastIndex;return a<this.length&&t.push(this.slice(a)),a==this.length&&t.push(""),t};var qTranslateX=function(){function e(e){return document.getElementById(e)}function n(e,n){var a=g[e],t=languageSwitch.getActiveLanguage();a.contents[t]=n,a.mlContentField.value="<"===a.separator?qtranxj_join_c(a.contents):qtranxj_join_b(a.contents)}function a(e,a,t){if(e){var r=g[e.id]={};r.contentField=e,r.contents=qtranxj_split(e.value),r.mlContentField=qtranxj_ce(e.tagName,{name:e.name,className:"hidden",value:e.value},a,!0),t||(t="TEXTAREA"===e.tagName?"<":"["),r.separator=t,e.name+="_edit",e.value=r.contents[o],e.onblur=function(){n(this.id,this.value)}}}function t(e,n){a(e,n,"<")}function r(e,n){a(e,n,"[")}function i(){var n,a,t=!!e("tag-name");t?(n="tag-",a="addtag"):(n="",a="edittag");var r=e(n+"name"),i=e(a);if(!i||!r)return!1;var l=qTranslateConfig.language;build_translator=function(e,n){var a={};for(var t in qTranslateConfig.term_name){var r=qTranslateConfig.term_name[t],i=r[e],l=r[n];if(!i||!l){var s=r[qTranslateConfig.default_language];if(!s)continue;i||(i=s+"("+qTranslateConfig.default_language+")"),l||(l=s+"("+qTranslateConfig.default_language+")")}a[i]=l}return a};var s=e("the-list");hideQuickEdit=function(){if(s)for(var e=s.getElementsByTagName("TR"),n=0;n<e.length;n++)for(var a=e[n],t=a.getElementsByTagName("TD")[0],r=t.getElementsByClassName("inline"),i=0;i<r.length;++i){var l=r[i];l.style.display="none"}},hideQuickEdit(),updateNames=function(e,n){if(s)for(var a=s.getElementsByTagName("TR"),t=0;t<a.length;t++){for(var r,i=a[t],o=i.getElementsByTagName("TD")[0],g=o.getElementsByTagName("DIV"),u=0;u<g.length;u++){var c=g[u];if("name"===c.className){r=c.innerHTML;break}}if(l!=qTranslateConfig.default_language){var f=build_translator(l,qTranslateConfig.default_language);r=f[r]}for(var d=qTranslateConfig.term_name[r]||{},h=d[e]||"",v=d[n]||"",m=o.getElementsByClassName("row-title"),p=0;p<m.length;++p){var c=m[p];h?c.innerHTML=c.innerHTML.replace(h,v):c.innerHTML+=v}}};var g=document.getElementsByClassName("tagcloud")[0];updateTagCloud=function(e,n){if(g){var a=g.getElementsByTagName("A");if(a.length)for(var t=build_translator(e,n),r=0;r<a.length;++r){var i=a[r],l=i.innerHTML,s=t[l];s&&(i.innerHTML=s)}}},updateNamesAndTagCloud=function(e,n){updateNames(e,n),updateTagCloud(e,n)},l!==o&&updateNamesAndTagCloud(l,o);var u=qtranxj_ce("input",{name:r.name,className:"hidden",value:r.value},i,!0);r.name="";var c=qTranslateConfig.term_name[r.value]||{};o!==qTranslateConfig.default_language&&(r.value=c[o]||""),editinline_activated=function(){return!0};for(var f=document.getElementsByClassName("editinline"),d=0;d<f.length;++d){var h=f[d];"A"===h.tagName&&h.addEventListener("click",editinline_activated)}onTabSwitch=function(){o!==this.lang&&(r.value=c[this.lang]||"",updateNamesAndTagCloud(o,this.lang),o=this.lang)};for(var v=qTranslateConfig.enabled_languages,m={},d=0;d<v.length;++d){var p=v[d];m[p]=qtranxj_ce("input",{name:"qtranx_term_"+p,className:"hidden",value:name[p]||""},i,!0)}return r.onblur=function(){var e=languageSwitch.getActiveLanguage();m[e].value=this.value,c[e]=this.value,e===qTranslateConfig.default_language&&(u.value=this.value)},!0}function l(){function i(e,n){switch(qTranslateConfig.url_mode.toString()){case"1":e.search?e.search+="&lang="+n:e.search="?lang="+n;break;case"2":var a=qTranslateConfig.url_info_home,t=e.pathname.indexOf(a);e.pathname=a+n+e.pathname.substring(t+a.length-1);break;case"3":e.host=n+"."+e.host}}function l(n){if(!x){var a=e("view-post-btn");if(!a||!a.children.length)return;if(x=a.children[0],"A"!=x.tagName)return;b=x.href,E=qtranxj_ce("a",{})}E.href=b,i(E,n),x.href=E.href;var t=e("preview-action");if(t&&t.children.length&&(t.children[0].href=E.href),1!=qTranslateConfig.url_mode){if(!N){var r=e("sample-permalink");r&&r.childNodes.length&&(N=r.childNodes[0],y=N.nodeValue)}N&&(E.href=y,i(E,n),N.nodeValue=E.href)}}function s(e){var a=e.id;if(a){var t=g[a];t.mce||(t.mce=e,e.getBody().addEventListener("blur",function(){n(e.id,e.getContent())}))}}var u=e("post");if(!u)return!1;var c=e("title");c&&t(c,u);for(var f=u.getElementsByClassName("wp-editor-area"),d=0;d<f.length;++d){var h=f[d];t(h,u)}var v=e("attachment_caption");v&&t(v,u);for(var d=0;d<qTranslateConfig.custom_fields.length;++d){var m,p=qTranslateConfig.custom_fields[d];(0==p.indexOf("<")||0==p.indexOf("["))&&(m=p.substring(0,1),p=p.substring(1));var _=e(p);a(_,u,m)}for(var d=0;d<qTranslateConfig.custom_field_classes.length;++d){var m,T=qTranslateConfig.custom_field_classes[d];(0==T.indexOf("<")||0==T.indexOf("["))&&(m=T.substring(0,1),T=T.substring(1));for(var C=u.getElementsByClassName(T),q=0;q<C.length;++q)_=C[q],a(_,u,m)}var w=e("attachment_alt");w&&r(w,u);var x,b,E,N,y;return l(o),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}if(w&&(w.value=alttexts[this.lang]),l(this.lang),window.tinyMCE)for(var a=0;a<tinyMCE.editors.length;++a){var t=tinyMCE.editors[a],n=g[t.id];n&&t.setContent(n.contentField.value)}},window.addEventListener("load",function(){if(window.tinyMCE){for(var e=0;e<tinyMCE.editors.length;++e){var n=tinyMCE.editors[e];s(n)}for(var a in g){var t=g[a];t.mce||"TEXTAREA"===t.contentField.tagName&&(tinyMCEPreInit.mceInit[a].init_instance_callback=function(e){s(e)})}}}),!0}function s(){var n=document.getElementsByTagName("FORM");if(!n.length)return!1;var a=n[0];return r(e("blogname"),a),r(e("blogdescription"),a),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}},!0}var o=qtranxj_get_cookie("wp_qtrans_edit_language");o||(o=qTranslateConfig.language);var g={};setLangCookie=function(){document.cookie="wp_qtrans_edit_language="+this.lang};var u=location.pathname.match(/(\/wp-admin\/([^\/]*))#x2F;);switch(u&&u[1]){case"/wp-admin/post.php":case"/wp-admin/post-new.php":if(!l())return;break;case"/wp-admin/edit-tags.php":if(!i())return;break;case"/wp-admin/options-general.php":if(location.search.indexOf("page=")>=0)return;if(!s())return;break;default:return}var c=qtranxj_ce("ul",{className:"qtranxs-lang-switch-wrap"}),f=document.getElementsByClassName("wrap")[0],d=f.getElementsByTagName("form")[0];d.parentNode.insertBefore(c,d),languageSwitch=new LanguageSwitch(c,o),languageSwitch.onSwitch(onTabSwitch),languageSwitch.onSwitch(setLangCookie)};new qTranslateX;
1
+ function qtranxj_get_cookie(e){for(var n=document.cookie.split(";"),a=0;a<n.length;++a){var t=n[a],r=t.split("=");if(r[0].trim()==e&&!(n.length<2))return r[1].trim()}return""}function qtranxj_isArray(e){return e.constructor.toString().indexOf("Array")>=0}function qtranxj_ce(e,n,a,t){var r=document.createElement(e);if(n)for(prop in n)r[prop]=n[prop];return a&&(t&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r)),r}function LanguageSwitch(e,n){function a(){var e=this;if(!e.lang)return void alert("qTranslate-X: This should not have happened: Please, report this incident to the developers: !tabSwitch.lang");if(i!==e.lang){i&&l[i].classList.remove("active"),i=e.lang,e.classList.add("active");for(var n=0;n<s.length;++n)s[n].call(this)}}var t=qTranslateConfig.enabled_languages,r=qTranslateConfig.language_name,i=n,l={},s=[];location.pathname.indexOf();for(var o=0;o<t.length;++o){var g=qTranslateConfig.flag_location,u=t[o],c=qtranxj_ce("li",{lang:u,className:"qtranxs-lang-switch",onclick:a},e);qtranxj_ce("img",{src:g+qTranslateConfig.flag[u]},c),qtranxj_ce("span",{innerHTML:r[u]},c),l[u]=c,i==u&&c.classList.add("active")}this.getActiveLanguage=function(){return i},this.onSwitch=function(e){"function"==typeof e&&s.push(e)}}qtranxj_split=function(e){for(var n=new Object,a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a];n[t]=""}var r=/<!--:-->/gi,i=e.xsplit(r);if(!qtranxj_isArray(i))return n;var l,s,t;if(i.length>1){s=/<!--:([a-z]{2})-->/gi;for(var a=0;a<i.length;++a){var o=i[a];o.length&&(l=s.exec(o),s.lastIndex=0,null!=l&&(t=l[1],n[t]+=o.substring(10)))}}else{var g=/(\[:[a-z]{2}\])/gi;if(i=e.xsplit(g),!qtranxj_isArray(i))return n;s=/\[:([a-z]{2})\]/gi,t=!1;for(var a=0;a<i.length;++a){var o=i[a];if(t)n[t]+=o,t=!1;else{if(l=s.exec(o),s.lastIndex=0,null==l)continue;t=l[1]}}}return n},qtranxj_join_c=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="<!--:"+t+"-->",n+=r,n+="<!--:-->")}return n},qtranxj_join_b=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;++a){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="[:"+t+"]",n+=r)}return n},String.prototype.xsplit=function(e){if(3==="a~b".split(/(~)/).length)return this.split(e);e.global||(e=new RegExp(e.source,"g"+(e.ignoreCase?"i":"")));for(var n,a=0,t=[];null!=(n=e.exec(this));)t.push(this.slice(a,n.index)),n.length>1&&t.push(n[1]),a=e.lastIndex;return a<this.length&&t.push(this.slice(a)),a==this.length&&t.push(""),t};var qTranslateX=function(){function e(e){return document.getElementById(e)}function n(e,n){var a=g[e],t=languageSwitch.getActiveLanguage();a.contents[t]=n,a.mlContentField.value="<"===a.separator?qtranxj_join_c(a.contents):qtranxj_join_b(a.contents)}function a(e,a,t){if(e){var r=g[e.id]={};r.contentField=e,r.contents=qtranxj_split(e.value),r.mlContentField=qtranxj_ce(e.tagName,{name:e.name,className:"hidden",value:e.value},a,!0),t||(t="TEXTAREA"===e.tagName?"<":"["),r.separator=t,e.name+="_edit",e.value=r.contents[o],e.onblur=function(){n(this.id,this.value)}}}function t(e,n){a(e,n,"<")}function r(e,n){a(e,n,"[")}function i(){var n,a,t=!!e("tag-name");t?(n="tag-",a="addtag"):(n="",a="edittag");var r=e(n+"name"),i=e(a);if(!i||!r)return!1;var l=qTranslateConfig.language;build_translator=function(e,n){var a={};for(var t in qTranslateConfig.term_name){var r=qTranslateConfig.term_name[t],i=r[e],l=r[n];if(!i||!l){var s=r[qTranslateConfig.default_language];if(!s)continue;i||(i=s+"("+qTranslateConfig.default_language+")"),l||(l=s+"("+qTranslateConfig.default_language+")")}a[i]=l}return a};var s=e("the-list");hideQuickEdit=function(){if(s)for(var e=s.getElementsByTagName("TR"),n=0;n<e.length;n++)for(var a=e[n],t=a.getElementsByTagName("TD")[0],r=t.getElementsByClassName("inline"),i=0;i<r.length;++i){var l=r[i];l.style.display="none"}},hideQuickEdit(),updateNames=function(e,n){if(s)for(var a=s.getElementsByTagName("TR"),t=0;t<a.length;t++){for(var r,i=a[t],o=i.getElementsByTagName("TD")[0],g=o.getElementsByTagName("DIV"),u=0;u<g.length;u++){var c=g[u];if("name"===c.className){r=c.innerHTML;break}}if(l!=qTranslateConfig.default_language){var f=build_translator(l,qTranslateConfig.default_language);r=f[r]}for(var d=qTranslateConfig.term_name[r]||{},h=d[e]||"",v=d[n]||"",m=o.getElementsByClassName("row-title"),p=0;p<m.length;++p){var c=m[p];h?c.innerHTML=c.innerHTML.replace(h,v):c.innerHTML+=v}}};var g=document.getElementsByClassName("tagcloud")[0];updateTagCloud=function(e,n){if(g){var a=g.getElementsByTagName("A");if(a.length)for(var t=build_translator(e,n),r=0;r<a.length;++r){var i=a[r],l=i.innerHTML,s=t[l];s&&(i.innerHTML=s)}}},updateNamesAndTagCloud=function(e,n){updateNames(e,n),updateTagCloud(e,n)},l!==o&&updateNamesAndTagCloud(l,o);var u=qtranxj_ce("input",{name:r.name,className:"hidden",value:r.value},i,!0);r.name="";var c=qTranslateConfig.term_name[r.value]||{};o!==qTranslateConfig.default_language&&(r.value=c[o]||""),editinline_activated=function(){return!0};for(var f=document.getElementsByClassName("editinline"),d=0;d<f.length;++d){var h=f[d];"A"===h.tagName&&h.addEventListener("click",editinline_activated)}onTabSwitch=function(){o!==this.lang&&(r.value=c[this.lang]||"",updateNamesAndTagCloud(o,this.lang),o=this.lang)};for(var v=qTranslateConfig.enabled_languages,m={},d=0;d<v.length;++d){var p=v[d];m[p]=qtranxj_ce("input",{name:"qtranx_term_"+p,className:"hidden",value:name[p]||""},i,!0)}return r.onblur=function(){var e=languageSwitch.getActiveLanguage();m[e].value=this.value,c[e]=this.value,e===qTranslateConfig.default_language&&(u.value=this.value)},!0}function l(){function i(e,n){switch(qTranslateConfig.url_mode.toString()){case"1":e.search?e.search+="&lang="+n:e.search="?lang="+n;break;case"2":var a=qTranslateConfig.url_info_home,t=e.pathname.indexOf(a);e.pathname=a+n+e.pathname.substring(t+a.length-1);break;case"3":e.host=n+"."+e.host}}function l(n){if(!x){var a=e("view-post-btn");if(!a||!a.children.length)return;if(x=a.children[0],"A"!=x.tagName)return;b=x.href,E=qtranxj_ce("a",{})}E.href=b,i(E,n),x.href=E.href;var t=e("preview-action");if(t&&t.children.length&&(t.children[0].href=E.href),1!=qTranslateConfig.url_mode){if(!N){var r=e("sample-permalink");r&&r.childNodes.length&&(N=r.childNodes[0],y=N.nodeValue)}N&&(E.href=y,i(E,n),N.nodeValue=E.href)}}function s(e){var a=e.id;if(a){var t=g[a];t.mce||(t.mce=e,e.getBody().addEventListener("blur",function(){n(e.id,e.getContent())}))}}var u=e("post");if(!u)return!1;var c=e("title");c&&t(c,u);for(var f=u.getElementsByClassName("wp-editor-area"),d=0;d<f.length;++d){var h=f[d];t(h,u)}var v=e("attachment_caption");v&&t(v,u);for(var d=0;d<qTranslateConfig.custom_fields.length;++d){var m,p=qTranslateConfig.custom_fields[d];(0==p.indexOf("<")||0==p.indexOf("["))&&(m=p.substring(0,1),p=p.substring(1));var _=e(p);a(_,u,m)}for(var d=0;d<qTranslateConfig.custom_field_classes.length;++d){var m,T=qTranslateConfig.custom_field_classes[d];(0==T.indexOf("<")||0==T.indexOf("["))&&(m=T.substring(0,1),T=T.substring(1));for(var C=u.getElementsByClassName(T),q=0;q<C.length;++q)_=C[q],a(_,u,m)}var w=e("attachment_alt");w&&r(w,u);var x,b,E,N,y;return l(o),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}if(w&&(w.value=alttexts[this.lang]),l(this.lang),window.tinyMCE)for(var a=0;a<tinyMCE.editors.length;++a){var t=tinyMCE.editors[a],n=g[t.id];n&&t.setContent(n.contentField.value)}},window.addEventListener("load",function(){if(window.tinyMCE){for(var e=0;e<tinyMCE.editors.length;++e){var n=tinyMCE.editors[e];s(n)}for(var a in g){var t=g[a];t.mce||"TEXTAREA"===t.contentField.tagName&&(tinyMCEPreInit.mceInit[a].init_instance_callback=function(e){s(e)})}}}),!0}function s(){var n=document.getElementsByTagName("FORM");if(!n.length)return!1;var a=n[0];return r(e("blogname"),a),r(e("blogdescription"),a),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}},!0}var o=qtranxj_get_cookie("wp_qtrans_edit_language");o||(o=qTranslateConfig.language);var g={};setLangCookie=function(){document.cookie="wp_qtrans_edit_language="+this.lang};var u=location.pathname.match(/(\/wp-admin\/([^\/]*))#x2F;);switch(u&&u[1]){case"/wp-admin/post.php":case"/wp-admin/post-new.php":if(!l())return;break;case"/wp-admin/edit-tags.php":if(!i())return;break;case"/wp-admin/options-general.php":if(location.search.indexOf("page=")>=0)return;if(!s())return;break;default:return}var c=qtranxj_ce("ul",{className:"qtranxs-lang-switch-wrap"}),f=document.getElementsByClassName("wrap")[0],d=f.getElementsByTagName("form")[0];d.parentNode.insertBefore(c,d),languageSwitch=new LanguageSwitch(c,o),languageSwitch.onSwitch(onTabSwitch),languageSwitch.onSwitch(setLangCookie)};new qTranslateX;
qtranslate.php CHANGED
@@ -1,9 +1,9 @@
1
<?php // encoding: utf-8
2
/**
3
- Plugin Name: qTranslate X
4
Plugin URI: http://wordpress.org/plugins/qtranslate-x/
5
Description: Adds user-friendly and database-friendly multilingual content support into WordPress.
6
- Version: 2.9.2
7
Author: John Clause based on original code by Qian Qin
8
Author URI: http://qtranslatexteam.wordpress.com/about
9
Tags: multilingual, multi, language, admin, tinymce, Polyglot, bilingual, widget, switcher, professional, human, translation, service, qTranslate, zTranslate, mqTranslate, qTranslate Plus, WPML
@@ -153,9 +153,6 @@ $q_config['auto_update_mo'] = true;
153
// hide language tag for default language
154
$q_config['hide_default_language'] = true;
155
156
- //enables compatibility with former qtrans_* functions
157
- $q_config['qtrans_compatibility'] = false;
158
-
159
// sets default url mode
160
// QTX_URL_QUERY(1) - query (questionmark)
161
// QTX_URL_PATH(2) - pre-path
1
<?php // encoding: utf-8
2
/**
3
+ Plugin Name: qTranslate-X
4
Plugin URI: http://wordpress.org/plugins/qtranslate-x/
5
Description: Adds user-friendly and database-friendly multilingual content support into WordPress.
6
+ Version: 2.9
7
Author: John Clause based on original code by Qian Qin
8
Author URI: http://qtranslatexteam.wordpress.com/about
9
Tags: multilingual, multi, language, admin, tinymce, Polyglot, bilingual, widget, switcher, professional, human, translation, service, qTranslate, zTranslate, mqTranslate, qTranslate Plus, WPML
153
// hide language tag for default language
154
$q_config['hide_default_language'] = true;
155
156
// sets default url mode
157
// QTX_URL_QUERY(1) - query (questionmark)
158
// QTX_URL_PATH(2) - pre-path
qtranslate_compatibility.php CHANGED
@@ -19,10 +19,8 @@ if (!function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')){
19
return qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($content);
20
}
21
}
22
- if(!function_exists('qtrans_useTermLib')){
23
- function qtrans_useTermLib($obj){ return qtranxf_useTermLib($obj); }
24
- }
25
- if(!function_exists('qtrans_getSortedLanguages')){
26
- function qtrans_getSortedLanguages($reverse = false){ return qtranxf_getSortedLanguages($reverse); }
27
- }
28
?>
19
return qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($content);
20
}
21
}
22
+
23
+ //if(!function_exists('qtrans_useTermLib')){//is not available any more
24
+ // function qtrans_useTermLib($obj){ return qtranxf_useTermLib($obj);
25
+ //}
26
?>
qtranslate_configuration.php CHANGED
@@ -47,7 +47,6 @@ function qtranxf_update_config()
47
delete_option('qtranslate_auto_update_mo');
48
delete_option('qtranslate_next_update_mo');
49
delete_option('qtranslate_hide_default_language');
50
- delete_option('qtranslate_qtrans_compatibility');
51
delete_option('qtranslate_custom_fields');
52
if(isset($_POST['qtranslate_reset3'])) {
53
delete_option('qtranslate_term_name');
@@ -256,7 +255,7 @@ function qtranxf_language_form($lang = '', $language_code = '', $language_name =
256
<label for="language_locale"><?php _e('Locale', 'qtranslate') ?></label>
257
<input name="language_locale" id="language_locale" type="text" value="<?php echo $language_locale; ?>" size="5" maxlength="5"/>
258
<p>
259
- <?php _e('PHP and Wordpress Locale for the language. (Example: en_US)', 'qtranslate'); ?><br/>
260
<?php _e('You will need to install the .mo file for this language.', 'qtranslate'); ?>
261
</p>
262
</div>
@@ -274,8 +273,8 @@ function qtranxf_language_form($lang = '', $language_code = '', $language_name =
274
<label for="language_na_message"><?php _e('Not Available Message', 'qtranslate') ?></label>
275
<input name="language_na_message" id="language_na_message" type="text" value="<?php echo $language_na_message; ?>"/>
276
<p>
277
- <?php _e('Message to display if post is not available in the requested language. (Example: Sorry, this entry is only available in %LANG:, : and %.)', 'qtranslate'); ?><br/>
278
- <?php _e('%LANG:&lt;normal_seperator&gt;:&lt;last_seperator&gt;% generates a list of languages seperated by &lt;normal_seperator&gt; except for the last one, where &lt;last_seperator&gt; will be used instead.', 'qtranslate'); ?><br/>
279
</p>
280
</div>
281
<?php
@@ -436,7 +435,6 @@ function qtranxf_conf() {
436
qtranxf_updateSetting('url_mode', QTX_INTEGER);
437
qtranxf_updateSetting('auto_update_mo', QTX_BOOLEAN);
438
qtranxf_updateSetting('hide_default_language', QTX_BOOLEAN);
439
- qtranxf_updateSetting('qtrans_compatibility', QTX_BOOLEAN);
440
qtranxf_updateSetting('custom_fields', QTX_ARRAY);
441
qtranxf_updateSetting('custom_field_classes', QTX_ARRAY);
442
qtranxf_updateSetting('text_field_filters', QTX_ARRAY);
@@ -670,7 +668,7 @@ function qtranxf_conf() {
670
echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowup.png" alt="up" /></a>';
671
echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowdown.png" alt="down" /></a>';
672
echo ' <img src="' . trailingslashit(WP_CONTENT_URL) .$q_config['flag_location'].$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
673
- echo ' '.$q_config['language_name'][$language] . "</label><br/>\n";
674
}
675
?>
676
<small><?php printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url')); ?></small>
@@ -704,9 +702,9 @@ function qtranxf_conf() {
704
<th scope="row"><?php _e('URL Modification Mode', 'qtranslate') ?></th>
705
<td>
706
<fieldset><legend class="hidden"><?php _e('URL Modification Mode', 'qtranslate') ?></legend>
707
- <label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_PATH; ?>" <?php echo ($q_config['url_mode']==QTX_URL_PATH)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate').'. SEO '.__('friendly', 'qtranslate').'.'; ?></label><br/>
708
- <label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_DOMAIN; ?>" <?php echo ($q_config['url_mode']==QTX_URL_DOMAIN)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate').'. '.__('You will need to configure DNS sub-domains on your site.', 'qtranslate'); ?></label><br/>
709
- <label title="Query Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_QUERY; ?>" <?php echo ($q_config['url_mode']==QTX_URL_QUERY)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Query Mode (?lang=en)', 'qtranslate').'. '.__('Most SEO unfriendly, not recommended.', 'qtranslate'); ?></label><br/>
710
</fieldset>
711
<small><?php _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!', 'qtranslate'); ?></small>
712
<br/><br/>
@@ -742,10 +740,10 @@ function qtranxf_conf() {
742
<tr valign="top">
743
<th scope="row"><?php _e('Date / Time Conversion', 'qtranslate');?></th>
744
<td>
745
- <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function.', 'qtranslate'); ?></label><br/>
746
- <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br/>
747
- <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date.', 'qtranslate'); ?></label><br/>
748
- <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br/>
749
<small><?php _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate'); ?></small>
750
</td>
751
</tr>
@@ -758,7 +756,7 @@ function qtranxf_conf() {
758
<tr valign="top">
759
<th scope="row" style="text-align: right">id:</th>
760
<td>
761
- <input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php echo implode(' ',$q_config['custom_fields']); ?>" style="width:100%"><br/>
762
<small><?php _e('The value of "id" attribute is normally unique within one page, otherwise the first field found, having an id specified, is picked up.', 'qtranslate'); ?></small>
763
</td>
764
</tr>
@@ -776,13 +774,6 @@ function qtranxf_conf() {
776
<small><?php printf(__('Names of filters (which are enabled on theme or other plugins via %s function) to add translation to. For more information, read %sFAQ%s.', 'qtranslate'),'apply_filters()','<a href="https://wordpress.org/plugins/qtranslate-x/faq/">','</a>'); ?></small>
777
</td>
778
</tr>
779
- <tr valign="top">
780
- <th scope="row"><?php _e('Compatibility Functions', 'qtranslate');?></th>
781
- <td>
782
- <label for="qtrans_compatibility"><input type="checkbox" name="qtrans_compatibility" id="qtrans_compatibility" value="1"<?php echo ($q_config['qtrans_compatibility'])?' checked="checked"':''; ?>/>&nbsp;<?php printf(__('Enable function names compatibility for %s.', 'qtranslate'), 'qtrans_getLanguage, qtrans_convertURL, qtrans_use, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtranxf_useTermLib and qtrans_getSortedLanguages'); ?></label><br/>
783
- <small><?php printf(__('Some plugins and themes use direct calls to the functions listed, which are defined in former %s plugin and some of its forks. Turning this flag on will enable those function to exists, which will make the dependent plugins and themes to work. WordPress policy prohibits to define functions with the same names as in other plugins, since it generates user-unfriendly fatal errors, when two conflicting plugins are activated simultaneously. Before turning this option on, you have to make sure that there are no other plugins active, which define those functions.', 'qtranslate'), '<a href="https://wordpress.org/plugins/qtranslate/" target="_blank">qTranslate</a>'); ?></small>
784
- </td>
785
- </tr>
786
<?php /*
787
<tr>
788
<th scope="row"><?php _e('Debugging Information', 'qtranslate');?></th>
@@ -918,7 +909,7 @@ function qtranxf_nav_menu_metabox( $object )
918
</div>
919
<span class="list-controls hide-if-no-js">
920
<a href="javascript:void(0);" class="help" onclick="jQuery( '#help-login-links' ).toggle();"><?php _e( 'Help' ); ?></a>
921
- <span class="hide-if-js" id="help-login-links"><br/><a name="help-login-links"></a>
922
Menu item added is replaced with a sub-menu of available languages when menu is rendered. Depending on how your theme renders menu you may need to override and customize css entries .qtranxs-lang-menu and .qtranxs-lang-menu-item, originally defined in qtranslate.css.
923
</span>
924
</span>
47
delete_option('qtranslate_auto_update_mo');
48
delete_option('qtranslate_next_update_mo');
49
delete_option('qtranslate_hide_default_language');
50
delete_option('qtranslate_custom_fields');
51
if(isset($_POST['qtranslate_reset3'])) {
52
delete_option('qtranslate_term_name');
255
<label for="language_locale"><?php _e('Locale', 'qtranslate') ?></label>
256
<input name="language_locale" id="language_locale" type="text" value="<?php echo $language_locale; ?>" size="5" maxlength="5"/>
257
<p>
258
+ <?php _e('PHP and Wordpress Locale for the language. (Example: en_US)', 'qtranslate'); ?><br />
259
<?php _e('You will need to install the .mo file for this language.', 'qtranslate'); ?>
260
</p>
261
</div>
273
<label for="language_na_message"><?php _e('Not Available Message', 'qtranslate') ?></label>
274
<input name="language_na_message" id="language_na_message" type="text" value="<?php echo $language_na_message; ?>"/>
275
<p>
276
+ <?php _e('Message to display if post is not available in the requested language. (Example: Sorry, this entry is only available in %LANG:, : and %.)', 'qtranslate'); ?><br />
277
+ <?php _e('%LANG:&lt;normal_seperator&gt;:&lt;last_seperator&gt;% generates a list of languages seperated by &lt;normal_seperator&gt; except for the last one, where &lt;last_seperator&gt; will be used instead.', 'qtranslate'); ?><br />
278
</p>
279
</div>
280
<?php
435
qtranxf_updateSetting('url_mode', QTX_INTEGER);
436
qtranxf_updateSetting('auto_update_mo', QTX_BOOLEAN);
437
qtranxf_updateSetting('hide_default_language', QTX_BOOLEAN);
438
qtranxf_updateSetting('custom_fields', QTX_ARRAY);
439
qtranxf_updateSetting('custom_field_classes', QTX_ARRAY);
440
qtranxf_updateSetting('text_field_filters', QTX_ARRAY);
668
echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowup.png" alt="up" /></a>';
669
echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowdown.png" alt="down" /></a>';
670
echo ' <img src="' . trailingslashit(WP_CONTENT_URL) .$q_config['flag_location'].$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
671
+ echo ' '.$q_config['language_name'][$language] . "</label><br />\n";
672
}
673
?>
674
<small><?php printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url')); ?></small>
702
<th scope="row"><?php _e('URL Modification Mode', 'qtranslate') ?></th>
703
<td>
704
<fieldset><legend class="hidden"><?php _e('URL Modification Mode', 'qtranslate') ?></legend>
705
+ <label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_PATH; ?>" <?php echo ($q_config['url_mode']==QTX_URL_PATH)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate').'. SEO '.__('friendly', 'qtranslate').'.'; ?></label><br />
706
+ <label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_DOMAIN; ?>" <?php echo ($q_config['url_mode']==QTX_URL_DOMAIN)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate').'. '.__('You will need to configure DNS sub-domains on your site.', 'qtranslate'); ?></label><br />
707
+ <label title="Query Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_QUERY; ?>" <?php echo ($q_config['url_mode']==QTX_URL_QUERY)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Query Mode (?lang=en)', 'qtranslate').'. '.__('Most SEO unfriendly, not recommended.', 'qtranslate'); ?></label><br />
708
</fieldset>
709
<small><?php _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!', 'qtranslate'); ?></small>
710
<br/><br/>
740
<tr valign="top">
741
<th scope="row"><?php _e('Date / Time Conversion', 'qtranslate');?></th>
742
<td>
743
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function.', 'qtranslate'); ?></label><br />
744
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br />
745
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date.', 'qtranslate'); ?></label><br />
746
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br />
747
<small><?php _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate'); ?></small>
748
</td>
749
</tr>
756
<tr valign="top">
757
<th scope="row" style="text-align: right">id:</th>
758
<td>
759
+ <input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php echo implode(' ',$q_config['custom_fields']); ?>" style="width:100%"><br />
760
<small><?php _e('The value of "id" attribute is normally unique within one page, otherwise the first field found, having an id specified, is picked up.', 'qtranslate'); ?></small>
761
</td>
762
</tr>
774
<small><?php printf(__('Names of filters (which are enabled on theme or other plugins via %s function) to add translation to. For more information, read %sFAQ%s.', 'qtranslate'),'apply_filters()','<a href="https://wordpress.org/plugins/qtranslate-x/faq/">','</a>'); ?></small>
775
</td>
776
</tr>
777
<?php /*
778
<tr>
779
<th scope="row"><?php _e('Debugging Information', 'qtranslate');?></th>
909
</div>
910
<span class="list-controls hide-if-no-js">
911
<a href="javascript:void(0);" class="help" onclick="jQuery( '#help-login-links' ).toggle();"><?php _e( 'Help' ); ?></a>
912
+ <span class="hide-if-js" id="help-login-links"><br /><a name="help-login-links"></a>
913
Menu item added is replaced with a sub-menu of available languages when menu is rendered. Depending on how your theme renders menu you may need to override and customize css entries .qtranxs-lang-menu and .qtranxs-lang-menu-item, originally defined in qtranslate.css.
914
</span>
915
</span>
qtranslate_core.php CHANGED
@@ -86,10 +86,6 @@ function qtranxf_init() {
86
// fix url to prevent xss
87
$q_config['url_info']['url'] = qtranxf_convertURL(add_query_arg('lang',$q_config['default_language'],$q_config['url_info']['url']));
88
89
- if($q_config['qtrans_compatibility']){
90
- require_once(dirname(__FILE__)."/qtranslate_compatibility.php");
91
- }
92
-
93
//allow other plugins to initialize whatever they need
94
do_action('qtranxf_init');
95
@@ -389,7 +385,12 @@ function qtranxf_loadConfig() {
389
$use_strftime = get_option('qtranslate_use_strftime');
390
$ignore_file_types = get_option('qtranslate_ignore_file_types');
391
$url_mode = get_option('qtranslate_url_mode');
392
$term_name = get_option('qtranslate_term_name');
393
394
qtranxf_load_option_array('custom_fields');
395
qtranxf_load_option_array('custom_field_classes');
@@ -414,25 +415,12 @@ function qtranxf_loadConfig() {
414
qtranxf_load_option_bool('show_displayed_language_prefix');
415
qtranxf_load_option_bool('auto_update_mo');
416
qtranxf_load_option_bool('hide_default_language');
417
- qtranxf_load_option_bool('qtrans_compatibility');
418
/*
419
- $detect_browser_language = get_option('qtranslate_detect_browser_language');
420
- $hide_untranslated = get_option('qtranslate_hide_untranslated');
421
- $show_displayed_language_prefix = get_option('qtranslate_show_displayed_language_prefix');
422
- $auto_update_mo = get_option('qtranslate_auto_update_mo');
423
- $hide_default_language = get_option('qtranslate_hide_default_language');
424
-
425
$detect_browser_language = qtranxf_validateBool($detect_browser_language, $q_config['detect_browser_language']);
426
$hide_untranslated = qtranxf_validateBool($hide_untranslated, $q_config['hide_untranslated']);
427
$show_displayed_language_prefix = qtranxf_validateBool($show_displayed_language_prefix, $q_config['show_displayed_language_prefix']);
428
$auto_update_mo = qtranxf_validateBool($auto_update_mo, $q_config['auto_update_mo']);
429
$hide_default_language = qtranxf_validateBool($hide_default_language, $q_config['hide_default_language']);
430
-
431
- $q_config['detect_browser_language'] = $detect_browser_language;
432
- $q_config['hide_untranslated'] = $hide_untranslated;
433
- $q_config['show_displayed_language_prefix'] = $show_displayed_language_prefix;
434
- $q_config['auto_update_mo'] = $auto_update_mo;
435
- $q_config['hide_default_language'] = $hide_default_language;
436
*/
437
// url fix for upgrading users
438
$flag_location = trailingslashit(preg_replace('#^wp-content/#','',$flag_location));
@@ -466,6 +454,11 @@ function qtranxf_loadConfig() {
466
$q_config['ignore_file_types'] = $val;
467
468
$q_config['url_mode'] = $url_mode;
469
$q_config['term_name'] = $term_name;
470
471
foreach($q_config['text_field_filters'] as $nm){
86
// fix url to prevent xss
87
$q_config['url_info']['url'] = qtranxf_convertURL(add_query_arg('lang',$q_config['default_language'],$q_config['url_info']['url']));
88
89
//allow other plugins to initialize whatever they need
90
do_action('qtranxf_init');
91
385
$use_strftime = get_option('qtranslate_use_strftime');
386
$ignore_file_types = get_option('qtranslate_ignore_file_types');
387
$url_mode = get_option('qtranslate_url_mode');
388
+ $detect_browser_language = get_option('qtranslate_detect_browser_language');
389
+ $hide_untranslated = get_option('qtranslate_hide_untranslated');
390
+ $show_displayed_language_prefix = get_option('qtranslate_show_displayed_language_prefix');
391
+ $auto_update_mo = get_option('qtranslate_auto_update_mo');
392
$term_name = get_option('qtranslate_term_name');
393
+ $hide_default_language = get_option('qtranslate_hide_default_language');
394
395
qtranxf_load_option_array('custom_fields');
396
qtranxf_load_option_array('custom_field_classes');
415
qtranxf_load_option_bool('show_displayed_language_prefix');
416
qtranxf_load_option_bool('auto_update_mo');
417
qtranxf_load_option_bool('hide_default_language');
418
/*
419
$detect_browser_language = qtranxf_validateBool($detect_browser_language, $q_config['detect_browser_language']);
420
$hide_untranslated = qtranxf_validateBool($hide_untranslated, $q_config['hide_untranslated']);
421
$show_displayed_language_prefix = qtranxf_validateBool($show_displayed_language_prefix, $q_config['show_displayed_language_prefix']);
422
$auto_update_mo = qtranxf_validateBool($auto_update_mo, $q_config['auto_update_mo']);
423
$hide_default_language = qtranxf_validateBool($hide_default_language, $q_config['hide_default_language']);
424
*/
425
// url fix for upgrading users
426
$flag_location = trailingslashit(preg_replace('#^wp-content/#','',$flag_location));
454
$q_config['ignore_file_types'] = $val;
455
456
$q_config['url_mode'] = $url_mode;
457
+ $q_config['detect_browser_language'] = $detect_browser_language;
458
+ $q_config['hide_untranslated'] = $hide_untranslated;
459
+ $q_config['show_displayed_language_prefix'] = $show_displayed_language_prefix;
460
+ $q_config['auto_update_mo'] = $auto_update_mo;
461
+ $q_config['hide_default_language'] = $hide_default_language;
462
$q_config['term_name'] = $term_name;
463
464
foreach($q_config['text_field_filters'] as $nm){
qtranslate_frontend.php CHANGED
@@ -71,54 +71,21 @@ function qtranxf_get_nav_menu_items( $items, $menu, $args )
71
$itemid=0;
72
$menu_order=0;
73
$qtransmenu=null;
74
- $altlang=null;
75
- $url='';//it will keep the same page
76
- $tp='LM';
77
- $flags=true;
78
foreach($items as $item)
79
{
80
if($itemid<$item->ID) $itemid=$item->ID;
81
if($menu_order<$item->menu_order) $menu_order=$item->menu_order;
82
if( !isset( $item->url ) || strstr( $item->url, '#qtransLangSw' ) === FALSE ) continue;
83
- $qs=explode('?',$item->url);
84
- if(count($qs)>1){
85
- $pars=explode('&',$qs[1]);
86
- foreach($pars as $par){
87
- $ps=explode('=',$par);
88
- switch($ps[0]){
89
- case 'flags': $flags=($ps[1]!='no'); break;
90
- case 'type': $tp=$ps[1]; break;
91
- }
92
- }
93
- }
94
- if($tp=='AL'){
95
- foreach($q_config['enabled_languages'] as $lang){
96
- if($lang==$language) continue;
97
- $toplang=$lang;
98
- $altlang=$lang;
99
- break;
100
- }
101
- $item->title=$q_config['language_name'][$toplang];
102
- $item->url=qtranxf_convertURL($url, $altlang, false, true);
103
- }else{
104
- $toplang=$language;
105
- $item->title=__('Language','qtranslate');
106
- $item->url=null;
107
- }
108
- if($flags){
109
- $item->title.=':&nbsp;<img src="'.$flag_location.$q_config['flag'][$toplang].'">';
110
- }
111
//$item->classes[] = 'qtranxs_flag_'.$language;
112
$item->classes[] = 'qtranxs-lang-menu';
113
$qtransmenu = $item;
114
}
115
if(!$qtransmenu) return $items;
116
foreach($q_config['enabled_languages'] as $lang)
117
{
118
- if($tp=='AL'){
119
- if($lang==$language) continue;
120
- if($lang==$altlang ) continue;
121
- }
122
$item=new WP_Post((object)array('ID' => ++$itemid));
123
//$item->db_id=$item->ID;
124
$item->menu_item_parent=$qtransmenu->ID;
@@ -128,10 +95,7 @@ function qtranxf_get_nav_menu_items( $items, $menu, $args )
128
//$item->object_id=0;
129
$item->type='custom';
130
$item->type_label='Custom';
131
- $item->title=$q_config['language_name'][$lang];
132
- if($flags){
133
- $item->title='<img src="'.$flag_location.$q_config['flag'][$lang].'">&nbsp;'.$item->title;
134
- }
135
$item->post_title=$item->title;
136
$item->post_name='language-menuitem-'.$lang;
137
if($lang!=$language)
71
$itemid=0;
72
$menu_order=0;
73
$qtransmenu=null;
74
foreach($items as $item)
75
{
76
if($itemid<$item->ID) $itemid=$item->ID;
77
if($menu_order<$item->menu_order) $menu_order=$item->menu_order;
78
if( !isset( $item->url ) || strstr( $item->url, '#qtransLangSw' ) === FALSE ) continue;
79
+ $item->title=__('Language','qtranslate').':'.'&nbsp;<img src="'.$flag_location.$q_config['flag'][$language].'">';
80
+ $item->url=null;
81
//$item->classes[] = 'qtranxs_flag_'.$language;
82
$item->classes[] = 'qtranxs-lang-menu';
83
$qtransmenu = $item;
84
}
85
if(!$qtransmenu) return $items;
86
+ $url='';//it will keep the same page
87
foreach($q_config['enabled_languages'] as $lang)
88
{
89
$item=new WP_Post((object)array('ID' => ++$itemid));
90
//$item->db_id=$item->ID;
91
$item->menu_item_parent=$qtransmenu->ID;
95
//$item->object_id=0;
96
$item->type='custom';
97
$item->type_label='Custom';
98
+ $item->title='<img src="'.$flag_location.$q_config['flag'][$lang].'">&nbsp;'.$q_config['language_name'][$lang];
99
$item->post_title=$item->title;
100
$item->post_name='language-menuitem-'.$lang;
101
if($lang!=$language)
qtranslate_services.php CHANGED
@@ -630,7 +630,7 @@ function qts_service() {
630
if(isset($answer['error'])) {
631
$error = sprintf(__('An error occured: %s', 'qtranslate'), $qts_error_messages[$answer['error']]);
632
if($answer['message']!='') {
633
- $error.='<br/>'.sprintf(__('Additional information: %s', 'qtranslate'), qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($answer['message']));
634
}
635
}
636
if(isset($answer['order_id'])) {
630
if(isset($answer['error'])) {
631
$error = sprintf(__('An error occured: %s', 'qtranslate'), $qts_error_messages[$answer['error']]);
632
if($answer['message']!='') {
633
+ $error.='<br />'.sprintf(__('Additional information: %s', 'qtranslate'), qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($answer['message']));
634
}
635
}
636
if(isset($answer['order_id'])) {
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === qTranslate X ===
2
Developed by: qTranslate Team based on original code by Qian Qin
3
Contributors: johnclause, chineseleper, Vavooon
4
Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, translation
5
Requires at least: 3.9
6
Tested up to: 4.1
7
- Stable tag: 2.9.2
8
License: GPLv3 or later
9
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QEXEK3HX8AR6U
10
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -115,13 +115,6 @@ One can find the original qTranslate FAQ [here](https://wordpress.org/plugins/qt
115
116
== Changelog ==
117
118
- = 2.9.2 =
119
- * Option "Compatibility Functions" to enable former qTranslate function names: qtrans_getLanguage, qtrans_convertURL, qtrans_use, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtranxf_useTermLib and qtrans_getSortedLanguages
120
- * "Language Switcher" menu options: flags=[yes|no], type=[LM|AL]. They can be used in a query string in URL field of Language Menu.
121
-
122
- = 2.9.1 =
123
- * JS bug fixed, which would not show any field value if no languages are yet configured for that field.
124
-
125
= 2.9 =
126
* ability to enable "Custom Fields" by either "id" or "class" attribute.
127
* ability to specify filters, which other theme or plugins define, to pass relevant data through the translation.
1
+ === qTranslate-X ===
2
Developed by: qTranslate Team based on original code by Qian Qin
3
Contributors: johnclause, chineseleper, Vavooon
4
Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, translation
5
Requires at least: 3.9
6
Tested up to: 4.1
7
+ Stable tag: 2.9
8
License: GPLv3 or later
9
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QEXEK3HX8AR6U
10
License URI: http://www.gnu.org/licenses/gpl-3.0.html
115
116
== Changelog ==
117
118
= 2.9 =
119
* ability to enable "Custom Fields" by either "id" or "class" attribute.
120
* ability to specify filters, which other theme or plugins define, to pass relevant data through the translation.