Ultimate Tag Cloud Widget - Version 2.5-beta1

Version Description

= 2.5 =

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

= 2.4 =

  • Issues with WPML and custom taxonomies resolved. New features, see plugin page at wordpress.org for full details.

= 2.3.1 =

  • Security fix for sensitive data exposed when using the debug option

= 2.3 =

  • New features, see plugin page at wordpress.org for full details. Watch out for the changes in class names: https://github.com/rickard2/utcw/issues/29

= 2.2.3 =

  • Fixed naming collision issue with other plugins

= 2.2.2 =

  • Fixed widget initialization issue

= 2.2.1 =

  • Fixes compatibility issue with PHP 5.2

= 2.2 =

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

= 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.5-beta1
Comparing to
See all releases

Code changes from version 2.4 to 2.5-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}fieldset.utcw .post-term-search-result{background:#fff;box-shadow:0 0 6px #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}fieldset.utcw .post-term-search-result li{padding:0 0.5em;cursor:pointer}fieldset.utcw .post-term-search-result li:first-of-type{padding-top:0.5em}fieldset.utcw .post-term-search-result li:last-of-type{padding-bottom:0.5em}fieldset.utcw .submitbox{float:right;cursor:pointer}.utcw-hidden{display:none}.utcw-active{font-weight:bold;opacity:1}.utcw-authors{margin-top:5px}.utcw-remove-config{cursor:pointer}
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}fieldset.utcw .post-term-search-result,fieldset.utcw .tags-list-search-result,fieldset.utcw .author-search-result{background:#fff;box-shadow:0 0 6px #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}fieldset.utcw .post-term-search-result li,fieldset.utcw .tags-list-search-result li,fieldset.utcw .author-search-result li{padding:0 0.5em;cursor:pointer}fieldset.utcw .post-term-search-result li:first-of-type,fieldset.utcw .tags-list-search-result li:first-of-type,fieldset.utcw .author-search-result li:first-of-type{padding-top:0.5em}fieldset.utcw .post-term-search-result li:last-of-type,fieldset.utcw .tags-list-search-result li:last-of-type,fieldset.utcw .author-search-result li:last-of-type{padding-bottom:0.5em}fieldset.utcw .submitbox{float:right;cursor:pointer}.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 +1 @@
1
- /*! utcw - v2.4.0 - 2013-08-26*/var Query=function(a){"use strict";var b=function(a){var b,c,d,e,f=[];if("undefined"==typeof a||null===a||""===a)return f;for(0===a.indexOf("?")&&(a=a.substring(1)),c=a.toString().split(/[&;]/),b=0;b<c.length;b++)d=c[b],e=d.split("="),f.push([e[0],e[1]]);return f},c=b(a),d=function(){var a,b,d="";for(a=0;a<c.length;a++)b=c[a],d.length>0&&(d+="&"),d+=b.join("=");return d.length>0?"?"+d:d},e=function(a){return a=decodeURIComponent(a),a=a.replace("+"," ")},f=function(a){var b,d;for(d=0;d<c.length;d++)if(b=c[d],e(a)===e(b[0]))return b[1]},g=function(a){var b,d,f=[];for(b=0;b<c.length;b++)d=c[b],e(a)===e(d[0])&&f.push(d[1]);return f},h=function(a,b){var d,f,g,h,i=[];for(d=0;d<c.length;d++)f=c[d],g=e(f[0])===e(a),h=e(f[1])===e(b),(1===arguments.length&&!g||2===arguments.length&&!g&&!h)&&i.push(f);return c=i,this},i=function(a,b,d){return 3===arguments.length&&-1!==d?(d=Math.min(d,c.length),c.splice(d,0,[a,b])):arguments.length>0&&c.push([a,b]),this},j=function(a,b,d){var f,g,j=-1;if(3===arguments.length){for(f=0;f<c.length;f++)if(g=c[f],e(g[0])===e(a)&&decodeURIComponent(g[1])===e(d)){j=f;break}h(a,d).addParam(a,b,j)}else{for(f=0;f<c.length;f++)if(g=c[f],e(g[0])===e(a)){j=f;break}h(a),i(a,b,j)}return this};return{getParamValue:f,getParamValues:g,deleteParam:h,addParam:i,replaceParam:j,toString:d}},Uri=function(a){"use strict";var b=!1,c=function(a){for(var c={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],e={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},f=c[b?"strict":"loose"].exec(a),g={},h=14;h--;)g[d[h]]=f[h]||"";return g[e.name]={},g[d[12]].replace(e.parser,function(a,b,c){b&&(g[e.name][b]=c)}),g},d=c(a||""),e=new Query(d.query),f=function(a){return"undefined"!=typeof a&&(d.protocol=a),d.protocol},g=null,h=function(a){return"undefined"!=typeof a&&(g=a),null===g?-1!==d.source.indexOf("//"):g},i=function(a){return"undefined"!=typeof a&&(d.userInfo=a),d.userInfo},j=function(a){return"undefined"!=typeof a&&(d.host=a),d.host},k=function(a){return"undefined"!=typeof a&&(d.port=a),d.port},l=function(a){return"undefined"!=typeof a&&(d.path=a),d.path},m=function(a){return"undefined"!=typeof a&&(e=new Query(a)),e},n=function(a){return"undefined"!=typeof a&&(d.anchor=a),d.anchor},o=function(a){return f(a),this},p=function(a){return h(a),this},q=function(a){return i(a),this},r=function(a){return j(a),this},s=function(a){return k(a),this},t=function(a){return l(a),this},u=function(a){return m(a),this},v=function(a){return n(a),this},w=function(a){return m().getParamValue(a)},x=function(a){return m().getParamValues(a)},y=function(a,b){return 2===arguments.length?m().deleteParam(a,b):m().deleteParam(a),this},z=function(a,b,c){return 3===arguments.length?m().addParam(a,b,c):m().addParam(a,b),this},A=function(a,b,c){return 3===arguments.length?m().replaceParam(a,b,c):m().replaceParam(a,b),this},B=function(){var a="",b=function(a){return null!==a&&""!==a};return b(f())?(a+=f(),f().indexOf(":")!==f().length-1&&(a+=":"),a+="//"):h()&&b(j())&&(a+="//"),b(i())&&b(j())&&(a+=i(),i().indexOf("@")!==i().length-1&&(a+="@")),b(j())&&(a+=j(),b(k())&&(a+=":"+k())),b(l())?a+=l():b(j())&&(b(m().toString())||b(n()))&&(a+="/"),b(m().toString())&&(0!==m().toString().indexOf("?")&&(a+="?"),a+=m().toString()),b(n())&&(0!==n().indexOf("#")&&(a+="#"),a+=n()),a},C=function(){return new Uri(B())};return{protocol:f,hasAuthorityPrefix:h,userInfo:i,host:j,port:k,path:l,query:m,anchor:n,setProtocol:o,setHasAuthorityPrefix:p,setUserInfo:q,setHost:r,setPort:s,setPath:t,setQuery:u,setAnchor:v,getQueryParamValue:w,getQueryParamValues:x,deleteQueryParam:y,addQueryParam:z,replaceQueryParam:A,toString:B,clone:C}},jsUri=Uri;!function(a){a.fn.wTooltip=function(b,c){function d(c){c&&(b.degrade?a(n).html(b.content.replace(/<\/?[^>]+>/gi,"")):a(n).html(b.content))}function e(c){function d(){f&&!b.content&&(f="")}function e(){!l&&b.auto&&(clearInterval(i),b.fadeOut?a(n).fadeOut(b.fadeOut,function(){d(c)}):(d(c),n.style.display="none")),"function"==typeof b.callAfter&&b.callAfter(n,c,b),p&&(b=a.listen(b))}b.timeout>0?h=setTimeout(function(){e()},b.timeout):e()}b=a.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(){},callAfter:function(){},clickAction:function(b){a(b).hide()},delay:0,timeout:0},b||{}),b.style||"object"==typeof b.style?b.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},b.style||{}):(b.style={},b.style.zIndex="1000"),"function"==typeof c&&(b.callAfter=c||b.callAfter),b.style.display="none",b.style.position="absolute";var f,g,h,i,j={},k=!0,l=!1,m=!1,n=document.createElement("div"),o="undefined"==typeof document.body.style.maxWidth?!0:!1,p="function"==typeof a.talk&&"function"==typeof a.listen?!0:!1;b.id&&(n.id=b.id),b.className&&(n.className=b.className),b.degrade=b.degrade&&o?!0:!1;for(var q in b.style)n.style[q]=b.style[q];return b.ajax&&a.get(b.ajax,function(a){a&&(b.content=a),d(b.content)}),a(n).hover(function(){l=!0},function(){l=!1,e(j)}),p&&(b.key=n,b.plugin="wTooltip",b.channel="wayfarer",a.talk(b)),d(b.content&&!b.ajax),a(n).appendTo(b.appendTip),this.each(function(){a(this).hover(function(){function c(){"function"==typeof b.callBefore&&b.callBefore(n,d,b),p&&(b=a.listen(b));var c;b.content?b.degrade||(c="block"):f&&!b.degrade?(a(n).html(unescape(f)),c="block",f=""):c="none",b.auto&&("block"==c&&b.fadeIn?a(n).fadeIn(b.fadeIn):n.style.display=c)}var d=this;clearTimeout(h),!this.title&&!this.titleMemKeep||b.degrade||b.content||(f=this.title||this.titleMemKeep,this.title&&(this.titleMemKeep=this.title,this.title="")),b.content&&b.degrade&&(this.title=n.innerHTML),b.delay>0?g=setTimeout(function(){c()},b.delay):c()},function(){clearTimeout(g);var c=this;k=!0,!b.follow||m||b.offsetX<0&&0-b.offsetX<a(n).outerWidth()&&b.offsetY>0&&0-b.offsetY<a(n).outerHeight()?setTimeout(function(){i=setInterval(function(){e(c)},1)},1):e(this)}),a(this).mousemove(function(c){if(j=this,b.follow||k){var d=a(window).scrollTop(),e=a(window).scrollLeft(),f=c.clientY+d+b.offsetY,g=c.clientX+e+b.offsetX,h=a(b.appendTip).outerHeight(),i=a(b.appendTip).innerHeight(),l=a(window).width()+e-a(n).outerWidth(),o=a(window).height()+d-a(n).outerHeight();f=h>i?f-(h-i):f,m=f>o||g>l?!0:!1,0>=g-e&&b.offsetX<0?g=e:g>l&&(g=l),0>=f-d&&b.offsetY<0?f=d:f>o&&(f=o),n.style.top=f+"px",n.style.left=g+"px",k=!1}}),"function"==typeof b.clickAction&&a(this).click(function(){b.clickAction(n,this)})})}}(jQuery),function(a,b){"use strict";var c={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1e3},d={activeTab:{},terms:{},init:function(){var c=a("body");c.delegate("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]","click",this.colorClickHandler),c.delegate("input[id$=-title_type_counter], input[id$=-title_type_name], input[id$=-title_type_custom]","click",this.titleTypeClickHandler),c.delegate(".utcw-tab-button","click",this.tabClickHandler),c.delegate(".utcw-input-taxonomy","click",this.taxonomyClickHandler),c.delegate(".utcw-all-authors","click",this.allAuthorsClickHandler),c.delegate(".utcw-selected-authors","click",this.selectedAuthorsClickHandler),c.delegate(".utcw-remove-config","click",this.removeConfigClickHandler),c.delegate(".post-term-search","keyup",this.postTermSearchHandler),c.delegate(".post-term-search","search",this.postTermSearchHandler),c.delegate(".utcw-remove-term","click",this.removeTermClickHandler),a(document).ready(this.initTooltip),a(document).ajaxSuccess(this.ajaxSuccessHandler),a.post(b,{action:"utcw_get_terms"},function(a){d.terms=a})},initTooltip:function(){a(".utcw-help").wTooltip({style:c,className:"utcw-tooltip"})},postTermSearchHandler:function(){var b=a(this),c=a(b.data("result-selector")),e=a(b.data("selected-selector")),f=b.val().toLocaleLowerCase(),g=[],h=function(a){-1!==a.name.toLocaleLowerCase().indexOf(f)&&g.push(a)};if(c.text(""),f){for(var i in d.terms)d.terms.hasOwnProperty(i)&&d.terms[i].forEach(h);g.forEach(function(f){var g=a(document.createElement("li")),h=a(document.createElement("a")),i=f.name+" ("+f.taxonomy+")";h.text(i),h.data("id",f.term_id),h.click(d.postTermSearchClickHandler(e,b)),g.append(h),c.append(g)})}},postTermSearchClickHandler:function(b,c){return function(){var d=a(this),e=a(document.createElement("li")),f=a(document.createElement("a")),g=a(document.createElement("span")),h=a(document.createElement("input")),i=d.parent().parent();e.text(d.text()),h.attr("type","hidden"),h.val(d.data("id")),h.attr("name",c.data("input-name")+"[]"),f.addClass("submitdelete"),f.addClass("deletion"),f.addClass("utcw-remove-term"),f.text(c.data("delete")),g.addClass("submitbox"),g.append(f),e.append(g),e.append(h),b.append(e),i.text(""),c.val("")}},removeTermClickHandler:function(){a(this).parent().parent().remove()},removeConfigClickHandler:function(){var b=a(this),c=d.findWidgetParent(b),e=c.find(".utcw-load-config"),f=e.val(),g=b.data("input-name")+"[]",h=a(document.createElement("input"));h.attr("type","hidden"),h.attr("name",g),h.attr("value",f),b.after(h),e.find(":selected").remove()},allAuthorsClickHandler:function(){var b=a(this),c=d.findWidgetParent(b);c.find(".utcw-authors").addClass("hidden"),c.find(".utcw-author-field").attr("checked",!1)},selectedAuthorsClickHandler:function(){var b=a(this),c=d.findWidgetParent(b);c.find(".utcw-authors").removeClass("hidden")},tabClickHandler:function(){var b=a(this);return"utcw-__i__"===b.data("id")?!1:(b.parent().find(".utcw-tab-button").removeClass("utcw-active"),b.addClass("utcw-active"),b.parent().find("fieldset.utcw").addClass("hidden"),a("#"+b.data("tab")).removeClass("hidden"),d.activeTab[b.data("id")]=b.data("tab"),!1)},colorClickHandler:function(){var b=a('div[id$="set_chooser"]'),c=a('div[id$="span_chooser"]'),d=a(this).val();b.addClass("utcw-hidden"),c.addClass("utcw-hidden"),"set"===d?b.removeClass("utcw-hidden"):"span"===d&&c.removeClass("utcw-hidden")},titleTypeClickHandler:function(){var b=a('div[id$="-title_custom_template_container"]'),c=a(this).val();"custom"===c?b.removeClass("utcw-hidden"):b.addClass("utcw-hidden")},findWidgetParent:function(a){return a.parents(".widget-content")},taxonomyClickHandler:function(){var b=a(this),c=b.val(),e=b.is(":checked"),f=d.findWidgetParent(b),g=f.find("#"+c+"-terms");e?g.removeClass("hidden"):g.addClass("hidden")},ajaxSuccessHandler:function(a,b,c){d.setCurrentTab.apply(d,[c.data]),d.initTooltip.apply(d)},setCurrentTab:function(b){var c,d=new Uri;d.setQuery(decodeURI(b)),"save-widget"===d.getQueryParamValue("action")&&"utcw"===d.getQueryParamValue("id_base")&&(c=d.getQueryParamValue("widget-id"),this.activeTab[c]&&a('button[data-tab="'+this.activeTab[c]+'"]').trigger("click"))}};d.init()}(jQuery,ajaxurl);
1
+ /*! utcw - v2.5.0 - 2013-09-21*/var Query=function(a){"use strict";var b=function(a){var b,c,d,e,f=[];if("undefined"==typeof a||null===a||""===a)return f;for(0===a.indexOf("?")&&(a=a.substring(1)),c=a.toString().split(/[&;]/),b=0;b<c.length;b++)d=c[b],e=d.split("="),f.push([e[0],e[1]]);return f},c=b(a),d=function(){var a,b,d="";for(a=0;a<c.length;a++)b=c[a],d.length>0&&(d+="&"),d+=b.join("=");return d.length>0?"?"+d:d},e=function(a){return a=decodeURIComponent(a),a=a.replace("+"," ")},f=function(a){var b,d;for(d=0;d<c.length;d++)if(b=c[d],e(a)===e(b[0]))return b[1]},g=function(a){var b,d,f=[];for(b=0;b<c.length;b++)d=c[b],e(a)===e(d[0])&&f.push(d[1]);return f},h=function(a,b){var d,f,g,h,i=[];for(d=0;d<c.length;d++)f=c[d],g=e(f[0])===e(a),h=e(f[1])===e(b),(1===arguments.length&&!g||2===arguments.length&&!g&&!h)&&i.push(f);return c=i,this},i=function(a,b,d){return 3===arguments.length&&-1!==d?(d=Math.min(d,c.length),c.splice(d,0,[a,b])):arguments.length>0&&c.push([a,b]),this},j=function(a,b,d){var f,g,j=-1;if(3===arguments.length){for(f=0;f<c.length;f++)if(g=c[f],e(g[0])===e(a)&&decodeURIComponent(g[1])===e(d)){j=f;break}h(a,d).addParam(a,b,j)}else{for(f=0;f<c.length;f++)if(g=c[f],e(g[0])===e(a)){j=f;break}h(a),i(a,b,j)}return this};return{getParamValue:f,getParamValues:g,deleteParam:h,addParam:i,replaceParam:j,toString:d}},Uri=function(a){"use strict";var b=!1,c=function(a){for(var c={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],e={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},f=c[b?"strict":"loose"].exec(a),g={},h=14;h--;)g[d[h]]=f[h]||"";return g[e.name]={},g[d[12]].replace(e.parser,function(a,b,c){b&&(g[e.name][b]=c)}),g},d=c(a||""),e=new Query(d.query),f=function(a){return"undefined"!=typeof a&&(d.protocol=a),d.protocol},g=null,h=function(a){return"undefined"!=typeof a&&(g=a),null===g?-1!==d.source.indexOf("//"):g},i=function(a){return"undefined"!=typeof a&&(d.userInfo=a),d.userInfo},j=function(a){return"undefined"!=typeof a&&(d.host=a),d.host},k=function(a){return"undefined"!=typeof a&&(d.port=a),d.port},l=function(a){return"undefined"!=typeof a&&(d.path=a),d.path},m=function(a){return"undefined"!=typeof a&&(e=new Query(a)),e},n=function(a){return"undefined"!=typeof a&&(d.anchor=a),d.anchor},o=function(a){return f(a),this},p=function(a){return h(a),this},q=function(a){return i(a),this},r=function(a){return j(a),this},s=function(a){return k(a),this},t=function(a){return l(a),this},u=function(a){return m(a),this},v=function(a){return n(a),this},w=function(a){return m().getParamValue(a)},x=function(a){return m().getParamValues(a)},y=function(a,b){return 2===arguments.length?m().deleteParam(a,b):m().deleteParam(a),this},z=function(a,b,c){return 3===arguments.length?m().addParam(a,b,c):m().addParam(a,b),this},A=function(a,b,c){return 3===arguments.length?m().replaceParam(a,b,c):m().replaceParam(a,b),this},B=function(){var a="",b=function(a){return null!==a&&""!==a};return b(f())?(a+=f(),f().indexOf(":")!==f().length-1&&(a+=":"),a+="//"):h()&&b(j())&&(a+="//"),b(i())&&b(j())&&(a+=i(),i().indexOf("@")!==i().length-1&&(a+="@")),b(j())&&(a+=j(),b(k())&&(a+=":"+k())),b(l())?a+=l():b(j())&&(b(m().toString())||b(n()))&&(a+="/"),b(m().toString())&&(0!==m().toString().indexOf("?")&&(a+="?"),a+=m().toString()),b(n())&&(0!==n().indexOf("#")&&(a+="#"),a+=n()),a},C=function(){return new Uri(B())};return{protocol:f,hasAuthorityPrefix:h,userInfo:i,host:j,port:k,path:l,query:m,anchor:n,setProtocol:o,setHasAuthorityPrefix:p,setUserInfo:q,setHost:r,setPort:s,setPath:t,setQuery:u,setAnchor:v,getQueryParamValue:w,getQueryParamValues:x,deleteQueryParam:y,addQueryParam:z,replaceQueryParam:A,toString:B,clone:C}},jsUri=Uri;!function(a){a.fn.wTooltip=function(b,c){function d(c){c&&(b.degrade?a(n).html(b.content.replace(/<\/?[^>]+>/gi,"")):a(n).html(b.content))}function e(c){function d(){f&&!b.content&&(f="")}function e(){!l&&b.auto&&(clearInterval(i),b.fadeOut?a(n).fadeOut(b.fadeOut,function(){d(c)}):(d(c),n.style.display="none")),"function"==typeof b.callAfter&&b.callAfter(n,c,b),p&&(b=a.listen(b))}b.timeout>0?h=setTimeout(function(){e()},b.timeout):e()}b=a.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(){},callAfter:function(){},clickAction:function(b){a(b).hide()},delay:0,timeout:0},b||{}),b.style||"object"==typeof b.style?b.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},b.style||{}):(b.style={},b.style.zIndex="1000"),"function"==typeof c&&(b.callAfter=c||b.callAfter),b.style.display="none",b.style.position="absolute";var f,g,h,i,j={},k=!0,l=!1,m=!1,n=document.createElement("div"),o="undefined"==typeof document.body.style.maxWidth?!0:!1,p="function"==typeof a.talk&&"function"==typeof a.listen?!0:!1;b.id&&(n.id=b.id),b.className&&(n.className=b.className),b.degrade=b.degrade&&o?!0:!1;for(var q in b.style)n.style[q]=b.style[q];return b.ajax&&a.get(b.ajax,function(a){a&&(b.content=a),d(b.content)}),a(n).hover(function(){l=!0},function(){l=!1,e(j)}),p&&(b.key=n,b.plugin="wTooltip",b.channel="wayfarer",a.talk(b)),d(b.content&&!b.ajax),a(n).appendTo(b.appendTip),this.each(function(){a(this).hover(function(){function c(){"function"==typeof b.callBefore&&b.callBefore(n,d,b),p&&(b=a.listen(b));var c;b.content?b.degrade||(c="block"):f&&!b.degrade?(a(n).html(unescape(f)),c="block",f=""):c="none",b.auto&&("block"==c&&b.fadeIn?a(n).fadeIn(b.fadeIn):n.style.display=c)}var d=this;clearTimeout(h),!this.title&&!this.titleMemKeep||b.degrade||b.content||(f=this.title||this.titleMemKeep,this.title&&(this.titleMemKeep=this.title,this.title="")),b.content&&b.degrade&&(this.title=n.innerHTML),b.delay>0?g=setTimeout(function(){c()},b.delay):c()},function(){clearTimeout(g);var c=this;k=!0,!b.follow||m||b.offsetX<0&&0-b.offsetX<a(n).outerWidth()&&b.offsetY>0&&0-b.offsetY<a(n).outerHeight()?setTimeout(function(){i=setInterval(function(){e(c)},1)},1):e(this)}),a(this).mousemove(function(c){if(j=this,b.follow||k){var d=a(window).scrollTop(),e=a(window).scrollLeft(),f=c.clientY+d+b.offsetY,g=c.clientX+e+b.offsetX,h=a(b.appendTip).outerHeight(),i=a(b.appendTip).innerHeight(),l=a(window).width()+e-a(n).outerWidth(),o=a(window).height()+d-a(n).outerHeight();f=h>i?f-(h-i):f,m=f>o||g>l?!0:!1,0>=g-e&&b.offsetX<0?g=e:g>l&&(g=l),0>=f-d&&b.offsetY<0?f=d:f>o&&(f=o),n.style.top=f+"px",n.style.left=g+"px",k=!1}}),"function"==typeof b.clickAction&&a(this).click(function(){b.clickAction(n,this)})})}}(jQuery),function(a,b){"use strict";var c={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1e3},d={activeTab:{},terms:{},authors:[],init:function(){var c=a("body");c.delegate("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]","click",this.colorClickHandler),c.delegate("input[id$=-title_type_counter], input[id$=-title_type_name], input[id$=-title_type_custom]","click",this.titleTypeClickHandler),c.delegate(".utcw-tab-button","click",this.tabClickHandler),c.delegate(".utcw-input-taxonomy","click",this.taxonomyClickHandler),c.delegate(".utcw-all-authors","click",this.allAuthorsClickHandler),c.delegate(".utcw-selected-authors","click",this.selectedAuthorsClickHandler),c.delegate(".utcw-remove-config","click",this.removeConfigClickHandler),c.delegate(".post-term-search","keyup",this.postTermSearchHandler),c.delegate(".post-term-search","search",this.postTermSearchHandler),c.delegate(".tags-list-search","keyup",this.postTermSearchHandler),c.delegate(".tags-list-search","search",this.postTermSearchHandler),c.delegate(".author-search","keyup",this.authorSearchHandler),c.delegate(".author-search","search",this.authorSearchHandler),c.delegate(".utcw-remove-item","click",this.removeTermClickHandler),a(document).ready(this.initTooltip),a(document).ajaxSuccess(this.ajaxSuccessHandler),a.post(b,{action:"utcw_get_terms"},function(a){d.terms=a}),a.post(b,{action:"utcw_get_authors"},function(a){d.authors=a})},initTooltip:function(){a(".utcw-help").wTooltip({style:c,className:"utcw-tooltip"})},postTermSearchHandler:function(){var b=a(this),c=a(b.data("result-selector")),e=a(b.data("selected-selector")),f=b.val().toLocaleLowerCase(),g=[],h=function(a){-1!==a.name.toLocaleLowerCase().indexOf(f)&&g.push(a)};if(c.text(""),f){for(var i in d.terms)d.terms.hasOwnProperty(i)&&d.terms[i].forEach(h);g.forEach(function(f){var g=a(document.createElement("li")),h=a(document.createElement("a")),i=f.name+" ("+f.taxonomy+")";h.text(i),h.data("id",f.term_id),h.click(d.selectionClickHandler(e,b)),g.append(h),c.append(g)})}},selectionClickHandler:function(b,c){return function(){var d=a(this),e=a(document.createElement("li")),f=a(document.createElement("a")),g=a(document.createElement("span")),h=a(document.createElement("input")),i=d.parent().parent();e.text(d.text()),h.attr("type","hidden"),h.val(d.data("id")),h.attr("name",c.data("input-name")+"[]"),f.addClass("submitdelete"),f.addClass("deletion"),f.addClass("utcw-remove-item"),f.text(c.data("delete")),g.addClass("submitbox"),g.append(f),e.append(g),e.append(h),b.append(e),i.text(""),c.val("")}},authorSearchHandler:function(){var b=a(this),c=a(b.data("result-selector")),e=a(b.data("selected-selector")),f=b.val().toLocaleLowerCase(),g=[];c.text(""),f&&(d.authors.forEach(function(a){-1!==a.display_name.toLocaleLowerCase().indexOf(f)&&g.push(a)}),g.forEach(function(f){var g=a(document.createElement("li")),h=a(document.createElement("a")),i=f.display_name;h.text(i),h.data("id",f.ID),h.click(d.selectionClickHandler(e,b)),g.append(h),c.append(g)}))},removeTermClickHandler:function(){a(this).parent().parent().remove()},removeConfigClickHandler:function(){var b=a(this),c=d.findWidgetParent(b),e=c.find(".utcw-load-config"),f=e.val(),g=b.data("input-name")+"[]",h=a(document.createElement("input"));h.attr("type","hidden"),h.attr("name",g),h.attr("value",f),b.after(h),e.find(":selected").remove()},allAuthorsClickHandler:function(){var b=a(this),c=d.findWidgetParent(b);c.find(".utcw-authors").addClass("hidden"),c.find("[name*='[authors]']").attr("disabled",!0)},selectedAuthorsClickHandler:function(){var b=a(this),c=d.findWidgetParent(b);c.find(".utcw-authors").removeClass("hidden"),c.find("[name*='[authors]']").attr("disabled",!1)},tabClickHandler:function(){var b=a(this);return"utcw-__i__"===b.data("id")?!1:(b.parent().find(".utcw-tab-button").removeClass("utcw-active"),b.addClass("utcw-active"),b.parent().find("fieldset.utcw").addClass("hidden"),a("#"+b.data("tab")).removeClass("hidden"),d.activeTab[b.data("id")]=b.data("tab"),!1)},colorClickHandler:function(){var b=a('div[id$="set_chooser"]'),c=a('div[id$="span_chooser"]'),d=a(this).val();b.addClass("utcw-hidden"),c.addClass("utcw-hidden"),"set"===d?b.removeClass("utcw-hidden"):"span"===d&&c.removeClass("utcw-hidden")},titleTypeClickHandler:function(){var b=a('div[id$="-title_custom_template_container"]'),c=a(this).val();"custom"===c?b.removeClass("utcw-hidden"):b.addClass("utcw-hidden")},findWidgetParent:function(a){return a.parents(".widget-content")},taxonomyClickHandler:function(){var b=a(this),c=b.val(),e=b.is(":checked"),f=d.findWidgetParent(b),g=f.find("#"+c+"-terms");e?g.removeClass("hidden"):g.addClass("hidden")},ajaxSuccessHandler:function(a,b,c){d.setCurrentTab.apply(d,[c.data]),d.initTooltip.apply(d)},setCurrentTab:function(b){var c,d=new Uri;d.setQuery(decodeURI(b)),"save-widget"===d.getQueryParamValue("action")&&"utcw"===d.getQueryParamValue("id_base")&&(c=d.getQueryParamValue("widget-id"),this.activeTab[c]&&a('button[data-tab="'+this.activeTab[c]+'"]').trigger("click"))}};d.init()}(jQuery,ajaxurl);
pages/settings.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.4
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
@@ -14,7 +14,7 @@
14
  * @var array $configurations
15
  * @var array $terms
16
  * @var array $terms_by_id
17
- * @var array $users
18
  * @var UTCW_Widget $this
19
  */
20
  if ( ! defined( 'ABSPATH' ) ) die();
@@ -36,7 +36,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
36
  <fieldset class='utcw' id="<?php echo $this->get_field_id( 'utcw-tab-data' ) ?>">
37
  <legend></legend>
38
 
39
- <a class="utcw-help" title="<?php _e('How the tag cloud should find tags to display. Popularity based selection is the default strategy which shows the most popular tags.', 'utcw') ?>">?</a>
40
  <strong><?php _e('Selection strategy:', 'utcw') ?></strong><br>
41
  <label>
42
  <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="popularity" <?php if ($dataConfig->strategy === 'popularity') echo 'checked="checked"' ?>>
@@ -46,6 +46,14 @@ if ( ! defined( 'ABSPATH' ) ) die();
46
  <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="random" <?php if ($dataConfig->strategy === 'random') echo 'checked="checked"' ?>>
47
  <?php _e('Random','utcw') ?>
48
  </label><br>
 
 
 
 
 
 
 
 
49
  <br>
50
 
51
  <a class="utcw-help"
@@ -64,12 +72,24 @@ if ( ! defined( 'ABSPATH' ) ) die();
64
  <br>
65
 
66
  <div class="utcw-authors <?php if (!$dataConfig->authors) echo 'hidden' ?>">
67
- <?php foreach ( $users as $user ) : ?>
68
- <input class="utcw-author-field" type="checkbox" name="<?php echo $this->get_field_name( 'authors' ) ?>[]"
69
- id="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"
70
- value="<?php echo $user->ID ?>" <?php echo in_array( $user->ID, $dataConfig->authors, true ) ? 'checked="checked"' : ''; ?>>
71
- <label for="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"><?php echo $user->display_name ?></label><br>
72
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
73
  </div>
74
  <br>
75
 
@@ -163,13 +183,20 @@ if ( ! defined( 'ABSPATH' ) ) die();
163
  <li>
164
  <?php echo $term->name ?> (<?php echo $term->taxonomy ?>)
165
  <span class="submitbox">
166
- <a class="submitdelete deletion utcw-remove-term"><?php _e('Delete', 'utcw') ?></a>
167
  </span>
168
  <input type="hidden" name="<?php echo $this->get_field_name( 'post_term' ) ?>[]" value="<?php echo $term_id ?>" />
169
  </li>
170
  <?php endforeach ?>
171
  </ul>
172
 
 
 
 
 
 
 
 
173
  </fieldset>
174
 
175
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-terms' ) ?>">
@@ -193,34 +220,24 @@ if ( ! defined( 'ABSPATH' ) ) die();
193
  <br>
194
  <br>
195
  <a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
196
- <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
197
-
198
- <div id="<?php echo $taxonomy->name ?>-terms" <?php if ( !in_array( $taxonomy->name, $dataConfig->taxonomy ) ) echo 'class="hidden"' ?>>
199
-
200
- <strong><?php printf( __( 'Terms for taxonomy %s', 'utcw' ), $taxonomy->labels->name ) ?></strong>
201
-
202
- <?php if ( isset( $terms[ $taxonomy->name ] ) ) : ?>
203
- <ul>
204
- <?php foreach ( $terms[ $taxonomy->name ] as $term ) : ?>
205
- <li>
206
- <label>
207
- <input
208
- type="checkbox"
209
- name="<?php echo $this->get_field_name( 'tags_list' ) ?>[]"
210
- value="<?php echo $term->term_id ?>"
211
- <?php if ( in_array( $term->term_id, $dataConfig->tags_list ) ) echo 'checked="checked"' ?>>
212
- <?php echo $term->name ?>
213
- </label>
214
- </li>
215
- <?php endforeach ?>
216
- </ul>
217
- <?php else : ?>
218
- <p><?php printf( __( 'No terms for taxonomy "%s"', 'utcw' ), $taxonomy->labels->name ) ?></p>
219
- <?php endif ?>
220
-
221
- </div>
222
 
223
- <?php endforeach ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  </fieldset>
226
 
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.5
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
14
  * @var array $configurations
15
  * @var array $terms
16
  * @var array $terms_by_id
17
+ * @var array $authors_by_id
18
  * @var UTCW_Widget $this
19
  */
20
  if ( ! defined( 'ABSPATH' ) ) die();
36
  <fieldset class='utcw' id="<?php echo $this->get_field_id( 'utcw-tab-data' ) ?>">
37
  <legend></legend>
38
 
39
+ <a class="utcw-help" title="<?php _e('How the tag cloud should find tags to display. Popularity based selection is the default strategy which shows the most popular tags. Creation time will display the newest terms.', 'utcw') ?>">?</a>
40
  <strong><?php _e('Selection strategy:', 'utcw') ?></strong><br>
41
  <label>
42
  <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="popularity" <?php if ($dataConfig->strategy === 'popularity') echo 'checked="checked"' ?>>
46
  <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="random" <?php if ($dataConfig->strategy === 'random') echo 'checked="checked"' ?>>
47
  <?php _e('Random','utcw') ?>
48
  </label><br>
49
+ <label>
50
+ <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="creation" <?php if ($dataConfig->strategy === 'creation') echo 'checked="checked"' ?>>
51
+ <?php _e('Creation time','utcw') ?>
52
+ </label><br>
53
+ <label>
54
+ <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="current_list" <?php if ($dataConfig->strategy === 'current_list') echo 'checked="checked"' ?>>
55
+ <?php _e('Only terms from the current list','utcw') ?>
56
+ </label><br>
57
  <br>
58
 
59
  <a class="utcw-help"
72
  <br>
73
 
74
  <div class="utcw-authors <?php if (!$dataConfig->authors) echo 'hidden' ?>">
75
+
76
+ <input type="search" class="author-search" id="<?php echo $this->get_field_id('authors_search') ?>"
77
+ data-result-selector="#<?php echo $this->get_field_id('author-search-result') ?>"
78
+ data-selected-selector="#<?php echo $this->get_field_id('author-search-selected') ?>"
79
+ data-input-name="<?php echo $this->get_field_name( 'authors' ) ?>"
80
+ data-delete="<?php _e( 'Delete', 'utcw' ) ?>" />
81
+ <ul class="author-search-result" id="<?php echo $this->get_field_id('author-search-result') ?>"></ul>
82
+ <ul class="author-search-selected" id="<?php echo $this->get_field_id('author-search-selected') ?>">
83
+ <?php foreach ($dataConfig->authors as $author_id) : $author = $authors_by_id[$author_id]; ?>
84
+ <li>
85
+ <?php echo $author->display_name ?>
86
+ <span class="submitbox">
87
+ <a class="submitdelete deletion utcw-remove-item"><?php _e('Delete', 'utcw') ?></a>
88
+ </span>
89
+ <input type="hidden" name="<?php echo $this->get_field_name( 'authors' ) ?>[]" value="<?php echo $author_id ?>" />
90
+ </li>
91
+ <?php endforeach ?>
92
+ </ul>
93
  </div>
94
  <br>
95
 
183
  <li>
184
  <?php echo $term->name ?> (<?php echo $term->taxonomy ?>)
185
  <span class="submitbox">
186
+ <a class="submitdelete deletion utcw-remove-item"><?php _e('Delete', 'utcw') ?></a>
187
  </span>
188
  <input type="hidden" name="<?php echo $this->get_field_name( 'post_term' ) ?>[]" value="<?php echo $term_id ?>" />
189
  </li>
190
  <?php endforeach ?>
191
  </ul>
192
 
193
+ <a class="utcw-help"
194
+ title="<?php _e( 'When used with post term filtering the resulting link in the tag cloud will contain a query variable to try to filter out the posts that have the term given in the term filter.', 'utcw' ) ?>">?</a>
195
+ <input type="checkbox" id="<?php echo $this->get_field_id( 'post_term_query_var' ) ?>"
196
+ name="<?php echo $this->get_field_name( 'post_term_query_var' ) ?>" <?php if ( $dataConfig->post_term_query_var ) echo 'checked="checked"' ?>>
197
+ <label for="<?php echo $this->get_field_id( 'post_term_query_var' ) ?>"><?php _e( 'Add filter to links', 'utcw' ) ?></label><br>
198
+
199
+
200
  </fieldset>
201
 
202
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-terms' ) ?>">
220
  <br>
221
  <br>
222
  <a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
 
224
+ <input type="search" class="tags-list-search" id="<?php echo $this->get_field_id('tags_list_search') ?>"
225
+ data-result-selector="#<?php echo $this->get_field_id('tags-list-search-result') ?>"
226
+ data-selected-selector="#<?php echo $this->get_field_id('tags-list-search-selected') ?>"
227
+ data-input-name="<?php echo $this->get_field_name( 'tags_list' ) ?>"
228
+ data-delete="<?php _e( 'Delete', 'utcw' ) ?>" />
229
+ <ul class="tags-list-search-result" id="<?php echo $this->get_field_id('tags-list-search-result') ?>"></ul>
230
+ <ul class="tags-list-search-selected" id="<?php echo $this->get_field_id('tags-list-search-selected') ?>">
231
+ <?php foreach ($dataConfig->tags_list as $term_id) : $term = $terms_by_id[$term_id]; ?>
232
+ <li>
233
+ <?php echo $term->name ?> (<?php echo $term->taxonomy ?>)
234
+ <span class="submitbox">
235
+ <a class="submitdelete deletion utcw-remove-item"><?php _e('Delete', 'utcw') ?></a>
236
+ </span>
237
+ <input type="hidden" name="<?php echo $this->get_field_name( 'tags_list' ) ?>[]" value="<?php echo $term_id ?>" />
238
+ </li>
239
+ <?php endforeach ?>
240
+ </ul>
241
 
242
  </fieldset>
243
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: exz
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 3.0
5
- Tested up to: 3.6
6
- Stable tag: 2.4
7
- Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
  License: GPLv2 or later
9
 
10
  This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
@@ -47,6 +47,14 @@ If you have questions, please post them in the forums.
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
 
 
50
  = 2.4 =
51
 
52
  * Fixed issue with WPML and custom taxonomies
@@ -109,6 +117,10 @@ The upgrade notice history for the 1.x branch is available on [GitHub](https://g
109
 
110
  == Upgrade Notice ==
111
 
 
 
 
 
112
  = 2.4 =
113
 
114
  * Issues with WPML and custom taxonomies resolved. New features, see plugin page at wordpress.org for full details.
2
  Contributors: exz
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 3.0
5
+ Tested up to: 3.7-beta1
6
+ Stable tag: 2.5
7
+ Donate link: https://0x539.se/donations
8
  License: GPLv2 or later
9
 
10
  This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
47
 
48
  == Changelog ==
49
 
50
+ = 2.5 =
51
+
52
+ * [#14](https://github.com/rickard2/utcw/issues/14): Updated UI for selecting authors
53
+ * [#22](https://github.com/rickard2/utcw/issues/22): Option to fetch terms based on the current list of posts and term creation time
54
+ * [#35](https://github.com/rickard2/utcw/issues/35): Updated UI for selecting post terms
55
+ * [#41](https://github.com/rickard2/utcw/issues/41): New option to add filtering to tag cloud links
56
+ * [#42](https://github.com/rickard2/utcw/issues/42): Added scope attribute to style tag
57
+
58
  = 2.4 =
59
 
60
  * Fixed issue with WPML and custom taxonomies
117
 
118
  == Upgrade Notice ==
119
 
120
+ = 2.5 =
121
+
122
+ * New features, see plugin page at wordpress.org for full details.
123
+
124
  = 2.4 =
125
 
126
  * Issues with WPML and custom taxonomies resolved. New features, see plugin page at wordpress.org for full details.
src/Cache/W3TotalCacheHandler.php CHANGED
@@ -4,7 +4,7 @@
4
  * Ultimate Tag Cloud Widget
5
  *
6
  * @author Rickard Andersson <rickard@0x539.se>
7
- * @version 2.4
8
  * @license GPLv2
9
  * @package utcw
10
  * @subpackage cache
4
  * Ultimate Tag Cloud Widget
5
  *
6
  * @author Rickard Andersson <rickard@0x539.se>
7
+ * @version 2.5
8
  * @license GPLv2
9
  * @package utcw
10
  * @subpackage cache
src/Cache/WPSuperCacheHandler.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage cache
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage cache
src/Config/Config.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
src/Config/DataConfig.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
@@ -15,25 +15,26 @@
15
  *
16
  * @since 2.3
17
  *
18
- * @property-read string strategy Which strategy to use when fetching terms
19
- * @property-read string order How the result should be ordered
20
- * @property-read string tags_list_type How the {@link $tags_list tags list} should be used
21
- * @property-read string color Which coloring strategy to use
22
- * @property-read string color_span_to Which color value to start from in color calculation. This is the color that the smallest tag will get.
23
- * @property-read string color_span_from Which color value to end at in color calculation. This is the color that the biggest tag will get.
24
- * @property-read array color_set A set of colors to randomly select from when coloring the tags
25
- * @property-read array taxonomy Which taxonomy to show tags from
26
- * @property-read array post_type An array of post type names to to include posts from in tag size calculation
27
- * @property-read array authors Which authors to include posts from. An empty array will include all authors
28
- * @property-read array tags_list A list of term IDs to be included or excluded. Inclusion or exclusion is determined by {@link $tags_list_type tags list type}
29
- * @property-read array post_term A list of term IDs which the posts needs to have to be included in tag size calculation
30
- * @property-read string size_from The smallest possible size
31
- * @property-read string size_to The greatest possible size
32
- * @property-read integer max Maximum number of tags to display
33
- * @property-read integer minimum How many posts a term needs to have to be shown in the cloud
34
- * @property-read integer days_old How many days old a post needs to be to be included in tag size calculation
35
- * @property-read bool reverse If the order of tags should be shown in reverse order
36
- * @property-read bool case_sensitive If sorting should be applied case sensitive
 
37
  */
38
  class UTCW_DataConfig extends UTCW_Config
39
  {
@@ -47,7 +48,7 @@ class UTCW_DataConfig extends UTCW_Config
47
  */
48
  public function __construct(array $input, UTCW_Plugin $plugin)
49
  {
50
- $this->addOption('strategy', 'set', array('values' => array('popularity', 'random')));
51
  $this->addOption('order', 'set', array('values' => array('name', 'random', 'slug', 'id', 'color', 'count')));
52
  $this->addOption('tags_list_type', 'set', array('values' => array('exclude', 'include')));
53
  $this->addOption('color', 'set', array('values' => array('none', 'random', 'set', 'span')));
@@ -86,6 +87,7 @@ class UTCW_DataConfig extends UTCW_Config
86
 
87
  $this->addOption('reverse', 'boolean');
88
  $this->addOption('case_sensitive', 'boolean');
 
89
 
90
  parent::__construct($input, $plugin);
91
 
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
15
  *
16
  * @since 2.3
17
  *
18
+ * @property-read string strategy Which strategy to use when fetching terms
19
+ * @property-read string order How the result should be ordered
20
+ * @property-read string tags_list_type How the {@link $tags_list tags list} should be used
21
+ * @property-read string color Which coloring strategy to use
22
+ * @property-read string color_span_to Which color value to start from in color calculation. This is the color that the smallest tag will get.
23
+ * @property-read string color_span_from Which color value to end at in color calculation. This is the color that the biggest tag will get.
24
+ * @property-read array color_set A set of colors to randomly select from when coloring the tags
25
+ * @property-read array taxonomy Which taxonomy to show tags from
26
+ * @property-read array post_type An array of post type names to to include posts from in tag size calculation
27
+ * @property-read array authors Which authors to include posts from. An empty array will include all authors
28
+ * @property-read array tags_list A list of term IDs to be included or excluded. Inclusion or exclusion is determined by {@link $tags_list_type tags list type}
29
+ * @property-read array post_term A list of term IDs which the posts needs to have to be included in tag size calculation
30
+ * @property-read string size_from The smallest possible size
31
+ * @property-read string size_to The greatest possible size
32
+ * @property-read integer max Maximum number of tags to display
33
+ * @property-read integer minimum How many posts a term needs to have to be shown in the cloud
34
+ * @property-read integer days_old How many days old a post needs to be to be included in tag size calculation
35
+ * @property-read bool reverse If the order of tags should be shown in reverse order
36
+ * @property-read bool case_sensitive If sorting should be applied case sensitive
37
+ * @property-read bool post_term_query_var If the resulting link should include query vars to filter to only the terms given in post_term
38
  */
39
  class UTCW_DataConfig extends UTCW_Config
40
  {
48
  */
49
  public function __construct(array $input, UTCW_Plugin $plugin)
50
  {
51
+ $this->addOption('strategy', 'set', array('values' => array('popularity', 'random', 'creation', 'current_list')));
52
  $this->addOption('order', 'set', array('values' => array('name', 'random', 'slug', 'id', 'color', 'count')));
53
  $this->addOption('tags_list_type', 'set', array('values' => array('exclude', 'include')));
54
  $this->addOption('color', 'set', array('values' => array('none', 'random', 'set', 'span')));
87
 
88
  $this->addOption('reverse', 'boolean');
89
  $this->addOption('case_sensitive', 'boolean');
90
+ $this->addOption('post_term_query_var', 'boolean');
91
 
92
  parent::__construct($input, $plugin);
93
 
src/Config/RenderConfig.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config
src/Config/Type/ArrayType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/BooleanType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/ColorType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/IntegerType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/MeasurementType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/SetType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/StringType.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Config/Type/Type.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage config-type
src/Data.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
@@ -96,6 +96,12 @@ class UTCW_Data
96
  case 'random':
97
  $this->strategy = new UTCW_RandomStrategy($this->plugin);
98
  break;
 
 
 
 
 
 
99
  }
100
  }
101
 
@@ -139,6 +145,10 @@ class UTCW_Data
139
  }
140
  }
141
 
 
 
 
 
142
  $size_from = floatval($this->config->size_from);
143
  $size_to = floatval($this->config->size_to);
144
  $unit = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $this->config->size_from);
@@ -267,6 +277,60 @@ class UTCW_Data
267
  return $step;
268
  }
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  /**
271
  * Cleans up sensitive data before being used in debug output
272
  */
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
96
  case 'random':
97
  $this->strategy = new UTCW_RandomStrategy($this->plugin);
98
  break;
99
+ case 'creation':
100
+ $this->strategy = new UTCW_CreationTimeStrategy($this->plugin);
101
+ break;
102
+ case 'current_list':
103
+ $this->strategy = new UTCW_CurrentListStrategy($this->plugin);
104
+ break;
105
  }
106
  }
107
 
145
  }
146
  }
147
 
148
+ if ($this->config->post_term_query_var && $this->config->post_term) {
149
+ $this->addTermFilterQueryVars();
150
+ }
151
+
152
  $size_from = floatval($this->config->size_from);
153
  $size_to = floatval($this->config->size_to);
154
  $unit = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $this->config->size_from);
277
  return $step;
278
  }
279
 
280
+ /**
281
+ * Will add a term filter to the query string of every link
282
+ *
283
+ * @since 2.5
284
+ */
285
+ protected function addTermFilterQueryVars()
286
+ {
287
+ $terms = array();
288
+ $query = array();
289
+
290
+ // First create a map of taxonomy => terms
291
+ foreach ($this->config->post_term as $term_id) {
292
+ $term = $this->plugin->getTerm($term_id);
293
+
294
+ if (!isset($terms[$term->taxonomy])) {
295
+ $terms[$term->taxonomy] = array();
296
+ }
297
+
298
+ $terms[$term->taxonomy][] = $term;
299
+ }
300
+
301
+ // Create a new map of query_var => terms for each taxonomy that has a query_var
302
+ foreach ($terms as $taxonomy => $taxonomyTerms) {
303
+
304
+ $taxonomy = $this->plugin->getTaxonomy($taxonomy);
305
+
306
+ if ($taxonomy->query_var) {
307
+ $query[$taxonomy->query_var] = array();
308
+
309
+ foreach ($taxonomyTerms as $term) {
310
+ $query[$taxonomy->query_var][] = $term->slug;
311
+ }
312
+ }
313
+ }
314
+
315
+ if (!$query) {
316
+ return;
317
+ }
318
+
319
+ // Construct query string
320
+ $queryString = array();
321
+
322
+ foreach ($query as $var => $termSlugs) {
323
+ $queryString[] = $var . '=' . join(',', $termSlugs);
324
+ }
325
+
326
+ $queryString = join('&', $queryString);
327
+
328
+ foreach ($this->terms as $term) {
329
+ $term->link .= strpos($term->link, '?') === false ? '?' : '&';
330
+ $term->link .= $queryString;
331
+ }
332
+ }
333
+
334
  /**
335
  * Cleans up sensitive data before being used in debug output
336
  */
src/Database/QueryBuilder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
@@ -65,6 +65,18 @@ class UTCW_QueryBuilder
65
  return $this->parameters;
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  /**
69
  * Add a statement to the query
70
  *
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
65
  return $this->parameters;
66
  }
67
 
68
+ /**
69
+ * Adds a parameter to the query
70
+ *
71
+ * @param $parameter
72
+ *
73
+ * @since 2.5
74
+ */
75
+ public function addParameter($parameter)
76
+ {
77
+ $this->parameters[] = $parameter;
78
+ }
79
+
80
  /**
81
  * Add a statement to the query
82
  *
src/Language/QTranslateHandler.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
src/Language/TranslationHandler.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
src/Language/WPMLHandler.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
src/Plugin.php CHANGED
@@ -11,7 +11,7 @@
11
  * Ultimate Tag Cloud Widget
12
  *
13
  * @author Rickard Andersson <rickard@0x539.se>
14
- * @version 2.4
15
  * @license GPLv2
16
  * @package utcw
17
  * @subpackage main
@@ -75,6 +75,7 @@ class UTCW_Plugin
75
  add_action('wp_loaded', array($this, 'wpLoaded'));
76
  add_action('widgets_init', array($this, 'widgetsInit'));
77
  add_action('wp_ajax_utcw_get_terms', array($this, 'outputTermsJson'));
 
78
  // add_action('init', array($this, 'setCacheHandler')); Disabled for now
79
  add_action('init', array($this, 'setTranslationHandler'));
80
  }
@@ -208,6 +209,39 @@ class UTCW_Plugin
208
  return json_encode($terms);
209
  }
210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  /**
212
  * Action handler for 'widgets_init' hook
213
  * Registers the widget
@@ -449,6 +483,44 @@ class UTCW_Plugin
449
  return !is_wp_error($link) ? $link : '';
450
  }
451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  /**
453
  * Check if the term exist for any of the taxonomies
454
  *
@@ -483,4 +555,33 @@ class UTCW_Plugin
483
  {
484
  return apply_filters($tag, $value);
485
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  }
11
  * Ultimate Tag Cloud Widget
12
  *
13
  * @author Rickard Andersson <rickard@0x539.se>
14
+ * @version 2.5
15
  * @license GPLv2
16
  * @package utcw
17
  * @subpackage main
75
  add_action('wp_loaded', array($this, 'wpLoaded'));
76
  add_action('widgets_init', array($this, 'widgetsInit'));
77
  add_action('wp_ajax_utcw_get_terms', array($this, 'outputTermsJson'));
78
+ add_action('wp_ajax_utcw_get_authors', array($this, 'outputAuthorsJson'));
79
  // add_action('init', array($this, 'setCacheHandler')); Disabled for now
80
  add_action('init', array($this, 'setTranslationHandler'));
81
  }
209
  return json_encode($terms);
210
  }
211
 
212
+ /**
213
+ * Outputs authors in JSON format
214
+ *
215
+ * @since 2.5
216
+ */
217
+ public function outputAuthorsJson()
218
+ {
219
+ header('Content-Type: application/json');
220
+ echo $this->getAuthorsJson();
221
+ die();
222
+ }
223
+
224
+ /**
225
+ * Fetch authors and return a AJAX friendly array as a JSON object
226
+ *
227
+ * @return string
228
+ *
229
+ * @since 2.5
230
+ */
231
+ public function getAuthorsJson()
232
+ {
233
+ $authors = array();
234
+
235
+ foreach ($this->getUsers() as $author) {
236
+ $authors[] = array(
237
+ 'ID' => $author->ID,
238
+ 'display_name' => $author->display_name
239
+ );
240
+ }
241
+
242
+ return json_encode($authors);
243
+ }
244
+
245
  /**
246
  * Action handler for 'widgets_init' hook
247
  * Registers the widget
483
  return !is_wp_error($link) ? $link : '';
484
  }
485
 
486
+ /**
487
+ * Returns the term if found
488
+ *
489
+ * @param $term_id
490
+ *
491
+ * @return bool|object
492
+ * @since 2.5
493
+ */
494
+ public function getTerm($term_id)
495
+ {
496
+ foreach ($this->getTerms() as $taxonomy => $terms) {
497
+ foreach ($terms as $term) {
498
+ if ($term->term_id == $term_id) {
499
+ $term = get_term($term_id, $taxonomy);
500
+
501
+ if ($term && !is_wp_error($term)) {
502
+ return $term;
503
+ }
504
+ }
505
+ }
506
+ }
507
+
508
+ return false;
509
+ }
510
+
511
+ /**
512
+ * Returns the taxonomy
513
+ *
514
+ * @param $taxonomy
515
+ *
516
+ * @return bool|object
517
+ * @since 2.5
518
+ */
519
+ public function getTaxonomy($taxonomy)
520
+ {
521
+ return get_taxonomy($taxonomy);
522
+ }
523
+
524
  /**
525
  * Check if the term exist for any of the taxonomies
526
  *
555
  {
556
  return apply_filters($tag, $value);
557
  }
558
+
559
+
560
+ /**
561
+ * Returns the terms associated with the posts in the current $wp_query
562
+ *
563
+ * @return stdClass[]
564
+ */
565
+ public function getCurrentQueryTerms()
566
+ {
567
+ global $wp_query;
568
+
569
+ $terms = array();
570
+
571
+ if (!$wp_query) {
572
+ return array();
573
+ }
574
+
575
+ foreach ($wp_query->posts as $post) {
576
+ $postTerms = wp_get_post_terms($post->ID);
577
+
578
+ foreach ($postTerms as $term) {
579
+ if (!isset($terms[$term->term_id])) {
580
+ $terms[$term->term_id] = $term;
581
+ }
582
+ }
583
+ }
584
+
585
+ return array_values($terms);
586
+ }
587
  }
src/Render.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
@@ -329,7 +329,7 @@ class UTCW_Render
329
  }
330
 
331
  if ($styles) {
332
- $this->css = sprintf('<style type="text/css">%s</style>', join('', $styles));
333
  }
334
  }
335
 
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
329
  }
330
 
331
  if ($styles) {
332
+ $this->css = sprintf('<style scoped type="text/css">%s</style>', join('', $styles));
333
  }
334
  }
335
 
src/Selection/CreationTimeStrategy.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage language
10
+ * @since 2.5
11
+ */
12
+
13
+ /**
14
+ * Class to select the newest terms from the DB
15
+ *
16
+ * @since 2.5
17
+ * @package utcw
18
+ * @subpackage selection
19
+ */
20
+ class UTCW_CreationTimeStrategy extends UTCW_SelectionStrategy
21
+ {
22
+ /**
23
+ * Config class instance
24
+ *
25
+ * @var UTCW_Config
26
+ * @since 2.5
27
+ */
28
+ protected $config;
29
+
30
+ /**
31
+ * Plugin class instance
32
+ *
33
+ * @var UTCW_Plugin
34
+ * @since 2.5
35
+ */
36
+ protected $plugin;
37
+
38
+ /**
39
+ * WP Database class instance
40
+ *
41
+ * @var wpdb
42
+ * @since 2.5
43
+ */
44
+ protected $db;
45
+
46
+ /**
47
+ * A copy of the SQL query for debugging purposes
48
+ *
49
+ * @var string
50
+ * @since 2.5
51
+ */
52
+ protected $query;
53
+
54
+ /**
55
+ * Creates a new instance
56
+ *
57
+ * @param UTCW_Plugin $plugin Main plugin instance
58
+ *
59
+ * @since 2.5
60
+ */
61
+ public function __construct(UTCW_Plugin $plugin)
62
+ {
63
+ $this->config = $plugin->get('dataConfig');
64
+ $this->db = $plugin->get('wpdb');
65
+ $this->plugin = $plugin;
66
+ }
67
+
68
+ /**
69
+ * Returns term data based on current configuration
70
+ *
71
+ * @return stdClass[]
72
+ * @since 2.5
73
+ */
74
+ public function getData()
75
+ {
76
+ $builder = new UTCW_QueryBuilder($this->plugin, $this->db);
77
+
78
+ $builder->addAuthorConstraint($this->config->authors);
79
+ $builder->addPostTypeConstraint($this->config->post_type);
80
+ $builder->addPostStatusConstraint($this->plugin->isAuthenticatedUser());
81
+ $builder->addDaysOldConstraint($this->config->days_old);
82
+ $builder->addTaxonomyConstraint($this->config->taxonomy);
83
+ $builder->addTagsListConstraint(
84
+ $this->config->tags_list_type,
85
+ $this->config->tags_list,
86
+ $this->config->taxonomy
87
+ );
88
+ $builder->addPostTermConstraint($this->config->post_term);
89
+ $builder->addGrouping();
90
+ $builder->addMinimum($this->config->minimum);
91
+ $builder->addStatement('ORDER BY term_id DESC');
92
+ $builder->addMaxConstraint($this->config->max);
93
+ $builder->addSort($this->config->order, $this->config->reverse, $this->config->case_sensitive);
94
+
95
+ $query = $builder->getQuery();
96
+ $parameters = $builder->getParameters();
97
+ $query = $this->db->prepare($query, $parameters);
98
+
99
+ $result = $this->db->get_results($query);
100
+ $this->query = $this->db->last_query;
101
+
102
+ return $result;
103
+ }
104
+
105
+ /**
106
+ * Clean up the internal members for debug output
107
+ *
108
+ * @return void
109
+ * @since 2.5
110
+ */
111
+ public function cleanupForDebug()
112
+ {
113
+ unset($this->db);
114
+ $this->plugin->remove('wpdb');
115
+ }
116
+ }
src/Selection/CurrentListStrategy.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage language
10
+ * @since 2.5
11
+ */
12
+
13
+ /**
14
+ * Class to select only the terms that are displayed in the current list
15
+ *
16
+ * @since 2.5
17
+ * @package utcw
18
+ * @subpackage selection
19
+ */
20
+ class UTCW_CurrentListStrategy extends UTCW_SelectionStrategy
21
+ {
22
+ /**
23
+ * Config class instance
24
+ *
25
+ * @var UTCW_Config
26
+ * @since 2.5
27
+ */
28
+ protected $config;
29
+
30
+ /**
31
+ * Plugin class instance
32
+ *
33
+ * @var UTCW_Plugin
34
+ * @since 2.5
35
+ */
36
+ protected $plugin;
37
+
38
+ /**
39
+ * WP Database class instance
40
+ *
41
+ * @var wpdb
42
+ * @since 2.5
43
+ */
44
+ protected $db;
45
+
46
+ /**
47
+ * A copy of the SQL query for debugging purposes
48
+ *
49
+ * @var string
50
+ * @since 2.5
51
+ */
52
+ protected $query;
53
+
54
+ /**
55
+ * Creates a new instance
56
+ *
57
+ * @param UTCW_Plugin $plugin Main plugin instance
58
+ *
59
+ * @since 2.5
60
+ */
61
+ public function __construct(UTCW_Plugin $plugin)
62
+ {
63
+ $this->config = $plugin->get('dataConfig');
64
+ $this->db = $plugin->get('wpdb');
65
+ $this->plugin = $plugin;
66
+ }
67
+
68
+ /**
69
+ * Returns term data based on current configuration
70
+ *
71
+ * @return stdClass[]
72
+ * @since 2.5
73
+ */
74
+ public function getData()
75
+ {
76
+ $terms = $this->plugin->getCurrentQueryTerms();
77
+
78
+ if (!$terms) {
79
+ return array();
80
+ }
81
+
82
+ $termIds = array_map(create_function('$term', 'return $term->term_id;'), $terms);
83
+
84
+ $builder = new UTCW_QueryBuilder($this->plugin, $this->db);
85
+
86
+ $builder->addAuthorConstraint($this->config->authors);
87
+ $builder->addPostTypeConstraint($this->config->post_type);
88
+ $builder->addPostStatusConstraint($this->plugin->isAuthenticatedUser());
89
+ $builder->addDaysOldConstraint($this->config->days_old);
90
+ $builder->addTaxonomyConstraint($this->config->taxonomy);
91
+ $builder->addTagsListConstraint(
92
+ $this->config->tags_list_type,
93
+ $this->config->tags_list,
94
+ $this->config->taxonomy
95
+ );
96
+ $builder->addPostTermConstraint($this->config->post_term);
97
+ $builder->addGrouping();
98
+ $builder->addMinimum($this->config->minimum);
99
+
100
+ $parameters = array();
101
+
102
+ foreach ($termIds as $termId) {
103
+ $parameters[] = '%d';
104
+ $builder->addParameter($termId);
105
+ }
106
+
107
+ $builder->addStatement('AND term_id IN (' . join(',', $parameters) . ')');
108
+
109
+ $builder->addMaxConstraint($this->config->max);
110
+ $builder->addSort($this->config->order, $this->config->reverse, $this->config->case_sensitive);
111
+
112
+ $query = $builder->getQuery();
113
+ $parameters = $builder->getParameters();
114
+ $query = $this->db->prepare($query, $parameters);
115
+
116
+ $result = $this->db->get_results($query);
117
+ $this->query = $this->db->last_query;
118
+
119
+ return $result;
120
+ }
121
+
122
+ /**
123
+ * Clean up the internal members for debug output
124
+ *
125
+ * @return void
126
+ * @since 2.5
127
+ */
128
+ public function cleanupForDebug()
129
+ {
130
+ unset($this->db);
131
+ $this->plugin->remove('wpdb');
132
+ }
133
+ }
src/Selection/RandomStrategy.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage language
src/Selection/SelectionStrategy.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage selection
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage selection
src/Term.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
src/Widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
- * @version 2.4
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
@@ -120,7 +120,7 @@ class UTCW_Widget extends WP_Widget
120
  /** @noinspection PhpUnusedLocalVariableInspection */
121
  $available_taxonomies = $this->plugin->getAllowedTaxonomiesObjects();
122
  /** @noinspection PhpUnusedLocalVariableInspection */
123
- $users = $this->plugin->getUsers();
124
  /** @noinspection PhpUnusedLocalVariableInspection */
125
  $terms = $this->plugin->getTerms();
126
 
@@ -132,6 +132,12 @@ class UTCW_Widget extends WP_Widget
132
  $terms_by_id[$term->term_id] = $term;
133
  }
134
  }
 
 
 
 
 
 
135
 
136
  // Content of the widget settings form
137
  require dirname(__FILE__) . '/../pages/settings.php';
3
  * Ultimate Tag Cloud Widget
4
  *
5
  * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.5
7
  * @license GPLv2
8
  * @package utcw
9
  * @subpackage main
120
  /** @noinspection PhpUnusedLocalVariableInspection */
121
  $available_taxonomies = $this->plugin->getAllowedTaxonomiesObjects();
122
  /** @noinspection PhpUnusedLocalVariableInspection */
123
+ $authors = $this->plugin->getUsers();
124
  /** @noinspection PhpUnusedLocalVariableInspection */
125
  $terms = $this->plugin->getTerms();
126
 
132
  $terms_by_id[$term->term_id] = $term;
133
  }
134
  }
135
+ // Create a lookup table with all the authors indexed by their ID
136
+ $authors_by_id = array();
137
+
138
+ foreach ($authors as $author) {
139
+ $authors_by_id[$author->ID] = $author;
140
+ }
141
 
142
  // Content of the widget settings form
143
  require dirname(__FILE__) . '/../pages/settings.php';
ultimate-tag-cloud-widget.php CHANGED
@@ -3,7 +3,7 @@
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.
6
- Version: 2.4
7
  Author: Rickard Andersson
8
  Author URI: https://www.0x539.se
9
  License: GPLv2
@@ -15,7 +15,7 @@ License: GPLv2
15
  * @var string
16
  * @since 2.0
17
  */
18
- define('UTCW_VERSION', '2.4');
19
 
20
  /**
21
  * If development mode is currently enabled
@@ -68,6 +68,8 @@ function utcw_load()
68
  'Selection/SelectionStrategy.php',
69
  'Selection/PopularityStrategy.php',
70
  'Selection/RandomStrategy.php',
 
 
71
  'Database/QueryBuilder.php',
72
  'Config/Config.php',
73
  'Config/DataConfig.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.
6
+ Version: 2.5
7
  Author: Rickard Andersson
8
  Author URI: https://www.0x539.se
9
  License: GPLv2
15
  * @var string
16
  * @since 2.0
17
  */
18
+ define('UTCW_VERSION', '2.5');
19
 
20
  /**
21
  * If development mode is currently enabled
68
  'Selection/SelectionStrategy.php',
69
  'Selection/PopularityStrategy.php',
70
  'Selection/RandomStrategy.php',
71
+ 'Selection/CreationTimeStrategy.php',
72
+ 'Selection/CurrentListStrategy.php',
73
  'Database/QueryBuilder.php',
74
  'Config/Config.php',
75
  'Config/DataConfig.php',