WPGlobus – Multilingual Everything! - Version 2.4.17

Version Description

  • (Core/WidgetsJS) Use WPGlobusCoreData.language instead of WPGlobusCoreData.default_language; Hide unneeded dialog icons.
Download this release

Release Info

Developer tivnet
Plugin Icon 128x128 WPGlobus – Multilingual Everything!
Version 2.4.17
Comparing to
See all releases

Code changes from version 2.4.16 to 2.4.17

includes/js/wpglobus-widgets.js CHANGED
@@ -3,6 +3,8 @@
3
  * Interface JS functions
4
  *
5
  * @since 1.0.6
 
 
6
  *
7
  * @package WPGlobus
8
  * @subpackage Administration
@@ -10,8 +12,6 @@
10
  /*jslint browser: true*/
11
  /*global jQuery, console, WPGlobusCore, WPGlobusCoreData, WPGlobusWidgets*/
12
 
13
- //var WPGlobusWidgets;
14
-
15
  (function($) {
16
  "use strict";
17
 
@@ -101,7 +101,10 @@
101
  /**
102
  * Set init value for tinymce editor via textarea field.
103
  */
104
- var ic = WPGlobusCore.TextFilter( api.editor[editor.id]['content'], WPGlobusCoreData.default_language, 'RETURN_EMPTY' );
 
 
 
105
  $('#'+editor.id).val(ic);
106
 
107
  /**
@@ -130,7 +133,7 @@
130
  'id="'+editor.id+'-wpglobus-button" ' +
131
  'data-widget-id="'+controlElementID+'"' +
132
  'class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe">' +
133
- '<span class="wpglobus-current-language" data-language="en" style="">En</span>' +
134
  '</button>' +
135
  '<div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;">' +
136
  '<div style="display:flex;flex-direction:column;">' + items + '</div>' +
@@ -148,8 +151,16 @@
148
  /**
149
  * Set widget title.
150
  */
151
- api.arbitraryWidgetTitle(editor.id);
152
-
 
 
 
 
 
 
 
 
153
  },
154
  arbitraryWidgetTitle: function(editorID) {
155
  var title = WPGlobusCore.TextFilter(
@@ -453,6 +464,42 @@
453
  setTimeout(function(){$('#wpglobus-'+elID).val(v)},1000);
454
  }
455
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  }
457
  };
458
 
3
  * Interface JS functions
4
  *
5
  * @since 1.0.6
6
+ * @since 2.4.17 To use WPGlobusCoreData.language instead of WPGlobusCoreData.default_language.
7
+ * Hide unneeded dialog icons.
8
  *
9
  * @package WPGlobus
10
  * @subpackage Administration
12
  /*jslint browser: true*/
13
  /*global jQuery, console, WPGlobusCore, WPGlobusCoreData, WPGlobusWidgets*/
14
 
 
 
15
  (function($) {
16
  "use strict";
17
 
101
  /**
102
  * Set init value for tinymce editor via textarea field.
103
  */
104
+ /**
105
+ * @since 2.4.17
106
+ */
107
+ var ic = WPGlobusCore.TextFilter( api.editor[editor.id]['content'], WPGlobusCoreData.language , 'RETURN_EMPTY' );
108
  $('#'+editor.id).val(ic);
109
 
110
  /**
133
  'id="'+editor.id+'-wpglobus-button" ' +
134
  'data-widget-id="'+controlElementID+'"' +
135
  'class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe">' +
136
+ '<span class="wpglobus-current-language" data-language="'+WPGlobusCoreData.language+'" style="">'+WPGlobusCoreData.language+'</span>' +
137
  '</button>' +
138
  '<div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;">' +
139
  '<div style="display:flex;flex-direction:column;">' + items + '</div>' +
151
  /**
152
  * Set widget title.
153
  */
154
+ api.arbitraryWidgetTitle(editor.id);
155
+
156
+ /**
157
+ * Hide unneeded dialog icon.
158
+ * @since 2.4.17
159
+ */
160
+ if ( $(sourceSelector).hasClass('hidden') ) {
161
+ var parentElement = $(sourceSelector).parent();
162
+ $(parentElement).find('div.wpglobus-widgets.wpglobus_dialog_start.wpglobus_dialog_icon').css({'display':'none'});
163
+ }
164
  },
165
  arbitraryWidgetTitle: function(editorID) {
166
  var title = WPGlobusCore.TextFilter(
464
  setTimeout(function(){$('#wpglobus-'+elID).val(v)},1000);
465
  }
466
  }
467
+ },
468
+ __getEditorContent: function() {
469
+ if ( Object.keys(api.editor).length == 0 ) {
470
+ console.log('WPGlobusWidgets editors length is: 0');
471
+ return;
472
+ }
473
+ console.log('WPGlobusWidgets editors length is: ', Object.keys(api.editor).length );
474
+
475
+ for(var key in api.editor) {
476
+ console.log('editor : ', key, ' -> widgetName: ', api.editor[key].widgetName);
477
+ console.log('source content: ', api.editor[key].content);
478
+ $.each(WPGlobusCoreData.enabled_languages, function(i,lang){
479
+ console.log('Language: ', lang);
480
+ var cont = WPGlobusCore.TextFilter(api.editor[key].content, lang, 'RETURN_EMPTY');
481
+ if ( '' == cont ) {
482
+ console.log('empty');
483
+ } else {
484
+ console.log('Content: ', cont);
485
+
486
+ }
487
+ });
488
+ console.log('--------------------');
489
+ }
490
+ },
491
+ __getEditorLanguage: function() {
492
+ if ( Object.keys(api.editor).length == 0 ) {
493
+ console.log('WPGlobusWidgets editors length is: 0');
494
+ return;
495
+ }
496
+ console.log('WPGlobusWidgets editors length is: ', Object.keys(api.editor).length );
497
+
498
+ for(var key in api.editor) {
499
+ console.log('editor : ', key, ' -> widgetName: ', api.editor[key].widgetName);
500
+ console.log('current language : ', $( api.editor[key]['languageSelector'] ).data('language'));
501
+ console.log('--------------------');
502
+ }
503
  }
504
  };
505
 
includes/js/wpglobus-widgets.min.js CHANGED
@@ -1 +1 @@
1
- !function(c){"use strict";var p;"undefined"!=typeof WPGlobusWidgets&&(p={saveArbitraryTextOrHTML:!1,editor:{},languageBoxActive:!1,languageBoxTimeout:null,init:function(){p.addElements(),p.attachListeners(),p.arbitraryTextOrHTML()},wysiwygClean:function(){c(".wpglobus-dialog-field").each(function(e,t){var i,a=c(t).data("source-id");1==c("#"+a+"-tmce").size()&&(i=c(t).next(".wpglobus_dialog_start"),c(t).remove(),c(i).remove())})},setupWidgetControl:function(a,e,i){var t,o,n,d,r,l,u,s,g=!1;c.each(p.editor,function(e,t){if(t.widgetName==a)return!(g=!0)}),g||(""==(o=e.$el[0].id)&&(t=e.$el[0].offsetParent,void 0===(o=c(t).attr("id"))&&c(".widget").each(function(e,t){var i=c(t).attr("id");if(-1!=i.indexOf(a))return o=i,!1})),n="#"+o+" #widget-"+a+"-text",d="#"+o+" #widget-"+a+"-title",p.editor[i.id]={},p.editor[i.id].widgetName=a,p.editor[i.id].controls=e,p.editor[i.id].sourceTitleSelector=d,p.editor[i.id].titleSelector=null,p.editor[i.id].sourceSelector=n,p.editor[i.id].content=c(n).val(),p.editor[i.id].saveSelector="#"+o+" #widget-"+a+"-savewidget",p.editor[i.id].languageSelector="#"+o+" .wpglobus-current-language",p.editor[i.id].inWidgetTitleSelector="#"+o+" .in-widget-title",r=WPGlobusCore.TextFilter(p.editor[i.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY"),c("#"+i.id).val(r),u=l="",c.each(WPGlobusCoreData.enabled_languages,function(e,t){l=(l=(l=(l=(l=(l=(l='<a href="#" onclick="return false;" class="item" data-widget-id="{{widgetID}}" data-source="{{source}}" data-editor-id="{{editorID}}" data-language="{{language}}" data-widget-name="{{widgetName}}" style="text-align:center;"><span>{{item}}</span></a>').replace("{{language}}",t)).replace("{{item}}",WPGlobusCoreData.en_language_name[t])).replace("{{widgetName}}",a)).replace("{{widgetID}}",o)).replace("{{editorID}}",i.id)).replace("{{source}}",n),u+=l}),s='<button style="z-index:200000;" type="button" id="'+i.id+'-wpglobus-button" data-widget-id="'+o+'"class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe"><span class="wpglobus-current-language" data-language="en" style="">En</span></button><div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;"><div style="display:flex;flex-direction:column;">'+u+"</div></div>",c("#"+o+" .wp-editor-tabs").append(s),WPGlobusDialogApp.addElement({id:e.fields.title[0].id,style:"width:93%;"})&&(p.editor[i.id].titleSelector="#"+e.fields.title[0].id),p.arbitraryWidgetTitle(i.id))},arbitraryWidgetTitle:function(e){var t=WPGlobusCore.TextFilter(c("#"+p.editor[e].controls.fields.title[0].id).val(),WPGlobusCoreData.language);c(p.editor[e].inWidgetTitleSelector).text(": "+t)},setBoxTimeout:function(){p.languageBoxTimeout=setTimeout(function(){p.languageBoxActive=!1,c(".wpglobus-language-box").css({display:"none"})},1e3)},arbitraryTextOrHTML:function(){function i(e){var t,i,a="",a="keyup"==e.type&&"tinymce"==e.target.id?c(e.target).data("id"):e.target.id;p.editor[a]&&(t=c(p.editor[a].languageSelector).data("language"),i="",i=tinymce.get(a).isHidden()?c("#"+a).val():tinymce.get(a).getContent({format:"raw"}),p.editor[a].content=WPGlobusCore.getString(p.editor[a].content,i,t),c(p.editor[a].sourceSelector).val(p.editor[a].content))}c(document).on("click",".switch-wpglobus-language",function(e){var t,i,a;p.languageBoxActive||(p.languageBoxActive=!0,i=(t=c(this)).data("widget-id"),(a=t.position()).top+=34,a.left+=10,c("#"+i+" .wpglobus-language-box").css({display:"block",top:a.top+"px",left:a.left+"px"}),p.setBoxTimeout())}),c(document).on("mouseenter",".wpglobus-language-box",function(e){clearTimeout(p.languageBoxTimeout)}).on("mouseleave",".wpglobus-language-box",function(e){c(".wpglobus-language-box").css({display:"none"}),p.languageBoxActive=!1}),c(document).on("click",".wpglobus-language-box .item",function(e){var t=c(this),i=t.data("language"),a=t.data("widget-id"),o=t.data("editor-id");c("#"+a+" .wpglobus-current-language").text(i).data("language",i);var n=WPGlobusCore.TextFilter(p.editor[o].content,i,"RETURN_EMPTY");tinymce.get(o).setContent(n,{format:"raw"}),c("textarea#"+o).val(n)}),c(document).on("tinymce-editor-setup",function(e,i){c.each(wp.textWidgets.widgetControls,function(e,t){p.setupWidgetControl(e,t,i)})}),c(document).on("tinymce-editor-init",function(e,t){c(document).on("mouseenter",p.editor[t.id].saveSelector,function(e){c(p.editor[t.id].sourceTitleSelector).val(c(p.editor[t.id].titleSelector).val()),c(p.editor[t.id].sourceSelector).val(p.editor[t.id].content)}),c(document).on("click",p.editor[t.id].saveSelector,function(e){p.saveArbitraryTextOrHTML=t.id}),t.on("nodechange keyup",_.debounce(i,100)),c("#"+t.id).on("keyup",_.debounce(i,100))})},addElements:function(e,t){var i,a=[];a[0]='input[type="text"]',a[1]="textarea",void 0===e||"class"==e?(i=".widget-liquid-right .widget .widget-content",c.each(a,function(e,t){p.makeClone(i,t)})):"id"==e&&(i="#"+t+" .widget-content",c.each(a,function(e,t){p.makeClone(i,t)}))},makeClone:function(e,u){c(e+" "+u).each(function(e,t){var i,a,o,n,d=c(t),r=!1,l=d.attr("id");return void 0===l||-1!=l.indexOf("-number")||""==l||(_.each(WPGlobusWidgets.disabledMask,function(e){if(-1!=l.indexOf(e))return!(r=!0)}),!!r||(i=c("#"+l).clone(),c(d).addClass("wpglobus-dialog-field-source hidden"),a=d.attr("name"),c(i).attr("id","wpglobus-"+l),c(i).attr("name","wpglobus-"+a),c(i).attr("data-source-id",l),c(i).attr("class","wpglobus-dialog-field"),c(i).attr("style","width:90%;"),o=WPGlobusCore.TextFilter(c(d).val(),WPGlobusCoreData.language),c(i).val(o),c('<div style="width:20px;" data-type="control" data-source-type="" data-source-id="'+l+'" class="wpglobus-widgets wpglobus_dialog_start wpglobus_dialog_icon"></div>').insertAfter(d),c(i).insertAfter(d),void('input[type="text"]'==u&&""!=o&&(n=d.parents(".widget").attr("id"),c("#"+n+" .in-widget-title").text(": "+o)))))})},attachListeners:function(){c(document).ajaxComplete(function(e,t,i){if(-1!=i.data.indexOf("action=save-widget")&&-1==i.data.indexOf("delete_widget=1")){if(p.saveArbitraryTextOrHTML){var a=WPGlobusCore.TextFilter(p.editor[p.saveArbitraryTextOrHTML].content,c(p.editor[p.saveArbitraryTextOrHTML].languageSelector).data("language"),"RETURN_EMPTY");return tinymce.get(p.saveArbitraryTextOrHTML).isHidden()?(c("#"+p.saveArbitraryTextOrHTML).val(a),c("#"+p.saveArbitraryTextOrHTML+"-tmce").click()):tinymce.get(p.saveArbitraryTextOrHTML).setContent(a,{format:"raw"}),p.arbitraryWidgetTitle(p.saveArbitraryTextOrHTML),void(p.saveArbitraryTextOrHTML=!1)}var o=(o=i.data.split("widget-id="))[1].split("&");c(".widget-liquid-right .widget").each(function(e,t){var i=c(t).attr("id");-1!==i.indexOf(o[0])&&(p.addElements("id",i),p.wysiwygClean())})}}),c("body").on("change",".wpglobus-dialog-field",function(){var i,a,o=c(this),e="#"+o.data("source-id"),n="";i=c(e).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(i)?(c.each(WPGlobusCoreData.enabled_languages,function(e,t){""!=(a=t==WPGlobusCoreData.language?o.val():WPGlobusCore.TextFilter(i,t,"RETURN_EMPTY"))&&(n+=WPGlobusCore.addLocaleMarks(a,t))}),c(e).val(n)):c(e).val(o.val())}),c(document).on("click",".widget-title, .widget-title-action",function(e){e.preventDefault(),p.wysiwygClean(),p.imageWidget(this)})},imageWidget:function(e){var t,i,a,o,n,d=c(e).parents(".widget").attr("id");-1!=d.indexOf("media_image")&&(t=c("#"+d+" .in-widget-title"),-1!=(i=c("#"+d).find('input[type="text"]').attr("id")).indexOf(".")?(a="wpg-"+i.replace(".","_"),c("#"+d).find('input[type="text"]').attr("name",a),WPGlobusDialogApp.addElement(a)&&(o=c("#"+d).find('input[name="'+a+'"]'),n=WPGlobusCore.getTranslations(o.val())[WPGlobusCoreData.language],t.text(": "+n),setTimeout(function(){c("#wpglobus-"+a).val(n)},1e3))):WPGlobusDialogApp.addElement(i)&&(n=WPGlobusCore.getTranslations(c("#"+i).val())[WPGlobusCoreData.language],t.text(": "+n),setTimeout(function(){c("#wpglobus-"+i).val(n)},1e3)))}},WPGlobusWidgets=c.extend({},WPGlobusWidgets,p))}(jQuery);
1
+ !function(b){"use strict";var p;"undefined"!=typeof WPGlobusWidgets&&(p={saveArbitraryTextOrHTML:!1,editor:{},languageBoxActive:!1,languageBoxTimeout:null,init:function(){p.addElements(),p.attachListeners(),p.arbitraryTextOrHTML()},wysiwygClean:function(){b(".wpglobus-dialog-field").each(function(e,t){var i,o=b(t).data("source-id");1==b("#"+o+"-tmce").size()&&(i=b(t).next(".wpglobus_dialog_start"),b(t).remove(),b(i).remove())})},setupWidgetControl:function(o,e,i){var t,a,n,l,d,r,s,g,u,c=!1;b.each(p.editor,function(e,t){if(t.widgetName==o)return!(c=!0)}),c||(""==(a=e.$el[0].id)&&(t=e.$el[0].offsetParent,void 0===(a=b(t).attr("id"))&&b(".widget").each(function(e,t){var i=b(t).attr("id");if(-1!=i.indexOf(o))return a=i,!1})),n="#"+a+" #widget-"+o+"-text",l="#"+a+" #widget-"+o+"-title",p.editor[i.id]={},p.editor[i.id].widgetName=o,p.editor[i.id].controls=e,p.editor[i.id].sourceTitleSelector=l,p.editor[i.id].titleSelector=null,p.editor[i.id].sourceSelector=n,p.editor[i.id].content=b(n).val(),p.editor[i.id].saveSelector="#"+a+" #widget-"+o+"-savewidget",p.editor[i.id].languageSelector="#"+a+" .wpglobus-current-language",p.editor[i.id].inWidgetTitleSelector="#"+a+" .in-widget-title",d=WPGlobusCore.TextFilter(p.editor[i.id].content,WPGlobusCoreData.language,"RETURN_EMPTY"),b("#"+i.id).val(d),s=r="",b.each(WPGlobusCoreData.enabled_languages,function(e,t){r=(r=(r=(r=(r=(r=(r='<a href="#" onclick="return false;" class="item" data-widget-id="{{widgetID}}" data-source="{{source}}" data-editor-id="{{editorID}}" data-language="{{language}}" data-widget-name="{{widgetName}}" style="text-align:center;"><span>{{item}}</span></a>').replace("{{language}}",t)).replace("{{item}}",WPGlobusCoreData.en_language_name[t])).replace("{{widgetName}}",o)).replace("{{widgetID}}",a)).replace("{{editorID}}",i.id)).replace("{{source}}",n),s+=r}),g='<button style="z-index:200000;" type="button" id="'+i.id+'-wpglobus-button" data-widget-id="'+a+'"class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe"><span class="wpglobus-current-language" data-language="'+WPGlobusCoreData.language+'" style="">'+WPGlobusCoreData.language+'</span></button><div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;"><div style="display:flex;flex-direction:column;">'+s+"</div></div>",b("#"+a+" .wp-editor-tabs").append(g),WPGlobusDialogApp.addElement({id:e.fields.title[0].id,style:"width:93%;"})&&(p.editor[i.id].titleSelector="#"+e.fields.title[0].id),p.arbitraryWidgetTitle(i.id),b(n).hasClass("hidden")&&(u=b(n).parent(),b(u).find("div.wpglobus-widgets.wpglobus_dialog_start.wpglobus_dialog_icon").css({display:"none"})))},arbitraryWidgetTitle:function(e){var t=WPGlobusCore.TextFilter(b("#"+p.editor[e].controls.fields.title[0].id).val(),WPGlobusCoreData.language);b(p.editor[e].inWidgetTitleSelector).text(": "+t)},setBoxTimeout:function(){p.languageBoxTimeout=setTimeout(function(){p.languageBoxActive=!1,b(".wpglobus-language-box").css({display:"none"})},1e3)},arbitraryTextOrHTML:function(){function i(e){var t,i,o="",o="keyup"==e.type&&"tinymce"==e.target.id?b(e.target).data("id"):e.target.id;p.editor[o]&&(t=b(p.editor[o].languageSelector).data("language"),i="",i=tinymce.get(o).isHidden()?b("#"+o).val():tinymce.get(o).getContent({format:"raw"}),p.editor[o].content=WPGlobusCore.getString(p.editor[o].content,i,t),b(p.editor[o].sourceSelector).val(p.editor[o].content))}b(document).on("click",".switch-wpglobus-language",function(e){var t,i,o;p.languageBoxActive||(p.languageBoxActive=!0,i=(t=b(this)).data("widget-id"),(o=t.position()).top+=34,o.left+=10,b("#"+i+" .wpglobus-language-box").css({display:"block",top:o.top+"px",left:o.left+"px"}),p.setBoxTimeout())}),b(document).on("mouseenter",".wpglobus-language-box",function(e){clearTimeout(p.languageBoxTimeout)}).on("mouseleave",".wpglobus-language-box",function(e){b(".wpglobus-language-box").css({display:"none"}),p.languageBoxActive=!1}),b(document).on("click",".wpglobus-language-box .item",function(e){var t=b(this),i=t.data("language"),o=t.data("widget-id"),a=t.data("editor-id");b("#"+o+" .wpglobus-current-language").text(i).data("language",i);var n=WPGlobusCore.TextFilter(p.editor[a].content,i,"RETURN_EMPTY");tinymce.get(a).setContent(n,{format:"raw"}),b("textarea#"+a).val(n)}),b(document).on("tinymce-editor-setup",function(e,i){b.each(wp.textWidgets.widgetControls,function(e,t){p.setupWidgetControl(e,t,i)})}),b(document).on("tinymce-editor-init",function(e,t){b(document).on("mouseenter",p.editor[t.id].saveSelector,function(e){b(p.editor[t.id].sourceTitleSelector).val(b(p.editor[t.id].titleSelector).val()),b(p.editor[t.id].sourceSelector).val(p.editor[t.id].content)}),b(document).on("click",p.editor[t.id].saveSelector,function(e){p.saveArbitraryTextOrHTML=t.id}),t.on("nodechange keyup",_.debounce(i,100)),b("#"+t.id).on("keyup",_.debounce(i,100))})},addElements:function(e,t){var i,o=[];o[0]='input[type="text"]',o[1]="textarea",void 0===e||"class"==e?(i=".widget-liquid-right .widget .widget-content",b.each(o,function(e,t){p.makeClone(i,t)})):"id"==e&&(i="#"+t+" .widget-content",b.each(o,function(e,t){p.makeClone(i,t)}))},makeClone:function(e,s){b(e+" "+s).each(function(e,t){var i,o,a,n,l=b(t),d=!1,r=l.attr("id");return void 0===r||-1!=r.indexOf("-number")||""==r||(_.each(WPGlobusWidgets.disabledMask,function(e){if(-1!=r.indexOf(e))return!(d=!0)}),!!d||(i=b("#"+r).clone(),b(l).addClass("wpglobus-dialog-field-source hidden"),o=l.attr("name"),b(i).attr("id","wpglobus-"+r),b(i).attr("name","wpglobus-"+o),b(i).attr("data-source-id",r),b(i).attr("class","wpglobus-dialog-field"),b(i).attr("style","width:90%;"),a=WPGlobusCore.TextFilter(b(l).val(),WPGlobusCoreData.language),b(i).val(a),b('<div style="width:20px;" data-type="control" data-source-type="" data-source-id="'+r+'" class="wpglobus-widgets wpglobus_dialog_start wpglobus_dialog_icon"></div>').insertAfter(l),b(i).insertAfter(l),void('input[type="text"]'==s&&""!=a&&(n=l.parents(".widget").attr("id"),b("#"+n+" .in-widget-title").text(": "+a)))))})},attachListeners:function(){b(document).ajaxComplete(function(e,t,i){if(-1!=i.data.indexOf("action=save-widget")&&-1==i.data.indexOf("delete_widget=1")){if(p.saveArbitraryTextOrHTML){var o=WPGlobusCore.TextFilter(p.editor[p.saveArbitraryTextOrHTML].content,b(p.editor[p.saveArbitraryTextOrHTML].languageSelector).data("language"),"RETURN_EMPTY");return tinymce.get(p.saveArbitraryTextOrHTML).isHidden()?(b("#"+p.saveArbitraryTextOrHTML).val(o),b("#"+p.saveArbitraryTextOrHTML+"-tmce").click()):tinymce.get(p.saveArbitraryTextOrHTML).setContent(o,{format:"raw"}),p.arbitraryWidgetTitle(p.saveArbitraryTextOrHTML),void(p.saveArbitraryTextOrHTML=!1)}var a=(a=i.data.split("widget-id="))[1].split("&");b(".widget-liquid-right .widget").each(function(e,t){var i=b(t).attr("id");-1!==i.indexOf(a[0])&&(p.addElements("id",i),p.wysiwygClean())})}}),b("body").on("change",".wpglobus-dialog-field",function(){var i,o,a=b(this),e="#"+a.data("source-id"),n="";i=b(e).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(i)?(b.each(WPGlobusCoreData.enabled_languages,function(e,t){""!=(o=t==WPGlobusCoreData.language?a.val():WPGlobusCore.TextFilter(i,t,"RETURN_EMPTY"))&&(n+=WPGlobusCore.addLocaleMarks(o,t))}),b(e).val(n)):b(e).val(a.val())}),b(document).on("click",".widget-title, .widget-title-action",function(e){e.preventDefault(),p.wysiwygClean(),p.imageWidget(this)})},imageWidget:function(e){var t,i,o,a,n,l=b(e).parents(".widget").attr("id");-1!=l.indexOf("media_image")&&(t=b("#"+l+" .in-widget-title"),-1!=(i=b("#"+l).find('input[type="text"]').attr("id")).indexOf(".")?(o="wpg-"+i.replace(".","_"),b("#"+l).find('input[type="text"]').attr("name",o),WPGlobusDialogApp.addElement(o)&&(a=b("#"+l).find('input[name="'+o+'"]'),n=WPGlobusCore.getTranslations(a.val())[WPGlobusCoreData.language],t.text(": "+n),setTimeout(function(){b("#wpglobus-"+o).val(n)},1e3))):WPGlobusDialogApp.addElement(i)&&(n=WPGlobusCore.getTranslations(b("#"+i).val())[WPGlobusCoreData.language],t.text(": "+n),setTimeout(function(){b("#wpglobus-"+i).val(n)},1e3)))},__getEditorContent:function(){if(0!=Object.keys(p.editor).length)for(var o in console.log("WPGlobusWidgets editors length is: ",Object.keys(p.editor).length),p.editor)console.log("editor : ",o," -> widgetName: ",p.editor[o].widgetName),console.log("source content: ",p.editor[o].content),b.each(WPGlobusCoreData.enabled_languages,function(e,t){console.log("Language: ",t);var i=WPGlobusCore.TextFilter(p.editor[o].content,t,"RETURN_EMPTY");""==i?console.log("empty"):console.log("Content: ",i)}),console.log("--------------------");else console.log("WPGlobusWidgets editors length is: 0")},__getEditorLanguage:function(){if(0!=Object.keys(p.editor).length)for(var e in console.log("WPGlobusWidgets editors length is: ",Object.keys(p.editor).length),p.editor)console.log("editor : ",e," -> widgetName: ",p.editor[e].widgetName),console.log("current language : ",b(p.editor[e].languageSelector).data("language")),console.log("--------------------");else console.log("WPGlobusWidgets editors length is: 0")}},WPGlobusWidgets=b.extend({},WPGlobusWidgets,p))}(jQuery);
languages/wpglobus.pot CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2020 WPGlobus 2.4.16
2
- # This file is distributed under the same license as the WPGlobus 2.4.16 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPGlobus 2.4.16\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
1
+ # Copyright (C) 2020 WPGlobus 2.4.17
2
+ # This file is distributed under the same license as the WPGlobus 2.4.17 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPGlobus 2.4.17\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
readme.txt CHANGED
@@ -217,6 +217,10 @@ WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.
217
 
218
  == Changelog ==
219
 
 
 
 
 
220
  = 2.4.16 =
221
 
222
  * (Integration) The [Advanced Post List](https://wordpress.org/plugins/advanced-post-list/) plugin is now supported.
217
 
218
  == Changelog ==
219
 
220
+ = 2.4.17 =
221
+
222
+ * (Core/WidgetsJS) Use `WPGlobusCoreData.language` instead of `WPGlobusCoreData.default_language`; Hide unneeded dialog icons.
223
+
224
  = 2.4.16 =
225
 
226
  * (Integration) The [Advanced Post List](https://wordpress.org/plugins/advanced-post-list/) plugin is now supported.
wpglobus.php CHANGED
@@ -15,7 +15,7 @@
15
  * Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
16
  * Text Domain: wpglobus
17
  * Domain Path: /languages/
18
- * Version: 2.4.16
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  exit;
43
  }
44
 
45
- define( 'WPGLOBUS_VERSION', '2.4.16' );
46
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47
  define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
48
 
15
  * Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
16
  * Text Domain: wpglobus
17
  * Domain Path: /languages/
18
+ * Version: 2.4.17
19
  * Author: WPGlobus
20
  * Author URI: https://wpglobus.com/
21
  * Network: false
42
  exit;
43
  }
44
 
45
+ define( 'WPGLOBUS_VERSION', '2.4.17' );
46
  define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47
  define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
48