qTranslate X - Version 3.4.6.7

Version Description

Download this release

Release Info

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

Code changes from version 3.4.6.6 to 3.4.6.7

admin/js/common.js CHANGED
@@ -35,8 +35,7 @@ function co(t,o){ ++cc; console.log('== '+cc+': '+t+'%o',o); }
35
/**
36
* since 3.2.7
37
*/
38
- qtranxj_get_split_blocks = function(text)
39
- {
40
var split_regex = /(<!--:[a-z]{2}-->|<!--:-->|\[:[a-z]{2}\]|\[:\]|\{:[a-z]{2}\}|\{:\})/gi; // @since 3.3.6 swirly brackets
41
return text.xsplit(split_regex);
42
}
@@ -44,8 +43,7 @@ qtranxj_get_split_blocks = function(text)
44
/**
45
* since 3.2.7
46
*/
47
- qtranxj_split = function(text)
48
- {
49
var blocks = qtranxj_get_split_blocks(text);
50
return qtranxj_split_blocks(blocks);
51
}
@@ -53,12 +51,10 @@ qtranxj_split = function(text)
53
/**
54
* since 3.1-b1 - closing tag [:]
55
*/
56
- qtranxj_split_blocks = function(blocks)
57
- {
58
var result = new Object;
59
//for(var i=0; i<qTranslateConfig.enabled_languages.length; ++i)
60
- for(var lang in qTranslateConfig.language_config)
61
- {
62
//var lang=qTranslateConfig.enabled_languages[i];
63
result[lang] = '';
64
}
@@ -114,8 +110,7 @@ qtranxj_split_blocks = function(blocks)
114
return result;
115
}
116
117
- function qtranxj_get_cookie(cname)
118
- {
119
var nm = cname + "=";
120
var ca = document.cookie.split(';');
121
//c('ca='+ca);
@@ -152,13 +147,10 @@ String.prototype.xsplit = function(_regEx){
152
153
//Since 3.2.7 removed: function qtranxj_isArray(obj){ return obj.constructor.toString().indexOf('Array') >= 0; }
154
155
- function qtranxj_ce(tagName, props, pNode, isFirst)
156
- {
157
var el= document.createElement(tagName);
158
- if (props)
159
- {
160
- for(prop in props)
161
- {
162
//try
163
{
164
el[prop]=props[prop];
@@ -169,22 +161,18 @@ function qtranxj_ce(tagName, props, pNode, isFirst)
169
}
170
}
171
}
172
- if (pNode)
173
- {
174
- if (isFirst && pNode.firstChild)
175
- {
176
pNode.insertBefore(el, pNode.firstChild);
177
}
178
- else
179
- {
180
pNode.appendChild(el);
181
}
182
}
183
return el;
184
}
185
186
- var qTranslateX=function(pg)
187
- {
188
var qtx = this;
189
qTranslateConfig.qtx = this;
190
@@ -259,8 +247,7 @@ var qTranslateX=function(pg)
259
var contentHooks={};
260
var contentHookId = 0;
261
262
- var updateFusedValueH=function(id,value)
263
- {
264
var h = contentHooks[id];
265
var text = value.trim();
266
//c('updateFusedValueH['+id+'] lang='+h.lang+'; text:'+text);
@@ -281,8 +268,7 @@ var qTranslateX=function(pg)
281
*
282
* @since 3.3.2
283
*/
284
- this.addContentHook=function(inpField,encode,field_name)
285
- {
286
//co('addContentHook: inpField:',inpField);
287
//co('addContentHook: encode:',encode);
288
//co('addContentHook: field_name:',field_name);
@@ -291,7 +277,15 @@ var qTranslateX=function(pg)
291
case 'TEXTAREA': break;
292
case 'INPUT':
293
//co('addContentHook: inpField.type=',inpField.type);
294
- if(inpField.type.match(/(button|checkbox|password|radio|submit)/)) return false;
295
break;
296
default: return false;
297
}
@@ -403,8 +397,7 @@ var qTranslateX=function(pg)
403
this.addContentHookB=function(inpField) { return qtx.addContentHook(inpField,'['); }
404
405
this.addContentHookById=function(id,sep,nm) { return qtx.addContentHook(document.getElementById(id),sep,nm); }
406
- this.addContentHookByIdName=function(nm)
407
- {
408
var sep;
409
//if(nm.indexOf('<')==0 || nm.indexOf('[')==0){
410
switch(nm[0]){
@@ -426,23 +419,20 @@ var qTranslateX=function(pg)
426
*
427
* @since 3.1-b2
428
*/
429
- this.addContentHooks=function(fields,sep,field_name)
430
- {
431
for(var i=0; i<fields.length; ++i){
432
var field = fields[i];
433
qtx.addContentHook(field,sep,field_name);
434
}
435
}
436
437
- var addContentHooksByClassName=function(nm,container,sep)
438
- {
439
if(!container) container=document;
440
var fields=container.getElementsByClassName(nm);
441
qtx.addContentHooks(fields,sep);
442
}
443
444
- this.addContentHooksByClass=function(nm,container)
445
- {
446
var sep;
447
if(nm.indexOf('<')==0 || nm.indexOf('[')==0){
448
sep=nm.substring(0,1);
@@ -457,8 +447,7 @@ var qTranslateX=function(pg)
457
*
458
* @since 3.3.2
459
*/
460
- this.addContentHooksByTagInClass=function(nm,tag,container)
461
- {
462
var elems=container.getElementsByClassName(nm);
463
for(var i=0; i<elems.length; ++i){
464
var elem=elems[i];
@@ -467,8 +456,7 @@ var qTranslateX=function(pg)
467
}
468
}
469
470
- var removeContentHookH=function(h)
471
- {
472
if(!h) return false;
473
if(h.sepfield) jQuery(h.sepfield).remove();
474
for(var lang in h.fields){
@@ -484,8 +472,7 @@ var qTranslateX=function(pg)
484
*
485
* @since 3.3
486
*/
487
- this.removeContentHook=function(inpField)
488
- {
489
if( !inpField ) return false;
490
if( !inpField.id ) return false;
491
if( !contentHooks[inpField.id] ) return false;
@@ -506,8 +493,7 @@ var qTranslateX=function(pg)
506
* https://qtranslatexteam.wordpress.com/integration/
507
* Re-create a hook, after a piece of HTML is dynamically replaced with a custom Java script.
508
*/
509
- this.refreshContentHook=function(inpField)
510
- {
511
if( !inpField ) return false;
512
if( !inpField.id ) return false;
513
var h = contentHooks[inpField.id];
@@ -519,8 +505,7 @@ var qTranslateX=function(pg)
519
* @since 3.2.7
520
*/
521
var displayHookNodes=[];
522
- var addDisplayHookNode=function(nd)
523
- {
524
if(!nd.nodeValue) return 0;
525
var blocks = qtranxj_get_split_blocks(nd.nodeValue);
526
if( !blocks || !blocks.length || blocks.length == 1 ) return 0;
@@ -541,8 +526,7 @@ var qTranslateX=function(pg)
541
* @since 3.2.7
542
*/
543
var displayHookAttrs=[];
544
- var addDisplayHookAttr=function(nd)
545
- {
546
if(!nd.value) return 0;
547
var blocks = qtranxj_get_split_blocks(nd.value);
548
if( !blocks || !blocks.length || blocks.length == 1 ) return 0;
@@ -561,8 +545,7 @@ var qTranslateX=function(pg)
561
*
562
* @since 3.2.7 switched to use of nodeValue instead of innerHTML.
563
*/
564
- this.addDisplayHook=function(elem)
565
- {
566
//co('addDisplayHook: this: ',this);
567
if(!elem || !elem.tagName) return 0;
568
switch(elem.tagName){
@@ -602,8 +585,7 @@ var qTranslateX=function(pg)
602
*/
603
this.addDisplayHookById=function(id) { return qtx.addDisplayHook(document.getElementById(id)); }
604
605
- var updateTinyMCE=function(h)
606
- {
607
text = h.contentField.value;
608
//co('updateTinyMCE: window.switchEditors: ',window.switchEditors);
609
//c('updateTinyMCE: text:'+text);
@@ -615,8 +597,7 @@ var qTranslateX=function(pg)
615
h.mce.setContent(text,{format: 'html'});
616
}
617
618
- var onTabSwitch=function(lang)
619
- {
620
//var qtx = this;
621
setLangCookie(lang);
622
for(var i = displayHookNodes.length; --i >= 0; ){
@@ -669,8 +650,7 @@ var qTranslateX=function(pg)
669
*
670
* @since 3.0
671
*/
672
- this.addDisplayHooks=function(elems)
673
- {
674
//c('addDisplayHooks: elems.length='+elems.length);
675
for(var i=0; i<elems.length; ++i){
676
var e=elems[i];
@@ -686,8 +666,7 @@ var qTranslateX=function(pg)
686
*
687
* @since 3.3
688
*/
689
- this.addDisplayHooksByClass=function(nm,container)
690
- {
691
//co('addDisplayHooksByClass: container:',container);
692
var elems=container.getElementsByClassName(nm);
693
//co('addDisplayHooksByClass: elems('+nm+'):',elems);
@@ -701,8 +680,7 @@ var qTranslateX=function(pg)
701
*
702
* @since 3.3
703
*/
704
- this.addDisplayHooksByTagInClass=function(nm,tag,container)
705
- {
706
var elems=container.getElementsByClassName(nm);
707
//c('addDisplayHooksByClass: elems.length='+elems.length);
708
for(var i=0; i<elems.length; ++i){
@@ -718,8 +696,7 @@ var qTranslateX=function(pg)
718
* @since 3.1-b2 - renamed to addCustomContentHooks, since addContentHooks used in qTranslateConfig.js
719
* @since 3.0 - addContentHooks
720
*/
721
- this.addCustomContentHooks=function()
722
- {
723
//c('qTranslateConfig.custom_fields.length='+qTranslateConfig.custom_fields.length);
724
for(var i=0; i<qTranslateConfig.custom_fields.length; ++i){
725
var nm=qTranslateConfig.custom_fields[i];
@@ -742,8 +719,7 @@ var qTranslateX=function(pg)
742
* i18n-multilingual-display
743
* @since 3.4
744
*/
745
- var addMultilingualHooks=function($)
746
- {
747
$('.i18n-multilingual').each(function(i,e){ qtx.addContentHook(e,'['); });
748
$('.i18n-multilingual-curly').each(function(i,e){ qtx.addContentHook(e,'{'); });
749
$('.i18n-multilingual-term').each(function(i,e){ qtx.addContentHook(e,'term'); });
@@ -755,8 +731,7 @@ var qTranslateX=function(pg)
755
* Parses page configuration, loaded in qtranxf_get_admin_page_config_post_type.
756
* @since 3.1-b2
757
*/
758
- var addPageHooks=function(page_config_forms)
759
- {
760
for(var form_id in page_config_forms){
761
var frm = page_config_forms[form_id];
762
var form;
@@ -843,10 +818,8 @@ var qTranslateX=function(pg)
843
}
844
}
845
846
- var addContentHooksTinyMCE=function()
847
- {
848
- function setEditorHooks(ed)
849
- {
850
var id = ed.id;
851
if (!id) return;
852
var h=contentHooks[id];
@@ -902,8 +875,7 @@ var qTranslateX=function(pg)
902
}
903
904
/** Sets hooks on HTML-loaded TinyMCE editors via tinyMCEPreInit.mceInit. */
905
- setTinyMceInit=function()
906
- {
907
//co('setTinyMceInit: this: ', this);
908
if (!window.tinyMCE) return;
909
for(var key in contentHooks){
@@ -934,8 +906,7 @@ var qTranslateX=function(pg)
934
setTinyMceInit();
935
936
/** Adds more TinyMCE editors, which may have been initialized dynamically. */
937
- loadTinyMceHooks=function()
938
- {
939
if (!window.tinyMCE) return;
940
if (!tinyMCE.editors) return;
941
for(var i=0; i<tinyMCE.editors.length; ++i){
@@ -1071,7 +1042,9 @@ var qTranslateX=function(pg)
1071
addMultilingualHooks(jQuery);
1072
1073
//co('displayHookNodes.length=',displayHookNodes.length);
1074
//co('displayHookAttrs.length=',displayHookAttrs.length);
1075
if(!displayHookNodes.length && !displayHookAttrs.length){
1076
var ok = false;
1077
for(var key in contentHooks){ ok = true; break; }
@@ -1084,8 +1057,7 @@ var qTranslateX=function(pg)
1084
* former switchTab
1085
* @since 3.3.2
1086
*/
1087
- this.switchActiveLanguage = function()
1088
- {
1089
//co('switchActiveLanguage: this=',this);
1090
var tabSwitch = this;
1091
var lang = tabSwitch.lang;
@@ -1096,12 +1068,10 @@ var qTranslateX=function(pg)
1096
if ( qTranslateConfig.activeLanguage === lang ){
1097
return;
1098
}
1099
- if (qTranslateConfig.activeLanguage)
1100
- {
1101
var ok2switch = true;
1102
var onTabSwitchFunctionsSave = qTranslateConfig.onTabSwitchFunctionsSave;
1103
- for(var i=0; i<onTabSwitchFunctionsSave.length; ++i)
1104
- {
1105
var ok = onTabSwitchFunctionsSave[i].call(qTranslateConfig.qtx,qTranslateConfig.activeLanguage,lang);
1106
if(ok === false) ok2switch = false;
1107
}
@@ -1126,13 +1096,11 @@ var qTranslateX=function(pg)
1126
}
1127
}
1128
var onTabSwitchFunctions = qTranslateConfig.onTabSwitchFunctions;
1129
- for(var i=0; i<onTabSwitchFunctions.length; ++i)
1130
- {
1131
onTabSwitchFunctions[i].call(qTranslateConfig.qtx,lang,langFrom);
1132
}
1133
var onTabSwitchFunctionsLoad = qTranslateConfig.onTabSwitchFunctionsLoad;
1134
- for(var i=0; i<onTabSwitchFunctionsLoad.length; ++i)
1135
- {
1136
onTabSwitchFunctionsLoad[i].call(qTranslateConfig.qtx,lang,langFrom);
1137
}
1138
}
@@ -1141,13 +1109,11 @@ var qTranslateX=function(pg)
1141
* former switchTab
1142
* @since 3.3.2
1143
*/
1144
- var createSetOfLSB = function()
1145
- {
1146
var langSwitchWrap=qtranxj_ce('ul', {className: qTranslateConfig.lsb_style_wrap_class});
1147
var langs=qTranslateConfig.language_config;
1148
if(!qTranslateConfig.tabSwitches) qTranslateConfig.tabSwitches={};
1149
- for(var lang in langs)
1150
- {
1151
var lang_conf = langs[lang];
1152
var flag_location=qTranslateConfig.flag_location;
1153
var tabSwitch=qtranxj_ce ('li', {lang: lang, className: 'qtranxs-lang-switch', onclick: qTranslateConfig.qtx.switchActiveLanguage }, langSwitchWrap );
@@ -1185,18 +1151,22 @@ var qTranslateX=function(pg)
1185
//create sets of LSB
1186
var anchors=[];
1187
if(qTranslateConfig.page_config && qTranslateConfig.page_config.anchors){
1188
- //for(var i=0; i < qTranslateConfig.page_config.anchors.length; ++i){
1189
- // var anchor = qTranslateConfig.page_config.anchors[i];
1190
- // var f = document.getElementById(anchor.id);
1191
for(var id in qTranslateConfig.page_config.anchors){
1192
- var f = document.getElementById(id);
1193
- if(!f) continue;
1194
var anchor = qTranslateConfig.page_config.anchors[id];
1195
- anchor.id = id;
1196
- anchor.f = f;
1197
- anchors.push(anchor);
1198
}
1199
}
1200
if(!anchors.length){
1201
var f=pg.langSwitchWrapAnchor;
1202
if(!f){
@@ -1206,6 +1176,7 @@ var qTranslateX=function(pg)
1206
}
1207
for(var i=0; i < anchors.length; ++i){
1208
var anchor = anchors[i];
1209
if( !anchor.where || anchor.where.indexOf('before') >= 0 ){
1210
//var langSwitchWrap=qtranxj_ce('ul', {className: qTranslateConfig.lsb_style_wrap_class});
1211
//var languageSwitch = new qtranxj_LanguageSwitch(langSwitchWrap);
35
/**
36
* since 3.2.7
37
*/
38
+ qtranxj_get_split_blocks = function(text) {
39
var split_regex = /(<!--:[a-z]{2}-->|<!--:-->|\[:[a-z]{2}\]|\[:\]|\{:[a-z]{2}\}|\{:\})/gi; // @since 3.3.6 swirly brackets
40
return text.xsplit(split_regex);
41
}
43
/**
44
* since 3.2.7
45
*/
46
+ qtranxj_split = function(text) {
47
var blocks = qtranxj_get_split_blocks(text);
48
return qtranxj_split_blocks(blocks);
49
}
51
/**
52
* since 3.1-b1 - closing tag [:]
53
*/
54
+ qtranxj_split_blocks = function(blocks) {
55
var result = new Object;
56
//for(var i=0; i<qTranslateConfig.enabled_languages.length; ++i)
57
+ for(var lang in qTranslateConfig.language_config) {
58
//var lang=qTranslateConfig.enabled_languages[i];
59
result[lang] = '';
60
}
110
return result;
111
}
112
113
+ function qtranxj_get_cookie(cname) {
114
var nm = cname + "=";
115
var ca = document.cookie.split(';');
116
//c('ca='+ca);
147
148
//Since 3.2.7 removed: function qtranxj_isArray(obj){ return obj.constructor.toString().indexOf('Array') >= 0; }
149
150
+ function qtranxj_ce(tagName, props, pNode, isFirst) {
151
var el= document.createElement(tagName);
152
+ if (props) {
153
+ for(prop in props) {
154
//try
155
{
156
el[prop]=props[prop];
161
}
162
}
163
}
164
+ if (pNode) {
165
+ if (isFirst && pNode.firstChild) {
166
pNode.insertBefore(el, pNode.firstChild);
167
}
168
+ else {
169
pNode.appendChild(el);
170
}
171
}
172
return el;
173
}
174
175
+ var qTranslateX=function(pg) {
176
var qtx = this;
177
qTranslateConfig.qtx = this;
178
247
var contentHooks={};
248
var contentHookId = 0;
249
250
+ var updateFusedValueH=function(id,value) {
251
var h = contentHooks[id];
252
var text = value.trim();
253
//c('updateFusedValueH['+id+'] lang='+h.lang+'; text:'+text);
268
*
269
* @since 3.3.2
270
*/
271
+ this.addContentHook=function(inpField,encode,field_name) {
272
//co('addContentHook: inpField:',inpField);
273
//co('addContentHook: encode:',encode);
274
//co('addContentHook: field_name:',field_name);
277
case 'TEXTAREA': break;
278
case 'INPUT':
279
//co('addContentHook: inpField.type=',inpField.type);
280
+ //reject the types which cannot be multilingual
281
+ switch (inpField.type) {
282
+ case 'button':
283
+ case 'checkbox':
284
+ case 'password':
285
+ case 'radio':
286
+ case 'submit': return false;
287
+ }
288
+ //if(inpField.type.match(/(button|checkbox|password|radio|submit)/)) return false;
289
break;
290
default: return false;
291
}
397
this.addContentHookB=function(inpField) { return qtx.addContentHook(inpField,'['); }
398
399
this.addContentHookById=function(id,sep,nm) { return qtx.addContentHook(document.getElementById(id),sep,nm); }
400
+ this.addContentHookByIdName=function(nm) {
401
var sep;
402
//if(nm.indexOf('<')==0 || nm.indexOf('[')==0){
403
switch(nm[0]){
419
*
420
* @since 3.1-b2
421
*/
422
+ this.addContentHooks=function(fields,sep,field_name) {
423
for(var i=0; i<fields.length; ++i){
424
var field = fields[i];
425
qtx.addContentHook(field,sep,field_name);
426
}
427
}
428
429
+ var addContentHooksByClassName=function(nm,container,sep) {
430
if(!container) container=document;
431
var fields=container.getElementsByClassName(nm);
432
qtx.addContentHooks(fields,sep);
433
}
434
435
+ this.addContentHooksByClass=function(nm,container) {
436
var sep;
437
if(nm.indexOf('<')==0 || nm.indexOf('[')==0){
438
sep=nm.substring(0,1);
447
*
448
* @since 3.3.2
449
*/
450
+ this.addContentHooksByTagInClass=function(nm,tag,container) {
451
var elems=container.getElementsByClassName(nm);
452
for(var i=0; i<elems.length; ++i){
453
var elem=elems[i];
456
}
457
}
458
459
+ var removeContentHookH=function(h) {
460
if(!h) return false;
461
if(h.sepfield) jQuery(h.sepfield).remove();
462
for(var lang in h.fields){
472
*
473
* @since 3.3
474
*/
475
+ this.removeContentHook=function(inpField) {
476
if( !inpField ) return false;
477
if( !inpField.id ) return false;
478
if( !contentHooks[inpField.id] ) return false;
493
* https://qtranslatexteam.wordpress.com/integration/
494
* Re-create a hook, after a piece of HTML is dynamically replaced with a custom Java script.
495
*/
496
+ this.refreshContentHook=function(inpField) {
497
if( !inpField ) return false;
498
if( !inpField.id ) return false;
499
var h = contentHooks[inpField.id];
505
* @since 3.2.7
506
*/
507
var displayHookNodes=[];
508
+ var addDisplayHookNode = function (nd) {
509
if(!nd.nodeValue) return 0;
510
var blocks = qtranxj_get_split_blocks(nd.nodeValue);
511
if( !blocks || !blocks.length || blocks.length == 1 ) return 0;
526
* @since 3.2.7
527
*/
528
var displayHookAttrs=[];
529
+ var addDisplayHookAttr = function (nd) {
530
if(!nd.value) return 0;
531
var blocks = qtranxj_get_split_blocks(nd.value);
532
if( !blocks || !blocks.length || blocks.length == 1 ) return 0;
545
*
546
* @since 3.2.7 switched to use of nodeValue instead of innerHTML.
547
*/
548
+ this.addDisplayHook = function (elem) {
549
//co('addDisplayHook: this: ',this);
550
if(!elem || !elem.tagName) return 0;
551
switch(elem.tagName){
585
*/
586
this.addDisplayHookById=function(id) { return qtx.addDisplayHook(document.getElementById(id)); }
587
588
+ var updateTinyMCE = function (h) {
589
text = h.contentField.value;
590
//co('updateTinyMCE: window.switchEditors: ',window.switchEditors);
591
//c('updateTinyMCE: text:'+text);
597
h.mce.setContent(text,{format: 'html'});
598
}
599
600
+ var onTabSwitch = function (lang) {
601
//var qtx = this;
602
setLangCookie(lang);
603
for(var i = displayHookNodes.length; --i >= 0; ){
650
*
651
* @since 3.0
652
*/
653
+ this.addDisplayHooks = function (elems) {
654
//c('addDisplayHooks: elems.length='+elems.length);
655
for(var i=0; i<elems.length; ++i){
656
var e=elems[i];
666
*
667
* @since 3.3
668
*/
669
+ this.addDisplayHooksByClass = function (nm, container) {
670
//co('addDisplayHooksByClass: container:',container);
671
var elems=container.getElementsByClassName(nm);
672
//co('addDisplayHooksByClass: elems('+nm+'):',elems);
680
*
681
* @since 3.3
682
*/
683
+ this.addDisplayHooksByTagInClass = function (nm, tag, container) {
684
var elems=container.getElementsByClassName(nm);
685
//c('addDisplayHooksByClass: elems.length='+elems.length);
686
for(var i=0; i<elems.length; ++i){
696
* @since 3.1-b2 - renamed to addCustomContentHooks, since addContentHooks used in qTranslateConfig.js
697
* @since 3.0 - addContentHooks
698
*/
699
+ this.addCustomContentHooks = function () {
700
//c('qTranslateConfig.custom_fields.length='+qTranslateConfig.custom_fields.length);
701
for(var i=0; i<qTranslateConfig.custom_fields.length; ++i){
702
var nm=qTranslateConfig.custom_fields[i];
719
* i18n-multilingual-display
720
* @since 3.4
721
*/
722
+ var addMultilingualHooks = function ($) {
723
$('.i18n-multilingual').each(function(i,e){ qtx.addContentHook(e,'['); });
724
$('.i18n-multilingual-curly').each(function(i,e){ qtx.addContentHook(e,'{'); });
725
$('.i18n-multilingual-term').each(function(i,e){ qtx.addContentHook(e,'term'); });
731
* Parses page configuration, loaded in qtranxf_get_admin_page_config_post_type.
732
* @since 3.1-b2
733
*/
734
+ var addPageHooks = function (page_config_forms) {
735
for(var form_id in page_config_forms){
736
var frm = page_config_forms[form_id];
737
var form;
818
}
819
}
820
821
+ var addContentHooksTinyMCE = function () {
822
+ function setEditorHooks(ed) {
823
var id = ed.id;
824
if (!id) return;
825
var h=contentHooks[id];
875
}
876
877
/** Sets hooks on HTML-loaded TinyMCE editors via tinyMCEPreInit.mceInit. */
878
+ setTinyMceInit = function () {
879
//co('setTinyMceInit: this: ', this);
880
if (!window.tinyMCE) return;
881
for(var key in contentHooks){
906
setTinyMceInit();
907
908
/** Adds more TinyMCE editors, which may have been initialized dynamically. */
909
+ loadTinyMceHooks = function () {
910
if (!window.tinyMCE) return;
911
if (!tinyMCE.editors) return;
912
for(var i=0; i<tinyMCE.editors.length; ++i){
1042
addMultilingualHooks(jQuery);
1043
1044
//co('displayHookNodes.length=',displayHookNodes.length);
1045
+ //co('displayHookNodes: ',displayHookNodes);
1046
//co('displayHookAttrs.length=',displayHookAttrs.length);
1047
+ //co('contentHooks: ',contentHooks);
1048
if(!displayHookNodes.length && !displayHookAttrs.length){
1049
var ok = false;
1050
for(var key in contentHooks){ ok = true; break; }
1057
* former switchTab
1058
* @since 3.3.2
1059
*/
1060
+ this.switchActiveLanguage = function () {
1061
//co('switchActiveLanguage: this=',this);
1062
var tabSwitch = this;
1063
var lang = tabSwitch.lang;
1068
if ( qTranslateConfig.activeLanguage === lang ){
1069
return;
1070
}
1071
+ if (qTranslateConfig.activeLanguage) {
1072
var ok2switch = true;
1073
var onTabSwitchFunctionsSave = qTranslateConfig.onTabSwitchFunctionsSave;
1074
+ for (var i = 0; i < onTabSwitchFunctionsSave.length; ++i) {
1075
var ok = onTabSwitchFunctionsSave[i].call(qTranslateConfig.qtx,qTranslateConfig.activeLanguage,lang);
1076
if(ok === false) ok2switch = false;
1077
}
1096
}
1097
}
1098
var onTabSwitchFunctions = qTranslateConfig.onTabSwitchFunctions;
1099
+ for (var i = 0; i < onTabSwitchFunctions.length; ++i) {
1100
onTabSwitchFunctions[i].call(qTranslateConfig.qtx,lang,langFrom);
1101
}
1102
var onTabSwitchFunctionsLoad = qTranslateConfig.onTabSwitchFunctionsLoad;
1103
+ for (var i = 0; i < onTabSwitchFunctionsLoad.length; ++i) {
1104
onTabSwitchFunctionsLoad[i].call(qTranslateConfig.qtx,lang,langFrom);
1105
}
1106
}
1109
* former switchTab
1110
* @since 3.3.2
1111
*/
1112
+ var createSetOfLSB = function () {
1113
var langSwitchWrap=qtranxj_ce('ul', {className: qTranslateConfig.lsb_style_wrap_class});
1114
var langs=qTranslateConfig.language_config;
1115
if(!qTranslateConfig.tabSwitches) qTranslateConfig.tabSwitches={};
1116
+ for (var lang in langs) {
1117
var lang_conf = langs[lang];
1118
var flag_location=qTranslateConfig.flag_location;
1119
var tabSwitch=qtranxj_ce ('li', {lang: lang, className: 'qtranxs-lang-switch', onclick: qTranslateConfig.qtx.switchActiveLanguage }, langSwitchWrap );
1151
//create sets of LSB
1152
var anchors=[];
1153
if(qTranslateConfig.page_config && qTranslateConfig.page_config.anchors){
1154
for(var id in qTranslateConfig.page_config.anchors){
1155
var anchor = qTranslateConfig.page_config.anchors[id];
1156
+ //co('anchor: ', anchor);
1157
+ var f = document.getElementById(id);
1158
+ if (f) {
1159
+ anchors.push({ f: f, where: anchor.where });
1160
+ } else if (anchor.jquery) {
1161
+ var list = jQuery(anchor.jquery);
1162
+ for (var i = 0; i < list.length; ++i) {
1163
+ var f = list[i];
1164
+ anchors.push({ f: f, where: anchor.where });
1165
+ }
1166
+ }
1167
}
1168
}
1169
+ //co('anchors: ', anchors);
1170
if(!anchors.length){
1171
var f=pg.langSwitchWrapAnchor;
1172
if(!f){
1176
}
1177
for(var i=0; i < anchors.length; ++i){
1178
var anchor = anchors[i];
1179
+ //co('anchor['+i+']: ', anchor);
1180
if( !anchor.where || anchor.where.indexOf('before') >= 0 ){
1181
//var langSwitchWrap=qtranxj_ce('ul', {className: qTranslateConfig.lsb_style_wrap_class});
1182
//var languageSwitch = new qtranxj_LanguageSwitch(langSwitchWrap);
admin/js/common.min.js CHANGED
@@ -1 +1 @@
1
- function qtranxj_get_cookie(n){for(var e=document.cookie.split(";"),a=0;a<e.length;++a){var t=e[a],i=t.split("=");if(i[0].trim()==n&&!(e.length<2))return i[1].trim()}return""}function qtranxj_ce(n,e,a,t){var i=document.createElement(n);if(e)for(prop in e)i[prop]=e[prop];return a&&(t&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i)),i}qtranxj_get_split_blocks=function(n){var e=/(<!--:[a-z]{2}-->|<!--:-->|\[:[a-z]{2}\]|\[:\]|\{:[a-z]{2}\}|\{:\})/gi;return n.xsplit(e)},qtranxj_split=function(n){var e=qtranxj_get_split_blocks(n);return qtranxj_split_blocks(e)},qtranxj_split_blocks=function(n){var e=new Object;for(var a in qTranslateConfig.language_config)e[a]="";if(!n||!n.length)return e;if(1==n.length){var t=n[0];for(var a in qTranslateConfig.language_config)e[a]+=t;return e}for(var i,r=/<!--:([a-z]{2})-->/gi,o=/\[:([a-z]{2})\]/gi,s=/\{:([a-z]{2})\}/gi,a=!1,l=0;l<n.length;++l){var t=n[l];if(t.length)if(i=r.exec(t),r.lastIndex=0,null==i)if(i=o.exec(t),o.lastIndex=0,null==i)if(i=s.exec(t),s.lastIndex=0,null==i)if("<!--:-->"!=t&&"[:]"!=t&&"{:}"!=t)if(a)e[a]?e[a]+=t:e[a]=t,a=!1;else for(var c in e)e[c]+=t;else a=!1;else a=i[1];else a=i[1];else a=i[1]}return e},String.prototype.xsplit=function(n){if(3==="a~b".split(/(~)/).length)return this.split(n);n.global||(n=new RegExp(n.source,"g"+(n.ignoreCase?"i":"")));for(var e,a=0,t=[];null!=(e=n.exec(this));)t.push(this.slice(a,e.index)),e.length>1&&t.push(e[1]),a=n.lastIndex;return a<this.length&&t.push(this.slice(a)),a==this.length&&t.push(""),t};var qTranslateX=function(n){var e=this;qTranslateConfig.qtx=this,this.getLanguages=function(){return qTranslateConfig.language_config},this.getFlagLocation=function(){return qTranslateConfig.flag_location},this.isLanguageEnabled=function(n){return!!qTranslateConfig.language_config[n]};var a=function(n){document.cookie="qtrans_edit_language="+n};qTranslateConfig.activeLanguage,qTranslateConfig.LSB?(qTranslateConfig.activeLanguage=qtranxj_get_cookie("qtrans_edit_language"),qTranslateConfig.activeLanguage&&this.isLanguageEnabled(qTranslateConfig.activeLanguage)||(qTranslateConfig.activeLanguage=qTranslateConfig.language,this.isLanguageEnabled(qTranslateConfig.activeLanguage)?a(qTranslateConfig.activeLanguage):qTranslateConfig.LSB=!1)):(qTranslateConfig.activeLanguage=qTranslateConfig.language,a(qTranslateConfig.activeLanguage)),this.getActiveLanguage=function(){return qTranslateConfig.activeLanguage},this.getLanguages=function(){return qTranslateConfig.language_config};var t={};this.hasContentHook=function(n){return t[n]},this.addContentHook=function(n,a,i){if(!n)return!1;switch(n.tagName){case"TEXTAREA":break;case"INPUT":if(n.type.match(/(button|checkbox|password|radio|submit)/))return!1;break;default:return!1}if(!i){if(!n.name)return!1;i=n.name}if(n.id){if(t[n.id]){if(jQuery.contains(document,n))return t[n.id];e.removeContentHook(n)}}else if(t[i]){var r=0;do++r,n.id=i+r;while(t[i])}else n.id=i;var o=t[n.id]={};o.name=i,o.contentField=n,o.lang=qTranslateConfig.activeLanguage;var s=qtranxj_split(n.value);n.value=s[o.lang];var l;if(a)switch(a){case"slug":l="qtranslate-slugs[";break;case"term":l="qtranslate-terms[";break;default:l="qtranslate-fields["}else a="[",l="qtranslate-fields[";var c,f,g=o.name.indexOf("[");if(0>g)c=l+o.name+"]";else if(c=l+o.name.substring(0,g)+"]",o.name.lastIndexOf("[]")<0)c+=o.name.substring(g);else{var u=o.name.length-2;u>g&&(c+=o.name.substring(g,u)),f="[]"}o.fields={};for(var d in s){var h=s[d],v=c+"["+d+"]";f&&(v+=f);var C=qtranxj_ce("input",{name:v,type:"hidden",className:"hidden",value:h});o.fields[d]=C,n.parentNode.insertBefore(C,n)}switch(a){case"slug":case"term":o.sepfield=qtranxj_ce("input",{name:c+"[qtranslate-original-value]",type:"hidden",className:"hidden",value:s[qTranslateConfig.default_language]});break;default:o.sepfield=qtranxj_ce("input",{name:c+"[qtranslate-separator]",type:"hidden",className:"hidden",value:a})}return n.parentNode.insertBefore(o.sepfield,n),o.encode=a,n.className+=" qtranxs-translatable",o},this.addContentHookC=function(n){return e.addContentHook(n,"[")},this.addContentHookB=function(n){return e.addContentHook(n,"[")},this.addContentHookById=function(n,a,t){return e.addContentHook(document.getElementById(n),a,t)},this.addContentHookByIdName=function(n){var a;switch(n[0]){case"<":case"[":a=n.substring(0,1),n=n.substring(1)}return e.addContentHookById(n,a)},this.addContentHookByIdC=function(n){return e.addContentHookById(n,"[")},this.addContentHookByIdB=function(n){return e.addContentHookById(n,"[")},this.addContentHooks=function(n,a,t){for(var i=0;i<n.length;++i){var r=n[i];e.addContentHook(r,a,t)}};var i=function(n,a,t){a||(a=document);var i=a.getElementsByClassName(n);e.addContentHooks(i,t)};this.addContentHooksByClass=function(n,e){var a;(0==n.indexOf("<")||0==n.indexOf("["))&&(a=n.substring(0,1),n=n.substring(1)),i(n,e,a)},this.addContentHooksByTagInClass=function(n,a,t){for(var i=t.getElementsByClassName(n),r=0;r<i.length;++r){var o=i[r],s=o.getElementsByTagName(a);e.addContentHooks(s)}};var r=function(n){if(!n)return!1;n.sepfield&&jQuery(n.sepfield).remove();for(var e in n.fields)jQuery(n.fields[e]).remove();return delete t[n.contentField.id],!0};this.removeContentHook=function(n){if(!n)return!1;if(!n.id)return!1;if(!t[n.id])return!1;var e=t[n.id];return r(e),jQuery(n).removeClass("qtranxs-translatable"),!0},this.refreshContentHook=function(n){if(!n)return!1;if(!n.id)return!1;var a=t[n.id];return a&&r(a),e.addContentHook(n)};var o=[],s=function(n){if(!n.nodeValue)return 0;var e=qtranxj_get_split_blocks(n.nodeValue);if(!e||!e.length||1==e.length)return 0;var a={};return a.nd=n,a.contents=qtranxj_split_blocks(e),n.nodeValue=a.contents[qTranslateConfig.activeLanguage],o.push(a),1},l=[],c=function(n){if(!n.value)return 0;var e=qtranxj_get_split_blocks(n.value);if(!e||!e.length||1==e.length)return 0;var a={};return a.nd=n,a.contents=qtranxj_split_blocks(e),n.value=a.contents[qTranslateConfig.activeLanguage],l.push(a),1};this.addDisplayHook=function(n){if(!n||!n.tagName)return 0;switch(n.tagName){case"TEXTAREA":return 0;case"INPUT":switch(n.type){case"submit":if(n.value)return c(n);default:return 0}}var a=0;if(n.childNodes&&n.childNodes.length)for(var t=0;t<n.childNodes.length;++t){var i=n.childNodes[t];switch(i.nodeType){case 1:a+=e.addDisplayHook(i);break;case 2:case 3:a+=s(i)}}return a},this.addDisplayHookById=function(n){return e.addDisplayHook(document.getElementById(n))};var f=function(n){text=n.contentField.value,n.wpautop&&window.switchEditors&&(text=window.switchEditors.wpautop(text)),n.mce.setContent(text,{format:"html"})},g=function(n){a(n);for(var e=o.length;--e>=0;){var i=o[e];i.nd.parentNode?i.nd.nodeValue=i.contents[n]:o.splice(e,1)}for(var e=l.length;--e>=0;){var i=l[e];i.nd.parentNode?i.nd.value=i.contents[n]:l.splice(e,1)}for(var r in t){var i=t[r],s=i.mce&&!i.mce.hidden;s&&i.mce.save({format:"html"}),i.fields[i.lang].value=i.contentField.value,i.lang=n;var c=i.fields[i.lang].value;i.contentField.placeholder&&""!=c&&(i.contentField.placeholder=""),i.contentField.value=c,s&&f(i)}};this.addDisplayHooks=function(n){for(var a=0;a<n.length;++a){var t=n[a];e.addDisplayHook(t)}},this.addDisplayHooksByClass=function(n,a){var t=a.getElementsByClassName(n);e.addDisplayHooks(t)},this.addDisplayHooksByTagInClass=function(n,a,t){for(var i=t.getElementsByClassName(n),r=0;r<i.length;++r){var o=i[r],s=o.getElementsByTagName(a);e.addDisplayHooks(s)}},this.addCustomContentHooks=function(){for(var n=0;n<qTranslateConfig.custom_fields.length;++n){var a=qTranslateConfig.custom_fields[n];e.addContentHookByIdName(a)}for(var n=0;n<qTranslateConfig.custom_field_classes.length;++n){var a=qTranslateConfig.custom_field_classes[n];e.addContentHooksByClass(a)}qTranslateConfig.LSB&&setTinyMceInit()};var u=function(n){n(".i18n-multilingual").each(function(n,a){e.addContentHook(a,"[")}),n(".i18n-multilingual-curly").each(function(n,a){e.addContentHook(a,"{")}),n(".i18n-multilingual-term").each(function(n,a){e.addContentHook(a,"term")}),n(".i18n-multilingual-slug").each(function(n,a){e.addContentHook(a,"slug")}),n(".i18n-multilingual-display").each(function(n,a){e.addDisplayHook(a)})},d=function(n){for(var a in n){var t,i=n[a];if(i.form){if(i.form.id)t=document.getElementById(i.form.id);else if(i.form.jquery)t=$(i.form.jquery);else if(i.form.name){var r=document.getElementsByName(i.form.name);r&&r.length&&(t=r[0])}}else t=document.getElementById(a);t||(t=v(),t||(t=document));for(var o in i.fields){var s=i.fields[o],l=[];if(s.container_id){var c=document.getElementById(s.container_id);c&&l.push(c)}else s.container_jquery?l=$(s.container_jquery):s.container_class?l=document.getElementsByClassName(s.container_class):l.push(t);var f=s.encode;switch(f){case"none":continue;case"display":if(s.jquery)for(var g=0;g<l.length;++g){var c=l[g],u=jQuery(c).find(s.jquery);e.addDisplayHooks(u)}else{var d=s.id?s.id:o;e.addDisplayHook(document.getElementById(d))}break;case"[":case"<":case"{":case"byline":default:if(s.jquery)for(var g=0;g<l.length;++g){var c=l[g],u=jQuery(c).find(s.jquery);e.addContentHooks(u,f,s.name)}else{var d=s.id?s.id:o;e.addContentHookById(d,f,s.name)}}}}},h=function(){function n(n){var e=n.id;if(e){var a=t[e];if(a&&!a.mce){a.mce=n,n.getContainer().className+=" qtranxs-translatable",n.getElement().className+=" qtranxs-translatable";var i=a.updateTinyMCEonInit;if(null==i){var r=n.getContent({format:"html"}).replace(/\s+/g,""),o=a.contentField.value.replace(/\s+/g,"");i=r!=o}return i&&f(a),a}}}setTinyMceInit=function(){if(window.tinyMCE)for(var e in t){var a=t[e];if("TEXTAREA"===a.contentField.tagName&&!a.mce&&!a.mceInit&&tinyMCEPreInit.mceInit[e]){if(a.mceInit=tinyMCEPreInit.mceInit[e],a.mceInit.wpautop){a.wpautop=a.mceInit.wpautop;var i=tinymce.DOM.select("#wp-"+e+"-wrap");i&&i.length&&(a.wrapper=i[0],a.wrapper&&(tinymce.DOM.hasClass(a.wrapper,"tmce-active")&&(a.updateTinyMCEonInit=!0),tinymce.DOM.hasClass(a.wrapper,"html-active")&&(a.updateTinyMCEonInit=!1)))}else a.updateTinyMCEonInit=!1;tinyMCEPreInit.mceInit[e].init_instance_callback=function(e){n(e)}}}},setTinyMceInit(),loadTinyMceHooks=function(){if(window.tinyMCE&&tinyMCE.editors)for(var e=0;e<tinyMCE.editors.length;++e){var a=tinyMCE.editors[e];n(a)}},window.addEventListener("load",loadTinyMceHooks)};qTranslateConfig.onTabSwitchFunctions||(qTranslateConfig.onTabSwitchFunctions=[]),qTranslateConfig.onTabSwitchFunctionsSave||(qTranslateConfig.onTabSwitchFunctionsSave=[]),qTranslateConfig.onTabSwitchFunctionsLoad||(qTranslateConfig.onTabSwitchFunctionsLoad=[]),this.addLanguageSwitchListener=function(n){qTranslateConfig.onTabSwitchFunctions.push(n)},this.addLanguageSwitchBeforeListener=function(n){qTranslateConfig.onTabSwitchFunctionsSave.push(n)},this.delLanguageSwitchBeforeListener=function(n){for(var e=0;e<qTranslateConfig.onTabSwitchFunctionsSave.length;++e){var a=qTranslateConfig.onTabSwitchFunctionsSave[e];if(a==n)return void qTranslateConfig.onTabSwitchFunctionsSave.splice(e,1)}},this.addLanguageSwitchAfterListener=function(n){qTranslateConfig.onTabSwitchFunctionsLoad.push(n)},this.delLanguageSwitchAfterListener=function(n){for(var e=0;e<qTranslateConfig.onTabSwitchFunctionsLoad.length;++e){var a=qTranslateConfig.onTabSwitchFunctionsLoad[e];if(a==n)return void qTranslateConfig.onTabSwitchFunctionsLoad.splice(e,1)}},this.enableLanguageSwitchingButtons=function(n){var e=n?"block":"none";for(var a in qTranslateConfig.tabSwitches){for(var t=qTranslateConfig.tabSwitches[a],i=0;i<t.length;++i){var r=(t[i],t[i].parentElement);r.style.display=e;break}break}};var v=function(){for(var n=document.getElementsByClassName("wrap"),e=0;e<n.length;++e){var a=n[e],t=a.getElementsByTagName("form");if(t.length)return t[0]}var t=document.getElementsByTagName("form");if(1===t.length)return t[0];for(var e=0;e<t.length;++e){var i=t[e];if(n=i.getElementsByClassName("wrap"),n.length)return i}return null};if("function"==typeof n.addContentHooks&&n.addContentHooks(this),qTranslateConfig.page_config&&qTranslateConfig.page_config.forms&&d(qTranslateConfig.page_config.forms),u(jQuery),!o.length&&!l.length){var C=!1;for(var m in t){C=!0;break}if(!C)return}this.switchActiveLanguage=function(){var n=this,e=n.lang;if(!e)return void alert("qTranslate-X: This should not have happened: Please, report this incident to the developers: !lang");if(qTranslateConfig.activeLanguage!==e){if(qTranslateConfig.activeLanguage){for(var a=!0,t=qTranslateConfig.onTabSwitchFunctionsSave,i=0;i<t.length;++i){var r=t[i].call(qTranslateConfig.qtx,qTranslateConfig.activeLanguage,e);r===!1&&(a=!1)}if(!a)return;for(var o=qTranslateConfig.tabSwitches[qTranslateConfig.activeLanguage],i=0;i<o.length;++i)o[i].classList.remove(qTranslateConfig.lsb_style_active_class)}var s=qTranslateConfig.activeLanguage;qTranslateConfig.activeLanguage=e;for(var o=qTranslateConfig.tabSwitches[qTranslateConfig.activeLanguage],i=0;i<o.length;++i)o[i].classList.add(qTranslateConfig.lsb_style_active_class);for(var l=qTranslateConfig.onTabSwitchFunctions,i=0;i<l.length;++i)l[i].call(qTranslateConfig.qtx,e,s);for(var c=qTranslateConfig.onTabSwitchFunctionsLoad,i=0;i<c.length;++i)c[i].call(qTranslateConfig.qtx,e,s)}};var q=function(){var n=qtranxj_ce("ul",{className:qTranslateConfig.lsb_style_wrap_class}),e=qTranslateConfig.language_config;qTranslateConfig.tabSwitches||(qTranslateConfig.tabSwitches={});for(var a in e){var t=e[a],i=qTranslateConfig.flag_location,r=qtranxj_ce("li",{lang:a,className:"qtranxs-lang-switch",onclick:qTranslateConfig.qtx.switchActiveLanguage},n);qtranxj_ce("img",{src:i+t.flag},r),qtranxj_ce("span",{innerHTML:t.name},r),qTranslateConfig.activeLanguage==a&&r.classList.add(qTranslateConfig.lsb_style_active_class),qTranslateConfig.tabSwitches[a]||(qTranslateConfig.tabSwitches[a]=[]),qTranslateConfig.tabSwitches[a].push(r)}return n},T=function(n){var e=document.getElementById("qtranxs-meta-box-lsb");if(e){var a=e.getElementsByClassName("inside");if(a.length){e.className+=" closed",n(e).find(".hndle").remove();var t=document.createElement("span");e.insertBefore(t,a[0]),t.className="hndle ui-sortable-handle";var i=q();t.appendChild(i),n(function(n){n("#qtranxs-meta-box-lsb .hndle").unbind("click.postboxes")})}}};if(qTranslateConfig.LSB){h(),T(jQuery);var p=[];if(qTranslateConfig.page_config&&qTranslateConfig.page_config.anchors)for(var y in qTranslateConfig.page_config.anchors){var w=document.getElementById(y);if(w){var b=qTranslateConfig.page_config.anchors[y];b.id=y,b.f=w,p.push(b)}}if(!p.length){var w=n.langSwitchWrapAnchor;w||(w=v()),w&&p.push({f:w,where:"before"})}for(var _=0;_<p.length;++_){var b=p[_];if(!b.where||b.where.indexOf("before")>=0){var k=q();b.f.parentNode.insertBefore(k,b.f)}if(b.where&&b.where.indexOf("after")>=0){var k=q();b.f.parentNode.insertBefore(k,b.f.nextSibling)}if(b.where&&b.where.indexOf("first")>=0){var k=q();b.f.insertBefore(k,b.f.firstChild)}if(b.where&&b.where.indexOf("last")>=0){var k=q();b.f.insertBefore(k,null)}}this.addLanguageSwitchListener(g),n.onTabSwitch&&this.addLanguageSwitchListener(n.onTabSwitch)}};qTranslateConfig.js.get_qtx=function(){return qTranslateConfig.qtx||new qTranslateX(qTranslateConfig.js),qTranslateConfig.qtx},jQuery(document).ready(qTranslateConfig.js.get_qtx);
1
+ function qtranxj_get_cookie(e){for(var n=document.cookie.split(";"),a=0;a<n.length;++a){var t=n[a],i=t.split("=");if(i[0].trim()==e&&!(n.length<2))return i[1].trim()}return""}function qtranxj_ce(e,n,a,t){var i=document.createElement(e);if(n)for(prop in n)i[prop]=n[prop];return a&&(t&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i)),i}qtranxj_get_split_blocks=function(e){var n=/(<!--:[a-z]{2}-->|<!--:-->|\[:[a-z]{2}\]|\[:\]|\{:[a-z]{2}\}|\{:\})/gi;return e.xsplit(n)},qtranxj_split=function(e){var n=qtranxj_get_split_blocks(e);return qtranxj_split_blocks(n)},qtranxj_split_blocks=function(e){var n=new Object;for(var a in qTranslateConfig.language_config)n[a]="";if(!e||!e.length)return n;if(1==e.length){var t=e[0];for(var a in qTranslateConfig.language_config)n[a]+=t;return n}for(var i,r=/<!--:([a-z]{2})-->/gi,o=/\[:([a-z]{2})\]/gi,s=/\{:([a-z]{2})\}/gi,a=!1,l=0;l<e.length;++l){var t=e[l];if(t.length)if(i=r.exec(t),r.lastIndex=0,null==i)if(i=o.exec(t),o.lastIndex=0,null==i)if(i=s.exec(t),s.lastIndex=0,null==i)if("<!--:-->"!=t&&"[:]"!=t&&"{:}"!=t)if(a)n[a]?n[a]+=t:n[a]=t,a=!1;else for(var c in n)n[c]+=t;else a=!1;else a=i[1];else a=i[1];else a=i[1]}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(e){var n=this;qTranslateConfig.qtx=this,this.getLanguages=function(){return qTranslateConfig.language_config},this.getFlagLocation=function(){return qTranslateConfig.flag_location},this.isLanguageEnabled=function(e){return!!qTranslateConfig.language_config[e]};var a=function(e){document.cookie="qtrans_edit_language="+e};qTranslateConfig.activeLanguage,qTranslateConfig.LSB?(qTranslateConfig.activeLanguage=qtranxj_get_cookie("qtrans_edit_language"),qTranslateConfig.activeLanguage&&this.isLanguageEnabled(qTranslateConfig.activeLanguage)||(qTranslateConfig.activeLanguage=qTranslateConfig.language,this.isLanguageEnabled(qTranslateConfig.activeLanguage)?a(qTranslateConfig.activeLanguage):qTranslateConfig.LSB=!1)):(qTranslateConfig.activeLanguage=qTranslateConfig.language,a(qTranslateConfig.activeLanguage)),this.getActiveLanguage=function(){return qTranslateConfig.activeLanguage},this.getLanguages=function(){return qTranslateConfig.language_config};var t={};this.hasContentHook=function(e){return t[e]},this.addContentHook=function(e,a,i){if(!e)return!1;switch(e.tagName){case"TEXTAREA":break;case"INPUT":switch(e.type){case"button":case"checkbox":case"password":case"radio":case"submit":return!1}break;default:return!1}if(!i){if(!e.name)return!1;i=e.name}if(e.id){if(t[e.id]){if(jQuery.contains(document,e))return t[e.id];n.removeContentHook(e)}}else if(t[i]){var r=0;do++r,e.id=i+r;while(t[i])}else e.id=i;var o=t[e.id]={};o.name=i,o.contentField=e,o.lang=qTranslateConfig.activeLanguage;var s=qtranxj_split(e.value);e.value=s[o.lang];var l;if(a)switch(a){case"slug":l="qtranslate-slugs[";break;case"term":l="qtranslate-terms[";break;default:l="qtranslate-fields["}else a="[",l="qtranslate-fields[";var c,f,g=o.name.indexOf("[");if(0>g)c=l+o.name+"]";else if(c=l+o.name.substring(0,g)+"]",o.name.lastIndexOf("[]")<0)c+=o.name.substring(g);else{var u=o.name.length-2;u>g&&(c+=o.name.substring(g,u)),f="[]"}o.fields={};for(var d in s){var h=s[d],v=c+"["+d+"]";f&&(v+=f);var C=qtranxj_ce("input",{name:v,type:"hidden",className:"hidden",value:h});o.fields[d]=C,e.parentNode.insertBefore(C,e)}switch(a){case"slug":case"term":o.sepfield=qtranxj_ce("input",{name:c+"[qtranslate-original-value]",type:"hidden",className:"hidden",value:s[qTranslateConfig.default_language]});break;default:o.sepfield=qtranxj_ce("input",{name:c+"[qtranslate-separator]",type:"hidden",className:"hidden",value:a})}return e.parentNode.insertBefore(o.sepfield,e),o.encode=a,e.className+=" qtranxs-translatable",o},this.addContentHookC=function(e){return n.addContentHook(e,"[")},this.addContentHookB=function(e){return n.addContentHook(e,"[")},this.addContentHookById=function(e,a,t){return n.addContentHook(document.getElementById(e),a,t)},this.addContentHookByIdName=function(e){var a;switch(e[0]){case"<":case"[":a=e.substring(0,1),e=e.substring(1)}return n.addContentHookById(e,a)},this.addContentHookByIdC=function(e){return n.addContentHookById(e,"[")},this.addContentHookByIdB=function(e){return n.addContentHookById(e,"[")},this.addContentHooks=function(e,a,t){for(var i=0;i<e.length;++i){var r=e[i];n.addContentHook(r,a,t)}};var i=function(e,a,t){a||(a=document);var i=a.getElementsByClassName(e);n.addContentHooks(i,t)};this.addContentHooksByClass=function(e,n){var a;(0==e.indexOf("<")||0==e.indexOf("["))&&(a=e.substring(0,1),e=e.substring(1)),i(e,n,a)},this.addContentHooksByTagInClass=function(e,a,t){for(var i=t.getElementsByClassName(e),r=0;r<i.length;++r){var o=i[r],s=o.getElementsByTagName(a);n.addContentHooks(s)}};var r=function(e){if(!e)return!1;e.sepfield&&jQuery(e.sepfield).remove();for(var n in e.fields)jQuery(e.fields[n]).remove();return delete t[e.contentField.id],!0};this.removeContentHook=function(e){if(!e)return!1;if(!e.id)return!1;if(!t[e.id])return!1;var n=t[e.id];return r(n),jQuery(e).removeClass("qtranxs-translatable"),!0},this.refreshContentHook=function(e){if(!e)return!1;if(!e.id)return!1;var a=t[e.id];return a&&r(a),n.addContentHook(e)};var o=[],s=function(e){if(!e.nodeValue)return 0;var n=qtranxj_get_split_blocks(e.nodeValue);if(!n||!n.length||1==n.length)return 0;var a={};return a.nd=e,a.contents=qtranxj_split_blocks(n),e.nodeValue=a.contents[qTranslateConfig.activeLanguage],o.push(a),1},l=[],c=function(e){if(!e.value)return 0;var n=qtranxj_get_split_blocks(e.value);if(!n||!n.length||1==n.length)return 0;var a={};return a.nd=e,a.contents=qtranxj_split_blocks(n),e.value=a.contents[qTranslateConfig.activeLanguage],l.push(a),1};this.addDisplayHook=function(e){if(!e||!e.tagName)return 0;switch(e.tagName){case"TEXTAREA":return 0;case"INPUT":switch(e.type){case"submit":if(e.value)return c(e);default:return 0}}var a=0;if(e.childNodes&&e.childNodes.length)for(var t=0;t<e.childNodes.length;++t){var i=e.childNodes[t];switch(i.nodeType){case 1:a+=n.addDisplayHook(i);break;case 2:case 3:a+=s(i)}}return a},this.addDisplayHookById=function(e){return n.addDisplayHook(document.getElementById(e))};var f=function(e){text=e.contentField.value,e.wpautop&&window.switchEditors&&(text=window.switchEditors.wpautop(text)),e.mce.setContent(text,{format:"html"})},g=function(e){a(e);for(var n=o.length;--n>=0;){var i=o[n];i.nd.parentNode?i.nd.nodeValue=i.contents[e]:o.splice(n,1)}for(var n=l.length;--n>=0;){var i=l[n];i.nd.parentNode?i.nd.value=i.contents[e]:l.splice(n,1)}for(var r in t){var i=t[r],s=i.mce&&!i.mce.hidden;s&&i.mce.save({format:"html"}),i.fields[i.lang].value=i.contentField.value,i.lang=e;var c=i.fields[i.lang].value;i.contentField.placeholder&&""!=c&&(i.contentField.placeholder=""),i.contentField.value=c,s&&f(i)}};this.addDisplayHooks=function(e){for(var a=0;a<e.length;++a){var t=e[a];n.addDisplayHook(t)}},this.addDisplayHooksByClass=function(e,a){var t=a.getElementsByClassName(e);n.addDisplayHooks(t)},this.addDisplayHooksByTagInClass=function(e,a,t){for(var i=t.getElementsByClassName(e),r=0;r<i.length;++r){var o=i[r],s=o.getElementsByTagName(a);n.addDisplayHooks(s)}},this.addCustomContentHooks=function(){for(var e=0;e<qTranslateConfig.custom_fields.length;++e){var a=qTranslateConfig.custom_fields[e];n.addContentHookByIdName(a)}for(var e=0;e<qTranslateConfig.custom_field_classes.length;++e){var a=qTranslateConfig.custom_field_classes[e];n.addContentHooksByClass(a)}qTranslateConfig.LSB&&setTinyMceInit()};var u=function(e){e(".i18n-multilingual").each(function(e,a){n.addContentHook(a,"[")}),e(".i18n-multilingual-curly").each(function(e,a){n.addContentHook(a,"{")}),e(".i18n-multilingual-term").each(function(e,a){n.addContentHook(a,"term")}),e(".i18n-multilingual-slug").each(function(e,a){n.addContentHook(a,"slug")}),e(".i18n-multilingual-display").each(function(e,a){n.addDisplayHook(a)})},d=function(e){for(var a in e){var t,i=e[a];if(i.form){if(i.form.id)t=document.getElementById(i.form.id);else if(i.form.jquery)t=$(i.form.jquery);else if(i.form.name){var r=document.getElementsByName(i.form.name);r&&r.length&&(t=r[0])}}else t=document.getElementById(a);t||(t=v(),t||(t=document));for(var o in i.fields){var s=i.fields[o],l=[];if(s.container_id){var c=document.getElementById(s.container_id);c&&l.push(c)}else s.container_jquery?l=$(s.container_jquery):s.container_class?l=document.getElementsByClassName(s.container_class):l.push(t);var f=s.encode;switch(f){case"none":continue;case"display":if(s.jquery)for(var g=0;g<l.length;++g){var c=l[g],u=jQuery(c).find(s.jquery);n.addDisplayHooks(u)}else{var d=s.id?s.id:o;n.addDisplayHook(document.getElementById(d))}break;case"[":case"<":case"{":case"byline":default:if(s.jquery)for(var g=0;g<l.length;++g){var c=l[g],u=jQuery(c).find(s.jquery);n.addContentHooks(u,f,s.name)}else{var d=s.id?s.id:o;n.addContentHookById(d,f,s.name)}}}}},h=function(){function e(e){var n=e.id;if(n){var a=t[n];if(a&&!a.mce){a.mce=e,e.getContainer().className+=" qtranxs-translatable",e.getElement().className+=" qtranxs-translatable";var i=a.updateTinyMCEonInit;if(null==i){var r=e.getContent({format:"html"}).replace(/\s+/g,""),o=a.contentField.value.replace(/\s+/g,"");i=r!=o}return i&&f(a),a}}}setTinyMceInit=function(){if(window.tinyMCE)for(var n in t){var a=t[n];if("TEXTAREA"===a.contentField.tagName&&!a.mce&&!a.mceInit&&tinyMCEPreInit.mceInit[n]){if(a.mceInit=tinyMCEPreInit.mceInit[n],a.mceInit.wpautop){a.wpautop=a.mceInit.wpautop;var i=tinymce.DOM.select("#wp-"+n+"-wrap");i&&i.length&&(a.wrapper=i[0],a.wrapper&&(tinymce.DOM.hasClass(a.wrapper,"tmce-active")&&(a.updateTinyMCEonInit=!0),tinymce.DOM.hasClass(a.wrapper,"html-active")&&(a.updateTinyMCEonInit=!1)))}else a.updateTinyMCEonInit=!1;tinyMCEPreInit.mceInit[n].init_instance_callback=function(n){e(n)}}}},setTinyMceInit(),loadTinyMceHooks=function(){if(window.tinyMCE&&tinyMCE.editors)for(var n=0;n<tinyMCE.editors.length;++n){var a=tinyMCE.editors[n];e(a)}},window.addEventListener("load",loadTinyMceHooks)};qTranslateConfig.onTabSwitchFunctions||(qTranslateConfig.onTabSwitchFunctions=[]),qTranslateConfig.onTabSwitchFunctionsSave||(qTranslateConfig.onTabSwitchFunctionsSave=[]),qTranslateConfig.onTabSwitchFunctionsLoad||(qTranslateConfig.onTabSwitchFunctionsLoad=[]),this.addLanguageSwitchListener=function(e){qTranslateConfig.onTabSwitchFunctions.push(e)},this.addLanguageSwitchBeforeListener=function(e){qTranslateConfig.onTabSwitchFunctionsSave.push(e)},this.delLanguageSwitchBeforeListener=function(e){for(var n=0;n<qTranslateConfig.onTabSwitchFunctionsSave.length;++n){var a=qTranslateConfig.onTabSwitchFunctionsSave[n];if(a==e)return void qTranslateConfig.onTabSwitchFunctionsSave.splice(n,1)}},this.addLanguageSwitchAfterListener=function(e){qTranslateConfig.onTabSwitchFunctionsLoad.push(e)},this.delLanguageSwitchAfterListener=function(e){for(var n=0;n<qTranslateConfig.onTabSwitchFunctionsLoad.length;++n){var a=qTranslateConfig.onTabSwitchFunctionsLoad[n];if(a==e)return void qTranslateConfig.onTabSwitchFunctionsLoad.splice(n,1)}},this.enableLanguageSwitchingButtons=function(e){var n=e?"block":"none";for(var a in qTranslateConfig.tabSwitches){for(var t=qTranslateConfig.tabSwitches[a],i=0;i<t.length;++i){var r=(t[i],t[i].parentElement);r.style.display=n;break}break}};var v=function(){for(var e=document.getElementsByClassName("wrap"),n=0;n<e.length;++n){var a=e[n],t=a.getElementsByTagName("form");if(t.length)return t[0]}var t=document.getElementsByTagName("form");if(1===t.length)return t[0];for(var n=0;n<t.length;++n){var i=t[n];if(e=i.getElementsByClassName("wrap"),e.length)return i}return null};if("function"==typeof e.addContentHooks&&e.addContentHooks(this),qTranslateConfig.page_config&&qTranslateConfig.page_config.forms&&d(qTranslateConfig.page_config.forms),u(jQuery),!o.length&&!l.length){var C=!1;for(var m in t){C=!0;break}if(!C)return}this.switchActiveLanguage=function(){var e=this,n=e.lang;if(!n)return void alert("qTranslate-X: This should not have happened: Please, report this incident to the developers: !lang");if(qTranslateConfig.activeLanguage!==n){if(qTranslateConfig.activeLanguage){for(var a=!0,t=qTranslateConfig.onTabSwitchFunctionsSave,i=0;i<t.length;++i){var r=t[i].call(qTranslateConfig.qtx,qTranslateConfig.activeLanguage,n);r===!1&&(a=!1)}if(!a)return;for(var o=qTranslateConfig.tabSwitches[qTranslateConfig.activeLanguage],i=0;i<o.length;++i)o[i].classList.remove(qTranslateConfig.lsb_style_active_class)}var s=qTranslateConfig.activeLanguage;qTranslateConfig.activeLanguage=n;for(var o=qTranslateConfig.tabSwitches[qTranslateConfig.activeLanguage],i=0;i<o.length;++i)o[i].classList.add(qTranslateConfig.lsb_style_active_class);for(var l=qTranslateConfig.onTabSwitchFunctions,i=0;i<l.length;++i)l[i].call(qTranslateConfig.qtx,n,s);for(var c=qTranslateConfig.onTabSwitchFunctionsLoad,i=0;i<c.length;++i)c[i].call(qTranslateConfig.qtx,n,s)}};var q=function(){var e=qtranxj_ce("ul",{className:qTranslateConfig.lsb_style_wrap_class}),n=qTranslateConfig.language_config;qTranslateConfig.tabSwitches||(qTranslateConfig.tabSwitches={});for(var a in n){var t=n[a],i=qTranslateConfig.flag_location,r=qtranxj_ce("li",{lang:a,className:"qtranxs-lang-switch",onclick:qTranslateConfig.qtx.switchActiveLanguage},e);qtranxj_ce("img",{src:i+t.flag},r),qtranxj_ce("span",{innerHTML:t.name},r),qTranslateConfig.activeLanguage==a&&r.classList.add(qTranslateConfig.lsb_style_active_class),qTranslateConfig.tabSwitches[a]||(qTranslateConfig.tabSwitches[a]=[]),qTranslateConfig.tabSwitches[a].push(r)}return e},T=function(e){var n=document.getElementById("qtranxs-meta-box-lsb");if(n){var a=n.getElementsByClassName("inside");if(a.length){n.className+=" closed",e(n).find(".hndle").remove();var t=document.createElement("span");n.insertBefore(t,a[0]),t.className="hndle ui-sortable-handle";var i=q();t.appendChild(i),e(function(e){e("#qtranxs-meta-box-lsb .hndle").unbind("click.postboxes")})}}};if(qTranslateConfig.LSB){h(),T(jQuery);var p=[];if(qTranslateConfig.page_config&&qTranslateConfig.page_config.anchors)for(var y in qTranslateConfig.page_config.anchors){var w=qTranslateConfig.page_config.anchors[y],b=document.getElementById(y);if(b)p.push({f:b,where:w.where});else if(w.jquery)for(var _=jQuery(w.jquery),k=0;k<_.length;++k){var b=_[k];p.push({f:b,where:w.where})}}if(!p.length){var b=e.langSwitchWrapAnchor;b||(b=v()),b&&p.push({f:b,where:"before"})}for(var k=0;k<p.length;++k){var w=p[k];if(!w.where||w.where.indexOf("before")>=0){var x=q();w.f.parentNode.insertBefore(x,w.f)}if(w.where&&w.where.indexOf("after")>=0){var x=q();w.f.parentNode.insertBefore(x,w.f.nextSibling)}if(w.where&&w.where.indexOf("first")>=0){var x=q();w.f.insertBefore(x,w.f.firstChild)}if(w.where&&w.where.indexOf("last")>=0){var x=q();w.f.insertBefore(x,null)}}this.addLanguageSwitchListener(g),e.onTabSwitch&&this.addLanguageSwitchListener(e.onTabSwitch)}};qTranslateConfig.js.get_qtx=function(){return qTranslateConfig.qtx||new qTranslateX(qTranslateConfig.js),qTranslateConfig.qtx},jQuery(document).ready(qTranslateConfig.js.get_qtx);
admin/qtx_activation_hook.php CHANGED
@@ -59,10 +59,14 @@ function qtranxf_default_enabled_languages(){
59
* since 3.2.9.2
60
*/
61
function qtranxf_default_default_language(){
62
$enabled_languages = qtranxf_default_enabled_languages();
63
$default_language = $enabled_languages[0];
64
update_option('qtranslate_enabled_languages',$enabled_languages);
65
update_option('qtranslate_default_language',$default_language);
66
return $default_language;
67
}
68
59
* since 3.2.9.2
60
*/
61
function qtranxf_default_default_language(){
62
+ global $q_config;
63
$enabled_languages = qtranxf_default_enabled_languages();
64
$default_language = $enabled_languages[0];
65
update_option('qtranslate_enabled_languages',$enabled_languages);
66
update_option('qtranslate_default_language',$default_language);
67
+ $q_config['language'] = $q_config['default_language'] = $default_language;
68
+ $q_config['enabled_languages'] = $enabled_languages;
69
+ //qtranxf_updateGettextDatabases(true);
70
return $default_language;
71
}
72
admin/qtx_admin.php CHANGED
@@ -739,7 +739,7 @@ function qtranxf_add_language_menu( $wp_admin_bar ){
739
}
740
741
function qtranxf_links($links, $file, $plugin_data, $context){
742
- $settings_link = '<a href="options-general.php?page=qtranslate-x">' . __('Settings', 'qtranslate') . '</a>';
743
array_unshift( $links, $settings_link ); // before other links
744
return $links;
745
}
@@ -754,13 +754,13 @@ function qtranxf_admin_notices_config() {
754
755
if(isset($q_config['url_info']['errors']) && is_array($q_config['url_info']['errors'])){
756
foreach($q_config['url_info']['errors'] as $key => $msg){
757
- echo '<div class="error notice is-dismissible" id="qtranxs_error_'.$key.'"><p>'.$link.'<strong><span style="color: red;">'.qtranxf_translate_wp('Error').'</span></strong>:&nbsp;'.$msg.'</p></div>';
758
}
759
unset($q_config['url_info']['errors']);
760
}
761
if(isset($q_config['url_info']['warnings']) && is_array($q_config['url_info']['warnings'])){
762
foreach($q_config['url_info']['warnings'] as $key => $msg){
763
- echo '<div class="update-nag notice is-dismissible" id="qtranxs_warning_'.$key.'"><p>'.$link.'<strong><span style="color: blue;">'.qtranxf_translate_wp('Warning').'</span></strong>:&nbsp;'.$msg.'</p></div>';
764
}
765
unset($q_config['url_info']['warnings']);
766
}
@@ -799,8 +799,7 @@ add_filter('get_terms_args', 'qtranxf_get_terms_args');
799
* Encode front end language on home_url, since, on admin side, it is mostly in use to create links to a preview pages.
800
* @since 3.4.5
801
*/
802
- function qtranxf_admin_home_url($url, $path, $orig_scheme, $blog_id)
803
- {
804
global $q_config;
805
//qtranxf_dbg_log('qtranxf_admin_home_url: $_COOKIE: ', $_COOKIE);
806
if(isset($_COOKIE[QTX_COOKIE_NAME_FRONT]))
739
}
740
741
function qtranxf_links($links, $file, $plugin_data, $context){
742
+ $settings_link = '<a href="options-general.php?page=qtranslate-x">' . qtranxf_translate('Settings') . '</a>';
743
array_unshift( $links, $settings_link ); // before other links
744
return $links;
745
}
754
755
if(isset($q_config['url_info']['errors']) && is_array($q_config['url_info']['errors'])){
756
foreach($q_config['url_info']['errors'] as $key => $msg){
757
+ echo '<div class="error notice is-dismissible" id="qtranxs_error_'.$key.'"><p>'.$link.'<strong><span style="color: red;">'.qtranxf_translate('Error').'</span></strong>:&nbsp;'.$msg.'</p></div>';
758
}
759
unset($q_config['url_info']['errors']);
760
}
761
if(isset($q_config['url_info']['warnings']) && is_array($q_config['url_info']['warnings'])){
762
foreach($q_config['url_info']['warnings'] as $key => $msg){
763
+ echo '<div class="update-nag notice is-dismissible" id="qtranxs_warning_'.$key.'"><p>'.$link.'<strong><span style="color: blue;">'.qtranxf_translate('Warning').'</span></strong>:&nbsp;'.$msg.'</p></div>';
764
}
765
unset($q_config['url_info']['warnings']);
766
}
799
* Encode front end language on home_url, since, on admin side, it is mostly in use to create links to a preview pages.
800
* @since 3.4.5
801
*/
802
+ function qtranxf_admin_home_url($url, $path, $orig_scheme, $blog_id){
803
global $q_config;
804
//qtranxf_dbg_log('qtranxf_admin_home_url: $_COOKIE: ', $_COOKIE);
805
if(isset($_COOKIE[QTX_COOKIE_NAME_FRONT]))
admin/qtx_admin_utils.php CHANGED
@@ -65,10 +65,14 @@ function qtranxf_detect_admin_language($url_info) {
65
}
66
add_filter('qtranslate_detect_admin_language','qtranxf_detect_admin_language');
67
68
function qtranxf_array_compare($a,$b) {
69
if( !is_array($a) || !is_array($b) ) return false;
70
if(count($a) != count($b)) return false;
71
foreach($a as $k => $v){
72
if(is_array($v)){
73
if(!qtranxf_array_compare($v,$b[$k])) return false;
74
}else{
@@ -636,6 +640,7 @@ function qtranxf_admin_category_description($text) {
636
add_filter('category_description', 'qtranxf_admin_category_description',0);
637
638
function qtranxf_admin_the_title($title) {
639
//todo this filter should not be used in admin area at all?
640
if(defined('DOING_AJAX') && DOING_AJAX)//nav-menus.php#752
641
return $title;
65
}
66
add_filter('qtranslate_detect_admin_language','qtranxf_detect_admin_language');
67
68
+ /**
69
+ * @return bool true if $a and $b are equal.
70
+ */
71
function qtranxf_array_compare($a,$b) {
72
if( !is_array($a) || !is_array($b) ) return false;
73
if(count($a) != count($b)) return false;
74
foreach($a as $k => $v){
75
+ if(!isset($b[$k])) return false;
76
if(is_array($v)){
77
if(!qtranxf_array_compare($v,$b[$k])) return false;
78
}else{
640
add_filter('category_description', 'qtranxf_admin_category_description',0);
641
642
function qtranxf_admin_the_title($title) {
643
+ global $pagenow;
644
//todo this filter should not be used in admin area at all?
645
if(defined('DOING_AJAX') && DOING_AJAX)//nav-menus.php#752
646
return $title;
admin/qtx_configuration.php CHANGED
@@ -248,8 +248,8 @@ echo ' '; printf(__('Please, read %sIntegration Guide%s for more information.',
248
echo '<td><label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
249
checked($language,$q_config['default_language']);
250
echo ' />';
251
- echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.$pluginurl.'arrowup.png" alt="up" /></a>';
252
- echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.$pluginurl.'arrowdown.png" alt="down" /></a>';
253
echo ' <img src="' . $flag_location.$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
254
echo ' '.$q_config['language_name'][$language];
255
echo '</label></td>';
248
echo '<td><label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
249
checked($language,$q_config['default_language']);
250
echo ' />';
251
+ echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.$pluginurl.'img/arrowup.png" alt="up" /></a>';
252
+ echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.$pluginurl.'img/arrowdown.png" alt="down" /></a>';
253
echo ' <img src="' . $flag_location.$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
254
echo ' '.$q_config['language_name'][$language];
255
echo '</label></td>';
arrowdown.png → img/arrowdown.png RENAMED
File without changes
arrowup.png → img/arrowup.png RENAMED
File without changes
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.
6
- Version: 3.4.6.6
7
Author: qTranslate Team
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
@@ -121,7 +121,7 @@ if ( ! function_exists( 'add_filter' ) ) {
121
* Designed as interface for other plugin integration. The documentation is available at
122
* https://qtranslatexteam.wordpress.com/integration/
123
*/
124
- define('QTX_VERSION','3.4.6.6');
125
126
if ( ! defined( 'QTRANSLATE_FILE' ) ) {
127
define( 'QTRANSLATE_FILE', __FILE__ );
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.
6
+ Version: 3.4.6.7
7
Author: qTranslate Team
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
121
* Designed as interface for other plugin integration. The documentation is available at
122
* https://qtranslatexteam.wordpress.com/integration/
123
*/
124
+ define('QTX_VERSION','3.4.6.7');
125
126
if ( ! defined( 'QTRANSLATE_FILE' ) ) {
127
define( 'QTRANSLATE_FILE', __FILE__ );
qtranslate_core.php CHANGED
@@ -859,7 +859,7 @@ function qtranxf_language_neutral_path($path) {
859
return $language_neutral_path_cache[$path];
860
}
861
//if(preg_match('#^/(wp-.*\.php|wp-admin/|xmlrpc.php|.*sitemap.*|robots.txt|oauth/)#', $path)){//sitemap.hml works ok without it
862
- if(preg_match('#^/(wp-.*\.php|wp-admin/|xmlrpc.php|robots.txt|oauth/)#', $path)){
863
$language_neutral_path_cache[$path] = true;
864
//qtranxf_dbg_log('qtranxf_language_neutral_path: preg_match: path='.$path);
865
return true;
859
return $language_neutral_path_cache[$path];
860
}
861
//if(preg_match('#^/(wp-.*\.php|wp-admin/|xmlrpc.php|.*sitemap.*|robots.txt|oauth/)#', $path)){//sitemap.hml works ok without it
862
+ if(preg_match('#^/(wp-.*\.php|wp-login/|wp-admin/|xmlrpc.php|robots.txt|oauth/)#', $path)){
863
$language_neutral_path_cache[$path] = true;
864
//qtranxf_dbg_log('qtranxf_language_neutral_path: preg_match: path='.$path);
865
return true;
qtranslate_frontend.php CHANGED
@@ -112,8 +112,9 @@ function qtranxf_wp_get_nav_menu_items( $items, $menu, $args ){
112
switch($item->type){
113
case 'post_type':
114
$p = get_post($item->object_id);
115
- if($p && isset($p->post_title_ml)){
116
- $item_title=qtranxf_use_language($language, $p->post_title_ml, false, true);
117
}
118
break;
119
case 'taxonomy':
112
switch($item->type){
113
case 'post_type':
114
$p = get_post($item->object_id);
115
+ if($p){
116
+ $post_title_ml = isset($p->post_title_ml) ? $p->post_title_ml : $p->post_title;
117
+ $item_title=qtranxf_use_language($language, $post_title_ml, false, true);
118
}
119
break;
120
case 'taxonomy':
qtranslate_utils.php CHANGED
@@ -200,17 +200,21 @@ function qtranxf_parseURL($url) {
200
function qtranxf_buildURL($urlinfo,$homeinfo) {
201
//qtranxf_dbg_log('qtranxf_buildURL: $urlinfo:',$urlinfo);
202
//qtranxf_dbg_log('qtranxf_buildURL: $homeinfo:',$homeinfo);
203
- $url = (empty($urlinfo['scheme']) ? $homeinfo['scheme'] : $urlinfo['scheme']).'://';
204
- if(!empty($urlinfo['user'])){
205
- $url .= $urlinfo['user'];
206
- if(!empty($urlinfo['pass'])) $url .= ':'.$urlinfo['pass'];
207
- $url .= '@';
208
- }elseif(!empty($homeinfo['user'])){
209
- $url .= $homeinfo['user'];
210
- if(!empty($homeinfo['pass'])) $url .= ':'.$homeinfo['pass'];
211
- $url .= '@';
212
- }
213
- $url .= empty($urlinfo['host']) ? $homeinfo['host'] : $urlinfo['host'];
214
if(!empty($urlinfo['path-base'])) $url .= $urlinfo['path-base'];
215
if(!empty($urlinfo['wp-path'])) $url .= $urlinfo['wp-path'];
216
if(!empty($urlinfo['query'])) $url .= '?'.$urlinfo['query'];
200
function qtranxf_buildURL($urlinfo,$homeinfo) {
201
//qtranxf_dbg_log('qtranxf_buildURL: $urlinfo:',$urlinfo);
202
//qtranxf_dbg_log('qtranxf_buildURL: $homeinfo:',$homeinfo);
203
+ if(empty($urlinfo['host'])){//relative path stays relative
204
+ $url = '';
205
+ }else{
206
+ $url = (empty($urlinfo['scheme']) ? $homeinfo['scheme'] : $urlinfo['scheme']).'://';
207
+ if(!empty($urlinfo['user'])){
208
+ $url .= $urlinfo['user'];
209
+ if(!empty($urlinfo['pass'])) $url .= ':'.$urlinfo['pass'];
210
+ $url .= '@';
211
+ }elseif(!empty($homeinfo['user'])){
212
+ $url .= $homeinfo['user'];
213
+ if(!empty($homeinfo['pass'])) $url .= ':'.$homeinfo['pass'];
214
+ $url .= '@';
215
+ }
216
+ $url .= empty($urlinfo['host']) ? $homeinfo['host'] : $urlinfo['host'];
217
+ }
218
if(!empty($urlinfo['path-base'])) $url .= $urlinfo['path-base'];
219
if(!empty($urlinfo['wp-path'])) $url .= $urlinfo['wp-path'];
220
if(!empty($urlinfo['query'])) $url .= '?'.$urlinfo['query'];
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: johnclause, chineseleper, Vavooon, grafcom
4
Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, translation
5
Requires at least: 3.9
6
Tested up to: 4.5
7
- Stable tag: 3.4.6.6
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
@@ -121,9 +121,13 @@ This version recovers translation of parent of a category on category edit page.
121
122
## Changelog ##
123
124
### 3.4.6.6 ###
125
* Fix: WP45, '/wp-admin/nav-menus.php': title of newly added menu item kept one language only.
126
- * Fix: WP45, '/wp-admin/nav-menus.php': double quotation mark in menu label.
127
128
### 3.4.6.5 ###
129
* Improvement: Option 'Show language names in "Camel Case"' has been added on Settings/Languages page `/wp-admin/options-general.php?page=qtranslate-x#general` in order to handle absence of function `mb_convert_case`, as PHP module `mbstring` may not be installed by default: [WP Topic](https://wordpress.org/support/topic/qtranslate_utilsphp-on-line-504).
4
Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, translation
5
Requires at least: 3.9
6
Tested up to: 4.5
7
+ Stable tag: 3.4.6.7
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
121
122
## Changelog ##
123
124
+ ### 3.4.6.7 ###
125
+ * Fix: for `/wp-login/` and `/login/`. Thanks to [extremecarver](http://qtranslate-x.com/support/index.php?action=profile;u=373).
126
+ * Fix: unexpected menu behaviour for empty menu label when option "Hide Content which is not available for the selected language" is on: [WP Topic](https://wordpress.org/support/topic/menu-visible-despite-empty-label).
127
+
128
### 3.4.6.6 ###
129
* Fix: WP45, '/wp-admin/nav-menus.php': title of newly added menu item kept one language only.
130
+ * Fix: WP45, '/wp-admin/nav-menus.php': double-quotation mark in menu label.
131
132
### 3.4.6.5 ###
133
* Improvement: Option 'Show language names in "Camel Case"' has been added on Settings/Languages page `/wp-admin/options-general.php?page=qtranslate-x#general` in order to handle absence of function `mb_convert_case`, as PHP module `mbstring` may not be installed by default: [WP Topic](https://wordpress.org/support/topic/qtranslate_utilsphp-on-line-504).