Ultimate Tag Cloud Widget - Version 2.1-beta1

Version Description

= 2.1 =

  • New features, see the plugin page at wordpress.org for full details

= 2.0.1 =

  • Small bug fix in the widget options panel

= 2.0 =

  • New plugin architecture and a big rewrite of the plugin foundation. Watch out for breaking changes, please see http://exz.nu/utcwbreaking for more information.
Download this release

Release Info

Developer exz
Plugin Icon wp plugin Ultimate Tag Cloud Widget
Version 2.1-beta1
Comparing to
See all releases

Code changes from version 2.0.1 to 2.1-beta1

css/style.css CHANGED
@@ -1 +1 @@
1
- .utcw-tab-button{border-top:solid 1px #dfdfdf;border-left:solid 1px #dfdfdf;border-right:solid 1px #dfdfdf;border-bottom:none;margin:0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;border-top-left-radius:3px;border-top-right-radius:3px;padding:2px;background:transparent;opacity:0.5;cursor:pointer;-webkit-transition:opacity 0.1s ease-in}.utcw-tab-button:hover{opacity:1}.utcw-help{float:right;display:block;width:14px;height:14px;border:solid 1px transparent;-webkit-border-radius:14px;-moz-border-radius:14px;-khtml-border-radius:14px;border-radius:14px;text-align:center;color:#fff;font-weight:bold;background-color:#6295fb;background-image:-webkit-gradient(linear, left top, left bottom, from(#6295fb), to(#3265cb));background-image:-webkit-linear-gradient(top, #6295fb, #3265cb);background-image:-moz-linear-gradient(top, #6295fb, #3265cb);background-image:-ms-linear-gradient(top, #6295fb, #3265cb);background-image:-o-linear-gradient(top, #6295fb, #3265cb);background-image:linear-gradient(top, #6295fb, #3265cb);cursor:pointer}.utcw-help:hover{color:#fff}.utcw-tooltip{color:#000;width:200px;text-align:center;border:solid 1px #6295fb;-webkit-border-radius:9px;-moz-border-radius:9px;-khtml-border-radius:9px;border-radius:9px}.utcw-tooltip ul{list-style-type:circle;margin:10px 0}.utcw-tooltip li{margin:0 0 0 20px}fieldset.utcw{padding:10px;border:solid 1px #dfdfdf;margin-bottom:25px}fieldset.utcw h3{margin:0 0 5px 0}fieldset.utcw input[type="number"]{width:50px}fieldset.utcw legend{letter-spacing:2px;font-size:16px}fieldset.utcw label.two-col{width:120px;display:inline-block}.utcw-hidden{display:none}.utcw-active{font-weight:bold;opacity:1}
1
+ .utcw-tab-button{border-top:solid 1px #dfdfdf;border-left:solid 1px #dfdfdf;border-right:solid 1px #dfdfdf;border-bottom:none;margin:0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;border-top-left-radius:3px;border-top-right-radius:3px;padding:2px;background:transparent;opacity:0.5;cursor:pointer;-webkit-transition:opacity 0.1s ease-in}.utcw-tab-button:hover{opacity:1}.utcw-help{float:right;display:block;width:14px;height:14px;border:solid 1px transparent;-webkit-border-radius:14px;-moz-border-radius:14px;-khtml-border-radius:14px;border-radius:14px;text-align:center;color:#fff;font-weight:bold;background-color:#6295fb;background-image:-webkit-gradient(linear, left top, left bottom, from(#6295fb), to(#3265cb));background-image:-webkit-linear-gradient(top, #6295fb, #3265cb);background-image:-moz-linear-gradient(top, #6295fb, #3265cb);background-image:-ms-linear-gradient(top, #6295fb, #3265cb);background-image:-o-linear-gradient(top, #6295fb, #3265cb);background-image:linear-gradient(top, #6295fb, #3265cb);cursor:pointer}.utcw-help:hover{color:#fff}.utcw-tooltip{color:#000;width:200px;text-align:center;border:solid 1px #6295fb;-webkit-border-radius:9px;-moz-border-radius:9px;-khtml-border-radius:9px;border-radius:9px}.utcw-tooltip ul{list-style-type:circle;margin:10px 0}.utcw-tooltip li{margin:0 0 0 20px}fieldset.utcw{padding:10px;border:solid 1px #dfdfdf;margin-bottom:25px}fieldset.utcw h3{margin:0 0 5px 0}fieldset.utcw input[type="number"]{width:50px}fieldset.utcw legend{letter-spacing:2px;font-size:16px}fieldset.utcw label.two-col{width:120px;display:inline-block}.utcw-hidden{display:none}.utcw-active{font-weight:bold;opacity:1}.utcw-authors{margin-top:5px}.utcw-remove-config{cursor:pointer}
js/utcw.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Ultimate Tag Cloud Widget - v2.0.1 - 2013-01-02
2
  * https://0x539.se/wordpress/ultimate-tag-cloud-widget/
3
  * Copyright (c) 2013 Rickard Andersson; Licensed GPLv2 */
4
- var Query=function(e){"use strict";var t=function(e){var t=[],n,r,i,s;if(typeof e=="undefined"||e===null||e==="")return t;e.indexOf("?")===0&&(e=e.substring(1)),r=e.toString().split(/[&;]/);for(n=0;n<r.length;n++)i=r[n],s=i.split("="),t.push([s[0],s[1]]);return t},n=t(e),r=function(){var e="",t,r;for(t=0;t<n.length;t++)r=n[t],e.length>0&&(e+="&"),e+=r.join("=");return e.length>0?"?"+e:e},i=function(e){return e=decodeURIComponent(e),e=e.replace("+"," "),e},s=function(e){var t,r;for(r=0;r<n.length;r++){t=n[r];if(i(e)===i(t[0]))return t[1]}},o=function(e){var t=[],r,s;for(r=0;r<n.length;r++)s=n[r],i(e)===i(s[0])&&t.push(s[1]);return t},u=function(e,t){var r=[],s,o,u,a;for(s=0;s<n.length;s++)o=n[s],u=i(o[0])===i(e),a=i(o[1])===i(t),(arguments.length===1&&!u||arguments.length===2&&!u&&!a)&&r.push(o);return n=r,this},a=function(e,t,r){return arguments.length===3&&r!==-1?(r=Math.min(r,n.length),n.splice(r,0,[e,t])):arguments.length>0&&n.push([e,t]),this},f=function(e,t,r){var s=-1,o,f;if(arguments.length===3){for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)&&decodeURIComponent(f[1])===i(r)){s=o;break}}u(e,r).addParam(e,t,s)}else{for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)){s=o;break}}u(e),a(e,t,s)}return this};return{getParamValue:s,getParamValues:o,deleteParam:u,addParam:a,replaceParam:f,toString:r}},Uri=function(e){"use strict";var t=!1,n=function(e){var n={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],i={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},s=n[t?"strict":"loose"].exec(e),o={},u=14;while(u--)o[r[u]]=s[u]||"";return o[i.name]={},o[r[12]].replace(i.parser,function(e,t,n){t&&(o[i.name][t]=n)}),o},r=n(e||""),i=new Query(r.query),s=function(e){return typeof e!="undefined"&&(r.protocol=e),r.protocol},o=null,u=function(e){return typeof e!="undefined"&&(o=e),o===null?r.source.indexOf("//")!==-1:o},a=function(e){return typeof e!="undefined"&&(r.userInfo=e),r.userInfo},f=function(e){return typeof e!="undefined"&&(r.host=e),r.host},l=function(e){return typeof e!="undefined"&&(r.port=e),r.port},c=function(e){return typeof e!="undefined"&&(r.path=e),r.path},h=function(e){return typeof e!="undefined"&&(i=new Query(e)),i},p=function(e){return typeof e!="undefined"&&(r.anchor=e),r.anchor},d=function(e){return s(e),this},v=function(e){return u(e),this},m=function(e){return a(e),this},g=function(e){return f(e),this},y=function(e){return l(e),this},b=function(e){return c(e),this},w=function(e){return h(e),this},E=function(e){return p(e),this},S=function(e){return h().getParamValue(e)},x=function(e){return h().getParamValues(e)},T=function(e,t){return arguments.length===2?h().deleteParam(e,t):h().deleteParam(e),this},N=function(e,t,n){return arguments.length===3?h().addParam(e,t,n):h().addParam(e,t),this},C=function(e,t,n){return arguments.length===3?h().replaceParam(e,t,n):h().replaceParam(e,t),this},k=function(){var e="",t=function(e){return e!==null&&e!==""};return t(s())?(e+=s(),s().indexOf(":")!==s().length-1&&(e+=":"),e+="//"):u()&&t(f())&&(e+="//"),t(a())&&t(f())&&(e+=a(),a().indexOf("@")!==a().length-1&&(e+="@")),t(f())&&(e+=f(),t(l())&&(e+=":"+l())),t(c())?e+=c():t(f())&&(t(h().toString())||t(p()))&&(e+="/"),t(h().toString())&&(h().toString().indexOf("?")!==0&&(e+="?"),e+=h().toString()),t(p())&&(p().indexOf("#")!==0&&(e+="#"),e+=p()),e},L=function(){return new Uri(k())};return{protocol:s,hasAuthorityPrefix:u,userInfo:a,host:f,port:l,path:c,query:h,anchor:p,setProtocol:d,setHasAuthorityPrefix:v,setUserInfo:m,setHost:g,setPort:y,setPath:b,setQuery:w,setAnchor:E,getQueryParamValue:S,getQueryParamValues:x,deleteQueryParam:T,addQueryParam:N,replaceQueryParam:C,toString:k,clone:L}},jsUri=Uri;(function(e){e.fn.wTooltip=function(t,n){function m(n){n&&(t.degrade?e(h).html(t.content.replace(/<\/?[^>]+>/gi,"")):e(h).html(t.content))}function g(n){function i(e){r&&!t.content&&(r="")}function u(){!l&&t.auto&&(clearInterval(o),t.fadeOut?e(h).fadeOut(t.fadeOut,function(){i(n)}):(i(n),h.style.display="none")),typeof t.callAfter=="function"&&t.callAfter(h,n,t),d&&(t=e.listen(t))}t.timeout>0?s=setTimeout(function(){u()},t.timeout):u()}t=e.extend({content:null,ajax:null,follow:!0,auto:!0,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:!1,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(e,t,n){},callAfter:function(e,t,n){},clickAction:function(t,n){e(t).hide()},delay:0,timeout:0},t||{}),!t.style&&typeof t.style!="object"?(t.style={},t.style.zIndex="1000"):t.style=e.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},t.style||{}),typeof n=="function"&&(t.callAfter=n||t.callAfter),t.style.display="none",t.style.position="absolute";var r,i,s,o,u={},f=!0,l=!1,c=!1,h=document.createElement("div"),p=typeof document.body.style.maxWidth=="undefined"?!0:!1,d=typeof e.talk=="function"&&typeof e.listen=="function"?!0:!1;t.id&&(h.id=t.id),t.className&&(h.className=t.className),t.degrade=t.degrade&&p?!0:!1;for(var v in t.style)h.style[v]=t.style[v];return t.ajax&&e.get(t.ajax,function(e){e&&(t.content=e),m(t.content)}),e(h).hover(function(){l=!0},function(){l=!1,g(u)}),d&&(t.key=h,t.plugin="wTooltip",t.channel="wayfarer",e.talk(t)),m(t.content&&!t.ajax),e(h).appendTo(t.appendTip),this.each(function(){e(this).hover(function(){function o(){typeof t.callBefore=="function"&&t.callBefore(h,n,t),d&&(t=e.listen(t));var i;t.content?t.degrade||(i="block"):r&&!t.degrade?(e(h).html(unescape(r)),i="block",r=""):i="none",t.auto&&(i=="block"&&t.fadeIn?e(h).fadeIn(t.fadeIn):h.style.display=i)}var n=this;clearTimeout(s),(this.title||this.titleMemKeep)&&!t.degrade&&!t.content&&(r=this.title||this.titleMemKeep,this.title&&(this.titleMemKeep=this.title,this.title="")),t.content&&t.degrade&&(this.title=h.innerHTML),t.delay>0?i=setTimeout(function(){o()},t.delay):o()},function(){clearTimeout(i);var n=this;f=!0,!t.follow||c||t.offsetX<0&&0-t.offsetX<e(h).outerWidth()&&t.offsetY>0&&0-t.offsetY<e(h).outerHeight()?setTimeout(function(){o=setInterval(function(){g(n)},1)},1):g(this)}),e(this).mousemove(function(n){u=this;if(t.follow||f){var r=e(window).scrollTop(),i=e(window).scrollLeft(),s=n.clientY+r+t.offsetY,o=n.clientX+i+t.offsetX,l=e(t.appendTip).outerHeight(),p=e(t.appendTip).innerHeight(),d=e(window).width()+i-e(h).outerWidth(),v=e(window).height()+r-e(h).outerHeight();s=l>p?s-(l-p):s,c=s>v||o>d?!0:!1,o-i<=0&&t.offsetX<0?o=i:o>d&&(o=d),s-r<=0&&t.offsetY<0?s=r:s>v&&(s=v),h.style.top=s+"px",h.style.left=o+"px",f=!1}}),typeof t.clickAction=="function"&&e(this).click(function(){t.clickAction(h,this)})})}})(jQuery),function(e){"use strict";var t={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1e3},n={activeTab:{},init:function(){e("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]").live("click",this.colorClickHandler),e(".utcw-tab-button").live("click",this.tabClickHandler),e("select[id$=-taxonomy]").live("change",this.taxonomyChangeHandler),e(document).ready(this.initTooltip),e(document).ajaxSuccess(this.ajaxSuccessHandler)},initTooltip:function(){e(".utcw-help").wTooltip({style:t,className:"utcw-tooltip"})},tabClickHandler:function(){var t=e(this);return t.data("id")==="utcw-__i__"?!1:(t.parent().find(".utcw-tab-button").removeClass("utcw-active"),t.addClass("utcw-active"),t.parent().find("fieldset.utcw").addClass("hidden"),e("#"+t.data("tab")).removeClass("hidden"),n.activeTab[t.data("id")]=t.data("tab"),!1)},colorClickHandler:function(){var t=e("div[id$='set_chooser']"),n=e("div[id$='span_chooser']"),r=e(this).val();t.addClass("utcw-hidden"),n.addClass("utcw-hidden"),r==="set"?t.removeClass("utcw-hidden"):r==="span"&&n.removeClass("utcw-hidden")},taxonomyChangeHandler:function(){var t=e(this),n=t.find(":selected").val(),r=t.parents(".widget-content");r.find("div[id$=-terms]").addClass("hidden"),r.find("#"+n+"-terms").removeClass("hidden")},ajaxSuccessHandler:function(e,t,r){n.setCurrentTab.apply(n,[r.data]),n.initTooltip.apply(n)},setCurrentTab:function(t){var n=new Uri,r;n.setQuery(decodeURI(t)),n.getQueryParamValue("action")==="save-widget"&&n.getQueryParamValue("id_base")==="utcw"&&(r=n.getQueryParamValue("widget-id"),this.activeTab[r]&&e("button[data-tab='"+this.activeTab[r]+"']").trigger("click"))}};n.init()}(jQuery);
1
+ /*! Ultimate Tag Cloud Widget - v2.1 beta1 - 2013-01-16
2
  * https://0x539.se/wordpress/ultimate-tag-cloud-widget/
3
  * Copyright (c) 2013 Rickard Andersson; Licensed GPLv2 */
4
+ var Query=function(e){"use strict";var t=function(e){var t=[],n,r,i,s;if(typeof e=="undefined"||e===null||e==="")return t;e.indexOf("?")===0&&(e=e.substring(1)),r=e.toString().split(/[&;]/);for(n=0;n<r.length;n++)i=r[n],s=i.split("="),t.push([s[0],s[1]]);return t},n=t(e),r=function(){var e="",t,r;for(t=0;t<n.length;t++)r=n[t],e.length>0&&(e+="&"),e+=r.join("=");return e.length>0?"?"+e:e},i=function(e){return e=decodeURIComponent(e),e=e.replace("+"," "),e},s=function(e){var t,r;for(r=0;r<n.length;r++){t=n[r];if(i(e)===i(t[0]))return t[1]}},o=function(e){var t=[],r,s;for(r=0;r<n.length;r++)s=n[r],i(e)===i(s[0])&&t.push(s[1]);return t},u=function(e,t){var r=[],s,o,u,a;for(s=0;s<n.length;s++)o=n[s],u=i(o[0])===i(e),a=i(o[1])===i(t),(arguments.length===1&&!u||arguments.length===2&&!u&&!a)&&r.push(o);return n=r,this},a=function(e,t,r){return arguments.length===3&&r!==-1?(r=Math.min(r,n.length),n.splice(r,0,[e,t])):arguments.length>0&&n.push([e,t]),this},f=function(e,t,r){var s=-1,o,f;if(arguments.length===3){for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)&&decodeURIComponent(f[1])===i(r)){s=o;break}}u(e,r).addParam(e,t,s)}else{for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)){s=o;break}}u(e),a(e,t,s)}return this};return{getParamValue:s,getParamValues:o,deleteParam:u,addParam:a,replaceParam:f,toString:r}},Uri=function(e){"use strict";var t=!1,n=function(e){var n={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],i={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},s=n[t?"strict":"loose"].exec(e),o={},u=14;while(u--)o[r[u]]=s[u]||"";return o[i.name]={},o[r[12]].replace(i.parser,function(e,t,n){t&&(o[i.name][t]=n)}),o},r=n(e||""),i=new Query(r.query),s=function(e){return typeof e!="undefined"&&(r.protocol=e),r.protocol},o=null,u=function(e){return typeof e!="undefined"&&(o=e),o===null?r.source.indexOf("//")!==-1:o},a=function(e){return typeof e!="undefined"&&(r.userInfo=e),r.userInfo},f=function(e){return typeof e!="undefined"&&(r.host=e),r.host},l=function(e){return typeof e!="undefined"&&(r.port=e),r.port},c=function(e){return typeof e!="undefined"&&(r.path=e),r.path},h=function(e){return typeof e!="undefined"&&(i=new Query(e)),i},p=function(e){return typeof e!="undefined"&&(r.anchor=e),r.anchor},d=function(e){return s(e),this},v=function(e){return u(e),this},m=function(e){return a(e),this},g=function(e){return f(e),this},y=function(e){return l(e),this},b=function(e){return c(e),this},w=function(e){return h(e),this},E=function(e){return p(e),this},S=function(e){return h().getParamValue(e)},x=function(e){return h().getParamValues(e)},T=function(e,t){return arguments.length===2?h().deleteParam(e,t):h().deleteParam(e),this},N=function(e,t,n){return arguments.length===3?h().addParam(e,t,n):h().addParam(e,t),this},C=function(e,t,n){return arguments.length===3?h().replaceParam(e,t,n):h().replaceParam(e,t),this},k=function(){var e="",t=function(e){return e!==null&&e!==""};return t(s())?(e+=s(),s().indexOf(":")!==s().length-1&&(e+=":"),e+="//"):u()&&t(f())&&(e+="//"),t(a())&&t(f())&&(e+=a(),a().indexOf("@")!==a().length-1&&(e+="@")),t(f())&&(e+=f(),t(l())&&(e+=":"+l())),t(c())?e+=c():t(f())&&(t(h().toString())||t(p()))&&(e+="/"),t(h().toString())&&(h().toString().indexOf("?")!==0&&(e+="?"),e+=h().toString()),t(p())&&(p().indexOf("#")!==0&&(e+="#"),e+=p()),e},L=function(){return new Uri(k())};return{protocol:s,hasAuthorityPrefix:u,userInfo:a,host:f,port:l,path:c,query:h,anchor:p,setProtocol:d,setHasAuthorityPrefix:v,setUserInfo:m,setHost:g,setPort:y,setPath:b,setQuery:w,setAnchor:E,getQueryParamValue:S,getQueryParamValues:x,deleteQueryParam:T,addQueryParam:N,replaceQueryParam:C,toString:k,clone:L}},jsUri=Uri;(function(e){e.fn.wTooltip=function(t,n){function m(n){n&&(t.degrade?e(h).html(t.content.replace(/<\/?[^>]+>/gi,"")):e(h).html(t.content))}function g(n){function i(e){r&&!t.content&&(r="")}function u(){!l&&t.auto&&(clearInterval(o),t.fadeOut?e(h).fadeOut(t.fadeOut,function(){i(n)}):(i(n),h.style.display="none")),typeof t.callAfter=="function"&&t.callAfter(h,n,t),d&&(t=e.listen(t))}t.timeout>0?s=setTimeout(function(){u()},t.timeout):u()}t=e.extend({content:null,ajax:null,follow:!0,auto:!0,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:!1,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(e,t,n){},callAfter:function(e,t,n){},clickAction:function(t,n){e(t).hide()},delay:0,timeout:0},t||{}),!t.style&&typeof t.style!="object"?(t.style={},t.style.zIndex="1000"):t.style=e.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},t.style||{}),typeof n=="function"&&(t.callAfter=n||t.callAfter),t.style.display="none",t.style.position="absolute";var r,i,s,o,u={},f=!0,l=!1,c=!1,h=document.createElement("div"),p=typeof document.body.style.maxWidth=="undefined"?!0:!1,d=typeof e.talk=="function"&&typeof e.listen=="function"?!0:!1;t.id&&(h.id=t.id),t.className&&(h.className=t.className),t.degrade=t.degrade&&p?!0:!1;for(var v in t.style)h.style[v]=t.style[v];return t.ajax&&e.get(t.ajax,function(e){e&&(t.content=e),m(t.content)}),e(h).hover(function(){l=!0},function(){l=!1,g(u)}),d&&(t.key=h,t.plugin="wTooltip",t.channel="wayfarer",e.talk(t)),m(t.content&&!t.ajax),e(h).appendTo(t.appendTip),this.each(function(){e(this).hover(function(){function o(){typeof t.callBefore=="function"&&t.callBefore(h,n,t),d&&(t=e.listen(t));var i;t.content?t.degrade||(i="block"):r&&!t.degrade?(e(h).html(unescape(r)),i="block",r=""):i="none",t.auto&&(i=="block"&&t.fadeIn?e(h).fadeIn(t.fadeIn):h.style.display=i)}var n=this;clearTimeout(s),(this.title||this.titleMemKeep)&&!t.degrade&&!t.content&&(r=this.title||this.titleMemKeep,this.title&&(this.titleMemKeep=this.title,this.title="")),t.content&&t.degrade&&(this.title=h.innerHTML),t.delay>0?i=setTimeout(function(){o()},t.delay):o()},function(){clearTimeout(i);var n=this;f=!0,!t.follow||c||t.offsetX<0&&0-t.offsetX<e(h).outerWidth()&&t.offsetY>0&&0-t.offsetY<e(h).outerHeight()?setTimeout(function(){o=setInterval(function(){g(n)},1)},1):g(this)}),e(this).mousemove(function(n){u=this;if(t.follow||f){var r=e(window).scrollTop(),i=e(window).scrollLeft(),s=n.clientY+r+t.offsetY,o=n.clientX+i+t.offsetX,l=e(t.appendTip).outerHeight(),p=e(t.appendTip).innerHeight(),d=e(window).width()+i-e(h).outerWidth(),v=e(window).height()+r-e(h).outerHeight();s=l>p?s-(l-p):s,c=s>v||o>d?!0:!1,o-i<=0&&t.offsetX<0?o=i:o>d&&(o=d),s-r<=0&&t.offsetY<0?s=r:s>v&&(s=v),h.style.top=s+"px",h.style.left=o+"px",f=!1}}),typeof t.clickAction=="function"&&e(this).click(function(){t.clickAction(h,this)})})}})(jQuery),function(e){"use strict";var t={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1e3},n={activeTab:{},init:function(){e("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]").live("click",this.colorClickHandler),e(".utcw-tab-button").live("click",this.tabClickHandler),e(".utcw-input-taxonomy").live("click",this.taxonomyClickHandler),e(".utcw-all-authors").live("click",this.allAuthorsClickHandler),e(".utcw-selected-authors").live("click",this.selectedAuthorsClickHandler),e(".utcw-remove-config").live("click",this.removeConfigClickHandler),e(document).ready(this.initTooltip),e(document).ajaxSuccess(this.ajaxSuccessHandler)},initTooltip:function(){e(".utcw-help").wTooltip({style:t,className:"utcw-tooltip"})},removeConfigClickHandler:function(){var t=e(this),r=n.findWidgetParent(t),i=r.find(".utcw-load-config"),s=i.val(),o=t.data("input-name")+"[]",u=e(document.createElement("input"));u.attr("type","hidden"),u.attr("name",o),u.attr("value",s),t.after(u),i.find(":selected").remove()},allAuthorsClickHandler:function(){var t=e(this),r=n.findWidgetParent(t);r.find(".utcw-authors").addClass("hidden"),r.find(".utcw-author-field").attr("checked",!1)},selectedAuthorsClickHandler:function(){var t=e(this),r=n.findWidgetParent(t);r.find(".utcw-authors").removeClass("hidden")},tabClickHandler:function(){var t=e(this);return t.data("id")==="utcw-__i__"?!1:(t.parent().find(".utcw-tab-button").removeClass("utcw-active"),t.addClass("utcw-active"),t.parent().find("fieldset.utcw").addClass("hidden"),e("#"+t.data("tab")).removeClass("hidden"),n.activeTab[t.data("id")]=t.data("tab"),!1)},colorClickHandler:function(){var t=e('div[id$="set_chooser"]'),n=e('div[id$="span_chooser"]'),r=e(this).val();t.addClass("utcw-hidden"),n.addClass("utcw-hidden"),r==="set"?t.removeClass("utcw-hidden"):r==="span"&&n.removeClass("utcw-hidden")},findWidgetParent:function(e){return e.parents(".widget-content")},taxonomyClickHandler:function(){var t=e(this),r=t.val(),i=t.is(":checked"),s=n.findWidgetParent(t),o=s.find("#"+r+"-terms");i?o.removeClass("hidden"):o.addClass("hidden")},ajaxSuccessHandler:function(e,t,r){n.setCurrentTab.apply(n,[r.data]),n.initTooltip.apply(n)},setCurrentTab:function(t){var n=new Uri,r;n.setQuery(decodeURI(t)),n.getQueryParamValue("action")==="save-widget"&&n.getQueryParamValue("id_base")==="utcw"&&(r=n.getQueryParamValue("widget-id"),this.activeTab[r]&&e('button[data-tab="'+this.activeTab[r]+'"]').trigger("click"))}};n.init()}(jQuery);
pages/settings.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
@@ -36,13 +36,27 @@ if ( ! defined( 'ABSPATH' ) ) die();
36
  <a class="utcw-help"
37
  title="<?php _e( 'Only posts from the selected authors will be used when calculating the tag cloud.', 'utcw' ) ?>">?</a>
38
  <strong><?php _e( 'Authors:', 'utcw' ) ?></strong><br>
39
- <?php foreach ( $users as $user ) : ?>
40
- <input type="checkbox" name="<?php echo $this->get_field_name( 'authors' ) ?>[]"
41
- id="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"
42
- value="<?php echo $user->ID?>" <?php echo in_array( $user->ID, $config->authors, true ) ? 'checked="checked"' : ''; ?>>
43
- <label for="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"><?php echo $user->user_login?></label><br>
44
- <?php endforeach; ?>
45
  <br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  <a class="utcw-help"
48
  title="<?php _e( 'Which property of the tag should be used when determining the order of the tags in the cloud.', 'utcw' ) ?>">?</a>
@@ -83,15 +97,14 @@ if ( ! defined( 'ABSPATH' ) ) die();
83
  <a class="utcw-help"
84
  title="<?php _e( 'Which taxonomy should be used in the cloud. You should be able to choose a custom taxonomy as well.', 'utcw' ) ?>">?</a>
85
  <strong><label
86
- for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomy:', 'utcw' ) ?></label></strong><br>
87
- <select id="<?php echo $this->get_field_id( 'taxonomy' ) ?>"
88
- name="<?php echo $this->get_field_name( 'taxonomy' ) ?>">
89
- <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
90
- <option
91
- value="<?php echo $taxonomy->name ?>" <?php echo $config->taxonomy == $taxonomy->name ? 'selected="selected"' : ''?>><?php echo $taxonomy->labels->name ?></option>
92
- <?php endforeach; ?>
93
- </select><br>
94
- <br>
95
 
96
  <a class="utcw-help"
97
  title="<?php _e( 'Which post types should be used in the cloud. Only tags from posts from these post types will be used in the tag cloud.', 'utcw' ) ?>">?</a>
@@ -144,7 +157,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
144
  <a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
145
  <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
146
 
147
- <div id="<?php echo $taxonomy->name ?>-terms" <?php if ( $taxonomy->name != $config->taxonomy ) echo 'class="hidden"' ?>>
148
 
149
  <strong><?php printf( __( 'Terms for taxonomy %s', 'utcw' ), $taxonomy->labels->name ) ?></strong>
150
 
@@ -189,13 +202,13 @@ if ( ! defined( 'ABSPATH' ) ) die();
189
 
190
  <a class="utcw-help"
191
  title="<?php _e( 'The tag with the least number of posts will be the smallest, and the tag with the most number of posts will be the biggest.', 'utcw' ) ?>">?</a>
192
- <strong><?php _e( 'Tag size (in px):', 'utcw' ) ?></strong><br>
193
  <label for="<?php echo $this->get_field_id( 'size_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
194
- <input type="number" name="<?php echo $this->get_field_name( 'size_from' ) ?>"
195
  id="<?php echo $this->get_field_id( 'size_from' ) ?>" size="3"
196
  value="<?php echo $config->size_from ?>">
197
  <label for="<?php echo $this->get_field_id( 'size_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
198
- <input type="number" name="<?php echo $this->get_field_name( 'size_to' ) ?>"
199
  id="<?php echo $this->get_field_id( 'size_to' ) ?>" size="3"
200
  value="<?php echo $config->size_to ?>"><br>
201
  <br>
@@ -264,7 +277,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
264
 
265
  <a class="utcw-help"
266
  title="<?php _e( 'The spacing is a numerical value which controls how much space there is between letters, words, tags or rows. To use the default value for these settings just use the corresponding default value from the CSS specification: <ul><li>Letter spacing: normal</li><li>Word spacing: normal</li><li>Tag spacing (CSS margin): auto</li><li>Row spacing (CSS line height): inherit</li></ul>To use anything but the default values, just specify a number (the unit is pixels).', 'utcw' ) ?>">?</a>
267
- <strong><?php _e( 'Spacing (in px):', 'utcw' ) ?></strong><br>
268
  <label class="two-col"
269
  for="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"><?php _e( 'Between letters:', 'utcw' ) ?></label>
270
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'letter_spacing' ) ?>"
@@ -425,8 +438,8 @@ if ( ! defined( 'ABSPATH' ) ) die();
425
  </select><br>
426
  <br>
427
  <label
428
- for="<?php echo $this->get_field_id( 'link_border_width' ) ?>"><?php _e( 'Width (in px):', 'utcw' ) ?></label><br>
429
- <input type="number" name="<?php echo $this->get_field_name( 'link_border_width' ) ?>"
430
  id="<?php echo $this->get_field_id( 'link_border_width' ) ?>" value="<?php echo $config->link_border_width ?>"><br>
431
  <br>
432
  <label
@@ -518,8 +531,8 @@ if ( ! defined( 'ABSPATH' ) ) die();
518
  </select><br>
519
  <br>
520
  <label
521
- for="<?php echo $this->get_field_id( 'hover_border_width' ) ?>"><?php _e( 'Width (in px):', 'utcw' ) ?></label><br>
522
- <input type="number" name="<?php echo $this->get_field_name( 'hover_border_width' ) ?>"
523
  id="<?php echo $this->get_field_id( 'hover_border_width' ) ?>" value="<?php echo $config->hover_border_width ?>"><br>
524
  <br>
525
  <label
@@ -563,7 +576,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
563
  <label
564
  for="<?php echo $this->get_field_id( 'load_config_name' ) ?>"><?php _e( 'Configuration name', 'utcw' ) ?></label>
565
  <br>
566
- <select name="<?php echo $this->get_field_name( 'load_config_name' ) ?>"
567
  id="<?php echo $this->get_field_id( 'load_config_name' ) ?>">
568
 
569
  <?php foreach ( $configurations as $name => $config ) : ?>
@@ -572,6 +585,10 @@ if ( ! defined( 'ABSPATH' ) ) die();
572
 
573
  </select>
574
 
 
 
 
 
575
  <?php endif ?>
576
 
577
  </fieldset>
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
36
  <a class="utcw-help"
37
  title="<?php _e( 'Only posts from the selected authors will be used when calculating the tag cloud.', 'utcw' ) ?>">?</a>
38
  <strong><?php _e( 'Authors:', 'utcw' ) ?></strong><br>
39
+
40
+ <label>
41
+ <input type="radio" class="utcw-all-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( ! $config->authors ) echo 'checked="checked"'; ?>>
42
+ <?php _e( 'All authors', 'utcw' ) ?>
43
+ </label>
 
44
  <br>
45
+ <label>
46
+ <input type="radio" class="utcw-selected-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( $config->authors ) echo 'checked="checked"'; ?>>
47
+ <?php _e( 'Selected authors only', 'utcw' ) ?>
48
+ </label>
49
+ <br>
50
+
51
+ <div class="utcw-authors <?php if (!$config->authors) echo 'hidden' ?>">
52
+ <?php foreach ( $users as $user ) : ?>
53
+ <input class="utcw-author-field" type="checkbox" name="<?php echo $this->get_field_name( 'authors' ) ?>[]"
54
+ id="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"
55
+ value="<?php echo $user->ID ?>" <?php echo in_array( $user->ID, $config->authors, true ) ? 'checked="checked"' : ''; ?>>
56
+ <label for="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"><?php echo $user->display_name ?></label><br>
57
+ <?php endforeach; ?>
58
+ </div>
59
+ <br>
60
 
61
  <a class="utcw-help"
62
  title="<?php _e( 'Which property of the tag should be used when determining the order of the tags in the cloud.', 'utcw' ) ?>">?</a>
97
  <a class="utcw-help"
98
  title="<?php _e( 'Which taxonomy should be used in the cloud. You should be able to choose a custom taxonomy as well.', 'utcw' ) ?>">?</a>
99
  <strong><label
100
+ for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomies:', 'utcw' ) ?></label></strong><br>
101
+ <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
102
+ <label>
103
+ <input type="checkbox" class="utcw-input-taxonomy" value="<?php echo $taxonomy->name ?>" name="<?php echo $this->get_field_name( 'taxonomy' ) ?>[]" <?php if ( in_array( $taxonomy->name, $config->taxonomy ) ) echo 'checked="checked"' ?>>
104
+ <?php echo $taxonomy->labels->name ?>
105
+ </label><br>
106
+ <?php endforeach; ?>
107
+ <br>
 
108
 
109
  <a class="utcw-help"
110
  title="<?php _e( 'Which post types should be used in the cloud. Only tags from posts from these post types will be used in the tag cloud.', 'utcw' ) ?>">?</a>
157
  <a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
158
  <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
159
 
160
+ <div id="<?php echo $taxonomy->name ?>-terms" <?php if ( !in_array( $taxonomy->name, $config->taxonomy ) ) echo 'class="hidden"' ?>>
161
 
162
  <strong><?php printf( __( 'Terms for taxonomy %s', 'utcw' ), $taxonomy->labels->name ) ?></strong>
163
 
202
 
203
  <a class="utcw-help"
204
  title="<?php _e( 'The tag with the least number of posts will be the smallest, and the tag with the most number of posts will be the biggest.', 'utcw' ) ?>">?</a>
205
+ <strong><?php _e( 'Tag size:', 'utcw' ) ?></strong><br>
206
  <label for="<?php echo $this->get_field_id( 'size_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
207
+ <input type="text" name="<?php echo $this->get_field_name( 'size_from' ) ?>"
208
  id="<?php echo $this->get_field_id( 'size_from' ) ?>" size="3"
209
  value="<?php echo $config->size_from ?>">
210
  <label for="<?php echo $this->get_field_id( 'size_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
211
+ <input type="text" name="<?php echo $this->get_field_name( 'size_to' ) ?>"
212
  id="<?php echo $this->get_field_id( 'size_to' ) ?>" size="3"
213
  value="<?php echo $config->size_to ?>"><br>
214
  <br>
277
 
278
  <a class="utcw-help"
279
  title="<?php _e( 'The spacing is a numerical value which controls how much space there is between letters, words, tags or rows. To use the default value for these settings just use the corresponding default value from the CSS specification: <ul><li>Letter spacing: normal</li><li>Word spacing: normal</li><li>Tag spacing (CSS margin): auto</li><li>Row spacing (CSS line height): inherit</li></ul>To use anything but the default values, just specify a number (the unit is pixels).', 'utcw' ) ?>">?</a>
280
+ <strong><?php _e( 'Spacing:', 'utcw' ) ?></strong><br>
281
  <label class="two-col"
282
  for="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"><?php _e( 'Between letters:', 'utcw' ) ?></label>
283
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'letter_spacing' ) ?>"
438
  </select><br>
439
  <br>
440
  <label
441
+ for="<?php echo $this->get_field_id( 'link_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
442
+ <input type="text" name="<?php echo $this->get_field_name( 'link_border_width' ) ?>"
443
  id="<?php echo $this->get_field_id( 'link_border_width' ) ?>" value="<?php echo $config->link_border_width ?>"><br>
444
  <br>
445
  <label
531
  </select><br>
532
  <br>
533
  <label
534
+ for="<?php echo $this->get_field_id( 'hover_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
535
+ <input type="text" name="<?php echo $this->get_field_name( 'hover_border_width' ) ?>"
536
  id="<?php echo $this->get_field_id( 'hover_border_width' ) ?>" value="<?php echo $config->hover_border_width ?>"><br>
537
  <br>
538
  <label
576
  <label
577
  for="<?php echo $this->get_field_id( 'load_config_name' ) ?>"><?php _e( 'Configuration name', 'utcw' ) ?></label>
578
  <br>
579
+ <select class="utcw-load-config" name="<?php echo $this->get_field_name( 'load_config_name' ) ?>"
580
  id="<?php echo $this->get_field_id( 'load_config_name' ) ?>">
581
 
582
  <?php foreach ( $configurations as $name => $config ) : ?>
585
 
586
  </select>
587
 
588
+ <span class="submitbox">
589
+ <a class="submitdelete deletion utcw-remove-config" data-input-name="<?php echo $this->get_field_name( 'remove_config' ) ?>"><?php _e( 'Delete', 'utcw' ) ?></a>
590
+ </span>
591
+
592
  <?php endif ?>
593
 
594
  </fieldset>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: exz
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 3.0
5
  Tested up to: 3.5
6
- Stable tag: 2.0.1
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
  License: GPLv2 or later
9
 
@@ -47,6 +47,14 @@ If you have questions, please post them in the forums.
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
 
 
50
  = 2.0.1 =
51
 
52
  * Small bug fix in the widget options panel
@@ -62,6 +70,10 @@ The upgrade notice history for the 1.x branch is available on [GitHub](https://g
62
 
63
  == Upgrade Notice ==
64
 
 
 
 
 
65
  = 2.0.1 =
66
 
67
  * Small bug fix in the widget options panel
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 3.0
5
  Tested up to: 3.5
6
+ Stable tag: 2.1
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
  License: GPLv2 or later
9
 
47
 
48
  == Changelog ==
49
 
50
+ = 2.1 =
51
+
52
+ * Support for multiple taxonomies per widget
53
+ * Improved UI for selecting authors
54
+ * Fixed problem with authors setting not working correctly
55
+ * Support for setting minimum post count to zero
56
+ * Support for other measurements than pixels
57
+
58
  = 2.0.1 =
59
 
60
  * Small bug fix in the widget options panel
70
 
71
  == Upgrade Notice ==
72
 
73
+ = 2.1 =
74
+
75
+ * New features, see the plugin page at wordpress.org for full details
76
+
77
  = 2.0.1 =
78
 
79
  * Small bug fix in the widget options panel
ultimate-tag-cloud-widget.php CHANGED
@@ -3,11 +3,12 @@
3
  Plugin Name: Ultimate tag cloud widget
4
  Plugin URI: https://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
5
  Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
6
- Version: 2.0.1
7
  Author: Rickard Andersson
8
  Author URI: https://www.0x539.se
9
  License: GPLv2
10
  */
11
 
12
- // Legacy file for compatibility with verison 1.x
 
13
  require_once 'utcw.php';
3
  Plugin Name: Ultimate tag cloud widget
4
  Plugin URI: https://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
5
  Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
6
+ Version: 2.1 beta1
7
  Author: Rickard Andersson
8
  Author URI: https://www.0x539.se
9
  License: GPLv2
10
  */
11
 
12
+ // Legacy file for compatibility with version 1.x
13
+ /** @noinspection PhpIncludeInspection */
14
  require_once 'utcw.php';
utcw-config.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
@@ -40,18 +40,18 @@ class UTCW_Config {
40
 
41
  /**
42
  * The smallest possible size
43
- * Default: 10
44
  *
45
- * @var int
46
  * @since 2.0
47
  */
48
  public $size_from;
49
 
50
  /**
51
  * The greatest possible size
52
- * Default: 30
53
  *
54
- * @var int
55
  * @since 2.0
56
  */
57
  public $size_to;
@@ -67,9 +67,9 @@ class UTCW_Config {
67
 
68
  /**
69
  * Which taxonomy to show tags from
70
- * Default: post_tag
71
  *
72
- * @var string
73
  * @since 2.0
74
  */
75
  public $taxonomy;
@@ -97,7 +97,7 @@ class UTCW_Config {
97
  * CSS letter-spacing value (in pixels)
98
  * Default: normal
99
  *
100
- * @var int|string
101
  * @since 2.0
102
  */
103
  public $letter_spacing;
@@ -106,7 +106,7 @@ class UTCW_Config {
106
  * CSS word-spacing value (in pixels)
107
  * Default: normal
108
  *
109
- * @var int|string
110
  * @since 2.0
111
  */
112
  public $word_spacing;
@@ -212,7 +212,7 @@ class UTCW_Config {
212
  * Border width for links
213
  * Default: 0
214
  *
215
- * @var int
216
  * @since 2.0
217
  */
218
  public $link_border_width;
@@ -291,7 +291,7 @@ class UTCW_Config {
291
  * Border width for links in their hover state
292
  * Default: 0
293
  *
294
- * @var int
295
  * @since 2.0
296
  */
297
  public $hover_border_width;
@@ -310,7 +310,7 @@ class UTCW_Config {
310
  * CSS margin between tags
311
  * Default: auto
312
  *
313
- * @var int
314
  * @since 2.0
315
  */
316
  public $tag_spacing;
@@ -337,7 +337,7 @@ class UTCW_Config {
337
  * CSS line-height for the tags
338
  * Default: inherit
339
  *
340
- * @var int
341
  * @since 2.0
342
  */
343
  public $line_height;
@@ -487,10 +487,10 @@ class UTCW_Config {
487
  static protected $options = array(
488
  'title' => 'Tag Cloud',
489
  'order' => 'name',
490
- 'size_from' => 10,
491
- 'size_to' => 30,
492
  'max' => 45,
493
- 'taxonomy' => 'post_tag',
494
  'reverse' => false,
495
  'color' => 'none',
496
  'letter_spacing' => 'normal',
@@ -505,7 +505,7 @@ class UTCW_Config {
505
  'link_italic' => 'default',
506
  'link_bg_color' => 'transparent',
507
  'link_border_style' => 'none',
508
- 'link_border_width' => 0,
509
  'link_border_color' => 'none',
510
  'hover_underline' => 'default',
511
  'hover_bold' => 'default',
@@ -513,7 +513,7 @@ class UTCW_Config {
513
  'hover_bg_color' => 'transparent',
514
  'hover_color' => 'default',
515
  'hover_border_style' => 'none',
516
- 'hover_border_width' => 0,
517
  'hover_border_color' => 'none',
518
  'tag_spacing' => 'auto',
519
  'debug' => false,
@@ -672,7 +672,18 @@ class UTCW_Config {
672
  break;
673
 
674
  case 'taxonomy':
675
- $valid = in_array( $input[ $key ], $this->allowed_taxonomies );
 
 
 
 
 
 
 
 
 
 
 
676
  break;
677
 
678
  case 'post_type':
@@ -689,22 +700,30 @@ class UTCW_Config {
689
  $input[ $key ] = explode( ',', $input[ $key ] );
690
  }
691
 
692
- $valid = $this->is_array_numeric( $input[ $key ] );
 
693
  break;
694
 
695
  case 'size_from':
696
- $valid = isset( $input[ 'size_to' ] ) && $input[ 'size_from' ] <= $input[ 'size_to' ];
 
 
697
  break;
698
 
699
  case 'size_to':
700
- $valid = isset( $input[ 'size_from' ] ) && $input[ 'size_to' ] >= $input[ 'size_from' ];
 
 
701
  break;
702
 
703
  case 'letter_spacing':
704
  case 'word_spacing':
705
  case 'tag_spacing':
706
  case 'line_height':
707
- $valid = is_numeric( $input[ $key ] );
 
 
 
708
  break;
709
  }
710
 
@@ -723,8 +742,7 @@ class UTCW_Config {
723
  }
724
  }
725
  $this->$key = $input[ $key ];
726
- } // Special handling of some properties which have string defaults but integer values expected
727
- else if ( in_array( $key, array( 'letter_spacing', 'word_spacing', 'tag_spacing', 'line_height' ) ) ) {
728
  $this->$key = intval( $input[ $key ] );
729
  } else if ( is_string( self::$options[ $key ] ) && is_string( $input[ $key ] ) && strlen( $input[ $key ] ) > 0 ) {
730
  $this->$key = $input[ $key ];
@@ -757,6 +775,43 @@ class UTCW_Config {
757
  return true;
758
  }
759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  /**
761
  * Returns an array of current configuration
762
  *
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
40
 
41
  /**
42
  * The smallest possible size
43
+ * Default: 10px
44
  *
45
+ * @var string
46
  * @since 2.0
47
  */
48
  public $size_from;
49
 
50
  /**
51
  * The greatest possible size
52
+ * Default: 30px
53
  *
54
+ * @var string
55
  * @since 2.0
56
  */
57
  public $size_to;
67
 
68
  /**
69
  * Which taxonomy to show tags from
70
+ * Default: [post_tag]
71
  *
72
+ * @var array
73
  * @since 2.0
74
  */
75
  public $taxonomy;
97
  * CSS letter-spacing value (in pixels)
98
  * Default: normal
99
  *
100
+ * @var string
101
  * @since 2.0
102
  */
103
  public $letter_spacing;
106
  * CSS word-spacing value (in pixels)
107
  * Default: normal
108
  *
109
+ * @var string
110
  * @since 2.0
111
  */
112
  public $word_spacing;
212
  * Border width for links
213
  * Default: 0
214
  *
215
+ * @var string
216
  * @since 2.0
217
  */
218
  public $link_border_width;
291
  * Border width for links in their hover state
292
  * Default: 0
293
  *
294
+ * @var string
295
  * @since 2.0
296
  */
297
  public $hover_border_width;
310
  * CSS margin between tags
311
  * Default: auto
312
  *
313
+ * @var string
314
  * @since 2.0
315
  */
316
  public $tag_spacing;
337
  * CSS line-height for the tags
338
  * Default: inherit
339
  *
340
+ * @var string
341
  * @since 2.0
342
  */
343
  public $line_height;
487
  static protected $options = array(
488
  'title' => 'Tag Cloud',
489
  'order' => 'name',
490
+ 'size_from' => '10px',
491
+ 'size_to' => '30px',
492
  'max' => 45,
493
+ 'taxonomy' => array( 'post_tag' ),
494
  'reverse' => false,
495
  'color' => 'none',
496
  'letter_spacing' => 'normal',
505
  'link_italic' => 'default',
506
  'link_bg_color' => 'transparent',
507
  'link_border_style' => 'none',
508
+ 'link_border_width' => '0',
509
  'link_border_color' => 'none',
510
  'hover_underline' => 'default',
511
  'hover_bold' => 'default',
513
  'hover_bg_color' => 'transparent',
514
  'hover_color' => 'default',
515
  'hover_border_style' => 'none',
516
+ 'hover_border_width' => '0',
517
  'hover_border_color' => 'none',
518
  'tag_spacing' => 'auto',
519
  'debug' => false,
672
  break;
673
 
674
  case 'taxonomy':
675
+ if ( ! is_array( $input[ $key ] ) ) {
676
+ $input[ $key ] = explode( ',', $input[ $key ] );
677
+ }
678
+
679
+ // Remove invalid taxonomies
680
+ foreach ( $input[ $key ] as $tax_key => $taxonomy ) {
681
+ if ( ! in_array( $taxonomy, $this->allowed_taxonomies ) ) {
682
+ unset( $input[ $key ][ $tax_key ] );
683
+ }
684
+ }
685
+
686
+ $valid = ! ! $input[ $key ]; // Setting is valid if any of the taxonomies were valid
687
  break;
688
 
689
  case 'post_type':
700
  $input[ $key ] = explode( ',', $input[ $key ] );
701
  }
702
 
703
+ $valid = $this->is_array_numeric( $input[ $key ] );
704
+ $input[ $key ] = array_map( 'intval', $input[ $key ] );
705
  break;
706
 
707
  case 'size_from':
708
+ $input[ 'size_from' ] = $this->parse_measurement( $input[ 'size_from' ] );
709
+ $size_to = isset( $input[ 'size_to' ] ) ? $input[ 'size_to' ] : self::$options[ 'size_to' ];
710
+ $valid = $input[ 'size_from' ] !== false && $this->equal_units( $input[ 'size_from' ], $size_to ) && floatval( $input[ 'size_from' ] ) <= floatval( $size_to );
711
  break;
712
 
713
  case 'size_to':
714
+ $input[ 'size_to' ] = $this->parse_measurement( $input[ 'size_to' ] );
715
+ $size_from = isset( $input[ 'size_from' ] ) ? $input[ 'size_from' ] : self::$options[ 'size_from' ];
716
+ $valid = $input[ 'size_to' ] !== false && $this->equal_units( $size_from, $input[ 'size_to' ] ) && floatval( $input[ 'size_to' ] ) >= floatval( $size_from );
717
  break;
718
 
719
  case 'letter_spacing':
720
  case 'word_spacing':
721
  case 'tag_spacing':
722
  case 'line_height':
723
+ case 'link_border_width':
724
+ case 'hover_border_width':
725
+ $input[ $key ] = $this->parse_measurement( $input[ $key ] );
726
+ $valid = $input[ $key ] !== false;
727
  break;
728
  }
729
 
742
  }
743
  }
744
  $this->$key = $input[ $key ];
745
+ } else if ( $key == 'minimum' ) {
 
746
  $this->$key = intval( $input[ $key ] );
747
  } else if ( is_string( self::$options[ $key ] ) && is_string( $input[ $key ] ) && strlen( $input[ $key ] ) > 0 ) {
748
  $this->$key = $input[ $key ];
775
  return true;
776
  }
777
 
778
+ /**
779
+ * Parses the input value as measurement
780
+ *
781
+ * @param mixed $input
782
+ *
783
+ * @return bool|string False on failure
784
+ * @since 2.1
785
+ */
786
+ private function parse_measurement( $input ) {
787
+ if ( ! preg_match( '/^' . UTCW_DECIMAL_REGEX . '(em|px|%)?$/i', $input ) ) {
788
+ return false;
789
+ }
790
+
791
+ // Convert integer values to pixel values
792
+ if ( preg_match( '/^' . UTCW_DECIMAL_REGEX . '$/', $input ) ) {
793
+ return $input . 'px';
794
+ }
795
+
796
+ return $input;
797
+ }
798
+
799
+ /**
800
+ * Checks if the two measurements have the same unit
801
+ *
802
+ * @param string $measurement1
803
+ * @param string $measurement2
804
+ *
805
+ * @return bool
806
+ * @since 2.1
807
+ */
808
+ private function equal_units( $measurement1, $measurement2 ) {
809
+ $unit1 = preg_replace( '/' . UTCW_DECIMAL_REGEX . '/', '', $measurement1 );
810
+ $unit2 = preg_replace( '/' . UTCW_DECIMAL_REGEX . '/', '', $measurement2 );
811
+
812
+ return $unit1 === $unit2 || ( $unit1 === 'px' && $unit2 === '' ) || ( $unit1 === '' && $unit2 === 'px' );
813
+ }
814
+
815
  /**
816
  * Returns an array of current configuration
817
  *
utcw-data.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
@@ -43,6 +43,14 @@ class UTCW_Data {
43
  */
44
  protected $plugin;
45
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Creates a new instance
48
  *
@@ -68,17 +76,13 @@ class UTCW_Data {
68
  $query = array();
69
 
70
  // Base query with joins
71
- $query[ ] = 'SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count`';
72
- $query[ ] = 'FROM `' . $this->db->posts . '` AS p';
73
- $query[ ] = 'JOIN `' . $this->db->term_relationships . '` AS tr ON tr.object_id = p.ID';
74
- $query[ ] = 'JOIN `' . $this->db->term_taxonomy . '` AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id';
75
- $query[ ] = 'JOIN `' . $this->db->terms . '` AS t ON t.term_id = tt.term_id';
76
 
77
- // Add taxonomy statement
78
- $query[ ] = 'WHERE tt.taxonomy = %s';
79
- $parameters[ ] = $this->config->taxonomy;
80
-
81
- // Add authors statement if configured
82
  if ( $this->config->authors ) {
83
  $author_parameters = array();
84
 
@@ -87,10 +91,10 @@ class UTCW_Data {
87
  $parameters[ ] = $author;
88
  }
89
 
90
- $query[ ] = 'AND post_author IN (' . join( ',', $author_parameters ) . ')';
91
  }
92
 
93
- // Add post types statement
94
  $post_type_parameters = array();
95
 
96
  foreach ( $this->config->post_type as $post_type ) {
@@ -98,15 +102,31 @@ class UTCW_Data {
98
  $parameters[ ] = $post_type;
99
  }
100
 
101
- $query[ ] = 'AND post_type IN (' . join( ',', $post_type_parameters ) . ')';
102
 
103
  // Add post status statement, authenticated users are allowed to view tags for private posts
104
  if ( $this->config->authenticated ) {
105
- $query[ ] = "AND post_status IN ('publish','private')";
106
  } else {
107
- $query[ ] = "AND post_status = 'publish'";
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  // Add include or exclude statement
111
  if ( $this->config->tags_list ) {
112
  $tags_list_parameters = array();
@@ -124,16 +144,10 @@ class UTCW_Data {
124
  }
125
  }
126
 
127
- // Add days old statement
128
- if ( $this->config->days_old ) {
129
- $query[ ] = 'AND post_date > %s';
130
- $parameters[ ] = date( 'Y-m-d', strtotime( '-' . $this->config->days_old . ' days' ) );
131
- }
132
-
133
  $query[ ] = 'GROUP BY tr.term_taxonomy_id';
134
 
135
  // Add minimum constraint
136
- if ( $this->config->minimum > 1 ) {
137
  $query[ ] = 'HAVING count >= %d';
138
  $parameters[ ] = $this->config->minimum;
139
  }
@@ -154,7 +168,6 @@ class UTCW_Data {
154
  $subquery_required = false;
155
  }
156
 
157
-
158
  // No subquery is needed if the order should be by color since the sorting is done in PHP afterwards
159
  if ( $this->config->order == 'color' ) {
160
  $subquery_required = false;
@@ -195,8 +208,9 @@ class UTCW_Data {
195
  $query = $this->db->prepare( $query, $parameters );
196
 
197
  // Fetch terms from DB
198
- $result = $this->db->get_results( $query );
199
- $terms = array();
 
200
 
201
  // Calculate sizes
202
  $min_count = PHP_INT_MAX;
@@ -211,14 +225,17 @@ class UTCW_Data {
211
  $max_count = $item->count;
212
  }
213
 
214
- $item->taxonomy = $this->config->taxonomy;
215
- $terms[ ] = new UTCW_Term( $item, $this->plugin );
216
  }
217
 
218
- $font_step = $this->calc_step( $min_count, $max_count, $this->config->size_from, $this->config->size_to );
 
 
 
 
219
 
220
  foreach ( $terms as $term ) {
221
- $term->size = $this->calc_size( $this->config->size_from, $term->count, $min_count, $font_step );
222
  }
223
 
224
  // Set colors
@@ -337,4 +354,11 @@ class UTCW_Data {
337
 
338
  return $step;
339
  }
 
 
 
 
 
 
 
340
  }
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
43
  */
44
  protected $plugin;
45
 
46
+ /**
47
+ * A copy of the SQL query for debugging purposes
48
+ *
49
+ * @var string
50
+ * @since 2.1
51
+ */
52
+ protected $query;
53
+
54
  /**
55
  * Creates a new instance
56
  *
76
  $query = array();
77
 
78
  // Base query with joins
79
+ $query[ ] = 'SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count`, tt.taxonomy';
80
+ $query[ ] = 'FROM `' . $this->db->terms . '` AS t';
81
+ $query[ ] = 'JOIN `' . $this->db->term_taxonomy . '` AS tt ON t.term_id = tt.term_id';
82
+ $query[ ] = 'LEFT JOIN `' . $this->db->term_relationships . '` AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id';
83
+ $query[ ] = 'LEFT JOIN `' . $this->db->posts . '` AS p ON tr.object_id = p.ID';
84
 
85
+ // Add authors constraint if configured
 
 
 
 
86
  if ( $this->config->authors ) {
87
  $author_parameters = array();
88
 
91
  $parameters[ ] = $author;
92
  }
93
 
94
+ $query[ ] = 'AND p.post_author IN (' . join( ',', $author_parameters ) . ')';
95
  }
96
 
97
+ // Add post types constraint
98
  $post_type_parameters = array();
99
 
100
  foreach ( $this->config->post_type as $post_type ) {
102
  $parameters[ ] = $post_type;
103
  }
104
 
105
+ $query[ ] = 'AND p.post_type IN (' . join( ',', $post_type_parameters ) . ')';
106
 
107
  // Add post status statement, authenticated users are allowed to view tags for private posts
108
  if ( $this->config->authenticated ) {
109
+ $query[ ] = "AND p.post_status IN ('publish','private')";
110
  } else {
111
+ $query[ ] = "AND p.post_status = 'publish'";
112
  }
113
 
114
+ // Add days old constraint
115
+ if ( $this->config->days_old ) {
116
+ $query[ ] = 'AND p.post_date > %s';
117
+ $parameters[ ] = date( 'Y-m-d', strtotime( '-' . $this->config->days_old . ' days' ) );
118
+ }
119
+
120
+ // Add taxonomy statement
121
+ $taxonomy_parameters = array();
122
+
123
+ foreach ( $this->config->taxonomy as $taxonomy ) {
124
+ $taxonomy_parameters[ ] = '%s';
125
+ $parameters[ ] = $taxonomy;
126
+ }
127
+
128
+ $query[ ] = 'WHERE tt.taxonomy IN (' . join( ',', $taxonomy_parameters ) . ')';
129
+
130
  // Add include or exclude statement
131
  if ( $this->config->tags_list ) {
132
  $tags_list_parameters = array();
144
  }
145
  }
146
 
 
 
 
 
 
 
147
  $query[ ] = 'GROUP BY tr.term_taxonomy_id';
148
 
149
  // Add minimum constraint
150
+ if ( $this->config->minimum ) {
151
  $query[ ] = 'HAVING count >= %d';
152
  $parameters[ ] = $this->config->minimum;
153
  }
168
  $subquery_required = false;
169
  }
170
 
 
171
  // No subquery is needed if the order should be by color since the sorting is done in PHP afterwards
172
  if ( $this->config->order == 'color' ) {
173
  $subquery_required = false;
208
  $query = $this->db->prepare( $query, $parameters );
209
 
210
  // Fetch terms from DB
211
+ $result = $this->db->get_results( $query );
212
+ $this->query = $this->db->last_query;
213
+ $terms = array();
214
 
215
  // Calculate sizes
216
  $min_count = PHP_INT_MAX;
225
  $max_count = $item->count;
226
  }
227
 
228
+ $terms[ ] = new UTCW_Term( $item, $this->plugin );
 
229
  }
230
 
231
+ $size_from = floatval( $this->config->size_from );
232
+ $size_to = floatval( $this->config->size_to );
233
+ $unit = preg_replace( '/' . UTCW_DECIMAL_REGEX . '/', '', $this->config->size_from );
234
+
235
+ $font_step = $this->calc_step( $min_count, $max_count, $size_from, $size_to );
236
 
237
  foreach ( $terms as $term ) {
238
+ $term->size = $this->calc_size( $size_from, $term->count, $min_count, $font_step ) . $unit;
239
  }
240
 
241
  // Set colors
354
 
355
  return $step;
356
  }
357
+
358
+ /**
359
+ * Cleans up sensitive data before being used in debug output
360
+ */
361
+ public function cleanup_for_debug() {
362
+ unset( $this->db );
363
+ }
364
  }
utcw-render.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
@@ -124,7 +124,7 @@ class UTCW_Render {
124
  $title = $this->config->show_title ? sprintf( ' title="' . _n( '%s topic', '%s topics', $term->count ) . '"', $term->count ) : '';
125
 
126
  $terms[ ] = sprintf(
127
- '%s<a class="tag-link-%s" href="%s" style="font-size:%spx%s"%s>%s</a>%s',
128
  $this->config->prefix,
129
  $term->term_id,
130
  $term->link,
@@ -141,7 +141,9 @@ class UTCW_Render {
141
  $markup[ ] = '</div>';
142
 
143
  if ( $this->config->debug ) {
144
- $markup[ ] = sprintf( "<!-- Ultimate Tag Cloud Debug information:\n%s -->", print_r( $this->data, true ) );
 
 
145
  }
146
 
147
  if ( $this->config->after_widget ) {
@@ -164,11 +166,11 @@ class UTCW_Render {
164
  }
165
 
166
  if ( ! $this->has_default_value( 'letter_spacing' ) ) {
167
- $main_styles[ ] = sprintf( 'letter-spacing:%spx', $this->config->letter_spacing );
168
  }
169
 
170
  if ( ! $this->has_default_value( 'word_spacing' ) ) {
171
- $main_styles[ ] = sprintf( 'word-spacing:%spx', $this->config->word_spacing );
172
  }
173
 
174
  $link_styles = array();
@@ -190,7 +192,7 @@ class UTCW_Render {
190
  }
191
 
192
  if ( ! $this->has_default_value( 'link_border_style' ) && ! $this->has_default_value( 'link_border_color' ) && ! $this->has_default_value( 'link_border_width' ) ) {
193
- $link_styles[ ] = sprintf( 'border:%s %spx %s', $this->config->link_border_style, $this->config->link_border_width, $this->config->link_border_color );
194
  } else {
195
  if ( ! $this->has_default_value( 'link_border_style' ) ) {
196
  $link_styles[ ] = sprintf( 'border-style:%s', $this->config->link_border_style );
@@ -201,16 +203,16 @@ class UTCW_Render {
201
  }
202
 
203
  if ( ! $this->has_default_value( 'link_border_width' ) ) {
204
- $link_styles[ ] = sprintf( 'border-width:%spx', $this->config->link_border_width );
205
  }
206
  }
207
 
208
  if ( ! $this->has_default_value( 'tag_spacing' ) ) {
209
- $link_styles[ ] = sprintf( 'margin-right:%spx', $this->config->tag_spacing );
210
  }
211
 
212
  if ( ! $this->has_default_value( 'line_height' ) ) {
213
- $link_styles[ ] = sprintf( 'line-height:%spx', $this->config->line_height );
214
  }
215
 
216
  $hover_styles = array();
@@ -233,7 +235,7 @@ class UTCW_Render {
233
 
234
 
235
  if ( ! $this->has_default_value( 'hover_border_style' ) && ! $this->has_default_value( 'hover_border_color' ) && ! $this->has_default_value( 'hover_border_width' ) ) {
236
- $hover_styles[ ] = sprintf( 'border:%s %spx %s', $this->config->hover_border_style, $this->config->hover_border_width, $this->config->hover_border_color );
237
  } else {
238
  if ( ! $this->has_default_value( 'hover_border_style' ) ) {
239
  $hover_styles[ ] = sprintf( 'border-style:%s', $this->config->hover_border_style );
@@ -244,7 +246,7 @@ class UTCW_Render {
244
  }
245
 
246
  if ( ! $this->has_default_value( 'hover_border_width' ) ) {
247
- $hover_styles[ ] = sprintf( 'border-width:%spx', $this->config->hover_border_width );
248
  }
249
  }
250
 
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
124
  $title = $this->config->show_title ? sprintf( ' title="' . _n( '%s topic', '%s topics', $term->count ) . '"', $term->count ) : '';
125
 
126
  $terms[ ] = sprintf(
127
+ '%s<a class="tag-link-%s" href="%s" style="font-size:%s%s"%s>%s</a>%s',
128
  $this->config->prefix,
129
  $term->term_id,
130
  $term->link,
141
  $markup[ ] = '</div>';
142
 
143
  if ( $this->config->debug ) {
144
+ $debug_object = clone $this->data;
145
+ $debug_object->cleanup_for_debug();
146
+ $markup[ ] = sprintf( "<!-- Ultimate Tag Cloud Debug information:\n%s -->", print_r( $debug_object, true ) );
147
  }
148
 
149
  if ( $this->config->after_widget ) {
166
  }
167
 
168
  if ( ! $this->has_default_value( 'letter_spacing' ) ) {
169
+ $main_styles[ ] = sprintf( 'letter-spacing:%s', $this->config->letter_spacing );
170
  }
171
 
172
  if ( ! $this->has_default_value( 'word_spacing' ) ) {
173
+ $main_styles[ ] = sprintf( 'word-spacing:%s', $this->config->word_spacing );
174
  }
175
 
176
  $link_styles = array();
192
  }
193
 
194
  if ( ! $this->has_default_value( 'link_border_style' ) && ! $this->has_default_value( 'link_border_color' ) && ! $this->has_default_value( 'link_border_width' ) ) {
195
+ $link_styles[ ] = sprintf( 'border:%s %s %s', $this->config->link_border_style, $this->config->link_border_width, $this->config->link_border_color );
196
  } else {
197
  if ( ! $this->has_default_value( 'link_border_style' ) ) {
198
  $link_styles[ ] = sprintf( 'border-style:%s', $this->config->link_border_style );
203
  }
204
 
205
  if ( ! $this->has_default_value( 'link_border_width' ) ) {
206
+ $link_styles[ ] = sprintf( 'border-width:%s', $this->config->link_border_width );
207
  }
208
  }
209
 
210
  if ( ! $this->has_default_value( 'tag_spacing' ) ) {
211
+ $link_styles[ ] = sprintf( 'margin-right:%s', $this->config->tag_spacing );
212
  }
213
 
214
  if ( ! $this->has_default_value( 'line_height' ) ) {
215
+ $link_styles[ ] = sprintf( 'line-height:%s', $this->config->line_height );
216
  }
217
 
218
  $hover_styles = array();
235
 
236
 
237
  if ( ! $this->has_default_value( 'hover_border_style' ) && ! $this->has_default_value( 'hover_border_color' ) && ! $this->has_default_value( 'hover_border_width' ) ) {
238
+ $hover_styles[ ] = sprintf( 'border:%s %s %s', $this->config->hover_border_style, $this->config->hover_border_width, $this->config->hover_border_color );
239
  } else {
240
  if ( ! $this->has_default_value( 'hover_border_style' ) ) {
241
  $hover_styles[ ] = sprintf( 'border-style:%s', $this->config->hover_border_style );
246
  }
247
 
248
  if ( ! $this->has_default_value( 'hover_border_width' ) ) {
249
+ $hover_styles[ ] = sprintf( 'border-width:%s', $this->config->hover_border_width );
250
  }
251
  }
252
 
utcw-term.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
utcw-widget.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
@@ -77,6 +77,12 @@ class UTCW extends WP_Widget {
77
  $this->plugin->save_configuration( $new_instance[ 'save_config_name' ], $config->get_instance() );
78
  }
79
 
 
 
 
 
 
 
80
  return $config->get_instance();
81
  }
82
 
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
77
  $this->plugin->save_configuration( $new_instance[ 'save_config_name' ], $config->get_instance() );
78
  }
79
 
80
+ if ( isset( $new_instance[ 'remove_config' ] ) && is_array( $new_instance[ 'remove_config' ] ) ) {
81
+ foreach ( $new_instance[ 'remove_config' ] as $configuration ) {
82
+ $this->plugin->remove_configuration( $configuration );
83
+ }
84
+ }
85
+
86
  return $config->get_instance();
87
  }
88
 
utcw.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.0
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
16
  * @var string
17
  * @since 2.0
18
  */
19
- define( 'UTCW_VERSION', '2.0.1' );
20
 
21
  /**
22
  * If development mode is currently enabled
@@ -34,6 +34,14 @@ define( 'UTCW_DEV', false );
34
  */
35
  define( 'UTCW_HEX_COLOR_REGEX', '/#([a-f0-9]{6}|[a-f0-9]{3})/i' );
36
 
 
 
 
 
 
 
 
 
37
  /**
38
  * printf format for rendering hexadecimal colors
39
  *
@@ -219,6 +227,25 @@ class UTCW_Plugin {
219
  }
220
  }
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  /**
223
  * Saves the configuration
224
  *
@@ -232,7 +259,7 @@ class UTCW_Plugin {
232
  $configs = $this->get_configurations();
233
  $configs[ $name ] = $config;
234
 
235
- return update_option( 'utcw_saved_configs', $configs );
236
  }
237
 
238
  /**
@@ -263,6 +290,18 @@ class UTCW_Plugin {
263
  return get_option( 'utcw_saved_configs', array() );
264
  }
265
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  /**
267
  * Returns boolean true if the current page request is for an authenticated user
268
  *
@@ -289,16 +328,23 @@ class UTCW_Plugin {
289
  }
290
 
291
  /**
292
- * Check if the term exist for taxonomy
293
  *
294
  * @param int $term_id Term ID
295
- * @param string $taxonomy Taxonomy name
296
  *
297
  * @return bool
298
  * @since 2.0
299
  */
300
- public function check_term_taxonomy( $term_id, $taxonomy ) {
301
- return ! ! get_term( $term_id, $taxonomy );
 
 
 
 
 
 
 
302
  }
303
 
304
  /**
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.1
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage main
16
  * @var string
17
  * @since 2.0
18
  */
19
+ define( 'UTCW_VERSION', '2.1 beta1' );
20
 
21
  /**
22
  * If development mode is currently enabled
34
  */
35
  define( 'UTCW_HEX_COLOR_REGEX', '/#([a-f0-9]{6}|[a-f0-9]{3})/i' );
36
 
37
+ /**
38
+ * Regular expression for matching decimal numbers
39
+ *
40
+ * @var string
41
+ * @since 2.1
42
+ */
43
+ define( 'UTCW_DECIMAL_REGEX', '\d+(\.\d+)?' );
44
+
45
  /**
46
  * printf format for rendering hexadecimal colors
47
  *
227
  }
228
  }
229
 
230
+ /**
231
+ * Removes a previously saved configuration
232
+ *
233
+ * @param string $name
234
+ *
235
+ * @return bool
236
+ * @since 2.1
237
+ */
238
+ function remove_configuration( $name ) {
239
+ $configs = $this->get_configurations();
240
+
241
+ if ( isset( $configs[ $name ] ) ) {
242
+ unset( $configs[ $name ] );
243
+ return $this->set_configurations( $configs );
244
+ }
245
+
246
+ return false;
247
+ }
248
+
249
  /**
250
  * Saves the configuration
251
  *
259
  $configs = $this->get_configurations();
260
  $configs[ $name ] = $config;
261
 
262
+ return $this->set_configurations( $configs );
263
  }
264
 
265
  /**
290
  return get_option( 'utcw_saved_configs', array() );
291
  }
292
 
293
+ /**
294
+ * Set saved configurations
295
+ *
296
+ * @param array $configs
297
+ *
298
+ * @return bool
299
+ * @since 2.1
300
+ */
301
+ protected function set_configurations( $configs ) {
302
+ return update_option( 'utcw_saved_configs', $configs );
303
+ }
304
+
305
  /**
306
  * Returns boolean true if the current page request is for an authenticated user
307
  *
328
  }
329
 
330
  /**
331
+ * Check if the term exist for any of the taxonomies
332
  *
333
  * @param int $term_id Term ID
334
+ * @param array $taxonomy Array of taxonomy names
335
  *
336
  * @return bool
337
  * @since 2.0
338
  */
339
+ public function check_term_taxonomy( $term_id, array $taxonomy ) {
340
+
341
+ foreach ( $taxonomy as $tax ) {
342
+ if ( get_term( $term_id, $tax ) ) {
343
+ return true;
344
+ }
345
+ }
346
+
347
+ return false;
348
  }
349
 
350
  /**