qTranslate X - Version 2.9.4

Version Description

  • fix for https://wordpress.org/support/topic/comment-shows-404-error
Download this release

Release Info

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

Code changes from version 2.9 to 2.9.4

qtranslate.js CHANGED
@@ -31,26 +31,34 @@ qtranxj_split = function(text)
31
//c('matches='+matches);
32
if(matches==null) continue;
33
lang = matches[1];
34
- result[lang] += b.substring(10);
35
- //c('text='+result[lang]);
36
}
37
}else{
38
var split_regex_b = /(\[:[a-z]{2}\])/gi;
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
}
@@ -126,6 +134,7 @@ qtranxj_join_c = function(texts)
126
text += t;
127
text += '<!--:-->';
128
}
129
return text;
130
}
131
@@ -241,8 +250,8 @@ var qTranslateX=function()
241
if(!inpField) return;
242
var h=contentHooks[inpField.id]={};
243
h.contentField=inpField;
244
- h.contents=qtranxj_split(inpField.value);
245
- h.mlContentField=qtranxj_ce(inpField.tagName, {name: inpField.name, className: 'hidden', value: inpField.value}, form, true);
246
if(!separator){
247
if(inpField.tagName==='TEXTAREA')
248
separator='<';
31
//c('matches='+matches);
32
if(matches==null) continue;
33
lang = matches[1];
34
+ result[lang] += b.substring(b.indexOf('-->')+3);//b.substring(10);//stupid problem coming from TinyMCE like '<p><!--:en-->EN<!--:--><!--:de-->DE<!--:--></p>'
35
+ //c('text['+lang+']='+result[lang]);
36
}
37
}else{
38
var split_regex_b = /(\[:[a-z]{2}\])/gi;
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
}
134
text += t;
135
text += '<!--:-->';
136
}
137
+ //c('qtranxj_join_c:text:'+text);
138
return text;
139
}
140
250
if(!inpField) return;
251
var h=contentHooks[inpField.id]={};
252
h.contentField=inpField;
253
+ h.contents=qtranxj_split(inpField.value);//inpField.tagName
254
+ h.mlContentField=qtranxj_ce('input', {name: inpField.name, className: 'hidden', value: inpField.value}, form, true);
255
if(!separator){
256
if(inpField.tagName==='TEXTAREA')
257
separator='<';
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;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],f=qtranxj_ce("li",{lang:u,className:"qtranxs-lang-switch",onclick:a},e);qtranxj_ce("img",{src:g+qTranslateConfig.flag[u]},f),qtranxj_ce("span",{innerHTML:r[u]},f),l[u]=f,i==u&&f.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(o.indexOf("-->")+3)))}}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("input",{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 f=g[u];if("name"===f.className){r=f.innerHTML;break}}if(l!=qTranslateConfig.default_language){var c=build_translator(l,qTranslateConfig.default_language);r=c[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 f=m[p];h?f.innerHTML=f.innerHTML.replace(h,v):f.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 f=qTranslateConfig.term_name[r.value]||{};o!==qTranslateConfig.default_language&&(r.value=f[o]||""),editinline_activated=function(){return!0};for(var c=document.getElementsByClassName("editinline"),d=0;d<c.length;++d){var h=c[d];"A"===h.tagName&&h.addEventListener("click",editinline_activated)}onTabSwitch=function(){o!==this.lang&&(r.value=f[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,f[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(!w){var a=e("view-post-btn");if(!a||!a.children.length)return;if(w=a.children[0],"A"!=w.tagName)return;b=w.href,E=qtranxj_ce("a",{})}E.href=b,i(E,n),w.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 f=e("title");f&&t(f,u);for(var c=u.getElementsByClassName("wp-editor-area"),d=0;d<c.length;++d){var h=c[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 x=e("attachment_alt");x&&r(x,u);var w,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(x&&(x.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 f=qtranxj_ce("ul",{className:"qtranxs-lang-switch-wrap"}),c=document.getElementsByClassName("wrap")[0],d=c.getElementsByTagName("form")[0];d.parentNode.insertBefore(f,d),languageSwitch=new LanguageSwitch(f,o),languageSwitch.onSwitch(onTabSwitch),languageSwitch.onSwitch(setLangCookie)};new qTranslateX;
qtranslate.php CHANGED
@@ -3,7 +3,7 @@
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
@@ -138,7 +138,7 @@ $q_config['enabled_languages'] = array(
138
139
// sets default language
140
$q_config['default_language'] = 'en';
141
- $q_config['language'] = $q_config['default_language'];//otherwise some early called (before qtranxf_init) functions complain
142
143
// enables browser language detection
144
$q_config['detect_browser_language'] = true;
@@ -153,6 +153,9 @@ $q_config['auto_update_mo'] = true;
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
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.4
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
138
139
// sets default language
140
$q_config['default_language'] = 'en';
141
+ $q_config['language'] = $q_config['default_language'];//otherwise some early called (before qtranxf_init_language) functions complain
142
143
// enables browser language detection
144
$q_config['detect_browser_language'] = 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
qtranslate_compatibility.php CHANGED
@@ -19,8 +19,10 @@ if (!function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')){
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
?>
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
?>
qtranslate_configuration.php CHANGED
@@ -18,43 +18,43 @@
18
*/
19
20
// Exit if accessed directly
21
- if ( !defined( 'ABSPATH' ) ) exit;
22
23
require_once(dirname(__FILE__)."/admin/import_export.php");
24
require_once(dirname(__FILE__)."/admin/activation_hook.php");
25
26
- function qtranxf_update_config()
27
{
28
- //if(!defined('WP_ADMIN')) return;
29
if(!current_user_can('manage_options')) return;
30
- if(isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
31
- // reset all settings
32
- delete_option('qtranslate_language_names');
33
- delete_option('qtranslate_enabled_languages');
34
- delete_option('qtranslate_default_language');
35
- delete_option('qtranslate_flag_location');
36
- delete_option('qtranslate_flags');
37
- delete_option('qtranslate_locales');
38
- delete_option('qtranslate_na_messages');
39
- delete_option('qtranslate_date_formats');
40
- delete_option('qtranslate_time_formats');
41
- delete_option('qtranslate_use_strftime');
42
- delete_option('qtranslate_ignore_file_types');
43
- delete_option('qtranslate_url_mode');
44
- delete_option('qtranslate_detect_browser_language');
45
- delete_option('qtranslate_hide_untranslated');
46
- delete_option('qtranslate_show_displayed_language_prefix');
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');
53
- delete_option('qtranslate_widget_css');
54
- }
55
}
56
}
57
- add_action('qtranxf_init_begin','qtranxf_update_config',10);
58
59
function qtranxf_add_admin_js () {
60
global $q_config;
@@ -255,7 +255,7 @@ function qtranxf_language_form($lang = '', $language_code = '', $language_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,8 +273,8 @@ function qtranxf_language_form($lang = '', $language_code = '', $language_name =
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,6 +435,7 @@ function qtranxf_conf() {
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,7 +669,7 @@ function qtranxf_conf() {
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,9 +703,9 @@ function qtranxf_conf() {
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,10 +741,10 @@ function qtranxf_conf() {
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,7 +757,7 @@ function qtranxf_conf() {
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,6 +775,13 @@ function qtranxf_conf() {
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,8 +917,8 @@ function qtranxf_nav_menu_metabox( $object )
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>
916
<p class="button-controls">
18
*/
19
20
// Exit if accessed directly
21
+ if ( !defined( 'WP_ADMIN' ) ) exit;
22
23
require_once(dirname(__FILE__)."/admin/import_export.php");
24
require_once(dirname(__FILE__)."/admin/activation_hook.php");
25
26
+ function qtranxf_reset_config()
27
{
28
if(!current_user_can('manage_options')) return;
29
+ if( !isset($_POST['qtranslate_reset']) || !isset($_POST['qtranslate_reset2']) ) return;
30
+ // reset all settings
31
+ delete_option('qtranslate_language_names');
32
+ delete_option('qtranslate_enabled_languages');
33
+ delete_option('qtranslate_default_language');
34
+ delete_option('qtranslate_flag_location');
35
+ delete_option('qtranslate_flags');
36
+ delete_option('qtranslate_locales');
37
+ delete_option('qtranslate_na_messages');
38
+ delete_option('qtranslate_date_formats');
39
+ delete_option('qtranslate_time_formats');
40
+ delete_option('qtranslate_use_strftime');
41
+ delete_option('qtranslate_ignore_file_types');
42
+ delete_option('qtranslate_url_mode');
43
+ delete_option('qtranslate_detect_browser_language');
44
+ delete_option('qtranslate_hide_untranslated');
45
+ delete_option('qtranslate_show_displayed_language_prefix');
46
+ delete_option('qtranslate_auto_update_mo');
47
+ delete_option('qtranslate_next_update_mo');
48
+ delete_option('qtranslate_hide_default_language');
49
+ delete_option('qtranslate_qtrans_compatibility');
50
+ delete_option('qtranslate_custom_fields');
51
+ if(isset($_POST['qtranslate_reset3'])) {
52
+ delete_option('qtranslate_term_name');
53
+ delete_option('qtranslate_widget_css');
54
}
55
+ qtranxf_loadConfig();
56
}
57
+ add_action('qtranxf_init_begin','qtranxf_reset_config');
58
59
function qtranxf_add_admin_js () {
60
global $q_config;
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('qtrans_compatibility', QTX_BOOLEAN);
439
qtranxf_updateSetting('custom_fields', QTX_ARRAY);
440
qtranxf_updateSetting('custom_field_classes', QTX_ARRAY);
441
qtranxf_updateSetting('text_field_filters', QTX_ARRAY);
669
echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowup.png" alt="up" /></a>';
670
echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowdown.png" alt="down" /></a>';
671
echo ' <img src="' . trailingslashit(WP_CONTENT_URL) .$q_config['flag_location'].$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
672
+ echo ' '.$q_config['language_name'][$language] . "</label><br/>\n";
673
}
674
?>
675
<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>
703
<th scope="row"><?php _e('URL Modification Mode', 'qtranslate') ?></th>
704
<td>
705
<fieldset><legend class="hidden"><?php _e('URL Modification Mode', 'qtranslate') ?></legend>
706
+ <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/>
707
+ <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/>
708
+ <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/>
709
</fieldset>
710
<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>
711
<br/><br/>
741
<tr valign="top">
742
<th scope="row"><?php _e('Date / Time Conversion', 'qtranslate');?></th>
743
<td>
744
+ <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/>
745
+ <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/>
746
+ <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/>
747
+ <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/>
748
<small><?php _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate'); ?></small>
749
</td>
750
</tr>
757
<tr valign="top">
758
<th scope="row" style="text-align: right">id:</th>
759
<td>
760
+ <input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php echo implode(' ',$q_config['custom_fields']); ?>" style="width:100%"><br/>
761
<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>
762
</td>
763
</tr>
775
<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>
776
</td>
777
</tr>
778
+ <tr valign="top">
779
+ <th scope="row"><?php _e('Compatibility Functions', 'qtranslate');?></th>
780
+ <td>
781
+ <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/>
782
+ <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>
783
+ </td>
784
+ </tr>
785
<?php /*
786
<tr>
787
<th scope="row"><?php _e('Debugging Information', 'qtranslate');?></th>
917
</div>
918
<span class="list-controls hide-if-no-js">
919
<a href="javascript:void(0);" class="help" onclick="jQuery( '#help-login-links' ).toggle();"><?php _e( 'Help' ); ?></a>
920
+ <span class="hide-if-js" id="help-login-links"><br/><a name="help-login-links"></a>
921
+ 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. The field "URL" of inserted menu item allows additional configuration described in <a href="https://wordpress.org/plugins/qtranslate-x/faq" target="blank">FAQ</a>.<br>
922
</span>
923
</span>
924
<p class="button-controls">
qtranslate_core.php CHANGED
@@ -22,49 +22,31 @@ if ( !defined( 'ABSPATH' ) ) exit;
22
23
/* qTranslate Functions */
24
25
- function qtranxf_init() {
26
global $q_config;
27
// check if it isn't already initialized
28
- if(defined('QTRANX_INIT')) return;
29
define('QTRANX_INIT',true);
30
31
- do_action('qtranxf_init_begin');
32
-
33
qtranxf_loadConfig();
34
35
- if(defined('WP_ADMIN')){
36
- // update Gettext Databases if on Backend
37
- if($q_config['auto_update_mo']) qtranxf_updateGettextDatabases();
38
- // update definitions if neccesary
39
- if(current_user_can('manage_categories')) qtranxf_updateTermLibrary();
40
- $q_config['cookie_enabled']=isset($_COOKIE[QTX_COOKIE_NAME_ADMIN]);
41
- }else{
42
- $q_config['cookie_enabled']=isset($_COOKIE[QTX_COOKIE_NAME_FRONT]);
43
- }
44
45
$host=$_SERVER['HTTP_HOST'];
46
//on different port, it will not work for now
47
//if(isset($_SERVER['SERVER_PORT']) && !empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']!='80'){
48
// $host.=':'.$_SERVER['SERVER_PORT'];
49
//}
50
- //qtranxf_dbg_log('qtranxf_init: IP='.$_SERVER['REMOTE_ADDR']);
51
- //qtranxf_dbg_log('qtranxf_init: URL='.$host.$_SERVER['REQUEST_URI']);
52
- //qtranxf_dbg_log('qtranxf_init: POST: ',$_POST);
53
$q_config['url_info'] = qtranxf_detect_language($_SERVER['REQUEST_URI'], $host, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
54
- //qtranxf_dbg_log('qtranxf_init: url_info: ',$q_config['url_info']);
55
56
$q_config['language'] = $q_config['url_info']['language'];
57
$q_config['language'] = apply_filters('qtranslate_language', $q_config['language']);
58
59
- /*
60
- // Check for WP Secret Key Mismatch
61
- global $wp_default_secret_key;
62
- if(strpos($q_config['url_info']['url'],'wp-login.php')!==false && defined('AUTH_KEY') && isset($wp_default_secret_key) && $wp_default_secret_key != AUTH_KEY) {
63
- global $error;
64
- $error = __('Your $wp_default_secret_key is mismatchting with your AUTH_KEY. This might cause you not to be able to login anymore.', 'qtranslate');
65
- }
66
- */
67
-
68
// Filter all options for language tags
69
if(!defined('WP_ADMIN')) {
70
$alloptions = wp_load_alloptions();
@@ -73,32 +55,25 @@ function qtranxf_init() {
73
}
74
}
75
76
- // load plugin translations
77
- load_plugin_textdomain('qtranslate', false, dirname(plugin_basename( __FILE__ )).'/lang');
78
-
79
// remove traces of language (or better not?)
80
//unset($_GET['lang']);
81
- //qtranxf_dbg_log('qtranxf_init: REQUEST_URI='.$_SERVER['REQUEST_URI']);
82
//$_SERVER['REQUEST_URI'] = $q_config['url_info']['url'];
83
//$_SERVER['HTTP_HOST'] = $q_config['url_info']['host'];
84
- //qtranxf_dbg_log('qtranxf_init: REQUEST_URI='.$_SERVER['REQUEST_URI']);
85
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
-
92
- /*
93
- //"WordPress SEO" plugin support - not yet
94
- //if(is_plugin_active( 'wordpress-seo/wp-seo.php' )){//in admin only
95
- if ( defined( 'WPSEO_FILE' ) ) {
96
- //add_filter('wpseo_replacements', 'qtranxf_wpseo_replacements', 0);
97
- add_filter('wpseo_replacements', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', 0);
98
}
99
- */
100
- //qtranxf_dbg_log('qtranxf_init: url_info.url='.$q_config['url_info']['url']);
101
- //qtranxf_dbg_log('qtranxf_init: language='.$q_config['language']);
102
}
103
104
function qtranxf_resolveLangCase($lang,&$caseredirect)
@@ -340,6 +315,48 @@ function qtranxf_http_negotiate_language(){
340
return $lang;
341
}
342
343
function qtranxf_validateBool($var, $default) {
344
if($var==='0') return false; elseif($var==='1') return true; else return $default;
345
}
@@ -385,12 +402,7 @@ function qtranxf_loadConfig() {
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,12 +427,25 @@ function qtranxf_loadConfig() {
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,16 +479,8 @@ function qtranxf_loadConfig() {
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){
465
- add_filter($nm, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
466
- }
467
do_action('qtranslate_loadConfig');
468
}
469
@@ -772,7 +789,7 @@ function qtranxf_ignored_file_type($path) {
772
773
function qtranxf_language_nutral_path($path) {
774
//qtranxf_dbg_echo('qtranxf_language_nutral_path: path='.$path);
775
- if(preg_match("#^(wp-login.php|wp-signup.php|wp-register.php|wp-cron.php|wp-admin/)#", $path)) return true;
776
if(qtranxf_ignored_file_type($path)) return true;
777
return false;
778
}
22
23
/* qTranslate Functions */
24
25
+ function qtranxf_init_language() {
26
global $q_config;
27
// check if it isn't already initialized
28
+ if(defined('QTRANX_INIT')){ echo "qtranxf_init_language second time"; return; }
29
define('QTRANX_INIT',true);
30
31
qtranxf_loadConfig();
32
33
+ $cookie_name = defined('WP_ADMIN') ? QTX_COOKIE_NAME_ADMIN : QTX_COOKIE_NAME_FRONT;
34
+ $q_config['cookie_enabled']=isset($_COOKIE[$cookie_name]);
35
36
$host=$_SERVER['HTTP_HOST'];
37
//on different port, it will not work for now
38
//if(isset($_SERVER['SERVER_PORT']) && !empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']!='80'){
39
// $host.=':'.$_SERVER['SERVER_PORT'];
40
//}
41
+ //qtranxf_dbg_log('qtranxf_init_language: IP='.$_SERVER['REMOTE_ADDR']);
42
+ //qtranxf_dbg_log('qtranxf_init_language: URL='.$host.$_SERVER['REQUEST_URI']);
43
+ //qtranxf_dbg_log('qtranxf_init_language: POST: ',$_POST);
44
$q_config['url_info'] = qtranxf_detect_language($_SERVER['REQUEST_URI'], $host, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
45
+ //qtranxf_dbg_log('qtranxf_init_language: url_info: ',$q_config['url_info']);
46
47
$q_config['language'] = $q_config['url_info']['language'];
48
$q_config['language'] = apply_filters('qtranslate_language', $q_config['language']);
49
50
// Filter all options for language tags
51
if(!defined('WP_ADMIN')) {
52
$alloptions = wp_load_alloptions();
55
}
56
}
57
58
// remove traces of language (or better not?)
59
//unset($_GET['lang']);
60
+ //qtranxf_dbg_log('qtranxf_init_language: REQUEST_URI='.$_SERVER['REQUEST_URI']);
61
//$_SERVER['REQUEST_URI'] = $q_config['url_info']['url'];
62
//$_SERVER['HTTP_HOST'] = $q_config['url_info']['host'];
63
+ //qtranxf_dbg_log('qtranxf_init_language: REQUEST_URI='.$_SERVER['REQUEST_URI']);
64
65
// fix url to prevent xss
66
$q_config['url_info']['url'] = qtranxf_convertURL(add_query_arg('lang',$q_config['default_language'],$q_config['url_info']['url']));
67
68
+ if($q_config['qtrans_compatibility']){
69
+ require_once(dirname(__FILE__)."/qtranslate_compatibility.php");
70
}
71
+
72
+ //allow other plugins to initialize whatever they need for language
73
+ do_action('qtranxf_init_language');
74
+
75
+ //qtranxf_dbg_log('qtranxf_init_language: url_info.url='.$q_config['url_info']['url']);
76
+ //qtranxf_dbg_log('qtranxf_init_language: language='.$q_config['language']);
77
}
78
79
function qtranxf_resolveLangCase($lang,&$caseredirect)
315
return $lang;
316
}
317
318
+ function qtranxf_init() {
319
+ global $q_config;
320
+
321
+ do_action('qtranxf_init_begin');
322
+
323
+ if(defined('WP_ADMIN')){
324
+ // update Gettext Databases if on Backend
325
+ if($q_config['auto_update_mo']) qtranxf_updateGettextDatabases();
326
+ // update definitions if neccesary
327
+ if(current_user_can('manage_categories')) qtranxf_updateTermLibrary();
328
+ }
329
+ /*
330
+ // Check for WP Secret Key Mismatch
331
+ global $wp_default_secret_key;
332
+ if(strpos($q_config['url_info']['url'],'wp-login.php')!==false && defined('AUTH_KEY') && isset($wp_default_secret_key) && $wp_default_secret_key != AUTH_KEY) {
333
+ global $error;
334
+ $error = __('Your $wp_default_secret_key is mismatchting with your AUTH_KEY. This might cause you not to be able to login anymore.', 'qtranslate');
335
+ }
336
+ */
337
+
338
+ // load plugin translations
339
+ load_plugin_textdomain('qtranslate', false, dirname(plugin_basename( __FILE__ )).'/lang');
340
+
341
+ if($q_config['qtrans_compatibility']){
342
+ require_once(dirname(__FILE__)."/qtranslate_compatibility.php");
343
+ }
344
+
345
+ foreach($q_config['text_field_filters'] as $nm){
346
+ add_filter($nm, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
347
+ }
348
+ /*
349
+ //"WordPress SEO" plugin support - not yet
350
+ //if(is_plugin_active( 'wordpress-seo/wp-seo.php' )){//in admin only
351
+ if ( defined( 'WPSEO_FILE' ) ) {
352
+ //add_filter('wpseo_replacements', 'qtranxf_wpseo_replacements', 0);
353
+ add_filter('wpseo_replacements', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', 0);
354
+ }
355
+ */
356
+ //allow other plugins to initialize whatever they need for qTranslate
357
+ do_action('qtranxf_init');
358
+ }
359
+
360
function qtranxf_validateBool($var, $default) {
361
if($var==='0') return false; elseif($var==='1') return true; else return $default;
362
}
402
$use_strftime = get_option('qtranslate_use_strftime');
403
$ignore_file_types = get_option('qtranslate_ignore_file_types');
404
$url_mode = get_option('qtranslate_url_mode');
405
$term_name = get_option('qtranslate_term_name');
406
407
qtranxf_load_option_array('custom_fields');
408
qtranxf_load_option_array('custom_field_classes');
427
qtranxf_load_option_bool('show_displayed_language_prefix');
428
qtranxf_load_option_bool('auto_update_mo');
429
qtranxf_load_option_bool('hide_default_language');
430
+ qtranxf_load_option_bool('qtrans_compatibility');
431
/*
432
+ $detect_browser_language = get_option('qtranslate_detect_browser_language');
433
+ $hide_untranslated = get_option('qtranslate_hide_untranslated');
434
+ $show_displayed_language_prefix = get_option('qtranslate_show_displayed_language_prefix');
435
+ $auto_update_mo = get_option('qtranslate_auto_update_mo');
436
+ $hide_default_language = get_option('qtranslate_hide_default_language');
437
+
438
$detect_browser_language = qtranxf_validateBool($detect_browser_language, $q_config['detect_browser_language']);
439
$hide_untranslated = qtranxf_validateBool($hide_untranslated, $q_config['hide_untranslated']);
440
$show_displayed_language_prefix = qtranxf_validateBool($show_displayed_language_prefix, $q_config['show_displayed_language_prefix']);
441
$auto_update_mo = qtranxf_validateBool($auto_update_mo, $q_config['auto_update_mo']);
442
$hide_default_language = qtranxf_validateBool($hide_default_language, $q_config['hide_default_language']);
443
+
444
+ $q_config['detect_browser_language'] = $detect_browser_language;
445
+ $q_config['hide_untranslated'] = $hide_untranslated;
446
+ $q_config['show_displayed_language_prefix'] = $show_displayed_language_prefix;
447
+ $q_config['auto_update_mo'] = $auto_update_mo;
448
+ $q_config['hide_default_language'] = $hide_default_language;
449
*/
450
// url fix for upgrading users
451
$flag_location = trailingslashit(preg_replace('#^wp-content/#','',$flag_location));
479
$q_config['ignore_file_types'] = $val;
480
481
$q_config['url_mode'] = $url_mode;
482
$q_config['term_name'] = $term_name;
483
484
do_action('qtranslate_loadConfig');
485
}
486
789
790
function qtranxf_language_nutral_path($path) {
791
//qtranxf_dbg_echo('qtranxf_language_nutral_path: path='.$path);
792
+ if(preg_match("#^(wp-comments-post.php|wp-login.php|wp-signup.php|wp-register.php|wp-cron.php|wp-admin/)#", $path)) return true;
793
if(qtranxf_ignored_file_type($path)) return true;
794
return false;
795
}
qtranslate_frontend.php CHANGED
@@ -71,21 +71,76 @@ function qtranxf_get_nav_menu_items( $items, $menu, $args )
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,7 +150,10 @@ function qtranxf_get_nav_menu_items( $items, $menu, $args )
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)
71
$itemid=0;
72
$menu_order=0;
73
$qtransmenu=null;
74
+ $altlang=null;
75
+ $url='';//it will keep the same page
76
+ //options
77
+ $type='LM';//[LM|AL]
78
+ $title='Language';//[none|Language|Current]
79
+ $current=true;//[shown|hidden]
80
+ $flags=true;//[none|all|items]
81
+ $topflag=true;
82
foreach($items as $item)
83
{
84
if($itemid<$item->ID) $itemid=$item->ID;
85
if($menu_order<$item->menu_order) $menu_order=$item->menu_order;
86
+ if( !isset( $item->url ) || stristr( $item->url, 'qtransLangSw' ) === FALSE ) continue;
87
+ $p=strpos($item->url,'?');
88
+ if($p!==FALSE){
89
+ $qs=substr($item->url,$p+1);
90
+ $qs=str_replace('#','',$qs);
91
+ $pars=array(); parse_str($qs,$pars);
92
+ if(isset($pars['type']) && stripos($pars['type'],'AL')!==FALSE ) $type='AL';
93
+ if(isset($pars['flags'])){
94
+ $flags=(stripos($pars['flags'],'no')===FALSE);
95
+ if($flags) $topflag=(stripos($pars['flags'],'items')===FALSE);
96
+ else $topflag=false;
97
+ }
98
+ if(isset($pars['title'])){
99
+ $title=$pars['title'];
100
+ if(stripos($pars['title'],'no')!==FALSE) $title='';
101
+ if(!$topflag && empty($title)) $title='Language';
102
+ }
103
+ if(isset($pars['current'])){
104
+ $current=(stripos($pars['current'],'hid')===FALSE);
105
+ }
106
+ }
107
+ if($type=='AL'){
108
+ foreach($q_config['enabled_languages'] as $lang){
109
+ if($lang==$language) continue;
110
+ $toplang=$lang;
111
+ $altlang=$lang;
112
+ break;
113
+ }
114
+ $item->title=empty($title)?'':$q_config['language_name'][$toplang];
115
+ $item->url=qtranxf_convertURL($url, $altlang, false, true);
116
+ }else{
117
+ $toplang=$language;
118
+ if(empty($title)){
119
+ $item->title='';
120
+ }elseif(stripos($title,'Current')!==FALSE){
121
+ $item->title=$q_config['language_name'][$toplang];
122
+ }else{
123
+ $item->title=__('Language','qtranslate');
124
+ }
125
+ $item->url=null;
126
+ }
127
+ if($topflag){
128
+ if(!empty($item->title)) $item->title.=':&nbsp;';
129
+ $item->title.='<img src="'.$flag_location.$q_config['flag'][$toplang].'">';
130
+ }
131
//$item->classes[] = 'qtranxs_flag_'.$language;
132
$item->classes[] = 'qtranxs-lang-menu';
133
$qtransmenu = $item;
134
}
135
if(!$qtransmenu) return $items;
136
foreach($q_config['enabled_languages'] as $lang)
137
{
138
+ if($type=='AL'){
139
+ if($lang==$language) continue;
140
+ if($lang==$altlang ) continue;
141
+ }elseif(!$current){
142
+ if($lang==$language) continue;
143
+ }
144
$item=new WP_Post((object)array('ID' => ++$itemid));
145
//$item->db_id=$item->ID;
146
$item->menu_item_parent=$qtransmenu->ID;
150
//$item->object_id=0;
151
$item->type='custom';
152
$item->type_label='Custom';
153
+ $item->title=$q_config['language_name'][$lang];
154
+ if($flags){
155
+ $item->title='<img src="'.$flag_location.$q_config['flag'][$lang].'">&nbsp;'.$item->title;
156
+ }
157
$item->post_title=$item->title;
158
$item->post_name='language-menuitem-'.$lang;
159
if($lang!=$language)
qtranslate_hooks.php CHANGED
@@ -201,8 +201,9 @@ function qtranxf_gettext_with_context($translated_text) {
201
// add_action('category_add_form', 'qtranxf_modifyTermFormFor');
202
// add_action('post_tag_add_form', 'qtranxf_modifyTermFormFor');
203
// add_action('link_category_add_form', 'qtranxf_modifyTermFormFor');
204
add_action('widgets_init', 'qtranxf_widget_init');
205
- add_action('plugins_loaded', 'qtranxf_init', 2);
206
207
// Hooks (execution time critical filters)
208
add_filter('gettext', 'qtranxf_gettext',0);
201
// add_action('category_add_form', 'qtranxf_modifyTermFormFor');
202
// add_action('post_tag_add_form', 'qtranxf_modifyTermFormFor');
203
// add_action('link_category_add_form', 'qtranxf_modifyTermFormFor');
204
+ add_action('plugins_loaded', 'qtranxf_init_language', 2);//user is not authenticated yet
205
+ add_action('init', 'qtranxf_init');//user is authenticated
206
add_action('widgets_init', 'qtranxf_widget_init');
207
208
// Hooks (execution time critical filters)
209
add_filter('gettext', 'qtranxf_gettext',0);
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
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
@@ -59,7 +59,7 @@ Installation of this plugin is no different from any other plugin:
59
60
Yes, some themes put additional text fields per page or per post. By default, those fields have no way to respond to language switching buttons in editors. However, you may enter "id" or "class" name attribute of those fields into "Custom Fields" section of "Languages" configuration page in "Settings", and they will then respond to the language switching buttons allowing you to enter different text for each language. To lookup "id" or "class", right-click on the field in the post or the page editor, choose "Inspect Element", and look for which attributes are defined for that field. If you cannot uniquely distinct the field neither by if nor by class, report on the forum threads.
61
62
- The theme must pass those values through [translation](http://codex.wordpress.org/Function_Reference/_2) function '__()' before displaying on the front-end output. If this is not done, you will see the text of all languages displayed one after another. Most themes use '__()' translation by default, otherwise you may ask theme author to make this little modification for each field you need to be translatable. However, sometimes, they pass a value through 'apply_filters()' function before displaying the value, and then you may put that filter name into configuration filed "Custom Filters" to get the value translated properly.
63
64
The following fields are pre-configured to be translatable by default:
65
@@ -82,6 +82,32 @@ If a theme uses `__()` [translate](http://codex.wordpress.org/Function_Reference
82
83
The '`[:]`' syntax works well for one-line text fields, while '`<--:-->`' syntax is more suitable for text areas.
84
85
= What is wrong with the original qTranslate? =
86
87
qTranslate still works fine at frontend, except one known to me bug of incorrect date display in comments for some themes. However, its backend breaks tinyMCE content editor in post editing page. Many people have been reporting the problems, but the author keeps silence. qTranslate-X uses the same database backend, and updated admin interface with a slightly different design.
@@ -115,6 +141,21 @@ One can find the original qTranslate FAQ [here](https://wordpress.org/plugins/qt
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.
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.4
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
59
60
Yes, some themes put additional text fields per page or per post. By default, those fields have no way to respond to language switching buttons in editors. However, you may enter "id" or "class" name attribute of those fields into "Custom Fields" section of "Languages" configuration page in "Settings", and they will then respond to the language switching buttons allowing you to enter different text for each language. To lookup "id" or "class", right-click on the field in the post or the page editor, choose "Inspect Element", and look for which attributes are defined for that field. If you cannot uniquely distinct the field neither by if nor by class, report on the forum threads.
61
62
+ The theme must pass those values through [translation](http://codex.wordpress.org/Function_Reference/_2) function `__()` before displaying on the front-end output. If this is not done, you will see the text of all languages displayed one after another. Most themes use `__()` translation by default, otherwise you may ask theme author to make this little modification for each field you need to be translatable. However, sometimes, they pass a value through 'apply_filters()' function before displaying the value, and then you may put that filter name into configuration filed "Custom Filters" to get the value translated properly.
63
64
The following fields are pre-configured to be translatable by default:
65
82
83
The '`[:]`' syntax works well for one-line text fields, while '`<--:-->`' syntax is more suitable for text areas.
84
85
+ = Can I change the look of Language Switcher Menu? =
86
+
87
+ The following query options can be typed in the field "URL" of "Language Menu" custom menu item, after "#qtransLangSw?", separated by "&", same way as options are provided on a query string:
88
+
89
+ - type=[LM|AL] - type of menu:
90
+ - "LM" - Language Menu (default).
91
+ - "AL" - Alternative Language: the top menu entry displays the first available language other than the current.
92
+
93
+ - title=[none|Language|Current] - title text of the top item:
94
+ - "Language" - word "Language" translated to current language (default).
95
+ - "none" - no title in the top of menu, flag only.
96
+ - "Current" - displays current language name.
97
+
98
+ - flags=[none|all|items] - the way to display language flags:
99
+ - "none" - no flag is shown in any item, including the top item.
100
+ - "all" - all items show flag, including the top item.
101
+ - "items" - only sub-items show corresponding flag, top item does not.
102
+
103
+ - current=[shown|hidden] - whether to display the current language in the menu.
104
+
105
+ We understand that this is not a very user-friendly way to adjust the options, but it works, and we will provide a better in-editor interface to specify them in the future.
106
+
107
+ = How do I customize images for flags? =
108
+
109
+ If you wish to use different flag images, point option "Flag Image Path" to your own folder, containing custom images outside of "plugins" or "themes" folders. Most people would put it somewhere under "uploads" folder.
110
+
111
= What is wrong with the original qTranslate? =
112
113
qTranslate still works fine at frontend, except one known to me bug of incorrect date display in comments for some themes. However, its backend breaks tinyMCE content editor in post editing page. Many people have been reporting the problems, but the author keeps silence. qTranslate-X uses the same database backend, and updated admin interface with a slightly different design.
141
142
== Changelog ==
143
144
+ = 2.9.4 =
145
+ * fix for https://wordpress.org/support/topic/comment-shows-404-error
146
+
147
+ = 2.9.3 =
148
+ * "Language Switcher" menu options, read [FAQ](https://wordpress.org/plugins/qtranslate-x/faq/) for more information.
149
+ * fix for too early call to `current_user_can`, which caused a debug notice from within some other plugins.
150
+ * fix for https://wordpress.org/support/topic/editor-adds-characters-before-text
151
+
152
+ = 2.9.2 =
153
+ * Option "Compatibility Functions" to enable former qTranslate function names: qtrans_getLanguage, qtrans_convertURL, qtrans_use, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtranxf_useTermLib and qtrans_getSortedLanguages
154
+ * "Language Switcher" menu options: flags=[yes|no], type=[LM|AL]. They can be used in a query string in URL field of Language Menu.
155
+
156
+ = 2.9.1 =
157
+ * JS bug fixed, which would not show any field value if no languages are yet configured for that field.
158
+
159
= 2.9 =
160
* ability to enable "Custom Fields" by either "id" or "class" attribute.
161
* ability to specify filters, which other theme or plugins define, to pass relevant data through the translation.