Ultimate Tag Cloud Widget - Version 2.3-beta1

Version Description

= 2.3 =

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

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

Code changes from version 2.2.3 to 2.3-beta1

css/style.css CHANGED
@@ -1 +1,103 @@
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}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .utcw-tab-button {
2
+ border-top: solid 1px #dfdfdf;
3
+ border-left: solid 1px #dfdfdf;
4
+ border-right: solid 1px #dfdfdf;
5
+ border-bottom: none;
6
+ margin: 0;
7
+ -webkit-border-top-left-radius: 3px;
8
+ -webkit-border-top-right-radius: 3px;
9
+ -moz-border-radius-topleft: 3px;
10
+ -moz-border-radius-topright: 3px;
11
+ border-top-left-radius: 3px;
12
+ border-top-right-radius: 3px;
13
+ padding: 2px;
14
+ background: transparent;
15
+ opacity: 0.5;
16
+ cursor: pointer;
17
+ -webkit-transition: opacity 0.1s ease-in; }
18
+ .utcw-tab-button:hover {
19
+ opacity: 1; }
20
+
21
+ .utcw-help {
22
+ float: right;
23
+ display: block;
24
+ width: 14px;
25
+ height: 14px;
26
+ border: solid 1px transparent;
27
+ -webkit-border-radius: 14px;
28
+ -moz-border-radius: 14px;
29
+ -khtml-border-radius: 14px;
30
+ border-radius: 14px;
31
+ text-align: center;
32
+ color: #fff;
33
+ font-weight: bold;
34
+ background-color: #6295fb;
35
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#6295fb), to(#3265cb));
36
+ background-image: -webkit-linear-gradient(top, #6295fb, #3265cb);
37
+ background-image: -moz-linear-gradient(top, #6295fb, #3265cb);
38
+ background-image: -ms-linear-gradient(top, #6295fb, #3265cb);
39
+ background-image: -o-linear-gradient(top, #6295fb, #3265cb);
40
+ background-image: linear-gradient(top, #6295fb, #3265cb);
41
+ cursor: pointer; }
42
+ .utcw-help:hover {
43
+ color: #fff; }
44
+
45
+ .utcw-tooltip {
46
+ color: #000;
47
+ width: 200px;
48
+ text-align: center;
49
+ border: solid 1px #6295fb;
50
+ -webkit-border-radius: 9px;
51
+ -moz-border-radius: 9px;
52
+ -khtml-border-radius: 9px;
53
+ border-radius: 9px; }
54
+ .utcw-tooltip ul {
55
+ list-style-type: circle;
56
+ margin: 10px 0; }
57
+ .utcw-tooltip li {
58
+ margin: 0 0 0 20px; }
59
+
60
+ fieldset.utcw {
61
+ padding: 10px;
62
+ border: solid 1px #dfdfdf;
63
+ margin-bottom: 25px; }
64
+ fieldset.utcw h3 {
65
+ margin: 0 0 5px 0; }
66
+ fieldset.utcw input[type="number"] {
67
+ width: 50px; }
68
+ fieldset.utcw legend {
69
+ letter-spacing: 2px;
70
+ font-size: 16px; }
71
+ fieldset.utcw label.two-col {
72
+ width: 120px;
73
+ display: inline-block; }
74
+ fieldset.utcw .post-term-search-result {
75
+ background: #fff;
76
+ box-shadow: 0 0 6px #ccc;
77
+ -webkit-border-radius: 3px;
78
+ -moz-border-radius: 3px;
79
+ -khtml-border-radius: 3px;
80
+ border-radius: 3px; }
81
+ fieldset.utcw .post-term-search-result li {
82
+ padding: 0 0.5em;
83
+ cursor: pointer; }
84
+ fieldset.utcw .post-term-search-result li:first-of-type {
85
+ padding-top: 0.5em; }
86
+ fieldset.utcw .post-term-search-result li:last-of-type {
87
+ padding-bottom: 0.5em; }
88
+ fieldset.utcw .submitbox {
89
+ float: right;
90
+ cursor: pointer; }
91
+
92
+ .utcw-hidden {
93
+ display: none; }
94
+
95
+ .utcw-active {
96
+ font-weight: bold;
97
+ opacity: 1; }
98
+
99
+ .utcw-authors {
100
+ margin-top: 5px; }
101
+
102
+ .utcw-remove-config {
103
+ cursor: pointer; }
js/utcw.min.js CHANGED
@@ -1,4 +1,11 @@
1
- /*! Ultimate Tag Cloud Widget - v2.2.3 - 2013-05-06
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);
 
 
 
 
 
 
 
1
+ /*! Ultimate Tag Cloud Widget - v2.3 - 2013-05-30
2
  * https://0x539.se/wordpress/ultimate-tag-cloud-widget/
3
  * Copyright (c) 2013 Rickard Andersson; Licensed GPLv2 */
4
+ (function(b,k){var l={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1E3},c={activeTab:{},terms:{},init:function(){b("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]").live("click",this.colorClickHandler);b(".utcw-tab-button").live("click",this.tabClickHandler);b(".utcw-input-taxonomy").live("click",this.taxonomyClickHandler);b(".utcw-all-authors").live("click",this.allAuthorsClickHandler);b(".utcw-selected-authors").live("click",
5
+ this.selectedAuthorsClickHandler);b(".utcw-remove-config").live("click",this.removeConfigClickHandler);b(".post-term-search").live("keyup",this.postTermSearchHandler).live("search",this.postTermSearchHandler);b(".utcw-remove-term").live("click",this.removeTermClickHandler);b(document).ready(this.initTooltip);b(document).ajaxSuccess(this.ajaxSuccessHandler);b.post(k,{action:"utcw_get_terms"},function(a){c.terms=a})},initTooltip:function(){b(".utcw-help").wTooltip({style:l,className:"utcw-tooltip"})},
6
+ postTermSearchHandler:function(){var a=b(this),e=b(a.data("result-selector")),h=b(a.data("selected-selector")),f=a.val().toLocaleLowerCase(),d=[];e.text("");if(f){for(var g in c.terms)c.terms.hasOwnProperty(g)&&c.terms[g].forEach(function(a){-1!==a.name.toLocaleLowerCase().indexOf(f)&&d.push(a)});d.forEach(function(d){var f=b(document.createElement("li")),g=b(document.createElement("a"));g.text(d.name+" ("+d.taxonomy+")");g.data("id",d.term_id);g.click(c.postTermSearchClickHandler(h,a));f.append(g);
7
+ e.append(f)})}},postTermSearchClickHandler:function(a,e){return function(){var c=b(this),f=b(document.createElement("li")),d=b(document.createElement("a")),g=b(document.createElement("span")),j=b(document.createElement("input")),k=c.parent().parent();f.text(c.text());j.attr("type","hidden");j.val(c.data("id"));j.attr("name",e.data("input-name")+"[]");d.addClass("submitdelete");d.addClass("deletion");d.addClass("utcw-remove-term");d.text(e.data("delete"));g.addClass("submitbox");g.append(d);f.append(g);
8
+ f.append(j);a.append(f);k.text("");e.val("")}},removeTermClickHandler:function(){b(this).parent().parent().remove()},removeConfigClickHandler:function(){var a=b(this),e=c.findWidgetParent(a).find(".utcw-load-config"),h=e.val(),f=a.data("input-name")+"[]",d=b(document.createElement("input"));d.attr("type","hidden");d.attr("name",f);d.attr("value",h);a.after(d);e.find(":selected").remove()},allAuthorsClickHandler:function(){var a=b(this),a=c.findWidgetParent(a);a.find(".utcw-authors").addClass("hidden");
9
+ a.find(".utcw-author-field").attr("checked",!1)},selectedAuthorsClickHandler:function(){var a=b(this);c.findWidgetParent(a).find(".utcw-authors").removeClass("hidden")},tabClickHandler:function(){var a=b(this);if("utcw-__i__"===a.data("id"))return!1;a.parent().find(".utcw-tab-button").removeClass("utcw-active");a.addClass("utcw-active");a.parent().find("fieldset.utcw").addClass("hidden");b("#"+a.data("tab")).removeClass("hidden");c.activeTab[a.data("id")]=a.data("tab");return!1},colorClickHandler:function(){var a=
10
+ b('div[id$="set_chooser"]'),e=b('div[id$="span_chooser"]'),c=b(this).val();a.addClass("utcw-hidden");e.addClass("utcw-hidden");"set"===c?a.removeClass("utcw-hidden"):"span"===c&&e.removeClass("utcw-hidden")},findWidgetParent:function(a){return a.parents(".widget-content")},taxonomyClickHandler:function(){var a=b(this),e=a.val(),h=a.is(":checked"),a=c.findWidgetParent(a).find("#"+e+"-terms");h?a.removeClass("hidden"):a.addClass("hidden")},ajaxSuccessHandler:function(a,b,h){c.setCurrentTab.apply(c,
11
+ [h.data]);c.initTooltip.apply(c)},setCurrentTab:function(a){var c=new Uri;c.setQuery(decodeURI(a));"save-widget"===c.getQueryParamValue("action")&&"utcw"===c.getQueryParamValue("id_base")&&(a=c.getQueryParamValue("widget-id"),this.activeTab[a]&&b('button[data-tab="'+this.activeTab[a]+'"]').trigger("click"))}};c.init()})(jQuery,ajaxurl);
pages/settings.php CHANGED
@@ -2,16 +2,18 @@
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
- * @version 2.2.3
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
9
  *
10
- * @var UTCW_Config $config
 
11
  * @var array $available_taxonomies
12
  * @var array $available_post_types
13
  * @var array $configurations
14
  * @var array $terms
 
15
  * @var array $users
16
  * @var UTCW_Widget $this
17
  */
@@ -37,35 +39,35 @@ if ( ! defined( 'ABSPATH' ) ) die();
37
  <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>
38
  <strong><?php _e('Selection strategy:', 'utcw') ?></strong><br>
39
  <label>
40
- <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="popularity" <?php if ($config->strategy === 'popularity') echo 'checked="checked"' ?>>
41
  <?php _e('Popularity','utcw') ?>
42
  </label><br>
43
  <label>
44
- <input type="radio" name="<?php echo $this->get_field_name('strategy') ?>" value="random" <?php if ($config->strategy === 'random') echo 'checked="checked"' ?>>
45
  <?php _e('Random','utcw') ?>
46
  </label><br>
47
  <br>
48
-
49
  <a class="utcw-help"
50
  title="<?php _e( 'Only posts from the selected authors will be used when calculating the tag cloud.', 'utcw' ) ?>">?</a>
51
  <strong><?php _e( 'Authors:', 'utcw' ) ?></strong><br>
52
 
53
  <label>
54
- <input type="radio" class="utcw-all-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( ! $config->authors ) echo 'checked="checked"'; ?>>
55
  <?php _e( 'All authors', 'utcw' ) ?>
56
  </label>
57
  <br>
58
  <label>
59
- <input type="radio" class="utcw-selected-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( $config->authors ) echo 'checked="checked"'; ?>>
60
  <?php _e( 'Selected authors only', 'utcw' ) ?>
61
  </label>
62
  <br>
63
 
64
- <div class="utcw-authors <?php if (!$config->authors) echo 'hidden' ?>">
65
  <?php foreach ( $users as $user ) : ?>
66
  <input class="utcw-author-field" type="checkbox" name="<?php echo $this->get_field_name( 'authors' ) ?>[]"
67
  id="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"
68
- value="<?php echo $user->ID ?>" <?php echo in_array( $user->ID, $config->authors, true ) ? 'checked="checked"' : ''; ?>>
69
  <label for="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"><?php echo $user->display_name ?></label><br>
70
  <?php endforeach; ?>
71
  </div>
@@ -76,33 +78,33 @@ if ( ! defined( 'ABSPATH' ) ) die();
76
  <strong><?php _e( 'Order:', 'utcw' ) ?></strong><br>
77
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
78
  id="<?php echo $this->get_field_id( 'order_random' ) ?>"
79
- value="random" <?php echo $config->order == 'random' ? ' checked="checked" ' : ''; ?>>
80
  <label for="<?php echo $this->get_field_id( 'order_random' ) ?>"><?php _e( 'Random', 'utcw' ) ?></label><br>
81
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
82
  id="<?php echo $this->get_field_id( 'order_name' ) ?>"
83
- value="name" <?php echo $config->order == 'name' ? ' checked="checked"' : ''; ?>>
84
  <label for="<?php echo $this->get_field_id( 'order_name' ) ?>"><?php _e( 'By name', 'utcw' ) ?></label><br>
85
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
86
  id="<?php echo $this->get_field_id( 'order_slug' ) ?>"
87
- value="slug" <?php echo $config->order == 'slug' ? ' checked="checked"' : ''; ?>>
88
  <label for="<?php echo $this->get_field_id( 'order_slug' ) ?>"><?php _e( 'By slug', 'utcw' ) ?></label><br>
89
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
90
  id="<?php echo $this->get_field_id( 'order_id' ) ?>"
91
- value="id" <?php echo $config->order == 'id' ? ' checked="checked"' : ''; ?>>
92
  <label for="<?php echo $this->get_field_id( 'order_id' ) ?>"><?php _e( 'By id', 'utcw' ) ?></label><br>
93
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
94
  id="<?php echo $this->get_field_id( 'order_color' ) ?>"
95
- value="name" <?php echo $config->order == 'color' ? ' checked="checked"' : ''; ?>>
96
  <label for="<?php echo $this->get_field_id( 'order_color' ) ?>"><?php _e( 'By color', 'utcw' ) ?></label><br>
97
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
98
  id="<?php echo $this->get_field_id( 'order_count' ) ?>"
99
- value="count" <?php echo $config->order == 'count' || strlen( $config->order ) == 0 ? ' checked="checked" ' : ''; ?>>
100
  <label for="<?php echo $this->get_field_id( 'order_count' ) ?>"><?php _e( 'Count', 'utcw' ) ?></label><br>
101
  <input type="checkbox" name="<?php echo $this->get_field_name( 'reverse' ) ?>"
102
- id="<?php echo $this->get_field_id( 'reverse' ) ?>" <?php echo $config->reverse === true ? ' checked="checked"' : ''; ?>>
103
  <label for="<?php echo $this->get_field_id( 'reverse' ) ?>"><?php _e( 'Reverse order', 'utcw' ) ?></label><br>
104
  <input type="checkbox" name="<?php echo $this->get_field_name( 'case_sensitive' ) ?>"
105
- id="<?php echo $this->get_field_id( 'case_sensitive' ) ?>" <?php echo $config->case_sensitive === true ? ' checked="checked"' : ''; ?>>
106
  <label
107
  for="<?php echo $this->get_field_id( 'case_sensitive' ) ?>"><?php _e( 'Case sensitive', 'utcw' ) ?></label><br>
108
  <br>
@@ -113,7 +115,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
113
  for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomies:', 'utcw' ) ?></label></strong><br>
114
  <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
115
  <label>
116
- <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"' ?>>
117
  <?php echo $taxonomy->labels->name ?>
118
  </label><br>
119
  <?php endforeach; ?>
@@ -126,7 +128,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
126
  <?php foreach ( $available_post_types as $pt ) : $data = get_post_type_object( $pt ) ?>
127
  <input type="checkbox" name="<?php echo $this->get_field_name( 'post_type' ) ?>[]"
128
  id="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"
129
- value="<?php echo $pt ?>" <?php if ( in_array( $pt, $config->post_type ) ) echo 'checked="checked"' ?>>
130
  <label for="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"><?php echo $data->labels->name ?></label><br>
131
  <?php endforeach ?>
132
  <br>
@@ -136,7 +138,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
136
  <strong><label for="<?php echo $this->get_field_id( 'minimum' ) ?>"
137
  title="<?php _e( 'Tags with fewer posts than this will be automatically excluded.', 'utcw' ) ?>"><?php _e( 'Minimum number of posts: ', 'utcw' ) ?></label></strong>
138
  <input type="number" name="<?php echo $this->get_field_name( 'minimum' ) ?>"
139
- id="<?php echo $this->get_field_id( 'minimum' ) ?>" value="<?php echo $config->minimum; ?>"><br>
140
  <br>
141
 
142
  <a class="utcw-help"
@@ -144,7 +146,30 @@ if ( ! defined( 'ABSPATH' ) ) die();
144
  <strong><label for="<?php echo $this->get_field_id( 'days_old' ) ?>"
145
  title="<?php _e( 'The maximum number of days back to search for posts, zero means every post.', 'utcw' )?>"><?php _e( 'Posts max age:', 'utcw' )?></label></strong><br>
146
  <input type="number" name="<?php echo $this->get_field_name( 'days_old' ) ?>"
147
- id="<?php echo $this->get_field_id( 'days_old' ) ?>" value="<?php echo $config->days_old; ?>"><br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  </fieldset>
149
 
150
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-terms' ) ?>">
@@ -155,13 +180,13 @@ if ( ! defined( 'ABSPATH' ) ) die();
155
  <br>
156
  <input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
157
  id="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"
158
- value="include" <?php echo $config->tags_list_type == 'include' ? 'checked="checked" ' : ''; ?>>
159
  <label
160
  for="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"><?php _e( 'Include only selected terms', 'utcw' ) ?></label>
161
  <br>
162
  <input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
163
  id="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"
164
- value="exclude" <?php echo $config->tags_list_type == 'exclude' ? 'checked="checked" ' : ''; ?>>
165
  <label
166
  for="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"><?php _e( 'Exclude selected terms', 'utcw' ) ?></label>
167
 
@@ -170,7 +195,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
170
  <a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
171
  <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
172
 
173
- <div id="<?php echo $taxonomy->name ?>-terms" <?php if ( !in_array( $taxonomy->name, $config->taxonomy ) ) echo 'class="hidden"' ?>>
174
 
175
  <strong><?php printf( __( 'Terms for taxonomy %s', 'utcw' ), $taxonomy->labels->name ) ?></strong>
176
 
@@ -183,7 +208,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
183
  type="checkbox"
184
  name="<?php echo $this->get_field_name( 'tags_list' ) ?>[]"
185
  value="<?php echo $term->term_id ?>"
186
- <?php if ( in_array( $term->term_id, $config->tags_list ) ) echo 'checked="checked"' ?>>
187
  <?php echo $term->name ?>
188
  </label>
189
  </li>
@@ -206,11 +231,11 @@ if ( ! defined( 'ABSPATH' ) ) die();
206
  <strong><label
207
  for="<?php echo $this->get_field_id( 'title' );?>"><?php _e( 'Title:', 'utcw' ) ?></label></strong><br>
208
  <input type="checkbox" id="<?php echo $this->get_field_id( 'show_title_text' ) ?>"
209
- name="<?php echo $this->get_field_name( 'show_title_text' ) ?>" <?php if ( ! isset( $config->show_title_text ) || $config->show_title_text ) echo 'checked="checked"' ?>>
210
  <label for="<?php echo $this->get_field_id( 'show_title_text' ) ?>"><?php _e( 'Show title', 'utcw' ) ?></label><br>
211
  <input type="text" id="<?php echo $this->get_field_id( 'title' );?>"
212
  name="<?php echo $this->get_field_name( 'title' );?>"
213
- value="<?php echo $config->title ?>"><br>
214
  <br>
215
 
216
  <a class="utcw-help"
@@ -219,11 +244,11 @@ if ( ! defined( 'ABSPATH' ) ) die();
219
  <label for="<?php echo $this->get_field_id( 'size_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
220
  <input type="text" name="<?php echo $this->get_field_name( 'size_from' ) ?>"
221
  id="<?php echo $this->get_field_id( 'size_from' ) ?>" size="3"
222
- value="<?php echo $config->size_from ?>">
223
  <label for="<?php echo $this->get_field_id( 'size_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
224
  <input type="text" name="<?php echo $this->get_field_name( 'size_to' ) ?>"
225
  id="<?php echo $this->get_field_id( 'size_to' ) ?>" size="3"
226
- value="<?php echo $config->size_to ?>"><br>
227
  <br>
228
 
229
  <a class="utcw-help"
@@ -232,7 +257,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
232
  for="<?php echo $this->get_field_id( 'max' ) ?>"><?php _e( 'Max tags:', 'utcw' ) ?></label></strong><br>
233
  <input type="number" name="<?php echo $this->get_field_name( 'max' ) ?>"
234
  id="<?php echo $this->get_field_id( 'max' ) ?>"
235
- value="<?php echo $config->max ?>"><br>
236
  <br>
237
 
238
  <a class="utcw-help"
@@ -240,55 +265,78 @@ if ( ! defined( 'ABSPATH' ) ) die();
240
  <strong><?php _e( 'Coloring:', 'utcw' ) ?></strong><br>
241
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
242
  id="<?php echo $this->get_field_id( 'color_none' ) ?>"
243
- value="none" <?php echo $config->color == 'none' ? 'checked="checked"' : ''; ?>>
244
  <label for="<?php echo $this->get_field_id( 'color_none' ) ?>"><?php _e( 'None', 'utcw' ) ?></label><br>
245
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
246
  id="<?php echo $this->get_field_id( 'color_random' ) ?>"
247
- value="random" <?php echo $config->color == 'random' ? 'checked="checked"' : ''; ?>>
248
  <label for="<?php echo $this->get_field_id( 'color_random' ) ?>"><?php _e( 'Totally random', 'utcw' ) ?></label><br>
249
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
250
  id="<?php echo $this->get_field_id( 'color_set' ) ?>"
251
- value="set" <?php echo $config->color == 'set' ? 'checked="checked"' : ''; ?>>
252
  <label
253
  for="<?php echo $this->get_field_id( 'color_set' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label><br>
254
 
255
  <div
256
- id="<?php echo $this->get_field_id( 'set_chooser' ) ?>" <?php echo $config->color != 'set' ? 'class="utcw-hidden"' : ''; ?>>
257
  <label class="screen-reader-text"
258
  for="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label>
259
  <input type="text" name="<?php echo $this->get_field_name( 'color_set' ) ?>"
260
- id="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>" value="<?php echo join( ',', $config->color_set ) ?>">
261
  </div>
262
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
263
  id="<?php echo $this->get_field_id( 'color_span' ) ?>"
264
- value="span" <?php echo $config->color == 'span' ? 'checked="checked"' : ''; ?>>
265
  <label
266
  for="<?php echo $this->get_field_id( 'color_span' ) ?>"><?php _e( 'Spanning between values', 'utcw' ) ?></label><br>
267
 
268
  <div
269
- id="<?php echo $this->get_field_id( 'span_chooser' ) ?>" <?php echo $config->color != 'span' ? 'class="utcw-hidden"' : ''; ?>>
270
  <label for="<?php echo $this->get_field_id( 'color_span_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
271
  <input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_from' ) ?>"
272
- id="<?php echo $this->get_field_id( 'color_span_from' ) ?>" value="<?php echo $config->color_span_from ?>"><br>
273
 
274
  <label for="<?php echo $this->get_field_id( 'color_span_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
275
  <input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_to' ) ?>"
276
- id="<?php echo $this->get_field_id( 'color_span_to' ) ?>" value="<?php echo $config->color_span_to ?>">
277
  </div>
278
  <br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  </fieldset>
280
 
281
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced-appearance' ) ?>">
 
 
 
 
 
 
 
 
 
282
  <legend></legend>
283
  <a class="utcw-help"
284
  title="<?php _e( 'The title is the small (usually) yellow label which will appear when the user hovers the tag. Try to hover the text to the left to see an example of what a title text looks like.', 'utcw' ) ?>">?</a>
285
  <input type="checkbox" name="<?php echo $this->get_field_name( 'show_title' ) ?>"
286
- id="<?php echo $this->get_field_id( 'show_title' ) ?>" <?php echo $config->show_title === true ? 'checked="checked"' : ''?>>
287
  <label for="<?php echo $this->get_field_id( 'show_title' ) ?>"
288
  title="<?php _e( 'This is a title', 'utcw' ) ?>"><?php _e( 'Show title (hover text)', 'utcw' ) ?></label><br> <a class="utcw-help"
289
  title="<?php _e( 'Uncheck this option if you do not want your tag cloud to contain links to the archive page for each tag.', 'utcw' ) ?>">?</a>
290
  <input type="checkbox" name="<?php echo $this->get_field_name( 'show_links' ) ?>"
291
- id="<?php echo $this->get_field_id( 'show_links' ) ?>" <?php echo $config->show_links === true ? 'checked="checked"' : ''?>>
292
  <label for="<?php echo $this->get_field_id( 'show_links' ) ?>"><?php _e( 'Show links', 'utcw' ) ?></label><br>
293
  <br>
294
 
@@ -299,22 +347,22 @@ if ( ! defined( 'ABSPATH' ) ) die();
299
  for="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"><?php _e( 'Between letters:', 'utcw' ) ?></label>
300
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'letter_spacing' ) ?>"
301
  id="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"
302
- value="<?php echo $config->letter_spacing ?>"><br>
303
  <label class="two-col"
304
  for="<?php echo $this->get_field_id( 'word_spacing' ) ?>"><?php _e( 'Between words:', 'utcw' ) ?></label>
305
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'word_spacing' ) ?>"
306
  id="<?php echo $this->get_field_id( 'word_spacing' ) ?>"
307
- value="<?php echo $config->word_spacing ?>"><br>
308
  <label class="two-col"
309
  for="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"><?php _e( 'Between tags:', 'utcw' ) ?></label>
310
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'tag_spacing' ) ?>"
311
  id="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"
312
- value="<?php echo $config->tag_spacing ?>"><br>
313
  <label class="two-col"
314
  for="<?php echo $this->get_field_id( 'line_height' ) ?>"><?php _e( 'Between rows:', 'utcw' ) ?></label>
315
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'line_height' ) ?>"
316
  id="<?php echo $this->get_field_id( 'line_height' ) ?>"
317
- value="<?php echo $config->line_height ?>"><br>
318
  <br>
319
 
320
  <a class="utcw-help"
@@ -322,21 +370,21 @@ if ( ! defined( 'ABSPATH' ) ) die();
322
  <strong><?php _e( 'Transform tags:', 'utcw' ) ?></strong><br>
323
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
324
  id="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"
325
- value="off" <?php echo $config->text_transform == 'off' ? 'checked="checked"' : ''; ?>>
326
  <label for="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"><?php _e( 'Off', 'utcw' ) ?></label><br>
327
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
328
  id="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"
329
- value="lowercase" <?php echo $config->text_transform == 'lowercase' ? ' checked="checked"' : ''; ?>>
330
  <label
331
  for="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"><?php _e( 'To lowercase', 'utcw' ) ?></label><br>
332
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
333
  id="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"
334
- value="uppercase" <?php echo $config->text_transform == 'uppercase' ? ' checked="checked"' : ''; ?>>
335
  <label
336
  for="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"><?php _e( 'To uppercase', 'utcw' ) ?></label><br>
337
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
338
  id="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"
339
- value="capitalize" <?php echo $config->text_transform == 'capitalize' ? ' checked="checked"' : ''; ?>>
340
  <label
341
  for="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"><?php _e( 'Capitalize', 'utcw' ) ?></label><br>
342
  <br>
@@ -348,15 +396,15 @@ if ( ! defined( 'ABSPATH' ) ) die();
348
  for="<?php echo $this->get_field_id( 'separator' ) ?>"><?php _e( 'Separator', 'utcw' ) ?></label>
349
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'separator' ) ?>"
350
  id="<?php echo $this->get_field_id( 'separator' ) ?>"
351
- value="<?php echo $config->separator ?>"><br>
352
  <label class="two-col" for="<?php echo $this->get_field_id( 'prefix' ) ?>"><?php _e( 'Prefix', 'utcw' ) ?></label>
353
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'prefix' ) ?>"
354
  id="<?php echo $this->get_field_id( 'prefix' ) ?>"
355
- value="<?php echo $config->prefix ?>"><br>
356
  <label class="two-col" for="<?php echo $this->get_field_id( 'suffix' ) ?>"><?php _e( 'Suffix', 'utcw' ) ?></label>
357
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'suffix' ) ?>"
358
  id="<?php echo $this->get_field_id( 'suffix' ) ?>"
359
- value="<?php echo $config->suffix ?>"><br>
360
 
361
  </fieldset>
362
 
@@ -372,15 +420,15 @@ if ( ! defined( 'ABSPATH' ) ) die();
372
  <strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
373
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
374
  id="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"
375
- value="yes" <?php echo $config->link_underline == 'yes' ? ' checked="checked"' : '' ?>>
376
  <label for="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
377
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
378
  id="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"
379
- value="no" <?php echo $config->link_underline == 'no' ? ' checked="checked"' : '' ?>>
380
  <label for="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
381
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
382
  id="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"
383
- value="default" <?php echo $config->link_underline == 'default' ? ' checked="checked"' : '' ?>>
384
  <label
385
  for="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
386
  <br>
@@ -390,15 +438,15 @@ if ( ! defined( 'ABSPATH' ) ) die();
390
  <strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
391
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
392
  id="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"
393
- value="yes" <?php echo $config->link_bold == 'yes' ? ' checked="checked"' : '' ?>>
394
  <label for="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
395
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
396
  id="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"
397
- value="no" <?php echo $config->link_bold == 'no' ? ' checked="checked"' : '' ?>>
398
  <label for="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
399
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
400
  id="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"
401
- value="default" <?php echo $config->link_bold == 'default' ? ' checked="checked"' : '' ?>>
402
  <label for="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
403
  <br>
404
 
@@ -407,15 +455,15 @@ if ( ! defined( 'ABSPATH' ) ) die();
407
  <strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
408
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
409
  id="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"
410
- value="yes" <?php echo $config->link_italic == 'yes' ? ' checked="checked"' : '' ?>>
411
  <label for="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
412
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
413
  id="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"
414
- value="no" <?php echo $config->link_italic == 'no' ? ' checked="checked"' : '' ?>>
415
  <label for="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
416
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
417
  id="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"
418
- value="default" <?php echo $config->link_italic == 'default' ? ' checked="checked"' : '' ?>>
419
  <label
420
  for="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
421
  <br>
@@ -425,7 +473,7 @@ if ( ! defined( 'ABSPATH' ) ) die();
425
  <strong><label
426
  for="<?php echo $this->get_field_id( 'link_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
427
  <input type="text" name="<?php echo $this->get_field_name( 'link_bg_color' ) ?>"
428
- id="<?php echo $this->get_field_id( 'link_bg_color' ) ?>" value="<?php echo $config->link_bg_color ?>"><br>
429
  <br>
430
 
431
  <a class="utcw-help"
@@ -435,34 +483,34 @@ if ( ! defined( 'ABSPATH' ) ) die();
435
  <select name="<?php echo $this->get_field_name( 'link_border_style' ) ?>"
436
  id="<?php echo $this->get_field_id( 'link_border_style' ) ?>">
437
  <option
438
- value="none" <?php echo $config->link_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
439
  <option
440
- value="dotted" <?php echo $config->link_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
441
  <option
442
- value="dashed" <?php echo $config->link_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
443
  <option
444
- value="solid" <?php echo $config->link_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
445
  <option
446
- value="double" <?php echo $config->link_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
447
  <option
448
- value="groove" <?php echo $config->link_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
449
  <option
450
- value="ridge" <?php echo $config->link_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
451
  <option
452
- value="inset" <?php echo $config->link_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
453
  <option
454
- value="outset" <?php echo $config->link_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
455
  </select><br>
456
  <br>
457
  <label
458
  for="<?php echo $this->get_field_id( 'link_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
459
  <input type="text" name="<?php echo $this->get_field_name( 'link_border_width' ) ?>"
460
- id="<?php echo $this->get_field_id( 'link_border_width' ) ?>" value="<?php echo $config->link_border_width ?>"><br>
461
  <br>
462
  <label
463
  for="<?php echo $this->get_field_id( 'link_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
464
  <input type="text" name="<?php echo $this->get_field_name( 'link_border_color' ) ?>"
465
- id="<?php echo $this->get_field_id( 'link_border_color' ) ?>" value="<?php echo $config->link_border_color ?>"><br>
466
 
467
  <a class="utcw-help"
468
  title="<?php _e( 'The hover effects will only affect the style of the tag when the user hovers the tag. For details about each settings see the section above.', 'utcw' )?>">?</a>
@@ -471,98 +519,98 @@ if ( ! defined( 'ABSPATH' ) ) die();
471
  <strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
472
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
473
  id="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"
474
- value="yes" <?php echo $config->hover_underline == 'yes' ? ' checked="checked"' : '' ?>>
475
  <label for="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
476
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
477
  id="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"
478
- value="no" <?php echo $config->hover_underline == 'no' ? ' checked="checked"' : '' ?>>
479
  <label for="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
480
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
481
  id="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"
482
- value="default" <?php echo $config->hover_underline == 'default' ? ' checked="checked"' : '' ?>>
483
  <label
484
  for="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
485
  <br>
486
  <strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
487
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
488
  id="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"
489
- value="yes" <?php echo $config->hover_bold == 'yes' ? ' checked="checked"' : '' ?>>
490
  <label for="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
491
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
492
  id="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"
493
- value="no" <?php echo $config->hover_bold == 'no' ? ' checked="checked"' : '' ?>>
494
  <label for="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
495
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
496
  id="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"
497
- value="default" <?php echo $config->hover_bold == 'default' ? ' checked="checked"' : '' ?>>
498
  <label
499
  for="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
500
  <br>
501
  <strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
502
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
503
  id="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"
504
- value="yes" <?php echo $config->hover_italic == 'yes' ? ' checked="checked"' : '' ?>>
505
  <label for="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
506
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
507
  id="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"
508
- value="no" <?php echo $config->hover_italic == 'no' ? ' checked="checked"' : '' ?>>
509
  <label for="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
510
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
511
  id="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"
512
- value="default" <?php echo $config->hover_italic == 'default' ? ' checked="checked"' : '' ?>>
513
  <label
514
  for="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
515
  <br>
516
  <strong><label
517
  for="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
518
  <input type="text" name="<?php echo $this->get_field_name( 'hover_bg_color' ) ?>"
519
- id="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>" value="<?php echo $config->hover_bg_color ?>"><br>
520
  <br>
521
  <strong><label
522
  for="<?php echo $this->get_field_id( 'hover_color' ) ?>"><?php _e( 'Font color (hex value):', 'utcw' ) ?></label></strong><br>
523
  <input type="text" name="<?php echo $this->get_field_name( 'hover_color' ) ?>"
524
- id="<?php echo $this->get_field_id( 'hover_color' ) ?>" value="<?php echo $config->hover_color ?>"><br>
525
  <br>
526
  <strong><?php _e( 'Border', 'utcw' ) ?></strong><br>
527
  <label for="<?php echo $this->get_field_id( 'hover_border_style' ) ?>"><?php _e( 'Style: ', 'utcw' ) ?></label><br>
528
  <select name="<?php echo $this->get_field_name( 'hover_border_style' ) ?>"
529
  id="<?php echo $this->get_field_id( 'hover_border_style' ) ?>">
530
  <option
531
- value="none" <?php echo $config->hover_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
532
  <option
533
- value="dotted" <?php echo $config->hover_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
534
  <option
535
- value="dashed" <?php echo $config->hover_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
536
  <option
537
- value="solid" <?php echo $config->hover_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
538
  <option
539
- value="double" <?php echo $config->hover_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
540
  <option
541
- value="groove" <?php echo $config->hover_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
542
  <option
543
- value="ridge" <?php echo $config->hover_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
544
  <option
545
- value="inset" <?php echo $config->hover_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
546
  <option
547
- value="outset" <?php echo $config->hover_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
548
  </select><br>
549
  <br>
550
  <label
551
  for="<?php echo $this->get_field_id( 'hover_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
552
  <input type="text" name="<?php echo $this->get_field_name( 'hover_border_width' ) ?>"
553
- id="<?php echo $this->get_field_id( 'hover_border_width' ) ?>" value="<?php echo $config->hover_border_width ?>"><br>
554
  <br>
555
  <label
556
  for="<?php echo $this->get_field_id( 'hover_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
557
  <input type="text" name="<?php echo $this->get_field_name( 'hover_border_color' ) ?>"
558
- id="<?php echo $this->get_field_id( 'hover_border_color' ) ?>" value="<?php echo $config->hover_border_color ?>"><br>
559
  </fieldset>
560
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced' ) ?>">
561
  <legend></legend>
562
  <a class="utcw-help"
563
  title="<?php _e( 'This will add a &lt;-- HTML comment --&gt; to the output with some debugging information, please use this information when troubleshooting. You can find the debugging information by using \'view source\' in your browser when viewing the page and searching for \'Ultimate Tag Cloud Debug information\'', 'utcw' )?>">?</a>
564
  <input type="checkbox" name="<?php echo $this->get_field_name( 'debug' ) ?>"
565
- id="<?php echo $this->get_field_id( 'debug' ) ?>" <?php echo ( $config->debug === true ) ? 'checked="checked"' : '' ?>>
566
  <label for="<?php echo $this->get_field_id( 'debug' ) ?>"><?php _e( 'Include debug output', 'utcw' )?></label><br>
567
  <br>
568
  <a class="utcw-help"
2
  /**
3
  * Ultimate Tag Cloud Widget
4
  * @author Rickard Andersson <rickard@0x539.se>
5
+ * @version 2.3
6
  * @license GPLv2
7
  * @package utcw
8
  * @subpackage pages
9
  *
10
+ * @var UTCW_DataConfig $dataConfig
11
+ * @var UTCW_RenderConfig $renderConfig
12
  * @var array $available_taxonomies
13
  * @var array $available_post_types
14
  * @var array $configurations
15
  * @var array $terms
16
+ * @var array $terms_by_id
17
  * @var array $users
18
  * @var UTCW_Widget $this
19
  */
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"' ?>>
43
  <?php _e('Popularity','utcw') ?>
44
  </label><br>
45
  <label>
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"
52
  title="<?php _e( 'Only posts from the selected authors will be used when calculating the tag cloud.', 'utcw' ) ?>">?</a>
53
  <strong><?php _e( 'Authors:', 'utcw' ) ?></strong><br>
54
 
55
  <label>
56
+ <input type="radio" class="utcw-all-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( ! $dataConfig->authors ) echo 'checked="checked"'; ?>>
57
  <?php _e( 'All authors', 'utcw' ) ?>
58
  </label>
59
  <br>
60
  <label>
61
+ <input type="radio" class="utcw-selected-authors" name="<?php echo $this->get_field_name( 'utcw-all-authors' ) ?>" <?php if ( $dataConfig->authors ) echo 'checked="checked"'; ?>>
62
  <?php _e( 'Selected authors only', 'utcw' ) ?>
63
  </label>
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>
78
  <strong><?php _e( 'Order:', 'utcw' ) ?></strong><br>
79
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
80
  id="<?php echo $this->get_field_id( 'order_random' ) ?>"
81
+ value="random" <?php echo $dataConfig->order == 'random' ? ' checked="checked" ' : ''; ?>>
82
  <label for="<?php echo $this->get_field_id( 'order_random' ) ?>"><?php _e( 'Random', 'utcw' ) ?></label><br>
83
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
84
  id="<?php echo $this->get_field_id( 'order_name' ) ?>"
85
+ value="name" <?php echo $dataConfig->order == 'name' ? ' checked="checked"' : ''; ?>>
86
  <label for="<?php echo $this->get_field_id( 'order_name' ) ?>"><?php _e( 'By name', 'utcw' ) ?></label><br>
87
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
88
  id="<?php echo $this->get_field_id( 'order_slug' ) ?>"
89
+ value="slug" <?php echo $dataConfig->order == 'slug' ? ' checked="checked"' : ''; ?>>
90
  <label for="<?php echo $this->get_field_id( 'order_slug' ) ?>"><?php _e( 'By slug', 'utcw' ) ?></label><br>
91
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
92
  id="<?php echo $this->get_field_id( 'order_id' ) ?>"
93
+ value="id" <?php echo $dataConfig->order == 'id' ? ' checked="checked"' : ''; ?>>
94
  <label for="<?php echo $this->get_field_id( 'order_id' ) ?>"><?php _e( 'By id', 'utcw' ) ?></label><br>
95
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
96
  id="<?php echo $this->get_field_id( 'order_color' ) ?>"
97
+ value="name" <?php echo $dataConfig->order == 'color' ? ' checked="checked"' : ''; ?>>
98
  <label for="<?php echo $this->get_field_id( 'order_color' ) ?>"><?php _e( 'By color', 'utcw' ) ?></label><br>
99
  <input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
100
  id="<?php echo $this->get_field_id( 'order_count' ) ?>"
101
+ value="count" <?php echo $dataConfig->order == 'count' || strlen( $dataConfig->order ) == 0 ? ' checked="checked" ' : ''; ?>>
102
  <label for="<?php echo $this->get_field_id( 'order_count' ) ?>"><?php _e( 'Count', 'utcw' ) ?></label><br>
103
  <input type="checkbox" name="<?php echo $this->get_field_name( 'reverse' ) ?>"
104
+ id="<?php echo $this->get_field_id( 'reverse' ) ?>" <?php echo $dataConfig->reverse === true ? ' checked="checked"' : ''; ?>>
105
  <label for="<?php echo $this->get_field_id( 'reverse' ) ?>"><?php _e( 'Reverse order', 'utcw' ) ?></label><br>
106
  <input type="checkbox" name="<?php echo $this->get_field_name( 'case_sensitive' ) ?>"
107
+ id="<?php echo $this->get_field_id( 'case_sensitive' ) ?>" <?php echo $dataConfig->case_sensitive === true ? ' checked="checked"' : ''; ?>>
108
  <label
109
  for="<?php echo $this->get_field_id( 'case_sensitive' ) ?>"><?php _e( 'Case sensitive', 'utcw' ) ?></label><br>
110
  <br>
115
  for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomies:', 'utcw' ) ?></label></strong><br>
116
  <?php foreach ( $available_taxonomies as $taxonomy ) : ?>
117
  <label>
118
+ <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, $dataConfig->taxonomy ) ) echo 'checked="checked"' ?>>
119
  <?php echo $taxonomy->labels->name ?>
120
  </label><br>
121
  <?php endforeach; ?>
128
  <?php foreach ( $available_post_types as $pt ) : $data = get_post_type_object( $pt ) ?>
129
  <input type="checkbox" name="<?php echo $this->get_field_name( 'post_type' ) ?>[]"
130
  id="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"
131
+ value="<?php echo $pt ?>" <?php if ( in_array( $pt, $dataConfig->post_type ) ) echo 'checked="checked"' ?>>
132
  <label for="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"><?php echo $data->labels->name ?></label><br>
133
  <?php endforeach ?>
134
  <br>
138
  <strong><label for="<?php echo $this->get_field_id( 'minimum' ) ?>"
139
  title="<?php _e( 'Tags with fewer posts than this will be automatically excluded.', 'utcw' ) ?>"><?php _e( 'Minimum number of posts: ', 'utcw' ) ?></label></strong>
140
  <input type="number" name="<?php echo $this->get_field_name( 'minimum' ) ?>"
141
+ id="<?php echo $this->get_field_id( 'minimum' ) ?>" value="<?php echo $dataConfig->minimum; ?>"><br>
142
  <br>
143
 
144
  <a class="utcw-help"
146
  <strong><label for="<?php echo $this->get_field_id( 'days_old' ) ?>"
147
  title="<?php _e( 'The maximum number of days back to search for posts, zero means every post.', 'utcw' )?>"><?php _e( 'Posts max age:', 'utcw' )?></label></strong><br>
148
  <input type="number" name="<?php echo $this->get_field_name( 'days_old' ) ?>"
149
+ id="<?php echo $this->get_field_id( 'days_old' ) ?>" value="<?php echo $dataConfig->days_old; ?>"><br>
150
+ <br>
151
+
152
+ <a class="utcw-help"
153
+ title="<?php _e( 'Only posts which have any of the selected terms will be used when generating the cloud', 'utcw' ) ?>">?</a>
154
+ <strong><label for="<?php echo $this->get_field_id('post_term_search') ?>"><?php _e('Post term filter', 'utcw') ?></label></strong>
155
+ <input type="search" class="post-term-search" id="<?php echo $this->get_field_id('post_term_search') ?>"
156
+ data-result-selector="#<?php echo $this->get_field_id('post-term-search-result') ?>"
157
+ data-selected-selector="#<?php echo $this->get_field_id('post-term-search-selected') ?>"
158
+ data-input-name="<?php echo $this->get_field_name( 'post_term' ) ?>"
159
+ data-delete="<?php _e( 'Delete', 'utcw' ) ?>" />
160
+ <ul class="post-term-search-result" id="<?php echo $this->get_field_id('post-term-search-result') ?>"></ul>
161
+ <ul class="post-term-search-selected" id="<?php echo $this->get_field_id('post-term-search-selected') ?>">
162
+ <?php foreach ($dataConfig->post_term as $term_id) : $term = $terms_by_id[$term_id]; ?>
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' ) ?>">
180
  <br>
181
  <input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
182
  id="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"
183
+ value="include" <?php echo $dataConfig->tags_list_type == 'include' ? 'checked="checked" ' : ''; ?>>
184
  <label
185
  for="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"><?php _e( 'Include only selected terms', 'utcw' ) ?></label>
186
  <br>
187
  <input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
188
  id="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"
189
+ value="exclude" <?php echo $dataConfig->tags_list_type == 'exclude' ? 'checked="checked" ' : ''; ?>>
190
  <label
191
  for="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"><?php _e( 'Exclude selected terms', 'utcw' ) ?></label>
192
 
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
 
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>
231
  <strong><label
232
  for="<?php echo $this->get_field_id( 'title' );?>"><?php _e( 'Title:', 'utcw' ) ?></label></strong><br>
233
  <input type="checkbox" id="<?php echo $this->get_field_id( 'show_title_text' ) ?>"
234
+ name="<?php echo $this->get_field_name( 'show_title_text' ) ?>" <?php if ( ! isset( $renderConfig->show_title_text ) || $renderConfig->show_title_text ) echo 'checked="checked"' ?>>
235
  <label for="<?php echo $this->get_field_id( 'show_title_text' ) ?>"><?php _e( 'Show title', 'utcw' ) ?></label><br>
236
  <input type="text" id="<?php echo $this->get_field_id( 'title' );?>"
237
  name="<?php echo $this->get_field_name( 'title' );?>"
238
+ value="<?php echo $renderConfig->title ?>"><br>
239
  <br>
240
 
241
  <a class="utcw-help"
244
  <label for="<?php echo $this->get_field_id( 'size_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
245
  <input type="text" name="<?php echo $this->get_field_name( 'size_from' ) ?>"
246
  id="<?php echo $this->get_field_id( 'size_from' ) ?>" size="3"
247
+ value="<?php echo $dataConfig->size_from ?>">
248
  <label for="<?php echo $this->get_field_id( 'size_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
249
  <input type="text" name="<?php echo $this->get_field_name( 'size_to' ) ?>"
250
  id="<?php echo $this->get_field_id( 'size_to' ) ?>" size="3"
251
+ value="<?php echo $dataConfig->size_to ?>"><br>
252
  <br>
253
 
254
  <a class="utcw-help"
257
  for="<?php echo $this->get_field_id( 'max' ) ?>"><?php _e( 'Max tags:', 'utcw' ) ?></label></strong><br>
258
  <input type="number" name="<?php echo $this->get_field_name( 'max' ) ?>"
259
  id="<?php echo $this->get_field_id( 'max' ) ?>"
260
+ value="<?php echo $dataConfig->max ?>"><br>
261
  <br>
262
 
263
  <a class="utcw-help"
265
  <strong><?php _e( 'Coloring:', 'utcw' ) ?></strong><br>
266
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
267
  id="<?php echo $this->get_field_id( 'color_none' ) ?>"
268
+ value="none" <?php echo $dataConfig->color == 'none' ? 'checked="checked"' : ''; ?>>
269
  <label for="<?php echo $this->get_field_id( 'color_none' ) ?>"><?php _e( 'None', 'utcw' ) ?></label><br>
270
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
271
  id="<?php echo $this->get_field_id( 'color_random' ) ?>"
272
+ value="random" <?php echo $dataConfig->color == 'random' ? 'checked="checked"' : ''; ?>>
273
  <label for="<?php echo $this->get_field_id( 'color_random' ) ?>"><?php _e( 'Totally random', 'utcw' ) ?></label><br>
274
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
275
  id="<?php echo $this->get_field_id( 'color_set' ) ?>"
276
+ value="set" <?php echo $dataConfig->color == 'set' ? 'checked="checked"' : ''; ?>>
277
  <label
278
  for="<?php echo $this->get_field_id( 'color_set' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label><br>
279
 
280
  <div
281
+ id="<?php echo $this->get_field_id( 'set_chooser' ) ?>" <?php echo $dataConfig->color != 'set' ? 'class="utcw-hidden"' : ''; ?>>
282
  <label class="screen-reader-text"
283
  for="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label>
284
  <input type="text" name="<?php echo $this->get_field_name( 'color_set' ) ?>"
285
+ id="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>" value="<?php echo join( ',', $dataConfig->color_set ) ?>">
286
  </div>
287
  <input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
288
  id="<?php echo $this->get_field_id( 'color_span' ) ?>"
289
+ value="span" <?php echo $dataConfig->color == 'span' ? 'checked="checked"' : ''; ?>>
290
  <label
291
  for="<?php echo $this->get_field_id( 'color_span' ) ?>"><?php _e( 'Spanning between values', 'utcw' ) ?></label><br>
292
 
293
  <div
294
+ id="<?php echo $this->get_field_id( 'span_chooser' ) ?>" <?php echo $dataConfig->color != 'span' ? 'class="utcw-hidden"' : ''; ?>>
295
  <label for="<?php echo $this->get_field_id( 'color_span_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
296
  <input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_from' ) ?>"
297
+ id="<?php echo $this->get_field_id( 'color_span_from' ) ?>" value="<?php echo $dataConfig->color_span_from ?>"><br>
298
 
299
  <label for="<?php echo $this->get_field_id( 'color_span_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
300
  <input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_to' ) ?>"
301
+ id="<?php echo $this->get_field_id( 'color_span_to' ) ?>" value="<?php echo $dataConfig->color_span_to ?>">
302
  </div>
303
  <br>
304
+
305
+ <a class="utcw-help" title="<?php _e( 'Defines how the resulting tag should be aligned in the resulting cloud.', 'utcw' ) ?>">?</a>
306
+ <strong><?php _e('Text alignment:', 'utcw') ?></strong><br>
307
+ <input type="radio" name="<?php echo $this->get_field_name('alignment') ?>" id="<?php echo $this->get_field_id('alignment_default') ?>" value="" <?php if (!$renderConfig->alignment) echo 'checked="checked"' ?>>
308
+ <label for="<?php echo $this->get_field_id('alignment_default') ?>"><?php _e('Theme default', 'utcw') ?></label><br>
309
+ <input type="radio" name="<?php echo $this->get_field_name('alignment') ?>" id="<?php echo $this->get_field_id('alignment_left') ?>" value="left" <?php if ($renderConfig->alignment === 'left') echo 'checked="checked"' ?>>
310
+ <label for="<?php echo $this->get_field_id('alignment_left') ?>"><?php _e('Left', 'utcw') ?></label><br>
311
+ <input type="radio" name="<?php echo $this->get_field_name('alignment') ?>" id="<?php echo $this->get_field_id('alignment_right') ?>" value="right" <?php if ($renderConfig->alignment === 'right') echo 'checked="checked"' ?>>
312
+ <label for="<?php echo $this->get_field_id('alignment_right') ?>"><?php _e('Right', 'utcw') ?></label><br>
313
+ <input type="radio" name="<?php echo $this->get_field_name('alignment') ?>" id="<?php echo $this->get_field_id('alignment_center') ?>" value="center" <?php if ($renderConfig->alignment === 'center') echo 'checked="checked"' ?>>
314
+ <label for="<?php echo $this->get_field_id('alignment_center') ?>"><?php _e('Center', 'utcw') ?></label><br>
315
+ <input type="radio" name="<?php echo $this->get_field_name('alignment') ?>" id="<?php echo $this->get_field_id('alignment_justify') ?>" value="justify" <?php if ($renderConfig->alignment === 'justify') echo 'checked="checked"' ?>>
316
+ <label for="<?php echo $this->get_field_id('alignment_justify') ?>"><?php _e('Justify', 'utcw') ?></label><br>
317
+
318
  </fieldset>
319
 
320
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced-appearance' ) ?>">
321
+
322
+ <a class="utcw-help" title="<?php _e( 'Changes the overall display type of the output.', 'utcw' ) ?>">?</a>
323
+ <strong><?php _e('Display type:', 'utcw') ?></strong><br>
324
+ <input type="radio" name="<?php echo $this->get_field_name('display') ?>" id="<?php echo $this->get_field_id('display_inline') ?>" value="" <?php if ($renderConfig->display === 'inline') echo 'checked="checked"' ?>>
325
+ <label for="<?php echo $this->get_field_id('display_inline') ?>"><?php _e('Regular cloud', 'utcw') ?></label><br>
326
+ <input type="radio" name="<?php echo $this->get_field_name('display') ?>" id="<?php echo $this->get_field_id('display_list') ?>" value="list" <?php if ($renderConfig->display === 'list') echo 'checked="checked"' ?>>
327
+ <label for="<?php echo $this->get_field_id('display_list') ?>"><?php _e('List', 'utcw') ?></label><br>
328
+ <br>
329
+
330
  <legend></legend>
331
  <a class="utcw-help"
332
  title="<?php _e( 'The title is the small (usually) yellow label which will appear when the user hovers the tag. Try to hover the text to the left to see an example of what a title text looks like.', 'utcw' ) ?>">?</a>
333
  <input type="checkbox" name="<?php echo $this->get_field_name( 'show_title' ) ?>"
334
+ id="<?php echo $this->get_field_id( 'show_title' ) ?>" <?php echo $renderConfig->show_title === true ? 'checked="checked"' : ''?>>
335
  <label for="<?php echo $this->get_field_id( 'show_title' ) ?>"
336
  title="<?php _e( 'This is a title', 'utcw' ) ?>"><?php _e( 'Show title (hover text)', 'utcw' ) ?></label><br> <a class="utcw-help"
337
  title="<?php _e( 'Uncheck this option if you do not want your tag cloud to contain links to the archive page for each tag.', 'utcw' ) ?>">?</a>
338
  <input type="checkbox" name="<?php echo $this->get_field_name( 'show_links' ) ?>"
339
+ id="<?php echo $this->get_field_id( 'show_links' ) ?>" <?php echo $renderConfig->show_links === true ? 'checked="checked"' : ''?>>
340
  <label for="<?php echo $this->get_field_id( 'show_links' ) ?>"><?php _e( 'Show links', 'utcw' ) ?></label><br>
341
  <br>
342
 
347
  for="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"><?php _e( 'Between letters:', 'utcw' ) ?></label>
348
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'letter_spacing' ) ?>"
349
  id="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"
350
+ value="<?php echo $renderConfig->letter_spacing ?>"><br>
351
  <label class="two-col"
352
  for="<?php echo $this->get_field_id( 'word_spacing' ) ?>"><?php _e( 'Between words:', 'utcw' ) ?></label>
353
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'word_spacing' ) ?>"
354
  id="<?php echo $this->get_field_id( 'word_spacing' ) ?>"
355
+ value="<?php echo $renderConfig->word_spacing ?>"><br>
356
  <label class="two-col"
357
  for="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"><?php _e( 'Between tags:', 'utcw' ) ?></label>
358
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'tag_spacing' ) ?>"
359
  id="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"
360
+ value="<?php echo $renderConfig->tag_spacing ?>"><br>
361
  <label class="two-col"
362
  for="<?php echo $this->get_field_id( 'line_height' ) ?>"><?php _e( 'Between rows:', 'utcw' ) ?></label>
363
  <input type="text" size="5" name="<?php echo $this->get_field_name( 'line_height' ) ?>"
364
  id="<?php echo $this->get_field_id( 'line_height' ) ?>"
365
+ value="<?php echo $renderConfig->line_height ?>"><br>
366
  <br>
367
 
368
  <a class="utcw-help"
370
  <strong><?php _e( 'Transform tags:', 'utcw' ) ?></strong><br>
371
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
372
  id="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"
373
+ value="off" <?php echo $renderConfig->text_transform == 'none' ? 'checked="checked"' : ''; ?>>
374
  <label for="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"><?php _e( 'Off', 'utcw' ) ?></label><br>
375
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
376
  id="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"
377
+ value="lowercase" <?php echo $renderConfig->text_transform == 'lowercase' ? ' checked="checked"' : ''; ?>>
378
  <label
379
  for="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"><?php _e( 'To lowercase', 'utcw' ) ?></label><br>
380
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
381
  id="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"
382
+ value="uppercase" <?php echo $renderConfig->text_transform == 'uppercase' ? ' checked="checked"' : ''; ?>>
383
  <label
384
  for="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"><?php _e( 'To uppercase', 'utcw' ) ?></label><br>
385
  <input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
386
  id="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"
387
+ value="capitalize" <?php echo $renderConfig->text_transform == 'capitalize' ? ' checked="checked"' : ''; ?>>
388
  <label
389
  for="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"><?php _e( 'Capitalize', 'utcw' ) ?></label><br>
390
  <br>
396
  for="<?php echo $this->get_field_id( 'separator' ) ?>"><?php _e( 'Separator', 'utcw' ) ?></label>
397
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'separator' ) ?>"
398
  id="<?php echo $this->get_field_id( 'separator' ) ?>"
399
+ value="<?php echo $renderConfig->separator ?>"><br>
400
  <label class="two-col" for="<?php echo $this->get_field_id( 'prefix' ) ?>"><?php _e( 'Prefix', 'utcw' ) ?></label>
401
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'prefix' ) ?>"
402
  id="<?php echo $this->get_field_id( 'prefix' ) ?>"
403
+ value="<?php echo $renderConfig->prefix ?>"><br>
404
  <label class="two-col" for="<?php echo $this->get_field_id( 'suffix' ) ?>"><?php _e( 'Suffix', 'utcw' ) ?></label>
405
  <input type="text" size=5 name="<?php echo $this->get_field_name( 'suffix' ) ?>"
406
  id="<?php echo $this->get_field_id( 'suffix' ) ?>"
407
+ value="<?php echo $renderConfig->suffix ?>"><br>
408
 
409
  </fieldset>
410
 
420
  <strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
421
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
422
  id="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"
423
+ value="yes" <?php echo $renderConfig->link_underline == 'yes' ? ' checked="checked"' : '' ?>>
424
  <label for="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
425
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
426
  id="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"
427
+ value="no" <?php echo $renderConfig->link_underline == 'no' ? ' checked="checked"' : '' ?>>
428
  <label for="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
429
  <input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
430
  id="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"
431
+ value="default" <?php echo $renderConfig->link_underline == 'default' ? ' checked="checked"' : '' ?>>
432
  <label
433
  for="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
434
  <br>
438
  <strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
439
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
440
  id="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"
441
+ value="yes" <?php echo $renderConfig->link_bold == 'yes' ? ' checked="checked"' : '' ?>>
442
  <label for="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
443
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
444
  id="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"
445
+ value="no" <?php echo $renderConfig->link_bold == 'no' ? ' checked="checked"' : '' ?>>
446
  <label for="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
447
  <input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
448
  id="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"
449
+ value="default" <?php echo $renderConfig->link_bold == 'default' ? ' checked="checked"' : '' ?>>
450
  <label for="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
451
  <br>
452
 
455
  <strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
456
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
457
  id="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"
458
+ value="yes" <?php echo $renderConfig->link_italic == 'yes' ? ' checked="checked"' : '' ?>>
459
  <label for="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
460
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
461
  id="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"
462
+ value="no" <?php echo $renderConfig->link_italic == 'no' ? ' checked="checked"' : '' ?>>
463
  <label for="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
464
  <input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
465
  id="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"
466
+ value="default" <?php echo $renderConfig->link_italic == 'default' ? ' checked="checked"' : '' ?>>
467
  <label
468
  for="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
469
  <br>
473
  <strong><label
474
  for="<?php echo $this->get_field_id( 'link_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
475
  <input type="text" name="<?php echo $this->get_field_name( 'link_bg_color' ) ?>"
476
+ id="<?php echo $this->get_field_id( 'link_bg_color' ) ?>" value="<?php echo $renderConfig->link_bg_color ?>"><br>
477
  <br>
478
 
479
  <a class="utcw-help"
483
  <select name="<?php echo $this->get_field_name( 'link_border_style' ) ?>"
484
  id="<?php echo $this->get_field_id( 'link_border_style' ) ?>">
485
  <option
486
+ value="none" <?php echo $renderConfig->link_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
487
  <option
488
+ value="dotted" <?php echo $renderConfig->link_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
489
  <option
490
+ value="dashed" <?php echo $renderConfig->link_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
491
  <option
492
+ value="solid" <?php echo $renderConfig->link_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
493
  <option
494
+ value="double" <?php echo $renderConfig->link_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
495
  <option
496
+ value="groove" <?php echo $renderConfig->link_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
497
  <option
498
+ value="ridge" <?php echo $renderConfig->link_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
499
  <option
500
+ value="inset" <?php echo $renderConfig->link_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
501
  <option
502
+ value="outset" <?php echo $renderConfig->link_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
503
  </select><br>
504
  <br>
505
  <label
506
  for="<?php echo $this->get_field_id( 'link_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
507
  <input type="text" name="<?php echo $this->get_field_name( 'link_border_width' ) ?>"
508
+ id="<?php echo $this->get_field_id( 'link_border_width' ) ?>" value="<?php echo $renderConfig->link_border_width ?>"><br>
509
  <br>
510
  <label
511
  for="<?php echo $this->get_field_id( 'link_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
512
  <input type="text" name="<?php echo $this->get_field_name( 'link_border_color' ) ?>"
513
+ id="<?php echo $this->get_field_id( 'link_border_color' ) ?>" value="<?php echo $renderConfig->link_border_color ?>"><br>
514
 
515
  <a class="utcw-help"
516
  title="<?php _e( 'The hover effects will only affect the style of the tag when the user hovers the tag. For details about each settings see the section above.', 'utcw' )?>">?</a>
519
  <strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
520
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
521
  id="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"
522
+ value="yes" <?php echo $renderConfig->hover_underline == 'yes' ? ' checked="checked"' : '' ?>>
523
  <label for="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
524
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
525
  id="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"
526
+ value="no" <?php echo $renderConfig->hover_underline == 'no' ? ' checked="checked"' : '' ?>>
527
  <label for="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
528
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
529
  id="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"
530
+ value="default" <?php echo $renderConfig->hover_underline == 'default' ? ' checked="checked"' : '' ?>>
531
  <label
532
  for="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
533
  <br>
534
  <strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
535
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
536
  id="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"
537
+ value="yes" <?php echo $renderConfig->hover_bold == 'yes' ? ' checked="checked"' : '' ?>>
538
  <label for="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
539
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
540
  id="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"
541
+ value="no" <?php echo $renderConfig->hover_bold == 'no' ? ' checked="checked"' : '' ?>>
542
  <label for="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
543
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
544
  id="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"
545
+ value="default" <?php echo $renderConfig->hover_bold == 'default' ? ' checked="checked"' : '' ?>>
546
  <label
547
  for="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
548
  <br>
549
  <strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
550
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
551
  id="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"
552
+ value="yes" <?php echo $renderConfig->hover_italic == 'yes' ? ' checked="checked"' : '' ?>>
553
  <label for="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
554
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
555
  id="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"
556
+ value="no" <?php echo $renderConfig->hover_italic == 'no' ? ' checked="checked"' : '' ?>>
557
  <label for="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
558
  <input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
559
  id="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"
560
+ value="default" <?php echo $renderConfig->hover_italic == 'default' ? ' checked="checked"' : '' ?>>
561
  <label
562
  for="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
563
  <br>
564
  <strong><label
565
  for="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
566
  <input type="text" name="<?php echo $this->get_field_name( 'hover_bg_color' ) ?>"
567
+ id="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>" value="<?php echo $renderConfig->hover_bg_color ?>"><br>
568
  <br>
569
  <strong><label
570
  for="<?php echo $this->get_field_id( 'hover_color' ) ?>"><?php _e( 'Font color (hex value):', 'utcw' ) ?></label></strong><br>
571
  <input type="text" name="<?php echo $this->get_field_name( 'hover_color' ) ?>"
572
+ id="<?php echo $this->get_field_id( 'hover_color' ) ?>" value="<?php echo $renderConfig->hover_color ?>"><br>
573
  <br>
574
  <strong><?php _e( 'Border', 'utcw' ) ?></strong><br>
575
  <label for="<?php echo $this->get_field_id( 'hover_border_style' ) ?>"><?php _e( 'Style: ', 'utcw' ) ?></label><br>
576
  <select name="<?php echo $this->get_field_name( 'hover_border_style' ) ?>"
577
  id="<?php echo $this->get_field_id( 'hover_border_style' ) ?>">
578
  <option
579
+ value="none" <?php echo $renderConfig->hover_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
580
  <option
581
+ value="dotted" <?php echo $renderConfig->hover_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
582
  <option
583
+ value="dashed" <?php echo $renderConfig->hover_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
584
  <option
585
+ value="solid" <?php echo $renderConfig->hover_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
586
  <option
587
+ value="double" <?php echo $renderConfig->hover_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
588
  <option
589
+ value="groove" <?php echo $renderConfig->hover_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
590
  <option
591
+ value="ridge" <?php echo $renderConfig->hover_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
592
  <option
593
+ value="inset" <?php echo $renderConfig->hover_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
594
  <option
595
+ value="outset" <?php echo $renderConfig->hover_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
596
  </select><br>
597
  <br>
598
  <label
599
  for="<?php echo $this->get_field_id( 'hover_border_width' ) ?>"><?php _e( 'Width:', 'utcw' ) ?></label><br>
600
  <input type="text" name="<?php echo $this->get_field_name( 'hover_border_width' ) ?>"
601
+ id="<?php echo $this->get_field_id( 'hover_border_width' ) ?>" value="<?php echo $renderConfig->hover_border_width ?>"><br>
602
  <br>
603
  <label
604
  for="<?php echo $this->get_field_id( 'hover_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
605
  <input type="text" name="<?php echo $this->get_field_name( 'hover_border_color' ) ?>"
606
+ id="<?php echo $this->get_field_id( 'hover_border_color' ) ?>" value="<?php echo $renderConfig->hover_border_color ?>"><br>
607
  </fieldset>
608
  <fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced' ) ?>">
609
  <legend></legend>
610
  <a class="utcw-help"
611
  title="<?php _e( 'This will add a &lt;-- HTML comment --&gt; to the output with some debugging information, please use this information when troubleshooting. You can find the debugging information by using \'view source\' in your browser when viewing the page and searching for \'Ultimate Tag Cloud Debug information\'', 'utcw' )?>">?</a>
612
  <input type="checkbox" name="<?php echo $this->get_field_name( 'debug' ) ?>"
613
+ id="<?php echo $this->get_field_id( 'debug' ) ?>" <?php echo ( $renderConfig->debug === true ) ? 'checked="checked"' : '' ?>>
614
  <label for="<?php echo $this->get_field_id( 'debug' ) ?>"><?php _e( 'Include debug output', 'utcw' )?></label><br>
615
  <br>
616
  <a class="utcw-help"
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.6-beta2
6
- Stable tag: 2.2.3
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
  License: GPLv2 or later
9
 
@@ -47,6 +47,13 @@ If you have questions, please post them in the forums.
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
 
50
  = 2.2.3 =
51
 
52
  * Fixed naming collision issue with other plugins
@@ -90,6 +97,10 @@ The upgrade notice history for the 1.x branch is available on [GitHub](https://g
90
 
91
  == Upgrade Notice ==
92
 
 
 
 
 
93
  = 2.2.3 =
94
 
95
  * Fixed naming collision issue with other plugins
@@ -142,11 +153,20 @@ $args = array( "title" => "Most awesome title ever" );
142
 
143
  do_utcw( $args );`
144
 
 
 
 
 
 
 
 
145
  If you're not able to change your theme you can also use the shortcode `[utcw]` anywhere in your posts or pages. You can pass any of the settings along with the shortcode in the format of `key="value"`, for instance if you'd like to change the widget title:
146
 
147
  `[utcw title="Most awesome title ever"]`
148
 
149
- All the configuration options can be found in the [plugin documentation](http://barney.0x539.se/utcw/classes/UTCW_Config.html). The list of properties of `UTCW_Config` can all be used as keys to the function or shortcode.
 
 
150
 
151
  == Breaking changes in version 2.0 ==
152
 
3
  Tags: widget, tags, configurable, tag cloud
4
  Requires at least: 3.0
5
  Tested up to: 3.6-beta2
6
+ Stable tag: 2.3
7
  Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
8
  License: GPLv2 or later
9
 
47
 
48
  == Changelog ==
49
 
50
+ = 2.3 =
51
+
52
+ * [#27](https://github.com/rickard2/utcw/issues/27): Added filtering feature to generate a cloud of posts which have a common term/terms
53
+ * [#28](https://github.com/rickard2/utcw/issues/28): Added more styling options (center, right align, justify, display as list)
54
+ * [#29](https://github.com/rickard2/utcw/issues/29): Changed CSS classes to match the WordPress tag cloud
55
+ * [#25](https://github.com/rickard2/utcw/issues/25), [#26](https://github.com/rickard2/utcw/issues/26), [#31](https://github.com/rickard2/utcw/issues/31): Internal / code quality
56
+
57
  = 2.2.3 =
58
 
59
  * Fixed naming collision issue with other plugins
97
 
98
  == Upgrade Notice ==
99
 
100
+ = 2.3 =
101
+
102
+ * New features, see plugin page at wordpress.org for full details
103
+
104
  = 2.2.3 =
105
 
106
  * Fixed naming collision issue with other plugins
153
 
154
  do_utcw( $args );`
155
 
156
+ To use multiple configuration options just separate them with a comma:
157
+
158
+ `<?php
159
+ $args = array( "title" => "Most awesome title ever", "max" => 10 );
160
+
161
+ do_utcw( $args );`
162
+
163
  If you're not able to change your theme you can also use the shortcode `[utcw]` anywhere in your posts or pages. You can pass any of the settings along with the shortcode in the format of `key="value"`, for instance if you'd like to change the widget title:
164
 
165
  `[utcw title="Most awesome title ever"]`
166
 
167
+ == Configuration ==
168
+
169
+ All the configuration options can be found in the [configuration documentation at GitHub](https://github.com/rickard2/utcw/blob/master/CONFIG.md).
170
 
171
  == Breaking changes in version 2.0 ==
172
 
src/Config.php DELETED
@@ -1,898 +0,0 @@
1
- <?php
2
-
3
- //namespace Rickard\UTCW;
4
-
5
- /**
6
- * Ultimate Tag Cloud Widget
7
- *
8
- * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
- * @license GPLv2
11
- * @package utcw
12
- * @subpackage main
13
- * @since 2.0
14
- */
15
-
16
- /**
17
- * Configuration class for the widget.
18
- *
19
- * @since 2.0
20
- * @package utcw
21
- * @subpackage main
22
- */
23
- class UTCW_Config
24
- {
25
-
26
- /**
27
- * Title text of the widget.
28
- * Default value: Tag cloud
29
- *
30
- * @var string
31
- * @since 2.0
32
- */
33
- public $title;
34
-
35
- /**
36
- * How the result should be ordered
37
- * Default value: name
38
- * Valid values: random, name, slug, id, color, count
39
- *
40
- * @var string
41
- * @since 2.0
42
- */
43
- public $order;
44
-
45
- /**
46
- * The smallest possible size
47
- * Default: 10px
48
- *
49
- * @var string
50
- * @since 2.0
51
- */
52
- public $size_from;
53
-
54
- /**
55
- * The greatest possible size
56
- * Default: 30px
57
- *
58
- * @var string
59
- * @since 2.0
60
- */
61
- public $size_to;
62
-
63
- /**
64
- * Maximum number of tags to display
65
- * Default: 45
66
- *
67
- * @var int
68
- * @since 2.0
69
- */
70
- public $max;
71
-
72
- /**
73
- * Which taxonomy to show tags from
74
- * Default: [post_tag]
75
- *
76
- * @var array
77
- * @since 2.0
78
- */
79
- public $taxonomy;
80
-
81
- /**
82
- * If the order of tags should be shown in reverse order
83
- * Default: false
84
- *
85
- * @var bool
86
- * @since 2.0
87
- */
88
- public $reverse;
89
-
90
- /**
91
- * Which coloring strategy to use
92
- * Default: none
93
- * Valid values: none, random, set, span
94
- *
95
- * @var string
96
- * @since 2.0
97
- */
98
- public $color;
99
-
100
- /**
101
- * CSS letter-spacing value (in pixels)
102
- * Default: normal
103
- *
104
- * @var string
105
- * @since 2.0
106
- */
107
- public $letter_spacing;
108
-
109
- /**
110
- * CSS word-spacing value (in pixels)
111
- * Default: normal
112
- *
113
- * @var string
114
- * @since 2.0
115
- */
116
- public $word_spacing;
117
-
118
- /**
119
- * CSS text-transform value
120
- * Default: none
121
- * Valid values: lowercase, uppercase, capitalize
122
- *
123
- * @var string
124
- * @since 2.0
125
- */
126
- public $text_transform;
127
-
128
- /**
129
- * If sorting should be applied case sensitive
130
- * Default: false
131
- *
132
- * @var bool
133
- * @since 2.0
134
- */
135
- public $case_sensitive;
136
-
137
- /**
138
- * How many posts a term needs to have to be shown in the cloud
139
- * Default: 1
140
- *
141
- * @var int
142
- * @since 2.0
143
- */
144
- public $minimum;
145
-
146
- /**
147
- * How the $tags_list should be used
148
- * Default: exclude
149
- * Valid values: exclude, include
150
- *
151
- * @var string
152
- * @since 2.0
153
- */
154
- public $tags_list_type;
155
-
156
- /**
157
- * If the title attribute should be added to links in the cloud
158
- * Default: true
159
- *
160
- * @var bool
161
- * @since 2.0
162
- */
163
- public $show_title;
164
-
165
- /**
166
- * If the tags should be wrapped in links
167
- * Default: true
168
- *
169
- * @var bool
170
- * @since 2.2
171
- */
172
- public $show_links;
173
-
174
- /**
175
- * If links should be styled with underline decoration
176
- * Default: default
177
- * Valid values: yes, no, default
178
- *
179
- * @var string
180
- * @since 2.0
181
- */
182
- public $link_underline;
183
-
184
- /**
185
- * If links should be styled as bold
186
- * Default: default
187
- * Valid values: yes, no, default
188
- *
189
- * @var string
190
- * @since 2.0
191
- */
192
- public $link_bold;
193
-
194
- /**
195
- * If links should be styled as italic
196
- * Default: default
197
- * Valid values: yes, no, default
198
- *
199
- * @var string
200
- * @since 2.0
201
- */
202
- public $link_italic;
203
-
204
- /**
205
- * Background color for links
206
- * Default: transparent
207
- * Valid values: A hexadecimal color
208
- *
209
- * @var string
210
- * @since 2.0
211
- */
212
- public $link_bg_color;
213
-
214
- /**
215
- * Border style for links
216
- * Default: none
217
- * Valid values: none, dotted, dashed, solid, double, groove, ridge, inset, outset
218
- *
219
- * @var string
220
- * @since 2.0
221
- */
222
- public $link_border_style;
223
-
224
- /**
225
- * Border width for links
226
- * Default: 0
227
- *
228
- * @var string
229
- * @since 2.0
230
- */
231
- public $link_border_width;
232
-
233
- /**
234
- * Border color for links
235
- * Default: none
236
- * Valid values: A hexadecimal color
237
- *
238
- * @var string
239
- * @since 2.0
240
- */
241
- public $link_border_color;
242
-
243
- /**
244
- * If links should be decorated with underline decoration in their hover state
245
- * Default: default
246
- * Valid values: yes, no, default
247
- *
248
- * @var string
249
- * @since 2.0
250
- */
251
- public $hover_underline;
252
-
253
- /**
254
- * If links should be styled as bold in their hover state
255
- * Default: default
256
- * Valid values: yes, no, default
257
- *
258
- * @var string
259
- * @since 2.0
260
- */
261
- public $hover_bold;
262
-
263
- /**
264
- * If links should be styled as italic in their hover state
265
- * Default: default
266
- * Valid values: yes, no, default
267
- *
268
- * @var string
269
- * @since 2.0
270
- */
271
- public $hover_italic;
272
-
273
- /**
274
- * Background color for links in their hover state
275
- * Default: transparent
276
- * Valid values: A hexadecimal color
277
- *
278
- * @var string
279
- * @since 2.0
280
- */
281
- public $hover_bg_color;
282
-
283
- /**
284
- * Text color for links in their hover state
285
- * Default: default
286
- * Valid values: A hexadecimal color
287
- *
288
- * @var string
289
- * @since 2.0
290
- */
291
- public $hover_color;
292
-
293
- /**
294
- * Border style for links in their hover state
295
- * Default: none
296
- * Valid values: none, dotted, dashed, solid, double, groove, ridge, inset, outset
297
- *
298
- * @var string
299
- * @since 2.0
300
- */
301
- public $hover_border_style;
302
-
303
- /**
304
- * Border width for links in their hover state
305
- * Default: 0
306
- *
307
- * @var string
308
- * @since 2.0
309
- */
310
- public $hover_border_width;
311
-
312
- /**
313
- * Border color for links in their hover state
314
- * Default: none
315
- * Valid values: A hexadecimal color
316
- *
317
- * @var string
318
- * @since 2.0
319
- */
320
- public $hover_border_color;
321
-
322
- /**
323
- * CSS margin between tags
324
- * Default: auto
325
- *
326
- * @var string
327
- * @since 2.0
328
- */
329
- public $tag_spacing;
330
-
331
- /**
332
- * If debug output should be included
333
- * Default: false
334
- *
335
- * @var bool
336
- * @since 2.0
337
- */
338
- public $debug;
339
-
340
- /**
341
- * How many days old a post needs to be to be included in tag size calculation
342
- * Default: 0
343
- *
344
- * @var int
345
- * @since 2.0
346
- */
347
- public $days_old;
348
-
349
- /**
350
- * CSS line-height for the tags
351
- * Default: inherit
352
- *
353
- * @var string
354
- * @since 2.0
355
- */
356
- public $line_height;
357
-
358
- /**
359
- * Separator between tags
360
- * Default: (a space character)
361
- *
362
- * @var string
363
- * @since 2.0
364
- */
365
- public $separator;
366
-
367
- /**
368
- * Prefix before each tag
369
- * Default: (empty string)
370
- *
371
- * @var string
372
- * @since 2.0
373
- */
374
- public $prefix;
375
-
376
- /**
377
- * Suffix after each tag
378
- * Default: (empty string)
379
- *
380
- * @var string
381
- * @since 2.0
382
- */
383
- public $suffix;
384
-
385
- /**
386
- * If the widget title should be shown
387
- * Default: true
388
- *
389
- * @var bool
390
- * @since 2.0
391
- */
392
- public $show_title_text;
393
-
394
- /**
395
- * An array of post type names to to include posts from in tag size calculation
396
- * Default: [ post ]
397
- *
398
- * @var array
399
- * @since 2.0
400
- */
401
- public $post_type;
402
-
403
- /**
404
- * A list of term IDs to be included or excluded. Inclusion or exclusion is determined by $tags_list_type
405
- * Default: [] (an empty array)
406
- *
407
- * @var array
408
- * @since 2.0
409
- */
410
- public $tags_list;
411
-
412
- /**
413
- * Which color value to start from in color calculation. This is the color that the smallest tag will get.
414
- * Default: (an empty string)
415
- *
416
- * @var string
417
- * @since 2.0
418
- */
419
- public $color_span_to;
420
-
421
- /**
422
- * Which color value to end at in color calculation. This is the color that the biggest tag will get.
423
- * Default: (an empty string)
424
- *
425
- * @var string
426
- * @since 2.0
427
- */
428
- public $color_span_from;
429
-
430
- /**
431
- * Which authors to include posts from. An empty array will include all authors
432
- * Default: [] (an empty array)
433
- *
434
- * @var array
435
- * @since 2.0
436
- */
437
- public $authors;
438
-
439
- /**
440
- * A set of colors to randomly select from when coloring the tags
441
- * Default: [] (an empty array)
442
- *
443
- * @var array
444
- * @since 2.0
445
- */
446
- public $color_set;
447
-
448
- /**
449
- * If the current user is authenticated. Will be set internally
450
- *
451
- * @internal
452
- * @var bool
453
- * @since 2.0
454
- */
455
- public $authenticated;
456
-
457
- /**
458
- * Text to display before the widget.
459
- * The default value for this setting will probably be determined by the theme
460
- * Default: (an empty string)
461
- *
462
- * @var string
463
- * @since 2.0
464
- */
465
- public $before_widget;
466
-
467
- /**
468
- * Text to display after the widget.
469
- * The default value for this setting will probably be determined by the theme
470
- * Default: (an empty string)
471
- *
472
- * @var string
473
- * @since 2.0
474
- */
475
- public $after_widget;
476
-
477
- /**
478
- * Text to display before the widget title.
479
- * The default value for this setting will probably be determined by the theme
480
- * Default: (an empty string)
481
- *
482
- * @var string
483
- * @since 2.0
484
- */
485
- public $before_title;
486
-
487
- /**
488
- * Text to display after the widget title.
489
- * The default value for this setting will probably be determined by the theme
490
- * Default: (an empty string)
491
- *
492
- * @var string
493
- * @since 2.0
494
- */
495
- public $after_title;
496
-
497
- /**
498
- * Which strategy to use when selecting tags
499
- * Default: popularity
500
- *
501
- * @var string
502
- * @since 2.2
503
- */
504
- public $strategy;
505
-
506
- /**
507
- * Config store with default values
508
- *
509
- * @static
510
- * @var array
511
- * @since 2.0
512
- */
513
- static protected $options = array(
514
- 'title' => 'Tag Cloud',
515
- 'order' => 'name',
516
- 'size_from' => '10px',
517
- 'size_to' => '30px',
518
- 'max' => 45,
519
- 'taxonomy' => array('post_tag'),
520
- 'reverse' => false,
521
- 'color' => 'none',
522
- 'letter_spacing' => 'normal',
523
- 'word_spacing' => 'normal',
524
- 'text_transform' => 'none',
525
- 'case_sensitive' => false,
526
- 'minimum' => 1,
527
- 'tags_list_type' => 'exclude',
528
- 'show_title' => true,
529
- 'show_links' => true,
530
- 'link_underline' => 'default',
531
- 'link_bold' => 'default',
532
- 'link_italic' => 'default',
533
- 'link_bg_color' => 'transparent',
534
- 'link_border_style' => 'none',
535
- 'link_border_width' => '0',
536
- 'link_border_color' => 'none',
537
- 'hover_underline' => 'default',
538
- 'hover_bold' => 'default',
539
- 'hover_italic' => 'default',
540
- 'hover_bg_color' => 'transparent',
541
- 'hover_color' => 'default',
542
- 'hover_border_style' => 'none',
543
- 'hover_border_width' => '0',
544
- 'hover_border_color' => 'none',
545
- 'tag_spacing' => 'auto',
546
- 'debug' => false,
547
- 'days_old' => 0,
548
- 'line_height' => 'inherit',
549
- 'separator' => ' ',
550
- 'prefix' => '',
551
- 'suffix' => '',
552
- 'show_title_text' => true,
553
- 'post_type' => array('post'),
554
- 'tags_list' => array(),
555
- 'color_span_to' => '',
556
- 'color_span_from' => '',
557
- 'authors' => array(),
558
- 'color_set' => array(),
559
- 'before_widget' => '',
560
- 'after_widget' => '',
561
- 'before_title' => '',
562
- 'after_title' => '',
563
- 'strategy' => 'popularity'
564
- );
565
-
566
- /**
567
- * Which ordering strategies are allowed
568
- *
569
- * @var array
570
- * @since 2.0
571
- */
572
- protected $allowed_orders = array('random', 'name', 'slug', 'id', 'color', 'count');
573
-
574
- /**
575
- * Which taxonomies are allowed. Will be set dynamically at load
576
- *
577
- * @var array
578
- * @since 2.0
579
- */
580
- protected $allowed_taxonomies = array();
581
-
582
- /**
583
- * Which post types are allowed. Will be set dynamically at load
584
- *
585
- * @var array
586
- * @since 2.0
587
- */
588
- protected $allowed_post_types = array();
589
-
590
- /**
591
- * Which coloring strategies are allowed
592
- *
593
- * @var array
594
- * @since 2.0
595
- */
596
- protected $allowed_colors = array('none', 'random', 'set', 'span');
597
-
598
- /**
599
- * Which CSS text-transform values are allowed
600
- *
601
- * @var array
602
- * @since 2.0
603
- */
604
- protected $allowed_text_transforms = array('lowercase', 'uppercase', 'capitalize');
605
-
606
- /**
607
- * Which tags_list_type values are allowed
608
- *
609
- * @var array
610
- * @since 2.0
611
- */
612
- protected $allowed_tags_list_types = array('exclude', 'include');
613
-
614
- /**
615
- * Which values are allowed for optional booleans.
616
- * These are values which can be true, false or fallback to theme default (where applicable)
617
- *
618
- * @var array
619
- * @since 2.0
620
- */
621
- protected $allowed_optional_booleans = array('yes', 'no', 'default');
622
-
623
- /**
624
- * Which CSS border-style values are allowed
625
- *
626
- * @var array
627
- * @since 2.0
628
- */
629
- protected $allowed_border_styles = array(
630
- 'none',
631
- 'dotted',
632
- 'dashed',
633
- 'solid',
634
- 'double',
635
- 'groove',
636
- 'ridge',
637
- 'inset',
638
- 'outset',
639
- );
640
-
641
- /**
642
- * Which strategies are allowed
643
- *
644
- * @var array
645
- * @since 2.2
646
- */
647
- protected $allowed_strategies = array('popularity', 'random');
648
-
649
- /**
650
- * Loads a configuration instance array and parses the options
651
- *
652
- * @param array $input Array of key => value pairs of settings and values
653
- * @param UTCW_Plugin $plugin Reference to the main plugin instance
654
- *
655
- * @since 2.0
656
- */
657
- public function __construct(array $input, UTCW_Plugin $plugin)
658
- {
659
- $this->allowed_post_types = $plugin->getAllowedPostTypes();
660
- $this->allowed_taxonomies = $plugin->getAllowedTaxonomies();
661
- $this->authenticated = $plugin->isAuthenticatedUser();
662
-
663
- foreach (self::$options as $key => $default) {
664
- $this->$key = $default;
665
-
666
- if (isset($input[$key])) {
667
- $valid = true;
668
-
669
- switch ($key) {
670
- case 'strategy':
671
- $valid = in_array($input[$key], $this->allowed_strategies);
672
- break;
673
- case 'order':
674
- $valid = in_array($input[$key], $this->allowed_orders);
675
- break;
676
- case 'text_transform':
677
- $valid = in_array($input[$key], $this->allowed_text_transforms);
678
- break;
679
- case 'tags_list_type':
680
- $valid = in_array($input[$key], $this->allowed_tags_list_types);
681
- break;
682
- // Optional booleans, can be yes, no or default
683
- case 'link_underline':
684
- case 'link_bold':
685
- case 'link_italic':
686
- case 'hover_underline':
687
- case 'hover_bold':
688
- case 'hover_italic':
689
- $valid = in_array($input[$key], $this->allowed_optional_booleans);
690
- break;
691
- case 'link_border_style':
692
- case 'hover_border_style':
693
- $valid = in_array($input[$key], $this->allowed_border_styles);
694
- break;
695
- case 'color':
696
- $valid = in_array($input[$key], $this->allowed_colors);
697
- break;
698
- // TODO: Allow more flexibility in color setting, like rgb/rgba/hsl/hsla and named colors
699
- case 'link_bg_color':
700
- case 'link_border_color':
701
- case 'hover_bg_color':
702
- case 'hover_color':
703
- case 'hover_border_color':
704
- case 'color_span_to':
705
- case 'color_span_from':
706
- $valid = preg_match(UTCW_HEX_COLOR_REGEX, $input[$key]) > 0;
707
- break;
708
- case 'color_set':
709
- if (!is_array($input[$key])) {
710
- $input[$key] = explode(',', $input[$key]);
711
- }
712
-
713
- $valid = $input[$key] && array_filter(
714
- $input[$key],
715
- create_function('$item', 'return preg_match( UTCW_HEX_COLOR_REGEX, $item );')
716
- ) == $input[$key];
717
- break;
718
- case 'taxonomy':
719
- if (!is_array($input[$key])) {
720
- $input[$key] = explode(',', $input[$key]);
721
- }
722
-
723
- // Remove invalid taxonomies
724
- foreach ($input[$key] as $tax_key => $taxonomy) {
725
- if (!in_array($taxonomy, $this->allowed_taxonomies)) {
726
- unset($input[$key][$tax_key]);
727
- }
728
- }
729
-
730
- $valid = !!$input[$key]; // Setting is valid if any of the taxonomies were valid
731
- break;
732
- case 'post_type':
733
- if (!is_array($input[$key])) {
734
- $input[$key] = explode(',', $input[$key]);
735
- }
736
-
737
- $valid = $input[$key] && count(
738
- array_intersect($this->allowed_post_types, $input[$key])
739
- ) == count($input[$key]);
740
- break;
741
- case 'authors':
742
- case 'tags_list':
743
- if (!is_array($input[$key])) {
744
- $input[$key] = explode(',', $input[$key]);
745
- }
746
-
747
- $valid = $this->isArrayNumeric($input[$key]);
748
- $input[$key] = array_map('intval', $input[$key]);
749
- break;
750
- case 'size_from':
751
- $input['size_from'] = $this->parseMeasurement($input['size_from']);
752
-
753
- $size_to = isset($input['size_to']) ? $input['size_to'] : self::$options['size_to'];
754
- $valid = $input['size_from'] !== false && $this->equalUnits(
755
- $input['size_from'],
756
- $size_to
757
- ) && floatval($input['size_from']) <= floatval($size_to);
758
- break;
759
- case 'size_to':
760
- $input['size_to'] = $this->parseMeasurement($input['size_to']);
761
-
762
- $size_from = isset($input['size_from']) ? $input['size_from'] : self::$options['size_from'];
763
- $valid = $input['size_to'] !== false && $this->equalUnits(
764
- $size_from,
765
- $input['size_to']
766
- ) && floatval($input['size_to']) >= floatval($size_from);
767
- break;
768
- case 'letter_spacing':
769
- case 'word_spacing':
770
- case 'tag_spacing':
771
- case 'line_height':
772
- case 'link_border_width':
773
- case 'hover_border_width':
774
- $input[$key] = $this->parseMeasurement($input[$key]);
775
- $valid = $input[$key] !== false;
776
- break;
777
- }
778
-
779
- if (!$valid) {
780
- continue;
781
- }
782
-
783
- // Special handling of the color_set config attribute which needs to be expanded to full 6 digit values
784
- if ($key == 'color_set') {
785
- foreach ($input[$key] as $cs_key => $color) {
786
- if (strlen($color) == 4) {
787
- $red = substr($color, 1, 1);
788
- $green = substr($color, 2, 1);
789
- $blue = substr($color, 3, 1);
790
- $input[$key][$cs_key] = sprintf('#%s%s%s%s%s%s', $red, $red, $green, $green, $blue, $blue);
791
- }
792
- }
793
- $this->$key = $input[$key];
794
- } elseif ($key == 'minimum') {
795
- $this->$key = intval($input[$key]);
796
- } elseif (is_string(self::$options[$key]) && is_string($input[$key]) && strlen($input[$key]) > 0) {
797
- $this->$key = $input[$key];
798
- } elseif (is_integer(self::$options[$key]) && $input[$key] > 0) {
799
- $this->$key = intval($input[$key]);
800
- } elseif (is_bool(self::$options[$key])) {
801
- $this->$key = !!$input[$key];
802
- } elseif (is_array(self::$options[$key])) {
803
- $this->$key = is_array($input[$key]) ? $input[$key] : explode(
804
- ',',
805
- $input[$key]
806
- );
807
- }
808
- }
809
- }
810
- }
811
-
812
- /**
813
- * Checks if every item in the array is numeric
814
- *
815
- * @param array $array
816
- *
817
- * @return bool
818
- * @since 2.0
819
- */
820
- private function isArrayNumeric(array $array)
821
- {
822
- foreach ($array as $item) {
823
- if (!is_numeric($item)) {
824
- return false;
825
- }
826
- }
827
-
828
- return true;
829
- }
830
-
831
- /**
832
- * Parses the input value as measurement
833
- *
834
- * @param mixed $input
835
- *
836
- * @return bool|string False on failure
837
- * @since 2.1
838
- */
839
- private function parseMeasurement($input)
840
- {
841
- if (!preg_match('/^' . UTCW_DECIMAL_REGEX . '(em|px|%)?$/i', $input)) {
842
- return false;
843
- }
844
-
845
- // Convert integer values to pixel values
846
- if (preg_match('/^' . UTCW_DECIMAL_REGEX . '$/', $input)) {
847
- return $input . 'px';
848
- }
849
-
850
- return $input;
851
- }
852
-
853
- /**
854
- * Checks if the two measurements have the same unit
855
- *
856
- * @param string $measurement1
857
- * @param string $measurement2
858
- *
859
- * @return bool
860
- * @since 2.1
861
- */
862
- private function equalUnits($measurement1, $measurement2)
863
- {
864
- $unit1 = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $measurement1);
865
- $unit2 = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $measurement2);
866
-
867
- return $unit1 === $unit2 || ($unit1 === 'px' && $unit2 === '') || ($unit1 === '' && $unit2 === 'px');
868
- }
869
-
870
- /**
871
- * Returns an array of current configuration
872
- *
873
- * @return array
874
- * @since 2.0
875
- */
876
- public function getInstance()
877
- {
878
- $instance = array();
879
-
880
- foreach (array_keys(self::$options) as $key) {
881
- $instance[$key] = $this->$key;
882
- }
883
-
884
- return $instance;
885
- }
886
-
887
- /**
888
- * Returns the default values for all the configuration options
889
- *
890
- * @static
891
- * @return array
892
- * @since 2.0
893
- */
894
- public static function getDefaults()
895
- {
896
- return self::$options;
897
- }
898
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/Config/Config.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Abstract base class to represent a set of configuration options
15
+ *
16
+ * @since 2.3
17
+ */
18
+ abstract class UTCW_Config
19
+ {
20
+ /**
21
+ * The validated configuration option values
22
+ *
23
+ * @var array
24
+ * @since 2.3
25
+ */
26
+ protected $data = array();
27
+
28
+ /**
29
+ * A set of configuration options
30
+ *
31
+ * @var UTCW_Type[]
32
+ * @since 2.3
33
+ */
34
+ protected $options = array();
35
+
36
+ /**
37
+ * Validates the input and instantiates an object with the parsed input
38
+ *
39
+ * @param array $input
40
+ * @param UTCW_Plugin $plugin
41
+ */
42
+ public function __construct(array $input, UTCW_Plugin $plugin)
43
+ {
44
+ $this->_validate($input);
45
+ }
46
+
47
+ /**
48
+ * Add a new configuration option
49
+ *
50
+ * @param string $name
51
+ * @param string $type
52
+ * @param array $options
53
+ *
54
+ * @throws Exception
55
+ * @since 2.3
56
+ */
57
+ protected function addOption($name, $type, $options = array())
58
+ {
59
+ $typeClass = sprintf('UTCW_%sType', ucfirst($type));
60
+
61
+ if (!class_exists($typeClass)) {
62
+ throw new Exception('Unknown type ' . $type);
63
+ }
64
+
65
+ $this->options[$name] = new $typeClass($options);
66
+ }
67
+
68
+ /**
69
+ * Parses the input array, validates and normalizes all the values
70
+ *
71
+ * @param array $input
72
+ *
73
+ * @since 2.3
74
+ */
75
+ protected function _validate(array $input)
76
+ {
77
+ foreach ($this->options as $name => $type) {
78
+
79
+ $value = isset($input[$name]) ? $input[$name] : false;
80
+
81
+ if (isset($input[$name]) && $type->validate($value)) {
82
+ $this->data[$name] = $type->normalize($value);
83
+ } else {
84
+ $this->data[$name] = $type->getDefaultValue();
85
+ }
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Magic method to the return the value of a configuration option
91
+ *
92
+ * @param $name
93
+ *
94
+ * @return mixed
95
+ * @throws Exception
96
+ * @since 2.3
97
+ */
98
+ public function __get($name)
99
+ {
100
+ if (!isset($this->data[$name])) {
101
+ throw new Exception('Invalid configuration option ' . $name);
102
+ }
103
+
104
+ return $this->data[$name];
105
+ }
106
+
107
+ /**
108
+ * Returns the configuration option values
109
+ *
110
+ * @return array
111
+ * @since 2.3
112
+ */
113
+ public function getInstance()
114
+ {
115
+ return $this->data;
116
+ }
117
+ }
src/Config/DataConfig.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Class to represent a the configuration options for data retrieval
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
+ {
40
+ /**
41
+ * Creates a new instance of the class and adds all the options
42
+ *
43
+ * @param array $input
44
+ * @param UTCW_Plugin $plugin
45
+ *
46
+ * @since 2.3
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')));
54
+ $this->addOption('color_span_to', 'color', array('default' => ''));
55
+ $this->addOption('color_span_from', 'color', array('default' => ''));
56
+ $this->addOption('color_set', 'array', array('type' => 'color'));
57
+ $this->addOption(
58
+ 'taxonomy',
59
+ 'array',
60
+ array(
61
+ 'type' => 'set',
62
+ 'typeOptions' => array('values' => $plugin->getAllowedTaxonomies()),
63
+ 'default' => array('post_tag')
64
+ )
65
+ );
66
+ $this->addOption(
67
+ 'post_type',
68
+ 'array',
69
+ array(
70
+ 'type' => 'set',
71
+ 'typeOptions' => array('values' => $plugin->getAllowedPostTypes()),
72
+ 'default' => array('post')
73
+ )
74
+ );
75
+
76
+ $this->addOption('authors', 'array', array('type' => 'integer'));
77
+ $this->addOption('tags_list', 'array', array('type' => 'integer'));
78
+ $this->addOption('post_term', 'array', array('type' => 'integer'));
79
+
80
+ $this->addOption('size_from', 'measurement', array('default' => '10px'));
81
+ $this->addOption('size_to', 'measurement', array('default' => '30px'));
82
+
83
+ $this->addOption('max', 'integer', array('default' => 45, 'min' => 1));
84
+ $this->addOption('minimum', 'integer', array('default' => 1));
85
+ $this->addOption('days_old', 'integer');
86
+
87
+ $this->addOption('reverse', 'boolean');
88
+ $this->addOption('case_sensitive', 'boolean');
89
+
90
+ parent::__construct($input, $plugin);
91
+
92
+ $this->checkSizes();
93
+ }
94
+
95
+ /**
96
+ * Checks if size_from and size_to have correct values, and reverts to defaults if they don't
97
+ *
98
+ * @since 2.3
99
+ */
100
+ protected function checkSizes()
101
+ {
102
+ $size_from = $this->__get('size_from');
103
+ $size_to = $this->__get('size_to');
104
+
105
+ $unit1 = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $size_from);
106
+ $unit2 = preg_replace('/' . UTCW_DECIMAL_REGEX . '/', '', $size_to);
107
+
108
+ $unitsEqual = $unit1 === $unit2 || ($unit1 === 'px' && $unit2 === '') || ($unit1 === '' && $unit2 === 'px');
109
+ $rangeOk = floatval($size_from) <= floatval($size_to);
110
+
111
+ $valid = $unitsEqual && $rangeOk;
112
+
113
+ if (!$valid) {
114
+ $this->data['size_from'] = $this->options['size_from']->getDefaultValue();
115
+ $this->data['size_to'] = $this->options['size_to']->getDefaultValue();
116
+ }
117
+ }
118
+ }
src/Config/RenderConfig.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Class to represent a the configuration options for cloud rendering retrieval
15
+ *
16
+ * @since 2.3
17
+ * @property-read string title Title text of the widget
18
+ * @property-read string letter_spacing CSS letter-spacing value (in pixels)
19
+ * @property-read string word_spacing CSS word-spacing value (in pixels)
20
+ * @property-read string text_transform CSS text-transform value
21
+ * @property-read string show_title If the title attribute should be added to links in the cloud
22
+ * @property-read string show_links If the tags should be wrapped in links
23
+ * @property-read string link_underline If links should be styled with underline decoration
24
+ * @property-read string link_bold If links should be styled as bold
25
+ * @property-read string link_italic If links should be styled as italic
26
+ * @property-read string link_bg_color Background color for links
27
+ * @property-read string link_border_style Border style for links
28
+ * @property-read string link_border_width Border width for links
29
+ * @property-read string link_border_color Border color for links
30
+ * @property-read string hover_underline If links should be decorated with underline decoration in their hover state
31
+ * @property-read string hover_bold If links should be styled as bold in their hover state
32
+ * @property-read string hover_italic If links should be styled as italic in their hover state
33
+ * @property-read string hover_bg_color Background color for links in their hover state
34
+ * @property-read string hover_color Text color for links in their hover state
35
+ * @property-read string hover_border_style Border style for links in their hover state
36
+ * @property-read string hover_border_width Border width for links in their hover state
37
+ * @property-read string hover_border_color Border color for links in their hover state
38
+ * @property-read string tag_spacing CSS margin between tags
39
+ * @property-read bool debug If debug output should be included
40
+ * @property-read string line_height CSS line-height for the tags
41
+ * @property-read string separator Separator between tags
42
+ * @property-read string prefix Prefix before each tag
43
+ * @property-read string suffix Suffix after each tag
44
+ * @property-read bool show_title_text If the widget title should be shown
45
+ * @property-read string alignment How the text in the resulting cloud should be aligned
46
+ * @property-read string display How the resulting cloud should be displayed
47
+ * @property-read string before_widget @internal
48
+ * @property-read string after_widget @internal
49
+ * @property-read string before_title @internal
50
+ * @property-read string after_title @internal
51
+ */
52
+
53
+ class UTCW_RenderConfig extends UTCW_Config
54
+ {
55
+ /**
56
+ * Valid values for optional boolean set
57
+ *
58
+ * @var array
59
+ * @since 2.3
60
+ */
61
+ protected $optionalBooleanValues = array('default', 'yes', 'no');
62
+
63
+ /**
64
+ * Valid values for border style set
65
+ *
66
+ * @var array
67
+ * @since 2.3
68
+ */
69
+ protected $borderStyleValues = array(
70
+ 'none',
71
+ 'dotted',
72
+ 'dashed',
73
+ 'solid',
74
+ 'double',
75
+ 'groove',
76
+ 'ridge',
77
+ 'inset',
78
+ 'outset'
79
+ );
80
+
81
+ /**
82
+ * Valid values for alignment set
83
+ *
84
+ * @var array
85
+ * @since 2.3
86
+ */
87
+ protected $alignmentValues = array(
88
+ 'left',
89
+ 'right',
90
+ 'center',
91
+ 'justify',
92
+ );
93
+
94
+ /**
95
+ * Valid values for display set
96
+ *
97
+ * @var array
98
+ * @since 2.3
99
+ */
100
+ protected $displayValues = array('inline', 'list');
101
+
102
+ /**
103
+ * Creates a new instance of the class and adds all the options
104
+ *
105
+ * @param array $input
106
+ * @param UTCW_Plugin $plugin
107
+ *
108
+ * @since 2.3
109
+ */
110
+ public function __construct(array $input, UTCW_Plugin $plugin)
111
+ {
112
+ $this->addOption(
113
+ 'text_transform',
114
+ 'set',
115
+ array(
116
+ 'values' => array('lowercase', 'uppercase', 'capitalize'),
117
+ 'default' => 'none'
118
+ )
119
+ );
120
+
121
+ $this->addOption('link_underline', 'set', array('values' => $this->optionalBooleanValues));
122
+ $this->addOption('link_bold', 'set', array('values' => $this->optionalBooleanValues));
123
+ $this->addOption('link_italic', 'set', array('values' => $this->optionalBooleanValues));
124
+ $this->addOption('hover_underline', 'set', array('values' => $this->optionalBooleanValues));
125
+ $this->addOption('hover_bold', 'set', array('values' => $this->optionalBooleanValues));
126
+ $this->addOption('hover_italic', 'set', array('values' => $this->optionalBooleanValues));
127
+
128
+ $this->addOption('link_border_style', 'set', array('values' => $this->borderStyleValues));
129
+ $this->addOption('hover_border_style', 'set', array('values' => $this->borderStyleValues));
130
+ $this->addOption('alignment', 'set', array('values' => $this->alignmentValues, 'default' => ''));
131
+ $this->addOption('display', 'set', array('values' => $this->displayValues));
132
+
133
+ $this->addOption('link_bg_color', 'color');
134
+ $this->addOption('hover_bg_color', 'color');
135
+ $this->addOption('link_border_color', 'color', array('default' => 'none'));
136
+ $this->addOption('hover_color', 'color', array('default' => 'default'));
137
+ $this->addOption('hover_border_color', 'color', array('default' => 'none'));
138
+
139
+ $this->addOption('letter_spacing', 'measurement', array('default' => 'normal'));
140
+ $this->addOption('word_spacing', 'measurement', array('default' => 'normal'));
141
+ $this->addOption('tag_spacing', 'measurement', array('default' => 'auto'));
142
+ $this->addOption('line_height', 'measurement', array('default' => 'inherit'));
143
+ $this->addOption('link_border_width', 'measurement');
144
+ $this->addOption('hover_border_width', 'measurement');
145
+
146
+ $this->addOption('title', 'string', array('default' => 'Tag Cloud'));
147
+ $this->addOption('separator', 'string', array('default' => ' '));
148
+ $this->addOption('prefix', 'string');
149
+ $this->addOption('suffix', 'string');
150
+ $this->addOption('before_widget', 'string');
151
+ $this->addOption('after_widget', 'string');
152
+ $this->addOption('before_title', 'string');
153
+ $this->addOption('after_title', 'string');
154
+
155
+ $this->addOption('show_title', 'boolean', array('default' => true));
156
+ $this->addOption('show_links', 'boolean', array('default' => true));
157
+ $this->addOption('show_title_text', 'boolean', array('default' => true));
158
+ $this->addOption('debug', 'boolean');
159
+
160
+ parent::__construct($input, $plugin);
161
+ }
162
+ }
src/Config/Type/ArrayType.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Array type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_ArrayType extends UTCW_Type
19
+ {
20
+
21
+ /**
22
+ * Which type of option this array contains
23
+ *
24
+ * @var UTCW_Type
25
+ * @since 2.3
26
+ */
27
+ protected $type;
28
+
29
+ /**
30
+ * Creates a new ArrayType instance
31
+ *
32
+ * @param array $options
33
+ *
34
+ * @since 2.3
35
+ * @throws Exception
36
+ */
37
+ public function __construct(array $options)
38
+ {
39
+ if (!isset($options['type'])) {
40
+ throw new Exception('Array type needs configuration option type');
41
+ }
42
+
43
+ $typeClass = sprintf('UTCW_%sType', ucfirst($options['type']));
44
+
45
+ if (!class_exists($typeClass)) {
46
+ throw new Exception('Unknown array type type ' . $options['type']);
47
+ }
48
+
49
+ $typeOptions = isset($options['typeOptions']) ? $options['typeOptions'] : array();
50
+ $this->type = new $typeClass($typeOptions);
51
+
52
+ unset($options['typeOptions']);
53
+ unset($options['type']);
54
+
55
+ parent::__construct($options);
56
+ }
57
+
58
+ /**
59
+ * Validates each item in the array with the given type
60
+ *
61
+ * @param string|array $value
62
+ *
63
+ * @return bool
64
+ * @since 2.3
65
+ */
66
+ function validate($value)
67
+ {
68
+ if (!is_array($value)) {
69
+ $value = explode(',', $value);
70
+ }
71
+
72
+ // Invalidate empty arrays and let the default value return an empty array if it's allowed
73
+ if (!$value) {
74
+ return false;
75
+ }
76
+
77
+ foreach ($value as $item) {
78
+ if (!$this->type->validate($item)) {
79
+ return false;
80
+ }
81
+ }
82
+
83
+ return true;
84
+ }
85
+
86
+ /**
87
+ * Normalizes each item in the array with the given type
88
+ *
89
+ * @param string|array $value
90
+ *
91
+ * @return array
92
+ * @since 2.3
93
+ */
94
+ public function normalize($value)
95
+ {
96
+ if (!is_array($value)) {
97
+ $value = explode(',', $value);
98
+ }
99
+
100
+ $value = array_map(array($this->type, 'normalize'), $value);
101
+
102
+ return $value;
103
+ }
104
+
105
+ /**
106
+ * Returns an empty array if a default value is not given
107
+ *
108
+ * @return array
109
+ * @since 2.3
110
+ */
111
+ function getDefaultValue()
112
+ {
113
+ if (isset($this->options['default'])) {
114
+ return $this->options['default'];
115
+ }
116
+
117
+ return array();
118
+ }
119
+ }
src/Config/Type/BooleanType.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Boolean type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_BooleanType extends UTCW_Type
19
+ {
20
+ /**
21
+ * Validates the input as a boolean
22
+ *
23
+ * @param mixed $value
24
+ *
25
+ * @return bool
26
+ * @since 2.3
27
+ */
28
+ function validate($value)
29
+ {
30
+ return true; // Everything can be parsed as a boolean
31
+ }
32
+
33
+ /**
34
+ * Normalizes the value into a boolean
35
+ *
36
+ * @param mixed $value
37
+ *
38
+ * @return bool
39
+ * @since 2.3
40
+ */
41
+ public function normalize($value)
42
+ {
43
+ return !!$value;
44
+ }
45
+
46
+ /**
47
+ * Returns false if a default value is not given
48
+ *
49
+ * @return bool
50
+ * @since 2.3
51
+ */
52
+ function getDefaultValue()
53
+ {
54
+ if (isset($this->options['default'])) {
55
+ return $this->options['default'];
56
+ }
57
+
58
+ return false;
59
+ }
60
+ }
src/Config/Type/ColorType.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Color type configuration option
15
+ *
16
+ * @since 2.3
17
+ * @todo Allow more flexibility in color setting, like rgb/rgba/hsl/hsla and named colors
18
+ */
19
+ class UTCW_ColorType extends UTCW_Type
20
+ {
21
+ /**
22
+ * Validates the input as a color value
23
+ *
24
+ * @param mixed $value
25
+ *
26
+ * @return bool
27
+ * @since 2.3
28
+ */
29
+ function validate($value)
30
+ {
31
+ return preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $value) > 0;
32
+ }
33
+
34
+ /**
35
+ * Normalizes the input as a color value
36
+ *
37
+ * @param mixed $value
38
+ *
39
+ * @return string
40
+ * @since 2.3
41
+ */
42
+ public function normalize($value)
43
+ {
44
+ if (strlen($value) == 4) {
45
+ $red = substr($value, 1, 1);
46
+ $green = substr($value, 2, 1);
47
+ $blue = substr($value, 3, 1);
48
+
49
+ return sprintf('#%s%s%s%s%s%s', $red, $red, $green, $green, $blue, $blue);
50
+ }
51
+
52
+ return $value;
53
+ }
54
+
55
+ /**
56
+ * Returns transparent if a default value is not given
57
+ *
58
+ * @return string
59
+ * @since 2.3
60
+ */
61
+ function getDefaultValue()
62
+ {
63
+ if (isset($this->options['default'])) {
64
+ return $this->options['default'];
65
+ }
66
+
67
+ return 'transparent';
68
+ }
69
+ }
src/Config/Type/IntegerType.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Integer type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_IntegerType extends UTCW_Type
19
+ {
20
+
21
+ /**
22
+ * Validates the input value as a integer
23
+ *
24
+ * @param mixed $value
25
+ *
26
+ * @return bool
27
+ * @since 2.3
28
+ */
29
+ function validate($value)
30
+ {
31
+ if (!is_numeric($value)) {
32
+ return false;
33
+ }
34
+
35
+ if (isset($this->options['min']) && $value < $this->options['min']) {
36
+ return false;
37
+ }
38
+
39
+ if (isset($this->options['max']) && $value > $this->options['max']) {
40
+ return false;
41
+ }
42
+
43
+ return true;
44
+ }
45
+
46
+ /**
47
+ * Normalizes the input value into an integer
48
+ *
49
+ * @param mixed $value
50
+ *
51
+ * @return int
52
+ * @since 2.3
53
+ */
54
+ public function normalize($value)
55
+ {
56
+ return intval($value);
57
+ }
58
+
59
+ /**
60
+ * Returns zero if a default value is not given
61
+ *
62
+ * @return int
63
+ * @since 2.3
64
+ */
65
+ function getDefaultValue()
66
+ {
67
+ if (isset($this->options['default'])) {
68
+ return $this->options['default'];
69
+ }
70
+
71
+ return 0;
72
+ }
73
+ }
src/Config/Type/MeasurementType.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Measurement type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_MeasurementType extends UTCW_Type
19
+ {
20
+
21
+ /**
22
+ * Validates the input value as a measurement
23
+ *
24
+ * @param string|int|float $value
25
+ *
26
+ * @return bool
27
+ * @since 2.3
28
+ */
29
+ function validate($value)
30
+ {
31
+ return !!preg_match('/^' . UTCW_DECIMAL_REGEX . '(em|px|%)?$/i', $value);
32
+ }
33
+
34
+ /**
35
+ * Normalizes the input value as a measurement
36
+ *
37
+ * @param mixed $value
38
+ *
39
+ * @return string
40
+ * @since 2.3
41
+ */
42
+ public function normalize($value)
43
+ {
44
+ if (preg_match('/^' . UTCW_DECIMAL_REGEX . '$/', $value)) {
45
+ return $value . 'px';
46
+ }
47
+
48
+ return $value;
49
+ }
50
+
51
+ /**
52
+ * Returns zero if a default value is not given
53
+ *
54
+ * @return int|mixed
55
+ * @since 2.3
56
+ */
57
+ function getDefaultValue()
58
+ {
59
+ if (isset($this->options['default'])) {
60
+ return $this->options['default'];
61
+ }
62
+
63
+ return 0;
64
+ }
65
+ }
src/Config/Type/SetType.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Set type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_SetType extends UTCW_Type
19
+ {
20
+
21
+ /**
22
+ * Validates if the value is valid for the given set
23
+ *
24
+ * @param mixed $value
25
+ *
26
+ * @return bool
27
+ * @since 2.3
28
+ */
29
+ function validate($value)
30
+ {
31
+ if (!isset($this->options['values'])) {
32
+ return false;
33
+ }
34
+
35
+ if (!is_array($this->options['values'])) {
36
+ return false;
37
+ }
38
+
39
+ return in_array($value, $this->options['values']);
40
+ }
41
+
42
+ /**
43
+ * Returns the first value of the set if a default value is not given
44
+ *
45
+ * @return mixed
46
+ * @since 2.3
47
+ */
48
+ function getDefaultValue()
49
+ {
50
+ if (isset($this->options['default'])) {
51
+ return $this->options['default'];
52
+ }
53
+
54
+ if (isset($this->options['values']) && is_array($this->options['values']) && $this->options['values']) {
55
+ return $this->options['values'][0];
56
+ }
57
+
58
+ return '';
59
+ }
60
+ }
src/Config/Type/StringType.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * String type configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ class UTCW_StringType extends UTCW_Type
19
+ {
20
+
21
+ /**
22
+ * Validates the input value as a string
23
+ *
24
+ * @param mixed $value
25
+ *
26
+ *
27
+ * @return bool
28
+ * @since 2.3
29
+ */
30
+ function validate($value)
31
+ {
32
+ return is_string($value) && $value;
33
+ }
34
+
35
+ /**
36
+ * Returns an empty string if a default value is not given
37
+ *
38
+ * @return string
39
+ * @since 2.3
40
+ */
41
+ function getDefaultValue()
42
+ {
43
+ if (isset($this->options['default'])) {
44
+ return $this->options['default'];
45
+ }
46
+
47
+ return '';
48
+ }
49
+ }
src/Config/Type/Type.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ultimate Tag Cloud Widget
4
+ *
5
+ * @author Rickard Andersson <rickard@0x539.se>
6
+ * @version 2.3
7
+ * @license GPLv2
8
+ * @package utcw
9
+ * @subpackage config-type
10
+ * @since 2.3
11
+ */
12
+
13
+ /**
14
+ * Abstract base class to represent a type of configuration option
15
+ *
16
+ * @since 2.3
17
+ */
18
+ abstract class UTCW_Type
19
+ {
20
+ /**
21
+ * Contains type specific options
22
+ *
23
+ * @var array
24
+ * @since 2.3
25
+ */
26
+ protected $options;
27
+
28
+ /**
29
+ * Creates a new type instance
30
+ *
31
+ * @param array $options
32
+ *
33
+ * @since 2.3
34
+ */
35
+ public function __construct(array $options)
36
+ {
37
+ $this->options = $options;
38
+ }
39
+
40
+ /**
41
+ * Normalize configuration value
42
+ *
43
+ * @param mixed $value
44
+ *
45
+ * @return mixed
46
+ * @since 2.3
47
+ */
48
+ public function normalize($value)
49
+ {
50
+ return $value;
51
+ }
52
+
53
+ /**
54
+ * Returns true if the given value is valid for this type
55
+ *
56
+ * @param mixed $value
57
+ *
58
+ * @return bool
59
+ * @since 2.3
60
+ */
61
+ abstract function validate($value);
62
+
63
+ /**
64
+ * Returns the default value to be set when the value is missing or invalid
65
+ *
66
+ * @return mixed
67
+ * @since 2.3
68
+ */
69
+ abstract function getDefaultValue();
70
+ }
src/Data.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage main
@@ -61,27 +61,49 @@ class UTCW_Data
61
  */
62
  protected $strategy;
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Creates a new instance
66
  *
67
- * @param UTCW_Config $config Current configuration
68
- * @param UTCW_Plugin $plugin Main plugin instance
69
- * @param wpdb $db WordPress DB instance
70
  *
71
  * @since 2.0
72
  */
73
- public function __construct(UTCW_Config $config, UTCW_Plugin $plugin, wpdb $db)
74
  {
75
- $this->config = $config;
76
- $this->db = $db;
77
  $this->plugin = $plugin;
78
 
79
  switch ($this->config->strategy) {
80
  case 'popularity':
81
- $this->strategy = new UTCW_PopularityStrategy($this->config, $this->plugin, $this->db);
82
  break;
83
  case 'random':
84
- $this->strategy = new UTCW_RandomStrategy($this->config, $this->plugin, $this->db);
85
  break;
86
  }
87
  }
@@ -94,17 +116,17 @@ class UTCW_Data
94
  */
95
  public function getTerms()
96
  {
97
- $terms = array();
98
- $result = $this->strategy->getData();
99
 
100
  // Calculate sizes
101
  $min_count = PHP_INT_MAX;
102
  $max_count = 0;
103
 
104
  // Get translation handler if a translation plugin is active
105
- $translationHandler = $this->plugin->getTranslationHandler();
106
 
107
- foreach ($result as $item) {
108
  if ($item->count < $min_count) {
109
  $min_count = $item->count;
110
  }
@@ -113,16 +135,16 @@ class UTCW_Data
113
  $max_count = $item->count;
114
  }
115
 
116
- if ($translationHandler) {
117
 
118
  // Let the translation handler determine if the term should be included or not
119
- $term = $translationHandler->createTerm($item, $this->plugin);
120
 
121
  if ($term) {
122
- $terms[] = $term;
123
  }
124
  } else {
125
- $terms[] = new UTCW_Term($item, $this->plugin);
126
  }
127
  }
128
 
@@ -132,20 +154,20 @@ class UTCW_Data
132
 
133
  $font_step = $this->calcStep($min_count, $max_count, $size_from, $size_to);
134
 
135
- foreach ($terms as $term) {
136
  $term->size = $this->calcSize($size_from, $term->count, $min_count, $font_step) . $unit;
137
  }
138
 
139
  // Set colors
140
  switch ($this->config->color) {
141
  case 'random':
142
- foreach ($terms as $term) {
143
  $term->color = sprintf(UTCW_HEX_COLOR_FORMAT, rand() % 255, rand() % 255, rand() % 255);
144
  }
145
  break;
146
  case 'set':
147
  if ($this->config->color_set) {
148
- foreach ($terms as $term) {
149
  $term->color = $this->config->color_set[array_rand($this->config->color_set)];
150
  }
151
  }
@@ -166,7 +188,7 @@ class UTCW_Data
166
  $colors->blue_from = $blue_from;
167
  $colors->blue_to = $blue_to;
168
 
169
- foreach ($terms as $term) {
170
  $term->color = $this->calcColor($min_count, $max_count, $colors, $term->count);
171
  }
172
  }
@@ -182,10 +204,10 @@ class UTCW_Data
182
 
183
  $sort_fn = create_function($sort_fn_arguments, 'return strcmp( $a->color, $b->color );');
184
 
185
- usort($terms, $sort_fn);
186
  }
187
 
188
- return $terms;
189
  }
190
 
191
  /**
@@ -260,6 +282,7 @@ class UTCW_Data
260
  public function cleanupForDebug()
261
  {
262
  unset($this->db);
 
263
  $this->strategy->cleanupForDebug();
264
  }
265
  }
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage main
61
  */
62
  protected $strategy;
63
 
64
+ /**
65
+ * Reference to the translation handler used
66
+ *
67
+ * @var UTCW_TranslationHandler
68
+ * @since 2.3
69
+ */
70
+ protected $translationHandler;
71
+
72
+ /**
73
+ * Contains the created terms
74
+ *
75
+ * @var UTCW_Term[]
76
+ * @since 2.3
77
+ */
78
+ protected $terms;
79
+
80
+ /**
81
+ * Contains the result from loading the terms
82
+ *
83
+ * @var stdClass[]
84
+ * @since 2.3
85
+ */
86
+ protected $result;
87
+
88
  /**
89
  * Creates a new instance
90
  *
91
+ * @param UTCW_Plugin $plugin Main plugin instance
 
 
92
  *
93
  * @since 2.0
94
  */
95
+ public function __construct(UTCW_Plugin $plugin)
96
  {
97
+ $this->config = $plugin->get('dataConfig');
98
+ $this->db = $plugin->get('wpdb');
99
  $this->plugin = $plugin;
100
 
101
  switch ($this->config->strategy) {
102
  case 'popularity':
103
+ $this->strategy = new UTCW_PopularityStrategy($this->plugin);
104
  break;
105
  case 'random':
106
+ $this->strategy = new UTCW_RandomStrategy($this->plugin);
107
  break;
108
  }
109
  }
116
  */
117
  public function getTerms()
118
  {
119
+ $this->terms = array();
120
+ $this->result = $this->strategy->getData();
121
 
122
  // Calculate sizes
123
  $min_count = PHP_INT_MAX;
124
  $max_count = 0;
125
 
126
  // Get translation handler if a translation plugin is active
127
+ $this->translationHandler = $this->plugin->getTranslationHandler();
128
 
129
+ foreach ($this->result as $item) {
130
  if ($item->count < $min_count) {
131
  $min_count = $item->count;
132
  }
135
  $max_count = $item->count;
136
  }
137
 
138
+ if ($this->translationHandler) {
139
 
140
  // Let the translation handler determine if the term should be included or not
141
+ $term = $this->translationHandler->createTerm($item, $this->plugin);
142
 
143
  if ($term) {
144
+ $this->terms[] = $term;
145
  }
146
  } else {
147
+ $this->terms[] = new UTCW_Term($item, $this->plugin);
148
  }
149
  }
150
 
154
 
155
  $font_step = $this->calcStep($min_count, $max_count, $size_from, $size_to);
156
 
157
+ foreach ($this->terms as $term) {
158
  $term->size = $this->calcSize($size_from, $term->count, $min_count, $font_step) . $unit;
159
  }
160
 
161
  // Set colors
162
  switch ($this->config->color) {
163
  case 'random':
164
+ foreach ($this->terms as $term) {
165
  $term->color = sprintf(UTCW_HEX_COLOR_FORMAT, rand() % 255, rand() % 255, rand() % 255);
166
  }
167
  break;
168
  case 'set':
169
  if ($this->config->color_set) {
170
+ foreach ($this->terms as $term) {
171
  $term->color = $this->config->color_set[array_rand($this->config->color_set)];
172
  }
173
  }
188
  $colors->blue_from = $blue_from;
189
  $colors->blue_to = $blue_to;
190
 
191
+ foreach ($this->terms as $term) {
192
  $term->color = $this->calcColor($min_count, $max_count, $colors, $term->count);
193
  }
194
  }
204
 
205
  $sort_fn = create_function($sort_fn_arguments, 'return strcmp( $a->color, $b->color );');
206
 
207
+ usort($this->terms, $sort_fn);
208
  }
209
 
210
+ return $this->terms;
211
  }
212
 
213
  /**
282
  public function cleanupForDebug()
283
  {
284
  unset($this->db);
285
+ $this->plugin->remove('wpdb');
286
  $this->strategy->cleanupForDebug();
287
  }
288
  }
src/Database/QueryBuilder.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
@@ -37,14 +37,13 @@ class UTCW_QueryBuilder
37
  /**
38
  * Creates a new instance of the QueryBuilder
39
  *
40
- * @param UTCW_Plugin $plugin
41
- * @param wpdb $db
42
  *
43
  * @since 2.2
44
  */
45
- public function __construct(UTCW_Plugin $plugin, wpdb $db)
46
  {
47
- $this->db = $db;
48
  $this->plugin = $plugin;
49
  $this->query = $this->getBaseQuery();
50
  $this->parameters = array();
@@ -124,6 +123,31 @@ class UTCW_QueryBuilder
124
  }
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  /**
128
  * Add post type constraint
129
  *
@@ -218,9 +242,9 @@ class UTCW_QueryBuilder
218
  if ($tags_list_parameters) {
219
  $tags_list_operator = $type == 'include' ? 'IN' : 'NOT IN';
220
  $this->query[] = 'AND t.term_id ' . $tags_list_operator . ' (' . join(
221
- ',',
222
- $tags_list_parameters
223
- ) . ')';
224
  }
225
  }
226
  }
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
37
  /**
38
  * Creates a new instance of the QueryBuilder
39
  *
40
+ * @param UTCW_Plugin $plugin Main plugin instance
 
41
  *
42
  * @since 2.2
43
  */
44
+ public function __construct(UTCW_Plugin $plugin)
45
  {
46
+ $this->db = $plugin->get('wpdb');
47
  $this->plugin = $plugin;
48
  $this->query = $this->getBaseQuery();
49
  $this->parameters = array();
123
  }
124
  }
125
 
126
+ /**
127
+ * Add post term relationship constraint
128
+ *
129
+ * @param array $post_terms
130
+ *
131
+ * @since 2.3
132
+ */
133
+ public function addPostTermConstraint(array $post_terms)
134
+ {
135
+ if ($post_terms) {
136
+
137
+ $post_term_parameters = array();
138
+
139
+ foreach ($post_terms as $post_term) {
140
+ $post_term_parameters[] = '%d';
141
+ $this->parameters[] = $post_term;
142
+ }
143
+
144
+ $this->query[] = 'AND p.ID IN (SELECT _p.ID FROM wp_posts _p';
145
+ $this->query[] = 'JOIN wp_term_relationships AS _tr ON _tr.object_id = _p.ID';
146
+ $this->query[] = 'JOIN wp_term_taxonomy AS _tt ON _tt.term_taxonomy_id = _tr.term_taxonomy_id';
147
+ $this->query[] = 'WHERE _tt.term_id IN (' . join(',', $post_term_parameters) . '))';
148
+ }
149
+ }
150
+
151
  /**
152
  * Add post type constraint
153
  *
242
  if ($tags_list_parameters) {
243
  $tags_list_operator = $type == 'include' ? 'IN' : 'NOT IN';
244
  $this->query[] = 'AND t.term_id ' . $tags_list_operator . ' (' . join(
245
+ ',',
246
+ $tags_list_parameters
247
+ ) . ')';
248
  }
249
  }
250
  }
src/Language/QTranslateHandler.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
src/Language/TranslationHandler.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
src/Language/WPMLHandler.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
src/Plugin.php CHANGED
@@ -17,7 +17,7 @@
17
  * Ultimate Tag Cloud Widget
18
  *
19
  * @author Rickard Andersson <rickard@0x539.se>
20
- * @version 2.2.3
21
  * @license GPLv2
22
  * @package utcw
23
  * @subpackage main
@@ -42,6 +42,15 @@ class UTCW_Plugin
42
  */
43
  protected $allowed_post_types = array();
44
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Singleton instance
47
  *
@@ -61,9 +70,48 @@ class UTCW_Plugin
61
  add_action('admin_head-widgets.php', array($this, 'initAdminAssets'));
62
  add_action('wp_loaded', array($this, 'wpLoaded'));
63
  add_action('widgets_init', create_function('', 'return register_widget("UTCW_Widget");'));
 
64
  add_shortcode('utcw', array($this, 'shortcode'));
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Returns an instance of the plugin
69
  *
@@ -80,6 +128,22 @@ class UTCW_Plugin
80
  return self::$instance;
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  /**
84
  * Action handler for 'wpLoaded' hook
85
  * Loads taxonomies and post types
@@ -112,9 +176,12 @@ class UTCW_Plugin
112
  }
113
  }
114
 
115
- $config = new UTCW_Config($args, $this);
116
- $data = new UTCW_Data($config, $this, $wpdb);
117
- $render = new UTCW_Render($config, $data, $this);
 
 
 
118
 
119
  return $render->getCloud();
120
  }
17
  * Ultimate Tag Cloud Widget
18
  *
19
  * @author Rickard Andersson <rickard@0x539.se>
20
+ * @version 2.3
21
  * @license GPLv2
22
  * @package utcw
23
  * @subpackage main
42
  */
43
  protected $allowed_post_types = array();
44
 
45
+
46
+ /**
47
+ * An array of dependencies
48
+ *
49
+ * @var array
50
+ * @since 2.3
51
+ */
52
+ protected $container = array();
53
+
54
  /**
55
  * Singleton instance
56
  *
70
  add_action('admin_head-widgets.php', array($this, 'initAdminAssets'));
71
  add_action('wp_loaded', array($this, 'wpLoaded'));
72
  add_action('widgets_init', create_function('', 'return register_widget("UTCW_Widget");'));
73
+ add_action('wp_ajax_utcw_get_terms', array($this, 'getTermsJson'));
74
  add_shortcode('utcw', array($this, 'shortcode'));
75
  }
76
 
77
+ /**
78
+ * Set dependency in the container
79
+ *
80
+ * @param string $key
81
+ * @param mixed $value
82
+ *
83
+ * @since 2.3
84
+ */
85
+ public function set($key, $value)
86
+ {
87
+ $this->container[$key] = $value;
88
+ }
89
+
90
+ /**
91
+ * Get dependency from the container
92
+ *
93
+ * @param string $key
94
+ *
95
+ * @return mixed|null
96
+ * @since 2.3
97
+ */
98
+ public function get($key)
99
+ {
100
+ return isset($this->container[$key]) ? $this->container[$key] : null;
101
+ }
102
+
103
+ /**
104
+ * Removes the dependency from the container
105
+ *
106
+ * @param string $key
107
+ *
108
+ * @since 2.3
109
+ */
110
+ public function remove($key)
111
+ {
112
+ unset($this->container[$key]);
113
+ }
114
+
115
  /**
116
  * Returns an instance of the plugin
117
  *
128
  return self::$instance;
129
  }
130
 
131
+ /**
132
+ * Outputs all the terms in JSON format
133
+ *
134
+ * @since 2.3
135
+ */
136
+ public function getTermsJson() {
137
+
138
+ header('Content-Type: application/json');
139
+
140
+ $terms = $this->getTerms();
141
+
142
+ echo json_encode($terms);
143
+
144
+ die();
145
+ }
146
+
147
  /**
148
  * Action handler for 'wpLoaded' hook
149
  * Loads taxonomies and post types
176
  }
177
  }
178
 
179
+ $this->set('wpdb', $wpdb);
180
+ $this->set('dataConfig', new UTCW_DataConfig($args, $this));
181
+ $this->set('renderConfig', new UTCW_RenderConfig($args, $this));
182
+ $this->set('data', new UTCW_Data($this));
183
+
184
+ $render = new UTCW_Render($this);
185
 
186
  return $render->getCloud();
187
  }
src/Render.php CHANGED
@@ -2,16 +2,16 @@
2
 
3
  //namespace Rickard\UTCW;
4
 
5
- /**
6
- * Ultimate Tag Cloud Widget
7
- *
8
- * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
- * @license GPLv2
11
- * @package utcw
12
- * @subpackage main
13
- * @since 2.0
14
- */
15
 
16
  /**
17
  * Class for rendering the cloud
@@ -66,18 +66,16 @@ class UTCW_Render
66
  /**
67
  * Creates a new instance of the renderer
68
  *
69
- * @param UTCW_Config $config Configuration
70
- * @param UTCW_Data $data Term data
71
  * @param UTCW_Plugin $plugin Main plugin instance
72
  *
73
  * @since 2.0
74
  */
75
- public function __construct(UTCW_Config $config, UTCW_Data $data, UTCW_Plugin $plugin)
76
  {
77
- $this->data = $data;
78
- $this->config = $config;
79
  $this->plugin = $plugin;
80
- $this->id = base_convert(crc32(serialize($config)), 10, 27);
81
 
82
  $this->buildCSS();
83
  }
@@ -107,7 +105,7 @@ class UTCW_Render
107
  }
108
 
109
  if ($this->config->before_widget) {
110
- $markup[] = $this->config->before_widget;
111
  }
112
 
113
  if ($this->config->show_title_text) {
@@ -122,7 +120,7 @@ class UTCW_Render
122
  }
123
  }
124
 
125
- $markup[] = '<div class="widget_tag_cloud utcw-' . $this->id . '">';
126
 
127
  $terms = array();
128
 
@@ -132,7 +130,7 @@ class UTCW_Render
132
  ' title="' . _n('%s topic', '%s topics', $term->count) . '"',
133
  $term->count
134
  ) : '';
135
- $tag = $this->config->show_links ? 'a' : 'span';
136
 
137
  $terms[] = sprintf(
138
  '%s<%s class="tag-link-%s" href="%s" style="font-size:%s%s"%s>%s</%s>%s',
@@ -149,8 +147,18 @@ class UTCW_Render
149
  );
150
  }
151
 
 
 
 
 
 
 
152
  $markup[] = join($this->config->separator, $terms);
153
 
 
 
 
 
154
  $markup[] = '</div>';
155
 
156
  if ($this->config->debug) {
@@ -187,6 +195,10 @@ class UTCW_Render
187
  $main_styles[] = sprintf('word-spacing:%s', $this->config->word_spacing);
188
  }
189
 
 
 
 
 
190
  $link_styles = array();
191
 
192
  if (!$this->hasDefaultValue('link_underline')) {
@@ -208,9 +220,10 @@ class UTCW_Render
208
  $link_styles[] = sprintf('background-color:%s', $this->config->link_bg_color);
209
  }
210
 
211
- if (!$this->hasDefaultValue('link_border_style') && !$this->hasDefaultValue(
212
- 'link_border_color'
213
- ) && !$this->hasDefaultValue('link_border_width')
 
214
  ) {
215
  $link_styles[] = sprintf(
216
  'border:%s %s %s',
@@ -263,8 +276,8 @@ class UTCW_Render
263
 
264
 
265
  if (!$this->hasDefaultValue('hover_border_style') && !$this->hasDefaultValue(
266
- 'hover_border_color'
267
- ) && !$this->hasDefaultValue('hover_border_width')
268
  ) {
269
  $hover_styles[] = sprintf(
270
  'border:%s %s %s',
@@ -301,7 +314,12 @@ class UTCW_Render
301
  }
302
 
303
  if ($hover_styles) {
304
- $styles[] = sprintf('.utcw-%s span:hover,.utcw-%s a:hover{%s}', $this->id, $this->id, join(';', $hover_styles));
 
 
 
 
 
305
  }
306
 
307
  if ($styles) {
@@ -319,7 +337,9 @@ class UTCW_Render
319
  */
320
  private function hasDefaultValue($option)
321
  {
322
- $defaults = $this->config->getDefaults();
 
 
323
  return $this->config->$option === $defaults[$option];
324
  }
325
  }
2
 
3
  //namespace Rickard\UTCW;
4
 
5
+ /**
6
+ * Ultimate Tag Cloud Widget
7
+ *
8
+ * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
+ * @license GPLv2
11
+ * @package utcw
12
+ * @subpackage main
13
+ * @since 2.0
14
+ */
15
 
16
  /**
17
  * Class for rendering the cloud
66
  /**
67
  * Creates a new instance of the renderer
68
  *
 
 
69
  * @param UTCW_Plugin $plugin Main plugin instance
70
  *
71
  * @since 2.0
72
  */
73
+ public function __construct(UTCW_Plugin $plugin)
74
  {
75
+ $this->data = $plugin->get('data');
76
+ $this->config = $plugin->get('renderConfig');
77
  $this->plugin = $plugin;
78
+ $this->id = base_convert(crc32(serialize($this->config)), 10, 27);
79
 
80
  $this->buildCSS();
81
  }
105
  }
106
 
107
  if ($this->config->before_widget) {
108
+ $markup[] = str_replace('widget_utcw', 'widget_utcw widget_tag_cloud', $this->config->before_widget);
109
  }
110
 
111
  if ($this->config->show_title_text) {
120
  }
121
  }
122
 
123
+ $markup[] = '<div class="tagcloud utcw-' . $this->id . '">';
124
 
125
  $terms = array();
126
 
130
  ' title="' . _n('%s topic', '%s topics', $term->count) . '"',
131
  $term->count
132
  ) : '';
133
+ $tag = $this->config->show_links ? 'a' : 'span';
134
 
135
  $terms[] = sprintf(
136
  '%s<%s class="tag-link-%s" href="%s" style="font-size:%s%s"%s>%s</%s>%s',
147
  );
148
  }
149
 
150
+ if ($this->config->display === 'list') {
151
+ $markup[] = '<ul>';
152
+
153
+ $terms = array_map(create_function('$term', 'return sprintf("<li>%s</li>", $term);'), $terms);
154
+ }
155
+
156
  $markup[] = join($this->config->separator, $terms);
157
 
158
+ if ($this->config->display === 'list') {
159
+ $markup[] = '</ul>';
160
+ }
161
+
162
  $markup[] = '</div>';
163
 
164
  if ($this->config->debug) {
195
  $main_styles[] = sprintf('word-spacing:%s', $this->config->word_spacing);
196
  }
197
 
198
+ if (!$this->hasDefaultValue('alignment')) {
199
+ $main_styles[] = sprintf('text-align:%s', $this->config->alignment);
200
+ }
201
+
202
  $link_styles = array();
203
 
204
  if (!$this->hasDefaultValue('link_underline')) {
220
  $link_styles[] = sprintf('background-color:%s', $this->config->link_bg_color);
221
  }
222
 
223
+ if (
224
+ !$this->hasDefaultValue('link_border_style') &&
225
+ !$this->hasDefaultValue('link_border_color') &&
226
+ !$this->hasDefaultValue('link_border_width')
227
  ) {
228
  $link_styles[] = sprintf(
229
  'border:%s %s %s',
276
 
277
 
278
  if (!$this->hasDefaultValue('hover_border_style') && !$this->hasDefaultValue(
279
+ 'hover_border_color'
280
+ ) && !$this->hasDefaultValue('hover_border_width')
281
  ) {
282
  $hover_styles[] = sprintf(
283
  'border:%s %s %s',
314
  }
315
 
316
  if ($hover_styles) {
317
+ $styles[] = sprintf(
318
+ '.utcw-%s span:hover,.utcw-%s a:hover{%s}',
319
+ $this->id,
320
+ $this->id,
321
+ join(';', $hover_styles)
322
+ );
323
  }
324
 
325
  if ($styles) {
337
  */
338
  private function hasDefaultValue($option)
339
  {
340
+ $defaultConfig = new UTCW_RenderConfig(array(), $this->plugin);
341
+ $defaults = $defaultConfig->getInstance();
342
+
343
  return $this->config->$option === $defaults[$option];
344
  }
345
  }
src/Selection/PopularityStrategy.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
@@ -63,17 +63,15 @@ class UTCW_PopularityStrategy extends UTCW_SelectionStrategy
63
  /**
64
  * Creates a new instance
65
  *
66
- * @param UTCW_Config $config Current configuration
67
- * @param UTCW_Plugin $plugin Main plugin instance
68
- * @param wpdb $db WordPress DB instance
69
  *
70
  * @since 2.2
71
  */
72
- public function __construct(UTCW_Config $config, UTCW_Plugin $plugin, wpdb $db)
73
  {
74
- $this->config = $config;
 
75
  $this->plugin = $plugin;
76
- $this->db = $db;
77
  }
78
 
79
  /**
@@ -96,6 +94,7 @@ class UTCW_PopularityStrategy extends UTCW_SelectionStrategy
96
  $this->config->tags_list,
97
  $this->config->taxonomy
98
  );
 
99
  $builder->addGrouping();
100
  $builder->addMinimum($this->config->minimum);
101
  $builder->addStatement('ORDER BY count DESC');
@@ -121,5 +120,6 @@ class UTCW_PopularityStrategy extends UTCW_SelectionStrategy
121
  public function cleanupForDebug()
122
  {
123
  unset($this->db);
 
124
  }
125
  }
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
63
  /**
64
  * Creates a new instance
65
  *
66
+ * @param UTCW_Plugin $plugin Main plugin instance
 
 
67
  *
68
  * @since 2.2
69
  */
70
+ public function __construct(UTCW_Plugin $plugin)
71
  {
72
+ $this->config = $plugin->get('dataConfig');
73
+ $this->db = $plugin->get('wpdb');
74
  $this->plugin = $plugin;
 
75
  }
76
 
77
  /**
94
  $this->config->tags_list,
95
  $this->config->taxonomy
96
  );
97
+ $builder->addPostTermConstraint($this->config->post_term);
98
  $builder->addGrouping();
99
  $builder->addMinimum($this->config->minimum);
100
  $builder->addStatement('ORDER BY count DESC');
120
  public function cleanupForDebug()
121
  {
122
  unset($this->db);
123
+ $this->plugin->remove('wpdb');
124
  }
125
  }
src/Selection/RandomStrategy.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
@@ -63,17 +63,15 @@ class UTCW_RandomStrategy extends UTCW_SelectionStrategy
63
  /**
64
  * Creates a new instance
65
  *
66
- * @param UTCW_Config $config Current configuration
67
- * @param UTCW_Plugin $plugin Main plugin instance
68
- * @param wpdb $db WordPress DB instance
69
  *
70
  * @since 2.2
71
  */
72
- public function __construct(UTCW_Config $config, UTCW_Plugin $plugin, wpdb $db)
73
  {
74
- $this->config = $config;
 
75
  $this->plugin = $plugin;
76
- $this->db = $db;
77
  }
78
 
79
  /**
@@ -96,6 +94,7 @@ class UTCW_RandomStrategy extends UTCW_SelectionStrategy
96
  $this->config->tags_list,
97
  $this->config->taxonomy
98
  );
 
99
  $builder->addGrouping();
100
  $builder->addMinimum($this->config->minimum);
101
  $builder->addStatement('ORDER BY RAND()');
@@ -121,5 +120,7 @@ class UTCW_RandomStrategy extends UTCW_SelectionStrategy
121
  public function cleanupForDebug()
122
  {
123
  unset($this->db);
 
 
124
  }
125
  }
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage language
63
  /**
64
  * Creates a new instance
65
  *
66
+ * @param UTCW_Plugin $plugin Main plugin instance
 
 
67
  *
68
  * @since 2.2
69
  */
70
+ public function __construct(UTCW_Plugin $plugin)
71
  {
72
+ $this->config = $plugin->get('dataConfig');
73
+ $this->db = $plugin->get('wpdb');
74
  $this->plugin = $plugin;
 
75
  }
76
 
77
  /**
94
  $this->config->tags_list,
95
  $this->config->taxonomy
96
  );
97
+ $builder->addPostTermConstraint($this->config->post_term);
98
  $builder->addGrouping();
99
  $builder->addMinimum($this->config->minimum);
100
  $builder->addStatement('ORDER BY RAND()');
120
  public function cleanupForDebug()
121
  {
122
  unset($this->db);
123
+ $this->plugin->remove('wpdb');
124
+
125
  }
126
  }
src/Selection/SelectionStrategy.php CHANGED
@@ -6,7 +6,7 @@
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
- * @version 2.2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage selection
@@ -30,13 +30,11 @@ abstract class UTCW_SelectionStrategy
30
  /**
31
  * Creates a new instance
32
  *
33
- * @param UTCW_Config $config Current configuration
34
- * @param UTCW_Plugin $plugin Main plugin instance
35
- * @param wpdb $db WordPress DB instance
36
  *
37
  * @since 2.0
38
  */
39
- abstract public function __construct(UTCW_Config $config, UTCW_Plugin $plugin, wpdb $db);
40
 
41
  /**
42
  * Loads terms based on current configuration
6
  * Ultimate Tag Cloud Widget
7
  *
8
  * @author Rickard Andersson <rickard@0x539.se>
9
+ * @version 2.3
10
  * @license GPLv2
11
  * @package utcw
12
  * @subpackage selection
30
  /**
31
  * Creates a new instance
32
  *
33
+ * @param UTCW_Plugin $plugin Main plugin instance
 
 
34
  *
35
  * @since 2.0
36
  */
37
+ abstract public function __construct(UTCW_Plugin $plugin);
38
 
39
  /**
40
  * Loads terms based on current configuration
src/Term.php CHANGED
@@ -8,7 +8,7 @@
8
  * Ultimate Tag Cloud Widget
9
  *
10
  * @author Rickard Andersson <rickard@0x539.se>
11
- * @version 2.2.3
12
  * @license GPLv2
13
  * @package utcw
14
  * @subpackage main
8
  * Ultimate Tag Cloud Widget
9
  *
10
  * @author Rickard Andersson <rickard@0x539.se>
11
+ * @version 2.3
12
  * @license GPLv2
13
  * @package utcw
14
  * @subpackage main
src/Widget.php CHANGED
@@ -8,7 +8,7 @@
8
  * Ultimate Tag Cloud Widget
9
  *
10
  * @author Rickard Andersson <rickard@0x539.se>
11
- * @version 2.2.3
12
  * @license GPLv2
13
  * @package utcw
14
  * @subpackage main
@@ -86,10 +86,13 @@ class UTCW_Widget extends WP_Widget
86
  }
87
  }
88
 
89
- $config = new UTCW_Config($new_instance, $this->plugin);
 
 
 
90
 
91
  if ($save_config) {
92
- $this->plugin->saveConfiguration($new_instance['save_config_name'], $config->getInstance());
93
  }
94
 
95
  if (isset($new_instance['remove_config']) && is_array($new_instance['remove_config'])) {
@@ -98,7 +101,7 @@ class UTCW_Widget extends WP_Widget
98
  }
99
  }
100
 
101
- return $config->getInstance();
102
  }
103
 
104
  /**
@@ -112,7 +115,9 @@ class UTCW_Widget extends WP_Widget
112
  public function form(array $instance)
113
  {
114
  /** @noinspection PhpUnusedLocalVariableInspection */
115
- $config = new UTCW_Config($instance, $this->plugin);
 
 
116
  /** @noinspection PhpUnusedLocalVariableInspection */
117
  $configurations = $this->plugin->getConfigurations();
118
  /** @noinspection PhpUnusedLocalVariableInspection */
@@ -124,6 +129,15 @@ class UTCW_Widget extends WP_Widget
124
  /** @noinspection PhpUnusedLocalVariableInspection */
125
  $terms = $this->plugin->getTerms();
126
 
 
 
 
 
 
 
 
 
 
127
  // Content of the widget settings form
128
  require dirname(__FILE__) . '/../pages/settings.php';
129
  }
@@ -141,9 +155,12 @@ class UTCW_Widget extends WP_Widget
141
 
142
  $input = array_merge($instance, $args);
143
 
144
- $config = new UTCW_Config($input, $this->plugin);
145
- $data = new UTCW_Data($config, $this->plugin, $wpdb);
146
- $render = new UTCW_Render($config, $data, $this->plugin);
 
 
 
147
 
148
  $render->render();
149
  }
8
  * Ultimate Tag Cloud Widget
9
  *
10
  * @author Rickard Andersson <rickard@0x539.se>
11
+ * @version 2.3
12
  * @license GPLv2
13
  * @package utcw
14
  * @subpackage main
86
  }
87
  }
88
 
89
+ $dataConfig = new UTCW_DataConfig($new_instance, $this->plugin);
90
+ $renderConfig = new UTCW_RenderConfig($new_instance, $this->plugin);
91
+
92
+ $config = array_merge($dataConfig->getInstance(), $renderConfig->getInstance());
93
 
94
  if ($save_config) {
95
+ $this->plugin->saveConfiguration($new_instance['save_config_name'], $config);
96
  }
97
 
98
  if (isset($new_instance['remove_config']) && is_array($new_instance['remove_config'])) {
101
  }
102
  }
103
 
104
+ return $config;
105
  }
106
 
107
  /**
115
  public function form(array $instance)
116
  {
117
  /** @noinspection PhpUnusedLocalVariableInspection */
118
+ $dataConfig = new UTCW_DataConfig($instance, $this->plugin);
119
+ /** @noinspection PhpUnusedLocalVariableInspection */
120
+ $renderConfig = new UTCW_RenderConfig($instance, $this->plugin);
121
  /** @noinspection PhpUnusedLocalVariableInspection */
122
  $configurations = $this->plugin->getConfigurations();
123
  /** @noinspection PhpUnusedLocalVariableInspection */
129
  /** @noinspection PhpUnusedLocalVariableInspection */
130
  $terms = $this->plugin->getTerms();
131
 
132
+ // Create a lookup table with all the terms indexed by their ID
133
+ $terms_by_id = array();
134
+
135
+ foreach ($terms as $taxonomyTerms) {
136
+ foreach ($taxonomyTerms as $term) {
137
+ $terms_by_id[$term->term_id] = $term;
138
+ }
139
+ }
140
+
141
  // Content of the widget settings form
142
  require dirname(__FILE__) . '/../pages/settings.php';
143
  }
155
 
156
  $input = array_merge($instance, $args);
157
 
158
+ $this->plugin->set('wpdb', $wpdb);
159
+ $this->plugin->set('dataConfig', new UTCW_DataConfig($input, $this->plugin));
160
+ $this->plugin->set('renderConfig', new UTCW_RenderConfig($input, $this->plugin));
161
+ $this->plugin->set('data', new UTCW_Data($this->plugin));
162
+
163
+ $render = new UTCW_Render($this->plugin);
164
 
165
  $render->render();
166
  }
ultimate-tag-cloud-widget.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin Name: Ultimate tag cloud widget
6
  Plugin URI: https://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
7
  Description: This plugin aims to be the most configurable tag cloud widget out there.
8
- Version: 2.2.3
9
  Author: Rickard Andersson
10
  Author URI: https://www.0x539.se
11
  License: GPLv2
@@ -17,7 +17,7 @@ License: GPLv2
17
  * @var string
18
  * @since 2.0
19
  */
20
- define('UTCW_VERSION', '2.2.3');
21
 
22
  /**
23
  * If development mode is currently enabled
@@ -51,35 +51,33 @@ define('UTCW_DECIMAL_REGEX', '\d+(\.\d+)?');
51
  */
52
  define('UTCW_HEX_COLOR_FORMAT', '#%02x%02x%02x');
53
 
54
- if (UTCW_DEV) {
55
- require_once '/www/utcw2/src/Plugin.php';
56
- require_once '/www/utcw2/src/Config.php';
57
- require_once '/www/utcw2/src/Widget.php';
58
- require_once '/www/utcw2/src/Data.php';
59
- require_once '/www/utcw2/src/Render.php';
60
- require_once '/www/utcw2/src/Term.php';
61
- require_once '/www/utcw2/src/Language/TranslationHandler.php';
62
- require_once '/www/utcw2/src/Language/QTranslateHandler.php';
63
- require_once '/www/utcw2/src/Language/WPMLHandler.php';
64
- require_once '/www/utcw2/src/Selection/SelectionStrategy.php';
65
- require_once '/www/utcw2/src/Selection/PopularityStrategy.php';
66
- require_once '/www/utcw2/src/Selection/RandomStrategy.php';
67
- require_once '/www/utcw2/src/Database/QueryBuilder.php';
68
- } else {
69
- require_once 'src/Plugin.php';
70
- require_once 'src/Config.php';
71
- require_once 'src/Widget.php';
72
- require_once 'src/Data.php';
73
- require_once 'src/Render.php';
74
- require_once 'src/Term.php';
75
- require_once 'src/Language/TranslationHandler.php';
76
- require_once 'src/Language/QTranslateHandler.php';
77
- require_once 'src/Language/WPMLHandler.php';
78
- require_once 'src/Selection/SelectionStrategy.php';
79
- require_once 'src/Selection/PopularityStrategy.php';
80
- require_once 'src/Selection/RandomStrategy.php';
81
- require_once 'src/Database/QueryBuilder.php';
82
- }
83
 
84
  // Instantiates the plugin
85
  UTCW_Plugin::getInstance();
5
  Plugin Name: Ultimate tag cloud widget
6
  Plugin URI: https://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
7
  Description: This plugin aims to be the most configurable tag cloud widget out there.
8
+ Version: 2.3 beta 1
9
  Author: Rickard Andersson
10
  Author URI: https://www.0x539.se
11
  License: GPLv2
17
  * @var string
18
  * @since 2.0
19
  */
20
+ define('UTCW_VERSION', '2.3 beta 1');
21
 
22
  /**
23
  * If development mode is currently enabled
51
  */
52
  define('UTCW_HEX_COLOR_FORMAT', '#%02x%02x%02x');
53
 
54
+ $__prefix = UTCW_DEV ? '/www/utcw2/' : '';
55
+
56
+ require_once $__prefix . 'src/Plugin.php';
57
+ require_once $__prefix . 'src/Widget.php';
58
+ require_once $__prefix . 'src/Data.php';
59
+ require_once $__prefix . 'src/Render.php';
60
+ require_once $__prefix . 'src/Term.php';
61
+ require_once $__prefix . 'src/Language/TranslationHandler.php';
62
+ require_once $__prefix . 'src/Language/QTranslateHandler.php';
63
+ require_once $__prefix . 'src/Language/WPMLHandler.php';
64
+ require_once $__prefix . 'src/Selection/SelectionStrategy.php';
65
+ require_once $__prefix . 'src/Selection/PopularityStrategy.php';
66
+ require_once $__prefix . 'src/Selection/RandomStrategy.php';
67
+ require_once $__prefix . 'src/Database/QueryBuilder.php';
68
+ require_once $__prefix . 'src/Config/Config.php';
69
+ require_once $__prefix . 'src/Config/DataConfig.php';
70
+ require_once $__prefix . 'src/Config/RenderConfig.php';
71
+ require_once $__prefix . 'src/Config/Type/Type.php';
72
+ require_once $__prefix . 'src/Config/Type/SetType.php';
73
+ require_once $__prefix . 'src/Config/Type/ColorType.php';
74
+ require_once $__prefix . 'src/Config/Type/ArrayType.php';
75
+ require_once $__prefix . 'src/Config/Type/IntegerType.php';
76
+ require_once $__prefix . 'src/Config/Type/MeasurementType.php';
77
+ require_once $__prefix . 'src/Config/Type/StringType.php';
78
+ require_once $__prefix . 'src/Config/Type/BooleanType.php';
79
+
80
+ unset($__prefix);
 
 
81
 
82
  // Instantiates the plugin
83
  UTCW_Plugin::getInstance();