Weglot Translate – Translate your WP website - Version 2.0.7

Version Description

(31/08/2018) = * Bugfix: Ajax load media library * Improve choice original and destination language

Download this release

Release Info

Developer remyb92
Plugin Icon 128x128 Weglot Translate – Translate your WP website
Version 2.0.7
Comparing to
See all releases

Code changes from version 2.0.6 to 2.0.7

app/javascripts/admin-select.js CHANGED
@@ -7,6 +7,7 @@ const init_admin_select = function(){
7
  });
8
  }
9
 
 
10
  let destination_selectize
11
 
12
  const load_destination_selectize = () => {
@@ -41,6 +42,12 @@ const init_admin_select = function(){
41
  .on("change", (value) => {
42
  const code_languages = destination_selectize[0].selectize.getValue()
43
  const template = $("#li-button-tpl");
 
 
 
 
 
 
44
  const is_fullname = $("#is_fullname").is(":checked")
45
  const with_name = $("#with_name").is(":checked")
46
  const with_flags = $("#with_flags").is(":checked")
@@ -77,6 +84,22 @@ const init_admin_select = function(){
77
  }
78
 
79
  const execute = () => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  load_destination_selectize();
82
 
7
  });
8
  }
9
 
10
+
11
  let destination_selectize
12
 
13
  const load_destination_selectize = () => {
42
  .on("change", (value) => {
43
  const code_languages = destination_selectize[0].selectize.getValue()
44
  const template = $("#li-button-tpl");
45
+
46
+ if (template.length === 0){
47
+ return;
48
+ }
49
+
50
+
51
  const is_fullname = $("#is_fullname").is(":checked")
52
  const with_name = $("#with_name").is(":checked")
53
  const with_flags = $("#with_flags").is(":checked")
84
  }
85
 
86
  const execute = () => {
87
+ let work_original_language = $("#original_language").val()
88
+
89
+ $("#original_language").on("change", function (e) {
90
+ const new_destination_option = work_original_language;
91
+ work_original_language = e.target.value;
92
+
93
+ destination_selectize[0].selectize.removeOption(work_original_language);
94
+
95
+ const new_option = weglot_languages.available.find(itm => {
96
+ return itm.code === new_destination_option
97
+ });
98
+
99
+ destination_selectize[0].selectize.addOption(new_option);
100
+
101
+ });
102
+
103
 
104
  load_destination_selectize();
105
 
dist/admin-js.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function o(l){if(t[l])return t[l].exports;var a=t[l]={i:l,l:!1,exports:{}};return e[l].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,l){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:l})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/dist/",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);var l=function(){const e=jQuery;let t;const o=()=>{t=e(".weglot-select-destination").selectize({delimiter:"|",persist:!1,valueField:"code",labelField:"local",searchField:["code","english","local"],sortField:[{field:"english",direction:"asc"}],maxItems:weglot_languages.limit,plugins:["remove_button","drag_drop"],options:(()=>weglot_languages.available.filter(e=>e.code!==weglot_languages.original))(),render:{option:function(e,t){return'<div class="weglot__choice__language"><span class="weglot__choice__language--english">'+t(e.english)+'</span><span class="weglot__choice__language--local">'+t(e.local)+" ["+t(e.code)+"]</span></div>"}}}).on("change",o=>{const l=t[0].selectize.getValue(),a=e("#li-button-tpl"),n=e("#is_fullname").is(":checked"),r=e("#with_name").is(":checked");let s="";e("#with_flags").is(":checked")&&(s="weglot-flags");let c="";l.forEach(e=>{const t=weglot_languages.available.find(t=>t.code===e);let o="";r&&(o=n?t.local:e.toUpperCase()),c+=a.html().replace("{LABEL_LANGUAGE}",o).replace(new RegExp("{CODE_LANGUAGE}","g"),e).replace("{CLASSES}",s)}),e(".country-selector ul").html(c)})};document.addEventListener("DOMContentLoaded",()=>{o(),window.addEventListener("weglotCheckApi",e=>{let o=1e3;const l=e.detail.answer.plan;l<=0||weglot_languages.plans.starter_free.ids.indexOf(l)>=0?o=weglot_languages.plans.starter_free.limit_language:weglot_languages.plans.business.ids.indexOf(l)>=0&&(o=weglot_languages.plans.business.limit_language),t[0].selectize.settings.maxItems=o})})};var a=function(){const e=jQuery;document.addEventListener("DOMContentLoaded",()=>{e("#weglot-box-first-settings .weglot-btn-close").on("click",function(t){t.preventDefault(),e("#weglot-box-first-settings").hide()})})};var n=function(){jQuery;const e=()=>{const e=document.querySelector("#tpl-exclusion-url"),t=document.querySelector("#tpl-exclusion-block"),o=document.querySelector("#container-exclude_urls"),l=document.querySelector("#container-exclude_blocks");function a(e){e.preventDefault(),this.parentNode.remove()}document.querySelector("#js-add-exclude-url")&&document.querySelector("#js-add-exclude-url").addEventListener("click",t=>{t.preventDefault(),o.insertAdjacentHTML("beforeend",e.innerHTML),document.querySelector("#container-exclude_urls .item-exclude:last-child .js-btn-remove").addEventListener("click",a)}),document.querySelector("#js-add-exclude-block")&&document.querySelector("#js-add-exclude-block").addEventListener("click",e=>{e.preventDefault(),l.insertAdjacentHTML("beforeend",t.innerHTML),document.querySelector("#container-exclude_blocks .item-exclude:last-child .js-btn-remove-exclude").addEventListener("click",a)}),document.querySelectorAll(".js-btn-remove").forEach(e=>{e.addEventListener("click",a)})};document.addEventListener("DOMContentLoaded",()=>{e()})};var r=function(){const e=jQuery;document.addEventListener("DOMContentLoaded",()=>{0!==e(".weglot-preview").length&&(()=>{let t=e("#type_flags").val(),o=[];o.push(e(".country-selector label").data("code-language")),e(".country-selector li").each((t,l)=>{o.push(e(l).data("code-language"))});const l=weglot_languages.available.filter(e=>o.indexOf(e.code)>=0);e("#weglot-css-inline").text(weglot_css.inline),e("#is_dropdown").on("change",function(){e(".country-selector").toggleClass("weglot-inline"),e(".country-selector").toggleClass("weglot-dropdown")}),e("#with_flags").on("change",function(){e(".country-selector label, .country-selector li").toggleClass("weglot-flags")}),e("#type_flags").on("change",function(o){e(".country-selector label, .country-selector li").removeClass(`flag-${t}`);const l=o.target.value;e(".country-selector label, .country-selector li").addClass(`flag-${l}`),t=l});const a=()=>{const t=l.find(t=>t.code===e(".country-selector label").data("code-language")),o=e("#is_fullname").is(":checked"),a=o?t.local:t.code.toUpperCase();e(".country-selector label a, .country-selector label span").text(a),e(".country-selector li").each((t,a)=>{const n=l.find(t=>t.code===e(a).data("code-language")),r=o?n.local:n.code.toUpperCase();e(a).find("a").text(r)})};e("#with_name").on("change",function(t){t.target.checked?a():(e(".country-selector label a, .country-selector label span").text(""),e(".country-selector li a, .country-selector li span").each((t,o)=>{e(o).text("")}))}),e("#is_fullname").on("change",function(t){if(e("#with_name").is(":checked"))if(t.target.checked)a();else{const t=l.find(t=>t.code===e(".country-selector label").data("code-language"));e(".country-selector label a, .country-selector label span").text(t.code.toUpperCase()),e(".country-selector li").each((t,o)=>{const a=l.find(t=>t.code===e(o).data("code-language"));e(o).find("a").text(a.code.toUpperCase()),e(o).find("span").text(a.code.toUpperCase())})}}),e("#override_css").on("keyup",function(t){e("#weglot-css-inline").text(t.target.value)})})()})};var s=function(){const e=jQuery,t=()=>{e("#api_key").blur(function(){var t=e(this).val();if(0===t.length)return e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-nokkey"></span>'),void e("#wrap-weglot #submit").prop("disabled",!0);e.getJSON("https://weglot.com/api/user-info?api_key="+t,t=>{e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-okkey"></span>'),e("#wrap-weglot #submit").prop("disabled",!1);const o=new CustomEvent("weglotCheckApi",{detail:t});window.dispatchEvent(o)}).fail(function(){e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-nokkey"></span>'),e("#wrap-weglot #submit").prop("disabled",!0)})})};document.addEventListener("DOMContentLoaded",()=>{t()})};var c=function(){const e=jQuery;"undefined"!=typeof weglot_css&&e("#weglot-css-flag-css").text(weglot_css.flag_css);const t=()=>{e(".flag-style-openclose").on("click",function(){e(".flag-style-wrapper").toggle()}),e("select.flag-en-type, select.flag-es-type, select.flag-pt-type, select.flag-fr-type, select.flag-ar-type").on("change",function(){!function(){var t=new Array,o=new Array,l=new Array,a=new Array,n=new Array;t[1]=[3570,7841,48,2712],t[2]=[3720,449,3048,4440],t[3]=[3840,1281,2712,4224],t[4]=[3240,5217,1224,2112],t[5]=[4050,3585,1944,2496],t[6]=[2340,3457,2016,2016],o[1]=[4320,4641,3144,3552],o[2]=[3750,353,2880,4656],o[3]=[4200,1601,2568,3192],o[4]=[3990,5793,1032,2232],o[5]=[5460,897,4104,3120],o[6]=[3810,7905,216,3888],o[7]=[3630,8065,192,2376],o[8]=[3780,1473,2496,4104],o[9]=[6120,2145,4680,2568],o[10]=[4440,3009,3240,1176],o[11]=[5280,1825,3936,2976],o[12]=[4770,2081,3624,1008],o[13]=[4080,3201,2160,2544],o[14]=[4590,5761,3432,624],o[15]=[4350,2209,3360,2688],o[16]=[5610,5249,3168,528],o[17]=[5070,1729,3792,2952],o[18]=[6870,5953,96,3408],o[19]=[4020,5697,1056,1224],l[1]=[1740,5921,528,3504],a[1]=[2760,736,2856,4416],a[2]=[3840,1280,2712,4224],a[3]=[5700,7201,5016,2400],a[4]=[2220,4160,1632,1944],n[1]=[1830,129,3096,5664],n[2]=[5100,2177,3840,2904],n[3]=[4890,3425,3648,2136],n[4]=[1320,3681,1896,4080],n[5]=[1260,3841,1824,1200],n[6]=[1020,3969,1608,312],n[7]=[4800,4065,3600,72],n[8]=[4710,4865,3504,480],n[9]=[6720,5984,5112,3792],n[10]=[4500,7233,3288,1800],n[11]=[720,7522,384,3936],n[12]=[690,7745,336,1104],n[13]=[600,8225,120,1272],n[14]=[660,5569,840,576];var r=e("select.flag-en-type").val(),s=e("select.flag-es-type").val(),c=e("select.flag-pt-type").val(),g=e("select.flag-fr-type").val(),i=e("select.flag-ar-type").val(),f=r<=0?"":".weglot-flags.en > a:before, .weglot-flags.en > span:before { background-position: -"+t[r][0]+"px 0; } .weglot-flags.flag-1.en > a:before, .weglot-flags.flag-1.en > span:before { background-position: -"+t[r][1]+"px 0; } .weglot-flags.flag-2.en > a:before, .weglot-flags.flag-2.en > span:before { background-position: -"+t[r][2]+"px 0; } .weglot-flags.flag-3.en > a:before, .weglot-flags.flag-3.en > span:before { background-position: -"+t[r][3]+"px 0; } ",u=s<=0?"":".weglot-flags.es > a:before, .weglot-flags.es > span:before { background-position: -"+o[s][0]+"px 0; } .weglot-flags.flag-1.es > a:before, .weglot-flags.flag-1.es > span:before { background-position: -"+o[s][1]+"px 0; } .weglot-flags.flag-2.es > a:before, .weglot-flags.flag-2.es > span:before { background-position: -"+o[s][2]+"px 0; } .weglot-flags.flag-3.es > a:before, .weglot-flags.flag-3.es > span:before { background-position: -"+o[s][3]+"px 0; } ",d=c<=0?"":".weglot-flags.pt > a:before, .weglot-flags.pt > span:before { background-position: -"+l[c][0]+"px 0; } .weglot-flags.flag-1.pt > a:before, .weglot-flags.flag-1.pt > span:before { background-position: -"+l[c][1]+"px 0; } .weglot-flags.flag-2.pt > a:before, .weglot-flags.flag-2.pt > span:before { background-position: -"+l[c][2]+"px 0; } .weglot-flags.flag-3.pt > a:before, .weglot-flags.flag-3.pt > span:before { background-position: -"+l[c][3]+"px 0; } ",p=g<=0?"":".weglot-flags.fr > a:before, .weglot-flags.fr > span:before { background-position: -"+a[g][0]+"px 0; } .weglot-flags.flag-1.fr > a:before, .weglot-flags.flag-1.fr > span:before { background-position: -"+a[g][1]+"px 0; } .weglot-flags.flag-2.fr > a:before, .weglot-flags.flag-2.fr > span:before { background-position: -"+a[g][2]+"px 0; } .weglot-flags.flag-3.fr > a:before, .weglot-flags.flag-3.fr > span:before { background-position: -"+a[g][3]+"px 0; } ",w=i<=0?"":".weglot-flags.ar > a:before, .weglot-flags.ar > span:before { background-position: -"+n[i][0]+"px 0; } .weglot-flags.flag-1.ar > a:before, .weglot-flags.flag-1.ar > span:before { background-position: -"+n[i][1]+"px 0; } .weglot-flags.flag-2.ar > a:before, .weglot-flags.flag-2.ar > span:before { background-position: -"+n[i][2]+"px 0; } .weglot-flags.flag-3.ar > a:before, .weglot-flags.flag-3.ar > span:before { background-position: -"+n[i][3]+"px 0; } ";e("#flag_css, #weglot-css-flag-css").text(f+u+d+p+w)}()})};document.addEventListener("DOMContentLoaded",()=>{t()})};var g=function(){};o(2),o(1);l(),n(),a(),r(),s(),c(),g()},function(e,t){Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if("Function"!=typeof e&&"function"!=typeof e||!this)throw new TypeError;var o=this.length>>>0,l=new Array(o),a=this,n=0,r=-1;if(void 0===t)for(;++r!==o;)r in this&&e(a[r],r,a)&&(l[n++]=a[r]);else for(;++r!==o;)r in this&&e.call(t,a[r],r,a)&&(l[n++]=a[r]);return l.length=n,l})},function(e,t){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var l=arguments[1],a=0;a<o;){var n=t[a];if(e.call(l,n,a,t))return n;a++}},configurable:!0,writable:!0})}]);
1
+ !function(e){var t={};function o(l){if(t[l])return t[l].exports;var a=t[l]={i:l,l:!1,exports:{}};return e[l].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,l){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:l})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/dist/",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);var l=function(){const e=jQuery;let t;const o=()=>{t=e(".weglot-select-destination").selectize({delimiter:"|",persist:!1,valueField:"code",labelField:"local",searchField:["code","english","local"],sortField:[{field:"english",direction:"asc"}],maxItems:weglot_languages.limit,plugins:["remove_button","drag_drop"],options:(()=>weglot_languages.available.filter(e=>e.code!==weglot_languages.original))(),render:{option:function(e,t){return'<div class="weglot__choice__language"><span class="weglot__choice__language--english">'+t(e.english)+'</span><span class="weglot__choice__language--local">'+t(e.local)+" ["+t(e.code)+"]</span></div>"}}}).on("change",o=>{const l=t[0].selectize.getValue(),a=e("#li-button-tpl");if(0===a.length)return;const n=e("#is_fullname").is(":checked"),r=e("#with_name").is(":checked");let s="";e("#with_flags").is(":checked")&&(s="weglot-flags");let c="";l.forEach(e=>{const t=weglot_languages.available.find(t=>t.code===e);let o="";r&&(o=n?t.local:e.toUpperCase()),c+=a.html().replace("{LABEL_LANGUAGE}",o).replace(new RegExp("{CODE_LANGUAGE}","g"),e).replace("{CLASSES}",s)}),e(".country-selector ul").html(c)})};document.addEventListener("DOMContentLoaded",()=>{(()=>{let l=e("#original_language").val();e("#original_language").on("change",function(e){const o=l;l=e.target.value,t[0].selectize.removeOption(l);const a=weglot_languages.available.find(e=>e.code===o);t[0].selectize.addOption(a)}),o(),window.addEventListener("weglotCheckApi",e=>{let o=1e3;const l=e.detail.answer.plan;l<=0||weglot_languages.plans.starter_free.ids.indexOf(l)>=0?o=weglot_languages.plans.starter_free.limit_language:weglot_languages.plans.business.ids.indexOf(l)>=0&&(o=weglot_languages.plans.business.limit_language),t[0].selectize.settings.maxItems=o})})()})};var a=function(){const e=jQuery;document.addEventListener("DOMContentLoaded",()=>{e("#weglot-box-first-settings .weglot-btn-close").on("click",function(t){t.preventDefault(),e("#weglot-box-first-settings").hide()})})};var n=function(){jQuery;const e=()=>{const e=document.querySelector("#tpl-exclusion-url"),t=document.querySelector("#tpl-exclusion-block"),o=document.querySelector("#container-exclude_urls"),l=document.querySelector("#container-exclude_blocks");function a(e){e.preventDefault(),this.parentNode.remove()}document.querySelector("#js-add-exclude-url")&&document.querySelector("#js-add-exclude-url").addEventListener("click",t=>{t.preventDefault(),o.insertAdjacentHTML("beforeend",e.innerHTML),document.querySelector("#container-exclude_urls .item-exclude:last-child .js-btn-remove").addEventListener("click",a)}),document.querySelector("#js-add-exclude-block")&&document.querySelector("#js-add-exclude-block").addEventListener("click",e=>{e.preventDefault(),l.insertAdjacentHTML("beforeend",t.innerHTML),document.querySelector("#container-exclude_blocks .item-exclude:last-child .js-btn-remove-exclude").addEventListener("click",a)}),document.querySelectorAll(".js-btn-remove").forEach(e=>{e.addEventListener("click",a)})};document.addEventListener("DOMContentLoaded",()=>{e()})};var r=function(){const e=jQuery;document.addEventListener("DOMContentLoaded",()=>{0!==e(".weglot-preview").length&&(()=>{let t=e("#type_flags").val(),o=[];o.push(e(".country-selector label").data("code-language")),e(".country-selector li").each((t,l)=>{o.push(e(l).data("code-language"))});const l=weglot_languages.available.filter(e=>o.indexOf(e.code)>=0);e("#weglot-css-inline").text(weglot_css.inline),e("#is_dropdown").on("change",function(){e(".country-selector").toggleClass("weglot-inline"),e(".country-selector").toggleClass("weglot-dropdown")}),e("#with_flags").on("change",function(){e(".country-selector label, .country-selector li").toggleClass("weglot-flags")}),e("#type_flags").on("change",function(o){e(".country-selector label, .country-selector li").removeClass(`flag-${t}`);const l=o.target.value;e(".country-selector label, .country-selector li").addClass(`flag-${l}`),t=l});const a=()=>{const t=l.find(t=>t.code===e(".country-selector label").data("code-language")),o=e("#is_fullname").is(":checked"),a=o?t.local:t.code.toUpperCase();e(".country-selector label a, .country-selector label span").text(a),e(".country-selector li").each((t,a)=>{const n=l.find(t=>t.code===e(a).data("code-language")),r=o?n.local:n.code.toUpperCase();e(a).find("a").text(r)})};e("#with_name").on("change",function(t){t.target.checked?a():(e(".country-selector label a, .country-selector label span").text(""),e(".country-selector li a, .country-selector li span").each((t,o)=>{e(o).text("")}))}),e("#is_fullname").on("change",function(t){if(e("#with_name").is(":checked"))if(t.target.checked)a();else{const t=l.find(t=>t.code===e(".country-selector label").data("code-language"));e(".country-selector label a, .country-selector label span").text(t.code.toUpperCase()),e(".country-selector li").each((t,o)=>{const a=l.find(t=>t.code===e(o).data("code-language"));e(o).find("a").text(a.code.toUpperCase()),e(o).find("span").text(a.code.toUpperCase())})}}),e("#override_css").on("keyup",function(t){e("#weglot-css-inline").text(t.target.value)})})()})};var s=function(){const e=jQuery,t=()=>{e("#api_key").blur(function(){var t=e(this).val();if(0===t.length)return e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-nokkey"></span>'),void e("#wrap-weglot #submit").prop("disabled",!0);e.getJSON("https://weglot.com/api/user-info?api_key="+t,t=>{e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-okkey"></span>'),e("#wrap-weglot #submit").prop("disabled",!1);const o=new CustomEvent("weglotCheckApi",{detail:t});window.dispatchEvent(o)}).fail(function(){e(".weglot-keyres").remove(),e("#api_key").after('<span class="weglot-keyres weglot-nokkey"></span>'),e("#wrap-weglot #submit").prop("disabled",!0)})})};document.addEventListener("DOMContentLoaded",()=>{t()})};var c=function(){const e=jQuery;"undefined"!=typeof weglot_css&&e("#weglot-css-flag-css").text(weglot_css.flag_css);const t=()=>{e(".flag-style-openclose").on("click",function(){e(".flag-style-wrapper").toggle()}),e("select.flag-en-type, select.flag-es-type, select.flag-pt-type, select.flag-fr-type, select.flag-ar-type").on("change",function(){!function(){var t=new Array,o=new Array,l=new Array,a=new Array,n=new Array;t[1]=[3570,7841,48,2712],t[2]=[3720,449,3048,4440],t[3]=[3840,1281,2712,4224],t[4]=[3240,5217,1224,2112],t[5]=[4050,3585,1944,2496],t[6]=[2340,3457,2016,2016],o[1]=[4320,4641,3144,3552],o[2]=[3750,353,2880,4656],o[3]=[4200,1601,2568,3192],o[4]=[3990,5793,1032,2232],o[5]=[5460,897,4104,3120],o[6]=[3810,7905,216,3888],o[7]=[3630,8065,192,2376],o[8]=[3780,1473,2496,4104],o[9]=[6120,2145,4680,2568],o[10]=[4440,3009,3240,1176],o[11]=[5280,1825,3936,2976],o[12]=[4770,2081,3624,1008],o[13]=[4080,3201,2160,2544],o[14]=[4590,5761,3432,624],o[15]=[4350,2209,3360,2688],o[16]=[5610,5249,3168,528],o[17]=[5070,1729,3792,2952],o[18]=[6870,5953,96,3408],o[19]=[4020,5697,1056,1224],l[1]=[1740,5921,528,3504],a[1]=[2760,736,2856,4416],a[2]=[3840,1280,2712,4224],a[3]=[5700,7201,5016,2400],a[4]=[2220,4160,1632,1944],n[1]=[1830,129,3096,5664],n[2]=[5100,2177,3840,2904],n[3]=[4890,3425,3648,2136],n[4]=[1320,3681,1896,4080],n[5]=[1260,3841,1824,1200],n[6]=[1020,3969,1608,312],n[7]=[4800,4065,3600,72],n[8]=[4710,4865,3504,480],n[9]=[6720,5984,5112,3792],n[10]=[4500,7233,3288,1800],n[11]=[720,7522,384,3936],n[12]=[690,7745,336,1104],n[13]=[600,8225,120,1272],n[14]=[660,5569,840,576];var r=e("select.flag-en-type").val(),s=e("select.flag-es-type").val(),c=e("select.flag-pt-type").val(),g=e("select.flag-fr-type").val(),i=e("select.flag-ar-type").val(),f=r<=0?"":".weglot-flags.en > a:before, .weglot-flags.en > span:before { background-position: -"+t[r][0]+"px 0; } .weglot-flags.flag-1.en > a:before, .weglot-flags.flag-1.en > span:before { background-position: -"+t[r][1]+"px 0; } .weglot-flags.flag-2.en > a:before, .weglot-flags.flag-2.en > span:before { background-position: -"+t[r][2]+"px 0; } .weglot-flags.flag-3.en > a:before, .weglot-flags.flag-3.en > span:before { background-position: -"+t[r][3]+"px 0; } ",u=s<=0?"":".weglot-flags.es > a:before, .weglot-flags.es > span:before { background-position: -"+o[s][0]+"px 0; } .weglot-flags.flag-1.es > a:before, .weglot-flags.flag-1.es > span:before { background-position: -"+o[s][1]+"px 0; } .weglot-flags.flag-2.es > a:before, .weglot-flags.flag-2.es > span:before { background-position: -"+o[s][2]+"px 0; } .weglot-flags.flag-3.es > a:before, .weglot-flags.flag-3.es > span:before { background-position: -"+o[s][3]+"px 0; } ",d=c<=0?"":".weglot-flags.pt > a:before, .weglot-flags.pt > span:before { background-position: -"+l[c][0]+"px 0; } .weglot-flags.flag-1.pt > a:before, .weglot-flags.flag-1.pt > span:before { background-position: -"+l[c][1]+"px 0; } .weglot-flags.flag-2.pt > a:before, .weglot-flags.flag-2.pt > span:before { background-position: -"+l[c][2]+"px 0; } .weglot-flags.flag-3.pt > a:before, .weglot-flags.flag-3.pt > span:before { background-position: -"+l[c][3]+"px 0; } ",p=g<=0?"":".weglot-flags.fr > a:before, .weglot-flags.fr > span:before { background-position: -"+a[g][0]+"px 0; } .weglot-flags.flag-1.fr > a:before, .weglot-flags.flag-1.fr > span:before { background-position: -"+a[g][1]+"px 0; } .weglot-flags.flag-2.fr > a:before, .weglot-flags.flag-2.fr > span:before { background-position: -"+a[g][2]+"px 0; } .weglot-flags.flag-3.fr > a:before, .weglot-flags.flag-3.fr > span:before { background-position: -"+a[g][3]+"px 0; } ",w=i<=0?"":".weglot-flags.ar > a:before, .weglot-flags.ar > span:before { background-position: -"+n[i][0]+"px 0; } .weglot-flags.flag-1.ar > a:before, .weglot-flags.flag-1.ar > span:before { background-position: -"+n[i][1]+"px 0; } .weglot-flags.flag-2.ar > a:before, .weglot-flags.flag-2.ar > span:before { background-position: -"+n[i][2]+"px 0; } .weglot-flags.flag-3.ar > a:before, .weglot-flags.flag-3.ar > span:before { background-position: -"+n[i][3]+"px 0; } ";e("#flag_css, #weglot-css-flag-css").text(f+u+d+p+w)}()})};document.addEventListener("DOMContentLoaded",()=>{t()})};var g=function(){};o(2),o(1);l(),n(),a(),r(),s(),c(),g()},function(e,t){Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if("Function"!=typeof e&&"function"!=typeof e||!this)throw new TypeError;var o=this.length>>>0,l=new Array(o),a=this,n=0,r=-1;if(void 0===t)for(;++r!==o;)r in this&&e(a[r],r,a)&&(l[n++]=a[r]);else for(;++r!==o;)r in this&&e.call(t,a[r],r,a)&&(l[n++]=a[r]);return l.length=n,l})},function(e,t){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var l=arguments[1],a=0;a<o;){var n=t[a];if(e.call(l,n,a,t))return n;a++}},configurable:!0,writable:!0})}]);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: translate,translation,language,multilingual,bilingual,international,locali
4
  Requires at least: 4.5
5
  Tested up to: 4.9
6
  Requires PHP: 5.4
7
- Stable tag: 2.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -44,7 +44,7 @@ Weglot Translate offers professional support to premium users to help them trans
44
 
45
  Can I migrate from WPML or Polylang to Weglot Translate?
46
 
47
- Yes, you can easily migrate to Weglot Translate. Simply deactivate WPML or Polylang to only have one multilingual plugin. Then start using Weglot normally. If you need to import some translations contact us directly at support@weglot.com
48
 
49
  Does Weglot Translate provide support?
50
 
@@ -83,7 +83,7 @@ Weglot Translate is easy to set up:
83
  = Is Weglot Translate free? =
84
  Weglot Translate is a freemium plugin: it is free for small websites (under 2000 words) with one translation language. If you need more, you can upgrade. Details of our pricing can be found [here](https://weglot.com/pricing)
85
 
86
- In any case, you can try Weglot free for 10 days.
87
  = Edit my translations =
88
  With Weglot Translate, you can modify translations in "Translations" in your Weglot [account here](https://dashboard.weglot.com/translations/). If you change a translation, it's automatically saved and displayed on your website.
89
  = The translations I edited are not displayed on my website. =
@@ -152,9 +152,13 @@ See changelog for upgrade changes.
152
 
153
  == Changelog ==
154
 
 
 
 
 
155
  = 2.0.6 (29/08/2018) =
156
- * Add DOM checker for button value and data-value attribute
157
- * Update setting page
158
  * Bugfix : email translation
159
  * Bugfix : external link with quickpay
160
  * Prevent auto redirect on homepage translate
4
  Requires at least: 4.5
5
  Tested up to: 4.9
6
  Requires PHP: 5.4
7
+ Stable tag: 2.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
44
 
45
  Can I migrate from WPML or Polylang to Weglot Translate?
46
 
47
+ Yes, you can easily migrate to Weglot Translate. Simply deactivate WPML or Polylang to only have one multilingual plugin. Then start using Weglot Translate normally. If you need to import some translations contact us directly at support@weglot.com
48
 
49
  Does Weglot Translate provide support?
50
 
83
  = Is Weglot Translate free? =
84
  Weglot Translate is a freemium plugin: it is free for small websites (under 2000 words) with one translation language. If you need more, you can upgrade. Details of our pricing can be found [here](https://weglot.com/pricing)
85
 
86
+ In any case, you can try Weglot Translate free for 10 days.
87
  = Edit my translations =
88
  With Weglot Translate, you can modify translations in "Translations" in your Weglot [account here](https://dashboard.weglot.com/translations/). If you change a translation, it's automatically saved and displayed on your website.
89
  = The translations I edited are not displayed on my website. =
152
 
153
  == Changelog ==
154
 
155
+ = 2.0.7 (31/08/2018) =
156
+ * Bugfix: Ajax load media library
157
+ * Improve choice original and destination language
158
+
159
  = 2.0.6 (29/08/2018) =
160
+ * Add DOM checker to translate button value and data-value attribute
161
+ * Update Weglot Translate setting page
162
  * Bugfix : email translation
163
  * Bugfix : external link with quickpay
164
  * Prevent auto redirect on homepage translate
src/actions/front/class-translate-page-weglot.php CHANGED
@@ -43,8 +43,9 @@ class Translate_Page_Weglot implements Hooks_Interface_Weglot {
43
  * @return void
44
  */
45
  public function hooks() {
46
- $no_translate = false;
47
- if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['action'] ) && 'add-menu-item' === $_POST['action'] ) { //phpcs:ignore
 
48
  $no_translate = true;
49
  }
50
 
43
  * @return void
44
  */
45
  public function hooks() {
46
+ $no_translate = false;
47
+ $action_ajax_no_translate = apply_filters( 'weglot_action_ajax_no_translate', [ 'add-menu-item', 'query-attachments' ] );
48
+ if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['action'] ) && in_array( $_POST['action'], $action_ajax_no_translate ) ) { //phpcs:ignore
49
  $no_translate = true;
50
  }
51
 
templates/admin/pages/tabs/appearance.php CHANGED
@@ -280,13 +280,13 @@ $options_available = [
280
  <tr valign="top">
281
  <th scope="row"><?php esc_html_e( 'In menu?', 'weglot' ); ?></th>
282
  <td>
283
- <?php esc_html_e( 'You can place the button in a menu area. Go to Appearance -> Menus and drag and drop the Weglot Translate Custom link where you want.', 'weglot' ); ?>
284
  </td>
285
  </tr>
286
  <tr valign="top">
287
  <th scope="row"><?php esc_html_e( 'As a widget?', 'weglot' ); ?></th>
288
  <td>
289
- <?php esc_html_e( 'You can place the button in a widget area. Go to Appearance -> Widgets and drag and drop the Weglot Translate widget where you want.', 'weglot' ); ?>
290
  </td>
291
  </tr>
292
  <tr valign="top">
280
  <tr valign="top">
281
  <th scope="row"><?php esc_html_e( 'In menu?', 'weglot' ); ?></th>
282
  <td>
283
+ <?php echo __( 'You can place the button in a menu area. Go to <a href="' . admin_url( 'nav-menus.php' ) . '">Appearance -> Menus</a> and drag and drop the Weglot Translate Custom link where you want.', 'weglot' ); ?>
284
  </td>
285
  </tr>
286
  <tr valign="top">
287
  <th scope="row"><?php esc_html_e( 'As a widget?', 'weglot' ); ?></th>
288
  <td>
289
+ <?php echo __( 'You can place the button in a widget area. Go to <a href="' . admin_url( 'widgets.php' ) . '">Appearance -> Widgets</a> and drag and drop the Weglot Translate widget where you want.', 'weglot' ); ?>
290
  </td>
291
  </tr>
292
  <tr valign="top">
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit91145ad7da755053e6c2f4a1f34084b8::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitec5eb040bcf6bc06d6afc63577f1384f
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequireec5eb040bcf6bc06d6afc63577f1384f($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequireec5eb040bcf6bc06d6afc63577f1384f($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit91145ad7da755053e6c2f4a1f34084b8
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit91145ad7da755053e6c2f4a1f34084b8', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit91145ad7da755053e6c2f4a1f34084b8', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire91145ad7da755053e6c2f4a1f34084b8($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire91145ad7da755053e6c2f4a1f34084b8($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f
8
  {
9
  public static $files = array (
10
  '6c200413eed8aeea54dbaf934a31b127' => __DIR__ . '/..' . '/weglot/simplehtmldom/src/simple_html_dom.php',
@@ -45,9 +45,9 @@ class ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
- $loader->prefixLengthsPsr4 = ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f::$prefixLengthsPsr4;
49
- $loader->prefixDirsPsr4 = ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f::$prefixDirsPsr4;
50
- $loader->prefixesPsr0 = ComposerStaticInitec5eb040bcf6bc06d6afc63577f1384f::$prefixesPsr0;
51
 
52
  }, null, ClassLoader::class);
53
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8
8
  {
9
  public static $files = array (
10
  '6c200413eed8aeea54dbaf934a31b127' => __DIR__ . '/..' . '/weglot/simplehtmldom/src/simple_html_dom.php',
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
+ $loader->prefixLengthsPsr4 = ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8::$prefixLengthsPsr4;
49
+ $loader->prefixDirsPsr4 = ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8::$prefixDirsPsr4;
50
+ $loader->prefixesPsr0 = ComposerStaticInit91145ad7da755053e6c2f4a1f34084b8::$prefixesPsr0;
51
 
52
  }, null, ClassLoader::class);
53
  }
weglot.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * @version 2.0.6
4
  */
5
 
6
  /*
@@ -11,7 +11,7 @@ Author: Weglot Translate team
11
  Author URI: https://weglot.com/
12
  Text Domain: weglot
13
  Domain Path: /languages/
14
- Version: 2.0.6
15
  */
16
 
17
  /**
@@ -27,7 +27,7 @@ if ( ! defined('ABSPATH')) {
27
  define('WEGLOT_NAME', 'Weglot');
28
  define('WEGLOT_SLUG', 'weglot-translate');
29
  define('WEGLOT_OPTION_GROUP', 'group-weglot-translate');
30
- define('WEGLOT_VERSION', '2.0.6');
31
  define('WEGLOT_PHP_MIN', '5.4');
32
  define('WEGLOT_BNAME', plugin_basename(__FILE__));
33
  define('WEGLOT_DIR', __DIR__ );
1
  <?php
2
  /**
3
+ * @version 2.0.7
4
  */
5
 
6
  /*
11
  Author URI: https://weglot.com/
12
  Text Domain: weglot
13
  Domain Path: /languages/
14
+ Version: 2.0.7
15
  */
16
 
17
  /**
27
  define('WEGLOT_NAME', 'Weglot');
28
  define('WEGLOT_SLUG', 'weglot-translate');
29
  define('WEGLOT_OPTION_GROUP', 'group-weglot-translate');
30
+ define('WEGLOT_VERSION', '2.0.7');
31
  define('WEGLOT_PHP_MIN', '5.4');
32
  define('WEGLOT_BNAME', plugin_basename(__FILE__));
33
  define('WEGLOT_DIR', __DIR__ );