diff --git a/admin/assets/images/wpsp-logo.svg b/admin/assets/images/wpsp-logo.svg index b13d41d62..f3009c16e 100755 --- a/admin/assets/images/wpsp-logo.svg +++ b/admin/assets/images/wpsp-logo.svg @@ -1,5 +1,5 @@ - + '].join("")),l(r)},bubble:function(t,e,i,r,a,n){var s,h,d,o,u,f;for(null==t&&(t="#39d"),null==e&&(e="#9cf"),null==i&&(i=15),null==r&&(r=1),null==a&&(a=6),null==n&&(n=1),s=[this.head("0 0 200 200"),''],h=0;h','',"",'','',""].join(""));return l(s.join("")+"")}},e={queue:{},running:!1,main:function(t){var e,i,r,a,l,n,s=this;e=!1,i=[];for(r in a=this.queue)(n=(l=a[r])(t))||i.push(l),e=e||n;for(r in a=this.queue)l=a[r],i.indexOf(l)>=0&&delete this.queue[r];return e?requestAnimationFrame(function(t){return s.main(t)}):this.running=!1},add:function(t,e){var i=this;if(this.queue[t]||(this.queue[t]=e),!this.running)return this.running=!0,requestAnimationFrame(function(t){return i.main(t)})}},window.ldBar=i=function(i,l){var n,h,d,o,u,f,c,g,p,w,m,k,b,x,v,y,M,q,A,B,C,S,_,L,N=this;if(null==l&&(l={}),n={xlink:"http://www.w3.org/1999/xlink"},(h="String"===s.call(i).slice(8,-1)?document.querySelector(i):i).ldBar)return h.ldBar;h.ldBar=this,~(d=h.getAttribute("class")||"").indexOf("ldBar")||h.setAttribute("class",d+" ldBar"),o="ldBar-"+Math.random().toString(16).substring(2),u={key:o,clip:o+"-clip",filter:o+"-filter",pattern:o+"-pattern",mask:o+"-mask",maskPath:o+"-mask-path"},f=function(t,e){var i,r;t=c(t);for(i in e)r=e[i],"attr"!==i&&t.appendChild(f(i,r||{}));return t.attrs(e.attr||{}),t},c=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},(g=document.body.__proto__.__proto__.__proto__).text=function(t){return this.appendChild(document.createTextNode(t))},g.attrs=function(t){var e,i,r,a=[];for(e in t)i=t[e],(r=/([^:]+):([^:]+)/.exec(e))&&n[r[1]]?a.push(this.setAttributeNS(n[r[1]],e,i)):a.push(this.setAttribute(e,i));return a},g.styles=function(t){var e,i,r=[];for(e in t)i=t[e],r.push(this.style[e]=i);return r},g.append=function(t){return this.appendChild(document.createElementNS("http://www.w3.og/2000/svg",t))},g.attr=function(t,e){return null!=e?this.setAttribute(t,e):this.getAttribute(t)},(p={type:"stroke",img:"",path:"M10 10L90 10","fill-dir":"btt",fill:"#25b","fill-background":"#ddd","fill-background-extrude":3,"pattern-size":null,"stroke-dir":"normal",stroke:"#25b","stroke-width":"3","stroke-trail":"#ddd","stroke-trail-width":.5,duration:1,easing:"linear",value:0,"img-size":null,bbox:null,"set-dim":!0,"aspect-ratio":"xMidYMid"}).preset=h.attr("data-preset")||l.preset,null!=p.preset&&r(p,a[p.preset]);for(w in p)(m=m=h.attr("data-"+w))&&(p[w]=m);return r(p,l),p.img&&(p.path=null),k="stroke"===p.type,b=function(e){var i,r;return i=/data:ldbar\/res,([^()]+)\(([^)]+)\)/,(r=i.exec(e))?r=t[r[1]].apply(t,r[2].split(",")):e},p.fill=b(p.fill),p.stroke=b(p.stroke),"false"===p["set-dim"]&&(p["set-dim"]=!1),x={attr:{"xmlns:xlink":"http://www.w3.org/1999/xlink",preserveAspectRatio:p["aspect-ratio"],width:"100%",height:"100%"},defs:{filter:{attr:{id:u.filter,x:-1,y:-1,width:3,height:3},feMorphology:{attr:{operator:+p["fill-background-extrude"]>=0?"dilate":"erode",radius:Math.abs(+p["fill-background-extrude"])}},feColorMatrix:{attr:{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",result:"cm"}}},mask:{attr:{id:u.mask},image:{attr:{"xlink:href":p.img,filter:"url(#"+u.filter+")",x:0,y:0,width:100,height:100,preserveAspectRatio:p["aspect-ratio"]}}},g:{mask:{attr:{id:u.maskPath},path:{attr:{d:p.path||"",fill:"#fff",stroke:"#fff",filter:"url(#"+u.filter+")"}}}},clipPath:{attr:{id:u.clip},rect:{attr:{class:"mask",fill:"#000"}}},pattern:{attr:{id:u.pattern,patternUnits:"userSpaceOnUse",x:0,y:0,width:300,height:300},image:{attr:{x:0,y:0,width:300,height:300}}}}},v=f("svg",x),(y=document.createElement("div")).setAttribute("class","ldBar-label"),h.appendChild(v),h.appendChild(y),M=[0,0],q=0,this.fit=function(){var t,e,i,r;if((t=p.bbox)?(e=t.split(" ").map(function(t){return+t.trim()}),e={x:e[0],y:e[1],width:e[2],height:e[3]}):e=M[1].getBBox(),e&&0!==e.width&&0!==e.height||(e={x:0,y:0,width:100,height:100}),i=1.5*Math.max.apply(null,["stroke-width","stroke-trail-width","fill-background-extrude"].map(function(t){return p[t]})),v.attrs({viewBox:[e.x-i,e.y-i,e.width+2*i,e.height+2*i].join(" ")}),p["set-dim"]&&["width","height"].map(function(t){if(!h.style[t]||N.fit[t])return h.style[t]=e[t]+2*i+"px",N.fit[t]=!0}),r=M[0].querySelector("rect"))return r.attrs({x:e.x-i,y:e.y-i,width:e.width+2*i,height:e.height+2*i})},p.path?(M[0]=k?f("g",{path:{attr:{d:p.path,fill:"none",class:"baseline"}}}):f("g",{rect:{attr:{x:0,y:0,width:100,height:100,mask:"url(#"+u.maskPath+")",fill:p["fill-background"],class:"frame"}}}),v.appendChild(M[0]),M[1]=f("g",{path:{attr:{d:p.path,class:k?"mainline":"solid","clip-path":"fill"===p.type?"url(#"+u.clip+")":""}}}),v.appendChild(M[1]),A=M[0].querySelector(k?"path":"rect"),B=M[1].querySelector("path"),k&&B.attrs({fill:"none"}),C=v.querySelector("pattern image"),(S=new Image).addEventListener("load",function(){var t,e;return t=(e=p["pattern-size"])?{width:+e,height:+e}:S.width&&S.height?{width:S.width,height:S.height}:{width:300,height:300},v.querySelector("pattern").attrs({width:t.width,height:t.height}),C.attrs({width:t.width,height:t.height})}),/.+\..+|^data:/.exec(k?p.stroke:p.fill)&&(S.src=k?p.stroke:p.fill,C.attrs({"xlink:href":S.src})),k&&(A.attrs({stroke:p["stroke-trail"],"stroke-width":p["stroke-trail-width"]}),B.attrs({"stroke-width":p["stroke-width"],stroke:/.+\..+|^data:/.exec(p.stroke)?"url(#"+u.pattern+")":p.stroke})),p.fill&&!k&&B.attrs({fill:/.+\..+|^data:/.exec(p.fill)?"url(#"+u.pattern+")":p.fill}),q=B.getTotalLength(),this.fit(),this.inited=!0):p.img&&(L=p["img-size"]?{width:+(_=p["img-size"].split(","))[0],height:+_[1]}:{width:100,height:100},M[0]=f("g",{rect:{attr:{x:0,y:0,width:100,height:100,mask:"url(#"+u.mask+")",fill:p["fill-background"]}}}),v.querySelector("mask image").attrs({width:L.width,height:L.height}),M[1]=f("g",{image:{attr:{width:L.width,height:L.height,x:0,y:0,preserveAspectRatio:p["aspect-ratio"],"clip-path":"fill"===p.type?"url(#"+u.clip+")":"","xlink:href":p.img,class:"solid"}}}),(S=new Image).addEventListener("load",function(){var t,e;return e=p["img-size"]?{width:+(t=p["img-size"].split(","))[0],height:+t[1]}:S.width&&S.height?{width:S.width,height:S.height}:{width:100,height:100},v.querySelector("mask image").attrs({width:e.width,height:e.height}),M[1].querySelector("image").attrs({width:e.width,height:e.height}),N.fit(),N.set(void 0,!1),N.inited=!0}),S.src=p.img,v.appendChild(M[0]),v.appendChild(M[1])),v.attrs({width:"100%",height:"100%"}),this.transition={value:{src:0,des:0},time:{},ease:function(t,e,i,r){return(t/=.5*r)<1?.5*i*t*t+e:(t-=1,.5*-i*(t*(t-2)-1)+e)},handler:function(t,e){var i,r,a,l,n,s,h,d,o;return null==e&&(e=!0),null==this.time.src&&(this.time.src=t),i=[this.value.des-this.value.src,.001*(t-this.time.src),+p.duration||1],r=i[0],a=i[1],l=i[2],y.textContent=n=e?Math.round(this.ease(a,this.value.src,r,l)):this.value.des,k?(s=B,h={"stroke-dasharray":"reverse"===p["stroke-dir"]?"0 "+q*(100-n)*.01+" "+q*n*.01+" 0":.01*n*q+" "+(.01*(100-n)*q+1)}):(d=M[1].getBBox(),h="btt"!==(o=p["fill-dir"])&&o?"ttb"===o?{y:d.y,height:d.height*n*.01,x:d.x,width:d.width}:"ltr"===o?{y:d.y,height:d.height,x:d.x,width:d.width*n*.01}:"rtl"===o?{y:d.y,height:d.height,x:d.x+d.width*(100-n)*.01,width:d.width*n*.01}:void 0:{y:d.y+d.height*(100-n)*.01,height:d.height*n*.01,x:d.x,width:d.width},s=v.querySelector("rect")),s.attrs(h),!(a>=l)||(delete this.time.src,!1)},start:function(t,i,r){var a,l=this;return a=this.value,a.src=t,a.des=i,h.offsetWidth||h.offsetHeight||h.getClientRects().length,r&&(h.offsetWidth||h.offsetHeight||h.getClientRects().length)?e.add(u.key,function(t){return l.handler(t)}):(this.time.src=0,void this.handler(1e3,!1))}},this.set=function(t,e){var i,r;return null==e&&(e=!0),i=this.value||0,null!=t?this.value=t:t=this.value,r=this.value,this.transition.start(i,r,e)},this.set(+p.value||0,!1),this},window.addEventListener("load",function(){var t,e,r,a,l=[];for(t=0,r=(e=document.querySelectorAll(".ldBar")).length;tLOADING',"fill-background-extrude":1.3,"pattern-size":100,"fill-dir":"ltr","img-size":"70,20",bbox:"0 0 70 20"},line:{type:"stroke",path:"M10 10L90 10",stroke:"#25b","stroke-width":3,"stroke-trail":"#ddd","stroke-trail-width":1,bbox:"10 10 80 10"},fan:{type:"stroke",path:"M10 90A40 40 0 0 1 90 90","fill-dir":"btt",fill:"#25b","fill-background":"#ddd","fill-background-extrude":3,"stroke-dir":"normal",stroke:"#25b","stroke-width":"3","stroke-trail":"#ddd","stroke-trail-width":.5,bbox:"10 50 80 40"},circle:{type:"stroke",path:"M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10","fill-dir":"btt",fill:"#25b","fill-background":"#ddd","fill-background-extrude":3,"stroke-dir":"normal",stroke:"#25b","stroke-width":"3","stroke-trail":"#ddd","stroke-trail-width":.5,bbox:"10 10 80 80"},bubble:{type:"fill",path:"M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10","fill-dir":"btt",fill:"data:ldbar/res,bubble(#39d,#cef)","pattern-size":"150","fill-background":"#ddd","fill-background-extrude":2,"stroke-dir":"normal",stroke:"#25b","stroke-width":"3","stroke-trail":"#ddd","stroke-trail-width":.5,bbox:"10 10 80 80"}}},{}]},{},[1]); \ No newline at end of file diff --git a/assets/sass/_feature-list.scss b/assets/sass/_feature-list.scss new file mode 100755 index 000000000..cbb258611 --- /dev/null +++ b/assets/sass/_feature-list.scss @@ -0,0 +1,590 @@ +/*----------------------------*/ +/* 35. Feature List +/*----------------------------*/ + +.elementor-widget-eael-feature-list { + + &.-icon-position-left .connector-type-modern.rhombus, + &.-icon-position-top .connector-type-modern.rhombus, + &.-icon-position-right .connector-type-modern.rhombus { + .eael-feature-list-item { + + &:before { + top: 3px !important; + } + &:after { + top: 45px !important; + } + } + } + + &.-icon-position-right, + &.-icon-position-right.-tablet-icon-position-right { + .connector { + right: 0; + left: calc(100% - 60px); + } + + .eael-feature-list-items { + &.connector-type-modern { + + .eael-feature-list-item { + padding: 0 50px 0 0; + + @media (max-width: 767px) { + padding: 0 30px 0 0; + } + + &:before { + left: auto; + right: 0; + } + + &:after { + left: auto; + right: 5px; + top: 30px; + } + } + } + } + } + + + .eael-feature-list-items { + list-style-type: none; + margin: 0; + padding: 0; + + .eael-feature-list-item { + position: relative; + + .connector { + display: block; + position: absolute; + width: 0; + margin: 0 auto; + z-index: 1; + + height: 100%; + top: 0.5em; + + font-size: 60px; + left: 0; + right: calc(100% - 60px); + border-left: 2px solid #2ecc71; + border-right: none !important; + } + + &:last-child .connector { + display: none; + } + + .eael-feature-list-icon-box { + z-index: 2; + + .eael-feature-list-icon { + padding: .5em; + @include transition(all .5s); + font-size: 30px; + line-height: 1; + color: #818a91; + text-align: center; + display: inline-flex; + + i { + width: 1em; + height: 1em; + position: relative; + display: block; + + &:before { + position: absolute; + left: 50%; + -webkit-transform: translateX(-50%); + -ms-transform: translateX(-50%); + transform: translateX(-50%); + } + } + } + + .eael-feature-list-img { + font-size: 8px; + line-height: 1; + } + } + + + .eael-feature-list-content-box { + margin: 0 0 0 20px; + + .eael-feature-list-title { + margin-top: 0; + line-height: 1.5em; + } + + .eael-feature-list-content { + padding: 0; + margin: 0; + line-height: 1.5em; + } + } + } + + &.stacked { + .eael-feature-list-icon-box { + .eael-feature-list-icon { + background-color: #818a91; + color: $white; + } + } + } + + &.framed { + .eael-feature-list-icon-box { + .eael-feature-list-icon { + border: 1px solid #818a91; + background-color: $white; + } + } + } + + &.circle { + .eael-feature-list-icon-box { + .eael-feature-list-icon { + @include border-radius(50%); + } + } + } + + &.square { + .eael-feature-list-icon-box { + + } + } + + &.rhombus { + .eael-feature-list-icon-box { + .eael-feature-list-icon { + transform: rotate(45deg); + margin: 15px; + + i { + -ms-transform: rotate(-43deg); + -webkit-transform: rotate(-43deg); + transform: rotate(-43deg); + } + + img { + -ms-transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + } + } + } + + .eael-feature-list-content-box{ + .eael-feature-list-title { + margin-top: 15px; + } + } + } + + // Connector type + + &.connector-type-modern { + + .eael-feature-list-item { + padding: 0 0 0 50px; + position: relative; + + @media (max-width: 767px) { + padding: 0 0 0 30px; + display: block; + } + + &:before, + &:after { + content: ''; + position: absolute; + display: block; + } + + &:before { + left: 0; + top: 0; + z-index: 1; + border-left: 1px solid #000; + border-right: none !important; + height: 100%; + } + + &:after { + left: 5px; + top: 30px; + width: 23px; + display: block; + z-index: 2; + border-bottom: 1px dashed #000; + border-top: none !important; + } + + .connector { + display: none; + } + + } + + @media (min-width: 768px) { + &.-icon-position-right { + .eael-feature-list-item { + padding: 0 50px 0 0; + + &:before { + left: auto; + right: 0; + } + + &:after { + left: auto; + right: 5px; + top: 30px; + } + + .connector { + display: none; + } + + } + } + } + } + + } + + + + @media (min-width: 1025px) { + + // Icon position + + &.-icon-position-left { + .eael-feature-list-content-box { + margin-right: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + } + + &.-icon-position-right { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + } + + &.-icon-position-top { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-right: 0 !important; + margin-bottom: 0 !important; + } + } + + &.-icon-position-left .eael-feature-list-item, + &.-icon-position-right .eael-feature-list-item { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + + &.-icon-position-left .eael-feature-list-item { + text-align: left; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + } + + &.-icon-position-right .eael-feature-list-item { + text-align: right; + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + -ms-flex-direction: row-reverse; + flex-direction: row-reverse; + } + + } + + @media (max-width: 1024px) { + + // Icon position + + &.-tablet-icon-position-left .eael-feature-list-item, + &.-tablet-icon-position-right .eael-feature-list-item { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + + &.-tablet-icon-position-left .eael-feature-list-item { + text-align: left; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + } + + &.-tablet-icon-position-right .eael-feature-list-item { + text-align: right; + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + -ms-flex-direction: row-reverse; + flex-direction: row-reverse; + } + + } + + @media (min-width: 768px) and (max-width: 1024px) { + + &.-icon-position-left.-tablet-icon-position-left, + &.-icon-position-right.-tablet-icon-position-left, + &.-icon-position-top.-tablet-icon-position-left { + .eael-feature-list-content-box { + margin-right: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 0 0 50px; + + @media (max-width: 767px) { + padding: 0 0 0 30px; + } + + &:before { + left: 0; + right: auto; + } + + &:after { + left: 5px; + top: 30px; + } + } + } + + + &.-icon-position-left.-tablet-icon-position-top, + &.-icon-position-right.-tablet-icon-position-top, + &.-icon-position-top.-tablet-icon-position-top { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-right: 0 !important; + margin-bottom: 0 !important; + } + + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 0 0 50px; + + @media (max-width: 767px) { + padding: 0 0 0 30px; + } + + &:before { + left: 0; + right: auto; + } + + &:after { + left: 5px; + } + } + } + + &.-icon-position-left.-tablet-icon-position-right, + &.-icon-position-right.-tablet-icon-position-right, + &.-icon-position-top.-tablet-icon-position-right { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 50px 0 0; + + @media (max-width: 767px) { + padding: 0 30px 0 0; + } + + &:before { + right: 0; + left: auto; + } + + &:after { + left: auto; + right: 5px; + } + } + } + + } + + @media (max-width: 767px) { + + // Icon Position + &.-icon-position-left, + &.-icon-position-right, + &.-tablet-icon-position-left, + &.-tablet-icon-position-right { + .eael-feature-list-item { + display: block; + text-align: left; + } + } + + &.-mobile-icon-position-left .eael-feature-list-item, + &.-mobile-icon-position-right .eael-feature-list-item { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + + &.-mobile-icon-position-left .eael-feature-list-item { + text-align: left; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + } + + &.-mobile-icon-position-right .eael-feature-list-item { + text-align: right; + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + -ms-flex-direction: row-reverse; + flex-direction: row-reverse; + } + + + &.-icon-position-left.-tablet-icon-position-left.-mobile-icon-position-left, + &.-icon-position-left.-tablet-icon-position-right.-mobile-icon-position-left, + &.-icon-position-left.-tablet-icon-position-top.-mobile-icon-position-left, + &.-icon-position-right.-tablet-icon-position-left.-mobile-icon-position-left, + &.-icon-position-right.-tablet-icon-position-right.-mobile-icon-position-left, + &.-icon-position-right.-tablet-icon-position-top.-mobile-icon-position-left, + &.-icon-position-top.-tablet-icon-position-left.-mobile-icon-position-left, + &.-icon-position-top.-tablet-icon-position-right.-mobile-icon-position-left, + &.-icon-position-top.-tablet-icon-position-top.-mobile-icon-position-left { + .eael-feature-list-content-box { + margin-right: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 0 0 50px; + + @media (max-width: 767px) { + padding: 0 0 0 30px; + } + + &:before { + left: 0; + right: auto; + } + + &:after { + left: 5px; + } + + .eael-feature-list-content-box { + + } + } + } + + &.-icon-position-left.-tablet-icon-position-left.-mobile-icon-position-top, + &.-icon-position-left.-tablet-icon-position-right.-mobile-icon-position-top, + &.-icon-position-left.-tablet-icon-position-top.-mobile-icon-position-top, + &.-icon-position-right.-tablet-icon-position-left.-mobile-icon-position-top, + &.-icon-position-right.-tablet-icon-position-right.-mobile-icon-position-top, + &.-icon-position-right.-tablet-icon-position-top.-mobile-icon-position-top, + &.-icon-position-top.-tablet-icon-position-left.-mobile-icon-position-top, + &.-icon-position-top.-tablet-icon-position-right.-mobile-icon-position-top, + &.-icon-position-top.-tablet-icon-position-top.-mobile-icon-position-top { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-right: 0 !important; + margin-bottom: 0 !important; + } + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 0 0 50px; + + @media (max-width: 767px) { + padding: 0 0 0 30px; + } + + &:before { + left: 0; + right: auto; + } + + &:after { + left: 5px; + } + } + } + + &.-icon-position-left.-tablet-icon-position-left.-mobile-icon-position-right, + &.-icon-position-left.-tablet-icon-position-right.-mobile-icon-position-right, + &.-icon-position-left.-tablet-icon-position-top.-mobile-icon-position-right, + &.-icon-position-right.-tablet-icon-position-left.-mobile-icon-position-right, + &.-icon-position-right.-tablet-icon-position-right.-mobile-icon-position-right, + &.-icon-position-right.-tablet-icon-position-top.-mobile-icon-position-right, + &.-icon-position-top.-tablet-icon-position-left.-mobile-icon-position-right, + &.-icon-position-top.-tablet-icon-position-right.-mobile-icon-position-right, + &.-icon-position-top.-tablet-icon-position-top.-mobile-icon-position-right { + .eael-feature-list-content-box { + margin-left: 0 !important; + margin-top: 0 !important; + margin-bottom: 0 !important; + } + + .eael-feature-list-items.connector-type-modern .eael-feature-list-item { + padding: 0 50px 0 0; + + @media (max-width: 767px) { + padding: 0 30px 0 0; + } + + &:before { + right: 0; + left: auto; + } + + &:after { + left: auto; + right: 5px; + } + } + } + + } +} diff --git a/assets/sass/_mixins.scss b/assets/sass/_mixins.scss new file mode 100755 index 000000000..f7a348ee3 --- /dev/null +++ b/assets/sass/_mixins.scss @@ -0,0 +1,29 @@ + +// Border Radius + +@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) { + @if $enable-rounded { + border-radius: $radius; + } @else if $fallback-border-radius != false { + border-radius: $fallback-border-radius; + } +} + + +// Transition + +@mixin transition($transition...) { + @if $enable-transitions { + @if length($transition) == 0 { + transition: $transition-base; + } @else { + transition: $transition; + } + } + + @if $enable-prefers-reduced-motion-media-query { + @media (prefers-reduced-motion: reduce) { + transition: none; + } + } +} \ No newline at end of file diff --git a/assets/sass/_particles.scss b/assets/sass/_particles.scss index c3de9dcc1..74abc47ff 100755 --- a/assets/sass/_particles.scss +++ b/assets/sass/_particles.scss @@ -1,3 +1,9 @@ -.elementor-section.eael-particles-section .elementor-container { +.elementor-section.eael-particles-section .elementor-container, +.elementor-section .elementor-container { z-index: 99; } + +.elementor-section.eael-particles-section > canvas{ + position: absolute; + top:0; +} \ No newline at end of file diff --git a/assets/sass/_variables.scss b/assets/sass/_variables.scss new file mode 100755 index 000000000..fa5339178 --- /dev/null +++ b/assets/sass/_variables.scss @@ -0,0 +1,11 @@ +// Color system + +$white: #fff !default; + +$border-radius: .25rem !default; + +$transition-base: all .2s ease-in-out !default; + +$enable-rounded: true !default; +$enable-transitions: true !default; +$enable-prefers-reduced-motion-media-query: true !default; \ No newline at end of file diff --git a/assets/sass/_woo-products.scss b/assets/sass/_woo-products.scss index 46ded41a5..12a91730b 100755 --- a/assets/sass/_woo-products.scss +++ b/assets/sass/_woo-products.scss @@ -4,45 +4,80 @@ .eael-product-grid, .eael-post-grid { + .woocommerce { + ul.products { + display: grid; + grid-gap: 25px; + margin: 0 !important; + padding: 0 !important; + + &:before, + &:after { + display: none; + } + + .product { + width: 100%; + margin: 0; + padding: 0; + } + + &.eael-product-columns-1 { + grid-template-columns: 100%; + } + &.eael-product-columns-2 { + grid-template-columns: repeat(2, 1fr); + + @media screen and (max-width: 480px) { + grid-template-columns: repeat(1, 1fr); + } + } + &.eael-product-columns-3 { + grid-template-columns: repeat(3, 1fr); + + @media screen and (max-width: 767px) { + grid-template-columns: repeat(2, 1fr); + } + + @media screen and (max-width: 480px) { + grid-template-columns: repeat(1, 1fr); + } + } + &.eael-product-columns-4 { + grid-template-columns: repeat(4, 1fr); + + @media screen and (max-width: 767px) { + grid-template-columns: repeat(2, 1fr); + } - .woocommerce { - ul.products { - display: grid; - grid-gap: 25px; - margin: 0 !important; - padding: 0 !important; - - &:before, - &:after { - display: none; - } - - .product { - width: 100%; - margin: 0; - padding: 0; - } - - &.eael-product-columns-1 { - grid-template-columns: 100%; - } - &.eael-product-columns-2 { - grid-template-columns: repeat(2, 1fr); - } - &.eael-product-columns-3 { - grid-template-columns: repeat(3, 1fr); - } - &.eael-product-columns-4 { - grid-template-columns: repeat(4, 1fr); - } - &.eael-product-columns-5 { - grid-template-columns: repeat(5, 1fr); - } - &.eael-product-columns-6 { - grid-template-columns: repeat(6, 1fr); - } - } - } + @media screen and (max-width: 480px) { + grid-template-columns: repeat(1, 1fr); + } + } + &.eael-product-columns-5 { + grid-template-columns: repeat(5, 1fr); + + @media screen and (max-width: 767px) { + grid-template-columns: repeat(2, 1fr); + } + + @media screen and (max-width: 480px) { + grid-template-columns: repeat(1, 1fr); + } + } + &.eael-product-columns-6 { + grid-template-columns: repeat(6, 1fr); + + @media screen and (max-width: 767px) { + grid-template-columns: repeat(2, 1fr); + } + + @media screen and (max-width: 480px) { + grid-template-columns: repeat(1, 1fr); + } + } + } + } // simple & reveal style &.eael-product-simple, diff --git a/assets/sass/essential-addons-elementor.scss b/assets/sass/essential-addons-elementor.scss index 053220ddf..8c7897385 100755 --- a/assets/sass/essential-addons-elementor.scss +++ b/assets/sass/essential-addons-elementor.scss @@ -41,8 +41,11 @@ 32. Tooltip 33. Progress Bar 34. Image accordion +35. Feature List -------------------------------------------------------*/ +@import "variables"; +@import "mixins"; @import "general"; @import "general-slider"; @import "fancy-text"; @@ -78,3 +81,4 @@ @import "progress-bar"; @import "img-accordion"; @import "particles"; +@import "feature-list"; diff --git a/elements/feature-list/feature-list.php b/elements/feature-list/feature-list.php new file mode 100755 index 000000000..4c26cef4a --- /dev/null +++ b/elements/feature-list/feature-list.php @@ -0,0 +1,733 @@ +start_controls_section( + 'eael_section_feature_list_content_settings', + [ + 'label' => esc_html__( 'Content Settings', 'essential-addons-elementor' ) + ] + ); + + $this->add_control( + 'eael_feature_list', + [ + 'label' => esc_html__( 'Feature Item', 'essential-addons-elementor' ), + 'type' => Controls_Manager::REPEATER, + 'seperator' => 'before', + 'default' => [ + [ + 'eael_feature_list_icon' => 'fa fa-check', + 'eael_feature_list_title' => esc_html__( 'Feature Item 1', 'essential-addons-elementor' ), + 'eael_feature_list_content' => esc_html__( 'Feature Item 1 content', 'essential-addons-elementor' ) + ], + [ + 'eael_feature_list_icon' => 'fa fa-times', + 'eael_feature_list_title' => esc_html__( 'Feature Item 2', 'essential-addons-elementor' ), + 'eael_feature_list_content' => esc_html__( 'Feature Item 2 content', 'essential-addons-elementor' ) + ], + [ + 'eael_feature_list_icon' => 'fa fa-dot-circle-o', + 'eael_feature_list_title' => esc_html__( 'Feature Item 3', 'essential-addons-elementor' ), + 'eael_feature_list_content' => esc_html__( 'Feature Item 3 content', 'essential-addons-elementor' ) + ] + ], + 'fields' => [ + [ + 'name' => 'eael_feature_list_icon_type', + 'label' => esc_html__( 'Icon Type', 'essential-addons-elementor' ), + 'type' => Controls_Manager::CHOOSE, + 'options' => [ + 'icon' => [ + 'title' => esc_html__( 'Icon', 'essential-addons-elementor' ), + 'icon' => 'fa fa-star', + ], + 'image' => [ + 'title' => esc_html__( 'Image', 'essential-addons-elementor' ), + 'icon' => 'fa fa-picture-o', + ], + ], + 'default' => 'icon', + 'label_block' => false, + ], + [ + 'name' => 'eael_feature_list_icon', + 'label' => esc_html__( 'Icon', 'essential-addons-elementor' ), + 'type' => Controls_Manager::ICON, + 'default' => 'fa fa-plus', + 'condition' => [ + 'eael_feature_list_icon_type' => 'icon' + ] + ], + [ + 'name' => 'eael_feature_list_img', + 'label' => esc_html__( 'Image', 'essential-addons-elementor' ), + 'type' => Controls_Manager::MEDIA, + 'default' => [ + 'url' => Utils::get_placeholder_image_src(), + ], + 'condition' => [ + 'eael_feature_list_icon_type' => 'image' + ] + ], + [ + 'name' => 'eael_feature_list_title', + 'label' => esc_html__( 'Title', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => esc_html__( 'Title', 'essential-addons-elementor' ), + 'dynamic' => [ 'active' => true ] + ], + [ + 'name' => 'eael_feature_list_content', + 'label' => esc_html__( 'Content', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio, neque qui velit. Magni dolorum quidem ipsam eligendi, totam, facilis laudantium cum accusamus ullam voluptatibus commodi numquam, error, est. Ea, consequatur.', 'essential-addons-elementor' ), + 'dynamic' => [ 'active' => true ] + ], + [ + 'name' => 'eael_feature_list_link', + 'label' => esc_html__( 'Link', 'essential-addons-elementor' ), + 'type' => Controls_Manager::URL, + 'dynamic' => [ 'active' => true ], + 'placeholder' => esc_html__( 'https://your-link.com', 'essential-addons-elementor' ), + 'separator' => 'before', + ], + ], + 'title_field' => ' {{{ eael_feature_list_title }}}', + ] + ); + + $this->add_control( + 'eael_feature_list_title_size', + [ + 'label' => esc_html__( 'Title HTML Tag', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'options' => [ + 'h1' => 'H1', + 'h2' => 'H2', + 'h3' => 'H3', + 'h4' => 'H4', + 'h5' => 'H5', + 'h6' => 'H6', + 'div' => 'div', + 'span' => 'span', + 'p' => 'p', + ], + 'default' => 'h3', + 'separator' => 'before' + ] + ); + + $this->add_control( + 'eael_feature_list_icon_shape', + [ + 'label' => esc_html__( 'Icon Shape', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'default' => 'circle', + 'label_block' => false, + 'options' => [ + 'circle' => esc_html__( 'Circle', 'essential-addons-elementor' ), + 'square' => esc_html__( 'Square', 'essential-addons-elementor' ), + 'rhombus' => esc_html__( 'Rhombus', 'essential-addons-elementor' ), + ], + ] + ); + + $this->add_control( + 'eael_feature_list_icon_shape_view', + [ + 'label' => esc_html__( 'Shape View', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'default' => 'stacked', + 'label_block' => false, + 'options' => [ + 'framed' => esc_html__( 'Framed', 'essential-addons-elementor' ), + 'stacked' => esc_html__( 'Stacked', 'essential-addons-elementor' ) + ], + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_icon_position', + [ + 'label' => esc_html__( 'Icon Position', 'essential-addons-elementor' ), + 'type' => Controls_Manager::CHOOSE, + 'options' => [ + 'left' => [ + 'title' => esc_html__( 'Left', 'essential-addons-elementor' ), + 'icon' => 'fa fa-align-left', + ], + 'top' => [ + 'title' => esc_html__( 'Top', 'essential-addons-elementor' ), + 'icon' => 'fa fa-align-center', + ], + 'right' => [ + 'title' => esc_html__( 'Right', 'essential-addons-elementor' ), + 'icon' => 'fa fa-align-right', + ], + ], + 'default' => 'left', + 'devices' => [ 'desktop', 'tablet', 'mobile' ], + 'desktop_default' => 'left', + 'tablet_default' => 'left', + 'mobile_default' => 'left', + 'prefix_class' => '%s-icon-position-', + 'toggle' => false, + ] + ); + + $this->add_control( + 'eael_feature_list_connector', + [ + 'label' => esc_html__( 'Show Connector', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SWITCHER, + 'default' => 'no', + 'label_on' => esc_html__( 'Show', 'essential-addons-elementor' ), + 'label_off' => esc_html__( 'No', 'essential-addons-elementor' ), + 'return_value' => 'yes', + ] + ); + + $this->end_controls_section(); + + /** + * ------------------------------------------- + * Feature List Style + * ------------------------------------------- + */ + + $this->start_controls_section( + 'eael_section_feature_list_style', + [ + 'label' => esc_html__( 'List', 'essential-addons-elementor' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_space_between', + [ + 'label' => esc_html__( 'Space Between', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'default' => [ + 'size' => 15, + ], + 'range' => [ + 'px' => [ + 'max' => 50, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-items .eael-feature-list-item:not(:last-child)' => 'padding-bottom: calc({{SIZE}}{{UNIT}}/2)', + '{{WRAPPER}} .eael-feature-list-items .eael-feature-list-item:not(:first-child)' => 'margin-top: calc({{SIZE}}{{UNIT}}/2)', + '{{WRAPPER}} .eael-feature-list-items.connector-type-modern .eael-feature-list-item:not(:last-child):before' => 'height: calc(100% + {{SIZE}}{{UNIT}})', +// '{{WRAPPER}} .eael-feature-list-items .eael-feature-list-item' => 'margin-right: calc({{SIZE}}{{UNIT}}/2); margin-left: calc({{SIZE}}{{UNIT}}/2)', +// '{{WRAPPER}} .eael-feature-list-items' => 'margin-right: calc(-{{SIZE}}{{UNIT}}/2); margin-left: calc(-{{SIZE}}{{UNIT}}/2)', + 'body.rtl {{WRAPPER}} .eael-feature-list-items .eael-feature-list-item:after' => 'left: calc(-{{SIZE}}{{UNIT}}/2)', +// 'body:not(.rtl) {{WRAPPER}} .eael-feature-list-items .eael-feature-list-item:after' => 'right: calc(-{{SIZE}}{{UNIT}}/2)', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_connector_type', + [ + 'label' => esc_html__( 'Connector Type', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'default' => 'connector-type-classic', + 'label_block' => false, + 'options' => [ + 'connector-type-classic' => esc_html__( 'Classic', 'essential-addons-elementor' ), + 'connector-type-modern' => esc_html__( 'Modern', 'essential-addons-elementor' ), + ], + 'condition' => [ + 'eael_feature_list_connector' => 'yes', + 'eael_feature_list_icon_position!' => 'top', + ], + 'separator' => 'before', + ] + ); + + $this->add_control( + 'eael_feature_list_connector_styles', + [ + 'label' => esc_html__( 'Connector Styles', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'default' => 'solid', + 'label_block' => false, + 'options' => [ + 'solid' => esc_html__( 'Solid', 'essential-addons-elementor' ), + 'dashed' => esc_html__( 'Dashed', 'essential-addons-elementor' ), + 'dotted' => esc_html__( 'Dotted', 'essential-addons-elementor' ), + ], + 'condition' => [ + 'eael_feature_list_connector' => 'yes', + ], + 'selectors' => [ + '{{WRAPPER}} .connector-type-classic .connector' => 'border-style: {{VALUE}};', + '{{WRAPPER}} .connector-type-modern .eael-feature-list-item:before, {{WRAPPER}} .connector-type-modern .eael-feature-list-item:after' => 'border-style: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_connector_color', + [ + 'label' => esc_html__( 'Connector Color', 'essential-addons-elementor' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#3858f4', + 'selectors' => [ + '{{WRAPPER}} .connector-type-classic .connector' => 'border-color: {{VALUE}};', + '{{WRAPPER}} .connector-type-modern .eael-feature-list-item:before, {{WRAPPER}} .connector-type-modern .eael-feature-list-item:after' => 'border-color: {{VALUE}};', + ], + 'condition' => [ + 'eael_feature_list_connector' => 'yes', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_connector_width', + [ + 'label' => esc_html__( 'Connector Width', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'default' => [ + 'size' => 1, + ], + 'range' => [ + 'px' => [ + 'min' => 1, + 'max' => 5, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .connector-type-classic .connector' => 'border-width: {{SIZE}}{{UNIT}};', + '{{WRAPPER}}.-icon-position-left .connector-type-modern .eael-feature-list-item:before, {{WRAPPER}}.-icon-position-left .connector-type-modern .eael-feature-list-item:after' => 'border-width: {{SIZE}}{{UNIT}};', + '{{WRAPPER}}.-icon-position-right .connector-type-modern .eael-feature-list-item:before, {{WRAPPER}}.-icon-position-right .connector-type-modern .eael-feature-list-item:after' => 'border-width: {{SIZE}}{{UNIT}};', + ], + 'condition' => [ + 'eael_feature_list_connector' => 'yes', + ], + ] + ); + + $this->end_controls_section(); + + /** + * ------------------------------------------- + * Feature List Icon Style + * ------------------------------------------- + */ + $this->start_controls_section( + 'eael_section_feature_list_style_icon', + [ + 'label' => esc_html__( 'Icon', 'essential-addons-elementor' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'eael_feature_list_primary_color', + [ + 'label' => esc_html__( 'Primary Color', 'essential-addons-elementor' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#3858f4', + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-items.stacked .eael-feature-list-icon' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-feature-list-items.framed .eael-feature-list-icon' => 'color: {{VALUE}}; border-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_secondary_color', + [ + 'label' => esc_html__( 'Secondary Color', 'essential-addons-elementor' ), + 'type' => Controls_Manager::COLOR, + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-items.framed .eael-feature-list-icon' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-feature-list-items.stacked .eael-feature-list-icon' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_icon_space', + [ + 'label' => esc_html__( 'Spacing', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'range' => [ + 'px' => [ + 'min' => 0, + 'max' => 100, + ], + ], + 'devices' => [ 'desktop', 'tablet', 'mobile' ], + 'desktop_default' => [ + 'size' => 30, + 'unit' => 'px', + ], + 'tablet_default' => [ + 'size' => 20, + 'unit' => 'px', + ], + 'mobile_default' => [ + 'size' => 10, + 'unit' => 'px', + ], + 'selectors' => [ + '{{WRAPPER}}.-icon-position-left .eael-feature-list-content-box, {{WRAPPER}}.-icon-position-right .eael-feature-list-content-box, {{WRAPPER}}.-icon-position-top .eael-feature-list-content-box' => 'margin: {{SIZE}}{{UNIT}};', + '(mobile){{WRAPPER}}.-mobile-icon-position-left .eael-feature-list-content-box' => 'margin: {{SIZE}}{{UNIT}} 0 0 0 !important;', + '(mobile){{WRAPPER}}.-mobile-icon-position-right .eael-feature-list-content-box' => 'margin: {{SIZE}}{{UNIT}} 0 0 0 !important;', + ], + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_icon_size', + [ + 'label' => esc_html__( 'Size', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'default' => [ + 'size' => 30, + ], + 'range' => [ + 'px' => [ + 'min' => 6, + 'max' => 300, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-icon' => 'font-size: {{SIZE}}{{UNIT}};', + '{{WRAPPER}} .eael-feature-list-img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', + ], + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_icon_padding', + [ + 'label' => esc_html__( 'Padding', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'default' => [ + 'size' => 15, + ], + 'range' => [ + 'px' => [ + 'min' => 0, + 'max' => 50, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-icon' => 'padding: {{SIZE}}{{UNIT}};', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_icon_border_width', + [ + 'label' => esc_html__( 'Border Width', 'essential-addons-elementor' ), + 'type' => Controls_Manager::DIMENSIONS, + 'default' => [ + 'top' => '1', + 'right' => '1', + 'bottom' => '1', + 'left' => '1', + 'unit' => 'px', + ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-icon' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', + ], + 'condition' => [ + 'eael_feature_list_icon_shape_view' => 'framed', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_icon_border_radius', + [ + 'label' => esc_html__( 'Border Radius', 'essential-addons-elementor' ), + 'type' => Controls_Manager::DIMENSIONS, + 'size_units' => [ 'px', '%' ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', + ] + ] + ); + + $this->end_controls_section(); + + /** + * ------------------------------------------- + * Feature List Content Style + * ------------------------------------------- + */ + $this->start_controls_section( + 'eael_section_feature_list_style_content', + [ + 'label' => esc_html__( 'Content', 'essential-addons-elementor' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'eael_feature_list_heading_title', + [ + 'label' => esc_html__( 'Title', 'essential-addons-elementor' ), + 'type' => Controls_Manager::HEADING, + ] + ); + + $this->add_responsive_control( + 'eael_feature_list_title_bottom_space', + [ + 'label' => esc_html__( 'Spacing', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'default' => [ + 'size' => 10, + ], + 'range' => [ + 'px' => [ + 'min' => 0, + 'max' => 100, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', + ], + ] + ); + + $this->add_control( + 'eael_feature_list_title_color', + [ + 'label' => esc_html__( 'Color', 'essential-addons-elementor' ), + 'type' => Controls_Manager::COLOR, + 'default' => '#414247', + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-content-box .eael-feature-list-title' => 'color: {{VALUE}};', + ], + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_feature_list_title_typography', + 'selector' => '{{WRAPPER}} .eael-feature-list-content-box .eael-feature-list-title', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + ] + ); + + $this->add_control( + 'eael_feature_list_description', + [ + 'label' => esc_html__( 'Description', 'essential-addons-elementor' ), + 'type' => Controls_Manager::HEADING, + 'separator' => 'before', + ] + ); + + $this->add_control( + 'eael_feature_list_description_color', + [ + 'label' => esc_html__( 'Color', 'essential-addons-elementor' ), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .eael-feature-list-content-box .eael-feature-list-content' => 'color: {{VALUE}};', + ], + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_3, + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_feature_list_description_typography', + 'selector' => '{{WRAPPER}} .eael-feature-list-content-box .eael-feature-list-content', + 'scheme' => Scheme_Typography::TYPOGRAPHY_3, + ] + ); + + $this->end_controls_section(); + } + + protected function render() { + $settings = $this->get_settings_for_display(); + + $this->add_render_attribute( 'eael_feature_list', [ + 'id' => 'eael-feature-list-' . esc_attr( $this->get_id() ), + 'class' => [ + 'eael-feature-list-items', + $settings['eael_feature_list_icon_shape'], + $settings['eael_feature_list_icon_shape_view'], + $settings['eael_feature_list_connector_type'], + ] + ] ); + + if ( ( $settings['eael_feature_list_icon_position'] == 'top' ) && ( $settings['eael_feature_list_connector'] == 'yes' ) ) { + $this->add_render_attribute( 'eael_feature_list', 'class', 'connector-type-modern' ); + } + + $this->add_render_attribute( 'eael_feature_list_item', 'class', 'eael-feature-list-item' ); + + $padding = $settings['eael_feature_list_icon_padding']['size']; + $font = $settings['eael_feature_list_icon_size']['size']; + $border = $settings['eael_feature_list_icon_border_width']['right'] + $settings['eael_feature_list_icon_border_width']['left']; + + + if ( $settings['eael_feature_list_icon_shape'] == 'rhombus' ) { + $margin = 30; + $connector_width = ( $padding * 2 ) + $font + $border + $margin; + } else { + $connector_width = ( $padding * 2 ) + $font + $border; + } + + + if ( $settings['eael_feature_list_icon_position'] == 'left' ) { + + $connector = 'right: calc(100% - ' . $connector_width . 'px) !important; left: 0;'; + + } else { + $connector = 'left: calc(100% - ' . $connector_width . 'px) !important; right: 0;'; + } + + + ?> + + + widgets_manager->register_widget_type( new Widget_Eael_Feature_List() ); \ No newline at end of file diff --git a/elements/flipbox/flipbox.php b/elements/flipbox/flipbox.php index 8fa875550..90131dcf6 100755 --- a/elements/flipbox/flipbox.php +++ b/elements/flipbox/flipbox.php @@ -96,7 +96,6 @@ protected function _register_controls() { 'label' => esc_html__( 'Icon', 'essential-addons-elementor' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-snowflake-o', - 'separator' => 'before', 'condition' => [ 'eael_flipbox_img_or_icon' => 'icon' ] @@ -116,7 +115,6 @@ protected function _register_controls() { 'max' => 500, ], ], - 'separator' => 'before', 'selectors' => [ '{{WRAPPER}} .eael-elements-flip-box-front-container .eael-elements-flip-box-icon-image > img' => 'width: {{SIZE}}px;' ], @@ -200,9 +198,8 @@ protected function _register_controls() { 'max' => 500, ], ], - 'separator' => 'before', 'selectors' => [ - '{{WRAPPER}} .eael-elements-flip-box-rear-container .flipbox-back-image-icon > img' => 'width: {{SIZE}}px;' + '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image > img' => 'width: {{SIZE}}px;' ], 'condition' => [ 'eael_flipbox_img_or_icon_back' => 'img' @@ -237,80 +234,71 @@ protected function _register_controls() { 'label' => esc_html__( 'Flipbox Content', 'essential-addons-elementor' ), ] ); - $this->add_responsive_control( - 'eael_flipbox_front_or_back_content', - [ - 'label' => esc_html__( 'Front or Back Content', 'essential-addons-elementor' ), - 'type' => Controls_Manager::CHOOSE, - 'label_block' => true, - 'options' => [ - 'front' => [ - 'title' => esc_html__( 'Front Content', 'essential-addons-elementor' ), - 'icon' => 'fa fa-reply', - ], - 'back' => [ - 'title' => esc_html__( 'Back Content', 'essential-addons-elementor' ), - 'icon' => 'fa fa-share', - ], - ], - 'default' => 'front', - ] - ); - /** - * Condition: 'eael_flipbox_front_or_back_content' => 'front' - */ - $this->add_control( - 'eael_flipbox_front_title', - [ - 'label' => esc_html__( 'Front Title', 'essential-addons-elementor' ), - 'type' => Controls_Manager::TEXT, - 'label_block' => true, - 'default' => esc_html__( 'Elementor Flipbox', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_flipbox_front_or_back_content' => 'front' + + $this->start_controls_tabs('eael_flipbox_content_tabs'); + + $this->start_controls_tab( + 'eael_flipbox_content_front', + [ + 'label' => __( 'Front', 'essential-addons-elementor' ) ] - ] - ); - $this->add_control( - 'eael_flipbox_front_text', - [ - 'label' => esc_html__( 'Front Text', 'essential-addons-elementor' ), - 'type' => Controls_Manager::WYSIWYG, - 'label_block' => true, - 'default' => __( 'This is front-end content.', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_flipbox_front_or_back_content' => 'front' + ); + + $this->add_control( + 'eael_flipbox_front_title', + [ + 'label' => esc_html__( 'Front Title', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXT, + 'label_block' => true, + 'default' => esc_html__( 'Front Title', 'essential-addons-elementor' ), ] - ] - ); - /** - * Condition: 'eael_flipbox_front_or_back_content' => 'back' - */ - $this->add_control( - 'eael_flipbox_back_title', - [ - 'label' => esc_html__( 'Back Title', 'essential-addons-elementor' ), - 'type' => Controls_Manager::TEXT, - 'label_block' => true, - 'default' => esc_html__( 'Elementor Flipbox', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_flipbox_front_or_back_content' => 'back' + ); + + $this->add_control( + 'eael_flipbox_front_text', + [ + 'label' => esc_html__( 'Front Text', 'essential-addons-elementor' ), + 'type' => Controls_Manager::WYSIWYG, + 'label_block' => true, + 'default' => __( 'This is front side content.', 'essential-addons-elementor' ), ] - ] - ); - $this->add_control( - 'eael_flipbox_back_text', - [ - 'label' => esc_html__( 'Back Text', 'essential-addons-elementor' ), - 'type' => Controls_Manager::WYSIWYG, - 'label_block' => true, - 'default' => __( 'This is back-end content.', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_flipbox_front_or_back_content' => 'back' + ); + + $this->end_controls_tab(); + + + $this->start_controls_tab( + 'eael_flipbox_content_back', + [ + 'label' => __( 'Back', 'essential-addons-elementor' ) ] - ] - ); - $this->add_responsive_control( + ); + + $this->add_control( + 'eael_flipbox_back_title', + [ + 'label' => esc_html__( 'Back Title', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXT, + 'label_block' => true, + 'default' => esc_html__( 'Back Title', 'essential-addons-elementor' ), + ] + ); + + $this->add_control( + 'eael_flipbox_back_text', + [ + 'label' => esc_html__( 'Back Text', 'essential-addons-elementor' ), + 'type' => Controls_Manager::WYSIWYG, + 'label_block' => true, + 'default' => __( 'This is back side content.', 'essential-addons-elementor' ), + ] + ); + + $this->end_controls_tab(); + + $this->end_controls_tabs(); + + $this->add_control( 'eael_flipbox_content_alignment', [ 'label' => esc_html__( 'Content Alignment', 'essential-addons-elementor' ), @@ -334,6 +322,7 @@ protected function _register_controls() { 'prefix_class' => 'eael-flipbox-content-align-', ] ); + $this->end_controls_section(); /** @@ -497,7 +486,7 @@ protected function _register_controls() { $this->add_responsive_control( 'eael_flipbox_front_back_padding', [ - 'label' => esc_html__( 'Fornt / Back Content Padding', 'essential-addons-elementor' ), + 'label' => esc_html__( 'Content Padding', 'essential-addons-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ @@ -601,7 +590,7 @@ protected function _register_controls() { ], 'selectors' => [ '{{WRAPPER}} .eael-elements-flip-box-icon-image img' => 'border-radius: {{SIZE}}px;', - '{{WRAPPER}} .flipbox-back-image-icon img' => 'border-radius: {{SIZE}}px;', + '{{WRAPPER}} .eael-elements-flip-box-icon-image img' => 'border-radius: {{SIZE}}px;', ], 'condition' => [ 'eael_flipbox_img_or_icon' => 'img', @@ -616,7 +605,7 @@ protected function _register_controls() { * ------------------------------------------- * Tab Style (Flip Box Icon Style) * ------------------------------------------- - */ + */ $this->start_controls_section( 'eael_section_flipbox_icon_style_settings', [ @@ -628,56 +617,122 @@ protected function _register_controls() { ] ); - $this->add_group_control( - Group_Control_Border::get_type(), + $this->start_controls_tabs('eael_section_icon_style_settings'); + $this->start_controls_tab('eael_section_icon_front_style_settings', [ + 'label' => esc_html__( 'Front', 'essential-addons-elementor' ) + ]); + + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'eael_flipbox_icon_front_border', + 'label' => esc_html__( 'Border', 'essential-addons-elementor' ), + 'selector' => '{{WRAPPER}} .eael-elements-flip-box-front-container .eael-elements-flip-box-icon-image', + 'condition' => [ + 'eael_flipbox_img_or_icon' => 'icon' + ] + ] + ); + + $this->add_responsive_control( + 'eael_flipbox_icon_front_padding', [ - 'name' => 'eael_flipbox_border', - 'label' => esc_html__( 'Border', 'essential-addons-elementor' ), - 'selector' => '{{WRAPPER}} .eael-elements-flip-box-icon-image', + 'label' => esc_html__( 'Padding', 'essential-addons-elementor' ), + 'type' => Controls_Manager::DIMENSIONS, + 'size_units' => [ 'px', 'em' ], + 'selectors' => [ + '{{WRAPPER}} .eael-elements-flip-box-front-container .eael-elements-flip-box-icon-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' + ], + ] + ); + + $this->add_control( + 'eael_flipbox_icon_front_border_radius', + [ + 'label' => esc_html__( 'Border Radius', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'size_units' => [ 'px', '%' ], + 'range' => [ + 'px' => [ + 'min' => 0, + 'step' => 1, + 'max' => 500, + ], + '%' => [ + 'min' => 0, + 'step' => 3, + 'max' => 100 + ] + ], + 'selectors' => [ + '{{WRAPPER}} .eael-elements-flip-box-front-container .eael-elements-flip-box-icon-image' => 'border-radius: {{SIZE}}{{UNIT}};', + ], 'condition' => [ 'eael_flipbox_img_or_icon' => 'icon' ] ] - ); - - $this->add_responsive_control( - 'eael_flipbox_icon_padding', - [ - 'label' => esc_html__( 'Padding', 'essential-addons-elementor' ), - 'type' => Controls_Manager::DIMENSIONS, - 'size_units' => [ 'px', 'em' ], - 'selectors' => [ - '{{WRAPPER}} .eael-elements-flip-box-icon-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' - ], - ] - ); + ); + + $this->end_controls_tab(); + + $this->start_controls_tab('eael_section_icon_back_style_settings', [ + 'label' => esc_html__( 'Back', 'essential-addons-elementor' ) + ]); - $this->add_control( - 'eael_flipbox_icon_border_radius', - [ - 'label' => esc_html__( 'Border Radius', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SLIDER, - 'size_units' => [ 'px', '%' ], - 'range' => [ - 'px' => [ - 'min' => 0, - 'step' => 1, - 'max' => 500, + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'eael_flipbox_icon_back_border', + 'label' => esc_html__( 'Border', 'essential-addons-elementor' ), + 'selector' => '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image', + 'condition' => [ + 'eael_flipbox_img_or_icon' => 'icon' + ] + ] + ); + + $this->add_responsive_control( + 'eael_flipbox_icon_back_padding', + [ + 'label' => esc_html__( 'Padding', 'essential-addons-elementor' ), + 'type' => Controls_Manager::DIMENSIONS, + 'size_units' => [ 'px', 'em' ], + 'selectors' => [ + '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' + ], + ] + ); + + $this->add_control( + 'eael_flipbox_icon_back_border_radius', + [ + 'label' => esc_html__( 'Border Radius', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SLIDER, + 'size_units' => [ 'px', '%' ], + 'range' => [ + 'px' => [ + 'min' => 0, + 'step' => 1, + 'max' => 500, + ], + '%' => [ + 'min' => 0, + 'step' => 3, + 'max' => 100 + ] ], - '%' => [ - 'min' => 0, - 'step' => 3, - 'max' => 100 + 'selectors' => [ + '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image' => 'border-radius: {{SIZE}}{{UNIT}};', + ], + 'condition' => [ + 'eael_flipbox_img_or_icon' => 'icon' ] - ], - 'selectors' => [ - '{{WRAPPER}} .eael-elements-flip-box-icon-image' => 'border-radius: {{SIZE}}{{UNIT}};', - ], - 'condition' => [ - 'eael_flipbox_img_or_icon' => 'icon' ] - ] - ); + ); + + $this->end_controls_tab(); + $this->end_controls_tabs(); + $this->end_controls_section(); /** @@ -695,7 +750,7 @@ protected function _register_controls() { $this->start_controls_tabs('eael_section_flipbox_typo_style_settings'); $this->start_controls_tab('eael_section_flipbox_typo_style_front_settings', [ - 'label' => esc_html__( 'Front Content', 'essential-addons-elementor' ) + 'label' => esc_html__( 'Front', 'essential-addons-elementor' ) ]); /** @@ -796,7 +851,7 @@ protected function _register_controls() { $this->end_controls_tab(); $this->start_controls_tab('eael_section_flipbox_typo_style_back_settings', [ - 'label' => esc_html__( 'Back Content', 'essential-addons-elementor' ) + 'label' => esc_html__( 'Back', 'essential-addons-elementor' ) ]); /** @@ -817,7 +872,7 @@ protected function _register_controls() { 'type' => Controls_Manager::COLOR, 'default' => '#fff', 'selectors' => [ - '{{WRAPPER}} .eael-elements-flip-box-rear-container .flipbox-back-image-icon i' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image i' => 'color: {{VALUE}};', ] ] ); @@ -826,7 +881,7 @@ protected function _register_controls() { Group_Control_Typography::get_type(), [ 'name' => 'eael_flipbox_back_icon_typography', - 'selector' => '{{WRAPPER}} .eael-elements-flip-box-rear-container .flipbox-back-image-icon i' + 'selector' => '{{WRAPPER}} .eael-elements-flip-box-rear-container .eael-elements-flip-box-icon-image i' ] ); @@ -1167,7 +1222,7 @@ protected function render() {
-
+
get_render_attribute_string('flipbox-back-icon-image-container'); ?>> diff --git a/elements/product-grid/product-grid.php b/elements/product-grid/product-grid.php index b680644bb..a0fa81d98 100755 --- a/elements/product-grid/product-grid.php +++ b/elements/product-grid/product-grid.php @@ -2,517 +2,527 @@ namespace Elementor; if (!defined('ABSPATH')) { - exit; + exit; } // If this file is called directly, abort. -class Widget_Eael_Product_Grid extends Widget_Base { - - public function get_name() { - return 'eicon-woocommerce'; - } - - public function get_title() { - return esc_html__('EA Product Grid', 'essential-addons-elementor'); - } - - public function get_icon() { - return 'eicon-woocommerce'; - } - - public function get_categories() { - return ['essential-addons-elementor']; - } - - protected function _register_controls() { - - // Content Controls - $this->start_controls_section( - 'eael_section_product_grid_settings', - [ - 'label' => esc_html__('Product Settings', 'essential-addons-elementor'), - ] - ); - - $this->add_control( - 'eael_product_grid_product_filter', - [ - 'label' => esc_html__('Filter By', 'essential-addons-elementor'), - 'type' => Controls_Manager::SELECT, - 'default' => 'recent-products', - 'options' => [ - 'recent-products' => esc_html__('Recent Products', 'essential-addons-elementor'), - 'featured-products' => esc_html__('Featured Products', 'essential-addons-elementor'), - 'best-selling-products' => esc_html__('Best Selling Products', 'essential-addons-elementor'), - 'sale-products' => esc_html__('Sale Products', 'essential-addons-elementor'), - 'top-products' => esc_html__('Top Rated Products', 'essential-addons-elementor'), - ], - ] - ); - - $this->add_control( - 'eael_product_grid_column', - [ - 'label' => esc_html__('Columns', 'essential-addons-elementor'), - 'type' => Controls_Manager::SELECT, - 'default' => '4', - 'options' => [ - '1' => esc_html__('1', 'essential-addons-elementor'), - '2' => esc_html__('2', 'essential-addons-elementor'), - '3' => esc_html__('3', 'essential-addons-elementor'), - '4' => esc_html__('4', 'essential-addons-elementor'), - '5' => esc_html__('5', 'essential-addons-elementor'), - '6' => esc_html__('6', 'essential-addons-elementor'), - ], - ] - ); - - $this->add_control( - 'eael_product_grid_products_count', - [ - 'label' => __('Products Count', 'essential-addons-elementor'), - 'type' => Controls_Manager::NUMBER, - 'default' => 4, - 'min' => 1, - 'max' => 1000, - 'step' => 1, - ] - ); - - $this->add_control( - 'eael_product_grid_categories', - [ - 'label' => esc_html__('Product Categories', 'essential-addons-elementor'), - 'type' => Controls_Manager::SELECT2, - 'label_block' => true, - 'multiple' => true, - 'options' => eael_woocommerce_product_categories(), - ] - ); - - $this->add_control( - 'eael_product_grid_style_preset', - [ - 'label' => esc_html__( 'Style Preset', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SELECT, - 'default' => 'eael-product-simple', - 'options' => [ - 'eael-product-default' => esc_html__( 'Default', 'essential-addons-elementor' ), - 'eael-product-simple' => esc_html__( 'Simple Style', 'essential-addons-elementor' ), - 'eael-product-reveal' => esc_html__( 'Reveal Style', 'essential-addons-elementor' ), - 'eael-product-overlay' => esc_html__( 'Overlay Style', 'essential-addons-elementor' ), - ], - ] - ); - - $this->add_control( - 'eael_product_grid_rating', - [ - 'label' => esc_html__('Show Product Rating?', 'essential-addons-elementor'), - 'type' => Controls_Manager::SWITCHER, - 'return_value' => 'yes', - 'default' => 'yes', - ] - ); - - $this->end_controls_section(); - - $this->start_controls_section( - 'eael_product_grid_styles', - [ - 'label' => esc_html__('Products Styles', 'essential-addons-elementor'), - 'tab' => Controls_Manager::TAB_STYLE, - ] - ); - - $this->add_control( - 'eael_product_grid_background_color', - [ - 'label' => esc_html__('Content Background Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#fff', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'background-color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Border::get_type(), - [ - 'name' => 'eael_peoduct_grid_border', - 'fields_options' => [ - 'border' => [ - 'default' => 'solid', - ], - 'width' => [ - 'default' => [ - 'top' => '1', - 'right' => '1', - 'bottom' => '1', - 'left' => '1', - 'isLinked' => false, - ], - ], - 'color' => [ - 'default' => '#eee', - ], - ], - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product', - 'condition' => [ - 'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple', 'eael-product-overlay'] +class Widget_Eael_Product_Grid extends Widget_Base +{ + + public function get_name() + { + return 'eicon-woocommerce'; + } + + public function get_title() + { + return esc_html__('EA Product Grid', 'essential-addons-elementor'); + } + + public function get_icon() + { + return 'eicon-woocommerce'; + } + + public function get_categories() + { + return ['essential-addons-elementor']; + } + + protected function _register_controls() + { + + // Content Controls + $this->start_controls_section( + 'eael_section_product_grid_settings', + [ + 'label' => esc_html__('Product Settings', 'essential-addons-elementor'), + ] + ); + + $this->add_control( + 'eael_product_grid_product_filter', + [ + 'label' => esc_html__('Filter By', 'essential-addons-elementor'), + 'type' => Controls_Manager::SELECT, + 'default' => 'recent-products', + 'options' => [ + 'recent-products' => esc_html__('Recent Products', 'essential-addons-elementor'), + 'featured-products' => esc_html__('Featured Products', 'essential-addons-elementor'), + 'best-selling-products' => esc_html__('Best Selling Products', 'essential-addons-elementor'), + 'sale-products' => esc_html__('Sale Products', 'essential-addons-elementor'), + 'top-products' => esc_html__('Top Rated Products', 'essential-addons-elementor'), + ], + ] + ); + + $this->add_control( + 'eael_product_grid_column', + [ + 'label' => esc_html__('Columns', 'essential-addons-elementor'), + 'type' => Controls_Manager::SELECT, + 'default' => '4', + 'options' => [ + '1' => esc_html__('1', 'essential-addons-elementor'), + '2' => esc_html__('2', 'essential-addons-elementor'), + '3' => esc_html__('3', 'essential-addons-elementor'), + '4' => esc_html__('4', 'essential-addons-elementor'), + '5' => esc_html__('5', 'essential-addons-elementor'), + '6' => esc_html__('6', 'essential-addons-elementor'), + ], + ] + ); + + $this->add_control( + 'eael_product_grid_products_count', + [ + 'label' => __('Products Count', 'essential-addons-elementor'), + 'type' => Controls_Manager::NUMBER, + 'default' => 4, + 'min' => 1, + 'max' => 1000, + 'step' => 1, + ] + ); + + $this->add_control( + 'eael_product_grid_categories', + [ + 'label' => esc_html__('Product Categories', 'essential-addons-elementor'), + 'type' => Controls_Manager::SELECT2, + 'label_block' => true, + 'multiple' => true, + 'options' => eael_woocommerce_product_categories(), + ] + ); + + $this->add_control( + 'eael_product_grid_style_preset', + [ + 'label' => esc_html__('Style Preset', 'essential-addons-elementor'), + 'type' => Controls_Manager::SELECT, + 'default' => 'eael-product-simple', + 'options' => [ + 'eael-product-default' => esc_html__('Default', 'essential-addons-elementor'), + 'eael-product-simple' => esc_html__('Simple Style', 'essential-addons-elementor'), + 'eael-product-reveal' => esc_html__('Reveal Style', 'essential-addons-elementor'), + 'eael-product-overlay' => esc_html__('Overlay Style', 'essential-addons-elementor'), + ], + ] + ); + + $this->add_control( + 'eael_product_grid_rating', + [ + 'label' => esc_html__('Show Product Rating?', 'essential-addons-elementor'), + 'type' => Controls_Manager::SWITCHER, + 'return_value' => 'yes', + 'default' => 'yes', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'eael_product_grid_styles', + [ + 'label' => esc_html__('Products Styles', 'essential-addons-elementor'), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'eael_product_grid_background_color', + [ + 'label' => esc_html__('Content Background Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#fff', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'eael_peoduct_grid_border', + 'fields_options' => [ + 'border' => [ + 'default' => 'solid', + ], + 'width' => [ + 'default' => [ + 'top' => '1', + 'right' => '1', + 'bottom' => '1', + 'left' => '1', + 'isLinked' => false, + ], + ], + 'color' => [ + 'default' => '#eee', + ], + ], + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product', + 'condition' => [ + 'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple', 'eael-product-overlay'], + ], + ] + ); + + $this->add_control( + 'eael_peoduct_grid_border_radius', + [ + 'label' => esc_html__('Border Radius', 'essential-addons-elementor'), + 'type' => Controls_Manager::DIMENSIONS, + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', + ], + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'eael_section_product_grid_typography', + [ + 'label' => esc_html__('Color & Typography', 'essential-addons-elementor'), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'eael_product_grid_product_title_heading', + [ + 'label' => __('Product Title', 'essential-addons-elementor'), + 'type' => Controls_Manager::HEADING, + ] + ); + + $this->add_control( + 'eael_product_grid_product_title_color', + [ + 'label' => esc_html__('Product Title Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#272727', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_product_grid_product_title_typography', + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title', + ] + ); + + $this->add_control( + 'eael_product_grid_product_price_heading', + [ + 'label' => __('Product Price', 'essential-addons-elementor'), + 'type' => Controls_Manager::HEADING, + ] + ); + + $this->add_control( + 'eael_product_grid_product_price_color', + [ + 'label' => esc_html__('Product Price Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#272727', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_product_grid_product_price_typography', + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price', + ] + ); + + $this->add_control( + 'eael_product_grid_product_rating_heading', + [ + 'label' => __('Star Rating', 'essential-addons-elementor'), + 'type' => Controls_Manager::HEADING, + ] + ); + + $this->add_control( + 'eael_product_grid_product_rating_color', + [ + 'label' => esc_html__('Rating Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#f2b01e', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating::before' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating span::before' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_product_grid_product_rating_typography', + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating', + ] + ); + + $this->add_control( + 'eael_product_grid_sale_badge_heading', + [ + 'label' => __('Sale Badge', 'essential-addons-elementor'), + 'type' => Controls_Manager::HEADING, + ] + ); + + $this->add_control( + 'eael_product_grid_sale_badge_color', + [ + 'label' => esc_html__('Sale Badge Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#fff', + 'selectors' => [ + '{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_product_grid_sale_badge_background', + [ + 'label' => esc_html__('Sale Badge Background', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#ff2a13', + 'selectors' => [ + '{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price ins' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_product_grid_sale_badge_typography', + 'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .onsale', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'eael_section_product_grid_add_to_cart_styles', + [ + 'label' => esc_html__('Add to Cart Button Styles', 'essential-addons-elementor'), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->start_controls_tabs('eael_product_grid_add_to_cart_style_tabs'); + + $this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-elementor')]); + + $this->add_control( + 'eael_product_grid_add_to_cart_color', + [ + 'label' => esc_html__('Button Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#fff', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_product_grid_add_to_cart_background', + [ + 'label' => esc_html__('Button Background Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#333', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'eael_product_grid_add_to_cart_border', + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart', + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'eael_product_grid_add_to_cart_typography', + 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button', + 'condition' => [ + 'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple'], + ], + ] + ); + + $this->end_controls_tab(); + + $this->start_controls_tab('eael_product_grid_add_to_cart_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-elementor')]); + + $this->add_control( + 'eael_product_grid_add_to_cart_hover_color', + [ + 'label' => esc_html__('Button Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#fff', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_product_grid_add_to_cart_hover_background', + [ + 'label' => esc_html__('Button Background Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '#333', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'background-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'eael_product_grid_add_to_cart_hover_border_color', + [ + 'label' => esc_html__('Border Color', 'essential-addons-elementor'), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'border-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'border-color: {{VALUE}};', + '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'border-color: {{VALUE}};', + ], + ] + ); + + $this->end_controls_tab(); + + $this->end_controls_tabs(); + + $this->end_controls_section(); + + } + + protected function render() + { + $settings = $this->get_settings(); + $show_rating = $settings['eael_product_grid_rating']; + + if ($settings['eael_product_grid_style_preset'] == 'eael-product-simple') { + $grid_layout = 'eael-product-simple'; + } else if ($settings['eael_product_grid_style_preset'] == 'eael-product-reveal') { + $grid_layout = 'eael-product-reveal'; + } else if ($settings['eael_product_grid_style_preset'] == 'eael-product-overlay') { + $grid_layout = 'eael-product-overlay'; + } else { + $grid_layout = 'eael-product-default'; + } + + $args = [ + 'post_type' => 'product', + 'posts_per_page' => $settings['eael_product_grid_products_count'] ?: 4, + 'order' => 'DESC', + ]; + + if (!empty($settings['eael_product_grid_categories'])) { + $args['tax_query'] = [ + [ + 'taxonomy' => 'product_cat', + 'field' => 'slug', + 'terms' => $settings['eael_product_grid_categories'], + 'operator' => 'IN', + ], + ]; + } + + if ($settings['eael_product_grid_product_filter'] == 'featured-products') { + $args['tax_query'] = [ + [ + 'taxonomy' => 'product_visibility', + 'field' => 'name', + 'terms' => 'featured' ] - ] - ); - - $this->add_control( - 'eael_peoduct_grid_border_radius', - [ - 'label' => esc_html__('Border Radius', 'essential-addons-elementor'), - 'type' => Controls_Manager::DIMENSIONS, - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', - ], - ] - ); - - $this->end_controls_section(); - - $this->start_controls_section( - 'eael_section_product_grid_typography', - [ - 'label' => esc_html__('Color & Typography', 'essential-addons-elementor'), - 'tab' => Controls_Manager::TAB_STYLE, - ] - ); - - $this->add_control( - 'eael_product_grid_product_title_heading', - [ - 'label' => __('Product Title', 'essential-addons-elementor'), - 'type' => Controls_Manager::HEADING, - ] - ); - - $this->add_control( - 'eael_product_grid_product_title_color', - [ - 'label' => esc_html__('Product Title Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#272727', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Typography::get_type(), - [ - 'name' => 'eael_product_grid_product_title_typography', - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title', - ] - ); - - $this->add_control( - 'eael_product_grid_product_price_heading', - [ - 'label' => __('Product Price', 'essential-addons-elementor'), - 'type' => Controls_Manager::HEADING, - ] - ); - - $this->add_control( - 'eael_product_grid_product_price_color', - [ - 'label' => esc_html__('Product Price Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#272727', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Typography::get_type(), - [ - 'name' => 'eael_product_grid_product_price_typography', - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price', - ] - ); - - $this->add_control( - 'eael_product_grid_product_rating_heading', - [ - 'label' => __('Star Rating', 'essential-addons-elementor'), - 'type' => Controls_Manager::HEADING, - ] - ); - - $this->add_control( - 'eael_product_grid_product_rating_color', - [ - 'label' => esc_html__('Rating Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#f2b01e', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating::before' => 'color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating span::before' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Typography::get_type(), - [ - 'name' => 'eael_product_grid_product_rating_typography', - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating', - ] - ); - - $this->add_control( - 'eael_product_grid_sale_badge_heading', - [ - 'label' => __('Sale Badge', 'essential-addons-elementor'), - 'type' => Controls_Manager::HEADING, - ] - ); - - $this->add_control( - 'eael_product_grid_sale_badge_color', - [ - 'label' => esc_html__('Sale Badge Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#fff', - 'selectors' => [ - '{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_control( - 'eael_product_grid_sale_badge_background', - [ - 'label' => esc_html__('Sale Badge Background', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#ff2a13', - 'selectors' => [ - '{{WRAPPER}} .woocommerce ul.products li.product .onsale' => 'background-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price ins' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Typography::get_type(), - [ - 'name' => 'eael_product_grid_sale_badge_typography', - 'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .onsale', - ] - ); - - $this->end_controls_section(); - - $this->start_controls_section( - 'eael_section_product_grid_add_to_cart_styles', - [ - 'label' => esc_html__('Add to Cart Button Styles', 'essential-addons-elementor'), - 'tab' => Controls_Manager::TAB_STYLE, - ] - ); - - $this->start_controls_tabs('eael_product_grid_add_to_cart_style_tabs'); - - $this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-elementor')]); - - $this->add_control( - 'eael_product_grid_add_to_cart_color', - [ - 'label' => esc_html__('Button Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#fff', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_control( - 'eael_product_grid_add_to_cart_background', - [ - 'label' => esc_html__('Button Background Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#333', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'background-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'background-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'background-color: {{VALUE}};', - ], - ] - ); - - $this->add_group_control( - Group_Control_Border::get_type(), - [ - 'name' => 'eael_product_grid_add_to_cart_border', - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart', - ] - ); - - $this->add_group_control( - Group_Control_Typography::get_type(), - [ - 'name' => 'eael_product_grid_add_to_cart_typography', - 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button', - 'condition' => [ - 'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple'] - ], - ] - ); - - $this->end_controls_tab(); - - $this->start_controls_tab('eael_product_grid_add_to_cart_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-elementor')]); - - $this->add_control( - 'eael_product_grid_add_to_cart_hover_color', - [ - 'label' => esc_html__('Button Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#fff', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'color: {{VALUE}};', - ], - ] - ); - - $this->add_control( - 'eael_product_grid_add_to_cart_hover_background', - [ - 'label' => esc_html__('Button Background Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '#333', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'background-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'background-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'background-color: {{VALUE}};', - ], - ] - ); - - $this->add_control( - 'eael_product_grid_add_to_cart_hover_border_color', - [ - 'label' => esc_html__('Border Color', 'essential-addons-elementor'), - 'type' => Controls_Manager::COLOR, - 'default' => '', - 'selectors' => [ - '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'border-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'border-color: {{VALUE}};', - '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'border-color: {{VALUE}};', - ], - ] - ); - - $this->end_controls_tab(); - - $this->end_controls_tabs(); - - $this->end_controls_section(); - - } - - protected function render() { - $settings = $this->get_settings(); - $show_rating = $settings['eael_product_grid_rating']; - - if ($settings['eael_product_grid_style_preset'] == 'eael-product-simple') { - $grid_layout = 'eael-product-simple'; - } else if ($settings['eael_product_grid_style_preset'] == 'eael-product-reveal') { - $grid_layout = 'eael-product-reveal'; - } else if ($settings['eael_product_grid_style_preset'] == 'eael-product-overlay') { - $grid_layout = 'eael-product-overlay'; - } else { - $grid_layout = 'eael-product-default'; - } - - $args = [ - 'post_type' => 'product', - 'posts_per_page' => $settings['eael_product_grid_products_count'] ?: 4, - 'order' => 'DESC', - ]; - - if (!empty($settings['eael_product_grid_categories'])) { - $args['tax_query'] = [ - [ - 'taxonomy' => 'product_cat', - 'field' => 'slug', - 'terms' => $settings['eael_product_grid_categories'], - 'operator' => 'IN', - ], - ]; - } - - if ($settings['eael_product_grid_product_filter'] == 'featured-products') { - $args['tax_query'] = [ - 'taxonomy' => 'product_visibility', - 'field' => 'name', - 'terms' => 'featured', - ]; - } else if ($settings['eael_product_grid_product_filter'] == 'best-selling-products') { - $args['meta_key'] = 'total_sales'; - $args['orderby'] = 'meta_value_num'; - $args['order'] = 'DESC'; - } else if ($settings['eael_product_grid_product_filter'] == 'sale-products') { - $args['meta_query'] = [ - 'relation' => 'OR', - [ - 'key' => '_sale_price', - 'value' => 0, - 'compare' => '>', - 'type' => 'numeric', - ], [ - 'key' => '_min_variation_sale_price', - 'value' => 0, - 'compare' => '>', - 'type' => 'numeric', - ], - ]; - } else if ($settings['eael_product_grid_product_filter'] == 'top-products') { - $args['meta_key'] = '_wc_average_rating'; - $args['orderby'] = 'meta_value_num'; - $args['order'] = 'DESC'; - } - - global $woocommerce_loop; - $woocommerce_loop['loop'] = $woocommerce_loop['columns'] = $settings['eael_product_grid_column']; - - echo '
+ ]; + } else if ($settings['eael_product_grid_product_filter'] == 'best-selling-products') { + $args['meta_key'] = 'total_sales'; + $args['orderby'] = 'meta_value_num'; + $args['order'] = 'DESC'; + } else if ($settings['eael_product_grid_product_filter'] == 'sale-products') { + $args['meta_query'] = [ + 'relation' => 'OR', + [ + 'key' => '_sale_price', + 'value' => 0, + 'compare' => '>', + 'type' => 'numeric', + ], [ + 'key' => '_min_variation_sale_price', + 'value' => 0, + 'compare' => '>', + 'type' => 'numeric', + ], + ]; + } else if ($settings['eael_product_grid_product_filter'] == 'top-products') { + $args['meta_key'] = '_wc_average_rating'; + $args['orderby'] = 'meta_value_num'; + $args['order'] = 'DESC'; + } + + global $woocommerce_loop; + $woocommerce_loop['loop'] = $woocommerce_loop['columns'] = $settings['eael_product_grid_column']; + + echo '
    '; - $query = new \WP_Query($args); - if ($query->have_posts()) { - while ($query->have_posts()): $query->the_post(); - include ESSENTIAL_ADDONS_EL_PATH . 'includes/templates/product-loop.php'; - endwhile; - } else { - echo __('No products found'); - } - wp_reset_postdata(); - unset($woocommerce_loop); - echo '
+ $query = new \WP_Query($args); + if ($query->have_posts()) { + while ($query->have_posts()): $query->the_post(); + include ESSENTIAL_ADDONS_EL_PATH . 'includes/templates/product-loop.php'; + endwhile; + } else { + echo __('No products found'); + } + wp_reset_postdata(); + unset($woocommerce_loop); + echo '
'; - } + } - protected function content_template() { + protected function content_template() + { - } + } } -Plugin::instance()->widgets_manager->register_widget_type(new Widget_Eael_Product_Grid()); \ No newline at end of file +Plugin::instance()->widgets_manager->register_widget_type(new Widget_Eael_Product_Grid()); diff --git a/essential_adons_elementor.php b/essential_adons_elementor.php index dac0b7313..813b71d5f 100755 --- a/essential_adons_elementor.php +++ b/essential_adons_elementor.php @@ -4,7 +4,7 @@ * Description: The ultimate elements library for Elementor page builder plugin for WordPress. * Plugin URI: https://essential-addons.com/elementor/ * Author: WPDeveloper - * Version: 2.9.3 + * Version: 2.9.6 * Author URI: https://wpdeveloper.net/ * * Text Domain: essential-addons-elementor @@ -16,8 +16,8 @@ define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) ); define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) ); define( 'ESSENTIAL_ADDONS_EL_ROOT', __FILE__ ); -define( 'ESSENTIAL_ADDONS_VERSION', '2.9.3' ); -define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.3' ); +define( 'ESSENTIAL_ADDONS_VERSION', '2.9.6' ); +define( 'ESSENTIAL_ADDONS_STABLE_VERSION', '2.9.6' ); define( 'ESSENTIAL_ADDONS_BASENAME', plugin_basename( __FILE__ ) ); @@ -28,7 +28,7 @@ require_once ESSENTIAL_ADDONS_EL_PATH.'includes/maintennance.php'; require_once ESSENTIAL_ADDONS_EL_PATH.'includes/eael-rollback.php'; require_once ESSENTIAL_ADDONS_EL_PATH.'admin/settings.php'; -require_once ESSENTIAL_ADDONS_EL_PATH .'includes/extensions.php'; +require_once ESSENTIAL_ADDONS_EL_PATH.'includes/extensions.php'; /** * This function will return true for all activated modules @@ -37,7 +37,7 @@ */ function eael_activated_modules() { - $eael_default_keys = [ 'contact-form-7', 'count-down', 'creative-btn', 'fancy-text', 'img-comparison', 'instagram-gallery', 'interactive-promo', 'lightbox', 'post-block', 'post-grid', 'post-timeline', 'product-grid', 'team-members', 'testimonial-slider', 'testimonials', 'testimonials', 'weforms', 'static-product', 'call-to-action', 'flip-box', 'info-box', 'dual-header', 'price-table', 'flip-carousel', 'interactive-cards', 'ninja-form', 'gravity-form', 'caldera-form', 'wisdom_registered_setting', 'twitter-feed', 'facebook-feed', 'data-table', 'filter-gallery', 'image-accordion','content-ticker', 'tooltip', 'adv-accordion', 'adv-tabs', 'progress-bar', 'section-particles' ]; + $eael_default_keys = [ 'contact-form-7', 'count-down', 'creative-btn', 'fancy-text', 'img-comparison', 'instagram-gallery', 'interactive-promo', 'lightbox', 'post-block', 'post-grid', 'post-timeline', 'product-grid', 'team-members', 'testimonial-slider', 'testimonials', 'testimonials', 'weforms', 'static-product', 'call-to-action', 'flip-box', 'info-box', 'dual-header', 'price-table', 'flip-carousel', 'interactive-cards', 'ninja-form', 'gravity-form', 'caldera-form', 'twitter-feed', 'facebook-feed', 'data-table', 'filter-gallery', 'image-accordion','content-ticker', 'tooltip', 'adv-accordion', 'adv-tabs', 'progress-bar', 'section-particles', 'feature-list' ]; $eael_default_settings = array_fill_keys( $eael_default_keys, true ); $eael_get_settings = get_option( 'eael_save_settings', $eael_default_settings ); @@ -170,6 +170,9 @@ function add_eael_elements() { if( $is_component_active['progress-bar'] ) { require_once ESSENTIAL_ADDONS_EL_PATH.'elements/progress-bar/progress-bar.php'; } + if( $is_component_active['feature-list'] ) { + require_once ESSENTIAL_ADDONS_EL_PATH.'elements/feature-list/feature-list.php'; + } } add_action('elementor/widgets/widgets_registered','add_eael_elements'); @@ -242,7 +245,7 @@ function essential_addons_el_enqueue(){ } if( $is_component_active['progress-bar'] ) { - wp_enqueue_script('essential_addons_elementor-progress-bar',ESSENTIAL_ADDONS_EL_URL.'assets/js/loading-bar.min.js', array('jquery'),'1.0', true); + wp_enqueue_script('essential_addons_elementor-progress-bar',ESSENTIAL_ADDONS_EL_URL.'assets/js/progress-bar.js', array('jquery'),'1.0', true); } if( $is_component_active['section-particles'] ) { wp_enqueue_script( @@ -313,9 +316,9 @@ function eael_redirect() { } if( ! function_exists( 'essential_addons_elementor_lite_start_plugin_tracking' ) ) { function essential_addons_elementor_lite_start_plugin_tracking() { - $wisdom = new Eael_Plugin_Usage_Tracker( + $wpins = new Eael_Plugin_Usage_Tracker( __FILE__, - 'https://wpdeveloper.net', + 'http://app.wpdeveloper.net', array(), true, true, @@ -325,7 +328,6 @@ function essential_addons_elementor_lite_start_plugin_tracking() { essential_addons_elementor_lite_start_plugin_tracking(); } - function eael_init() { if ( class_exists( 'Caldera_Forms' ) ) { add_filter( 'caldera_forms_force_enqueue_styles_early', '__return_true' ); @@ -373,4 +375,51 @@ function eael_is_failed_to_load() { } } add_action( 'plugins_loaded', 'eael_init' ); -require_once dirname( __FILE__ ) . '/includes/class-wpdev-notices.php'; \ No newline at end of file +require_once dirname( __FILE__ ) . '/includes/class-wpdev-notices.php'; + +/** + * EAE Pro Activation + */ +if( ! function_exists( 'eae_pro_filter_action_links' ) ) : + add_filter('plugin_action_links_essential-addons-elementor/essential_adons_elementor.php', 'eae_pro_filter_action_links'); + function eae_pro_filter_action_links( $links ) { + if( ! function_exists( 'get_plugins' ) ) { + include ABSPATH . '/wp-admin/includes/plugin.php'; + } + $activate_plugins = get_option( 'active_plugins' ); + if( in_array( plugin_basename( __FILE__ ), $activate_plugins ) ) { + $pro_plugin_base_name = 'essential-addons-elementor/essential_adons_elementor.php'; + if( isset( $links['activate'] ) ) { + $activate_link = $links['activate']; + // Insert an onClick action to allow form before deactivating + $activation_link = str_replace( ' + + start_controls_section( - 'eael_particles_section', - [ - 'label' => 'EA Particles', - 'tab' => Controls_Manager::TAB_LAYOUT +add_action( 'elementor/frontend/section/before_render', 'before_render' ); +add_action('elementor/element/section/section_layout/after_section_end', 'register_controls',10 ); + +function register_controls( $element ) { + + $element->start_controls_section( + 'eael_particles_section', + [ + 'label' => 'EA Particles', + 'tab' => Controls_Manager::TAB_LAYOUT + ] + ); + + $element->add_control( + 'eael_particle_switch', + [ + 'label' => __( 'Enable Particles', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SWITCHER, + ] + ); + + $element->add_control( + 'eael_particle_theme_from', + [ + 'label' => __( 'Theme Source', 'essential-addons-elementor' ), + 'type' => Controls_Manager::CHOOSE, + 'options' => [ + 'presets' => [ + 'title' => __( 'Defaults', 'essential-addons-elementor' ), + 'icon' => 'fa fa-list', + ], + 'custom' => [ + 'title' => __( 'Custom', 'essential-addons-elementor' ), + 'icon' => 'fa fa-edit', + ], + ], + 'condition' => [ + 'eael_particle_switch' => 'yes' + ], + 'default' => 'presets' + ] + ); + + $element->add_control( + 'eael_particle_preset_themes', + [ + 'label' => esc_html__( 'Preset Themes', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'label_block' => true, + 'options' => [ + 11 => __( 'Default', 'essential-addons-elementor' ), + 'nasa' => __( 'Nasa', 'essential-addons-elementor' ), + 'bubble' => __( 'Bubble', 'essential-addons-elementor' ), + 'snow' => __( 'Snow', 'essential-addons-elementor' ), + 'nyan_cat' => __( 'Nyan Cat', 'essential-addons-elementor' ) + ], + 'default' => 11, + 'condition' => [ + 'eael_particle_theme_from' => 'presets', + 'eael_particle_switch' => 'yes' ] - ); - - $element->add_control( - 'eael_particle_switch', - [ - 'label' => __( 'Enable Particles', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SWITCHER, + ] + ); + + $element->add_control( + 'eael_particles_custom_style', + [ + 'label' => __( 'Custom Style', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'description' => __( 'You can generate custom particles JSON code from Here!. Simply just past the JSON code above. For more queries Click Here!', 'essential-addons-elementor' ), + 'condition' => [ + 'eael_particle_theme_from' => 'custom', + 'eael_particle_switch' => 'yes' ] - ); - - $element->add_control( - 'eael_particle_area_zindex', - [ - 'label' => __( 'Z-index', 'essential-addons-elementor' ), - 'type' => Controls_Manager::NUMBER, - 'default' => 0, - 'condition' => [ - 'eael_particle_switch' => 'yes' - ] + ] + ); + + $element->add_control( + 'eael_particle_section_notice', + [ + 'raw' => __( 'You need to configure a Background Type to see this in full effect. You can do this by switching to the Style Tab.', 'essential-addons-elementor' ), + 'type' => Controls_Manager::RAW_HTML, + 'condition' => [ + 'eael_particle_theme_from' => 'custom', + 'eael_particle_switch' => 'yes' ] - ); + ] + ); + + $element->end_controls_section(); - $element->add_control( - 'eael_particle_theme_from', - [ - 'label' => __( 'Theme Source', 'essential-addons-elementor' ), - 'type' => Controls_Manager::CHOOSE, - 'options' => [ - 'presets' => [ - 'title' => __( 'Defaults', 'essential-addons-elementor' ), - 'icon' => 'fa fa-list', - ], - 'custom' => [ - 'title' => __( 'Custom', 'essential-addons-elementor' ), - 'icon' => 'fa fa-edit', - ], - ], - 'condition' => [ - 'eael_particle_switch' => 'yes' - ], - 'default' => 'presets' - ] - ); +} - $element->add_control( - 'eael_particle_preset_themes', - [ - 'label' => esc_html__( 'Preset Themes', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SELECT, - 'label_block' => true, - 'options' => [ - 11 => __( 'Default', 'essential-addons-elementor' ), - 'nasa' => __( 'Nasa', 'essential-addons-elementor' ), - 'bubble' => __( 'Bubble', 'essential-addons-elementor' ), - 'snow' => __( 'Snow', 'essential-addons-elementor' ), - 'nyan_cat' => __( 'Nyan Cat', 'essential-addons-elementor' ) - ], - 'default' => 11, - 'condition' => [ - 'eael_particle_theme_from' => 'presets', - 'eael_particle_switch' => 'yes' - ] - ] - ); - - $element->add_control( - 'eael_particles_custom_style', - [ - 'label' => __( 'Custom Style', 'essential-addons-elementor' ), - 'type' => Controls_Manager::TEXTAREA, - 'description' => __( 'You can generate custom particles JSON code from Here!. Simply just past the JSON code above. For more queries Click Here!', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_particle_theme_from' => 'custom', - 'eael_particle_switch' => 'yes' - ] - ] - ); +function before_render( $element ) { + $settings = $element->get_settings_for_display(); - $element->add_control( - 'eael_particle_section_notice', - [ - 'raw' => __( 'You need to configure a Background Type to see this in full effect. You can do this by switching to the Style Tab.', 'essential-addons-elementor' ), - 'type' => Controls_Manager::RAW_HTML, - 'condition' => [ - 'eael_particle_theme_from' => 'custom', - 'eael_particle_switch' => 'yes' - ] - ] - ); - - $element->end_controls_section(); + if( $settings['eael_particle_switch'] == 'yes' ){ - } + $element->add_render_attribute( + '_wrapper','id', + 'eael-section-particles-' . $element->get_id() + ); - public function before_render( $element ) { - - if( $element->get_settings('eael_particle_switch') == 'yes' ){ - $element->add_render_attribute( - '_wrapper','id', - 'eael-section-particles-' . $element->get_id() - ); - + $preset_themes = include('particle-themes.php'); + if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'presets') { + $theme = $preset_themes[ $settings['eael_particle_preset_themes'] ]; + $element->add_render_attribute('_wrapper', 'data-theme', $theme); } - - } - public function after_render( $element ) { - - $data = $element->get_data(); - $settings = $element->get_settings_for_display(); - $type = $data['elType']; - $zindex = ! empty( $settings['eael_particle_area_zindex'] ) ? $settings['eael_particle_area_zindex'] : 0; - - if( ('section' == $type) && ($element->get_settings('eael_particle_switch') == 'yes') ){ - - $preset_themes = include('particle-themes.php'); - if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'presets') { - $theme = $preset_themes[ $settings['eael_particle_preset_themes'] ]; - } - - if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'custom') { - $theme = $settings['eael_particles_custom_style']; - } - - ?> - - - - add_render_attribute('_wrapper', 'data-theme', $settings['eael_particles_custom_style']); } - } - - + } + } - -EAEL_Particle_Section::instance(); \ No newline at end of file diff --git a/includes/class-plugin-usage-tracker.php b/includes/class-plugin-usage-tracker.php index 4fc3c14c2..c8f0ec7ba 100755 --- a/includes/class-plugin-usage-tracker.php +++ b/includes/class-plugin-usage-tracker.php @@ -14,7 +14,7 @@ class Eael_Plugin_Usage_Tracker { - private $wisdom_version = '1.1.2'; + private $wpins_version = '1.1.3'; private $home_url = ''; private $plugin_file = ''; private $plugin_name = ''; @@ -23,6 +23,7 @@ class Eael_Plugin_Usage_Tracker { private $include_goodbye_form = true; private $marketing = false; private $collect_email = false; + private $pro_plugin_name = 'Essential Addons for Elementor Pro'; /** * Class constructor @@ -62,13 +63,44 @@ public function __construct( $this->init(); } + /** + * Migrate to the new Insights + * @return void + */ + public function migrate_plan(){ + $old_key = array_flip( [ 'wisdom_allow_tracking', 'wisdom_last_track_time', 'wisdom_block_notice', 'wisdom_collect_email', 'wisdom_admin_emails', 'wisdom_deactivation_reason_' . $this->plugin_name, 'wisdom_deactivation_details_' . $this->plugin_name ] ); + $new_key = [ 'wpins_allow_tracking', 'wpins_last_track_time', 'wpins_block_notice', 'wpins_collect_email', 'wpins_admin_emails', 'wpins_deactivation_reason_' . $this->plugin_name, 'wpins_deactivation_details_' . $this->plugin_name ]; + + foreach( $old_key as $key => $value ) { + $old_data = get_option( $key ); + if( ! $old_data ) { + continue; + } + update_option( $new_key[ $value ], $old_data ); + delete_option( $key ); + } + } + /** + * This function is fired for one time in a life time! + * if the data is not removed. + * @return void + */ + public function force_track_for_one_time(){ + $is_tracked = get_option( 'wpins_'. $this->plugin_name .'_force_tracked' ); + if( ! $is_tracked ) { + $this->do_tracking( true ); + update_option( 'wpins_'. $this->plugin_name .'_force_tracked', true ); + } + } public function init() { + if( version_compare( $this->wpins_version, '1.1.2', '>' ) ) { + $this->migrate_plan(); + } // Check marketing if( $this->marketing == 3 ) { $this->set_can_collect_email( true, $this->plugin_name ); } - // Check whether opt-in is required // If not, then tracking is allowed if( ! $this->require_optin ) { @@ -77,21 +109,23 @@ public function init() { $this->update_block_notice(); $this->do_tracking( true ); } - // Hook our do_tracking function to the daily action + add_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name, array( $this, 'clicked' ) ); + add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) ); - // Use this action for local testing - // add_action( 'admin_init', array( $this, 'do_tracking' ) ); - + // Use this action for local testing and for one time force tracking in a life time. + add_action( 'admin_init', array( $this, 'force_track_for_one_time' ) ); + // add_action( 'admin_init', array( $this, 'force_tracking' ) ); + // Display the admin notice on activation - add_action( 'wpdeveloper_optin_notice', array( $this, 'optin_notice' ) ); + add_action( 'wpdeveloper_optin_notice_for_' . $this->plugin_name, array( $this, 'optin_notice' ) ); add_action( 'admin_notices', array( $this, 'marketing_notice' ) ); // Deactivation add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filter_action_links' ) ); add_action( 'admin_footer-plugins.php', array( $this, 'goodbye_ajax' ) ); - add_action( 'wp_ajax_goodbye_form', array( $this, 'goodbye_form_callback' ) ); + add_action( 'wp_ajax_goodbye_form_' . esc_attr( $this->plugin_name ), array( $this, 'goodbye_form_callback' ) ); } @@ -108,7 +142,16 @@ public function schedule_tracking() { wp_schedule_event( time(), 'daily', 'put_do_weekly_action' ); } } - + /** + * This function is responsible for force tracking the plugin, + * if users are allowed to do! + * + * @return void + */ + public function force_tracking(){ + $this->do_tracking( true ); + } + /** * This is our function to get everything going * Check that user has opted in @@ -143,7 +186,6 @@ public function do_tracking( $force=false ) { // Send the data $this->send_data( $body ); - } /** @@ -192,7 +234,7 @@ public function get_data() { 'site_version' => get_bloginfo( 'version' ), 'site_language' => get_bloginfo( 'language' ), 'charset' => get_bloginfo( 'charset' ), - 'wisdom_version' => $this->wisdom_version, + 'wpins_version' => $this->wpins_version, 'php_version' => phpversion(), 'multisite' => is_multisite(), 'file_location' => __FILE__ @@ -266,7 +308,7 @@ public function get_data() { foreach( $options as $option ) { $fields = get_option( $option ); // Check for permission to send this option - if( isset( $fields['wisdom_registered_setting'] ) ) { + if( isset( $fields['wpins_registered_setting'] ) ) { foreach( $fields as $key=>$value ) { $plugin_options[$key] = $value; } @@ -323,11 +365,11 @@ public function deactivate_this_plugin() { $body['deactivated_date'] = time(); // Add deactivation form data - if( false !== get_option( 'wisdom_deactivation_reason_' . $this->plugin_name ) ) { - $body['deactivation_reason'] = get_option( 'wisdom_deactivation_reason_' . $this->plugin_name ); + if( false !== get_option( 'wpins_deactivation_reason_' . $this->plugin_name ) ) { + $body['deactivation_reason'] = get_option( 'wpins_deactivation_reason_' . $this->plugin_name ); } - if( false !== get_option( 'wisdom_deactivation_details_' . $this->plugin_name ) ) { - $body['deactivation_details'] = get_option( 'wisdom_deactivation_details_' . $this->plugin_name ); + if( false !== get_option( 'wpins_deactivation_details_' . $this->plugin_name ) ) { + $body['deactivation_details'] = get_option( 'wpins_deactivation_details_' . $this->plugin_name ); } $this->send_data( $body ); @@ -345,8 +387,8 @@ public function get_is_tracking_allowed() { $this->set_is_tracking_allowed( false, $this->plugin_name ); return false; } - // The wisdom_allow_tracking option is an array of plugins that are being tracked - $allow_tracking = get_option( 'wisdom_allow_tracking' ); + // The wpins_allow_tracking option is an array of plugins that are being tracked + $allow_tracking = get_option( 'wpins_allow_tracking' ); // If this plugin is in the array, then tracking is allowed if( isset( $allow_tracking[$this->plugin_name] ) ) { return true; @@ -365,8 +407,8 @@ public function set_is_tracking_allowed( $is_allowed, $plugin=null ) { if( empty( $plugin ) ) { $plugin = $this->plugin_name; } - // The wisdom_allow_tracking option is an array of plugins that are being tracked - $allow_tracking = get_option( 'wisdom_allow_tracking' ); + // The wpins_allow_tracking option is an array of plugins that are being tracked + $allow_tracking = get_option( 'wpins_allow_tracking' ); // If the user has decided to opt out if( $this->has_user_opted_out() ) { @@ -387,7 +429,7 @@ public function set_is_tracking_allowed( $is_allowed, $plugin=null ) { unset( $allow_tracking[$plugin] ); } } - update_option( 'wisdom_allow_tracking', $allow_tracking ); + update_option( 'wpins_allow_tracking', $allow_tracking ); } /** @@ -396,13 +438,13 @@ public function set_is_tracking_allowed( $is_allowed, $plugin=null ) { * @return Boolean */ public function has_user_opted_out() { - // Iterate through the options that are being tracked looking for wisdom_opt_out setting + // Iterate through the options that are being tracked looking for wpins_opt_out setting if( ! empty( $this->options ) ) { foreach( $this->options as $option_name ) { // Check each option $options = get_option( $option_name ); // If we find the setting, return true - if( ! empty( $options['wisdom_opt_out'] ) ) { + if( ! empty( $options['wpins_opt_out'] ) ) { return true; } } @@ -416,7 +458,7 @@ public function has_user_opted_out() { */ public function get_is_time_to_track() { // Let's see if we're due to track this plugin yet - $track_times = get_option( 'wisdom_last_track_time', array() ); + $track_times = get_option( 'wpins_last_track_time', array() ); if( ! isset( $track_times[$this->plugin_name] ) ) { // If we haven't set a time for this plugin yet, then we must track it return true; @@ -435,10 +477,10 @@ public function get_is_time_to_track() { */ public function set_track_time() { // We've tracked, so record the time - $track_times = get_option( 'wisdom_last_track_time', array() ); + $track_times = get_option( 'wpins_last_track_time', array() ); // Set different times according to plugin, in case we are tracking multiple plugins $track_times[$this->plugin_name] = time(); - update_option( 'wisdom_last_track_time', $track_times ); + update_option( 'wpins_last_track_time', $track_times ); } /** @@ -450,7 +492,7 @@ public function update_block_notice( $plugin=null ) { if( empty( $plugin ) ) { $plugin = $this->plugin_name; } - $block_notice = get_option( 'wisdom_block_notice' ); + $block_notice = get_option( 'wpins_block_notice' ); if( empty( $block_notice ) || ! is_array( $block_notice ) ) { // If nothing exists in the option yet, start a new array with the plugin name $block_notice = array( $plugin => $plugin ); @@ -458,7 +500,7 @@ public function update_block_notice( $plugin=null ) { // Else add the plugin name to the array $block_notice[$plugin] = $plugin; } - update_option( 'wisdom_block_notice', $block_notice ); + update_option( 'wpins_block_notice', $block_notice ); } /** @@ -466,8 +508,8 @@ public function update_block_notice( $plugin=null ) { * @since 1.0.0 */ public function get_can_collect_email() { - // The wisdom_collect_email option is an array of plugins that are being tracked - $collect_email = get_option( 'wisdom_collect_email' ); + // The wpins_collect_email option is an array of plugins that are being tracked + $collect_email = get_option( 'wpins_collect_email' ); // If this plugin is in the array, then we can collect the email address if( isset( $collect_email[$this->plugin_name] ) ) { return true; @@ -486,8 +528,8 @@ public function set_can_collect_email( $can_collect, $plugin=null ) { if( empty( $plugin ) ) { $plugin = $this->plugin_name; } - // The wisdom_collect_email option is an array of plugins that are being tracked - $collect_email = get_option( 'wisdom_collect_email' ); + // The wpins_collect_email option is an array of plugins that are being tracked + $collect_email = get_option( 'wpins_collect_email' ); // If the user has agreed to allow tracking or if opt-in is not required if( $can_collect ) { if( empty( $collect_email ) || ! is_array( $collect_email ) ) { @@ -502,7 +544,7 @@ public function set_can_collect_email( $can_collect, $plugin=null ) { unset( $collect_email[$plugin] ); } } - update_option( 'wisdom_collect_email', $collect_email ); + update_option( 'wpins_collect_email', $collect_email ); } /** @@ -511,8 +553,8 @@ public function set_can_collect_email( $can_collect, $plugin=null ) { * @return Email address */ public function get_admin_email() { - // The wisdom_collect_email option is an array of plugins that are being tracked - $email = get_option( 'wisdom_admin_emails' ); + // The wpins_collect_email option is an array of plugins that are being tracked + $email = get_option( 'wpins_admin_emails' ); // If this plugin is in the array, then we can collect the email address if( isset( $email[$this->plugin_name] ) ) { return $email[$this->plugin_name]; @@ -540,8 +582,8 @@ public function set_admin_email( $email=null, $plugin=null ) { $email = $current_user->user_email; } } - // The wisdom_admin_emails option is an array of admin email addresses - $admin_emails = get_option( 'wisdom_admin_emails' ); + // The wpins_admin_emails option is an array of admin email addresses + $admin_emails = get_option( 'wpins_admin_emails' ); if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) { // If nothing exists in the option yet, start a new array with the plugin name $admin_emails = array( $plugin => sanitize_email( $email ) ); @@ -549,15 +591,10 @@ public function set_admin_email( $email=null, $plugin=null ) { // Else add the email address to the array, if not already set $admin_emails[$plugin] = sanitize_email( $email ); } - update_option( 'wisdom_admin_emails', $admin_emails ); + update_option( 'wpins_admin_emails', $admin_emails ); } - - /** - * Display the admin notice to users to allow them to opt in - * - * @since 1.0.0 - */ - public function optin_notice() { + + public function clicked(){ // Check for plugin args if( isset( $_GET['plugin'] ) && isset( $_GET['plugin_action'] ) ) { $plugin = sanitize_text_field( $_GET['plugin'] ); @@ -570,10 +607,17 @@ public function optin_notice() { } $this->update_block_notice( $plugin ); } - + } + + /** + * Display the admin notice to users to allow them to opt in + * + * @since 1.0.0 + */ + public function optin_notice() { // Check whether to block the notice, e.g. because we're in a local environment - // wisdom_block_notice works the same as wisdom_allow_tracking, an array of plugin names - $block_notice = get_option( 'wisdom_block_notice' ); + // wpins_block_notice works the same as wpins_allow_tracking, an array of plugin names + $block_notice = get_option( 'wpins_block_notice' ); if( isset( $block_notice[$this->plugin_name] ) ) { return; } @@ -584,7 +628,12 @@ public function optin_notice() { // @credit EDD // Don't bother asking user to opt in if they're in local dev - if ( stristr( network_site_url( '/' ), 'local' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) { + $is_local = false; + if( stristr( network_site_url( '/' ), '.dev' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) { + $is_local = true; + } + $is_local = apply_filters( 'wpins_is_local_' . $this->plugin_name, $is_local ); + if ( $is_local ) { $this->update_block_notice(); } else { @@ -622,7 +671,7 @@ public function optin_notice() { $notice_text = __( 'Want to help make Essential Addons for Elementor even more awesome? You can get a 25% discount coupon for Pro upgrade if you allow. What we collect.', 'plugin-usage-tracker' ); } // And we allow you to filter the text anyway - $notice_text = apply_filters( 'wisdom_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?> + $notice_text = apply_filters( 'wpins_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?>

@@ -630,7 +679,7 @@ public function optin_notice() {

- +

jQuery('.insights-data-we-collect').on('click', function(e) { @@ -671,7 +720,7 @@ public function marketing_notice() { ) ); $marketing_text = __( 'Thank you for opting in to tracking. Would you like to receive occasional news about this plugin, including details of new features and special offers?', 'plugin-usage-tracker' ); - $marketing_text = apply_filters( 'wisdom_marketing_text_' . esc_attr( $this->plugin_name ), $marketing_text ); ?> + $marketing_text = apply_filters( 'wpins_marketing_text_' . esc_attr( $this->plugin_name ), $marketing_text ); ?>

' . esc_html( $plugin_name ) . ''; ?>

@@ -695,8 +744,10 @@ public function filter_action_links( $links ) { } if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) { $deactivation_link = $links['deactivate']; + + // Insert an onClick action to allow form before deactivating - $deactivation_link = str_replace( '
__( 'I found a better plugin', 'plugin-usage-tracker' ), + 'extra_field' => __( 'Please share which plugin', 'plugin-usage-tracker' ) + ], + __( "I couldn't get the plugin to work", 'plugin-usage-tracker' ), + __( 'It\'s a temporary deactivation', 'plugin-usage-tracker' ), + __( 'I have '. $this->pro_plugin_name, 'plugin-usage-tracker' ), + [ + 'label' => __( 'Other', 'plugin-usage-tracker' ), + 'extra_field' => __( 'Please share the reason', 'plugin-usage-tracker' ), + 'type' => 'textarea' + ] ); - $form['details'] = __( 'Details (optional)', 'plugin-usage-tracker' ); + return $form; } @@ -732,7 +790,7 @@ public function form_default_text() { */ public function form_filterable_text() { $form = $this->form_default_text(); - return apply_filters( 'wisdom_form_text_' . esc_attr( $this->plugin_name ), $form ); + return apply_filters( 'wpins_form_text_' . esc_attr( $this->plugin_name ), $form ); } /** @@ -748,59 +806,107 @@ public function goodbye_ajax() { $form = $this->form_default_text(); } // Build the HTML to go in the form - $html = '
' . esc_html( $form['heading'] ) . '
'; - $html .= '

' . esc_html( $form['body'] ) . '

'; + $html = '
' . esc_html( $form['heading'] ) . '
'; + $html .= '

' . esc_html( $form['body'] ) . '

'; if( is_array( $form['options'] ) ) { - $html .= '

'; + $html .= '

    '; foreach( $form['options'] as $option ) { - $html .= '
    '; + if( is_array( $option ) ) { + $id = strtolower( str_replace( " ", "_", esc_attr( $option['label'] ) ) ); + $id = $id . '_' . esc_attr( $this->plugin_name ); + $html .= '
  • '; + $html .= ''; + $html .= '
    '; + if( isset( $option[ 'extra_field' ] ) && ! isset( $option['type'] )) { + $html .= ''; + } + if( isset( $option[ 'extra_field' ] ) && isset( $option['type'] )) { + $html .= '<'. $option['type'] .' style="display: none" type="text" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '">'; + } + $html .= '
  • '; + } else { + $id = strtolower( str_replace( " ", "_", esc_attr( $option ) ) ); + $id = $id . '_' . esc_attr( $this->plugin_name ); + $html .= '
  • '; + } } - $html .= '

    '; - $html .= '
'; + $html .= '
'; } - $html .= '
'; + $html .= '
'; $html .= '

' . __( 'Submitting form', 'plugin-usage-tracker' ) . '

'; ?> -
plugin_name, $values ); + $values = $_POST['values']; + update_option( 'wpins_deactivation_reason_' . $this->plugin_name, $values ); } if( isset( $_POST['details'] ) ) { $details = sanitize_text_field( $_POST['details'] ); - update_option( 'wisdom_deactivation_details_' . $this->plugin_name, $details ); + update_option( 'wpins_deactivation_details_' . $this->plugin_name, $details ); } $this->do_tracking(); // Run this straightaway echo 'success'; diff --git a/includes/class-wpdev-core-install.php b/includes/class-wpdev-core-install.php index c14867abb..692974fae 100755 --- a/includes/class-wpdev-core-install.php +++ b/includes/class-wpdev-core-install.php @@ -4,12 +4,19 @@ * WPDeveloper Core Install */ class WPDeveloper_Core_Installer { + /** + * Plugin Base Name + * + * @var string + */ + private $plugin_basename; /** * Instantiate the class * * @param string $affiliate */ - function __construct() { + function __construct( $plugin_basename = '' ) { + $this->plugin_basename = $plugin_basename; add_action( 'init', array( $this, 'init_hooks' ) ); } /** @@ -21,7 +28,7 @@ public function init_hooks() { if ( ! current_user_can( 'manage_options' ) ) { return; } - add_action( 'wp_ajax_wpdeveloper_upsale_core_install', array( $this, 'core_install' ) ); + add_action( 'wp_ajax_wpdeveloper_upsale_core_install_' . $this->plugin_basename, array( $this, 'core_install' ) ); } /** * Fail if plugin installtion/activation fails @@ -42,7 +49,7 @@ public function fail_on_error( $thing ) { * @return void */ public function core_install() { - check_ajax_referer( 'wpdeveloper_upsale_core_install' ); + check_ajax_referer( 'wpdeveloper_upsale_core_install_' . $this->plugin_basename ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( __( 'You don\'t have permission to install the plugins' ) ); @@ -92,9 +99,4 @@ public function install_plugin( $slug, $file ) { return activate_plugin( $plugin_basename ); } } - /** - * Initiate The Core Installer - */ - new WPDeveloper_Core_Installer(); -endif; - +endif; \ No newline at end of file diff --git a/includes/class-wpdev-notices.php b/includes/class-wpdev-notices.php index 950a1d0d5..780bc19c3 100755 --- a/includes/class-wpdev-notices.php +++ b/includes/class-wpdev-notices.php @@ -52,6 +52,12 @@ class WPDeveloper_Notice { * @var integer */ public $timestamp; + /** + * Primary Notice Action + * + * @var string + */ + private $do_notice_action; /** * Default Options Set * @@ -90,8 +96,12 @@ public function __construct( $plugin_file = '', $version = '' ) { $this->timestamp = intval( current_time( 'timestamp' ) ); $this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version ); + $this->do_notice_action = 'wpdeveloper_notices_for_' . $this->plugin_name; + if( ! class_exists( 'WPDeveloper_Core_Installer' ) ) { require_once dirname( __FILE__ ) . '/class-wpdev-core-install.php'; + + new WPDeveloper_Core_Installer( $this->plugin_name ); } } /** @@ -108,15 +118,16 @@ public function init(){ * @return void */ public function hooks(){ - add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss', array( $this, 'upsale_notice_dissmiss' ) ); - add_action( 'wpdeveloper_before_notice', array( $this, 'before' ) ); - add_action( 'wpdeveloper_after_notice', array( $this, 'after' ) ); - add_action( 'wpdeveloper_before_upsale_notice', array( $this, 'before_upsale' ) ); - add_action( 'wpdeveloper_after_upsale_notice', array( $this, 'after' ) ); - add_action( 'wpdeveloper_notices', array( $this, 'content' ) ); + add_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name, array( $this, 'clicked' ) ); + add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss_for_' . $this->plugin_name, array( $this, 'upsale_notice_dissmiss' ) ); + add_action( 'wpdeveloper_before_notice_for_' . $this->plugin_name, array( $this, 'before' ) ); + add_action( 'wpdeveloper_after_notice_for_' . $this->plugin_name, array( $this, 'after' ) ); + add_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name, array( $this, 'before_upsale' ) ); + add_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name, array( $this, 'after' ) ); + add_action( $this->do_notice_action, array( $this, 'content' ) ); if( current_user_can( 'install_plugins' ) ) { - add_action( 'wpdeveloper_notice_clicked', array( $this, 'clicked' ) ); if( isset( $_GET['plugin'] ) && $_GET['plugin'] == $this->plugin_name ) { + do_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name ); /** * Redirect User To the Current URL, but without set query arguments. */ @@ -196,10 +207,7 @@ private function maybe_later( $notice ){ * When links are clicked, this function will invoked. * @return void */ - public function clicked(){ - // if( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wpdeveloper-nonce' ) ) { - // return; - // } + public function clicked(){ if( isset( $_GET['plugin'] ) && $_GET['plugin'] === $this->plugin_name ) { $options_data = $this->get_options_data(); $clicked_from = current( $this->next_notice() ); @@ -298,22 +306,22 @@ public function content(){ switch( $notice ) { case 'opt_in' : - do_action('wpdeveloper_optin_notice'); + do_action('wpdeveloper_optin_notice_for_' . $this->plugin_name ); break; case 'first_install' : if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) { - do_action('wpdeveloper_first_install_notice'); + do_action( 'wpdeveloper_first_install_notice_for_' . $this->plugin_name ); $this->get_thumbnail( 'first_install' ); $this->get_message( 'first_install' ); } break; case 'update' : - do_action('wpdeveloper_update_notice'); + do_action( 'wpdeveloper_update_notice_for_' . $this->plugin_name ); $this->get_thumbnail( 'update' ); $this->get_message( 'update' ); break; case 'review' : - do_action('wpdeveloper_review_notice'); + do_action( 'wpdeveloper_review_notice_for_' . $this->plugin_name ); $this->get_thumbnail( 'review' ); $this->get_message( 'review' ); break; @@ -334,11 +342,11 @@ public function before_upsale(){ * Upsale Notice */ public function upsale_notice(){ - do_action( 'wpdeveloper_before_upsale_notice' ); - do_action('wpdeveloper_upsale_notice'); + do_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name ); + do_action('wpdeveloper_upsale_notice_for_' . $this->plugin_name); $this->get_thumbnail( 'upsale' ); $this->get_message( 'upsale' ); - do_action( 'wpdeveloper_after_upsale_notice' ); + do_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name ); $this->upsale_button_script(); } /** @@ -357,7 +365,7 @@ private function upsale_button(){ if( empty( $plugin_slug ) ) { return; } - echo ''; + echo ''; } /** * This methods is responsible for get notice image. @@ -456,14 +464,13 @@ private function deserve_notice( $notice ) { */ public function admin_notices(){ $current_notice = current( $this->next_notice() ); - do_action( 'wpdeveloper_notice_clicked' ); if( $current_notice == 'opt_in' ) { - do_action( 'wpdeveloper_notices' ); + do_action( $this->do_notice_action ); return; } - do_action( 'wpdeveloper_before_notice' ); - do_action( 'wpdeveloper_notices' ); - do_action( 'wpdeveloper_after_notice' ); + do_action( 'wpdeveloper_before_notice_for_' . $this->plugin_name ); + do_action( $this->do_notice_action ); + do_action( 'wpdeveloper_after_notice_for_' . $this->plugin_name ); } /** * This method is responsible for all dismissible links generation. @@ -688,7 +695,7 @@ public function upsale_notice_dissmiss(){ return; } - if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss' ) ) { + if( ! isset( $_POST['action'] ) || ( $_POST['action'] !== 'wpdeveloper_upsale_notice_dissmiss_for_' . $this->plugin_name ) ) { return; } @@ -718,7 +725,7 @@ public function upsale_button_script(){