WooCommerce Multilingual – run WooCommerce with WPML - Version 3.5.4

Version Description

  • Bug fixed: It was not possible to access the source content in the WCML product translation table.
  • Bug fixed: Urls for some of the custom posts were leading to 404 errors.
Download this release

Release Info

Developer sergey.r
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 3.5.4
Comparing to
See all releases

Code changes from version 3.5.3 to 3.5.4

assets/css/management.css CHANGED
@@ -291,7 +291,7 @@
291
  .wcml_tags{
292
  clear: both;
293
  }
294
- .outer button.button-secondary.wcml_add_new_tag,.outer button.button-secondary.wcml_edit_conten{
295
  margin-top: 0px;
296
  }
297
  .wcml_price{
291
  .wcml_tags{
292
  clear: both;
293
  }
294
+ .outer button.button-secondary.wcml_add_new_tag,.outer button.button-secondary.wcml_edit_content{
295
  margin-top: 0px;
296
  }
297
  .wcml_price{
assets/js/jquery.cleditor.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /*!
2
- CLEditor WYSIWYG HTML Editor v1.4.1
3
  http://premiumsoftware.net/CLEditor
4
  requires jQuery v1.4.2 or later
5
  Copyright 2010, Chris Landowski, Premium Software, LLC
6
  Dual licensed under the MIT or GPL Version 2 licenses.
7
  */
8
- (function(n){function ci(t){var i=this,v=t.target,w=n.data(v,a),b=o[w],k=b.popupName,nt=f[k],p,d;if(!i.disabled&&n(v).attr(r)!=r){if(p={editor:i,button:v,buttonName:w,popup:nt,popupName:k,command:b.command,useCSS:i.options.useCSS},b.buttonClick&&b.buttonClick(t,p)===!1)return!1;if(w=="source")l(i)?(delete i.range,i.$area.hide(),i.$frame.show(),v.title=b.title):(i.$frame.hide(),i.$area.show(),v.title="Show Rich Text"),setTimeout(function(){c(i)},100);else if(!l(i)){if(k){if(d=n(nt),k=="url"){if(w=="link"&&ni(i)==="")return g(i,"A selection is required when inserting a link.",v),!1;d.children(":button").unbind(u).bind(u,function(){var t=d.find(":text"),r=n.trim(t.val());r!==""&&s(i,p.command,r,null,p.button),t.val("http://"),e(),h(i)})}else k=="pastetext"&&d.children(":button").unbind(u).bind(u,function(){var n=d.find("textarea"),t=n.val().replace(/\n/g,"<br />");t!==""&&s(i,p.command,t,null,p.button),n.val(""),e(),h(i)});return v!==n.data(nt,y)?(ti(i,nt,v),!1):void 0}if(w=="print")i.$frame[0].contentWindow.print();else if(!s(i,p.command,p.value,p.useCSS,v))return!1}h(i)}}function pt(t){var i=n(t.target).closest("div");i.css(tt,i.data(a)?"#FFF":"#FFC")}function wt(t){n(t.target).closest("div").css(tt,"transparent")}function li(i){var v=this,p=i.data.popup,r=i.target,l;if(p!==f.msg&&!n(p).hasClass(w)){var k=n.data(p,y),u=n.data(k,a),b=o[u],d=b.command,c,g=v.options.useCSS;if(u=="font"?c=r.style.fontFamily.replace(/"/g,""):u=="size"?(r.tagName=="DIV"&&(r=r.children[0]),c=r.innerHTML):u=="style"?c="<"+r.tagName+">":u=="color"?c=dt(r.style.backgroundColor):u=="highlight"&&(c=dt(r.style.backgroundColor),t?d="backcolor":g=!0),l={editor:v,button:k,buttonName:u,popup:p,popupName:b.popupName,command:d,value:c,useCSS:g},!b.popupClick||b.popupClick(i,l)!==!1){if(l.command&&!s(v,l.command,l.value,l.useCSS,k))return!1;e(),h(v)}}}function k(n){for(var t=1,r=0,i=0;i<n.length;++i)t=(t+n.charCodeAt(i))%65521,r=(r+t)%65521;return r<<16|t}function ai(n){n.$area.val(""),nt(n)}function bt(r,u,e,o,s){var h,c;return f[r]?f[r]:(h=n(i).hide().addClass(fi).appendTo("body"),o?h.html(o):r=="color"?(c=u.colors.split(" "),c.length<10&&h.width("auto"),n.each(c,function(t,r){n(i).appendTo(h).css(tt,"#"+r)}),e=ei):r=="font"?n.each(u.fonts.split(","),function(t,r){n(i).appendTo(h).css("fontFamily",r).html(r)}):r=="size"?n.each(u.sizes.split(","),function(t,r){n(i).appendTo(h).html("<font size="+r+">"+r+"<\/font>")}):r=="style"?n.each(u.styles,function(t,r){n(i).appendTo(h).html(r[1]+r[0]+r[1].replace("<","<\/"))}):r=="url"?(h.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">'),e=w):r=="pastetext"&&(h.html("Paste your content here and click submit.<br /><textarea cols=40 rows=3><\/textarea><br /><input type=button value=Submit>"),e=w),e||o||(e=at),h.addClass(e),t&&h.attr(it,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(it,"on"),(h.hasClass(at)||s===!0)&&h.children().hover(pt,wt),f[r]=h[0],h[0])}function kt(n,i){i?(n.$area.attr(r,r),n.disabled=!0):(n.$area.removeAttr(r),delete n.disabled);try{t?n.doc.body.contentEditable=!i:n.doc.designMode=i?"off":"on"}catch(u){}c(n)}function s(n,i,r,u,f){d(n),t||((u===undefined||u===null)&&(u=n.options.useCSS),n.doc.execCommand("styleWithCSS",0,u.toString()));var e=!0,o;if(t&&i.toLowerCase()=="inserthtml")v(n).pasteHTML(r);else{try{e=n.doc.execCommand(i,0,r||null)}catch(s){o=s.message,e=!1}e||("cutcopypaste".indexOf(i)>-1?g(n,"For security reasons, your browser does not support the "+i+" command. Try using the keyboard shortcut or context menu instead.",f):g(n,o?o:"Error executing the "+i+" command.",f))}return c(n),ot(n,!0),e}function h(n){setTimeout(function(){l(n)?n.$area.focus():n.$frame[0].contentWindow.focus(),c(n)},0)}function v(n){return t?ft(n).createRange():ft(n).getRangeAt(0)}function ft(n){return t?n.doc.selection:n.$frame[0].contentWindow.getSelection()}function dt(n){var i=/rgba?\((\d+), (\d+), (\d+)/.exec(n),t;if(i){for(n=(i[1]<<16|i[2]<<8|i[3]).toString(16);n.length<6;)n="0"+n;return"#"+n}return(t=n.split(""),n.length==4)?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:n}function e(){n.each(f,function(t,i){n(i).hide().unbind(u).removeData(y)})}function gt(){var t="jquery.cleditor.css",i=n("link[href$='"+t+"']").attr("href");return i.substr(0,i.length-t.length)+"images/"}function vi(n){return"url("+gt()+n+")"}function et(i){var o=i.$main,r=i.options;i.$frame&&i.$frame.remove();var u=i.$frame=n('<iframe frameborder="0" src="javascript:true;">').hide().appendTo(o),l=u[0].contentWindow,f=i.doc=l.document,s=n(f);f.open(),f.write(r.docType+"<html>"+(r.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+r.docCSSFile+'" /><\/head>')+'<body style="'+r.bodyStyle+'"><\/body><\/html>'),f.close(),t&&s.click(function(){h(i)}),nt(i),t&&(s.bind("beforedeactivate beforeactivate selectionchange keypress",function(n){if(n.type=="beforedeactivate")i.inactive=!0;else if(n.type=="beforeactivate")!i.inactive&&i.range&&i.range.length>1&&i.range.shift(),delete i.inactive;else if(!i.inactive)for(i.range||(i.range=[]),i.range.unshift(v(i));i.range.length>2;)i.range.pop()}),u.focus(function(){d(i)})),s.click(e).bind("keyup mouseup",function(){c(i),ot(i,!0)}),rt?i.$area.show():u.show(),n(function(){var t=i.$toolbar,f=t.children("div:last"),e=o.width(),n=f.offset().top+f.outerHeight()-t.offset().top+1;t.height(n),n=(/%/.test(""+r.height)?o.height():parseInt(r.height))-n,u.width(e).height(n),i.$area.width(e).height(si?n-2:n),kt(i,i.disabled),c(i)})}function c(i){var u,e;rt||!hi||i.focused||(i.$frame[0].contentWindow.focus(),window.focus(),i.focused=!0),u=i.doc,t&&(u=v(i)),e=l(i),n.each(i.$toolbar.find("."+ct),function(o,s){var v=n(s),h=n.cleditor.buttons[n.data(s,a)],c=h.command,l=!0,y;if(i.disabled)l=!1;else if(h.getEnabled)y={editor:i,button:s,buttonName:h.name,popup:f[h.popupName],popupName:h.popupName,command:h.command,useCSS:i.options.useCSS},l=h.getEnabled(y),l===undefined&&(l=!0);else if((e||rt)&&h.name!="source"||t&&(c=="undo"||c=="redo"))l=!1;else if(c&&c!="print"&&(t&&c=="hilitecolor"&&(c="backcolor"),!t||c!="inserthtml"))try{l=u.queryCommandEnabled(c)}catch(p){l=!1}l?(v.removeClass(lt),v.removeAttr(r)):(v.addClass(lt),v.attr(r,r))})}function d(n){t&&n.range&&n.range[0].select()}function yi(n){setTimeout(function(){l(n)?n.$area.select():s(n,"selectall")},0)}function pi(i){var u,r,f;return(d(i),u=v(i),t)?u.htmlText:(r=n("<layer>")[0],r.appendChild(u.cloneContents()),f=r.innerHTML,r=null,f)}function ni(n){return(d(n),t)?v(n).text:ft(n).toString()}function g(n,t,i){var r=bt("msg",n.options,oi);r.innerHTML=t,ti(n,r,i)}function ti(t,i,r){var f,h,c,o=n(i),l,s;r?(l=n(r),f=l.offset(),h=--f.left,c=f.top+l.height()):(s=t.$toolbar,f=s.offset(),h=Math.floor((s.width()-o.width())/2)+f.left,c=f.top+s.height()-2),e(),o.css({left:h,top:c}).show(),r&&(n.data(i,y,r),o.bind(u,{popup:i},n.proxy(li,t))),setTimeout(function(){o.find(":text,textarea").eq(0).focus().select()},100)}function l(n){return n.$area.is(":visible")}function nt(t,i){var u=t.$area.val(),o=t.options,f=o.updateFrame,s=n(t.doc.body),e,r;if(f){if(e=k(u),i&&t.areaChecksum==e)return;t.areaChecksum=e}r=f?f(u):u,r=r.replace(/<(?=\/?script)/ig,"&lt;"),o.updateTextArea&&(t.frameChecksum=k(r)),r!=s.html()&&(s.html(r),n(t).triggerHandler(p))}function ot(t,i){var u=n(t.doc.body).html(),o=t.options,f=o.updateTextArea,s=t.$area,e,r;if(f){if(e=k(u),i&&t.frameChecksum==e)return;t.frameChecksum=e}r=f?f(u):u,o.updateFrame&&(t.areaChecksum=k(r)),r!=s.val()&&(s.val(r),n(t).triggerHandler(p))}var ut,yt;n.cleditor={defaultOptions:{width:"auto",height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:!0,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},imagesPath:function(){return gt()}},n.fn.cleditor=function(t){var i=n([]);return this.each(function(r,u){if(u.tagName=="TEXTAREA"){var f=n.data(u,st);f||(f=new cleditor(u,t)),i=i.add(f)}}),i};var tt="backgroundColor",y="button",a="buttonName",p="change",st="cleditor",u="click",r="disabled",i="<div>",it="unselectable",ii="cleditorMain",ri="cleditorToolbar",ht="cleditorGroup",ct="cleditorButton",lt="cleditorDisabled",ui="cleditorDivider",fi="cleditorPopup",at="cleditorList",ei="cleditorColor",w="cleditorPrompt",oi="cleditorMsg",b=navigator.userAgent.toLowerCase(),t=/msie/.test(b),si=/msie\s6/.test(b),hi=/webkit/.test(b),rt=/iphone|ipad|ipod/i.test(b),f={},vt,o=n.cleditor.buttons;n.each(o.init.split("|"),function(n,t){var i=t.split(","),r=i[0];o[r]={stripIndex:n,name:r,title:i[1]===""?r.charAt(0).toUpperCase()+r.substr(1):i[1],command:i[2]===""?r:i[2],popupName:i[3]===""?r:i[3]}}),delete o.init,cleditor=function(r,f){var s=this;s.options=f=n.extend({},n.cleditor.defaultOptions,f);var l=s.$area=n(r).hide().data(st,s).blur(function(){nt(s,!0)}),v=s.$main=n(i).addClass(ii).width(f.width).height(f.height),y=s.$toolbar=n(i).addClass(ri).appendTo(v),h=n(i).addClass(ht).appendTo(y),c=0;n.each(f.controls.split(" "),function(r,e){var w,l,p,v;if(e==="")return!0;e=="|"?(w=n(i).addClass(ui).appendTo(h),h.width(c+1),c=0,h=n(i).addClass(ht).appendTo(y)):(l=o[e],p=n(i).data(a,l.name).addClass(ct).attr("title",l.title).bind(u,n.proxy(ci,s)).appendTo(h).hover(pt,wt),c+=24,h.width(c+1),v={},l.css?v=l.css:l.image&&(v.backgroundImage=vi(l.image)),l.stripIndex&&(v.backgroundPosition=l.stripIndex*-24),p.css(v),t&&p.attr(it,"on"),l.popupName&&bt(l.popupName,f,l.popupClass,l.popupContent,l.popupHover))}),v.insertBefore(l).append(l),vt||(n(document).click(function(t){var i=n(t.target);i.add(i.parents()).is("."+w)||e()}),vt=!0),/auto|%/.test(""+f.width+f.height)&&n(window).bind("resize.cleditor",function(){et(s)}),et(s)},ut=cleditor.prototype,yt=[["clear",ai],["disable",kt],["execCommand",s],["focus",h],["hidePopups",e],["sourceMode",l,!0],["refresh",et],["select",yi],["selectedHTML",pi,!0],["selectedText",ni,!0],["showMessage",g],["updateFrame",nt],["updateTextArea",ot]],n.each(yt,function(n,t){ut[t[0]]=function(){for(var i=this,r=[i],u,n=0;n<arguments.length;n++)r.push(arguments[n]);return(u=t[1].apply(i,r),t[2])?u:i}}),ut.change=function(t){var i=n(this);return t?i.bind(p,t):i.trigger(p)}})(jQuery);
1
+ /*!
2
+ CLEditor WYSIWYG HTML Editor v1.4.5
3
  http://premiumsoftware.net/CLEditor
4
  requires jQuery v1.4.2 or later
5
  Copyright 2010, Chris Landowski, Premium Software, LLC
6
  Dual licensed under the MIT or GPL Version 2 licenses.
7
  */
8
+ !function(e){function t(t){var n=this,r=t.target,o=e.data(r,R),a=ot[o],i=a.popupName,s=rt[i],l={editor:n,button:r,buttonName:o,popup:s,popupName:i,command:a.command,useCSS:n.options.useCSS};if(a.buttonClick&&a.buttonClick(t,l)===!1)return!1;if("source"===o)T(n)?(delete n.range,n.$area.hide(),n.$frame.show(),r.title=a.title):(n.$frame.hide(),n.$area.show(),r.title="Show Rich Text");else if(!T(n)){if(i){var u=e(s);if("url"===i){if("link"===o&&""===w(n))return S(n,"A selection is required when inserting a link.",r),!1;u.children(":button").unbind(z).bind(z,function(){var t=u.find(":text"),r=e.trim(t.val());""!==r&&d(n,l.command,r,null,l.button),t.val("http://"),h(),c(n)})}else"pastetext"===i&&u.children(":button").unbind(z).bind(z,function(){var e=u.find("textarea"),t=e.val().replace(/\n/g,"<br />");""!==t&&d(n,l.command,t,null,l.button),e.val(""),h(),c(n)});if(r!==e.data(s,M))return k(n,s,r),!1;return}if("print"===o)n.$frame[0].contentWindow.print();else if(!d(n,l.command,l.value,l.useCSS,r))return!1}c(n)}function n(t){var n=e(t.target).closest("div");n.css(N,n.data(R)?"#FFF":"#FFC")}function r(t){e(t.target).closest("div").css(N,"transparent")}function o(t){var n=this,r=t.data.popup,o=t.target;if(r!==rt.msg&&!e(r).hasClass(Y)){var a,i=e.data(r,M),s=e.data(i,R),l=ot[s],u=l.command,p=n.options.useCSS;"font"===s?a=o.style.fontFamily.replace(/"/g,""):"size"===s?("DIV"===o.tagName.toUpperCase()&&(o=o.children[0]),a=o.innerHTML):"style"===s?a="<"+o.tagName+">":"color"===s?a=f(o.style.backgroundColor):"highlight"===s&&(a=f(o.style.backgroundColor),Z?u="backcolor":p=!0);var m={editor:n,button:i,buttonName:s,popup:r,popupName:l.popupName,command:u,value:a,useCSS:p};if(!l.popupClick||l.popupClick(t,m)!==!1){if(m.command&&!d(n,m.command,m.value,m.useCSS,i))return!1;h(),c(n)}}}function a(e){for(var t=1,n=0,r=0;r<e.length;++r)t=(t+e.charCodeAt(r))%65521,n=(n+t)%65521;return n<<16|t}function i(e){e.$area.val(""),x(e)}function s(t,o,a,i,s){if(rt[t])return rt[t];var l=e(E).hide().addClass(V).appendTo("body");if(i)l.html(i);else if("color"===t){var d=o.colors.split(" ");d.length<10&&l.width("auto"),e.each(d,function(t,n){e(E).appendTo(l).css(N,"#"+n)}),a=X}else"font"===t?e.each(o.fonts.split(","),function(t,n){e(E).appendTo(l).css("fontFamily",n).html(n)}):"size"===t?e.each(o.sizes.split(","),function(t,n){e(E).appendTo(l).html('<font size="'+n+'">'+n+"</font>")}):"style"===t?e.each(o.styles,function(t,n){e(E).appendTo(l).html(n[1]+n[0]+n[1].replace("<","</"))}):"url"===t?(l.html('<label>Enter URL:<br /><input type="text" value="http://" style="width:200px" /></label><br /><input type="button" value="Submit" />'),a=Y):"pastetext"===t&&(l.html('<label>Paste your content here:<br /><textarea rows="3" style="width:200px"></textarea></label><br /><input type="button" value="Submit" />'),a=Y);return a||i||(a=Q),l.addClass(a),Z&&l.attr(D,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(D,"on"),(l.hasClass(Q)||s===!0)&&l.children().hover(n,r),rt[t]=l[0],l[0]}function l(e,t){t?(e.$area.attr(I,I),e.disabled=!0):(e.$area.removeAttr(I),delete e.disabled);try{Z?e.doc.body.contentEditable=!t:e.doc.designMode=t?"off":"on"}catch(n){}v(e)}function d(e,t,n,r,o){C(e),Z||((void 0===r||null===r)&&(r=e.options.useCSS),e.doc.execCommand("styleWithCSS",0,r.toString()));var a="inserthtml"===t.toLowerCase();if(Z&&a)u(e).pasteHTML(n);else if(et&&a){var i=p(e),s=i.getRangeAt(0);s.deleteContents(),s.insertNode(s.createContextualFragment(n)),i.removeAllRanges(),i.addRange(s)}else{var l,d=!0;try{d=e.doc.execCommand(t,0,n||null)}catch(c){l=c.message,d=!1}d||("cutcopypaste".indexOf(t)>-1?S(e,"For security reasons, your browser does not support the "+t+" command. Try using the keyboard shortcut or context menu instead.",o):S(e,l?l:"Error executing the "+t+" command.",o))}return v(e),$(e,!0),d}function c(e){setTimeout(function(){T(e)?e.$area.focus():e.$frame[0].contentWindow.focus(),v(e)},0)}function u(e){return Z?p(e).createRange():p(e).getRangeAt(0)}function p(e){return Z?e.doc.selection:e.$frame[0].contentWindow.getSelection()}function f(e){var t=/rgba?\((\d+), (\d+), (\d+)/.exec(e);if(t){for(e=(t[1]<<16|t[2]<<8|t[3]).toString(16);e.length<6;)e="0"+e;return"#"+e}var n=e.split("");return 4===e.length?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:e}function h(){e.each(rt,function(t,n){e(n).hide().unbind(z).removeData(M)})}function m(){var t=e("link[href*=cleditor]").attr("href");return t.replace(/^(.*\/)[^\/]+$/,"$1")+"images/"}function g(e){return"url("+m()+e+")"}function b(t){var n=t.$main,r=t.options;t.$frame&&t.$frame.remove();var o=t.$frame=e('<iframe frameborder="0" src="javascript:true;" />').hide().appendTo(n),a=o[0].contentWindow,i=t.doc=a.document,s=e(i);i.open(),i.write(r.docType+"<html>"+(""===r.docCSSFile?"":'<head><link rel="stylesheet" type="text/css" href="'+r.docCSSFile+'" /></head>')+'<body style="'+r.bodyStyle+'"></body></html>'),i.close(),(Z||et)&&s.click(function(){c(t)}),x(t),Z||et?(s.bind("beforedeactivate beforeactivate selectionchange keypress keyup",function(e){if("beforedeactivate"===e.type)t.inactive=!0;else if("beforeactivate"===e.type)!t.inactive&&t.range&&t.range.length>1&&t.range.shift(),delete t.inactive;else if(!t.inactive)for(t.range||(t.range=[]),t.range.unshift(u(t));t.range.length>2;)t.range.pop()}),o.focus(function(){C(t),e(t).triggerHandler(j)}),o.blur(function(){e(t).triggerHandler(A)})):e(o[0].contentWindow).focus(function(){e(t).triggerHandler(j)}).blur(function(){e(t).triggerHandler(A)}),s.click(h).keydown(function(e){Z&&"Control"==p(t).type&&8==e.keyCode&&(p(t).clear(),e.preventDefault())}).bind("keyup mouseup",function(){v(t),$(t,!0)}),nt?t.$area.show():o.show(),e(function(){var e=t.$toolbar,a=e.children("div:last"),i=n.width(),s=a.offset().top+a.outerHeight()-e.offset().top+1;e.height(s),s=(/%/.test(""+r.height)?n.height():parseInt(r.height,10))-s,o.width(i).height(s),t.$area.width(i).height(_?s-2:s),l(t,t.disabled),v(t)})}function v(t){nt||!tt||t.focused||(t.$frame[0].contentWindow.focus(),window.focus(),t.focused=!0);var n=t.doc;Z&&(n=u(t));var r=T(t);e.each(t.$toolbar.find("."+O),function(o,a){var i=e(a),s=e.cleditor.buttons[e.data(a,R)],l=s.command,d=!0;if(t.disabled)d=!1;else if(s.getEnabled){var c={editor:t,button:a,buttonName:s.name,popup:rt[s.popupName],popupName:s.popupName,command:s.command,useCSS:t.options.useCSS};d=s.getEnabled(c),void 0===d&&(d=!0)}else if((r||nt)&&"source"!==s.name||Z&&("undo"===l||"redo"===l))d=!1;else if(l&&"print"!==l&&(Z&&"hilitecolor"===l&&(l="backcolor"),!Z&&!et||"inserthtml"!==l))try{d=n.queryCommandEnabled(l)}catch(u){d=!1}d?(i.removeClass(q),i.removeAttr(I)):(i.addClass(q),i.attr(I,I))})}function C(e){e.range&&(Z?e.range[0].select():et&&p(e).addRange(e.range[0]))}function y(e){setTimeout(function(){T(e)?e.$area.select():d(e,"selectall")},0)}function F(t){C(t);var n=u(t);if(Z)return n.htmlText;var r=e("<layer>")[0];r.appendChild(n.cloneContents());var o=r.innerHTML;return r=null,o}function w(e){return C(e),Z?u(e).text:p(e).toString()}function S(e,t,n){var r=s("msg",e.options,J);r.innerHTML=t,k(e,r,n)}function k(t,n,r){var a,i,s,l=e(n);if(r){var d=e(r);a=d.offset(),i=--a.left,s=a.top+d.height()}else{var c=t.$toolbar;a=c.offset(),i=Math.floor((c.width()-l.width())/2)+a.left,s=a.top+c.height()-2}h(),l.css({left:i,top:s}).show(),r&&(e.data(n,M,r),l.bind(z,{popup:n},e.proxy(o,t))),setTimeout(function(){l.find(":text,textarea").eq(0).focus().select()},100)}function T(e){return e.$area.is(":visible")}function x(t,n){var r=t.$area.val(),o=t.options,i=o.updateFrame,s=e(t.doc.body);if(i){var l=a(r);if(n&&t.areaChecksum===l)return;t.areaChecksum=l}var d=i?i(r):r;d=d.replace(/<(?=\/?script)/gi,"&lt;"),o.updateTextArea&&(t.frameChecksum=a(d)),d!==s.html()&&(s.html(d),e(t).triggerHandler(L))}function $(t,n){var r=e(t.doc.body).html(),o=t.options,i=o.updateTextArea,s=t.$area;if(i){var l=a(r);if(n&&t.frameChecksum===l)return;t.frameChecksum=l}var d=i?i(r):r;o.updateFrame&&(t.areaChecksum=a(d)),d!==s.val()&&(s.val(d),e(t).triggerHandler(L))}e.cleditor={defaultOptions:{width:"auto",height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:!0,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},imagesPath:function(){return m()}},e.fn.cleditor=function(t){var n=e([]);return this.each(function(r,o){if("TEXTAREA"===o.tagName.toUpperCase()){var a=e.data(o,P);a||(a=new cleditor(o,t)),n=n.add(a)}}),n};var H,N="backgroundColor",A="blurred",M="button",R="buttonName",L="change",P="cleditor",z="click",I="disabled",E="<div>",j="focused",D="unselectable",W="cleditorMain",B="cleditorToolbar",U="cleditorGroup",O="cleditorButton",q="cleditorDisabled",G="cleditorDivider",V="cleditorPopup",Q="cleditorList",X="cleditorColor",Y="cleditorPrompt",J="cleditorMsg",K=navigator.userAgent.toLowerCase(),Z=/msie/.test(K),_=/msie\s6/.test(K),et=/(trident)(?:.*rv:([\w.]+))?/.test(K),tt=/webkit/.test(K),nt=/iPhone|iPad|iPod/i.test(K),rt={},ot=e.cleditor.buttons;e.each(ot.init.split("|"),function(e,t){var n=t.split(","),r=n[0];ot[r]={stripIndex:e,name:r,title:""===n[1]?r.charAt(0).toUpperCase()+r.substr(1):n[1],command:""===n[2]?r:n[2],popupName:""===n[3]?r:n[3]}}),delete ot.init,cleditor=function(o,a){var i=this;i.options=a=e.extend({},e.cleditor.defaultOptions,a);var l=i.$area=e(o).css({border:"none",margin:0,padding:0}).hide().data(P,i).blur(function(){x(i,!0)}),d=i.$main=e(E).addClass(W).width(a.width).height(a.height),c=i.$toolbar=e(E).addClass(B).appendTo(d),u=e(E).addClass(U).appendTo(c),p=0;e.each(a.controls.split(" "),function(o,l){if(""===l)return!0;if("|"===l){{e(E).addClass(G).appendTo(u)}u.width(p+1),p=0,u=e(E).addClass(U).appendTo(c)}else{var d=ot[l],f=e(E).data(R,d.name).addClass(O).attr("title",d.title).bind(z,e.proxy(t,i)).appendTo(u).hover(n,r);p+=24,u.width(p+1);var h={};d.css?h=d.css:d.image&&(h.backgroundImage=g(d.image)),d.stripIndex&&(h.backgroundPosition=-24*d.stripIndex),f.css(h),Z&&f.attr(D,"on"),d.popupName&&s(d.popupName,a,d.popupClass,d.popupContent,d.popupHover)}}),d.insertBefore(l).append(l),H||(e(document).click(function(t){var n=e(t.target);n.add(n.parents()).is("."+Y)||h()}),H=!0),/auto|%/.test(""+a.width+a.height)&&e(window).bind("resize.cleditor",function(){b(i)}),b(i)};var at=cleditor.prototype,it=[["clear",i],["disable",l],["execCommand",d],["focus",c],["hidePopups",h],["sourceMode",T,!0],["refresh",b],["select",y],["selectedHTML",F,!0],["selectedText",w,!0],["showMessage",S],["updateFrame",x],["updateTextArea",$]];e.each(it,function(e,t){at[t[0]]=function(){for(var e=this,n=[e],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=t[1].apply(e,n);return t[2]?o:e}}),at.blurred=function(t){var n=e(this);return t?n.bind(A,t):n.trigger(A)},at.change=function(t){var n=e(this);return t?n.bind(L,t):n.trigger(L)},at.focused=function(t){var n=e(this);return t?n.bind(j,t):n.trigger(j)}}(jQuery);
assets/js/scripts.js CHANGED
@@ -462,26 +462,28 @@ jQuery(document).ready(function($){
462
 
463
  })
464
 
465
- $(document).on('click','.wcml_edit_conten',function(){
466
  $(".wcml_fade").show();
467
  $(this).parent().find('.wcml_editor').show();
468
- $(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
469
- $(this).parent().find('.wcml_editor table.mceLayout iframe').css('min-height','150px');
470
  var txt_height = '90%';
471
- $(this).parent().find('textarea.wcml_content_tr').data('def',$(this).parent().find('textarea.wcml_content_tr').val());
472
  $(this).parent().find('.wcml_original_content').cleditor({
473
  height: txt_height,
474
  controls: // controls to add to the toolbar
475
- " source "
476
  });
477
  $(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
478
 
 
 
 
 
 
 
479
 
480
- var id = $(this).parent().find('.switch-tmce').attr('id').replace(/-tmce/, '');
481
- $(this).parent().find('.wp-editor-wrap').removeClass('html-active').addClass('tmce-active');
482
-
483
- if( window.parent.tinyMCE.get(id) == null ){
484
- tinymce.execCommand( 'mceAddEditor', false, id);
485
  }
486
 
487
  });
462
 
463
  })
464
 
465
+ $(document).on('click','.wcml_edit_content',function(){
466
  $(".wcml_fade").show();
467
  $(this).parent().find('.wcml_editor').show();
468
+
 
469
  var txt_height = '90%';
 
470
  $(this).parent().find('.wcml_original_content').cleditor({
471
  height: txt_height,
472
  controls: // controls to add to the toolbar
473
+ " | source "
474
  });
475
  $(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
476
 
477
+ if( !$(this).hasClass('origin_content') ){
478
+ $(this).parent().find('textarea.wcml_content_tr').data('def',$(this).parent().find('textarea.wcml_content_tr').val());
479
+ $(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
480
+ $(this).parent().find('.wcml_editor table.mceLayout iframe').css('min-height','150px');
481
+ var id = $(this).parent().find('.switch-tmce').attr('id').replace(/-tmce/, '');
482
+ $(this).parent().find('.wp-editor-wrap').removeClass('html-active').addClass('tmce-active');
483
 
484
+ if( window.parent.tinyMCE.get(id) == null ){
485
+ tinymce.execCommand( 'mceAddEditor', false, id);
486
+ }
 
 
487
  }
488
 
489
  });
compatibility/templates/wc_tab_manager_custom_box_html.php CHANGED
@@ -19,9 +19,9 @@
19
  <textarea rows="1" <?php if(!$template_data['original']): ?>name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[core_heading]['.$key.']'; ?>"<?php endif;?> <?php if($template_data['original']): ?> disabled="disabled"<?php endif;?>><?php echo $template_data['tr_tabs'][$key]['heading']; ?></textarea>
20
  <?php else: ?>
21
  <?php if($template_data['original']): ?>
22
- <button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
23
  <?php else: ?>
24
- <button type="button" class="button-secondary wcml_edit_conten<?php if($template_data['is_duplicate_product']): ?> js-dup-disabled<?php endif;?>"<?php if($template_data['is_duplicate_product']): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
25
  <?php endif;?>
26
  <div class="wcml_editor">
27
  <a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'wpml-wcml') ?>"><span class="media-modal-icon"></span></a>
19
  <textarea rows="1" <?php if(!$template_data['original']): ?>name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[core_heading]['.$key.']'; ?>"<?php endif;?> <?php if($template_data['original']): ?> disabled="disabled"<?php endif;?>><?php echo $template_data['tr_tabs'][$key]['heading']; ?></textarea>
20
  <?php else: ?>
21
  <?php if($template_data['original']): ?>
22
+ <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'wpml-wcml') ?></button>
23
  <?php else: ?>
24
+ <button type="button" class="button-secondary wcml_edit_content<?php if($template_data['is_duplicate_product']): ?> js-dup-disabled<?php endif;?>"<?php if($template_data['is_duplicate_product']): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
25
  <?php endif;?>
26
  <div class="wcml_editor">
27
  <a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'wpml-wcml') ?>"><span class="media-modal-icon"></span></a>
inc/endpoints.class.php CHANGED
@@ -7,10 +7,9 @@ class WCML_Endpoints{
7
  function __construct(){
8
 
9
  //endpoints hooks
10
- add_action( 'plugins_loaded', array( $this, 'register_endpoints_translations' ), 2 );
11
  add_action( 'icl_ajx_custom_call', array( $this, 'rewrite_rule_endpoints' ), 11, 2 );
12
- add_action( 'woocommerce_settings_saved', array( $this, 'update_endpoints_rules' ) );
13
- add_action( 'init', array( $this, 'update_endpoints_rules' ) );
14
 
15
  add_filter( 'page_link', array( $this, 'endpoint_permalink_filter' ), 10, 2 ); //after WPML
16
 
@@ -20,22 +19,23 @@ class WCML_Endpoints{
20
  if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) return false;
21
 
22
  $wc_vars = WC()->query->query_vars;
23
-
24
- $query_vars = array(
25
- // Checkout actions
26
- 'order-pay' => $this->get_endpoint_translation( $wc_vars['order-pay'] ),
27
- 'order-received' => $this->get_endpoint_translation( $wc_vars['order-received'] ),
28
-
29
- // My account actions
30
- 'view-order' => $this->get_endpoint_translation( $wc_vars['view-order'] ),
31
- 'edit-account' => $this->get_endpoint_translation( $wc_vars['edit-account'] ),
32
- 'edit-address' => $this->get_endpoint_translation( $wc_vars['edit-address'] ),
33
- 'lost-password' => $this->get_endpoint_translation( $wc_vars['lost-password'] ),
34
- 'customer-logout' => $this->get_endpoint_translation( $wc_vars['customer-logout'] ),
35
- 'add-payment-method' => $this->get_endpoint_translation( $wc_vars['add-payment-method'] ),
36
- );
37
-
38
- WC()->query->query_vars = $query_vars;
 
39
 
40
  }
41
 
@@ -60,6 +60,7 @@ class WCML_Endpoints{
60
  function rewrite_rule_endpoints( $call, $data ){
61
  if( $call == 'icl_st_save_translation' && in_array( $data['icl_st_string_id'], $this->endpoints_strings ) ){
62
  $this->add_endpoints();
 
63
  }
64
  }
65
 
@@ -79,7 +80,7 @@ class WCML_Endpoints{
79
  add_rewrite_endpoint( $string->value, EP_ROOT | EP_PAGES );
80
  }
81
  }
82
- flush_rewrite_rules();
83
  }
84
 
85
  function endpoint_permalink_filter( $p, $pid ){
7
  function __construct(){
8
 
9
  //endpoints hooks
10
+ $this->register_endpoints_translations();
11
  add_action( 'icl_ajx_custom_call', array( $this, 'rewrite_rule_endpoints' ), 11, 2 );
12
+ add_action( 'woocommerce_update_options', array( $this, 'update_endpoints_rules' ) );
 
13
 
14
  add_filter( 'page_link', array( $this, 'endpoint_permalink_filter' ), 10, 2 ); //after WPML
15
 
19
  if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) return false;
20
 
21
  $wc_vars = WC()->query->query_vars;
22
+ if ( !empty( $wc_vars ) ) {
23
+ $query_vars = array(
24
+ // Checkout actions
25
+ 'order-pay' => $this->get_endpoint_translation($wc_vars['order-pay']),
26
+ 'order-received' => $this->get_endpoint_translation($wc_vars['order-received']),
27
+
28
+ // My account actions
29
+ 'view-order' => $this->get_endpoint_translation($wc_vars['view-order']),
30
+ 'edit-account' => $this->get_endpoint_translation($wc_vars['edit-account']),
31
+ 'edit-address' => $this->get_endpoint_translation($wc_vars['edit-address']),
32
+ 'lost-password' => $this->get_endpoint_translation($wc_vars['lost-password']),
33
+ 'customer-logout' => $this->get_endpoint_translation($wc_vars['customer-logout']),
34
+ 'add-payment-method' => $this->get_endpoint_translation($wc_vars['add-payment-method']),
35
+ );
36
+
37
+ WC()->query->query_vars = $query_vars;
38
+ }
39
 
40
  }
41
 
60
  function rewrite_rule_endpoints( $call, $data ){
61
  if( $call == 'icl_st_save_translation' && in_array( $data['icl_st_string_id'], $this->endpoints_strings ) ){
62
  $this->add_endpoints();
63
+ flush_rewrite_rules();
64
  }
65
  }
66
 
80
  add_rewrite_endpoint( $string->value, EP_ROOT | EP_PAGES );
81
  }
82
  }
83
+
84
  }
85
 
86
  function endpoint_permalink_filter( $p, $pid ){
inc/upgrade.class.php CHANGED
@@ -1,135 +1,136 @@
1
  <?php
2
 
3
  class WCML_Upgrade{
4
-
5
  private $versions = array(
6
-
7
- '2.9.9.1',
8
- '3.1',
9
- '3.2',
10
- '3.3'
11
-
 
 
12
  );
13
-
14
  function __construct(){
15
-
16
- add_action('plugins_loaded', array($this, 'run'));
17
- add_action('plugins_loaded', array($this, 'setup_upgrade_notices'));
18
  add_action('admin_notices', array($this, 'show_upgrade_notices'));
19
-
20
  add_action('wp_ajax_wcml_hide_notice', array($this, 'hide_upgrade_notice'));
21
-
22
- }
23
-
24
  function setup_upgrade_notices(){
25
-
26
  $wcml_settings = get_option('_wcml_settings');
27
  $version_in_db = get_option('_wcml_version');
28
-
29
  if(!empty($version_in_db) && version_compare($version_in_db, '2.9.9.1', '<')){
30
  $n = 'varimages';
31
- $wcml_settings['notifications'][$n] =
32
  array(
33
- 'show' => 1,
34
  'text' => __('Looks like you are upgrading from a previous version of WooCommerce Multilingual. Would you like to automatically create translated variations and images?', 'wcml').
35
- '<br /><strong>' .
36
- ' <a href="' . admin_url('admin.php?page=' . basename(WCML_PLUGIN_PATH) . '/menu/sub/troubleshooting.php') . '">' . __('Yes, go to the troubleshooting page', 'wcml') . '</a> |' .
37
- ' <a href="#" onclick="jQuery.ajax({type:\'POST\',url: ajaxurl,data:\'action=wcml_hide_notice&notice='.$n.'\',success:function(){jQuery(\'#' . $n . '\').fadeOut()}});return false;">' . __('No - dismiss', 'wcml') . '</a>' .
38
- '</strong>'
39
  );
40
  update_option('_wcml_settings', $wcml_settings);
41
  }
42
-
43
  }
44
-
45
  function show_upgrade_notices(){
46
  $wcml_settings = get_option('_wcml_settings');
47
- if(!empty($wcml_settings['notifications'])){
48
  foreach($wcml_settings['notifications'] as $k => $notification){
49
-
50
  // exceptions
51
  if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH) . '/menu/sub/troubleshooting.php' && $k == 'varimages') continue;
52
-
53
  if($notification['show']){
54
  ?>
55
  <div id="<?php echo $k ?>" class="updated">
56
  <p><?php echo $notification['text'] ?></p>
57
  </div>
58
- <?php
59
  }
60
  }
61
  }
62
  }
63
-
64
  function hide_upgrade_notice($k){
65
-
66
  if(empty($k)){
67
  $k = $_POST['notice'];
68
  }
69
-
70
  $wcml_settings = get_option('_wcml_settings');
71
  if(isset($wcml_settings['notifications'][$k])){
72
  $wcml_settings['notifications'][$k]['show'] = 0;
73
  update_option('_wcml_settings', $wcml_settings);
74
  }
75
  }
76
-
77
  function run(){
78
-
79
  $version_in_db = get_option('_wcml_version');
80
-
81
  // exception - starting in 2.3.2
82
  if(empty($version_in_db) && get_option('icl_is_wcml_installed')){
83
  $version_in_db = '2.3.2';
84
- //delete_option('icl_is_wcml_installed');
85
  }
86
-
87
  $migration_ran = false;
88
-
89
  if($version_in_db && version_compare($version_in_db, WCML_VERSION, '<')){
90
-
91
  foreach($this->versions as $version){
92
-
93
  if(version_compare($version, WCML_VERSION, '<=') && version_compare($version, $version_in_db, '>')){
94
 
95
  $upgrade_method = 'upgrade_' . str_replace('.', '_', $version);
96
-
97
  if(method_exists($this, $upgrade_method)){
98
  $this->$upgrade_method();
99
  $migration_ran = true;
100
  }
101
-
102
  }
103
-
104
  }
105
-
106
  }
107
-
108
  if($migration_ran || empty($version_in_db)){
109
- update_option('_wcml_version', WCML_VERSION);
110
  }
111
  }
112
-
113
  function upgrade_2_9_9_1(){
114
  global $wpdb;
115
-
116
  //migrate exists currencies
117
  $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
118
  foreach($currencies as $currency){
119
  if(isset($currency->language_code)){
120
- $wpdb->insert($wpdb->prefix .'icl_languages_currencies', array(
121
- 'language_code' => $currency->language_code,
122
- 'currency_id' => $currency->id
123
- )
124
- );
125
- }
126
  }
127
 
128
- $cols = $wpdb->get_col("SHOW COLUMNS FROM {$wpdb->prefix}icl_currencies");
129
  if(in_array('language_code', $cols)){
130
  $wpdb->query("ALTER TABLE {$wpdb->prefix}icl_currencies DROP COLUMN language_code");
131
  }
132
-
133
  // migrate settings
134
  $new_settings = array(
135
  'is_term_order_synced' => get_option('icl_is_wcml_term_order_synched'),
@@ -139,52 +140,52 @@ class WCML_Upgrade{
139
  'enable_multi_currency' => get_option('icl_enable_multi_currency'),
140
  'currency_converting_option' => get_option('currency_converting_option')
141
  );
142
-
143
  if(!get_option('_wcml_settings')){
144
  add_option('_wcml_settings', $new_settings, false, true);
145
  }
146
-
147
  delete_option('icl_is_wcml_term_order_synced');
148
  delete_option('wcml_file_path_sync');
149
  delete_option('icl_is_wpcml_installed');
150
  delete_option('wpml_dismiss_doc_main');
151
  delete_option('icl_enable_multi_currency');
152
  delete_option('currency_converting_option');
153
-
154
-
155
  }
156
-
157
  function upgrade_3_1(){
158
  global $wpdb,$sitepress;
159
  $wcml_settings = get_option('_wcml_settings');
160
-
161
  if(isset($wcml_settings['enable_multi_currency']) && $wcml_settings['enable_multi_currency'] == 'yes'){
162
  $wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_INDEPENDENT;
163
  }else{
164
  $wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_DISABLED;
165
  }
166
-
167
  $wcml_settings['products_sync_date'] = 1;
168
-
169
-
170
  update_option('_wcml_settings', $wcml_settings);
171
-
172
  // multi-currency migration
173
  if($wcml_settings['enable_multi_currency'] == 'yes' && $wcml_settings['currency_converting_option'] == 2){
174
-
175
  // get currencies exchange rates
176
  $results = $wpdb->get_results("SELECT code, value FROM {$wpdb->prefix}icl_currencies");
177
  foreach($results as $row){
178
- $exchange_rates[$row->code] = $row->value;
179
  }
180
-
181
  // get languages currencies map
182
  $results = $wpdb->get_results("SELECT l.language_code, c.code FROM {$wpdb->prefix}icl_languages_currencies l JOIN {$wpdb->prefix}icl_currencies c ON l.currency_id = c.id");
183
  foreach($results as $row){
184
- $language_currencies[$row->language_code] = $row->code;
185
  }
186
-
187
-
188
  $results = $wpdb->get_results($wpdb->prepare("
189
  SELECT p.ID, t.trid, t.element_type
190
  FROM {$wpdb->posts} p JOIN {$wpdb->prefix}icl_translations t ON t.element_id = p.ID AND t.element_type IN ('post_product', 'post_product_variation')
@@ -192,7 +193,7 @@ class WCML_Upgrade{
192
  p.post_type in ('product', 'product_variation') AND t.language_code = %s
193
 
194
  ", $sitepress->get_default_language()));
195
-
196
  // set custom conversion rates
197
  foreach($results as $row){
198
  $translations = $sitepress->get_element_translations($row->trid, $row->element_type);
@@ -200,54 +201,54 @@ class WCML_Upgrade{
200
  $original_prices['_price'] = !empty($meta['_price']) ? $meta['_price'][0] : 0;
201
  $original_prices['_regular_price'] = !empty($meta['_regular_price']) ? $meta['_regular_price'][0] : 0;
202
  $original_prices['_sale_price'] = !empty($meta['_sale_price']) ? $meta['_sale_price'][0] : 0;
203
-
204
-
205
  $ccr = array();
206
-
207
  foreach($translations as $translation){
208
  if($translation->element_id != $row->ID){
209
-
210
  $meta = get_post_meta($translation->element_id);
211
  $translated_prices['_price'] = $meta['_price'][0];
212
  $translated_prices['_regular_price'] = $meta['_regular_price'][0];
213
  $translated_prices['_sale_price'] = $meta['_sale_price'][0];
214
 
215
  if(!empty($translated_prices['_price']) && !empty($original_prices['_price']) && $translated_prices['_price'] != $original_prices['_price']){
216
-
217
  $ccr['_price'][$language_currencies[$translation->language_code]] = $translated_prices['_price'] / $original_prices['_price'];
218
-
219
- }
220
  if(!empty($translated_prices['_regular_price']) && !empty($original_prices['_regular_price']) && $translated_prices['_regular_price'] != $original_prices['_regular_price']){
221
-
222
  $ccr['_regular_price'][$language_currencies[$translation->language_code]] = $translated_prices['_regular_price'] / $original_prices['_regular_price'];
223
-
224
- }
225
  if(!empty($translated_prices['_sale_price']) && !empty($original_prices['_sale_price']) && $translated_prices['_sale_price'] != $original_prices['_sale_price']){
226
-
227
  $ccr['_sale_price'][$language_currencies[$translation->language_code]] = $translated_prices['_sale_price'] / $original_prices['_sale_price'] ;
228
-
229
- }
230
-
231
-
232
  }
233
  }
234
-
235
  if($ccr){
236
- update_post_meta($row->ID, '_custom_conversion_rate', $ccr);
237
  }
238
-
239
-
240
  }
241
-
242
-
243
- }
244
-
245
  }
246
-
247
  function upgrade_3_2(){
248
-
249
  woocommerce_wpml::set_up_capabilities();
250
-
251
  //delete not existing currencies in WC
252
  global $wpdb;
253
  $currencies = $wpdb->get_results("SELECT id,code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
@@ -257,30 +258,30 @@ class WCML_Upgrade{
257
  $wpdb->delete( $wpdb->prefix . 'icl_currencies', array( 'ID' => $currency->id ) );
258
  }
259
  }
260
-
261
  }
262
-
263
  function upgrade_3_3(){
264
  global $wpdb, $woocommerce_wpml;
265
-
266
  woocommerce_wpml::set_up_capabilities();
267
 
268
  $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
269
  if($currencies)
270
- foreach($this->currencies as $currency){
271
-
272
- $woocommerce_wpml->settings['currency_options'][$currency->code]['rate'] = $currency->value;
273
- $woocommerce_wpml->settings['currency_options'][$currency->code]['updated'] = $currency->changed;
274
- $woocommerce_wpml->settings['currency_options'][$currency->code]['position'] = 'left';
275
- $woocommerce_wpml->settings['currency_options'][$currency->code]['languages'] = $woocommerce_wpml->settings['currencies_languages'];
276
- unset($woocommerce_wpml->settings['currencies_languages']);
277
-
278
- $woocommerce_wpml->update_settings();
279
-
280
- }
281
-
282
  $wpdb->query("DROP TABLE `{$wpdb->prefix}icl_currencies`");
283
-
284
  }
285
 
286
  function upgrade_3_5()
@@ -292,5 +293,10 @@ class WCML_Upgrade{
292
 
293
  update_option('_wcml_settings', $wcml_settings);
294
  }
295
-
 
 
 
 
 
296
  }
1
  <?php
2
 
3
  class WCML_Upgrade{
4
+
5
  private $versions = array(
6
+
7
+ '2.9.9.1',
8
+ '3.1',
9
+ '3.2',
10
+ '3.3',
11
+ '3.5',
12
+ '3.5.4'
13
+
14
  );
15
+
16
  function __construct(){
17
+
18
+ add_action('init', array($this, 'run'));
19
+ add_action('init', array($this, 'setup_upgrade_notices'));
20
  add_action('admin_notices', array($this, 'show_upgrade_notices'));
21
+
22
  add_action('wp_ajax_wcml_hide_notice', array($this, 'hide_upgrade_notice'));
23
+
24
+ }
25
+
26
  function setup_upgrade_notices(){
27
+
28
  $wcml_settings = get_option('_wcml_settings');
29
  $version_in_db = get_option('_wcml_version');
30
+
31
  if(!empty($version_in_db) && version_compare($version_in_db, '2.9.9.1', '<')){
32
  $n = 'varimages';
33
+ $wcml_settings['notifications'][$n] =
34
  array(
35
+ 'show' => 1,
36
  'text' => __('Looks like you are upgrading from a previous version of WooCommerce Multilingual. Would you like to automatically create translated variations and images?', 'wcml').
37
+ '<br /><strong>' .
38
+ ' <a href="' . admin_url('admin.php?page=' . basename(WCML_PLUGIN_PATH) . '/menu/sub/troubleshooting.php') . '">' . __('Yes, go to the troubleshooting page', 'wcml') . '</a> |' .
39
+ ' <a href="#" onclick="jQuery.ajax({type:\'POST\',url: ajaxurl,data:\'action=wcml_hide_notice&notice='.$n.'\',success:function(){jQuery(\'#' . $n . '\').fadeOut()}});return false;">' . __('No - dismiss', 'wcml') . '</a>' .
40
+ '</strong>'
41
  );
42
  update_option('_wcml_settings', $wcml_settings);
43
  }
44
+
45
  }
46
+
47
  function show_upgrade_notices(){
48
  $wcml_settings = get_option('_wcml_settings');
49
+ if(!empty($wcml_settings['notifications'])){
50
  foreach($wcml_settings['notifications'] as $k => $notification){
51
+
52
  // exceptions
53
  if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH) . '/menu/sub/troubleshooting.php' && $k == 'varimages') continue;
54
+
55
  if($notification['show']){
56
  ?>
57
  <div id="<?php echo $k ?>" class="updated">
58
  <p><?php echo $notification['text'] ?></p>
59
  </div>
60
+ <?php
61
  }
62
  }
63
  }
64
  }
65
+
66
  function hide_upgrade_notice($k){
67
+
68
  if(empty($k)){
69
  $k = $_POST['notice'];
70
  }
71
+
72
  $wcml_settings = get_option('_wcml_settings');
73
  if(isset($wcml_settings['notifications'][$k])){
74
  $wcml_settings['notifications'][$k]['show'] = 0;
75
  update_option('_wcml_settings', $wcml_settings);
76
  }
77
  }
78
+
79
  function run(){
80
+
81
  $version_in_db = get_option('_wcml_version');
82
+
83
  // exception - starting in 2.3.2
84
  if(empty($version_in_db) && get_option('icl_is_wcml_installed')){
85
  $version_in_db = '2.3.2';
 
86
  }
87
+
88
  $migration_ran = false;
89
+
90
  if($version_in_db && version_compare($version_in_db, WCML_VERSION, '<')){
91
+
92
  foreach($this->versions as $version){
93
+
94
  if(version_compare($version, WCML_VERSION, '<=') && version_compare($version, $version_in_db, '>')){
95
 
96
  $upgrade_method = 'upgrade_' . str_replace('.', '_', $version);
97
+
98
  if(method_exists($this, $upgrade_method)){
99
  $this->$upgrade_method();
100
  $migration_ran = true;
101
  }
102
+
103
  }
104
+
105
  }
106
+
107
  }
108
+
109
  if($migration_ran || empty($version_in_db)){
110
+ update_option('_wcml_version', WCML_VERSION);
111
  }
112
  }
113
+
114
  function upgrade_2_9_9_1(){
115
  global $wpdb;
116
+
117
  //migrate exists currencies
118
  $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
119
  foreach($currencies as $currency){
120
  if(isset($currency->language_code)){
121
+ $wpdb->insert($wpdb->prefix .'icl_languages_currencies', array(
122
+ 'language_code' => $currency->language_code,
123
+ 'currency_id' => $currency->id
124
+ )
125
+ );
126
+ }
127
  }
128
 
129
+ $cols = $wpdb->get_col("SHOW COLUMNS FROM {$wpdb->prefix}icl_currencies");
130
  if(in_array('language_code', $cols)){
131
  $wpdb->query("ALTER TABLE {$wpdb->prefix}icl_currencies DROP COLUMN language_code");
132
  }
133
+
134
  // migrate settings
135
  $new_settings = array(
136
  'is_term_order_synced' => get_option('icl_is_wcml_term_order_synched'),
140
  'enable_multi_currency' => get_option('icl_enable_multi_currency'),
141
  'currency_converting_option' => get_option('currency_converting_option')
142
  );
143
+
144
  if(!get_option('_wcml_settings')){
145
  add_option('_wcml_settings', $new_settings, false, true);
146
  }
147
+
148
  delete_option('icl_is_wcml_term_order_synced');
149
  delete_option('wcml_file_path_sync');
150
  delete_option('icl_is_wpcml_installed');
151
  delete_option('wpml_dismiss_doc_main');
152
  delete_option('icl_enable_multi_currency');
153
  delete_option('currency_converting_option');
154
+
155
+
156
  }
157
+
158
  function upgrade_3_1(){
159
  global $wpdb,$sitepress;
160
  $wcml_settings = get_option('_wcml_settings');
161
+
162
  if(isset($wcml_settings['enable_multi_currency']) && $wcml_settings['enable_multi_currency'] == 'yes'){
163
  $wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_INDEPENDENT;
164
  }else{
165
  $wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_DISABLED;
166
  }
167
+
168
  $wcml_settings['products_sync_date'] = 1;
169
+
170
+
171
  update_option('_wcml_settings', $wcml_settings);
172
+
173
  // multi-currency migration
174
  if($wcml_settings['enable_multi_currency'] == 'yes' && $wcml_settings['currency_converting_option'] == 2){
175
+
176
  // get currencies exchange rates
177
  $results = $wpdb->get_results("SELECT code, value FROM {$wpdb->prefix}icl_currencies");
178
  foreach($results as $row){
179
+ $exchange_rates[$row->code] = $row->value;
180
  }
181
+
182
  // get languages currencies map
183
  $results = $wpdb->get_results("SELECT l.language_code, c.code FROM {$wpdb->prefix}icl_languages_currencies l JOIN {$wpdb->prefix}icl_currencies c ON l.currency_id = c.id");
184
  foreach($results as $row){
185
+ $language_currencies[$row->language_code] = $row->code;
186
  }
187
+
188
+
189
  $results = $wpdb->get_results($wpdb->prepare("
190
  SELECT p.ID, t.trid, t.element_type
191
  FROM {$wpdb->posts} p JOIN {$wpdb->prefix}icl_translations t ON t.element_id = p.ID AND t.element_type IN ('post_product', 'post_product_variation')
193
  p.post_type in ('product', 'product_variation') AND t.language_code = %s
194
 
195
  ", $sitepress->get_default_language()));
196
+
197
  // set custom conversion rates
198
  foreach($results as $row){
199
  $translations = $sitepress->get_element_translations($row->trid, $row->element_type);
201
  $original_prices['_price'] = !empty($meta['_price']) ? $meta['_price'][0] : 0;
202
  $original_prices['_regular_price'] = !empty($meta['_regular_price']) ? $meta['_regular_price'][0] : 0;
203
  $original_prices['_sale_price'] = !empty($meta['_sale_price']) ? $meta['_sale_price'][0] : 0;
204
+
205
+
206
  $ccr = array();
207
+
208
  foreach($translations as $translation){
209
  if($translation->element_id != $row->ID){
210
+
211
  $meta = get_post_meta($translation->element_id);
212
  $translated_prices['_price'] = $meta['_price'][0];
213
  $translated_prices['_regular_price'] = $meta['_regular_price'][0];
214
  $translated_prices['_sale_price'] = $meta['_sale_price'][0];
215
 
216
  if(!empty($translated_prices['_price']) && !empty($original_prices['_price']) && $translated_prices['_price'] != $original_prices['_price']){
217
+
218
  $ccr['_price'][$language_currencies[$translation->language_code]] = $translated_prices['_price'] / $original_prices['_price'];
219
+
220
+ }
221
  if(!empty($translated_prices['_regular_price']) && !empty($original_prices['_regular_price']) && $translated_prices['_regular_price'] != $original_prices['_regular_price']){
222
+
223
  $ccr['_regular_price'][$language_currencies[$translation->language_code]] = $translated_prices['_regular_price'] / $original_prices['_regular_price'];
224
+
225
+ }
226
  if(!empty($translated_prices['_sale_price']) && !empty($original_prices['_sale_price']) && $translated_prices['_sale_price'] != $original_prices['_sale_price']){
227
+
228
  $ccr['_sale_price'][$language_currencies[$translation->language_code]] = $translated_prices['_sale_price'] / $original_prices['_sale_price'] ;
229
+
230
+ }
231
+
232
+
233
  }
234
  }
235
+
236
  if($ccr){
237
+ update_post_meta($row->ID, '_custom_conversion_rate', $ccr);
238
  }
239
+
240
+
241
  }
242
+
243
+
244
+ }
245
+
246
  }
247
+
248
  function upgrade_3_2(){
249
+
250
  woocommerce_wpml::set_up_capabilities();
251
+
252
  //delete not existing currencies in WC
253
  global $wpdb;
254
  $currencies = $wpdb->get_results("SELECT id,code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
258
  $wpdb->delete( $wpdb->prefix . 'icl_currencies', array( 'ID' => $currency->id ) );
259
  }
260
  }
261
+
262
  }
263
+
264
  function upgrade_3_3(){
265
  global $wpdb, $woocommerce_wpml;
266
+
267
  woocommerce_wpml::set_up_capabilities();
268
 
269
  $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
270
  if($currencies)
271
+ foreach($this->currencies as $currency){
272
+
273
+ $woocommerce_wpml->settings['currency_options'][$currency->code]['rate'] = $currency->value;
274
+ $woocommerce_wpml->settings['currency_options'][$currency->code]['updated'] = $currency->changed;
275
+ $woocommerce_wpml->settings['currency_options'][$currency->code]['position'] = 'left';
276
+ $woocommerce_wpml->settings['currency_options'][$currency->code]['languages'] = $woocommerce_wpml->settings['currencies_languages'];
277
+ unset($woocommerce_wpml->settings['currencies_languages']);
278
+
279
+ $woocommerce_wpml->update_settings();
280
+
281
+ }
282
+
283
  $wpdb->query("DROP TABLE `{$wpdb->prefix}icl_currencies`");
284
+
285
  }
286
 
287
  function upgrade_3_5()
293
 
294
  update_option('_wcml_settings', $wcml_settings);
295
  }
296
+
297
+ function upgrade_3_5_4()
298
+ {
299
+ flush_rewrite_rules( );
300
+ }
301
+
302
  }
inc/wc-strings.class.php CHANGED
@@ -5,7 +5,7 @@ class WCML_WC_Strings{
5
  function __construct(){
6
 
7
  add_action('init', array($this, 'init'));
8
- add_action('plugins_loaded', array($this, 'pre_init'));
9
  add_filter('query_vars', array($this, 'translate_query_var_for_product'));
10
  add_filter('wp_redirect', array($this, 'encode_shop_slug'),10,2);
11
 
5
  function __construct(){
6
 
7
  add_action('init', array($this, 'init'));
8
+ add_action('init', array($this, 'pre_init'));
9
  add_filter('query_vars', array($this, 'translate_query_var_for_product'));
10
  add_filter('wp_redirect', array($this, 'encode_shop_slug'),10,2);
11
 
menu/sub/product-data.php CHANGED
@@ -141,9 +141,9 @@ $button_labels = array(
141
  <?php endif; ?>
142
  <?php elseif(in_array($product_content,array('content','excerpt'))): ?>
143
  <?php if($default_language == $key): ?>
144
- <button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
145
  <?php else: ?>
146
- <button type="button" class="button-secondary wcml_edit_conten<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
147
  <?php if($missing_translation): ?>
148
  <span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
149
  <p class="missing-translation">
141
  <?php endif; ?>
142
  <?php elseif(in_array($product_content,array('content','excerpt'))): ?>
143
  <?php if($default_language == $key): ?>
144
+ <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'wpml-wcml') ?></button>
145
  <?php else: ?>
146
+ <button type="button" class="button-secondary wcml_edit_content<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
147
  <?php if($missing_translation): ?>
148
  <span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
149
  <p class="missing-translation">
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 4.1.1
8
- Stable tag: 3.5.3
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -78,6 +78,10 @@ In order for the checkout and store pages to appear translated, you need to crea
78
 
79
  == Changelog ==
80
 
 
 
 
 
81
  = 3.5.3 =
82
  * Bug fixed: Redirection issues with "Your latest posts" as a front page
83
  * Bug fixed: Yoast fileds not saved in WooCommerce Multilingual products table
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 4.1.1
8
+ Stable tag: 3.5.4
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.5.4 =
82
+ * Bug fixed: It was not possible to access the source content in the WCML product translation table.
83
+ * Bug fixed: Urls for some of the custom posts were leading to 404 errors.
84
+
85
  = 3.5.3 =
86
  * Bug fixed: Redirection issues with "Your latest posts" as a front page
87
  * Bug fixed: Yoast fileds not saved in WooCommerce Multilingual products table
wpml-woocommerce.php CHANGED
@@ -5,12 +5,12 @@
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
- Version: 3.5.3
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
- define('WCML_VERSION', '3.5.3');
14
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
15
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
16
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
+ Version: 3.5.4
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
+ define('WCML_VERSION', '3.5.4');
14
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
15
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
16
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);