Version Description
- JS bug fixed, which would not show any field value if no languages are yet configured for that field.
Download this release
Release Info
Developer | johnclause |
Plugin | qTranslate X |
Version | 2.9.1 |
Comparing to | |
See all releases |
Code changes from version 2.9.2 to 2.9.1
- admin/xhaleera_addons.php +0 -356
- qtranslate.php +2 -5
- qtranslate_compatibility.php +4 -6
- qtranslate_configuration.php +13 -22
- qtranslate_core.php +10 -17
- qtranslate_frontend.php +4 -40
- qtranslate_services.php +1 -1
- readme.txt +2 -6
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.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php // encoding: utf-8
|
2 |
/**
|
3 |
-
Plugin Name: qTranslate
|
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,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.1
|
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 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
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:<normal_seperator>:<last_seperator>% generates a list of languages seperated by <normal_seperator> except for the last one, where <last_seperator> 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"':''; ?>/> <?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:<normal_seperator>:<last_seperator>% generates a list of languages seperated by <normal_seperator> except for the last one, where <last_seperator> 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 |
-
$
|
84 |
-
|
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.=': <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
|
132 |
-
if($flags){
|
133 |
-
$item->title='<img src="'.$flag_location.$q_config['flag'][$lang].'"> '.$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').':'.' <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].'"> '.$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
|
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,10 +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 |
|
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.1
|
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.1 =
|
119 |
* JS bug fixed, which would not show any field value if no languages are yet configured for that field.
|
120 |
|