Version Description
= 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 | Ultimate Tag Cloud Widget |
Version | 2.0-beta1 |
Comparing to | |
See all releases |
Code changes from version 1.3.17 to 2.0-beta1
- css/style.css +1 -0
- js/utcw.min.js +4 -0
- language/utcw-sv_SE.mo +0 -0
- language/utcw-sv_SE.po +0 -521
- pages/settings.php +577 -0
- readme.txt +42 -264
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- settings.php +0 -367
- ultimate-tag-cloud-widget.php +7 -1029
- utcw-config.php +786 -0
- utcw-data.php +318 -0
- utcw-render.php +286 -0
- utcw-term.php +124 -0
- utcw-widget.php +118 -0
- utcw.css +0 -97
- utcw.js +0 -48
- utcw.min.css +0 -1
- utcw.min.js +0 -10
- utcw.php +331 -0
css/style.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.utcw-tab-button{border-top:solid 1px #dfdfdf;border-left:solid 1px #dfdfdf;border-right:solid 1px #dfdfdf;border-bottom:none;margin:0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;border-top-left-radius:3px;border-top-right-radius:3px;padding:2px;background:transparent;opacity:0.5;cursor:pointer;-webkit-transition:opacity 0.1s ease-in}.utcw-tab-button:hover{opacity:1}.utcw-help{float:right;display:block;width:14px;height:14px;border:solid 1px transparent;-webkit-border-radius:14px;-moz-border-radius:14px;-khtml-border-radius:14px;border-radius:14px;text-align:center;color:#fff;font-weight:bold;background-color:#6295fb;background-image:-webkit-gradient(linear, left top, left bottom, from(#6295fb), to(#3265cb));background-image:-webkit-linear-gradient(top, #6295fb, #3265cb);background-image:-moz-linear-gradient(top, #6295fb, #3265cb);background-image:-ms-linear-gradient(top, #6295fb, #3265cb);background-image:-o-linear-gradient(top, #6295fb, #3265cb);background-image:linear-gradient(top, #6295fb, #3265cb);cursor:pointer}.utcw-help:hover{color:#fff}.utcw-tooltip{color:#000;width:200px;text-align:center;border:solid 1px #6295fb;-webkit-border-radius:9px;-moz-border-radius:9px;-khtml-border-radius:9px;border-radius:9px}.utcw-tooltip ul{list-style-type:circle;margin:10px 0}.utcw-tooltip li{margin:0 0 0 20px}fieldset.utcw{padding:10px;border:solid 1px #dfdfdf;margin-bottom:25px}fieldset.utcw h3{margin:0 0 5px 0}fieldset.utcw input[type="number"]{width:50px}fieldset.utcw legend{letter-spacing:2px;font-size:16px}fieldset.utcw label.two-col{width:120px;display:inline-block}.utcw-hidden{display:none}.utcw-active{font-weight:bold;opacity:1}
|
js/utcw.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! Ultimate Tag Cloud Widget - v2.0 alpha - 2012-10-23
|
2 |
+
* https://0x539.se/wordpress/ultimate-tag-cloud-widget/
|
3 |
+
* Copyright (c) 2012 Rickard Andersson; Licensed GPLv2 */
|
4 |
+
var Query=function(e){"use strict";var t=function(e){var t=[],n,r,i,s;if(typeof e=="undefined"||e===null||e==="")return t;e.indexOf("?")===0&&(e=e.substring(1)),r=e.toString().split(/[&;]/);for(n=0;n<r.length;n++)i=r[n],s=i.split("="),t.push([s[0],s[1]]);return t},n=t(e),r=function(){var e="",t,r;for(t=0;t<n.length;t++)r=n[t],e.length>0&&(e+="&"),e+=r.join("=");return e.length>0?"?"+e:e},i=function(e){return e=decodeURIComponent(e),e=e.replace("+"," "),e},s=function(e){var t,r;for(r=0;r<n.length;r++){t=n[r];if(i(e)===i(t[0]))return t[1]}},o=function(e){var t=[],r,s;for(r=0;r<n.length;r++)s=n[r],i(e)===i(s[0])&&t.push(s[1]);return t},u=function(e,t){var r=[],s,o,u,a;for(s=0;s<n.length;s++)o=n[s],u=i(o[0])===i(e),a=i(o[1])===i(t),(arguments.length===1&&!u||arguments.length===2&&!u&&!a)&&r.push(o);return n=r,this},a=function(e,t,r){return arguments.length===3&&r!==-1?(r=Math.min(r,n.length),n.splice(r,0,[e,t])):arguments.length>0&&n.push([e,t]),this},f=function(e,t,r){var s=-1,o,f;if(arguments.length===3){for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)&&decodeURIComponent(f[1])===i(r)){s=o;break}}u(e,r).addParam(e,t,s)}else{for(o=0;o<n.length;o++){f=n[o];if(i(f[0])===i(e)){s=o;break}}u(e),a(e,t,s)}return this};return{getParamValue:s,getParamValues:o,deleteParam:u,addParam:a,replaceParam:f,toString:r}},Uri=function(e){"use strict";var t=!1,n=function(e){var n={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],i={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},s=n[t?"strict":"loose"].exec(e),o={},u=14;while(u--)o[r[u]]=s[u]||"";return o[i.name]={},o[r[12]].replace(i.parser,function(e,t,n){t&&(o[i.name][t]=n)}),o},r=n(e||""),i=new Query(r.query),s=function(e){return typeof e!="undefined"&&(r.protocol=e),r.protocol},o=null,u=function(e){return typeof e!="undefined"&&(o=e),o===null?r.source.indexOf("//")!==-1:o},a=function(e){return typeof e!="undefined"&&(r.userInfo=e),r.userInfo},f=function(e){return typeof e!="undefined"&&(r.host=e),r.host},l=function(e){return typeof e!="undefined"&&(r.port=e),r.port},c=function(e){return typeof e!="undefined"&&(r.path=e),r.path},h=function(e){return typeof e!="undefined"&&(i=new Query(e)),i},p=function(e){return typeof e!="undefined"&&(r.anchor=e),r.anchor},d=function(e){return s(e),this},v=function(e){return u(e),this},m=function(e){return a(e),this},g=function(e){return f(e),this},y=function(e){return l(e),this},b=function(e){return c(e),this},w=function(e){return h(e),this},E=function(e){return p(e),this},S=function(e){return h().getParamValue(e)},x=function(e){return h().getParamValues(e)},T=function(e,t){return arguments.length===2?h().deleteParam(e,t):h().deleteParam(e),this},N=function(e,t,n){return arguments.length===3?h().addParam(e,t,n):h().addParam(e,t),this},C=function(e,t,n){return arguments.length===3?h().replaceParam(e,t,n):h().replaceParam(e,t),this},k=function(){var e="",t=function(e){return e!==null&&e!==""};return t(s())?(e+=s(),s().indexOf(":")!==s().length-1&&(e+=":"),e+="//"):u()&&t(f())&&(e+="//"),t(a())&&t(f())&&(e+=a(),a().indexOf("@")!==a().length-1&&(e+="@")),t(f())&&(e+=f(),t(l())&&(e+=":"+l())),t(c())?e+=c():t(f())&&(t(h().toString())||t(p()))&&(e+="/"),t(h().toString())&&(h().toString().indexOf("?")!==0&&(e+="?"),e+=h().toString()),t(p())&&(p().indexOf("#")!==0&&(e+="#"),e+=p()),e},L=function(){return new Uri(k())};return{protocol:s,hasAuthorityPrefix:u,userInfo:a,host:f,port:l,path:c,query:h,anchor:p,setProtocol:d,setHasAuthorityPrefix:v,setUserInfo:m,setHost:g,setPort:y,setPath:b,setQuery:w,setAnchor:E,getQueryParamValue:S,getQueryParamValues:x,deleteQueryParam:T,addQueryParam:N,replaceQueryParam:C,toString:k,clone:L}},jsUri=Uri;(function(e){e.fn.wTooltip=function(t,n){function m(n){n&&(t.degrade?e(h).html(t.content.replace(/<\/?[^>]+>/gi,"")):e(h).html(t.content))}function g(n){function i(e){r&&!t.content&&(r="")}function u(){!l&&t.auto&&(clearInterval(o),t.fadeOut?e(h).fadeOut(t.fadeOut,function(){i(n)}):(i(n),h.style.display="none")),typeof t.callAfter=="function"&&t.callAfter(h,n,t),d&&(t=e.listen(t))}t.timeout>0?s=setTimeout(function(){u()},t.timeout):u()}t=e.extend({content:null,ajax:null,follow:!0,auto:!0,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:!1,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(e,t,n){},callAfter:function(e,t,n){},clickAction:function(t,n){e(t).hide()},delay:0,timeout:0},t||{}),!t.style&&typeof t.style!="object"?(t.style={},t.style.zIndex="1000"):t.style=e.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},t.style||{}),typeof n=="function"&&(t.callAfter=n||t.callAfter),t.style.display="none",t.style.position="absolute";var r,i,s,o,u={},f=!0,l=!1,c=!1,h=document.createElement("div"),p=typeof document.body.style.maxWidth=="undefined"?!0:!1,d=typeof e.talk=="function"&&typeof e.listen=="function"?!0:!1;t.id&&(h.id=t.id),t.className&&(h.className=t.className),t.degrade=t.degrade&&p?!0:!1;for(var v in t.style)h.style[v]=t.style[v];return t.ajax&&e.get(t.ajax,function(e){e&&(t.content=e),m(t.content)}),e(h).hover(function(){l=!0},function(){l=!1,g(u)}),d&&(t.key=h,t.plugin="wTooltip",t.channel="wayfarer",e.talk(t)),m(t.content&&!t.ajax),e(h).appendTo(t.appendTip),this.each(function(){e(this).hover(function(){function o(){typeof t.callBefore=="function"&&t.callBefore(h,n,t),d&&(t=e.listen(t));var i;t.content?t.degrade||(i="block"):r&&!t.degrade?(e(h).html(unescape(r)),i="block",r=""):i="none",t.auto&&(i=="block"&&t.fadeIn?e(h).fadeIn(t.fadeIn):h.style.display=i)}var n=this;clearTimeout(s),(this.title||this.titleMemKeep)&&!t.degrade&&!t.content&&(r=this.title||this.titleMemKeep,this.title&&(this.titleMemKeep=this.title,this.title="")),t.content&&t.degrade&&(this.title=h.innerHTML),t.delay>0?i=setTimeout(function(){o()},t.delay):o()},function(){clearTimeout(i);var n=this;f=!0,!t.follow||c||t.offsetX<0&&0-t.offsetX<e(h).outerWidth()&&t.offsetY>0&&0-t.offsetY<e(h).outerHeight()?setTimeout(function(){o=setInterval(function(){g(n)},1)},1):g(this)}),e(this).mousemove(function(n){u=this;if(t.follow||f){var r=e(window).scrollTop(),i=e(window).scrollLeft(),s=n.clientY+r+t.offsetY,o=n.clientX+i+t.offsetX,l=e(t.appendTip).outerHeight(),p=e(t.appendTip).innerHeight(),d=e(window).width()+i-e(h).outerWidth(),v=e(window).height()+r-e(h).outerHeight();s=l>p?s-(l-p):s,c=s>v||o>d?!0:!1,o-i<=0&&t.offsetX<0?o=i:o>d&&(o=d),s-r<=0&&t.offsetY<0?s=r:s>v&&(s=v),h.style.top=s+"px",h.style.left=o+"px",f=!1}}),typeof t.clickAction=="function"&&e(this).click(function(){t.clickAction(h,this)})})}})(jQuery),function(e){"use strict";var t={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1e3},n={activeTab:{},init:function(){e("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]").live("click",this.colorClickHandler),e(".utcw-tab-button").live("click",this.tabClickHandler),e("select[id$=-taxonomy]").live("change",this.taxonomyChangeHandler),e(document).ready(this.initTooltip),e(document).ajaxSuccess(this.ajaxSuccessHandler)},initTooltip:function(){e(".utcw-help").wTooltip({style:t,className:"utcw-tooltip"})},tabClickHandler:function(){var t=e(this);return t.data("id")==="utcw-__i__"?!1:(t.parent().find(".utcw-tab-button").removeClass("utcw-active"),t.addClass("utcw-active"),t.parent().find("fieldset.utcw").addClass("hidden"),e("#"+t.data("tab")).removeClass("hidden"),n.activeTab[t.data("id")]=t.data("tab"),!1)},colorClickHandler:function(){var t=e("div[id$='set_chooser']"),n=e("div[id$='span_chooser']"),r=e(this).val();t.addClass("utcw-hidden"),n.addClass("utcw-hidden"),r==="set"?t.removeClass("utcw-hidden"):r==="span"&&n.removeClass("utcw-hidden")},taxonomyChangeHandler:function(){var t=e(this),n=t.find(":selected").val(),r=t.parents(".widget-content");r.find("div[id$=-terms]").addClass("hidden"),r.find("#"+n+"-terms").removeClass("hidden")},ajaxSuccessHandler:function(e,t,r){n.setCurrentTab.apply(n,[r.data]),n.initTooltip.apply(n)},setCurrentTab:function(t){var n=new Uri,r;n.setQuery(decodeURI(t)),n.getQueryParamValue("action")==="save-widget"&&n.getQueryParamValue("id_base")==="utcw"&&(r=n.getQueryParamValue("widget-id"),this.activeTab[r]&&e("button[data-tab='"+this.activeTab[r]+"']").trigger("click"))}};n.init()}(jQuery);
|
language/utcw-sv_SE.mo
DELETED
Binary file
|
language/utcw-sv_SE.po
DELETED
@@ -1,521 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Ultimate Tag Cloud Widget\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2012-06-10 18:00+0100\n"
|
6 |
-
"PO-Revision-Date: 2012-06-10 18:00+0100\n"
|
7 |
-
"Last-Translator: Rickard Andersson <rickard@montania.se>\n"
|
8 |
-
"Language-Team: 0x539.se <rickard@0x539.se>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-KeywordsList: __;_e;_n;_x\n"
|
13 |
-
"X-Poedit-Basepath: /Users/rickard/serversites/ultimate-tag-cloud-widget\n"
|
14 |
-
"X-Poedit-Language: English\n"
|
15 |
-
"X-Poedit-Country: SWEDEN\n"
|
16 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
-
"X-Poedit-SearchPath-0: /www/ultimate-tag-cloud-widget/trunk\n"
|
18 |
-
|
19 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:52
|
20 |
-
msgid "Data"
|
21 |
-
msgstr "Data"
|
22 |
-
|
23 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:53
|
24 |
-
msgid "Basic appearance"
|
25 |
-
msgstr "Grundläggande utseende"
|
26 |
-
|
27 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:54
|
28 |
-
msgid "Advanced appearance"
|
29 |
-
msgstr "Avancerat utseende"
|
30 |
-
|
31 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:55
|
32 |
-
msgid "Links"
|
33 |
-
msgstr "Länkar"
|
34 |
-
|
35 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:56
|
36 |
-
msgid "Adv."
|
37 |
-
msgstr "Avanc."
|
38 |
-
|
39 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:60
|
40 |
-
msgid "Only posts from the selected authors will be used when calculating the tag cloud."
|
41 |
-
msgstr "Endast inlägg skrivna av de valda författarna kommer att användas när molnet skapas."
|
42 |
-
|
43 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:61
|
44 |
-
msgid "Authors:"
|
45 |
-
msgstr "Författare:"
|
46 |
-
|
47 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:68
|
48 |
-
msgid "Which property of the tag should be used when determining the order of the tags in the cloud."
|
49 |
-
msgstr "Vilken av taggens egenskap som ska användas när sorteringen av taggarna görs."
|
50 |
-
|
51 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:69
|
52 |
-
msgid "Order:"
|
53 |
-
msgstr "Ordning:"
|
54 |
-
|
55 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:71
|
56 |
-
msgid "Random"
|
57 |
-
msgstr "Slumpvis"
|
58 |
-
|
59 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:73
|
60 |
-
msgid "By name"
|
61 |
-
msgstr "Efter namn"
|
62 |
-
|
63 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:75
|
64 |
-
msgid "By slug"
|
65 |
-
msgstr "Efter slug"
|
66 |
-
|
67 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:77
|
68 |
-
msgid "By id"
|
69 |
-
msgstr "Efter id"
|
70 |
-
|
71 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:79
|
72 |
-
msgid "By color"
|
73 |
-
msgstr "Efter färg"
|
74 |
-
|
75 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:81
|
76 |
-
msgid "Count"
|
77 |
-
msgstr "Antal"
|
78 |
-
|
79 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:83
|
80 |
-
msgid "Reverse order"
|
81 |
-
msgstr "Omvänd ordning"
|
82 |
-
|
83 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:85
|
84 |
-
msgid "Case sensitive"
|
85 |
-
msgstr "Skiftlägeskänsligt"
|
86 |
-
|
87 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:88
|
88 |
-
msgid "Which taxonomy should be used in the cloud. You should be able to choose a custom taxonomy as well."
|
89 |
-
msgstr "Vilken taxonomi som ska användas i molnet. Här ska även skräddarsydda taxonomier (custom taxonomies) vara med."
|
90 |
-
|
91 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:89
|
92 |
-
msgid "Taxonomy:"
|
93 |
-
msgstr "Taxonomi:"
|
94 |
-
|
95 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:97
|
96 |
-
msgid "Which post types should be used in the cloud. Only tags from posts from these post types will be used in the tag cloud."
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:106
|
100 |
-
msgid "Only tags which have been used with this many posts will be visible in the cloud"
|
101 |
-
msgstr "Bara taggar som har blivit använda i så här många ilägg kommer att visas i molnet."
|
102 |
-
|
103 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:107
|
104 |
-
msgid "Tags with fewer posts than this will be automatically excluded."
|
105 |
-
msgstr "Taggar med färre inlägg än detta kommer automatiskt att exkluderas."
|
106 |
-
|
107 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:107
|
108 |
-
msgid "Minimum number of posts: "
|
109 |
-
msgstr "Minsta antal inlägg:"
|
110 |
-
|
111 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:111
|
112 |
-
msgid "Only posts which are posted within this number of days will be used when generating the cloud"
|
113 |
-
msgstr "Bara inlägg som blev publicerade inom såhär många dagar kommer att användas när molnet skapas."
|
114 |
-
|
115 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:112
|
116 |
-
msgid "The maximum number of days back to search for posts, zero means every post."
|
117 |
-
msgstr "Max antal dagar bakåt i tiden att söka efter inlägg, noll innebär alla inlägg."
|
118 |
-
|
119 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:112
|
120 |
-
msgid "Posts max age:"
|
121 |
-
msgstr "Inläggens maxålder:"
|
122 |
-
|
123 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:116
|
124 |
-
msgid "Choose either include or exclude above and enter a comma separated list of either the names or IDs of the tags you'd like to include/exclude."
|
125 |
-
msgstr "Välj antingen inkludera eller exkludera ovan och fyll i en kommaseparerad lista av antingen namn eller ID nummer av de taggar du vill inkludera/exkludera."
|
126 |
-
|
127 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:118
|
128 |
-
msgid "Include only ... "
|
129 |
-
msgstr "Inkludera endast ..."
|
130 |
-
|
131 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:120
|
132 |
-
msgid "Exclude ... "
|
133 |
-
msgstr "Exclude ..."
|
134 |
-
|
135 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:122
|
136 |
-
msgid "... these tags:"
|
137 |
-
msgstr "... dessa taggar:"
|
138 |
-
|
139 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:128
|
140 |
-
msgid "The title is the text which is shown above the tag cloud."
|
141 |
-
msgstr "Titeln är den text som visas ovanför taggmolnet"
|
142 |
-
|
143 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:129
|
144 |
-
msgid "Title:"
|
145 |
-
msgstr "Titel"
|
146 |
-
|
147 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:131
|
148 |
-
#, fuzzy
|
149 |
-
msgid "Show title"
|
150 |
-
msgstr "Visa titel"
|
151 |
-
|
152 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:135
|
153 |
-
msgid "The tag with the least number of posts will be the smallest, and the tag with the most number of posts will be the biggest."
|
154 |
-
msgstr "Taggen med färst antal inlägg kommer att bli minst och taggen med flest antal inlägg kommer att bli störst."
|
155 |
-
|
156 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:136
|
157 |
-
msgid "Tag size (in px):"
|
158 |
-
msgstr "Taggstorlek (i px):"
|
159 |
-
|
160 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:137
|
161 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:163
|
162 |
-
msgid "From"
|
163 |
-
msgstr "Från"
|
164 |
-
|
165 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:139
|
166 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:166
|
167 |
-
msgid "to"
|
168 |
-
msgstr "till"
|
169 |
-
|
170 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:143
|
171 |
-
msgid "If the total number of tags exceeds this number, only this many tags will be shown in the cloud."
|
172 |
-
msgstr "Om det totala antalet taggar överskrider detta antal, ta bara med såhär många taggar i molnet. "
|
173 |
-
|
174 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:144
|
175 |
-
msgid "Max tags:"
|
176 |
-
msgstr "Max antal taggar:"
|
177 |
-
|
178 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:148
|
179 |
-
msgid "This setting controls how the tags are colored.<ul><li>Totaly random will choose between all the 16 million colors available.</li><li>Random from preset values will choose colors from a predefined set of colors</li><li>Spanning between values will calculate the corresponding color based upon how many posts each tag has, similar to how the size is calculated. The tag with the least number of posts will have the first color and the tag with the most number of posts will have the second color. All tags in between will have a color calculated between the first and the second color.</li></ul>The colors for the choice 'Random from preset values' has to be specified as a comma separated list."
|
180 |
-
msgstr ""
|
181 |
-
|
182 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:149
|
183 |
-
msgid "Coloring:"
|
184 |
-
msgstr "Färgläggning:"
|
185 |
-
|
186 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:151
|
187 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:258
|
188 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:310
|
189 |
-
msgid "None"
|
190 |
-
msgstr "Ingen"
|
191 |
-
|
192 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:153
|
193 |
-
msgid "Totally random"
|
194 |
-
msgstr "Helt slumpat"
|
195 |
-
|
196 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:155
|
197 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:157
|
198 |
-
msgid "Random from preset values"
|
199 |
-
msgstr "Slumpat mellan färger"
|
200 |
-
|
201 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:161
|
202 |
-
msgid "Spanning between values"
|
203 |
-
msgstr "Utspritt mellan två färger"
|
204 |
-
|
205 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:174
|
206 |
-
msgid "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."
|
207 |
-
msgstr "Titeln är den lilla (vanligtvis) gula text som visas när användaren pekar på taggen. Prova att peka på texten till vänster för att se ett exempel på hur det ser ut."
|
208 |
-
|
209 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:176
|
210 |
-
msgid "This is a title"
|
211 |
-
msgstr "Detta är en titel"
|
212 |
-
|
213 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:176
|
214 |
-
msgid "Show title (hover text)"
|
215 |
-
msgstr "Visa titel"
|
216 |
-
|
217 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:179
|
218 |
-
msgid "The spacing is a numerical value which controls how much space there is between letters, words, tags or rows. To use the default value for these settings just use the corresponding default value from the CSS specification: <ul><li>Letter spacing: normal</li><li>Word spacing: normal</li><li>Tag spacing (CSS margin): auto</li><li>Row spacing (CSS line height): inherit</li></ul>To use anything but the default values, just specify a number (the unit is pixels)."
|
219 |
-
msgstr ""
|
220 |
-
|
221 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:180
|
222 |
-
msgid "Spacing (in px):"
|
223 |
-
msgstr "Mellanrum (i px):"
|
224 |
-
|
225 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:181
|
226 |
-
msgid "Between letters:"
|
227 |
-
msgstr "Mellan bokstäver:"
|
228 |
-
|
229 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:183
|
230 |
-
msgid "Between words:"
|
231 |
-
msgstr "Mellan ord:"
|
232 |
-
|
233 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:185
|
234 |
-
msgid "Between tags:"
|
235 |
-
msgstr "Mellan taggar:"
|
236 |
-
|
237 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:187
|
238 |
-
msgid "Between rows:"
|
239 |
-
msgstr "Mellan rader:"
|
240 |
-
|
241 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:191
|
242 |
-
msgid "The tags can be transformed in a number of different ways. lowercase, UPPERCASE or Capitalized."
|
243 |
-
msgstr ""
|
244 |
-
|
245 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:192
|
246 |
-
msgid "Transform tags:"
|
247 |
-
msgstr "Omvandla taggar:"
|
248 |
-
|
249 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:194
|
250 |
-
msgid "Off"
|
251 |
-
msgstr "Inaktiverat"
|
252 |
-
|
253 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:196
|
254 |
-
msgid "To lowercase"
|
255 |
-
msgstr "Till gemener"
|
256 |
-
|
257 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:198
|
258 |
-
msgid "To uppercase"
|
259 |
-
msgstr "Till versaler"
|
260 |
-
|
261 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:200
|
262 |
-
msgid "Capitalize"
|
263 |
-
msgstr "Stor begynnelsebokstav"
|
264 |
-
|
265 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:203
|
266 |
-
msgid "The tags can be surrounded by a prefix and/or suffix and separated with a separator. The default separator is just a space but can be changed to anything you'd like. Remember to add a space before and after the separator, this is not automatically added by the plugin.<br><br>A short example, these settings:<ul><li>Separator: - </li><li>Prefix: (</li><li>Suffix: )</li></ul>… would produce a tag cloud like this: <br><br>(first tag) - (second tag) - (third tag)<br><br>Prefix and suffix characters will have the same size and color as the tag, but the separator will not."
|
267 |
-
msgstr ""
|
268 |
-
|
269 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:204
|
270 |
-
msgid "Tag separators:"
|
271 |
-
msgstr "Separatorer:"
|
272 |
-
|
273 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:205
|
274 |
-
msgid "Separator"
|
275 |
-
msgstr "Separator"
|
276 |
-
|
277 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:207
|
278 |
-
msgid "Prefix"
|
279 |
-
msgstr "Prefix"
|
280 |
-
|
281 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:209
|
282 |
-
msgid "Suffix"
|
283 |
-
msgstr "Suffix"
|
284 |
-
|
285 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:217
|
286 |
-
msgid "The normal styles will apply to the tags when the user is <b>not</b> hovering the link."
|
287 |
-
msgstr ""
|
288 |
-
|
289 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:219
|
290 |
-
msgid "Yes or no will force the tag setting for the <u>underline</u> style, theme default will let the blog theme decide."
|
291 |
-
msgstr ""
|
292 |
-
|
293 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:220
|
294 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:277
|
295 |
-
msgid "Underline"
|
296 |
-
msgstr "Understreck"
|
297 |
-
|
298 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:222
|
299 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:232
|
300 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:242
|
301 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:279
|
302 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:287
|
303 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:295
|
304 |
-
msgid "Yes"
|
305 |
-
msgstr "Yes"
|
306 |
-
|
307 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:224
|
308 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:234
|
309 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:244
|
310 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:281
|
311 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:289
|
312 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:297
|
313 |
-
msgid "No"
|
314 |
-
msgstr "Nej"
|
315 |
-
|
316 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:226
|
317 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:236
|
318 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:246
|
319 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:283
|
320 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:291
|
321 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:299
|
322 |
-
msgid "Theme default"
|
323 |
-
msgstr "Följ temats standard"
|
324 |
-
|
325 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:229
|
326 |
-
msgid "Yes or no will force the tag setting for the <b>bold</b> style, theme default will let the blog theme decide."
|
327 |
-
msgstr ""
|
328 |
-
|
329 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:230
|
330 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:285
|
331 |
-
msgid "Bold"
|
332 |
-
msgstr "Fetstilt"
|
333 |
-
|
334 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:239
|
335 |
-
msgid "Yes or no will force the tag setting for the <i>italic</i> style, theme default will let the blog theme decide."
|
336 |
-
msgstr ""
|
337 |
-
|
338 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:240
|
339 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:293
|
340 |
-
msgid "Italic"
|
341 |
-
msgstr "Kursiv stil"
|
342 |
-
|
343 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:249
|
344 |
-
msgid "This setting will change the background color of <b>the link only</b>, not the whole cloud. The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black."
|
345 |
-
msgstr ""
|
346 |
-
|
347 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:250
|
348 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:301
|
349 |
-
msgid "Background color (hex value):"
|
350 |
-
msgstr "Bakgrundsfärgen (hexadecimalt värde)"
|
351 |
-
|
352 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:254
|
353 |
-
msgid "This setting will change the border of <b>the link only</b>, not the whole cloud. <ul><li>The width of the border is a numerical value (in the unit pixels).</li><li>The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black.</li></ul>"
|
354 |
-
msgstr ""
|
355 |
-
|
356 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:255
|
357 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:306
|
358 |
-
msgid "Border"
|
359 |
-
msgstr "Kantlinje"
|
360 |
-
|
361 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:256
|
362 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:308
|
363 |
-
msgid "Style: "
|
364 |
-
msgstr "Stil:"
|
365 |
-
|
366 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:259
|
367 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:311
|
368 |
-
msgid "Dotted"
|
369 |
-
msgstr "Prickig"
|
370 |
-
|
371 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:260
|
372 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:312
|
373 |
-
msgid "Dashed"
|
374 |
-
msgstr "Streckad"
|
375 |
-
|
376 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:261
|
377 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:313
|
378 |
-
msgid "Solid"
|
379 |
-
msgstr "Solid"
|
380 |
-
|
381 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:262
|
382 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:314
|
383 |
-
msgid "Double"
|
384 |
-
msgstr "Dubbel"
|
385 |
-
|
386 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:263
|
387 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:315
|
388 |
-
msgid "Groove"
|
389 |
-
msgstr "Groovy"
|
390 |
-
|
391 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:264
|
392 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:316
|
393 |
-
msgid "Ridge"
|
394 |
-
msgstr "Räfflad"
|
395 |
-
|
396 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:265
|
397 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:317
|
398 |
-
msgid "Inset"
|
399 |
-
msgstr "Infälld"
|
400 |
-
|
401 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:266
|
402 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:318
|
403 |
-
msgid "Outset"
|
404 |
-
msgstr "Utfälld"
|
405 |
-
|
406 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:269
|
407 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:321
|
408 |
-
msgid "Width (in px):"
|
409 |
-
msgstr "Bredd (i px):"
|
410 |
-
|
411 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:272
|
412 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:324
|
413 |
-
msgid "Color (hex value): "
|
414 |
-
msgstr "Färg (hexadecimalt värde):"
|
415 |
-
|
416 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:275
|
417 |
-
msgid "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."
|
418 |
-
msgstr ""
|
419 |
-
|
420 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:304
|
421 |
-
msgid "Font color (hex value):"
|
422 |
-
msgstr "Textfärg (hexadecimalt värde):"
|
423 |
-
|
424 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:329
|
425 |
-
msgid "This will add a <-- HTML comment --> 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'"
|
426 |
-
msgstr "Detta kommer att lägga till en <-- HTML kommentar --> till utskriften med felsökningsinformation, vänligen använd denna information om problem skulle uppstå. Du kan hitta informationen genom att använda \"visa källa\" i din webbläsare när du besöker sidan, och söka efter 'Ultimate Tag Cloud Debug information'"
|
427 |
-
|
428 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:331
|
429 |
-
msgid "Include debug output"
|
430 |
-
msgstr "Inkludera felsökningsinformation"
|
431 |
-
|
432 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:333
|
433 |
-
msgid "This will save the current configuration which enables you to load this configuration at a later time. Check this box, choose a name in the text field below and press 'Save' to save the configuration."
|
434 |
-
msgstr ""
|
435 |
-
|
436 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:335
|
437 |
-
msgid "Save configuration"
|
438 |
-
msgstr "Spara konfiguration"
|
439 |
-
|
440 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:337
|
441 |
-
msgid "This is the name which will be used for the current configuration if you check the option 'Save configuration' above. If the name is omitted the current date and time will be used."
|
442 |
-
msgstr "Detta är namnet som komemr att användas för den nuvarande konfigurationen om du väljer valet 'Spara konfiguration' ovanför. Om du inte väljer något namn kommer nuvarande datum och tid att användas."
|
443 |
-
|
444 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:338
|
445 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:348
|
446 |
-
msgid "Configuration name"
|
447 |
-
msgstr "Konfigurationens namn"
|
448 |
-
|
449 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:344
|
450 |
-
msgid "This will load the selected configuration to the state which the widget was when the configuration was saved."
|
451 |
-
msgstr "Detta kommer att ladda den valda konfigurationen till de inställningar som widgeten hade när konfigurationen sparades."
|
452 |
-
|
453 |
-
#: /www/ultimate-tag-cloud-widget/trunk/settings.php:346
|
454 |
-
msgid "Load configuration"
|
455 |
-
msgstr "Ladda konfiguration"
|
456 |
-
|
457 |
-
#: /www/ultimate-tag-cloud-widget/trunk/ultimate-tag-cloud-widget.php:28
|
458 |
-
msgid "Tag Cloud"
|
459 |
-
msgstr "Taggmoln"
|
460 |
-
|
461 |
-
#: /www/ultimate-tag-cloud-widget/trunk/ultimate-tag-cloud-widget.php:93
|
462 |
-
msgid "Highly configurable tag cloud"
|
463 |
-
msgstr "Ett mycket konfigurerbart taggmoln"
|
464 |
-
|
465 |
-
#: /www/ultimate-tag-cloud-widget/trunk/ultimate-tag-cloud-widget.php:94
|
466 |
-
msgid "Ultimate Tag Cloud"
|
467 |
-
msgstr "Ultimate Tag Cloud"
|
468 |
-
|
469 |
-
#: /www/ultimate-tag-cloud-widget/trunk/ultimate-tag-cloud-widget.php:885
|
470 |
-
#, php-format
|
471 |
-
msgid "%s topic"
|
472 |
-
msgstr "%s ämne"
|
473 |
-
|
474 |
-
#~ msgid "%s topics"
|
475 |
-
#~ msgstr "%s ämnen"
|
476 |
-
|
477 |
-
#~ msgid "Alphabetically"
|
478 |
-
#~ msgstr "Alfabetisk"
|
479 |
-
|
480 |
-
#~ msgid "Post Tags"
|
481 |
-
#~ msgstr "Taggar"
|
482 |
-
|
483 |
-
#~ msgid "Categories"
|
484 |
-
#~ msgstr "Kategorier"
|
485 |
-
|
486 |
-
#~ msgid "Exclude:"
|
487 |
-
#~ msgstr "Exkludera"
|
488 |
-
|
489 |
-
#~ msgid "Appearance"
|
490 |
-
#~ msgstr "Utseende"
|
491 |
-
|
492 |
-
#~ msgid "Enter either the names or IDs of the tags you'd like to exclude."
|
493 |
-
#~ msgstr "Skriv antingen namn eller IDn på de taggar du vill exkludera"
|
494 |
-
|
495 |
-
#~ msgid ""
|
496 |
-
#~ "Tagging pages is not a native feature of WordPress, you can use this "
|
497 |
-
#~ "feature together with the page tagger plugin"
|
498 |
-
#~ msgstr ""
|
499 |
-
#~ "Att tagga sidor är inte en standardfunktion i WordPress, du kan använda "
|
500 |
-
#~ "denna funktion tillsammans med pluginen page tagger"
|
501 |
-
|
502 |
-
#~ msgid "Include tags from pages"
|
503 |
-
#~ msgstr "Inkludera taggar från sidor"
|
504 |
-
|
505 |
-
#~ msgid "Exclude these tags:"
|
506 |
-
#~ msgstr "Exkludera dessa taggar:"
|
507 |
-
|
508 |
-
#~ msgid "Adv. appearance"
|
509 |
-
#~ msgstr "Avancerat utseende"
|
510 |
-
|
511 |
-
#~ msgid "Link CSS styles"
|
512 |
-
#~ msgstr "Länkars CSS-stil"
|
513 |
-
|
514 |
-
#~ msgid ""
|
515 |
-
#~ "Tagging pages is not a native feature of WordPress, you can use this "
|
516 |
-
#~ "feature together with the <a href=\"http://wordpress.org/extend/plugins/"
|
517 |
-
#~ "page-tagger/\" target=\"_blank\">page tagger plugin</a>"
|
518 |
-
#~ msgstr ""
|
519 |
-
#~ "Att tagga sidor är inte en standardfunktion i WordPress, du kan använda "
|
520 |
-
#~ "denna funktion tillsammans med pluginen <a href=\"http://wordpress.org/"
|
521 |
-
#~ "extend/plugins/page-tagger/\" target=\"_blank\">page tagger</a>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/settings.php
ADDED
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage pages
|
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 $this
|
17 |
+
*/
|
18 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
19 |
+
|
20 |
+
?>
|
21 |
+
<button class="utcw-tab-button utcw-active" data-id="<?php echo $this->id ?>"
|
22 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-data' ) ?>"><?php _e( 'Data', 'utcw' ) ?></button>
|
23 |
+
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>"
|
24 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-terms' ) ?>"><?php _e( 'Terms', 'utcw' ) ?></button>
|
25 |
+
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>"
|
26 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-basic-appearance' ) ?>"><?php _e( 'Basic appearance', 'utcw' ) ?></button>
|
27 |
+
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>"
|
28 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-advanced-appearance' ) ?>"><?php _e( 'Advanced appearance', 'utcw' ) ?></button>
|
29 |
+
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>"
|
30 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-links' ) ?>"><?php _e( 'Links', 'utcw' ) ?></button>
|
31 |
+
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>"
|
32 |
+
data-tab="<?php echo $this->get_field_id( 'utcw-tab-advanced' ) ?>"><?php _e( 'Adv.', 'utcw' ) ?></button>
|
33 |
+
|
34 |
+
<fieldset class='utcw' id="<?php echo $this->get_field_id( 'utcw-tab-data' ) ?>">
|
35 |
+
<legend></legend>
|
36 |
+
<a class="utcw-help"
|
37 |
+
title="<?php _e( 'Only posts from the selected authors will be used when calculating the tag cloud.', 'utcw' ) ?>">?</a>
|
38 |
+
<strong><?php _e( 'Authors:', 'utcw' ) ?></strong><br>
|
39 |
+
<?php foreach ( $users as $user ) : ?>
|
40 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'authors' ) ?>[]"
|
41 |
+
id="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"
|
42 |
+
value="<?php echo $user->ID?>" <?php echo in_array( $user->ID, $config->authors, true ) ? 'checked="checked"' : ''; ?>>
|
43 |
+
<label for="<?php echo $this->get_field_id( 'author_' . $user->ID ) ?>"><?php echo $user->user_login?></label><br>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
<br>
|
46 |
+
|
47 |
+
<a class="utcw-help"
|
48 |
+
title="<?php _e( 'Which property of the tag should be used when determining the order of the tags in the cloud.', 'utcw' ) ?>">?</a>
|
49 |
+
<strong><?php _e( 'Order:', 'utcw' ) ?></strong><br>
|
50 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
51 |
+
id="<?php echo $this->get_field_id( 'order_random' ) ?>"
|
52 |
+
value="random" <?php echo $config->order == 'random' ? ' checked="checked" ' : ''; ?>>
|
53 |
+
<label for="<?php echo $this->get_field_id( 'order_random' ) ?>"><?php _e( 'Random', 'utcw' ) ?></label><br>
|
54 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
55 |
+
id="<?php echo $this->get_field_id( 'order_name' ) ?>"
|
56 |
+
value="name" <?php echo $config->order == 'name' ? ' checked="checked"' : ''; ?>>
|
57 |
+
<label for="<?php echo $this->get_field_id( 'order_name' ) ?>"><?php _e( 'By name', 'utcw' ) ?></label><br>
|
58 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
59 |
+
id="<?php echo $this->get_field_id( 'order_slug' ) ?>"
|
60 |
+
value="slug" <?php echo $config->order == 'slug' ? ' checked="checked"' : ''; ?>>
|
61 |
+
<label for="<?php echo $this->get_field_id( 'order_slug' ) ?>"><?php _e( 'By slug', 'utcw' ) ?></label><br>
|
62 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
63 |
+
id="<?php echo $this->get_field_id( 'order_id' ) ?>"
|
64 |
+
value="id" <?php echo $config->order == 'id' ? ' checked="checked"' : ''; ?>>
|
65 |
+
<label for="<?php echo $this->get_field_id( 'order_id' ) ?>"><?php _e( 'By id', 'utcw' ) ?></label><br>
|
66 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
67 |
+
id="<?php echo $this->get_field_id( 'order_color' ) ?>"
|
68 |
+
value="name" <?php echo $config->order == 'color' ? ' checked="checked"' : ''; ?>>
|
69 |
+
<label for="<?php echo $this->get_field_id( 'order_color' ) ?>"><?php _e( 'By color', 'utcw' ) ?></label><br>
|
70 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'order' ) ?>"
|
71 |
+
id="<?php echo $this->get_field_id( 'order_count' ) ?>"
|
72 |
+
value="count" <?php echo $config->order == 'count' || strlen( $config->order ) == 0 ? ' checked="checked" ' : ''; ?>>
|
73 |
+
<label for="<?php echo $this->get_field_id( 'order_count' ) ?>"><?php _e( 'Count', 'utcw' ) ?></label><br>
|
74 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'reverse' ) ?>"
|
75 |
+
id="<?php echo $this->get_field_id( 'reverse' ) ?>" <?php echo $config->reverse === true ? ' checked="checked"' : ''; ?>>
|
76 |
+
<label for="<?php echo $this->get_field_id( 'reverse' ) ?>"><?php _e( 'Reverse order', 'utcw' ) ?></label><br>
|
77 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'case_sensitive' ) ?>"
|
78 |
+
id="<?php echo $this->get_field_id( 'case_sensitive' ) ?>" <?php echo $config->case_sensitive === true ? ' checked="checked"' : ''; ?>>
|
79 |
+
<label
|
80 |
+
for="<?php echo $this->get_field_id( 'case_sensitive' ) ?>"><?php _e( 'Case sensitive', 'utcw' ) ?></label><br>
|
81 |
+
<br>
|
82 |
+
|
83 |
+
<a class="utcw-help"
|
84 |
+
title="<?php _e( 'Which taxonomy should be used in the cloud. You should be able to choose a custom taxonomy as well.', 'utcw' ) ?>">?</a>
|
85 |
+
<strong><label
|
86 |
+
for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomy:', 'utcw' ) ?></label></strong><br>
|
87 |
+
<select id="<?php echo $this->get_field_id( 'taxonomy' ) ?>"
|
88 |
+
name="<?php echo $this->get_field_name( 'taxonomy' ) ?>">
|
89 |
+
<?php foreach ( $available_taxonomies as $taxonomy ) : ?>
|
90 |
+
<option
|
91 |
+
value="<?php echo $taxonomy->name ?>" <?php echo $config->taxonomy == $taxonomy->name ? 'selected="selected"' : ''?>><?php echo $taxonomy->labels->name ?></option>
|
92 |
+
<?php endforeach; ?>
|
93 |
+
</select><br>
|
94 |
+
<br>
|
95 |
+
|
96 |
+
<a class="utcw-help"
|
97 |
+
title="<?php _e( 'Which post types should be used in the cloud. Only tags from posts from these post types will be used in the tag cloud.', 'utcw' ) ?>">?</a>
|
98 |
+
<strong>Post types:</strong><br>
|
99 |
+
|
100 |
+
<?php foreach ( $available_post_types as $pt ) : $data = get_post_type_object( $pt ) ?>
|
101 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'post_type' ) ?>[]"
|
102 |
+
id="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"
|
103 |
+
value="<?php echo $pt ?>" <?php if ( in_array( $pt, $config->post_type ) ) echo 'checked="checked"' ?>>
|
104 |
+
<label for="<?php echo $this->get_field_id( 'post_type-' . $pt ) ?>"><?php echo $data->labels->name ?></label><br>
|
105 |
+
<?php endforeach ?>
|
106 |
+
<br>
|
107 |
+
|
108 |
+
<a class="utcw-help"
|
109 |
+
title="<?php _e( 'Only tags which have been used with this many posts will be visible in the cloud', 'utcw' ) ?>">?</a>
|
110 |
+
<strong><label for="<?php echo $this->get_field_id( 'minimum' ) ?>"
|
111 |
+
title="<?php _e( 'Tags with fewer posts than this will be automatically excluded.', 'utcw' ) ?>"><?php _e( 'Minimum number of posts: ', 'utcw' ) ?></label></strong>
|
112 |
+
<input type="number" name="<?php echo $this->get_field_name( 'minimum' ) ?>"
|
113 |
+
id="<?php echo $this->get_field_id( 'minimum' ) ?>" value="<?php echo $config->minimum; ?>"><br>
|
114 |
+
<br>
|
115 |
+
|
116 |
+
<a class="utcw-help"
|
117 |
+
title="<?php _e( 'Only posts which are posted within this number of days will be used when generating the cloud', 'utcw' ) ?>">?</a>
|
118 |
+
<strong><label for="<?php echo $this->get_field_id( 'days_old' ) ?>"
|
119 |
+
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>
|
120 |
+
<input type="number" name="<?php echo $this->get_field_name( 'days_old' ) ?>"
|
121 |
+
id="<?php echo $this->get_field_id( 'days_old' ) ?>" value="<?php echo $config->days_old; ?>"><br>
|
122 |
+
</fieldset>
|
123 |
+
|
124 |
+
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-terms' ) ?>">
|
125 |
+
<legend></legend>
|
126 |
+
|
127 |
+
<a class="utcw-help" title="<?php _e( 'This setting controls how the tag cloud should handle the selected terms. If the selected terms below should be the only ones included, or if the selected terms should be the ones being excluded from the result.', 'utcw' ) ?>">?</a>
|
128 |
+
<strong><?php _e( 'Selection type', 'utcw' ) ?></strong>
|
129 |
+
<br>
|
130 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
|
131 |
+
id="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"
|
132 |
+
value="include" <?php echo $config->tags_list_type == 'include' ? 'checked="checked" ' : ''; ?>>
|
133 |
+
<label
|
134 |
+
for="<?php echo $this->get_field_id( 'tags_list_type_include' ) ?>"><?php _e( 'Include only selected terms', 'utcw' ) ?></label>
|
135 |
+
<br>
|
136 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'tags_list_type' ) ?>"
|
137 |
+
id="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"
|
138 |
+
value="exclude" <?php echo $config->tags_list_type == 'exclude' ? 'checked="checked" ' : ''; ?>>
|
139 |
+
<label
|
140 |
+
for="<?php echo $this->get_field_id( 'tags_list_type_exclude' ) ?>"><?php _e( 'Exclude selected terms', 'utcw' ) ?></label>
|
141 |
+
|
142 |
+
<br>
|
143 |
+
<br>
|
144 |
+
<a class="utcw-help" title="<?php _e( 'Which tags to include or exclude', 'utcw' ) ?>">?</a>
|
145 |
+
<?php foreach ( $available_taxonomies as $taxonomy ) : ?>
|
146 |
+
|
147 |
+
<div id="<?php echo $taxonomy->name ?>-terms" <?php if ( $taxonomy->name != $config->taxonomy ) echo 'class="hidden"' ?>>
|
148 |
+
|
149 |
+
<strong><?php printf( __( 'Terms for taxonomy %s', 'utcw' ), $taxonomy->labels->name ) ?></strong>
|
150 |
+
|
151 |
+
<?php if ( isset( $terms[ $taxonomy->name ] ) ) : ?>
|
152 |
+
<ul>
|
153 |
+
<?php foreach ( $terms[ $taxonomy->name ] as $term ) : ?>
|
154 |
+
<li>
|
155 |
+
<label>
|
156 |
+
<input
|
157 |
+
type="checkbox"
|
158 |
+
name="<?php echo $this->get_field_name( 'tags_list' ) ?>[]"
|
159 |
+
value="<?php echo $term->term_id ?>"
|
160 |
+
<?php if ( in_array( $term->term_id, $config->tags_list ) ) echo 'checked="checked"' ?>>
|
161 |
+
<?php echo $term->name ?>
|
162 |
+
</label>
|
163 |
+
</li>
|
164 |
+
<?php endforeach ?>
|
165 |
+
</ul>
|
166 |
+
<?php else : ?>
|
167 |
+
<p><?php printf( __( 'No terms for taxonomy "%s"', 'utcw' ), $taxonomy->labels->name ) ?></p>
|
168 |
+
<?php endif ?>
|
169 |
+
|
170 |
+
</div>
|
171 |
+
|
172 |
+
<?php endforeach ?>
|
173 |
+
|
174 |
+
</fieldset>
|
175 |
+
|
176 |
+
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-basic-appearance' ) ?>">
|
177 |
+
<legend></legend>
|
178 |
+
<a class="utcw-help"
|
179 |
+
title="<?php _e( 'The title is the text which is shown above the tag cloud.', 'utcw' ) ?>">?</a>
|
180 |
+
<strong><label
|
181 |
+
for="<?php echo $this->get_field_id( 'title' );?>"><?php _e( 'Title:', 'utcw' ) ?></label></strong><br>
|
182 |
+
<input type="checkbox" id="<?php echo $this->get_field_id( 'show_title_text' ) ?>"
|
183 |
+
name="<?php echo $this->get_field_name( 'show_title_text' ) ?>" <?php if ( ! isset( $config->show_title_text ) || $config->show_title_text ) echo 'checked="checked"' ?>>
|
184 |
+
<label for="<?php echo $this->get_field_id( 'show_title_text' ) ?>"><?php _e( 'Show title', 'utcw' ) ?></label><br>
|
185 |
+
<input type="text" id="<?php echo $this->get_field_id( 'title' );?>"
|
186 |
+
name="<?php echo $this->get_field_name( 'title' );?>"
|
187 |
+
value="<?php echo $config->title ?>"><br>
|
188 |
+
<br>
|
189 |
+
|
190 |
+
<a class="utcw-help"
|
191 |
+
title="<?php _e( 'The tag with the least number of posts will be the smallest, and the tag with the most number of posts will be the biggest.', 'utcw' ) ?>">?</a>
|
192 |
+
<strong><?php _e( 'Tag size (in px):', 'utcw' ) ?></strong><br>
|
193 |
+
<label for="<?php echo $this->get_field_id( 'size_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
|
194 |
+
<input type="number" name="<?php echo $this->get_field_name( 'size_from' ) ?>"
|
195 |
+
id="<?php echo $this->get_field_id( 'size_from' ) ?>" size="3"
|
196 |
+
value="<?php echo $config->size_from ?>">
|
197 |
+
<label for="<?php echo $this->get_field_id( 'size_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
|
198 |
+
<input type="number" name="<?php echo $this->get_field_name( 'size_to' ) ?>"
|
199 |
+
id="<?php echo $this->get_field_id( 'size_to' ) ?>" size="3"
|
200 |
+
value="<?php echo $config->size_to ?>"><br>
|
201 |
+
<br>
|
202 |
+
|
203 |
+
<a class="utcw-help"
|
204 |
+
title="<?php _e( 'If the total number of tags exceeds this number, only this many tags will be shown in the cloud.', 'utcw' ) ?>">?</a>
|
205 |
+
<strong><label
|
206 |
+
for="<?php echo $this->get_field_id( 'max' ) ?>"><?php _e( 'Max tags:', 'utcw' ) ?></label></strong><br>
|
207 |
+
<input type="number" name="<?php echo $this->get_field_name( 'max' ) ?>"
|
208 |
+
id="<?php echo $this->get_field_id( 'max' ) ?>"
|
209 |
+
value="<?php echo $config->max ?>"><br>
|
210 |
+
<br>
|
211 |
+
|
212 |
+
<a class="utcw-help"
|
213 |
+
title="<?php _e( 'This setting controls how the tags are colored.<ul><li>Totaly random will choose between all the 16 million colors available.</li><li>Random from preset values will choose colors from a predefined set of colors</li><li>Spanning between values will calculate the corresponding color based upon how many posts each tag has, similar to how the size is calculated. The tag with the least number of posts will have the first color and the tag with the most number of posts will have the second color. All tags in between will have a color calculated between the first and the second color.</li></ul>The colors for the choice \'Random from preset values\' has to be specified as a comma separated list.', 'utcw' )?>">?</a>
|
214 |
+
<strong><?php _e( 'Coloring:', 'utcw' ) ?></strong><br>
|
215 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
|
216 |
+
id="<?php echo $this->get_field_id( 'color_none' ) ?>"
|
217 |
+
value="none" <?php echo $config->color == 'none' ? 'checked="checked"' : ''; ?>>
|
218 |
+
<label for="<?php echo $this->get_field_id( 'color_none' ) ?>"><?php _e( 'None', 'utcw' ) ?></label><br>
|
219 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
|
220 |
+
id="<?php echo $this->get_field_id( 'color_random' ) ?>"
|
221 |
+
value="random" <?php echo $config->color == 'random' ? 'checked="checked"' : ''; ?>>
|
222 |
+
<label for="<?php echo $this->get_field_id( 'color_random' ) ?>"><?php _e( 'Totally random', 'utcw' ) ?></label><br>
|
223 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
|
224 |
+
id="<?php echo $this->get_field_id( 'color_set' ) ?>"
|
225 |
+
value="set" <?php echo $config->color == 'set' ? 'checked="checked"' : ''; ?>>
|
226 |
+
<label
|
227 |
+
for="<?php echo $this->get_field_id( 'color_set' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label><br>
|
228 |
+
|
229 |
+
<div
|
230 |
+
id="<?php echo $this->get_field_id( 'set_chooser' ) ?>" <?php echo $config->color != 'set' ? 'class="utcw-hidden"' : ''; ?>>
|
231 |
+
<label class="screen-reader-text"
|
232 |
+
for="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>"><?php _e( 'Random from preset values', 'utcw' ) ?></label>
|
233 |
+
<input type="text" name="<?php echo $this->get_field_name( 'color_set' ) ?>"
|
234 |
+
id="<?php echo $this->get_field_id( 'color_set_chooser' ) ?>">
|
235 |
+
</div>
|
236 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'color' ) ?>"
|
237 |
+
id="<?php echo $this->get_field_id( 'color_span' ) ?>"
|
238 |
+
value="span" <?php echo $config->color == 'span' ? 'checked="checked"' : ''; ?>>
|
239 |
+
<label
|
240 |
+
for="<?php echo $this->get_field_id( 'color_span' ) ?>"><?php _e( 'Spanning between values', 'utcw' ) ?></label><br>
|
241 |
+
|
242 |
+
<div
|
243 |
+
id="<?php echo $this->get_field_id( 'span_chooser' ) ?>" <?php echo $config->color != 'span' ? 'class="utcw-hidden"' : ''; ?>>
|
244 |
+
<label for="<?php echo $this->get_field_id( 'color_span_from' ) ?>"><?php _e( 'From', 'utcw' ) ?></label>
|
245 |
+
<input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_from' ) ?>"
|
246 |
+
id="<?php echo $this->get_field_id( 'color_span_from' ) ?>" value="<?php echo $config->color_span_from ?>"><br>
|
247 |
+
|
248 |
+
<label for="<?php echo $this->get_field_id( 'color_span_to' ) ?>"><?php _e( 'to', 'utcw' ) ?></label>
|
249 |
+
<input type="text" size="7" name="<?php echo $this->get_field_name( 'color_span_to' ) ?>"
|
250 |
+
id="<?php echo $this->get_field_id( 'color_span_to' ) ?>" value="<?php echo $config->color_span_to ?>">
|
251 |
+
</div>
|
252 |
+
<br>
|
253 |
+
</fieldset>
|
254 |
+
|
255 |
+
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced-appearance' ) ?>">
|
256 |
+
<legend></legend>
|
257 |
+
<a class="utcw-help"
|
258 |
+
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>
|
259 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'show_title' ) ?>"
|
260 |
+
id="<?php echo $this->get_field_id( 'show_title' ) ?>" <?php echo $config->show_title === true ? 'checked="checked"' : ''?>>
|
261 |
+
<label for="<?php echo $this->get_field_id( 'show_title' ) ?>"
|
262 |
+
title="<?php _e( 'This is a title', 'utcw' ) ?>"><?php _e( 'Show title (hover text)', 'utcw' ) ?></label><br>
|
263 |
+
<br>
|
264 |
+
|
265 |
+
<a class="utcw-help"
|
266 |
+
title="<?php _e( 'The spacing is a numerical value which controls how much space there is between letters, words, tags or rows. To use the default value for these settings just use the corresponding default value from the CSS specification: <ul><li>Letter spacing: normal</li><li>Word spacing: normal</li><li>Tag spacing (CSS margin): auto</li><li>Row spacing (CSS line height): inherit</li></ul>To use anything but the default values, just specify a number (the unit is pixels).', 'utcw' ) ?>">?</a>
|
267 |
+
<strong><?php _e( 'Spacing (in px):', 'utcw' ) ?></strong><br>
|
268 |
+
<label class="two-col"
|
269 |
+
for="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"><?php _e( 'Between letters:', 'utcw' ) ?></label>
|
270 |
+
<input type="text" size="5" name="<?php echo $this->get_field_name( 'letter_spacing' ) ?>"
|
271 |
+
id="<?php echo $this->get_field_id( 'letter_spacing' ) ?>"
|
272 |
+
value="<?php echo $config->letter_spacing ?>"><br>
|
273 |
+
<label class="two-col"
|
274 |
+
for="<?php echo $this->get_field_id( 'word_spacing' ) ?>"><?php _e( 'Between words:', 'utcw' ) ?></label>
|
275 |
+
<input type="text" size="5" name="<?php echo $this->get_field_name( 'word_spacing' ) ?>"
|
276 |
+
id="<?php echo $this->get_field_id( 'word_spacing' ) ?>"
|
277 |
+
value="<?php echo $config->word_spacing ?>"><br>
|
278 |
+
<label class="two-col"
|
279 |
+
for="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"><?php _e( 'Between tags:', 'utcw' ) ?></label>
|
280 |
+
<input type="text" size="5" name="<?php echo $this->get_field_name( 'tag_spacing' ) ?>"
|
281 |
+
id="<?php echo $this->get_field_id( 'tag_spacing' ) ?>"
|
282 |
+
value="<?php echo $config->tag_spacing ?>"><br>
|
283 |
+
<label class="two-col"
|
284 |
+
for="<?php echo $this->get_field_id( 'line_height' ) ?>"><?php _e( 'Between rows:', 'utcw' ) ?></label>
|
285 |
+
<input type="text" size="5" name="<?php echo $this->get_field_name( 'line_height' ) ?>"
|
286 |
+
id="<?php echo $this->get_field_id( 'line_height' ) ?>"
|
287 |
+
value="<?php echo $config->line_height ?>"><br>
|
288 |
+
<br>
|
289 |
+
|
290 |
+
<a class="utcw-help"
|
291 |
+
title="<?php _e( 'The tags can be transformed in a number of different ways. lowercase, UPPERCASE or Capitalized.', 'utcw' )?>">?</a>
|
292 |
+
<strong><?php _e( 'Transform tags:', 'utcw' ) ?></strong><br>
|
293 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
|
294 |
+
id="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"
|
295 |
+
value="off" <?php echo $config->text_transform == 'off' ? 'checked="checked"' : ''; ?>>
|
296 |
+
<label for="<?php echo $this->get_field_id( 'text_transform_off' ) ?>"><?php _e( 'Off', 'utcw' ) ?></label><br>
|
297 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
|
298 |
+
id="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"
|
299 |
+
value="lowercase" <?php echo $config->text_transform == 'lowercase' ? ' checked="checked"' : ''; ?>>
|
300 |
+
<label
|
301 |
+
for="<?php echo $this->get_field_id( 'text_transform_lowercase' ) ?>"><?php _e( 'To lowercase', 'utcw' ) ?></label><br>
|
302 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
|
303 |
+
id="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"
|
304 |
+
value="uppercase" <?php echo $config->text_transform == 'uppercase' ? ' checked="checked"' : ''; ?>>
|
305 |
+
<label
|
306 |
+
for="<?php echo $this->get_field_id( 'text_transform_uppercase' ) ?>"><?php _e( 'To uppercase', 'utcw' ) ?></label><br>
|
307 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'text_transform' ) ?>"
|
308 |
+
id="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"
|
309 |
+
value="capitalize" <?php echo $config->text_transform == 'capitalize' ? ' checked="checked"' : ''; ?>>
|
310 |
+
<label
|
311 |
+
for="<?php echo $this->get_field_id( 'text_transform_capitalize' ) ?>"><?php _e( 'Capitalize', 'utcw' ) ?></label><br>
|
312 |
+
<br>
|
313 |
+
|
314 |
+
<a class="utcw-help"
|
315 |
+
title="<?php _e( 'The tags can be surrounded by a prefix and/or suffix and separated with a separator. The default separator is just a space but can be changed to anything you\'d like. Remember to add a space before and after the separator, this is not automatically added by the plugin.<br><br>A short example, these settings:<ul><li>Separator: - </li><li>Prefix: (</li><li>Suffix: )</li></ul>… would produce a tag cloud like this: <br><br>(first tag) - (second tag) - (third tag)<br><br>Prefix and suffix characters will have the same size and color as the tag, but the separator will not.', 'utcw' ) ?>">?</a>
|
316 |
+
<strong><?php _e( 'Tag separators:', 'utcw' )?></strong>
|
317 |
+
<label class="two-col"
|
318 |
+
for="<?php echo $this->get_field_id( 'separator' ) ?>"><?php _e( 'Separator', 'utcw' ) ?></label>
|
319 |
+
<input type="text" size=5 name="<?php echo $this->get_field_name( 'separator' ) ?>"
|
320 |
+
id="<?php echo $this->get_field_id( 'separator' ) ?>"
|
321 |
+
value="<?php echo $config->separator ?>"><br>
|
322 |
+
<label class="two-col" for="<?php echo $this->get_field_id( 'prefix' ) ?>"><?php _e( 'Prefix', 'utcw' ) ?></label>
|
323 |
+
<input type="text" size=5 name="<?php echo $this->get_field_name( 'prefix' ) ?>"
|
324 |
+
id="<?php echo $this->get_field_id( 'prefix' ) ?>"
|
325 |
+
value="<?php echo $config->prefix ?>"><br>
|
326 |
+
<label class="two-col" for="<?php echo $this->get_field_id( 'suffix' ) ?>"><?php _e( 'Suffix', 'utcw' ) ?></label>
|
327 |
+
<input type="text" size=5 name="<?php echo $this->get_field_name( 'suffix' ) ?>"
|
328 |
+
id="<?php echo $this->get_field_id( 'suffix' ) ?>"
|
329 |
+
value="<?php echo $config->suffix ?>"><br>
|
330 |
+
|
331 |
+
</fieldset>
|
332 |
+
|
333 |
+
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-links' ) ?>">
|
334 |
+
<legend></legend>
|
335 |
+
|
336 |
+
<a class="utcw-help"
|
337 |
+
title="<?php _e( 'The normal styles will apply to the tags when the user is <b>not</b> hovering the link.', 'utcw' )?>">?</a>
|
338 |
+
|
339 |
+
<h3><?php _e( 'Normal styles', 'utcw' ) ?></h3>
|
340 |
+
<a class="utcw-help"
|
341 |
+
title="<?php _e( 'Yes or no will force the tag setting for the <u>underline</u> style, theme default will let the blog theme decide.', 'utcw' ) ?>">?</a>
|
342 |
+
<strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
|
343 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
|
344 |
+
id="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"
|
345 |
+
value="yes" <?php echo $config->link_underline == 'yes' ? ' checked="checked"' : '' ?>>
|
346 |
+
<label for="<?php echo $this->get_field_id( 'link_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
347 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
|
348 |
+
id="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"
|
349 |
+
value="no" <?php echo $config->link_underline == 'no' ? ' checked="checked"' : '' ?>>
|
350 |
+
<label for="<?php echo $this->get_field_id( 'link_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
351 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_underline' ) ?>"
|
352 |
+
id="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"
|
353 |
+
value="default" <?php echo $config->link_underline == 'default' ? ' checked="checked"' : '' ?>>
|
354 |
+
<label
|
355 |
+
for="<?php echo $this->get_field_id( 'link_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
356 |
+
<br>
|
357 |
+
|
358 |
+
<a class="utcw-help"
|
359 |
+
title="<?php _e( 'Yes or no will force the tag setting for the <b>bold</b> style, theme default will let the blog theme decide.', 'utcw' ) ?>">?</a>
|
360 |
+
<strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
|
361 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
|
362 |
+
id="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"
|
363 |
+
value="yes" <?php echo $config->link_bold == 'yes' ? ' checked="checked"' : '' ?>>
|
364 |
+
<label for="<?php echo $this->get_field_id( 'link_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
365 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
|
366 |
+
id="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"
|
367 |
+
value="no" <?php echo $config->link_bold == 'no' ? ' checked="checked"' : '' ?>>
|
368 |
+
<label for="<?php echo $this->get_field_id( 'link_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
369 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_bold' ) ?>"
|
370 |
+
id="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"
|
371 |
+
value="default" <?php echo $config->link_bold == 'default' ? ' checked="checked"' : '' ?>>
|
372 |
+
<label for="<?php echo $this->get_field_id( 'link_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
373 |
+
<br>
|
374 |
+
|
375 |
+
<a class="utcw-help"
|
376 |
+
title="<?php _e( 'Yes or no will force the tag setting for the <i>italic</i> style, theme default will let the blog theme decide.', 'utcw' ) ?>">?</a>
|
377 |
+
<strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
|
378 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
|
379 |
+
id="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"
|
380 |
+
value="yes" <?php echo $config->link_italic == 'yes' ? ' checked="checked"' : '' ?>>
|
381 |
+
<label for="<?php echo $this->get_field_id( 'link_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
382 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
|
383 |
+
id="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"
|
384 |
+
value="no" <?php echo $config->link_italic == 'no' ? ' checked="checked"' : '' ?>>
|
385 |
+
<label for="<?php echo $this->get_field_id( 'link_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
386 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'link_italic' ) ?>"
|
387 |
+
id="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"
|
388 |
+
value="default" <?php echo $config->link_italic == 'default' ? ' checked="checked"' : '' ?>>
|
389 |
+
<label
|
390 |
+
for="<?php echo $this->get_field_id( 'link_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
391 |
+
<br>
|
392 |
+
|
393 |
+
<a class="utcw-help"
|
394 |
+
title="<?php _e( 'This setting will change the background color of <b>the link only</b>, not the whole cloud. The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black.', 'utcw' ) ?>">?</a>
|
395 |
+
<strong><label
|
396 |
+
for="<?php echo $this->get_field_id( 'link_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
|
397 |
+
<input type="text" name="<?php echo $this->get_field_name( 'link_bg_color' ) ?>"
|
398 |
+
id="<?php echo $this->get_field_id( 'link_bg_color' ) ?>" value="<?php echo $config->link_bg_color ?>"><br>
|
399 |
+
<br>
|
400 |
+
|
401 |
+
<a class="utcw-help"
|
402 |
+
title="<?php _e( 'This setting will change the border of <b>the link only</b>, not the whole cloud. <ul><li>The width of the border is a numerical value (in the unit pixels).</li><li>The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black.</li></ul>', 'utcw' ) ?>">?</a>
|
403 |
+
<strong><?php _e( 'Border', 'utcw' ) ?></strong><br>
|
404 |
+
<label for="<?php echo $this->get_field_id( 'link_border_style' ) ?>"><?php _e( 'Style: ', 'utcw' ) ?></label><br>
|
405 |
+
<select name="<?php echo $this->get_field_name( 'link_border_style' ) ?>"
|
406 |
+
id="<?php echo $this->get_field_id( 'link_border_style' ) ?>">
|
407 |
+
<option
|
408 |
+
value="none" <?php echo $config->link_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
|
409 |
+
<option
|
410 |
+
value="dotted" <?php echo $config->link_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
|
411 |
+
<option
|
412 |
+
value="dashed" <?php echo $config->link_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
|
413 |
+
<option
|
414 |
+
value="solid" <?php echo $config->link_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
|
415 |
+
<option
|
416 |
+
value="double" <?php echo $config->link_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
|
417 |
+
<option
|
418 |
+
value="groove" <?php echo $config->link_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
|
419 |
+
<option
|
420 |
+
value="ridge" <?php echo $config->link_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
|
421 |
+
<option
|
422 |
+
value="inset" <?php echo $config->link_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
|
423 |
+
<option
|
424 |
+
value="outset" <?php echo $config->link_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
|
425 |
+
</select><br>
|
426 |
+
<br>
|
427 |
+
<label
|
428 |
+
for="<?php echo $this->get_field_id( 'link_border_width' ) ?>"><?php _e( 'Width (in px):', 'utcw' ) ?></label><br>
|
429 |
+
<input type="number" name="<?php echo $this->get_field_name( 'link_border_width' ) ?>"
|
430 |
+
id="<?php echo $this->get_field_id( 'link_border_width' ) ?>" value="<?php echo $config->link_border_width ?>"><br>
|
431 |
+
<br>
|
432 |
+
<label
|
433 |
+
for="<?php echo $this->get_field_id( 'link_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
|
434 |
+
<input type="text" name="<?php echo $this->get_field_name( 'link_border_color' ) ?>"
|
435 |
+
id="<?php echo $this->get_field_id( 'link_border_color' ) ?>" value="<?php echo $config->link_border_color ?>"><br>
|
436 |
+
|
437 |
+
<a class="utcw-help"
|
438 |
+
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>
|
439 |
+
|
440 |
+
<h3><?php _e( 'Hover effects', 'utcw' ) ?></h3>
|
441 |
+
<strong><?php _e( 'Underline', 'utcw' ) ?></strong><br>
|
442 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
|
443 |
+
id="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"
|
444 |
+
value="yes" <?php echo $config->hover_underline == 'yes' ? ' checked="checked"' : '' ?>>
|
445 |
+
<label for="<?php echo $this->get_field_id( 'hover_underline_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
446 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
|
447 |
+
id="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"
|
448 |
+
value="no" <?php echo $config->hover_underline == 'no' ? ' checked="checked"' : '' ?>>
|
449 |
+
<label for="<?php echo $this->get_field_id( 'hover_underline_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
450 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_underline' ) ?>"
|
451 |
+
id="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"
|
452 |
+
value="default" <?php echo $config->hover_underline == 'default' ? ' checked="checked"' : '' ?>>
|
453 |
+
<label
|
454 |
+
for="<?php echo $this->get_field_id( 'hover_underline_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
455 |
+
<br>
|
456 |
+
<strong><?php _e( 'Bold', 'utcw' ) ?></strong><br>
|
457 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
|
458 |
+
id="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"
|
459 |
+
value="yes" <?php echo $config->hover_bold == 'yes' ? ' checked="checked"' : '' ?>>
|
460 |
+
<label for="<?php echo $this->get_field_id( 'hover_bold_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
461 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
|
462 |
+
id="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"
|
463 |
+
value="no" <?php echo $config->hover_bold == 'no' ? ' checked="checked"' : '' ?>>
|
464 |
+
<label for="<?php echo $this->get_field_id( 'hover_bold_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
465 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_bold' ) ?>"
|
466 |
+
id="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"
|
467 |
+
value="default" <?php echo $config->hover_bold == 'default' ? ' checked="checked"' : '' ?>>
|
468 |
+
<label
|
469 |
+
for="<?php echo $this->get_field_id( 'hover_bold_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
470 |
+
<br>
|
471 |
+
<strong><?php _e( 'Italic', 'utcw' ) ?></strong><br>
|
472 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
|
473 |
+
id="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"
|
474 |
+
value="yes" <?php echo $config->hover_italic == 'yes' ? ' checked="checked"' : '' ?>>
|
475 |
+
<label for="<?php echo $this->get_field_id( 'hover_italic_yes' ) ?>"><?php _e( 'Yes', 'utcw' ) ?></label><br>
|
476 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
|
477 |
+
id="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"
|
478 |
+
value="no" <?php echo $config->hover_italic == 'no' ? ' checked="checked"' : '' ?>>
|
479 |
+
<label for="<?php echo $this->get_field_id( 'hover_italic_no' ) ?>"><?php _e( 'No', 'utcw' ) ?></label><br>
|
480 |
+
<input type="radio" name="<?php echo $this->get_field_name( 'hover_italic' ) ?>"
|
481 |
+
id="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"
|
482 |
+
value="default" <?php echo $config->hover_italic == 'default' ? ' checked="checked"' : '' ?>>
|
483 |
+
<label
|
484 |
+
for="<?php echo $this->get_field_id( 'hover_italic_default' ) ?>"><?php _e( 'Theme default', 'utcw' ) ?></label><br>
|
485 |
+
<br>
|
486 |
+
<strong><label
|
487 |
+
for="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>"><?php _e( 'Background color (hex value):', 'utcw' ) ?></label></strong><br>
|
488 |
+
<input type="text" name="<?php echo $this->get_field_name( 'hover_bg_color' ) ?>"
|
489 |
+
id="<?php echo $this->get_field_id( 'hover_bg_color' ) ?>" value="<?php echo $config->hover_bg_color ?>"><br>
|
490 |
+
<br>
|
491 |
+
<strong><label
|
492 |
+
for="<?php echo $this->get_field_id( 'hover_color' ) ?>"><?php _e( 'Font color (hex value):', 'utcw' ) ?></label></strong><br>
|
493 |
+
<input type="text" name="<?php echo $this->get_field_name( 'hover_color' ) ?>"
|
494 |
+
id="<?php echo $this->get_field_id( 'hover_color' ) ?>" value="<?php echo $config->hover_color ?>"><br>
|
495 |
+
<br>
|
496 |
+
<strong><?php _e( 'Border', 'utcw' ) ?></strong><br>
|
497 |
+
<label for="<?php echo $this->get_field_id( 'hover_border_style' ) ?>"><?php _e( 'Style: ', 'utcw' ) ?></label><br>
|
498 |
+
<select name="<?php echo $this->get_field_name( 'hover_border_style' ) ?>"
|
499 |
+
id="<?php echo $this->get_field_id( 'hover_border_style' ) ?>">
|
500 |
+
<option
|
501 |
+
value="none" <?php echo $config->hover_border_style == 'none' ? 'selected="selected"' : '' ?>><?php _e( 'None', 'utcw' ) ?></option>
|
502 |
+
<option
|
503 |
+
value="dotted" <?php echo $config->hover_border_style == 'dotted' ? 'selected="selected"' : '' ?>><?php _e( 'Dotted', 'utcw' ) ?></option>
|
504 |
+
<option
|
505 |
+
value="dashed" <?php echo $config->hover_border_style == 'dashed' ? 'selected="selected"' : '' ?>><?php _e( 'Dashed', 'utcw' ) ?></option>
|
506 |
+
<option
|
507 |
+
value="solid" <?php echo $config->hover_border_style == 'solid' ? 'selected="selected"' : '' ?>><?php _e( 'Solid', 'utcw' ) ?></option>
|
508 |
+
<option
|
509 |
+
value="double" <?php echo $config->hover_border_style == 'double' ? 'selected="selected"' : '' ?>><?php _e( 'Double', 'utcw' ) ?></option>
|
510 |
+
<option
|
511 |
+
value="groove" <?php echo $config->hover_border_style == 'groove' ? 'selected="selected"' : '' ?>><?php _e( 'Groove', 'utcw' ) ?></option>
|
512 |
+
<option
|
513 |
+
value="ridge" <?php echo $config->hover_border_style == 'rigde' ? 'selected="selected"' : '' ?>><?php _e( 'Ridge', 'utcw' ) ?></option>
|
514 |
+
<option
|
515 |
+
value="inset" <?php echo $config->hover_border_style == 'inset' ? 'selected="selected"' : '' ?>><?php _e( 'Inset', 'utcw' ) ?></option>
|
516 |
+
<option
|
517 |
+
value="outset" <?php echo $config->hover_border_style == 'outset' ? 'selected="selected"' : '' ?>><?php _e( 'Outset', 'utcw' ) ?></option>
|
518 |
+
</select><br>
|
519 |
+
<br>
|
520 |
+
<label
|
521 |
+
for="<?php echo $this->get_field_id( 'hover_border_width' ) ?>"><?php _e( 'Width (in px):', 'utcw' ) ?></label><br>
|
522 |
+
<input type="number" name="<?php echo $this->get_field_name( 'hover_border_width' ) ?>"
|
523 |
+
id="<?php echo $this->get_field_id( 'hover_border_width' ) ?>" value="<?php echo $config->hover_border_width ?>"><br>
|
524 |
+
<br>
|
525 |
+
<label
|
526 |
+
for="<?php echo $this->get_field_id( 'hover_border_color' ) ?>"><?php _e( 'Color (hex value): ', 'utcw' ) ?></label><br>
|
527 |
+
<input type="text" name="<?php echo $this->get_field_name( 'hover_border_color' ) ?>"
|
528 |
+
id="<?php echo $this->get_field_id( 'hover_border_color' ) ?>" value="<?php echo $config->hover_border_color ?>"><br>
|
529 |
+
</fieldset>
|
530 |
+
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id( 'utcw-tab-advanced' ) ?>">
|
531 |
+
<legend></legend>
|
532 |
+
<a class="utcw-help"
|
533 |
+
title="<?php _e( 'This will add a <-- HTML comment --> 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>
|
534 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'debug' ) ?>"
|
535 |
+
id="<?php echo $this->get_field_id( 'debug' ) ?>" <?php echo ( $config->debug === true ) ? 'checked="checked"' : '' ?>>
|
536 |
+
<label for="<?php echo $this->get_field_id( 'debug' ) ?>"><?php _e( 'Include debug output', 'utcw' )?></label><br>
|
537 |
+
<br>
|
538 |
+
<a class="utcw-help"
|
539 |
+
title="<?php _e( 'This will save the current configuration which enables you to load this configuration at a later time. Check this box, choose a name in the text field below and press \'Save\' to save the configuration.', 'utcw' ) ?>">?</a>
|
540 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'save_config' ) ?>"
|
541 |
+
id="<?php echo $this->get_field_id( 'save_config' ) ?>">
|
542 |
+
<label
|
543 |
+
for="<?php echo $this->get_field_id( 'save_config' ) ?>"><?php _e( 'Save configuration', 'utcw' ) ?></label><br>
|
544 |
+
<br>
|
545 |
+
<a class="utcw-help"
|
546 |
+
title="<?php _e( 'This is the name which will be used for the current configuration if you check the option \'Save configuration\' above. If the name is omitted the current date and time will be used.', 'utcw' ) ?>">?</a>
|
547 |
+
<label
|
548 |
+
for="<?php echo $this->get_field_id( 'save_config_name' ) ?>"><?php _e( 'Configuration name', 'utcw' ) ?></label><br>
|
549 |
+
<input type="text" name="<?php echo $this->get_field_name( 'save_config_name' ) ?>"
|
550 |
+
id="<?php echo $this->get_field_id( 'save_config_name' ) ?>"
|
551 |
+
value="<?php echo date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ?>"><br>
|
552 |
+
<br>
|
553 |
+
|
554 |
+
<?php if ( $configurations !== false && is_array( $configurations ) && count( $configurations ) > 0 ) : ?>
|
555 |
+
|
556 |
+
<a class="utcw-help"
|
557 |
+
title="<?php _e( 'This will load the selected configuration to the state which the widget was when the configuration was saved.', 'utcw' ) ?>">?</a>
|
558 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'load_config' ) ?>"
|
559 |
+
id="<?php echo $this->get_field_id( 'load_config' ) ?>">
|
560 |
+
<label for="<?php echo $this->get_field_id( 'load_config' ) ?>"><?php _e( 'Load configuration', 'utcw' ) ?></label>
|
561 |
+
<br>
|
562 |
+
<br>
|
563 |
+
<label
|
564 |
+
for="<?php echo $this->get_field_id( 'load_config_name' ) ?>"><?php _e( 'Configuration name', 'utcw' ) ?></label>
|
565 |
+
<br>
|
566 |
+
<select name="<?php echo $this->get_field_name( 'load_config_name' ) ?>"
|
567 |
+
id="<?php echo $this->get_field_id( 'load_config_name' ) ?>">
|
568 |
+
|
569 |
+
<?php foreach ( $configurations as $name => $config ) : ?>
|
570 |
+
<option value="<?php echo $name ?>"><?php echo $name ?></option>
|
571 |
+
<?php endforeach ?>
|
572 |
+
|
573 |
+
</select>
|
574 |
+
|
575 |
+
<?php endif ?>
|
576 |
+
|
577 |
+
</fieldset>
|
readme.txt
CHANGED
@@ -1,36 +1,25 @@
|
|
1 |
=== Ultimate Tag Cloud Widget ===
|
2 |
Contributors: exz
|
3 |
Tags: widget, tags, configurable, tag cloud
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 3.
|
6 |
Stable tag: 1.3.17
|
7 |
Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
|
|
|
8 |
|
9 |
This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
This is the highly configurable tag cloud widget,
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
* Minimum amount of posts for tags to be included
|
23 |
-
* Number of days back to search for posts
|
24 |
-
* Title
|
25 |
-
* Size and color customization
|
26 |
-
* Max amount of tags in your cloud
|
27 |
-
* Spacing between tags, letters, words and rows
|
28 |
-
* Transform tags into lowercase, uppercase or Capitalize them
|
29 |
-
* Fully internationalized and translated into two languages
|
30 |
-
* Separator, suffix and prefix for the tags
|
31 |
-
* Load/save configuration
|
32 |
-
|
33 |
-
This plugin is under active development and my goal is to try to help everyone who have issues or suggestions for this plugin. If you have issues please post them in the forums, if you have suggestions most people use the comment system on my blog at http://0x539.se/wordpress/ultimate-tag-cloud-widget/. You're also always welcome to contact me by e-mail or Google Talk; rickard at 0x539.se
|
34 |
|
35 |
== Installation ==
|
36 |
|
@@ -43,283 +32,72 @@ This is the same procedure as with all ordinary plugins.
|
|
43 |
|
44 |
All the configuration options is set individually in every instance. Some default values are set if you're unsure on how to configure it.
|
45 |
|
46 |
-
If your theme doesn't use widgets, you can still use it in your theme by calling the function do_utcw()
|
47 |
|
48 |
== Frequently Asked Questions ==
|
49 |
|
50 |
-
|
51 |
|
52 |
== Screenshots ==
|
53 |
|
54 |
1. This shows my widget with the default settings on the default wordpress theme.
|
55 |
-
2. This is a more colorful example with random colors and all tags in uppercase. I'd like to actually see someone use it like this.
|
56 |
-
3. Maybe a more realistic usage of the widget with spanning colors and capitalized tags.
|
57 |
4. The settings page of the widget
|
58 |
|
59 |
== Changelog ==
|
60 |
|
61 |
-
=
|
62 |
-
* Removed the static wp-content/plugins path for assets
|
63 |
-
|
64 |
-
= 1.3.16 =
|
65 |
-
* Bug fix; fixes problem with saving "Random from preset values" setting
|
66 |
-
|
67 |
-
= 1.3.15 =
|
68 |
-
* Bux fix; removed jquery 1.7.x dependent functions
|
69 |
-
|
70 |
-
= 1.3.14 =
|
71 |
-
* Bug fix; tag cloud showed up empty after update from 1.3.12
|
72 |
-
|
73 |
-
= 1.3.13 =
|
74 |
-
* Added setting to hide the title of the widget
|
75 |
-
* Custom post type support, replaces page tagging feature
|
76 |
-
* Internal optimizations and improved code quality
|
77 |
-
|
78 |
-
= 1.3.12 =
|
79 |
-
* Fixed bug which made the default "data" tab disappear when adding the widget to a sidebar
|
80 |
-
* Added setting for link hover font color
|
81 |
-
* Added option to save or load configuration
|
82 |
-
|
83 |
-
= 1.3.11 =
|
84 |
-
* Proper namespacing of the CSS classes to prevent interference with other plugins
|
85 |
-
|
86 |
-
= 1.3.10 =
|
87 |
-
|
88 |
-
* Fixed shortcode problem where the content would appear at the top of a post/page instead of where the shortcode was placed.
|
89 |
-
* Fixed shortcode problem where you couldn't possibly enter some values as array types, now accepting a comma separated list for $tags_list, $color_set and $authors
|
90 |
-
* Updated spelling error in the documentation which caused some confusion
|
91 |
-
|
92 |
-
= 1.3.9 =
|
93 |
-
|
94 |
-
* Added shortcode [utcw]
|
95 |
-
|
96 |
-
= 1.3.8 =
|
97 |
-
|
98 |
-
* Improved the tabbed settings when using multiple tag clouds
|
99 |
-
* Improved the tabbed settings so that the same tab is reloaded after saving the settings
|
100 |
-
* Updated screenshot
|
101 |
-
* Bugfix; The help texts now also shows after saving the settings
|
102 |
-
* Added a setting for separator, prefix and suffix
|
103 |
-
|
104 |
-
= 1.3.7 =
|
105 |
-
|
106 |
-
* Added more detailed descriptions of all the settings
|
107 |
-
* Added the tabs for the sections in the widget settings
|
108 |
-
* Switched from deprecated function get_users_of_blog() to get_users() for WP 3.1+
|
109 |
-
|
110 |
-
= 1.3.6 =
|
111 |
-
|
112 |
-
* Added a setting for row spacing
|
113 |
-
* Added a setting for post age
|
114 |
-
|
115 |
-
= 1.3.5 =
|
116 |
-
|
117 |
-
* Now also showing private posts when signed in.
|
118 |
|
119 |
-
|
|
|
120 |
|
121 |
-
|
122 |
-
* Added a setting for including debug information to help troubleshooting
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
* Added new styling options upon requests from the forum
|
127 |
-
* Testing out the new HTML5 input type "number" in the settings form
|
128 |
-
|
129 |
-
= 1.3.2 =
|
130 |
-
|
131 |
-
* Fixed bug in the SQL query making the plugin also count posts that isn't published
|
132 |
-
* Added a new option to set the minimum amount of posts a tag should have to be included
|
133 |
-
|
134 |
-
= 1.3.1 =
|
135 |
-
|
136 |
-
* Added Swedish translation
|
137 |
-
* Minor internationalization changes
|
138 |
-
|
139 |
-
= 1.3 =
|
140 |
-
|
141 |
-
* As requested, support for calling a function to display the widget was added. Se other notes for information on how to use it.
|
142 |
-
* Javascript changes in order to fix problems with the options page in WP 3.1 beta 1
|
143 |
-
|
144 |
-
= 1.2 =
|
145 |
-
|
146 |
-
* Removed all the PHP short tags
|
147 |
-
* Can now sort by name, slug, id or color (!) case sensitive or case insensitive
|
148 |
-
* Exclude now takes either tag name or id
|
149 |
-
|
150 |
-
= 1.1 =
|
151 |
-
|
152 |
-
* Fixed bug with options page
|
153 |
-
* Improved link generation to create correct tag links
|
154 |
-
|
155 |
-
= 1.0 =
|
156 |
-
|
157 |
-
* Initial release
|
158 |
|
159 |
== Upgrade Notice ==
|
160 |
|
161 |
-
=
|
162 |
-
|
163 |
-
* Removed the static wp-content/plugins path for assets
|
164 |
-
|
165 |
-
= 1.3.16 =
|
166 |
-
|
167 |
-
* Bug fix; fixes problem with saving "Random from preset values" setting
|
168 |
-
|
169 |
-
= 1.3.15 =
|
170 |
-
|
171 |
-
* Bug fix; fixes problems with javascript errors on widgets page
|
172 |
-
|
173 |
-
= 1.3.14 =
|
174 |
|
175 |
-
*
|
176 |
-
|
177 |
-
= 1.3.13 =
|
178 |
-
|
179 |
-
* New features and internal optimizations and improvements
|
180 |
-
|
181 |
-
= 1.3.12 =
|
182 |
-
|
183 |
-
* Minor bug fix and added support for saving/loading configurations.
|
184 |
-
|
185 |
-
= 1.3.11 =
|
186 |
-
|
187 |
-
* Minor CSS fix
|
188 |
-
|
189 |
-
= 1.3.10 =
|
190 |
-
|
191 |
-
* Some shortcode bugfixes
|
192 |
-
|
193 |
-
= 1.3.9 =
|
194 |
-
|
195 |
-
* Added shortcode
|
196 |
-
|
197 |
-
= 1.3.8 =
|
198 |
-
|
199 |
-
* Minor bug fixes from previous version
|
200 |
-
* Added separator, prefix and suffix settings
|
201 |
-
|
202 |
-
= 1.3.7 =
|
203 |
-
|
204 |
-
* Removed deprecated function get_users_of_blog() for WP 3.1+
|
205 |
-
|
206 |
-
= 1.3.6 =
|
207 |
-
|
208 |
-
* Added two new features; post age and row spacing
|
209 |
-
|
210 |
-
= 1.3.5 =
|
211 |
-
|
212 |
-
* Now also showing private posts when signed in.
|
213 |
-
|
214 |
-
= 1.3.4 =
|
215 |
-
|
216 |
-
Support for page tagging and an option for debug information
|
217 |
-
|
218 |
-
= 1.3.3 =
|
219 |
-
|
220 |
-
* New styling options added
|
221 |
-
|
222 |
-
= 1.3.2 =
|
223 |
-
|
224 |
-
* Small bug fix in the SQL-query and a new option added
|
225 |
-
|
226 |
-
= 1.3.1 =
|
227 |
-
|
228 |
-
* Added Swedish translateion
|
229 |
-
|
230 |
-
= 1.3 =
|
231 |
-
|
232 |
-
* Support for integrating the widget within your theme added.
|
233 |
-
* New javascript fixing problem with options page in WP 3.1 beta 1
|
234 |
-
|
235 |
-
= 1.1 and 1.2 =
|
236 |
-
|
237 |
-
* Just bug fixes, should be safe to upgrade.
|
238 |
-
|
239 |
-
= 1.0 =
|
240 |
-
|
241 |
-
* Initial release
|
242 |
|
243 |
== Feedback ==
|
244 |
|
245 |
-
This plugin is under active development and my goal is to try to help everyone who have issues or suggestions for this plugin. If you
|
246 |
|
247 |
My contact information is
|
248 |
|
249 |
* rickard (a) 0x539.se (email, gtalk, msn, you name it)
|
250 |
* [twitter.com/rickard2](http://twitter.com/rickard2)
|
251 |
|
|
|
|
|
252 |
== Theme integration / Shortcode ==
|
253 |
|
254 |
-
You can integrate the widget within your own theme even if you're not using standard
|
255 |
|
256 |
`<?php do_utcw($args); ?>`
|
257 |
|
258 |
-
...with
|
259 |
|
260 |
-
`<?php
|
261 |
$args = array( "title" => "Most awesome title ever" );
|
262 |
-
|
263 |
do_utcw( $args );`
|
264 |
|
265 |
-
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
|
266 |
-
|
267 |
-
`[utcw title="Most awesome title ever"]`
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
*
|
274 |
-
*
|
275 |
-
*
|
276 |
-
*
|
277 |
-
* size_to (integer)
|
278 |
-
* max (integer)
|
279 |
-
* reverse (boolean)
|
280 |
-
* authors (array of user IDs or CSV, integers)
|
281 |
-
* tags_list (array of taxonomies or CSV, IDs or names to be included or excluded)
|
282 |
-
* tags_list_type (include or exclude, defines how to handle the tag_list)
|
283 |
-
* minimum (integer)
|
284 |
-
* days_old (integer)
|
285 |
-
* color_set (array of hex colors or CSV, like #fff or #ffffff)
|
286 |
-
* letter_spacing (integer)
|
287 |
-
* word_spacing (integer)
|
288 |
-
* tag_spacing (integer)
|
289 |
-
* line_height (integer)
|
290 |
-
* color_span_from (hex color, like #fff or #ffffff)
|
291 |
-
* color_span_to (hex color, dito)
|
292 |
-
* case_sensitive (boolean)
|
293 |
-
* order (string, valid values: 'random', 'name', 'slug', 'id', 'color', 'count')
|
294 |
-
* taxonomy (string, valid values: 'post_tag', 'category')
|
295 |
-
* color (string, valid values: 'none', 'random', 'set', 'span')
|
296 |
-
* case (string, valid values: 'lowercase', 'uppercase', 'capitalize', 'off')
|
297 |
-
* show_title (boolean)
|
298 |
-
* link_bold (string, valid values: 'yes', 'no', 'default')
|
299 |
-
* link_underline (string, valid values: 'yes', 'no', 'default')
|
300 |
-
* link_italic (string, valid values: 'yes', 'no', 'default)
|
301 |
-
* link_bg_color (hex color)
|
302 |
-
* link_border_color (hex color)
|
303 |
-
* link_border_style (string, valid values: 'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset')
|
304 |
-
* link_border_width (integer)
|
305 |
-
* hover_bold (string, valid values: 'yes', 'no', 'default')
|
306 |
-
* hover_underline (string, valid values: 'yes', 'no', 'default')
|
307 |
-
* hover_italic (string, valid values: 'yes', 'no', 'default)
|
308 |
-
* hover_bg_color (hex color)
|
309 |
-
* hover_border_color (hex color)
|
310 |
-
* hover_border_style (string, valid values: 'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset')
|
311 |
-
* hover_border_width (integer)
|
312 |
-
* debug (boolean)
|
313 |
-
* separator (string)
|
314 |
-
* prefix (string)
|
315 |
-
* suffix (string)
|
316 |
-
* return (boolean)
|
317 |
-
* post_type (array)
|
318 |
-
* show_title_text (boolean)
|
319 |
-
|
320 |
-
All options are optional, default values can be found in the widget php file. Valid values for order, taxonomy, color and case can be found in the arrays $utcw_allowed_orders, taxonomys, colors and cases respectively. To send the boolean value `true` just use the string `"on"`.
|
321 |
-
|
322 |
-
Good luck and remember to give me feedback if you run into any problems
|
323 |
|
324 |
== Thanks ==
|
325 |
|
1 |
=== Ultimate Tag Cloud Widget ===
|
2 |
Contributors: exz
|
3 |
Tags: widget, tags, configurable, tag cloud
|
4 |
+
Requires at least: 3.0
|
5 |
+
Tested up to: 3.5 beta2
|
6 |
Stable tag: 1.3.17
|
7 |
Donate link: https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget
|
8 |
+
License: GPLv2 or later
|
9 |
|
10 |
This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
This is the highly configurable tag cloud widget, the main features for this plugin is:
|
15 |
+
|
16 |
+
- All, single author or multiple authors per cloud
|
17 |
+
- Select which taxonomies or post types to show tags for
|
18 |
+
- Rules for which posts to include when fetching tags
|
19 |
+
- Inclusion/exclusion functions
|
20 |
+
- A bunch of ordering, coloring and styling options
|
21 |
+
|
22 |
+
This plugin is under active development and my goal is to try to help everyone who have issues or suggestions for this plugin. If you find bugs or have feature requests please use [GitHub issues](https://github.com/rickard2/utcw/issues), if you need support please use the [WordPress forums](http://wordpress.org/support/plugin/ultimate-tag-cloud-widget). You're also always welcome to contact me by e-mail or Google Talk; rickard at 0x539.se
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
== Installation ==
|
25 |
|
32 |
|
33 |
All the configuration options is set individually in every instance. Some default values are set if you're unsure on how to configure it.
|
34 |
|
35 |
+
If your theme doesn't use widgets, you can still use it in your theme by calling the function `do_utcw()` or by using the shortcode `[do_utcw]`. See [Other Notes](http://wordpress.org/extend/plugins/ultimate-tag-cloud-widget/other_notes/#Theme-integration-/-Shortcode) for more information.
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
39 |
+
If you have questions, please post them in the forums.
|
40 |
|
41 |
== Screenshots ==
|
42 |
|
43 |
1. This shows my widget with the default settings on the default wordpress theme.
|
44 |
+
2. This is a more colorful example with random colors and all tags in uppercase. I'd like to actually see someone use it like this.
|
45 |
+
3. Maybe a more realistic usage of the widget with spanning colors and capitalized tags.
|
46 |
4. The settings page of the widget
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 2.0 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
* New plugin structure
|
53 |
+
* Minor changes to the administration interface
|
54 |
|
55 |
+
The changelog history for the 1.x branch is available on [GitHub](https://github.com/rickard2/utcw/blob/master/CHANGELOG.md)
|
|
|
56 |
|
57 |
+
The upgrade notice history for the 1.x branch is available on [GitHub](https://github.com/rickard2/utcw/blob/master/UPGRADE.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
== Upgrade Notice ==
|
60 |
|
61 |
+
= 2.0 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
== Feedback ==
|
66 |
|
67 |
+
This plugin is under active development and my goal is to try to help everyone who have issues or suggestions for this plugin. If you find bugs or have feature requests please use [GitHub issues](https://github.com/rickard2/utcw/issues), if you need support please use the [WordPress forums](http://wordpress.org/support/plugin/ultimate-tag-cloud-widget).
|
68 |
|
69 |
My contact information is
|
70 |
|
71 |
* rickard (a) 0x539.se (email, gtalk, msn, you name it)
|
72 |
* [twitter.com/rickard2](http://twitter.com/rickard2)
|
73 |
|
74 |
+
If you use this plugin and like it, please consider giving me some [flattr love](https://flattr.com/thing/112193/Ultimate-Tag-Cloud-Widget).
|
75 |
+
|
76 |
== Theme integration / Shortcode ==
|
77 |
|
78 |
+
You can integrate the widget within your own theme even if you're not using standard WordPress widgets. Just install and load the plugin as described and use the function
|
79 |
|
80 |
`<?php do_utcw($args); ?>`
|
81 |
|
82 |
+
...with `$args` being a array of `key => value` pairs for the options you would like to set. For example if you'd like to change the title of the widget:
|
83 |
|
84 |
+
`<?php
|
85 |
$args = array( "title" => "Most awesome title ever" );
|
86 |
+
|
87 |
do_utcw( $args );`
|
88 |
|
89 |
+
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:
|
90 |
+
|
91 |
+
`[utcw title="Most awesome title ever"]`
|
92 |
+
|
93 |
+
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.
|
94 |
+
|
95 |
+
== Breaking changes in version 2.0 ==
|
96 |
+
|
97 |
+
* Tags lists with named tags will not work in version 2.0, only tags lists with IDs.
|
98 |
+
* The configuration option for text case has been renamed from case to text_transform
|
99 |
+
* The styles for links aren't marked as `!important` in the CSS longer, this might change the cloud presentation in some cases
|
100 |
+
* The shortcode and theme integration function call no longer accepts the widget arguments `before_widget`, `after_widget`, `before_title` and `after_title`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
== Thanks ==
|
103 |
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
CHANGED
Binary file
|
settings.php
DELETED
@@ -1,367 +0,0 @@
|
|
1 |
-
<?php if (!defined("ABSPATH")) die();
|
2 |
-
/**
|
3 |
-
* @var string $title
|
4 |
-
* @var integer $size_from
|
5 |
-
* @var integer $size_to
|
6 |
-
* @var integer $max
|
7 |
-
* @var integer $letter_spacing
|
8 |
-
* @var integer $word_spacing
|
9 |
-
* @var integer $tag_spacing
|
10 |
-
* @var integer $line_height
|
11 |
-
* @var integer $minimum
|
12 |
-
* @var integer $hover_border_width
|
13 |
-
* @var integer $link_border_width
|
14 |
-
* @var integer $days_old
|
15 |
-
* @var string $separator
|
16 |
-
* @var string $prefix
|
17 |
-
* @var string $suffix
|
18 |
-
* @var string $reverse
|
19 |
-
* @var string $tags_list
|
20 |
-
* @var array $color_set
|
21 |
-
* @var string $case_sensitive
|
22 |
-
* @var string $show_title
|
23 |
-
* @var string $debug
|
24 |
-
* @var string $color_span_from
|
25 |
-
* @var string $color_span_to
|
26 |
-
* @var string $link_bg_color
|
27 |
-
* @var string $link_border_color
|
28 |
-
* @var string $hover_bg_color
|
29 |
-
* @var string $hover_color
|
30 |
-
* @var string $hover_border_color
|
31 |
-
* @var string $taxonomy
|
32 |
-
* @var string $order
|
33 |
-
* @var string $color
|
34 |
-
* @var string $case
|
35 |
-
* @var string $tags_list_type
|
36 |
-
* @var string $link_underline
|
37 |
-
* @var string $link_bold
|
38 |
-
* @var string $link_italic
|
39 |
-
* @var string $link_border_style
|
40 |
-
* @var string $hover_underline
|
41 |
-
* @var string $hover_bold
|
42 |
-
* @var string $hover_italic
|
43 |
-
* @var string $hover_border_style
|
44 |
-
* @var array $authors
|
45 |
-
* @var string $show_title_text
|
46 |
-
* @var array $post_type
|
47 |
-
* @var array $available_post_types
|
48 |
-
* @var array $available_taxonomies
|
49 |
-
* @var array $configurations
|
50 |
-
*/
|
51 |
-
?>
|
52 |
-
<button class="utcw-tab-button utcw-active" data-id="<?php echo $this->id ?>" data-tab="<?php echo $this->get_field_id("utcw-tab-data") ?>"><?php _e("Data", 'utcw') ?></button>
|
53 |
-
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>" data-tab="<?php echo $this->get_field_id("utcw-tab-basic-appearance") ?>"><?php _e("Basic appearance", 'utcw') ?></button>
|
54 |
-
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>" data-tab="<?php echo $this->get_field_id("utcw-tab-advanced-appearance") ?>"><?php _e("Advanced appearance", 'utcw') ?></button>
|
55 |
-
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>" data-tab="<?php echo $this->get_field_id("utcw-tab-links") ?>"><?php _e("Links", 'utcw') ?></button>
|
56 |
-
<button class="utcw-tab-button" data-id="<?php echo $this->id ?>" data-tab="<?php echo $this->get_field_id("utcw-tab-advanced") ?>"><?php _e("Adv.", 'utcw') ?></button>
|
57 |
-
|
58 |
-
<fieldset class="utcw" id="<?php echo $this->get_field_id("utcw-tab-data") ?>">
|
59 |
-
<legend></legend>
|
60 |
-
<a class="utcw-help" title="<?php _e("Only posts from the selected authors will be used when calculating the tag cloud.", 'utcw') ?>">?</a>
|
61 |
-
<strong><?php _e("Authors:", 'utcw') ?></strong><br>
|
62 |
-
<?php foreach ($this->get_users() as $user) : ?>
|
63 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('authors') ?>[]" id="<?php echo $this->get_field_id('author_' . $user->ID) ?>" value="<?php echo $user->ID?>" <?php echo in_array($user->ID, $authors, true) ? 'checked="checked"' : ""; ?>>
|
64 |
-
<label for="<?php echo $this->get_field_id('author_' . $user->ID) ?>"><?php echo $user->user_login?></label><br>
|
65 |
-
<?php endforeach; ?>
|
66 |
-
<br>
|
67 |
-
|
68 |
-
<a class="utcw-help" title="<?php _e("Which property of the tag should be used when determining the order of the tags in the cloud.", 'utcw') ?>">?</a>
|
69 |
-
<strong><?php _e("Order:", 'utcw') ?></strong><br>
|
70 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_random') ?>" value="random" <?php echo $order == "random" ? ' checked="checked" ' : ""; ?>>
|
71 |
-
<label for="<?php echo $this->get_field_id('order_random') ?>"><?php _e("Random", 'utcw') ?></label><br>
|
72 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_name') ?>" value="name" <?php echo $order == "name" ? ' checked="checked"' : ""; ?>>
|
73 |
-
<label for="<?php echo $this->get_field_id('order_name') ?>"><?php _e("By name", 'utcw') ?></label><br>
|
74 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_slug') ?>" value="slug" <?php echo $order == "slug" ? ' checked="checked"' : ""; ?>>
|
75 |
-
<label for="<?php echo $this->get_field_id('order_slug') ?>"><?php _e("By slug", 'utcw') ?></label><br>
|
76 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_id') ?>" value="id" <?php echo $order == "id" ? ' checked="checked"' : ""; ?>>
|
77 |
-
<label for="<?php echo $this->get_field_id('order_id') ?>"><?php _e("By id", 'utcw') ?></label><br>
|
78 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_color') ?>" value="name" <?php echo $order == "color" ? ' checked="checked"' : ""; ?>>
|
79 |
-
<label for="<?php echo $this->get_field_id('order_color') ?>"><?php _e("By color", 'utcw') ?></label><br>
|
80 |
-
<input type="radio" name="<?php echo $this->get_field_name('order') ?>" id="<?php echo $this->get_field_id('order_count') ?>" value="count" <?php echo $order == "count" || strlen($order) == 0 ? ' checked="checked" ' : ""; ?>>
|
81 |
-
<label for="<?php echo $this->get_field_id('order_count') ?>"><?php _e("Count", 'utcw') ?></label><br>
|
82 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('reverse') ?>" id="<?php echo $this->get_field_id('reverse') ?>" <?php echo $reverse === true ? ' checked="checked"' : ""; ?>>
|
83 |
-
<label for="<?php echo $this->get_field_id('reverse') ?>"><?php _e("Reverse order", 'utcw') ?></label><br>
|
84 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('case_sensitive') ?>" id="<?php echo $this->get_field_id('case_sensitive') ?>" <?php echo $case_sensitive === true ? ' checked="checked"' : ""; ?>>
|
85 |
-
<label for="<?php echo $this->get_field_id('case_sensitive') ?>"><?php _e("Case sensitive", 'utcw') ?></label><br>
|
86 |
-
<br>
|
87 |
-
|
88 |
-
<a class="utcw-help" title="<?php _e("Which taxonomy should be used in the cloud. You should be able to choose a custom taxonomy as well.", 'utcw') ?>">?</a>
|
89 |
-
<strong><label for="<?php echo $this->get_field_id('taxonomy') ?>"><?php _e("Taxonomy:", 'utcw') ?></label></strong><br>
|
90 |
-
<select id="<?php echo $this->get_field_id('taxonomy') ?>" name="<?php echo $this->get_field_name('taxonomy') ?>">
|
91 |
-
<?php foreach ($available_taxonomies as $t) : $data = get_taxonomy( $t ) ?>
|
92 |
-
<option value="<?php echo $t ?>" <?php echo $taxonomy == $t ? 'selected="selected"' : ""?>><?php echo $data->labels->name ?></option>
|
93 |
-
<?php endforeach; ?>
|
94 |
-
</select><br>
|
95 |
-
<br>
|
96 |
-
|
97 |
-
<a class="utcw-help" title="<?php _e("Which post types should be used in the cloud. Only tags from posts from these post types will be used in the tag cloud.", 'utcw') ?>">?</a>
|
98 |
-
<strong>Post types:</strong><br>
|
99 |
-
|
100 |
-
<?php foreach ( $available_post_types as $pt ) : $data = get_post_type_object($pt) ?>
|
101 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('post_type') ?>[]" id="<?php echo $this->get_field_id('post_type-' . $pt) ?>" value="<?php echo $pt ?>" <?php if ( in_array($pt, $post_type) ) echo 'checked="checked"' ?>>
|
102 |
-
<label for="<?php echo $this->get_field_id('post_type-' . $pt) ?>"><?php echo $data->labels->name ?></label><br>
|
103 |
-
<?php endforeach ?>
|
104 |
-
<br>
|
105 |
-
|
106 |
-
<a class="utcw-help" title="<?php _e("Only tags which have been used with this many posts will be visible in the cloud", 'utcw') ?>">?</a>
|
107 |
-
<strong><label for="<?php echo $this->get_field_id('minimum') ?>" title="<?php _e("Tags with fewer posts than this will be automatically excluded.", 'utcw') ?>"><?php _e("Minimum number of posts: ", 'utcw') ?></label></strong>
|
108 |
-
<input type="number" name="<?php echo $this->get_field_name('minimum') ?>" id="<?php echo $this->get_field_id('minimum') ?>" value="<?php echo $minimum; ?>"><br>
|
109 |
-
<br>
|
110 |
-
|
111 |
-
<a class="utcw-help" title="<?php _e("Only posts which are posted within this number of days will be used when generating the cloud", 'utcw') ?>">?</a>
|
112 |
-
<strong><label for="<?php echo $this->get_field_id('days_old') ?>" 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>
|
113 |
-
<input type="number" name="<?php echo $this->get_field_name('days_old') ?>" id="<?php echo $this->get_field_id('days_old') ?>" value="<?php echo $days_old; ?>"><br>
|
114 |
-
<br>
|
115 |
-
|
116 |
-
<a class="utcw-help" title="<?php _e("Choose either include or exclude above and enter a comma separated list of either the names or IDs of the tags you'd like to include/exclude.", 'utcw') ?>">?</a>
|
117 |
-
<input type="radio" name="<?php echo $this->get_field_name('tags_list_type') ?>" id="<?php echo $this->get_field_id('tags_list_type_include') ?>" value="include" <?php echo $tags_list_type == "include" ? 'checked="checked" ' : ""; ?>>
|
118 |
-
<label for="<?php echo $this->get_field_id('tags_list_type_include') ?>"><?php _e("Include only ... ", 'utcw') ?></label> <br>
|
119 |
-
<input type="radio" name="<?php echo $this->get_field_name('tags_list_type') ?>" id="<?php echo $this->get_field_id('tags_list_type_exclude') ?>" value="exclude" <?php echo $tags_list_type == "exclude" ? 'checked="checked" ' : ""; ?>>
|
120 |
-
<label for="<?php echo $this->get_field_id('tags_list_type_exclude') ?>"><?php _e("Exclude ... ", 'utcw') ?></label> <br>
|
121 |
-
|
122 |
-
<label for="<?php echo $this->get_field_id('tags_list') ?>"><?php _e("... these tags:", 'utcw') ?></label><br>
|
123 |
-
<input type="text" name="<?php echo $this->get_field_name('tags_list') ?>" id="<?php echo $this->get_field_id('tags_list') ?>" value="<?php echo implode(",", $tags_list) ?>"><br>
|
124 |
-
</fieldset>
|
125 |
-
|
126 |
-
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id("utcw-tab-basic-appearance") ?>">
|
127 |
-
<legend></legend>
|
128 |
-
<a class="utcw-help" title="<?php _e("The title is the text which is shown above the tag cloud.", 'utcw') ?>">?</a>
|
129 |
-
<strong><label for="<?php echo $this->get_field_id('title');?>"><?php _e("Title:", 'utcw') ?></label></strong><br>
|
130 |
-
<input type="checkbox" id="<?php echo $this->get_field_id('show_title_text') ?>" name="<?php echo $this->get_field_name('show_title_text') ?>" <?php if ( !isset($show_title_text) || $show_title_text ) echo 'checked="checked"' ?>>
|
131 |
-
<label for="<?php echo $this->get_field_id('show_title_text') ?>"><?php _e('Show title', 'utcw') ?></label><br>
|
132 |
-
<input type="text" id="<?php echo $this->get_field_id('title');?>" name="<?php echo $this->get_field_name('title');?>" value="<?php echo strlen($title) > 0 ? $title : UTCW_DEFAULT_TITLE?>"><br>
|
133 |
-
<br>
|
134 |
-
|
135 |
-
<a class="utcw-help" title="<?php _e("The tag with the least number of posts will be the smallest, and the tag with the most number of posts will be the biggest.", 'utcw') ?>">?</a>
|
136 |
-
<strong><?php _e("Tag size (in px):", 'utcw') ?></strong><br>
|
137 |
-
<label for="<?php echo $this->get_field_id('size_from') ?>"><?php _e("From", 'utcw') ?></label>
|
138 |
-
<input type="number" name="<?php echo $this->get_field_name('size_from') ?>" id="<?php echo $this->get_field_id('size_from') ?>" size="3" value="<?php echo is_numeric($size_from) ? $size_from : UTCW_DEFAULT_SIZE_FROM?>">
|
139 |
-
<label for="<?php echo $this->get_field_id('size_to') ?>"><?php _e("to", 'utcw') ?></label>
|
140 |
-
<input type="number" name="<?php echo $this->get_field_name('size_to') ?>" id="<?php echo $this->get_field_id('size_to') ?>" size="3" value="<?php echo is_numeric($size_to) ? $size_to : UTCW_DEFAULT_SIZE_TO?>"><br>
|
141 |
-
<br>
|
142 |
-
|
143 |
-
<a class="utcw-help" title="<?php _e("If the total number of tags exceeds this number, only this many tags will be shown in the cloud.", 'utcw') ?>">?</a>
|
144 |
-
<strong><label for="<?php echo $this->get_field_id('max') ?>"><?php _e("Max tags:", 'utcw') ?></label></strong><br>
|
145 |
-
<input type="number" name="<?php echo $this->get_field_name('max') ?>" id="<?php echo $this->get_field_id('max') ?>" value="<?php echo is_numeric($max) ? $max : UTCW_DEFAULT_MAX?>"><br>
|
146 |
-
<br>
|
147 |
-
|
148 |
-
<a class="utcw-help" title="<?php _e("This setting controls how the tags are colored.<ul><li>Totaly random will choose between all the 16 million colors available.</li><li>Random from preset values will choose colors from a predefined set of colors</li><li>Spanning between values will calculate the corresponding color based upon how many posts each tag has, similar to how the size is calculated. The tag with the least number of posts will have the first color and the tag with the most number of posts will have the second color. All tags in between will have a color calculated between the first and the second color.</li></ul>The colors for the choice 'Random from preset values' has to be specified as a comma separated list.", 'utcw')?>">?</a>
|
149 |
-
<strong><?php _e("Coloring:", 'utcw') ?></strong><br>
|
150 |
-
<input type="radio" name="<?php echo $this->get_field_name('color') ?>" id="<?php echo $this->get_field_id('color_none') ?>" value="none" <?php echo $color == "none" || empty($color) ? 'checked="checked"' : ""; ?>>
|
151 |
-
<label for="<?php echo $this->get_field_id('color_none') ?>"><?php _e("None", 'utcw') ?></label><br>
|
152 |
-
<input type="radio" name="<?php echo $this->get_field_name('color') ?>" id="<?php echo $this->get_field_id('color_random') ?>" value="random" <?php echo $color == "random" ? 'checked="checked"' : ""; ?>>
|
153 |
-
<label for="<?php echo $this->get_field_id('color_random') ?>"><?php _e("Totally random", 'utcw') ?></label><br>
|
154 |
-
<input type="radio" name="<?php echo $this->get_field_name('color') ?>" id="<?php echo $this->get_field_id('color_set') ?>" value="set" <?php echo $color == "set" ? 'checked="checked"' : ""; ?>>
|
155 |
-
<label for="<?php echo $this->get_field_id('color_set') ?>"><?php _e("Random from preset values", 'utcw') ?></label><br>
|
156 |
-
<div id="<?php echo $this->get_field_id('set_chooser') ?>" <?php echo $color != "set" ? 'class="utcw-hidden"' : ""; ?>>
|
157 |
-
<label class="screen-reader-text" for="<?php echo $this->get_field_id('color_set_chooser') ?>"><?php _e("Random from preset values", 'utcw') ?></label>
|
158 |
-
<input type="text" name="<?php echo $this->get_field_name('color_set') ?>" id="<?php echo $this->get_field_id('color_set_chooser') ?>" value="<?php echo implode(',', $color_set) ?>">
|
159 |
-
</div>
|
160 |
-
<input type="radio" name="<?php echo $this->get_field_name('color') ?>" id="<?php echo $this->get_field_id('color_span') ?>" value="span" <?php echo $color == "span" ? 'checked="checked"' : ""; ?>>
|
161 |
-
<label for="<?php echo $this->get_field_id('color_span') ?>"><?php _e("Spanning between values", 'utcw') ?></label><br>
|
162 |
-
<div id="<?php echo $this->get_field_id('span_chooser') ?>" <?php echo $color != "span" ? 'class="utcw-hidden"' : ""; ?>>
|
163 |
-
<label for="<?php echo $this->get_field_id('color_span_from') ?>"><?php _e("From", 'utcw') ?></label>
|
164 |
-
<input type="text" size="7" name="<?php echo $this->get_field_name('color_span_from') ?>" id="<?php echo $this->get_field_id('color_span_from') ?>" value="<?php echo $color_span_from?>"><br>
|
165 |
-
|
166 |
-
<label for="<?php echo $this->get_field_id('color_span_to') ?>"><?php _e("to", 'utcw') ?></label>
|
167 |
-
<input type="text" size="7" name="<?php echo $this->get_field_name('color_span_to') ?>" id="<?php echo $this->get_field_id('color_span_to') ?>" value="<?php echo $color_span_to?>">
|
168 |
-
</div>
|
169 |
-
<br>
|
170 |
-
</fieldset>
|
171 |
-
|
172 |
-
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id("utcw-tab-advanced-appearance") ?>">
|
173 |
-
<legend></legend>
|
174 |
-
<a class="utcw-help" 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>
|
175 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('show_title') ?>" id="<?php echo $this->get_field_id('show_title') ?>" <?php echo $show_title === true || !isset($show_title) ? ' checked="checked"' : ''?>>
|
176 |
-
<label for="<?php echo $this->get_field_id('show_title') ?>" title="<?php _e("This is a title", "utcw") ?>"><?php _e("Show title (hover text)", "utcw") ?></label><br>
|
177 |
-
<br>
|
178 |
-
|
179 |
-
<a class="utcw-help" title="<?php _e("The spacing is a numerical value which controls how much space there is between letters, words, tags or rows. To use the default value for these settings just use the corresponding default value from the CSS specification: <ul><li>Letter spacing: normal</li><li>Word spacing: normal</li><li>Tag spacing (CSS margin): auto</li><li>Row spacing (CSS line height): inherit</li></ul>To use anything but the default values, just specify a number (the unit is pixels).", 'utcw') ?>">?</a>
|
180 |
-
<strong><?php _e("Spacing (in px):", 'utcw') ?></strong><br>
|
181 |
-
<label class="two-col" for="<?php echo $this->get_field_id('letter_spacing') ?>"><?php _e("Between letters:", 'utcw') ?></label>
|
182 |
-
<input type="text" size="5" name="<?php echo $this->get_field_name('letter_spacing') ?>" id="<?php echo $this->get_field_id('letter_spacing') ?>" value="<?php echo strlen($letter_spacing) > 0 ? $letter_spacing : UTCW_DEFAULT_LETTER_SPACING?>"><br>
|
183 |
-
<label class="two-col" for="<?php echo $this->get_field_id('word_spacing') ?>"><?php _e("Between words:", 'utcw') ?></label>
|
184 |
-
<input type="text" size="5" name="<?php echo $this->get_field_name('word_spacing') ?>" id="<?php echo $this->get_field_id('word_spacing') ?>" value="<?php echo strlen($word_spacing) > 0 ? $word_spacing : UTCW_DEFAULT_WORD_SPACING?>"><br>
|
185 |
-
<label class="two-col" for="<?php echo $this->get_field_id('tag_spacing') ?>"><?php _e("Between tags:", 'utcw') ?></label>
|
186 |
-
<input type="text" size="5" name="<?php echo $this->get_field_name('tag_spacing') ?>" id="<?php echo $this->get_field_id('tag_spacing') ?>" value="<?php echo strlen($tag_spacing) > 0 ? $tag_spacing : UTCW_DEFAULT_TAG_SPACING?>"><br>
|
187 |
-
<label class="two-col" for="<?php echo $this->get_field_id('line_height') ?>"><?php _e("Between rows:", 'utcw') ?></label>
|
188 |
-
<input type="text" size="5" name="<?php echo $this->get_field_name('line_height') ?>" id="<?php echo $this->get_field_id('line_height') ?>" value="<?php echo strlen($line_height) > 0 ? $line_height : UTCW_DEFAULT_LINE_HEIGHT ?>"><br>
|
189 |
-
<br>
|
190 |
-
|
191 |
-
<a class="utcw-help" title="<?php _e("The tags can be transformed in a number of different ways. lowercase, UPPERCASE or Capitalized.", 'utcw')?>">?</a>
|
192 |
-
<strong><?php _e("Transform tags:", 'utcw') ?></strong><br>
|
193 |
-
<input type="radio" name="<?php echo $this->get_field_name('case') ?>" id="<?php echo $this->get_field_id('text_transform_off') ?>" value="off" <?php echo ($case == "off" || empty($case)) ? ' checked="checked"' : ""; ?>>
|
194 |
-
<label for="<?php echo $this->get_field_id('text_transform_off') ?>"><?php _e("Off", 'utcw') ?></label><br>
|
195 |
-
<input type="radio" name="<?php echo $this->get_field_name('case') ?>" id="<?php echo $this->get_field_id('text_transform_lowercase') ?>" value="lowercase" <?php echo $case == "lowercase" ? ' checked="checked"' : ""; ?>>
|
196 |
-
<label for="<?php echo $this->get_field_id('text_transform_lowercase') ?>"><?php _e("To lowercase", 'utcw') ?></label><br>
|
197 |
-
<input type="radio" name="<?php echo $this->get_field_name('case') ?>" id="<?php echo $this->get_field_id('text_transform_uppercase') ?>" value="uppercase" <?php echo $case == "uppercase" ? ' checked="checked"' : ""; ?>>
|
198 |
-
<label for="<?php echo $this->get_field_id('text_transform_uppercase') ?>"><?php _e("To uppercase", 'utcw') ?></label><br>
|
199 |
-
<input type="radio" name="<?php echo $this->get_field_name('case') ?>" id="<?php echo $this->get_field_id('text_transform_capitalize') ?>" value="capitalize" <?php echo $case == "capitalize" ? ' checked="checked"' : ""; ?>>
|
200 |
-
<label for="<?php echo $this->get_field_id('text_transform_capitalize') ?>"><?php _e("Capitalize", 'utcw') ?></label><br>
|
201 |
-
<br>
|
202 |
-
|
203 |
-
<a class="utcw-help" title="<?php _e("The tags can be surrounded by a prefix and/or suffix and separated with a separator. The default separator is just a space but can be changed to anything you'd like. Remember to add a space before and after the separator, this is not automatically added by the plugin.<br><br>A short example, these settings:<ul><li>Separator: - </li><li>Prefix: (</li><li>Suffix: )</li></ul>… would produce a tag cloud like this: <br><br>(first tag) - (second tag) - (third tag)<br><br>Prefix and suffix characters will have the same size and color as the tag, but the separator will not.", 'utcw') ?>">?</a>
|
204 |
-
<strong><?php _e("Tag separators:", 'utcw')?></strong>
|
205 |
-
<label class="two-col" for="<?php echo $this->get_field_id("separator") ?>"><?php _e("Separator", 'utcw') ?></label>
|
206 |
-
<input type="text" size=5 name="<?php echo $this->get_field_name("separator") ?>" id="<?php echo $this->get_field_id("separator") ?>" value="<?php echo strlen($separator) > 0 ? $separator : UTCW_DEFAULT_SEPARATOR ?>"><br>
|
207 |
-
<label class="two-col" for="<?php echo $this->get_field_id("prefix") ?>"><?php _e("Prefix", 'utcw') ?></label>
|
208 |
-
<input type="text" size=5 name="<?php echo $this->get_field_name("prefix") ?>" id="<?php echo $this->get_field_id("prefix") ?>" value="<?php echo strlen($prefix) ? $prefix : UTCW_DEFAULT_PREFIX ?>"><br>
|
209 |
-
<label class="two-col" for="<?php echo $this->get_field_id("suffix") ?>"><?php _e("Suffix", 'utcw') ?></label>
|
210 |
-
<input type="text" size=5 name="<?php echo $this->get_field_name("suffix") ?>" id="<?php echo $this->get_field_id("suffix") ?>" value="<?php echo strlen($suffix) ? $suffix : UTCW_DEFAULT_SUFFIX ?>"><br>
|
211 |
-
|
212 |
-
</fieldset>
|
213 |
-
|
214 |
-
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id("utcw-tab-links") ?>">
|
215 |
-
<legend></legend>
|
216 |
-
|
217 |
-
<a class="utcw-help" title="<?php _e("The normal styles will apply to the tags when the user is <b>not</b> hovering the link.", 'utcw')?>">?</a>
|
218 |
-
<h3>Normal styles</h3>
|
219 |
-
<a class="utcw-help" title="<?php _e("Yes or no will force the tag setting for the <u>underline</u> style, theme default will let the blog theme decide.", 'utcw') ?>">?</a>
|
220 |
-
<strong><?php _e("Underline", "utcw") ?></strong><br>
|
221 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_underline') ?>" id="<?php echo $this->get_field_id('link_underline_yes') ?>" value="yes" <?php echo $link_underline == "yes" ? ' checked="checked"' : '' ?>>
|
222 |
-
<label for="<?php echo $this->get_field_id('link_underline_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
223 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_underline') ?>" id="<?php echo $this->get_field_id('link_underline_no') ?>" value="no" <?php echo $link_underline == "no" ? ' checked="checked"' : '' ?>>
|
224 |
-
<label for="<?php echo $this->get_field_id('link_underline_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
225 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_underline') ?>" id="<?php echo $this->get_field_id('link_underline_default') ?>" value="default" <?php echo $link_underline == "default" || empty($link_underline) ? ' checked="checked"' : '' ?>>
|
226 |
-
<label for="<?php echo $this->get_field_id('link_underline_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
227 |
-
<br>
|
228 |
-
|
229 |
-
<a class="utcw-help" title="<?php _e("Yes or no will force the tag setting for the <b>bold</b> style, theme default will let the blog theme decide.", 'utcw') ?>">?</a>
|
230 |
-
<strong><?php _e("Bold", "utcw") ?></strong><br>
|
231 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_bold') ?>" id="<?php echo $this->get_field_id('link_bold_yes') ?>" value="yes" <?php echo $link_bold == "yes" ? ' checked="checked"' : '' ?>>
|
232 |
-
<label for="<?php echo $this->get_field_id('link_bold_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
233 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_bold') ?>" id="<?php echo $this->get_field_id('link_bold_no') ?>" value="no" <?php echo $link_bold == "no" ? ' checked="checked"' : '' ?>>
|
234 |
-
<label for="<?php echo $this->get_field_id('link_bold_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
235 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_bold') ?>" id="<?php echo $this->get_field_id('link_bold_default') ?>" value="default" <?php echo $link_bold == "default" || empty($link_bold) ? ' checked="checked"' : '' ?>>
|
236 |
-
<label for="<?php echo $this->get_field_id('link_bold_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
237 |
-
<br>
|
238 |
-
|
239 |
-
<a class="utcw-help" title="<?php _e("Yes or no will force the tag setting for the <i>italic</i> style, theme default will let the blog theme decide.", 'utcw') ?>">?</a>
|
240 |
-
<strong><?php _e("Italic", "utcw") ?></strong><br>
|
241 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_italic') ?>" id="<?php echo $this->get_field_id('link_italic_yes') ?>" value="yes" <?php echo $link_italic == "yes" ? ' checked="checked"' : '' ?>>
|
242 |
-
<label for="<?php echo $this->get_field_id('link_italic_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
243 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_italic') ?>" id="<?php echo $this->get_field_id('link_italic_no') ?>" value="no" <?php echo $link_italic == "no" ? ' checked="checked"' : '' ?>>
|
244 |
-
<label for="<?php echo $this->get_field_id('link_italic_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
245 |
-
<input type="radio" name="<?php echo $this->get_field_name('link_italic') ?>" id="<?php echo $this->get_field_id('link_italic_default') ?>" value="default" <?php echo $link_italic == "default" || empty($link_italic) ? ' checked="checked"' : '' ?>>
|
246 |
-
<label for="<?php echo $this->get_field_id('link_italic_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
247 |
-
<br>
|
248 |
-
|
249 |
-
<a class="utcw-help" title="<?php _e("This setting will change the background color of <b>the link only</b>, not the whole cloud. The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black.", 'utcw') ?>">?</a>
|
250 |
-
<strong><label for="<?php echo $this->get_field_id('link_bg_color') ?>"><?php _e("Background color (hex value):", "utcw") ?></label></strong><br>
|
251 |
-
<input type="text" name="<?php echo $this->get_field_name('link_bg_color') ?>" id="<?php echo $this->get_field_id('link_bg_color') ?>" value="<?php echo $link_bg_color ?>"><br>
|
252 |
-
<br>
|
253 |
-
|
254 |
-
<a class="utcw-help" title="<?php _e("This setting will change the border of <b>the link only</b>, not the whole cloud. <ul><li>The width of the border is a numerical value (in the unit pixels).</li><li>The color has to be specified in hexadeximal format, like ffffff for white, 0000ff for blue or 000000 for black.</li></ul>", 'utcw') ?>">?</a>
|
255 |
-
<strong><?php _e("Border", "utcw") ?></strong><br>
|
256 |
-
<label for="<?php echo $this->get_field_id('link_border_style') ?>"><?php _e("Style: ", "utcw") ?></label><br>
|
257 |
-
<select name="<?php echo $this->get_field_name('link_border_style') ?>" id="<?php echo $this->get_field_id('link_border_style') ?>">
|
258 |
-
<option value="none" <?php echo $link_border_style == "none" ? 'selected="selected"' : '' ?>><?php _e("None", "utcw") ?></option>
|
259 |
-
<option value="dotted" <?php echo $link_border_style == "dotted" ? 'selected="selected"' : '' ?>><?php _e("Dotted", "utcw") ?></option>
|
260 |
-
<option value="dashed" <?php echo $link_border_style == "dashed" ? 'selected="selected"' : '' ?>><?php _e("Dashed", "utcw") ?></option>
|
261 |
-
<option value="solid" <?php echo $link_border_style == "solid" ? 'selected="selected"' : '' ?>><?php _e("Solid", "utcw") ?></option>
|
262 |
-
<option value="double" <?php echo $link_border_style == "double" ? 'selected="selected"' : '' ?>><?php _e("Double", "utcw") ?></option>
|
263 |
-
<option value="groove" <?php echo $link_border_style == "groove" ? 'selected="selected"' : '' ?>><?php _e("Groove", "utcw") ?></option>
|
264 |
-
<option value="ridge" <?php echo $link_border_style == "rigde" ? 'selected="selected"' : '' ?>><?php _e("Ridge", "utcw") ?></option>
|
265 |
-
<option value="inset" <?php echo $link_border_style == "inset" ? 'selected="selected"' : '' ?>><?php _e("Inset", "utcw") ?></option>
|
266 |
-
<option value="outset" <?php echo $link_border_style == "outset" ? 'selected="selected"' : '' ?>><?php _e("Outset", "utcw") ?></option>
|
267 |
-
</select><br>
|
268 |
-
<br>
|
269 |
-
<label for="<?php echo $this->get_field_id("link_border_width") ?>"><?php _e("Width (in px):", "utcw") ?></label><br>
|
270 |
-
<input type="number" name="<?php echo $this->get_field_name("link_border_width") ?>" id="<?php echo $this->get_field_id("link_border_width") ?>" value="<?php echo $link_border_width ?>"><br>
|
271 |
-
<br>
|
272 |
-
<label for="<?php echo $this->get_field_id("link_border_color") ?>"><?php _e("Color (hex value): ", "utcw") ?></label><br>
|
273 |
-
<input type="color" name="<?php echo $this->get_field_name("link_border_color") ?>" id="<?php echo $this->get_field_id("link_border_color") ?>" value="<?php echo $link_border_color ?>"><br>
|
274 |
-
|
275 |
-
<a class="utcw-help" 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>
|
276 |
-
<h3>Hover effects</h3>
|
277 |
-
<strong><?php _e("Underline", "utcw") ?></strong><br>
|
278 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_underline') ?>" id="<?php echo $this->get_field_id('hover_underline_yes') ?>" value="yes" <?php echo $hover_underline == "yes" ? ' checked="checked"' : '' ?>>
|
279 |
-
<label for="<?php echo $this->get_field_id('hover_underline_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
280 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_underline') ?>" id="<?php echo $this->get_field_id('hover_underline_no') ?>" value="no" <?php echo $hover_underline == "no" ? ' checked="checked"' : '' ?>>
|
281 |
-
<label for="<?php echo $this->get_field_id('hover_underline_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
282 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_underline') ?>" id="<?php echo $this->get_field_id('hover_underline_default') ?>" value="default" <?php echo $hover_underline == "default" || empty($hover_underline) ? ' checked="checked"' : '' ?>>
|
283 |
-
<label for="<?php echo $this->get_field_id('hover_underline_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
284 |
-
<br>
|
285 |
-
<strong><?php _e("Bold", "utcw") ?></strong><br>
|
286 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_bold') ?>" id="<?php echo $this->get_field_id('hover_bold_yes') ?>" value="yes" <?php echo $hover_bold == "yes" ? ' checked="checked"' : '' ?>>
|
287 |
-
<label for="<?php echo $this->get_field_id('hover_bold_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
288 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_bold') ?>" id="<?php echo $this->get_field_id('hover_bold_no') ?>" value="no" <?php echo $hover_bold == "no" ? ' checked="checked"' : '' ?>>
|
289 |
-
<label for="<?php echo $this->get_field_id('hover_bold_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
290 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_bold') ?>" id="<?php echo $this->get_field_id('hover_bold_default') ?>" value="default" <?php echo $hover_bold == "default" || empty($hover_bold) ? ' checked="checked"' : '' ?>>
|
291 |
-
<label for="<?php echo $this->get_field_id('hover_bold_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
292 |
-
<br>
|
293 |
-
<strong><?php _e("Italic", "utcw") ?></strong><br>
|
294 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_italic') ?>" id="<?php echo $this->get_field_id('hover_italic_yes') ?>" value="yes" <?php echo $hover_italic == "yes" ? ' checked="checked"' : '' ?>>
|
295 |
-
<label for="<?php echo $this->get_field_id('hover_italic_yes') ?>"><?php _e("Yes", "utcw") ?></label><br>
|
296 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_italic') ?>" id="<?php echo $this->get_field_id('hover_italic_no') ?>" value="no" <?php echo $hover_italic == "no" ? ' checked="checked"' : '' ?>>
|
297 |
-
<label for="<?php echo $this->get_field_id('hover_italic_no') ?>"><?php _e("No", "utcw") ?></label><br>
|
298 |
-
<input type="radio" name="<?php echo $this->get_field_name('hover_italic') ?>" id="<?php echo $this->get_field_id('hover_italic_default') ?>" value="default" <?php echo $hover_italic == "default" || empty($hover_italic) ? ' checked="checked"' : '' ?>>
|
299 |
-
<label for="<?php echo $this->get_field_id('hover_italic_default') ?>"><?php _e("Theme default", "utcw") ?></label><br>
|
300 |
-
<br>
|
301 |
-
<strong><label for="<?php echo $this->get_field_id('hover_bg_color') ?>"><?php _e("Background color (hex value):", "utcw") ?></label></strong><br>
|
302 |
-
<input type="text" name="<?php echo $this->get_field_name('hover_bg_color') ?>" id="<?php echo $this->get_field_id('hover_bg_color') ?>" value="<?php echo $hover_bg_color ?>"><br>
|
303 |
-
<br>
|
304 |
-
<strong><label for="<?php echo $this->get_field_id('hover_color') ?>"><?php _e("Font color (hex value):", "utcw") ?></label></strong>
|
305 |
-
<input type="text" name="<?php echo $this->get_field_name('hover_color') ?>" id="<?php echo $this->get_field_id('hover_color') ?>" value="<?php echo $hover_color ?>"><br>
|
306 |
-
<strong><?php _e("Border", "utcw") ?></strong><br>
|
307 |
-
<br>
|
308 |
-
<label for="<?php echo $this->get_field_id('hover_border_style') ?>"><?php _e("Style: ", "utcw") ?></label><br>
|
309 |
-
<select name="<?php echo $this->get_field_name('hover_border_style') ?>" id="<?php echo $this->get_field_id('hover_border_style') ?>">
|
310 |
-
<option value="none" <?php echo $hover_border_style == "none" ? 'selected="selected"' : '' ?>><?php _e("None", "utcw") ?></option>
|
311 |
-
<option value="dotted" <?php echo $hover_border_style == "dotted" ? 'selected="selected"' : '' ?>><?php _e("Dotted", "utcw") ?></option>
|
312 |
-
<option value="dashed" <?php echo $hover_border_style == "dashed" ? 'selected="selected"' : '' ?>><?php _e("Dashed", "utcw") ?></option>
|
313 |
-
<option value="solid" <?php echo $hover_border_style == "solid" ? 'selected="selected"' : '' ?>><?php _e("Solid", "utcw") ?></option>
|
314 |
-
<option value="double" <?php echo $hover_border_style == "double" ? 'selected="selected"' : '' ?>><?php _e("Double", "utcw") ?></option>
|
315 |
-
<option value="groove" <?php echo $hover_border_style == "groove" ? 'selected="selected"' : '' ?>><?php _e("Groove", "utcw") ?></option>
|
316 |
-
<option value="ridge" <?php echo $hover_border_style == "rigde" ? 'selected="selected"' : '' ?>><?php _e("Ridge", "utcw") ?></option>
|
317 |
-
<option value="inset" <?php echo $hover_border_style == "inset" ? 'selected="selected"' : '' ?>><?php _e("Inset", "utcw") ?></option>
|
318 |
-
<option value="outset" <?php echo $hover_border_style == "outset" ? 'selected="selected"' : '' ?>><?php _e("Outset", "utcw") ?></option>
|
319 |
-
</select><br>
|
320 |
-
<br>
|
321 |
-
<label for="<?php echo $this->get_field_id("hover_border_width") ?>"><?php _e("Width (in px):", "utcw") ?></label><br>
|
322 |
-
<input type="number" name="<?php echo $this->get_field_name("hover_border_width") ?>" id="<?php echo $this->get_field_id("hover_border_width") ?>" value="<?php echo $hover_border_width ?>"><br>
|
323 |
-
<br>
|
324 |
-
<label for="<?php echo $this->get_field_id("hover_border_color") ?>"><?php _e("Color (hex value): ", "utcw") ?></label><br>
|
325 |
-
<input type="color" name="<?php echo $this->get_field_name("hover_border_color") ?>" id="<?php echo $this->get_field_id("hover_border_color") ?>" value="<?php echo $hover_border_color ?>"><br>
|
326 |
-
</fieldset>
|
327 |
-
<fieldset class="utcw hidden" id="<?php echo $this->get_field_id("utcw-tab-advanced") ?>">
|
328 |
-
<legend></legend>
|
329 |
-
<a class="utcw-help" title="<?php _e("This will add a <-- HTML comment --> 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>
|
330 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('debug') ?>" id="<?php echo $this->get_field_id('debug') ?>" <?php echo ($debug === true) ? 'checked="checked"' : '' ?>>
|
331 |
-
<label for="<?php echo $this->get_field_id('debug') ?>"><?php _e("Include debug output", 'utcw')?></label><br>
|
332 |
-
<br>
|
333 |
-
<a class="utcw-help" title="<?php _e("This will save the current configuration which enables you to load this configuration at a later time. Check this box, choose a name in the text field below and press 'Save' to save the configuration.", 'utcw') ?>">?</a>
|
334 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('save_config') ?>" id="<?php echo $this->get_field_id('save_config') ?>">
|
335 |
-
<label for="<?php echo $this->get_field_id('save_config') ?>"><?php _e("Save configuration", 'utcw') ?></label><br>
|
336 |
-
<br>
|
337 |
-
<a class="utcw-help" title="<?php _e("This is the name which will be used for the current configuration if you check the option 'Save configuration' above. If the name is omitted the current date and time will be used.", 'utcw') ?>">?</a>
|
338 |
-
<label for="<?php echo $this->get_field_id('save_config_name') ?>"><?php _e("Configuration name", 'utcw') ?></label><br>
|
339 |
-
<input type="text" name="<?php echo $this->get_field_name('save_config_name') ?>" id="<?php echo $this->get_field_id('save_config_name') ?>" value="<?php echo date( get_option('date_format') . " " . get_option('time_format') ) ?>"><br>
|
340 |
-
<br>
|
341 |
-
|
342 |
-
<?php if ( $configurations !== false && is_array($configurations) && count($configurations) > 0 ) : ?>
|
343 |
-
|
344 |
-
<a class="utcw-help" title="<?php _e("This will load the selected configuration to the state which the widget was when the configuration was saved.", 'utcw') ?>">?</a>
|
345 |
-
<input type="checkbox" name="<?php echo $this->get_field_name('load_config') ?>" id="<?php echo $this->get_field_id('load_config') ?>">
|
346 |
-
<label for="<?php echo $this->get_field_id('load_config') ?>"><?php _e("Load configuration", 'utcw') ?></label><br>
|
347 |
-
<br>
|
348 |
-
<label for="<?php echo $this->get_field_id('load_config_name') ?>"><?php _e("Configuration name", 'utcw') ?></label><br>
|
349 |
-
<select name="<?php echo $this->get_field_name('load_config_name') ?>" id="<?php echo $this->get_field_id('load_config_name') ?>">
|
350 |
-
|
351 |
-
<?php foreach ($configurations as $name => $config) : ?>
|
352 |
-
<option value="<?php echo $name ?>"><?php echo $name ?></option>
|
353 |
-
<?php endforeach ?>
|
354 |
-
|
355 |
-
</select>
|
356 |
-
|
357 |
-
<?php endif ?>
|
358 |
-
|
359 |
-
</fieldset>
|
360 |
-
<script type="text/javascript">
|
361 |
-
jQuery(".utcw-help").wTooltip({style: wTooltipStyle,className:'utcw-tooltip'});
|
362 |
-
if (typeof(utcwActiveTab['<?php echo $this->id ?>']) == "undefined") {
|
363 |
-
utcwActiveTab['<?php echo $this->id ?>'] = '<?php echo $this->get_field_id("utcw-tab-data") ?>';
|
364 |
-
} else {
|
365 |
-
jQuery("button[data-tab='" + utcwActiveTab['<?php echo $this->id?>'] + "']").click();
|
366 |
-
}
|
367 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ultimate-tag-cloud-widget.php
CHANGED
@@ -1,1035 +1,13 @@
|
|
1 |
-
<?php
|
2 |
/*
|
3 |
Plugin Name: Ultimate tag cloud widget
|
4 |
-
Plugin URI:
|
5 |
-
Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your
|
6 |
-
Version:
|
7 |
Author: Rickard Andersson
|
8 |
-
Author URI:
|
9 |
License: GPLv2
|
10 |
*/
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
it under the terms of the GNU General Public License as published by
|
15 |
-
the Free Software Foundation; version 2 of the License.
|
16 |
-
|
17 |
-
This program is distributed in the hope that it will be useful,
|
18 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
-
GNU General Public License for more details.
|
21 |
-
|
22 |
-
You should have received a copy of the GNU General Public License
|
23 |
-
along with this program; if not, write to the Free Software
|
24 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
-
*/
|
26 |
-
|
27 |
-
// Default values if the widget isn't configured properly
|
28 |
-
define("UTCW_DEFAULT_TITLE", __("Tag Cloud", 'utcw'));
|
29 |
-
define("UTCW_DEFAULT_ORDER", "name");
|
30 |
-
define("UTCW_DEFAULT_SIZE_FROM", 10);
|
31 |
-
define("UTCW_DEFAULT_SIZE_TO", 30);
|
32 |
-
define("UTCW_DEFAULT_MAX", 45);
|
33 |
-
define("UTCW_DEFAULT_TAXONOMY", "post_tag");
|
34 |
-
define("UTCW_DEFAULT_REVERSE", false);
|
35 |
-
define("UTCW_DEFAULT_COLOR", "none");
|
36 |
-
define("UTCW_DEFAULT_LETTER_SPACING", "normal");
|
37 |
-
define("UTCW_DEFAULT_WORD_SPACING", "normal");
|
38 |
-
define("UTCW_DEFAULT_CASE", "off");
|
39 |
-
define("UTCW_DEFAULT_CASE_SENSITIVE", false);
|
40 |
-
define("UTCW_DEFAULT_MINIMUM", 1);
|
41 |
-
define("UTCW_DEFAULT_TAGS_LIST_TYPE", "exclude");
|
42 |
-
define("UTCW_DEFAULT_SHOW_TITLE", true);
|
43 |
-
define("UTCW_DEFAULT_LINK_UNDERLINE", "default");
|
44 |
-
define("UTCW_DEFAULT_LINK_BOLD", "default");
|
45 |
-
define("UTCW_DEFAULT_LINK_ITALIC", "default");
|
46 |
-
define("UTCW_DEFAULT_LINK_BG_COLOR", "transparent");
|
47 |
-
define("UTCW_DEFAULT_LINK_BORDER_STYLE", "none");
|
48 |
-
define("UTCW_DEFAULT_LINK_BORDER_WIDTH", "0px");
|
49 |
-
define("UTCW_DEFAULT_LINK_BORDER_COLOR", "none");
|
50 |
-
define("UTCW_DEFAULT_HOVER_UNDERLINE", "default");
|
51 |
-
define("UTCW_DEFAULT_HOVER_BOLD", "default");
|
52 |
-
define("UTCW_DEFAULT_HOVER_ITALIC", "default");
|
53 |
-
define("UTCW_DEFAULT_HOVER_BG_COLOR", "transparent");
|
54 |
-
define("UTCW_DEFAULT_HOVER_COLOR", "default");
|
55 |
-
define("UTCW_DEFAULT_HOVER_BORDER_STYLE", "none");
|
56 |
-
define("UTCW_DEFAULT_HOVER_BORDER_WIDTH", "0px");
|
57 |
-
define("UTCW_DEFAULT_HOVER_BORDER_COLOR", "none");
|
58 |
-
define("UTCW_DEFAULT_TAG_SPACING", "auto");
|
59 |
-
define("UTCW_DEFAULT_DEBUG", false);
|
60 |
-
define("UTCW_DEFAULT_DAYS_OLD", 0);
|
61 |
-
define("UTCW_DEFAULT_LINE_HEIGHT", "inherit");
|
62 |
-
define("UTCW_DEFAULT_SEPARATOR", " ");
|
63 |
-
define("UTCW_DEFAULT_PREFIX", "");
|
64 |
-
define("UTCW_DEFAULT_SUFFIX", "");
|
65 |
-
define("UTCW_DEFAULT_BG_COLOR", "transparent");
|
66 |
-
define("UTCW_DEFAULT_SHOW_TITLE_TEXT", true);
|
67 |
-
|
68 |
-
|
69 |
-
// Allowed values for miscellanious options in the widget
|
70 |
-
$utcw_allowed_orders = array('random', 'name', 'slug', 'id', 'color', 'count');
|
71 |
-
$utcw_allowed_taxonomies = array(); // Will be set dynamically at load
|
72 |
-
$utcw_allowed_colors = array('none', 'random', 'set', 'span');
|
73 |
-
$utcw_allowed_cases = array('lowercase', 'uppercase', 'capitalize', 'off');
|
74 |
-
$utcw_allowed_tags_list_types = array('exclude', 'include');
|
75 |
-
$utcw_allowed_booleans = array('yes', 'no', 'default');
|
76 |
-
$utcw_allowed_border_styles = array('none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset');
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Ultimate tag cloud widget class
|
80 |
-
* @package UTCW
|
81 |
-
* @author Rickard Andersson <rickard@0x539.se>
|
82 |
-
* @todo use only tags from the current category (if in a category)
|
83 |
-
* @todo check forum and blog for more feature requests
|
84 |
-
* @todo try dynamic stylesheets for better caching/performance
|
85 |
-
*/
|
86 |
-
class UTCW extends WP_Widget {
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Constructor
|
90 |
-
* @return UTCW
|
91 |
-
*/
|
92 |
-
function __construct() {
|
93 |
-
$options = array('description' => __("Highly configurable tag cloud", 'utcw'));
|
94 |
-
parent::WP_Widget(false, __('Ultimate Tag Cloud', 'utcw'), $options);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Action handler for the form in the admin panel
|
99 |
-
* @param array $new_instance
|
100 |
-
* @param array $old_instance
|
101 |
-
* @return array
|
102 |
-
*/
|
103 |
-
function update($new_instance, $old_instance) {
|
104 |
-
|
105 |
-
global $utcw_allowed_orders,
|
106 |
-
$utcw_allowed_taxonomies,
|
107 |
-
$utcw_allowed_colors,
|
108 |
-
$utcw_allowed_cases,
|
109 |
-
$utcw_allowed_tags_list_types,
|
110 |
-
$utcw_allowed_booleans,
|
111 |
-
$utcw_allowed_border_styles,
|
112 |
-
$utcw_allowed_post_types;
|
113 |
-
|
114 |
-
// This will extract all the settings
|
115 |
-
extract($new_instance);
|
116 |
-
/** @var string $title **/
|
117 |
-
/** @var integer $size_from **/
|
118 |
-
/** @var integer $size_to **/
|
119 |
-
/** @var integer $max **/
|
120 |
-
/** @var integer $letter_spacing **/
|
121 |
-
/** @var integer $word_spacing **/
|
122 |
-
/** @var integer $tag_spacing **/
|
123 |
-
/** @var integer $line_height **/
|
124 |
-
/** @var integer $minimum **/
|
125 |
-
/** @var integer $hover_border_width **/
|
126 |
-
/** @var integer $link_border_width **/
|
127 |
-
/** @var integer $days_old **/
|
128 |
-
/** @var string $separator **/
|
129 |
-
/** @var string $prefix **/
|
130 |
-
/** @var string $suffix **/
|
131 |
-
/** @var string $reverse **/
|
132 |
-
/** @var string $tags_list **/
|
133 |
-
/** @var string $color_set **/
|
134 |
-
/** @var string $case_sensitive **/
|
135 |
-
/** @var string $show_title **/
|
136 |
-
/** @var string $debug **/
|
137 |
-
/** @var string $color_span_from */
|
138 |
-
/** @var string $color_span_to */
|
139 |
-
/** @var string $link_bg_color */
|
140 |
-
/** @var string $link_border_color */
|
141 |
-
/** @var string $hover_bg_color */
|
142 |
-
/** @var string $hover_color */
|
143 |
-
/** @var string $hover_border_color */
|
144 |
-
/** @var string $taxonomy */
|
145 |
-
/** @var string $order */
|
146 |
-
/** @var string $color */
|
147 |
-
/** @var string $case */
|
148 |
-
/** @var string $tags_list_type */
|
149 |
-
/** @var string $link_underline */
|
150 |
-
/** @var string $link_bold */
|
151 |
-
/** @var string $link_italic */
|
152 |
-
/** @var string $link_border_style */
|
153 |
-
/** @var string $hover_underline */
|
154 |
-
/** @var string $hover_bold */
|
155 |
-
/** @var string $hover_italic */
|
156 |
-
/** @var string $hover_border_style */
|
157 |
-
/** @var array $authors */
|
158 |
-
/** @var string $show_title_text */
|
159 |
-
/** @var array $post_type */
|
160 |
-
|
161 |
-
// If the load configuration option was selected
|
162 |
-
if ( isset($load_config) && $load_config == "on" && isset($load_config_name) && strlen($load_config_name) > 0 ) {
|
163 |
-
|
164 |
-
// Get the currently saved configurations
|
165 |
-
$configurations = get_option('utcw_saved_configs');
|
166 |
-
|
167 |
-
// Try to get the selected configuration
|
168 |
-
$config = $configurations[ $load_config_name ];
|
169 |
-
|
170 |
-
if ( isset($config) && is_array($config) && count($config) > 0 ) {
|
171 |
-
return $config;
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
// Check all input values and set the default value if any value is invalid or empty
|
177 |
-
$instance = $old_instance;
|
178 |
-
$instance['title'] = strlen($title) > 0 ? apply_filters('widget_title', $title) : apply_filters('widget_title', UTCW_DEFAULT_TITLE);
|
179 |
-
$instance['size_from'] = is_numeric($size_from) ? $size_from : UTCW_DEFAULT_SIZE_FROM;
|
180 |
-
$instance['size_to'] = is_numeric($size_to) ? $size_to : UTCW_DEFAULT_SIZE_TO;
|
181 |
-
$instance['max'] = is_numeric($max) ? $max : UTCW_DEFAULT_MAX;
|
182 |
-
$instance['letter_spacing'] = is_numeric($letter_spacing) ? $letter_spacing : UTCW_DEFAULT_LETTER_SPACING;
|
183 |
-
$instance['word_spacing'] = is_numeric($word_spacing) ? $word_spacing : UTCW_DEFAULT_WORD_SPACING;
|
184 |
-
$instance['tag_spacing'] = is_numeric($tag_spacing) ? $tag_spacing : UTCW_DEFAULT_TAG_SPACING;
|
185 |
-
$instance['line_height'] = is_numeric($line_height) ? $line_height : UTCW_DEFAULT_LINE_HEIGHT;
|
186 |
-
$instance['minimum'] = is_numeric($minimum) ? $minimum : UTCW_DEFAULT_MINIMUM;
|
187 |
-
$instance['hover_border_width'] = is_numeric($hover_border_width) ? $hover_border_width : UTCW_DEFAULT_HOVER_BORDER_WIDTH;
|
188 |
-
$instance['link_border_width'] = is_numeric($link_border_width) ? $link_border_width : UTCW_DEFAULT_LINK_BORDER_WIDTH;
|
189 |
-
$instance['days_old'] = is_numeric($days_old) ? $days_old : UTCW_DEFAULT_DAYS_OLD;
|
190 |
-
$instance['separator'] = strlen($separator) > 0 ? $separator : UTCW_DEFAULT_SEPARATOR;
|
191 |
-
$instance['prefix'] = strlen($prefix) > 0 ? $prefix : UTCW_DEFAULT_PREFIX;
|
192 |
-
$instance['suffix'] = strlen($suffix) > 0 ? $suffix : UTCW_DEFAULT_SUFFIX;
|
193 |
-
$instance['reverse'] = ($reverse == "on");
|
194 |
-
$instance['tags_list'] = strlen($tags_list) > 0 ? @explode(",", $tags_list) : array();
|
195 |
-
$instance['color_set'] = strlen($color_set) > 0 ? @explode(",", $color_set) : array();
|
196 |
-
$instance['authors'] = array();
|
197 |
-
$instance['case_sensitive'] = ($case_sensitive == "on");
|
198 |
-
$instance['show_title'] = ($show_title == "on");
|
199 |
-
$instance['debug'] = ($debug == "on");
|
200 |
-
$instance['show_title_text'] = ($show_title_text == "on");
|
201 |
-
|
202 |
-
$instance['color_span_from'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color_span_from) > 0 ? $color_span_from : "";
|
203 |
-
$instance['color_span_to'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color_span_to) > 0 ? $color_span_to : "";
|
204 |
-
$instance['link_bg_color'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $link_bg_color) > 0 ? $link_bg_color : "";
|
205 |
-
$instance['link_border_color'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $link_border_color) > 0 ? $link_border_color : "";
|
206 |
-
$instance['hover_bg_color'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $hover_bg_color) > 0 ? $hover_bg_color : "";
|
207 |
-
$instance['hover_color'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $hover_color) > 0 ? $hover_color : "";
|
208 |
-
$instance['hover_border_color'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $hover_border_color) > 0 ? $hover_border_color : "";
|
209 |
-
|
210 |
-
$instance['taxonomy'] = in_array($taxonomy, $utcw_allowed_taxonomies) ? $taxonomy : UTCW_DEFAULT_TAXONOMY;
|
211 |
-
$instance['order'] = in_array($order, $utcw_allowed_orders) ? $order : UTCW_DEFAULT_ORDER;
|
212 |
-
$instance['color'] = in_array($color, $utcw_allowed_colors) ? $color : UTCW_DEFAULT_COLOR;
|
213 |
-
$instance['case'] = in_array($case, $utcw_allowed_cases) ? $case : UTCW_DEFAULT_CASE;
|
214 |
-
$instance['tags_list_type'] = in_array($tags_list_type, $utcw_allowed_tags_list_types) ? $tags_list_type : UTCW_DEFAULT_TAGS_LIST_TYPE;
|
215 |
-
$instance['link_underline'] = in_array($link_underline, $utcw_allowed_booleans) ? $link_underline : UTCW_DEFAULT_LINK_UNDERLINE;
|
216 |
-
$instance['link_bold'] = in_array($link_bold, $utcw_allowed_booleans) ? $link_bold : UTCW_DEFAULT_LINK_BOLD;
|
217 |
-
$instance['link_italic'] = in_array($link_italic, $utcw_allowed_booleans) ? $link_italic : UTCW_DEFAULT_LINK_ITALIC;
|
218 |
-
$instance['link_border_style'] = in_array($link_border_style, $utcw_allowed_border_styles) ? $link_border_style : UTCW_DEFAULT_LINK_BORDER_STYLE;
|
219 |
-
$instance['hover_underline'] = in_array($hover_underline, $utcw_allowed_booleans) ? $hover_underline : UTCW_DEFAULT_HOVER_UNDERLINE;
|
220 |
-
$instance['hover_bold'] = in_array($hover_bold, $utcw_allowed_booleans) ? $hover_bold : UTCW_DEFAULT_HOVER_BOLD;
|
221 |
-
$instance['hover_italic'] = in_array($hover_italic, $utcw_allowed_booleans) ? $hover_italic : UTCW_DEFAULT_HOVER_ITALIC;
|
222 |
-
$instance['hover_border_style'] = in_array($hover_border_style, $utcw_allowed_border_styles) ? $hover_border_style : UTCW_DEFAULT_HOVER_BORDER_STYLE;
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
// Only accept numeric authors (user ID)
|
227 |
-
if (is_array($authors)) {
|
228 |
-
foreach ($authors as $author) {
|
229 |
-
if (is_numeric($author)) {
|
230 |
-
$instance['authors'][] = $author;
|
231 |
-
}
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
// Remove spaces in the comma separated list
|
236 |
-
foreach ($instance['tags_list'] as $key => $value) {
|
237 |
-
$instance['tags_list'][$key] = trim($value);
|
238 |
-
}
|
239 |
-
|
240 |
-
// Only allow hexadecimal color values in the format #ffffff and #fff
|
241 |
-
foreach ($instance['color_set'] as $key => $color) {
|
242 |
-
|
243 |
-
$instance['color_set'][$key] = trim($color);
|
244 |
-
|
245 |
-
if (preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color) == 0) {
|
246 |
-
unset($instance['color_set'][$key]);
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
-
// Clear previous post types and add new from input data
|
251 |
-
$instance['post_type'] = array();
|
252 |
-
|
253 |
-
foreach ( $post_type as $pt) {
|
254 |
-
if ( in_array($pt, $utcw_allowed_post_types) ) {
|
255 |
-
$instance['post_type'][] = $pt;
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
// If the save_config option was selected
|
260 |
-
if ( isset($save_config) && $save_config == "on" ) {
|
261 |
-
|
262 |
-
// If no or empty name was submitted, fallback to the current date and time
|
263 |
-
if ( !isset($save_config_name) || strlen($save_config_name) == 0 ) {
|
264 |
-
$save_config_name = date( get_option('date_format') . " " . get_option('time_format') );
|
265 |
-
}
|
266 |
-
|
267 |
-
// Load previously saved configurations
|
268 |
-
$configurations = get_option('utcw_saved_configs');
|
269 |
-
|
270 |
-
// If no configurations has been saved before, create a new array
|
271 |
-
if ( $configurations === false ) {
|
272 |
-
$configurations = array();
|
273 |
-
}
|
274 |
-
|
275 |
-
// Save
|
276 |
-
$configurations[ $save_config_name ] = $instance;
|
277 |
-
update_option('utcw_saved_configs', $configurations);
|
278 |
-
|
279 |
-
}
|
280 |
-
|
281 |
-
return $instance;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Function for displaying the widget on the page
|
286 |
-
* @param array $args
|
287 |
-
* @param array $instance
|
288 |
-
* @return void
|
289 |
-
*/
|
290 |
-
function widget($args, $instance) {
|
291 |
-
do_utcw(array_merge($instance, $args));
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Function for handling the widget control in admin panel
|
296 |
-
* @param array $instance
|
297 |
-
* @return void|string
|
298 |
-
*/
|
299 |
-
function form($instance) {
|
300 |
-
|
301 |
-
// Get stored preferences
|
302 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
303 |
-
$title = isset( $instance['title'] ) ? esc_attr($instance['title']) : '' ;
|
304 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
305 |
-
$show_title_text = isset( $instance['show_title_text'] ) ? $instance['show_title_text'] : '' ;
|
306 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
307 |
-
$order = isset( $instance['order'] ) ? esc_attr($instance['order']) : '' ;
|
308 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
309 |
-
$size_from = isset( $instance['size_from'] ) ? esc_attr($instance['size_from']) : '' ;
|
310 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
311 |
-
$size_to = isset( $instance['size_to'] ) ? esc_attr($instance['size_to']) : '' ;
|
312 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
313 |
-
$max = isset( $instance['max'] ) ? esc_attr($instance['max']) : '' ;
|
314 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
315 |
-
$taxonomy = isset( $instance['taxonomy'] ) ? esc_attr($instance['taxonomy']) : '' ;
|
316 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
317 |
-
$color = isset( $instance['color'] ) ? esc_attr($instance['color']) : '' ;
|
318 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
319 |
-
$color_span_from = isset( $instance['color_span_from'] ) ? esc_attr($instance['color_span_from']) : '' ;
|
320 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
321 |
-
$color_span_to = isset( $instance['color_span_to'] ) ? esc_attr($instance['color_span_to']) : '' ;
|
322 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
323 |
-
$letter_spacing = isset( $instance['letter_spacing'] ) ? esc_attr($instance['letter_spacing']) : '' ;
|
324 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
325 |
-
$word_spacing = isset( $instance['word_spacing'] ) ? esc_attr($instance['word_spacing']) : '' ;
|
326 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
327 |
-
$tag_spacing = isset( $instance['tag_spacing'] ) ? esc_attr($instance['tag_spacing']) : '' ;
|
328 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
329 |
-
$case = isset( $instance['case'] ) ? esc_attr($instance['case']) : '' ;
|
330 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
331 |
-
$minimum = isset( $instance['minimum'] ) ? esc_attr($instance['minimum']) : '' ;
|
332 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
333 |
-
$tags_list = isset( $instance['tags_list'] ) && is_array($instance['tags_list']) ? $instance['tags_list'] : array();
|
334 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
335 |
-
$tags_list_type = isset( $instance['tags_list_type'] ) ? esc_attr($instance['tags_list_type']) : '' ;
|
336 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
337 |
-
$reverse = isset( $instance['reverse'] ) ? $instance['reverse'] : '' ;
|
338 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
339 |
-
$authors = isset( $instance['authors'] ) && is_array($instance['authors']) ? $instance['authors'] : array();
|
340 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
341 |
-
$color_set = isset( $instance['color_set'] ) && is_array($instance['color_set']) ? $instance['color_set'] : array();
|
342 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
343 |
-
$case_sensitive = isset( $instance['case_sensitive'] ) ? $instance['case_sensitive'] : '' ;
|
344 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
345 |
-
$debug = isset( $instance['debug'] ) ? $instance['debug'] : '' ;
|
346 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
347 |
-
$show_title = isset( $instance['show_title'] ) ? $instance['show_title'] : '' ;
|
348 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
349 |
-
$link_underline = isset( $instance['link_underline'] ) ? $instance['link_underline'] : '' ;
|
350 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
351 |
-
$link_bold = isset( $instance['link_bold'] ) ? $instance['link_bold'] : '' ;
|
352 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
353 |
-
$link_italic = isset( $instance['link_italic'] ) ? $instance['link_italic'] : '' ;
|
354 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
355 |
-
$link_bg_color = isset( $instance['link_bg_color'] ) ? esc_attr($instance['link_bg_color']) : '' ;
|
356 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
357 |
-
$link_border_width = isset( $instance['link_border_width'] ) ? esc_attr($instance['link_border_width']) : '' ;
|
358 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
359 |
-
$link_border_style = isset( $instance['link_border_style'] ) ? $instance['link_border_style'] : '' ;
|
360 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
361 |
-
$link_border_color = isset( $instance['link_border_color'] ) ? esc_attr($instance['link_border_color']) : '' ;
|
362 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
363 |
-
$hover_underline = isset( $instance['hover_underline'] ) ? $instance['hover_underline'] : '' ;
|
364 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
365 |
-
$hover_bold = isset( $instance['hover_bold'] ) ? $instance['hover_bold'] : '' ;
|
366 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
367 |
-
$hover_italic = isset( $instance['hover_italic'] ) ? $instance['hover_italic'] : '' ;
|
368 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
369 |
-
$hover_bg_color = isset( $instance['hover_bg_color'] ) ? esc_attr($instance['hover_bg_color']) : '' ;
|
370 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
371 |
-
$hover_color = isset( $instance['hover_color'] ) ? esc_attr($instance['hover_color']) : '' ;
|
372 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
373 |
-
$hover_border_width = isset( $instance['hover_border_width'] ) ? esc_attr($instance['hover_border_width']) : '' ;
|
374 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
375 |
-
$hover_border_style = isset( $instance['hover_border_style'] ) ? $instance['hover_border_style'] : '' ;
|
376 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
377 |
-
$hover_border_color = isset( $instance['hover_border_color'] ) ? esc_attr($instance['hover_border_color']) : '' ;
|
378 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
379 |
-
$days_old = isset( $instance['days_old'] ) ? esc_attr($instance['days_old']) : '' ;
|
380 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
381 |
-
$line_height = isset( $instance['line_height'] ) ? esc_attr($instance['line_height']) : '' ;
|
382 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
383 |
-
$separator = isset( $instance['separator'] ) ? esc_attr($instance['separator']) : '';
|
384 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
385 |
-
$prefix = isset( $instance['prefix'] ) ? esc_attr($instance['prefix']) : '';
|
386 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
387 |
-
$suffix = isset( $instance['suffix'] ) ? esc_attr($instance['suffix']) : '';
|
388 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
389 |
-
$post_type = isset( $instance['post_type'] ) ? $instance['post_type'] : array('post');
|
390 |
-
|
391 |
-
|
392 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
393 |
-
$configurations = get_option('utcw_saved_configs');
|
394 |
-
|
395 |
-
$args = array(
|
396 |
-
'public' => true
|
397 |
-
);
|
398 |
-
|
399 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
400 |
-
$available_post_types = get_post_types($args);
|
401 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
402 |
-
$available_taxonomies = get_taxonomies();
|
403 |
-
|
404 |
-
// Content of the widget settings form
|
405 |
-
require "settings.php";
|
406 |
-
}
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Returns the users on this blog
|
410 |
-
* @return array
|
411 |
-
*/
|
412 |
-
function get_users() {
|
413 |
-
|
414 |
-
global $wp_version;
|
415 |
-
|
416 |
-
if ( (float)$wp_version < 3.1 ) {
|
417 |
-
return get_users_of_blog();
|
418 |
-
} else {
|
419 |
-
return get_users();
|
420 |
-
}
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
/**
|
425 |
-
* do_utcw - Prints markup for the widget
|
426 |
-
* @param array $args An array with widget settings. See {@link http://wordpress.org/extend/plugins/ultimate-tag-cloud-widget/other_notes/} for details on which options you can set.
|
427 |
-
* @return void|string
|
428 |
-
*/
|
429 |
-
function do_utcw($args) {
|
430 |
-
|
431 |
-
/** @var wpdb $wpdb */
|
432 |
-
global $wpdb;
|
433 |
-
|
434 |
-
if (is_array($args)) {
|
435 |
-
extract($args);
|
436 |
-
}
|
437 |
-
|
438 |
-
/** @var string $before_title */
|
439 |
-
/** @var string $after_title */
|
440 |
-
/** @var string $before_widget */
|
441 |
-
/** @var string $after_widget */
|
442 |
-
/** @var string $title **/
|
443 |
-
/** @var integer $size_from **/
|
444 |
-
/** @var integer $size_to **/
|
445 |
-
/** @var integer $max **/
|
446 |
-
/** @var integer $letter_spacing **/
|
447 |
-
/** @var integer $word_spacing **/
|
448 |
-
/** @var integer $tag_spacing **/
|
449 |
-
/** @var integer $line_height **/
|
450 |
-
/** @var integer $minimum **/
|
451 |
-
/** @var integer $hover_border_width **/
|
452 |
-
/** @var integer $link_border_width **/
|
453 |
-
/** @var integer $days_old **/
|
454 |
-
/** @var string $separator **/
|
455 |
-
/** @var string $prefix **/
|
456 |
-
/** @var string $suffix **/
|
457 |
-
/** @var bool $reverse **/
|
458 |
-
/** @var string $tags_list **/
|
459 |
-
/** @var string $color_set **/
|
460 |
-
/** @var bool $case_sensitive **/
|
461 |
-
/** @var bool $show_title **/
|
462 |
-
/** @var bool $debug **/
|
463 |
-
/** @var string $color_span_from */
|
464 |
-
/** @var string $color_span_to */
|
465 |
-
/** @var string $link_bg_color */
|
466 |
-
/** @var string $link_border_color */
|
467 |
-
/** @var string $hover_bg_color */
|
468 |
-
/** @var string $hover_color */
|
469 |
-
/** @var string $hover_border_color */
|
470 |
-
/** @var string $taxonomy */
|
471 |
-
/** @var string $order */
|
472 |
-
/** @var string $color */
|
473 |
-
/** @var string $case */
|
474 |
-
/** @var string $tags_list_type */
|
475 |
-
/** @var string $link_underline */
|
476 |
-
/** @var string $link_bold */
|
477 |
-
/** @var string $link_italic */
|
478 |
-
/** @var string $link_border_style */
|
479 |
-
/** @var string $hover_underline */
|
480 |
-
/** @var string $hover_bold */
|
481 |
-
/** @var string $hover_italic */
|
482 |
-
/** @var string $hover_border_style */
|
483 |
-
/** @var array $authors */
|
484 |
-
/** @var bool $show_title_text */
|
485 |
-
/** @var array $post_type */
|
486 |
-
|
487 |
-
global $utcw_allowed_orders,
|
488 |
-
$utcw_allowed_taxonomies,
|
489 |
-
$utcw_allowed_colors,
|
490 |
-
$utcw_allowed_cases,
|
491 |
-
$utcw_allowed_tags_list_types,
|
492 |
-
$utcw_allowed_booleans,
|
493 |
-
$utcw_allowed_border_styles,
|
494 |
-
$utcw_allowed_post_types;
|
495 |
-
|
496 |
-
// Parse settings from $instance and set default values where empty or invalid
|
497 |
-
$title = strlen($title) > 0 ? $title : UTCW_DEFAULT_TITLE;
|
498 |
-
$show_title_text = is_bool($show_title_text) ? $show_title_text : UTCW_DEFAULT_SHOW_TITLE_TEXT;
|
499 |
-
$size_from = is_numeric($size_from) ? $size_from : UTCW_DEFAULT_SIZE_FROM;
|
500 |
-
$size_to = is_numeric($size_to) ? $size_to : UTCW_DEFAULT_SIZE_TO;
|
501 |
-
$max = is_numeric($max) ? $max : UTCW_DEFAULT_MAX;
|
502 |
-
$reverse = is_bool($reverse) ? $reverse : UTCW_DEFAULT_REVERSE;
|
503 |
-
$minimum = is_numeric($minimum) ? $minimum : UTCW_DEFAULT_MINIMUM;
|
504 |
-
$letter_spacing = is_numeric($letter_spacing) ? $letter_spacing . "px" : UTCW_DEFAULT_LETTER_SPACING;
|
505 |
-
$word_spacing = is_numeric($word_spacing) ? $word_spacing . "px" : UTCW_DEFAULT_WORD_SPACING;
|
506 |
-
$tag_spacing = is_numeric($tag_spacing) ? $tag_spacing . "px" : UTCW_DEFAULT_TAG_SPACING;
|
507 |
-
$color_span_from = is_string($color_span_from) ? $color_span_from : "";
|
508 |
-
$color_span_to = is_string($color_span_to) ? $color_span_to : "";
|
509 |
-
$case_sensitive = is_bool($case_sensitive) ? $case_sensitive : UTCW_DEFAULT_CASE_SENSITIVE;
|
510 |
-
$show_title = is_bool($show_title) ? $show_title : UTCW_DEFAULT_SHOW_TITLE;
|
511 |
-
$link_bg_color = is_string($link_bg_color) ? $link_bg_color : UTCW_DEFAULT_BG_COLOR;
|
512 |
-
$link_border_width = is_numeric($link_border_width) ? $link_border_width . "px" : UTCW_DEFAULT_LINK_BORDER_WIDTH;
|
513 |
-
$link_border_color = is_string($link_border_color) ? $link_border_color : UTCW_DEFAULT_LINK_BORDER_COLOR;
|
514 |
-
$hover_bg_color = is_string($hover_bg_color) ? $hover_bg_color : UTCW_DEFAULT_HOVER_BG_COLOR;
|
515 |
-
$hover_color = is_string($hover_color) ? $hover_color : UTCW_DEFAULT_HOVER_COLOR;
|
516 |
-
$hover_border_width = is_numeric($hover_border_width) ? $hover_border_width . "px" : UTCW_DEFAULT_HOVER_BORDER_WIDTH;
|
517 |
-
$hover_border_color = is_string($hover_border_color) ? $hover_border_color : UTCW_DEFAULT_HOVER_BORDER_COLOR;
|
518 |
-
$days_old = is_numeric($days_old) ? $days_old : UTCW_DEFAULT_DAYS_OLD;
|
519 |
-
$line_height = is_numeric($line_height) ? $line_height : UTCW_DEFAULT_LINE_HEIGHT;
|
520 |
-
$separator = is_string($separator) ? $separator : UTCW_DEFAULT_SEPARATOR;
|
521 |
-
$prefix = is_string($prefix) ? $prefix : UTCW_DEFAULT_PREFIX;
|
522 |
-
$suffix = is_string($suffix) ? $suffix : UTCW_DEFAULT_SUFFIX;
|
523 |
-
|
524 |
-
$order = in_array($order, $utcw_allowed_orders) ? $order : UTCW_DEFAULT_ORDER;
|
525 |
-
$taxonomy = in_array($taxonomy, $utcw_allowed_taxonomies) ? $taxonomy : UTCW_DEFAULT_TAXONOMY;
|
526 |
-
$color = in_array($color, $utcw_allowed_colors) ? $color : UTCW_DEFAULT_COLOR;
|
527 |
-
$case = in_array($case, $utcw_allowed_cases) ? $case : UTCW_DEFAULT_CASE;
|
528 |
-
$tags_list_type = in_array($tags_list_type, $utcw_allowed_tags_list_types) ? $tags_list_type : UTCW_DEFAULT_TAGS_LIST_TYPE;
|
529 |
-
$link_underline = in_array($link_underline, $utcw_allowed_booleans) ? $link_underline : UTCW_DEFAULT_LINK_UNDERLINE;
|
530 |
-
$link_bold = in_array($link_bold, $utcw_allowed_booleans) ? $link_bold : UTCW_DEFAULT_LINK_BOLD;
|
531 |
-
$link_italic = in_array($link_italic, $utcw_allowed_booleans) ? $link_italic : UTCW_DEFAULT_LINK_ITALIC;
|
532 |
-
$link_border_style = in_array($link_border_style, $utcw_allowed_border_styles) ? $link_border_style : UTCW_DEFAULT_LINK_BORDER_STYLE;
|
533 |
-
$hover_underline = in_array($hover_underline, $utcw_allowed_booleans) ? $hover_underline : UTCW_DEFAULT_HOVER_UNDERLINE;
|
534 |
-
$hover_bold = in_array($hover_bold, $utcw_allowed_booleans) ? $hover_bold : UTCW_DEFAULT_HOVER_BOLD;
|
535 |
-
$hover_italic = in_array($hover_italic, $utcw_allowed_booleans) ? $hover_italic : UTCW_DEFAULT_HOVER_ITALIC;
|
536 |
-
$hover_border_style = in_array($hover_border_style, $utcw_allowed_border_styles) ? $hover_border_style : UTCW_DEFAULT_HOVER_BORDER_STYLE;
|
537 |
-
|
538 |
-
$return = (isset($return) && $return == true);
|
539 |
-
|
540 |
-
// Auhtors can be given as a comma separated list from the shortcode,
|
541 |
-
// try to explode it and validate the values
|
542 |
-
if (isset($authors)) {
|
543 |
-
if (!is_array($authors)) {
|
544 |
-
$authors = explode(",", $authors);
|
545 |
-
|
546 |
-
foreach ($authors as $key => $author) {
|
547 |
-
if (!is_numeric($author)) {
|
548 |
-
unset($authors[ $key ]);
|
549 |
-
}
|
550 |
-
}
|
551 |
-
}
|
552 |
-
} else {
|
553 |
-
$authors = array();
|
554 |
-
}
|
555 |
-
|
556 |
-
// Same for $tags_list
|
557 |
-
if (isset($tags_list)) {
|
558 |
-
if (!is_array($tags_list)) {
|
559 |
-
$tags_list = explode(",", $tags_list);
|
560 |
-
|
561 |
-
foreach ($tags_list as $key => $tl) {
|
562 |
-
if (!is_numeric($tl)) {
|
563 |
-
unset($tags_list[ $key ]);
|
564 |
-
}
|
565 |
-
}
|
566 |
-
}
|
567 |
-
} else {
|
568 |
-
$tags_list = array();
|
569 |
-
}
|
570 |
-
|
571 |
-
// Same for $color_set but with different validation
|
572 |
-
if (isset($color_set)) {
|
573 |
-
if (!is_array($color_set)) {
|
574 |
-
$color_set = explode(",", $color_set);
|
575 |
-
|
576 |
-
foreach ($color_set as $key => $cs) {
|
577 |
-
if (!preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $cs)) {
|
578 |
-
unset($color_set[ $key ]);
|
579 |
-
}
|
580 |
-
}
|
581 |
-
}
|
582 |
-
} else {
|
583 |
-
$color_set = array();
|
584 |
-
}
|
585 |
-
|
586 |
-
// Validate post types against the array of allowed ones
|
587 |
-
if (isset($post_type)) {
|
588 |
-
if (!is_array($post_type)) {
|
589 |
-
$post_type = explode(",", $post_type);
|
590 |
-
}
|
591 |
-
|
592 |
-
foreach ($post_type as $key => $pt) {
|
593 |
-
if (!in_array($pt, $utcw_allowed_post_types)) {
|
594 |
-
unset($post_type[ $key ]);
|
595 |
-
}
|
596 |
-
}
|
597 |
-
} else {
|
598 |
-
$post_type = array('post');
|
599 |
-
}
|
600 |
-
|
601 |
-
// Fallback values
|
602 |
-
$counts = array();
|
603 |
-
$tag_array = array();
|
604 |
-
|
605 |
-
// Build SQL query
|
606 |
-
$sql[] = "SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count`";
|
607 |
-
$sql[] = "FROM `$wpdb->posts` AS p";
|
608 |
-
$sql[] = "LEFT JOIN `$wpdb->term_relationships` AS tr ON tr.object_id = p.ID";
|
609 |
-
$sql[] = "LEFT JOIN `$wpdb->term_taxonomy` AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
|
610 |
-
$sql[] = "LEFT JOIN `$wpdb->terms` AS t ON t.term_id = tt.term_id";
|
611 |
-
$sql[] = "WHERE tt.taxonomy = '$taxonomy'";
|
612 |
-
|
613 |
-
// Setting post type directive
|
614 |
-
if (count($post_type) == 1) {
|
615 |
-
$sql[] = "AND post_type = '$post_type[0]'";
|
616 |
-
} else {
|
617 |
-
$sql[] = "AND post_type IN ('" . implode("','", $post_type) . "')";
|
618 |
-
}
|
619 |
-
|
620 |
-
// Setting post status directive
|
621 |
-
if (is_user_logged_in() === true) {
|
622 |
-
$sql[] = "AND (post_status = 'publish' OR post_status = 'private')";
|
623 |
-
} else {
|
624 |
-
$sql[] = "AND post_status = 'publish'";
|
625 |
-
}
|
626 |
-
|
627 |
-
// Setting post author directive
|
628 |
-
if (count($authors) > 0) {
|
629 |
-
$sql[] = "AND post_author IN (" . implode(",", $authors) . ")";
|
630 |
-
}
|
631 |
-
|
632 |
-
// Setting include or exclude directive
|
633 |
-
if (count($tags_list) > 0) {
|
634 |
-
|
635 |
-
$tags_list_operator = ($tags_list_type == "include") ? "IN" : "NOT IN";
|
636 |
-
|
637 |
-
if (is_array_numeric($tags_list)) {
|
638 |
-
$sql[] = "AND t.term_id ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "')";
|
639 |
-
} else {
|
640 |
-
$sql[] = "AND t.name ". $tags_list_operator ." ('" . implode("', '", $tags_list) . "')";
|
641 |
-
}
|
642 |
-
}
|
643 |
-
|
644 |
-
// Setting to only include posts newer then a
|
645 |
-
if (is_numeric($days_old) && $days_old > 0) {
|
646 |
-
$sql[] = "AND post_date > '" . date("Y-m-d", strtotime("-" . $days_old . " days") ) . "'";
|
647 |
-
}
|
648 |
-
|
649 |
-
// Setting minimum post count directive
|
650 |
-
if (is_numeric($minimum)) {
|
651 |
-
$sql[] = "GROUP BY tr.term_taxonomy_id HAVING count >= $minimum";
|
652 |
-
} else {
|
653 |
-
$sql[] = "GROUP BY tr.term_taxonomy_id";
|
654 |
-
}
|
655 |
-
|
656 |
-
$sql[] = "ORDER BY count DESC";
|
657 |
-
$sql[] = "LIMIT $max";
|
658 |
-
|
659 |
-
$query = implode("\n", $sql);
|
660 |
-
|
661 |
-
$tag_data = $wpdb->get_results($query);
|
662 |
-
|
663 |
-
if (count($tag_data) > 0) {
|
664 |
-
|
665 |
-
// Extract counts and create an array to work with
|
666 |
-
foreach ($tag_data as $tag) {
|
667 |
-
$counts[] = $tag->count;
|
668 |
-
$tag_array[] = array(
|
669 |
-
'term_id' => $tag->term_id,
|
670 |
-
'count' => $tag->count,
|
671 |
-
'slug' => $tag->slug,
|
672 |
-
'name' => $tag->name,
|
673 |
-
'link' => get_term_link(intval($tag->term_id), $taxonomy),
|
674 |
-
'color' => ""
|
675 |
-
);
|
676 |
-
}
|
677 |
-
|
678 |
-
// Highest and lowest values
|
679 |
-
$min_count = min($counts);
|
680 |
-
$max_count = max($counts);
|
681 |
-
|
682 |
-
// Get the step size
|
683 |
-
$font_step = calc_step($min_count, $max_count, $size_from, $size_to);
|
684 |
-
|
685 |
-
// Calculate sizes for all tags
|
686 |
-
foreach ($tag_array as $key => $tag) {
|
687 |
-
$tag_array[$key]['size'] = $size_from + ( ( $tag['count'] - $min_count ) * $font_step );
|
688 |
-
}
|
689 |
-
|
690 |
-
// Check the coloring preference, default is none
|
691 |
-
switch ($color) {
|
692 |
-
|
693 |
-
// Just get an randomized value, who would ever use this?!
|
694 |
-
case "random":
|
695 |
-
foreach ($tag_array as $key => $tag) {
|
696 |
-
$tag_array[$key]['color'] = sprintf("#%s%s%s", dechex(rand() % 255), dechex(rand() % 255), dechex(rand() % 255));
|
697 |
-
}
|
698 |
-
break;
|
699 |
-
|
700 |
-
// Select a random value from the preset colors
|
701 |
-
case "set":
|
702 |
-
if (is_array($color_set) && count($color_set) > 0) {
|
703 |
-
foreach ($tag_array as $key => $tag) {
|
704 |
-
$tag_array[$key]['color'] = $color_set[ array_rand($color_set) ];
|
705 |
-
}
|
706 |
-
}
|
707 |
-
break;
|
708 |
-
|
709 |
-
// Calculate colors in a span between two values
|
710 |
-
case "span":
|
711 |
-
|
712 |
-
// Check the color format, #fff or #fffff
|
713 |
-
if (strlen($color_span_from) == 4) {
|
714 |
-
$red_from = hexdec(sprintf("%s%s", $color_span_from[1], $color_span_from[1]));
|
715 |
-
$green_from = hexdec(sprintf("%s%s", $color_span_from[2], $color_span_from[2]));
|
716 |
-
$blue_from = hexdec(sprintf("%s%s", $color_span_from[3], $color_span_from[3]));
|
717 |
-
} else {
|
718 |
-
$red_from = hexdec(substr($color_span_from, 1, 2));
|
719 |
-
$green_from = hexdec(substr($color_span_from, 3, 2));
|
720 |
-
$blue_from = hexdec(substr($color_span_from, 5, 2));
|
721 |
-
}
|
722 |
-
if (strlen($color_span_to) == 4) {
|
723 |
-
$red_to = hexdec(sprintf("%s%s", $color_span_to[1], $color_span_to[1]));
|
724 |
-
$green_to = hexdec(sprintf("%s%s", $color_span_to[2], $color_span_to[2]));
|
725 |
-
$blue_to = hexdec(sprintf("%s%s", $color_span_to[3], $color_span_to[3]));
|
726 |
-
} else {
|
727 |
-
$red_to = hexdec(substr($color_span_to, 1, 2));
|
728 |
-
$green_to = hexdec(substr($color_span_to, 3, 2));
|
729 |
-
$blue_to = hexdec(substr($color_span_to, 5, 2));
|
730 |
-
}
|
731 |
-
|
732 |
-
// Calculate steps for all the colors.
|
733 |
-
$red_step = calc_step($min_count, $max_count, $red_from, $red_to);
|
734 |
-
$green_step = calc_step($min_count, $max_count, $green_from, $green_to);
|
735 |
-
$blue_step = calc_step($min_count, $max_count, $blue_from, $blue_to);
|
736 |
-
|
737 |
-
// Iterate all tags and calculate their color
|
738 |
-
foreach ($tag_array as $key => $tag) {
|
739 |
-
$red = round($red_from + ( ( $tag['count'] - $min_count ) * $red_step ));
|
740 |
-
$green = round($green_from + ( ( $tag['count'] - $min_count ) * $green_step ));
|
741 |
-
$blue = round($blue_from + ( ( $tag['count'] - $min_count ) * $blue_step ));
|
742 |
-
|
743 |
-
$tag_array[$key]['color'] = sprintf("rgb(%s,%s,%s)", $red, $green, $blue);
|
744 |
-
}
|
745 |
-
break;
|
746 |
-
}
|
747 |
-
|
748 |
-
// Check the ordering preference, default is name
|
749 |
-
switch ($order) {
|
750 |
-
case "random":
|
751 |
-
shuffle($tag_array);
|
752 |
-
break;
|
753 |
-
|
754 |
-
case "count":
|
755 |
-
usort($tag_array, 'utcw_cmp_count');
|
756 |
-
break;
|
757 |
-
|
758 |
-
case "slug";
|
759 |
-
usort($tag_array, $case_sensitive === true ? 'utcw_cmp_slug' : 'utcw_icmp_slug');
|
760 |
-
break;
|
761 |
-
|
762 |
-
case "id":
|
763 |
-
usort($tag_array, 'utcw_cmp_id');
|
764 |
-
break;
|
765 |
-
|
766 |
-
case "color":
|
767 |
-
usort($tag_array, 'utcw_cmp_color');
|
768 |
-
break;
|
769 |
-
|
770 |
-
case "name":
|
771 |
-
default:
|
772 |
-
usort($tag_array, $case_sensitive === true ? 'utcw_cmp_name' : 'utcw_icmp_name');
|
773 |
-
break;
|
774 |
-
}
|
775 |
-
|
776 |
-
// Reverse the list if the user prefers it that way. Reversing an random sorted result seems correct.
|
777 |
-
if ($reverse === true) {
|
778 |
-
$tag_array = array_reverse($tag_array);
|
779 |
-
}
|
780 |
-
}
|
781 |
-
|
782 |
-
switch ($case) {
|
783 |
-
case 'uppercase':
|
784 |
-
$text_transform = 'text-transform: uppercase;';
|
785 |
-
break;
|
786 |
-
|
787 |
-
case 'lowercase':
|
788 |
-
$text_transform = 'text-transform: lowercase;';
|
789 |
-
break;
|
790 |
-
|
791 |
-
case 'capitalize':
|
792 |
-
$text_transform = 'text-transform: capitalize;';
|
793 |
-
break;
|
794 |
-
|
795 |
-
default:
|
796 |
-
$text_transform = '';
|
797 |
-
}
|
798 |
-
|
799 |
-
if ($return === true) {
|
800 |
-
ob_start();
|
801 |
-
}
|
802 |
-
|
803 |
-
// Print the tag cloud content
|
804 |
-
echo $before_widget;
|
805 |
-
|
806 |
-
if ( $show_title_text ) {
|
807 |
-
echo $before_title . $title . $after_title;
|
808 |
-
}
|
809 |
-
|
810 |
-
printf('<div class="widget_tag_cloud" style="letter-spacing:%s;word-spacing:%s;%s">', $letter_spacing, $word_spacing, $text_transform);
|
811 |
-
|
812 |
-
$hover_style = "";
|
813 |
-
$link_style = "";
|
814 |
-
|
815 |
-
if ($link_underline != "default") {
|
816 |
-
$link_style .= "text-decoration:" . ($link_underline == "yes" ? "underline !important;" : "none !important;");
|
817 |
-
}
|
818 |
-
if ($link_bold != "default") {
|
819 |
-
$link_style .= "font-weight:" . ($link_bold == "yes" ? "bold !important;" : "normal !important;");
|
820 |
-
}
|
821 |
-
if ($link_italic != "default") {
|
822 |
-
$link_style .= "font-style:" . ($link_italic == "yes" ? "italic !important;" : "normal !important;");
|
823 |
-
}
|
824 |
-
if ($link_bg_color != "transparent") {
|
825 |
-
$link_style .= sprintf("background-color:%s !important;", $link_bg_color);
|
826 |
-
}
|
827 |
-
if (strlen($link_border_style) > 0) {
|
828 |
-
$link_style .= sprintf("border-style:%s !important;", $link_border_style);
|
829 |
-
}
|
830 |
-
if (strlen($link_border_color) > 0) {
|
831 |
-
$link_style .= sprintf("border-color:%s !important;", $link_border_color);
|
832 |
-
}
|
833 |
-
if (strlen($link_border_width) > 0) {
|
834 |
-
$link_style .= sprintf("border-width:%s !important;", $link_border_width);
|
835 |
-
}
|
836 |
-
|
837 |
-
if ($hover_underline != "default") {
|
838 |
-
$hover_style .= "text-decoration:" . ($hover_underline == "yes" ? "underline !important;" : "none !important;");
|
839 |
-
}
|
840 |
-
if ($hover_bold != "default") {
|
841 |
-
$hover_style .= "font-weight:" . ($hover_bold == "yes" ? "bold !important;" : "normal !important;");
|
842 |
-
}
|
843 |
-
if ($hover_italic != "default") {
|
844 |
-
$hover_style .= "font-style:" . ($hover_italic == "yes" ? "italic !important;" : "normal !important;");
|
845 |
-
}
|
846 |
-
if ($hover_bg_color != "transparent") {
|
847 |
-
$hover_style .= sprintf("background-color:%s !important;", $hover_bg_color);
|
848 |
-
}
|
849 |
-
if ($hover_color != "default") {
|
850 |
-
$hover_style .= sprintf("color:%s !important;", $hover_color);
|
851 |
-
}
|
852 |
-
if (strlen($hover_border_style) > 0) {
|
853 |
-
$hover_style .= sprintf("border-style:%s !important;", $hover_border_style);
|
854 |
-
}
|
855 |
-
if (strlen($hover_border_color) > 0) {
|
856 |
-
$hover_style .= sprintf("border-color:%s !important;", $hover_border_color);
|
857 |
-
}
|
858 |
-
if (strlen($hover_border_width) > 0) {
|
859 |
-
$hover_style .= sprintf("border-width:%s !important;", $hover_border_width);
|
860 |
-
}
|
861 |
-
if (is_numeric($tag_spacing)) {
|
862 |
-
$link_style .= sprintf("margin-right: %s !important;", $tag_spacing);
|
863 |
-
}
|
864 |
-
if (is_numeric($line_height)) {
|
865 |
-
$link_style .= sprintf("line-height: %spx !important;", $line_height);
|
866 |
-
}
|
867 |
-
|
868 |
-
if (strlen($hover_style) > 0 || strlen($link_style)) {
|
869 |
-
printf('<style type="text/css">.utcw-tag-link{%s}.utcw-tag-link:hover{%s}</style>', $link_style, $hover_style);
|
870 |
-
}
|
871 |
-
|
872 |
-
$tags_left = count($tag_array);
|
873 |
-
|
874 |
-
foreach ($tag_array as $tag) {
|
875 |
-
// Extracts tag data
|
876 |
-
extract($tag);
|
877 |
-
/** @var integer $size */
|
878 |
-
/** @var integer $count */
|
879 |
-
/** @var integer $term_id */
|
880 |
-
/** @var string $link */
|
881 |
-
/** @var string $name */
|
882 |
-
/** @var string $separator */
|
883 |
-
|
884 |
-
if ($tags_left-- <= 1) {
|
885 |
-
$separator = '';
|
886 |
-
}
|
887 |
-
|
888 |
-
$link_title = $show_title === true ? sprintf(' title="' . _n("%s topic", "%s topics", $count) . '"', $count) : "";
|
889 |
-
|
890 |
-
printf('<span style="font-size:%spx;%s">%s<a class="utcw-tag-link tag-link-%s" href="%s" style="font-size:%spx;%s"%s>%s</a>%s</span>%s',
|
891 |
-
$size, strlen($color) > 0 ? "color:$color;" : "", $prefix, $term_id, $link, $size, strlen($color) > 0 ? "color:$color;" : "", $link_title, $name, $suffix, $separator);
|
892 |
-
}
|
893 |
-
|
894 |
-
echo "</div>";
|
895 |
-
|
896 |
-
if ($debug == true) {
|
897 |
-
echo "<!-- Ultimate Tag Cloud Debug information: "; var_dump($args);
|
898 |
-
echo "\n\n SQL Query:" . $query;
|
899 |
-
echo "\n\n Tag Data: "; var_dump($tag_data);
|
900 |
-
echo "-->";
|
901 |
-
}
|
902 |
-
|
903 |
-
echo $after_widget;
|
904 |
-
|
905 |
-
if ($return === true) {
|
906 |
-
$markup = ob_get_contents();
|
907 |
-
ob_end_clean();
|
908 |
-
return $markup;
|
909 |
-
}
|
910 |
-
|
911 |
-
return '';
|
912 |
-
}
|
913 |
-
|
914 |
-
/**
|
915 |
-
* Function for using the widget with a shortcode
|
916 |
-
* @param array $args
|
917 |
-
* @return string
|
918 |
-
*/
|
919 |
-
function do_utcw_shortcode($args) {
|
920 |
-
|
921 |
-
// Shortcodes should return values, not echo out
|
922 |
-
$args['return'] = true;
|
923 |
-
|
924 |
-
return do_utcw($args);
|
925 |
-
}
|
926 |
-
|
927 |
-
/**
|
928 |
-
* Used to calculate how step size in spanning values
|
929 |
-
* @param integer $min
|
930 |
-
* @param integer $max
|
931 |
-
* @param integer $from
|
932 |
-
* @param integer $to
|
933 |
-
* @return integer
|
934 |
-
*/
|
935 |
-
function calc_step($min, $max, $from, $to) {
|
936 |
-
|
937 |
-
// Thank you wordpress for this
|
938 |
-
$spread = $max - $min;
|
939 |
-
if ( $spread <= 0 )
|
940 |
-
$spread = 1;
|
941 |
-
$font_spread = $to - $from;
|
942 |
-
if ( $font_spread < 0 )
|
943 |
-
$font_spread = 1;
|
944 |
-
$step = $font_spread / $spread;
|
945 |
-
|
946 |
-
return $step;
|
947 |
-
}
|
948 |
-
|
949 |
-
load_plugin_textdomain('utcw', false, '/ultimate-tag-cloud-widget/language/');
|
950 |
-
|
951 |
-
// Register widget with wordpress
|
952 |
-
add_action('widgets_init', create_function('', 'return register_widget("UTCW");'));
|
953 |
-
add_action('wp_loaded', 'utcw_wp_loaded');
|
954 |
-
|
955 |
-
//Register scripts and css with wordpress
|
956 |
-
wp_register_script('utcw-js', WP_PLUGIN_URL . '/ultimate-tag-cloud-widget/utcw.min.js', array('jquery'), "1.3", false);
|
957 |
-
wp_register_style('utcw-css', WP_PLUGIN_URL . '/ultimate-tag-cloud-widget/utcw.min.css', array(), "1.3", 'all');
|
958 |
-
|
959 |
-
/**
|
960 |
-
* Action handler for wordpress init used to attach scripts and styles
|
961 |
-
* @return void
|
962 |
-
*/
|
963 |
-
function utcw_init() {
|
964 |
-
wp_enqueue_script('utcw-js');
|
965 |
-
wp_enqueue_style('utcw-css');
|
966 |
-
|
967 |
-
add_shortcode('utcw', 'do_utcw_shortcode');
|
968 |
-
}
|
969 |
-
add_action('init', 'utcw_init');
|
970 |
-
|
971 |
-
/*
|
972 |
-
* Compare functions
|
973 |
-
*/
|
974 |
-
function utcw_cmp_count($a, $b) {
|
975 |
-
if ($a['count'] == $b['count']) {
|
976 |
-
return 0;
|
977 |
-
} else {
|
978 |
-
return ($a['count'] < $b['count']) ? -1 : 1;
|
979 |
-
}
|
980 |
-
}
|
981 |
-
|
982 |
-
function utcw_icmp_name($a, $b) {
|
983 |
-
return strcasecmp($a['name'], $b['name']);
|
984 |
-
}
|
985 |
-
|
986 |
-
function utcw_cmp_name($a, $b) {
|
987 |
-
return strcmp($a['name'], $b['name']);
|
988 |
-
}
|
989 |
-
|
990 |
-
function utcw_icmp_slug($a, $b) {
|
991 |
-
return strcasecmp($a['slug'], $b['slug']);
|
992 |
-
}
|
993 |
-
|
994 |
-
function utcw_cmp_slug($a, $b) {
|
995 |
-
return strcmp($a['slug'], $b['slug']);
|
996 |
-
}
|
997 |
-
|
998 |
-
function utcw_cmp_id($a, $b) {
|
999 |
-
if ($a['term_id'] == $b['term_id']) {
|
1000 |
-
return 0;
|
1001 |
-
} else {
|
1002 |
-
return ($a['term_id'] < $b['term_id']) ? -1 : 1;
|
1003 |
-
}
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
function utcw_cmp_color($a, $b) {
|
1007 |
-
return strcasecmp($a['color'], $b['color']);
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
/**
|
1011 |
-
* Function for checking if every item within an array is a numeric value
|
1012 |
-
* @param array $array
|
1013 |
-
* @return boolean
|
1014 |
-
*/
|
1015 |
-
function is_array_numeric($array) {
|
1016 |
-
|
1017 |
-
foreach ($array as $item) {
|
1018 |
-
if (!is_numeric($item)) {
|
1019 |
-
return false;
|
1020 |
-
}
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
return true;
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
/**
|
1027 |
-
* Function to get the list of custom taxonomies
|
1028 |
-
* @return void
|
1029 |
-
*/
|
1030 |
-
function utcw_wp_loaded() {
|
1031 |
-
global $utcw_allowed_taxonomies, $utcw_allowed_post_types;
|
1032 |
-
|
1033 |
-
$utcw_allowed_taxonomies = get_taxonomies();
|
1034 |
-
$utcw_allowed_post_types = get_post_types(array('public' => true));
|
1035 |
-
}
|
1 |
+
<?php
|
2 |
/*
|
3 |
Plugin Name: Ultimate tag cloud widget
|
4 |
+
Plugin URI: https://www.0x539.se/wordpress/ultimate-tag-cloud-widget/
|
5 |
+
Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your weird tag cloud needs.
|
6 |
+
Version: 2.0 beta1
|
7 |
Author: Rickard Andersson
|
8 |
+
Author URI: https://www.0x539.se
|
9 |
License: GPLv2
|
10 |
*/
|
11 |
|
12 |
+
// Legacy file for compatibility with verison 1.x
|
13 |
+
require_once 'utcw.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utcw-config.php
ADDED
@@ -0,0 +1,786 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Configuration class for the widget.
|
15 |
+
*
|
16 |
+
* @since 2.0
|
17 |
+
* @package utcw
|
18 |
+
* @subpackage main
|
19 |
+
*/
|
20 |
+
class UTCW_Config {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Title text of the widget.
|
24 |
+
* Default value: Tag cloud
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
* @since 2.0
|
28 |
+
*/
|
29 |
+
public $title;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* How the result should be ordered
|
33 |
+
* Default value: name
|
34 |
+
* Valid values: random, name, slug, id, color, count
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
* @since 2.0
|
38 |
+
*/
|
39 |
+
public $order;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* The smallest possible size
|
43 |
+
* Default: 10
|
44 |
+
*
|
45 |
+
* @var int
|
46 |
+
* @since 2.0
|
47 |
+
*/
|
48 |
+
public $size_from;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The greatest possible size
|
52 |
+
* Default: 30
|
53 |
+
*
|
54 |
+
* @var int
|
55 |
+
* @since 2.0
|
56 |
+
*/
|
57 |
+
public $size_to;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Maximum number of tags to display
|
61 |
+
* Default: 45
|
62 |
+
*
|
63 |
+
* @var int
|
64 |
+
* @since 2.0
|
65 |
+
*/
|
66 |
+
public $max;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Which taxonomy to show tags from
|
70 |
+
* Default: post_tag
|
71 |
+
*
|
72 |
+
* @var string
|
73 |
+
* @since 2.0
|
74 |
+
*/
|
75 |
+
public $taxonomy;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* If the order of tags should be shown in reverse order
|
79 |
+
* Default: false
|
80 |
+
*
|
81 |
+
* @var bool
|
82 |
+
* @since 2.0
|
83 |
+
*/
|
84 |
+
public $reverse;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Which coloring strategy to use
|
88 |
+
* Default: none
|
89 |
+
* Valid values: none, random, set, span
|
90 |
+
*
|
91 |
+
* @var string
|
92 |
+
* @since 2.0
|
93 |
+
*/
|
94 |
+
public $color;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* CSS letter-spacing value (in pixels)
|
98 |
+
* Default: normal
|
99 |
+
*
|
100 |
+
* @var int|string
|
101 |
+
* @since 2.0
|
102 |
+
*/
|
103 |
+
public $letter_spacing;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* CSS word-spacing value (in pixels)
|
107 |
+
* Default: normal
|
108 |
+
*
|
109 |
+
* @var int|string
|
110 |
+
* @since 2.0
|
111 |
+
*/
|
112 |
+
public $word_spacing;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* CSS text-transform value
|
116 |
+
* Default: none
|
117 |
+
* Valid values: lowercase, uppercase, capitalize
|
118 |
+
*
|
119 |
+
* @var string
|
120 |
+
* @since 2.0
|
121 |
+
*/
|
122 |
+
public $text_transform;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* If sorting should be applied case sensitive
|
126 |
+
* Default: false
|
127 |
+
*
|
128 |
+
* @var bool
|
129 |
+
* @since 2.0
|
130 |
+
*/
|
131 |
+
public $case_sensitive;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* How many posts a term needs to have to be shown in the cloud
|
135 |
+
* Default: 1
|
136 |
+
*
|
137 |
+
* @var int
|
138 |
+
* @since 2.0
|
139 |
+
*/
|
140 |
+
public $minimum;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* How the $tags_list should be used
|
144 |
+
* Default: exclude
|
145 |
+
* Valid values: exclude, include
|
146 |
+
*
|
147 |
+
* @var string
|
148 |
+
* @since 2.0
|
149 |
+
*/
|
150 |
+
public $tags_list_type;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* If the title attribute should be added to links in the cloud
|
154 |
+
* Default: true
|
155 |
+
*
|
156 |
+
* @var bool
|
157 |
+
* @since 2.0
|
158 |
+
*/
|
159 |
+
public $show_title;
|
160 |
+
|
161 |
+
/**
|
162 |
+
* If links should be styled with underline decoration
|
163 |
+
* Default: default
|
164 |
+
* Valid values: yes, no, default
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
* @since 2.0
|
168 |
+
*/
|
169 |
+
public $link_underline;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* If links should be styled as bold
|
173 |
+
* Default: default
|
174 |
+
* Valid values: yes, no, default
|
175 |
+
*
|
176 |
+
* @var string
|
177 |
+
* @since 2.0
|
178 |
+
*/
|
179 |
+
public $link_bold;
|
180 |
+
|
181 |
+
/**
|
182 |
+
* If links should be styled as italic
|
183 |
+
* Default: default
|
184 |
+
* Valid values: yes, no, default
|
185 |
+
*
|
186 |
+
* @var string
|
187 |
+
* @since 2.0
|
188 |
+
*/
|
189 |
+
public $link_italic;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Background color for links
|
193 |
+
* Default: transparent
|
194 |
+
* Valid values: A hexadecimal color
|
195 |
+
*
|
196 |
+
* @var string
|
197 |
+
* @since 2.0
|
198 |
+
*/
|
199 |
+
public $link_bg_color;
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Border style for links
|
203 |
+
* Default: none
|
204 |
+
* Valid values: none, dotted, dashed, solid, double, groove, ridge, inset, outset
|
205 |
+
*
|
206 |
+
* @var string
|
207 |
+
* @since 2.0
|
208 |
+
*/
|
209 |
+
public $link_border_style;
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Border width for links
|
213 |
+
* Default: 0
|
214 |
+
*
|
215 |
+
* @var int
|
216 |
+
* @since 2.0
|
217 |
+
*/
|
218 |
+
public $link_border_width;
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Border color for links
|
222 |
+
* Default: none
|
223 |
+
* Valid values: A hexadecimal color
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
* @since 2.0
|
227 |
+
*/
|
228 |
+
public $link_border_color;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* If links should be decorated with underline decoration in their hover state
|
232 |
+
* Default: default
|
233 |
+
* Valid values: yes, no, default
|
234 |
+
*
|
235 |
+
* @var string
|
236 |
+
* @since 2.0
|
237 |
+
*/
|
238 |
+
public $hover_underline;
|
239 |
+
|
240 |
+
/**
|
241 |
+
* If links should be styled as bold in their hover state
|
242 |
+
* Default: default
|
243 |
+
* Valid values: yes, no, default
|
244 |
+
*
|
245 |
+
* @var string
|
246 |
+
* @since 2.0
|
247 |
+
*/
|
248 |
+
public $hover_bold;
|
249 |
+
|
250 |
+
/**
|
251 |
+
* If links should be styled as italic in their hover state
|
252 |
+
* Default: default
|
253 |
+
* Valid values: yes, no, default
|
254 |
+
*
|
255 |
+
* @var string
|
256 |
+
* @since 2.0
|
257 |
+
*/
|
258 |
+
public $hover_italic;
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Background color for links in their hover state
|
262 |
+
* Default: transparent
|
263 |
+
* Valid values: A hexadecimal color
|
264 |
+
*
|
265 |
+
* @var string
|
266 |
+
* @since 2.0
|
267 |
+
*/
|
268 |
+
public $hover_bg_color;
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Text color for links in their hover state
|
272 |
+
* Default: default
|
273 |
+
* Valid values: A hexadecimal color
|
274 |
+
*
|
275 |
+
* @var string
|
276 |
+
* @since 2.0
|
277 |
+
*/
|
278 |
+
public $hover_color;
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Border style for links in their hover state
|
282 |
+
* Default: none
|
283 |
+
* Valid values: none, dotted, dashed, solid, double, groove, ridge, inset, outset
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
* @since 2.0
|
287 |
+
*/
|
288 |
+
public $hover_border_style;
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Border width for links in their hover state
|
292 |
+
* Default: 0
|
293 |
+
*
|
294 |
+
* @var int
|
295 |
+
* @since 2.0
|
296 |
+
*/
|
297 |
+
public $hover_border_width;
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Border color for links in their hover state
|
301 |
+
* Default: none
|
302 |
+
* Valid values: A hexadecimal color
|
303 |
+
*
|
304 |
+
* @var string
|
305 |
+
* @since 2.0
|
306 |
+
*/
|
307 |
+
public $hover_border_color;
|
308 |
+
|
309 |
+
/**
|
310 |
+
* CSS margin between tags
|
311 |
+
* Default: auto
|
312 |
+
*
|
313 |
+
* @var int
|
314 |
+
* @since 2.0
|
315 |
+
*/
|
316 |
+
public $tag_spacing;
|
317 |
+
|
318 |
+
/**
|
319 |
+
* If debug output should be included
|
320 |
+
* Default: false
|
321 |
+
*
|
322 |
+
* @var bool
|
323 |
+
* @since 2.0
|
324 |
+
*/
|
325 |
+
public $debug;
|
326 |
+
|
327 |
+
/**
|
328 |
+
* How many days old a post needs to be to be included in tag size calculation
|
329 |
+
* Default: 0
|
330 |
+
*
|
331 |
+
* @var int
|
332 |
+
* @since 2.0
|
333 |
+
*/
|
334 |
+
public $days_old;
|
335 |
+
|
336 |
+
/**
|
337 |
+
* CSS line-height for the tags
|
338 |
+
* Default: inherit
|
339 |
+
*
|
340 |
+
* @var int
|
341 |
+
* @since 2.0
|
342 |
+
*/
|
343 |
+
public $line_height;
|
344 |
+
|
345 |
+
/**
|
346 |
+
* Separator between tags
|
347 |
+
* Default: (a space character)
|
348 |
+
*
|
349 |
+
* @var string
|
350 |
+
* @since 2.0
|
351 |
+
*/
|
352 |
+
public $separator;
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Prefix before each tag
|
356 |
+
* Default: (empty string)
|
357 |
+
*
|
358 |
+
* @var string
|
359 |
+
* @since 2.0
|
360 |
+
*/
|
361 |
+
public $prefix;
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Suffix after each tag
|
365 |
+
* Default: (empty string)
|
366 |
+
*
|
367 |
+
* @var string
|
368 |
+
* @since 2.0
|
369 |
+
*/
|
370 |
+
public $suffix;
|
371 |
+
|
372 |
+
/**
|
373 |
+
* If the widget title should be shown
|
374 |
+
* Default: true
|
375 |
+
*
|
376 |
+
* @var bool
|
377 |
+
* @since 2.0
|
378 |
+
*/
|
379 |
+
public $show_title_text;
|
380 |
+
|
381 |
+
/**
|
382 |
+
* An array of post type names to to include posts from in tag size calculation
|
383 |
+
* Default: [ post ]
|
384 |
+
*
|
385 |
+
* @var array
|
386 |
+
* @since 2.0
|
387 |
+
*/
|
388 |
+
public $post_type;
|
389 |
+
|
390 |
+
/**
|
391 |
+
* A list of term IDs to be included or excluded. Inclusion or exclusion is determined by $tags_list_type
|
392 |
+
* Default: [] (an empty array)
|
393 |
+
*
|
394 |
+
* @var array
|
395 |
+
* @since 2.0
|
396 |
+
*/
|
397 |
+
public $tags_list;
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Which color value to start from in color calculation. This is the color that the smallest tag will get.
|
401 |
+
* Default: (an empty string)
|
402 |
+
*
|
403 |
+
* @var string
|
404 |
+
* @since 2.0
|
405 |
+
*/
|
406 |
+
public $color_span_to;
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Which color value to end at in color calculation. This is the color that the biggest tag will get.
|
410 |
+
* Default: (an empty string)
|
411 |
+
*
|
412 |
+
* @var string
|
413 |
+
* @since 2.0
|
414 |
+
*/
|
415 |
+
public $color_span_from;
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Which authors to include posts from. An empty array will include all authors
|
419 |
+
* Default: [] (an empty array)
|
420 |
+
*
|
421 |
+
* @var array
|
422 |
+
* @since 2.0
|
423 |
+
*/
|
424 |
+
public $authors;
|
425 |
+
|
426 |
+
/**
|
427 |
+
* A set of colors to randomly select from when coloring the tags
|
428 |
+
* Default: [] (an empty array)
|
429 |
+
*
|
430 |
+
* @var array
|
431 |
+
* @since 2.0
|
432 |
+
*/
|
433 |
+
public $color_set;
|
434 |
+
|
435 |
+
/**
|
436 |
+
* If the current user is authenticated. Will be set internally
|
437 |
+
*
|
438 |
+
* @internal
|
439 |
+
* @var bool
|
440 |
+
* @since 2.0
|
441 |
+
*/
|
442 |
+
public $authenticated;
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Text to display before the widget. The default value for this setting will probably be determined by the theme
|
446 |
+
* Default: (an empty string)
|
447 |
+
*
|
448 |
+
* @var string
|
449 |
+
* @since 2.0
|
450 |
+
*/
|
451 |
+
public $before_widget;
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Text to display after the widget. The default value for this setting will probably be determined by the theme
|
455 |
+
* Default: (an empty string)
|
456 |
+
*
|
457 |
+
* @var string
|
458 |
+
* @since 2.0
|
459 |
+
*/
|
460 |
+
public $after_widget;
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Text to display before the widget title. The default value for this setting will probably be determined by the theme
|
464 |
+
* Default: (an empty string)
|
465 |
+
*
|
466 |
+
* @var string
|
467 |
+
* @since 2.0
|
468 |
+
*/
|
469 |
+
public $before_title;
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Text to display after the widget title. The default value for this setting will probably be determined by the theme
|
473 |
+
* Default: (an empty string)
|
474 |
+
*
|
475 |
+
* @var string
|
476 |
+
* @since 2.0
|
477 |
+
*/
|
478 |
+
public $after_title;
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Config store with default values
|
482 |
+
*
|
483 |
+
* @static
|
484 |
+
* @var array
|
485 |
+
* @since 2.0
|
486 |
+
*/
|
487 |
+
static protected $options = array(
|
488 |
+
'title' => 'Tag Cloud',
|
489 |
+
'order' => 'name',
|
490 |
+
'size_from' => 10,
|
491 |
+
'size_to' => 30,
|
492 |
+
'max' => 45,
|
493 |
+
'taxonomy' => 'post_tag',
|
494 |
+
'reverse' => false,
|
495 |
+
'color' => 'none',
|
496 |
+
'letter_spacing' => 'normal',
|
497 |
+
'word_spacing' => 'normal',
|
498 |
+
'text_transform' => 'none',
|
499 |
+
'case_sensitive' => false,
|
500 |
+
'minimum' => 1,
|
501 |
+
'tags_list_type' => 'exclude',
|
502 |
+
'show_title' => true,
|
503 |
+
'link_underline' => 'default',
|
504 |
+
'link_bold' => 'default',
|
505 |
+
'link_italic' => 'default',
|
506 |
+
'link_bg_color' => 'transparent',
|
507 |
+
'link_border_style' => 'none',
|
508 |
+
'link_border_width' => 0,
|
509 |
+
'link_border_color' => 'none',
|
510 |
+
'hover_underline' => 'default',
|
511 |
+
'hover_bold' => 'default',
|
512 |
+
'hover_italic' => 'default',
|
513 |
+
'hover_bg_color' => 'transparent',
|
514 |
+
'hover_color' => 'default',
|
515 |
+
'hover_border_style' => 'none',
|
516 |
+
'hover_border_width' => 0,
|
517 |
+
'hover_border_color' => 'none',
|
518 |
+
'tag_spacing' => 'auto',
|
519 |
+
'debug' => false,
|
520 |
+
'days_old' => 0,
|
521 |
+
'line_height' => 'inherit',
|
522 |
+
'separator' => ' ',
|
523 |
+
'prefix' => '',
|
524 |
+
'suffix' => '',
|
525 |
+
'show_title_text' => true,
|
526 |
+
'post_type' => array( 'post' ),
|
527 |
+
'tags_list' => array(),
|
528 |
+
'color_span_to' => '',
|
529 |
+
'color_span_from' => '',
|
530 |
+
'authors' => array(),
|
531 |
+
'color_set' => array(),
|
532 |
+
'before_widget' => '',
|
533 |
+
'after_widget' => '',
|
534 |
+
'before_title' => '',
|
535 |
+
'after_title' => '',
|
536 |
+
);
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Which ordering strategies are allowed
|
540 |
+
*
|
541 |
+
* @var array
|
542 |
+
* @since 2.0
|
543 |
+
*/
|
544 |
+
protected $allowed_orders = array( 'random', 'name', 'slug', 'id', 'color', 'count' );
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Which taxonomies are allowed. Will be set dynamically at load
|
548 |
+
*
|
549 |
+
* @var array
|
550 |
+
* @since 2.0
|
551 |
+
*/
|
552 |
+
protected $allowed_taxonomies = array();
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Which post types are allowed. Will be set dynamically at load
|
556 |
+
*
|
557 |
+
* @var array
|
558 |
+
* @since 2.0
|
559 |
+
*/
|
560 |
+
protected $allowed_post_types = array();
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Which coloring strategies are allowed
|
564 |
+
*
|
565 |
+
* @var array
|
566 |
+
* @since 2.0
|
567 |
+
*/
|
568 |
+
protected $allowed_colors = array( 'none', 'random', 'set', 'span' );
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Which CSS text-transform values are allowed
|
572 |
+
*
|
573 |
+
* @var array
|
574 |
+
* @since 2.0
|
575 |
+
*/
|
576 |
+
protected $allowed_text_transforms = array( 'lowercase', 'uppercase', 'capitalize' );
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Which tags_list_type values are allowed
|
580 |
+
*
|
581 |
+
* @var array
|
582 |
+
* @since 2.0
|
583 |
+
*/
|
584 |
+
protected $allowed_tags_list_types = array( 'exclude', 'include' );
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Which values are allowed for optional booleans. These are values which can be true, false or fallback to theme default (where applicable)
|
588 |
+
*
|
589 |
+
* @var array
|
590 |
+
* @since 2.0
|
591 |
+
*/
|
592 |
+
protected $allowed_optional_booleans = array( 'yes', 'no', 'default' );
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Which CSS border-style valeus are allowed
|
596 |
+
*
|
597 |
+
* @var array
|
598 |
+
* @since 2.0
|
599 |
+
*/
|
600 |
+
protected $allowed_border_styles = array(
|
601 |
+
'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset',
|
602 |
+
);
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Loads a configuration instance array and parses the options
|
606 |
+
*
|
607 |
+
* @param array $input Array of key => value pairs of settings and values
|
608 |
+
* @param UTCW_Plugin $plugin Reference to the main plugin instance
|
609 |
+
*
|
610 |
+
* @since 2.0
|
611 |
+
*/
|
612 |
+
public function __construct( array $input, UTCW_Plugin $plugin ) {
|
613 |
+
$this->allowed_post_types = $plugin->get_allowed_post_types();
|
614 |
+
$this->allowed_taxonomies = $plugin->get_allowed_taxonomies();
|
615 |
+
$this->authenticated = $plugin->is_authenticated_user();
|
616 |
+
|
617 |
+
foreach ( self::$options as $key => $default ) {
|
618 |
+
$this->$key = $default;
|
619 |
+
|
620 |
+
if ( isset( $input[ $key ] ) ) {
|
621 |
+
$valid = true;
|
622 |
+
|
623 |
+
switch ( $key ) {
|
624 |
+
case 'order':
|
625 |
+
$valid = in_array( $input[ $key ], $this->allowed_orders );
|
626 |
+
break;
|
627 |
+
|
628 |
+
case 'text_transform':
|
629 |
+
$valid = in_array( $input[ $key ], $this->allowed_text_transforms );
|
630 |
+
break;
|
631 |
+
|
632 |
+
case 'tags_list_type':
|
633 |
+
$valid = in_array( $input[ $key ], $this->allowed_tags_list_types );
|
634 |
+
break;
|
635 |
+
|
636 |
+
// Optional booleans, can be yes, no or default
|
637 |
+
case 'link_underline':
|
638 |
+
case 'link_bold':
|
639 |
+
case 'link_italic':
|
640 |
+
case 'hover_underline':
|
641 |
+
case 'hover_bold':
|
642 |
+
case 'hover_italic':
|
643 |
+
$valid = in_array( $input[ $key ], $this->allowed_optional_booleans );
|
644 |
+
break;
|
645 |
+
|
646 |
+
case 'link_border_style':
|
647 |
+
case 'hover_border_style':
|
648 |
+
$valid = in_array( $input[ $key ], $this->allowed_border_styles );
|
649 |
+
break;
|
650 |
+
|
651 |
+
case 'color':
|
652 |
+
$valid = in_array( $input[ $key ], $this->allowed_colors );
|
653 |
+
break;
|
654 |
+
|
655 |
+
// TODO: Allow more flexibility in color setting, like rgb/rgba/hsl/hsla and named colors
|
656 |
+
case 'link_bg_color':
|
657 |
+
case 'link_border_color':
|
658 |
+
case 'hover_bg_color':
|
659 |
+
case 'hover_color':
|
660 |
+
case 'hover_border_color':
|
661 |
+
case 'color_span_to':
|
662 |
+
case 'color_span_from':
|
663 |
+
$valid = preg_match( UTCW_HEX_COLOR_REGEX, $input[ $key ] ) > 0;
|
664 |
+
break;
|
665 |
+
|
666 |
+
case 'color_set':
|
667 |
+
if ( ! is_array( $input[ $key ] ) ) {
|
668 |
+
$input[ $key ] = explode( ',', $input[ $key ] );
|
669 |
+
}
|
670 |
+
|
671 |
+
$valid = $input[ $key ] && array_filter( $input[ $key ], create_function( '$item', 'return preg_match( UTCW_HEX_COLOR_REGEX, $item );' ) ) == $input[ $key ];
|
672 |
+
break;
|
673 |
+
|
674 |
+
case 'taxonomy':
|
675 |
+
$valid = in_array( $input[ $key ], $this->allowed_taxonomies );
|
676 |
+
break;
|
677 |
+
|
678 |
+
case 'post_type':
|
679 |
+
if ( ! is_array( $input[ $key ] ) ) {
|
680 |
+
$input[ $key ] = explode( ',', $input[ $key ] );
|
681 |
+
}
|
682 |
+
|
683 |
+
$valid = $input[ $key ] && count( array_intersect( $this->allowed_post_types, $input[ $key ] ) ) == count( $input[ $key ] );
|
684 |
+
break;
|
685 |
+
|
686 |
+
case 'authors':
|
687 |
+
case 'tags_list':
|
688 |
+
if ( ! is_array( $input[ $key ] ) ) {
|
689 |
+
$input[ $key ] = explode( ',', $input[ $key ] );
|
690 |
+
}
|
691 |
+
|
692 |
+
$valid = $this->is_array_numeric( $input[ $key ] );
|
693 |
+
break;
|
694 |
+
|
695 |
+
case 'size_from':
|
696 |
+
$valid = isset( $input[ 'size_to' ] ) && $input[ 'size_from' ] <= $input[ 'size_to' ];
|
697 |
+
break;
|
698 |
+
|
699 |
+
case 'size_to':
|
700 |
+
$valid = isset( $input[ 'size_from' ] ) && $input[ 'size_to' ] >= $input[ 'size_from' ];
|
701 |
+
break;
|
702 |
+
|
703 |
+
case 'letter_spacing':
|
704 |
+
case 'word_spacing':
|
705 |
+
case 'tag_spacing':
|
706 |
+
case 'line_height':
|
707 |
+
$valid = is_numeric( $input[ $key ] );
|
708 |
+
break;
|
709 |
+
}
|
710 |
+
|
711 |
+
if ( ! $valid ) {
|
712 |
+
continue;
|
713 |
+
}
|
714 |
+
|
715 |
+
// Special handling of the color_set config attribute which needs to be expanded to full 6 digit hexadecimal values
|
716 |
+
if ( $key == 'color_set' ) {
|
717 |
+
foreach ( $input[ $key ] as $cs_key => $color ) {
|
718 |
+
if ( strlen( $color ) == 4 ) {
|
719 |
+
$red = substr( $color, 1, 1 );
|
720 |
+
$green = substr( $color, 2, 1 );
|
721 |
+
$blue = substr( $color, 3, 1 );
|
722 |
+
$input[ $key ][ $cs_key ] = sprintf( '#%s%s%s%s%s%s', $red, $red, $green, $green, $blue, $blue );
|
723 |
+
}
|
724 |
+
}
|
725 |
+
$this->$key = $input[ $key ];
|
726 |
+
} // Special handling of some properties which have string defaults but integer values expected
|
727 |
+
else if ( in_array( $key, array( 'letter_spacing', 'word_spacing', 'tag_spacing', 'line_height' ) ) ) {
|
728 |
+
$this->$key = intval( $input[ $key ] );
|
729 |
+
} else if ( is_string( self::$options[ $key ] ) && is_string( $input[ $key ] ) && strlen( $input[ $key ] ) > 0 ) {
|
730 |
+
$this->$key = $input[ $key ];
|
731 |
+
} else if ( is_integer( self::$options[ $key ] ) && $input[ $key ] > 0 ) {
|
732 |
+
$this->$key = intval( $input[ $key ] );
|
733 |
+
} else if ( is_bool( self::$options[ $key ] ) ) {
|
734 |
+
$this->$key = ! ! $input[ $key ];
|
735 |
+
} else if ( is_array( self::$options[ $key ] ) ) {
|
736 |
+
$this->$key = is_array( $input[ $key ] ) ? $input[ $key ] : explode( ',', $input[ $key ] );
|
737 |
+
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
}
|
741 |
+
|
742 |
+
/**
|
743 |
+
* Checks if every item in the array is numeric
|
744 |
+
*
|
745 |
+
* @param array $array
|
746 |
+
*
|
747 |
+
* @return bool
|
748 |
+
* @since 2.0
|
749 |
+
*/
|
750 |
+
private function is_array_numeric( array $array ) {
|
751 |
+
foreach ( $array as $item ) {
|
752 |
+
if ( ! is_numeric( $item ) ) {
|
753 |
+
return false;
|
754 |
+
}
|
755 |
+
}
|
756 |
+
|
757 |
+
return true;
|
758 |
+
}
|
759 |
+
|
760 |
+
/**
|
761 |
+
* Returns an array of current configuration
|
762 |
+
*
|
763 |
+
* @return array
|
764 |
+
* @since 2.0
|
765 |
+
*/
|
766 |
+
public function get_instance() {
|
767 |
+
$instance = array();
|
768 |
+
|
769 |
+
foreach ( array_keys( self::$options ) as $key ) {
|
770 |
+
$instance[ $key ] = $this->$key;
|
771 |
+
}
|
772 |
+
|
773 |
+
return $instance;
|
774 |
+
}
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Returns the default values for all the configuration options
|
778 |
+
*
|
779 |
+
* @static
|
780 |
+
* @return array
|
781 |
+
* @since 2.0
|
782 |
+
*/
|
783 |
+
public static function get_defaults() {
|
784 |
+
return self::$options;
|
785 |
+
}
|
786 |
+
}
|
utcw-data.php
ADDED
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class for loading data for the cloud
|
15 |
+
*
|
16 |
+
* @since 2.0
|
17 |
+
* @package utcw
|
18 |
+
* @subpackage main
|
19 |
+
*/
|
20 |
+
class UTCW_Data {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Reference to the current configuration
|
24 |
+
*
|
25 |
+
* @var UTCW_Config
|
26 |
+
* @since 2.0
|
27 |
+
*/
|
28 |
+
protected $config;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Reference to WPDB object
|
32 |
+
*
|
33 |
+
* @var wpdb
|
34 |
+
* @since 2.0
|
35 |
+
*/
|
36 |
+
protected $db;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Reference to main plugin instance
|
40 |
+
*
|
41 |
+
* @var UTCW_Plugin
|
42 |
+
* @since 2.0
|
43 |
+
*/
|
44 |
+
protected $plugin;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Creates a new instance
|
48 |
+
*
|
49 |
+
* @param UTCW_Config $config Current configuration
|
50 |
+
* @param UTCW_Plugin $plugin Main plugin instance
|
51 |
+
* @param wpdb $db WordPress DB instance
|
52 |
+
*
|
53 |
+
* @since 2.0
|
54 |
+
*/
|
55 |
+
function __construct( UTCW_Config $config, UTCW_Plugin $plugin, wpdb $db ) {
|
56 |
+
$this->config = $config;
|
57 |
+
$this->db = $db;
|
58 |
+
$this->plugin = $plugin;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Loads terms based on current configuration
|
63 |
+
*
|
64 |
+
* @return UTCW_Term[]
|
65 |
+
* @since 2.0
|
66 |
+
*/
|
67 |
+
function get_terms() {
|
68 |
+
$query = array();
|
69 |
+
|
70 |
+
// Base query with joins
|
71 |
+
$query[ ] = 'SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count`';
|
72 |
+
$query[ ] = 'FROM `' . $this->db->posts . '` AS p';
|
73 |
+
$query[ ] = 'JOIN `' . $this->db->term_relationships . '` AS tr ON tr.object_id = p.ID';
|
74 |
+
$query[ ] = 'JOIN `' . $this->db->term_taxonomy . '` AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id';
|
75 |
+
$query[ ] = 'JOIN `' . $this->db->terms . '` AS t ON t.term_id = tt.term_id';
|
76 |
+
|
77 |
+
// Add taxonomy statement
|
78 |
+
$query[ ] = 'WHERE tt.taxonomy = %s';
|
79 |
+
$parameters[ ] = $this->config->taxonomy;
|
80 |
+
|
81 |
+
// Add authors statement if configured
|
82 |
+
if ( $this->config->authors ) {
|
83 |
+
$author_parameters = array();
|
84 |
+
|
85 |
+
foreach ( $this->config->authors as $author ) {
|
86 |
+
$author_parameters[ ] = '%d';
|
87 |
+
$parameters[ ] = $author;
|
88 |
+
}
|
89 |
+
|
90 |
+
$query[ ] = 'AND post_author IN (' . join( ',', $author_parameters ) . ')';
|
91 |
+
}
|
92 |
+
|
93 |
+
// Add post types statement
|
94 |
+
$post_type_parameters = array();
|
95 |
+
|
96 |
+
foreach ( $this->config->post_type as $post_type ) {
|
97 |
+
$post_type_parameters[ ] = '%s';
|
98 |
+
$parameters[ ] = $post_type;
|
99 |
+
}
|
100 |
+
|
101 |
+
$query[ ] = 'AND post_type IN (' . join( ',', $post_type_parameters ) . ')';
|
102 |
+
|
103 |
+
// Add post status statement, authenticated users are allowed to view tags for private posts
|
104 |
+
if ( $this->config->authenticated ) {
|
105 |
+
$query[ ] = "AND post_status IN ('publish','private')";
|
106 |
+
} else {
|
107 |
+
$query[ ] = "AND post_status = 'publish'";
|
108 |
+
}
|
109 |
+
|
110 |
+
// Add include or exclude statement
|
111 |
+
if ( $this->config->tags_list ) {
|
112 |
+
$tags_list_parameters = array();
|
113 |
+
|
114 |
+
foreach ( $this->config->tags_list as $tag_id ) {
|
115 |
+
if ( $this->plugin->check_term_taxonomy( $tag_id, $this->config->taxonomy ) ) {
|
116 |
+
$tags_list_parameters[ ] = '%d';
|
117 |
+
$parameters[ ] = $tag_id;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( $tags_list_parameters ) {
|
122 |
+
$tags_list_operator = $this->config->tags_list_type == 'include' ? 'IN' : 'NOT IN';
|
123 |
+
$query[ ] = 'AND t.term_id ' . $tags_list_operator . ' (' . join( ',', $tags_list_parameters ) . ')';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
// Add days old statement
|
128 |
+
if ( $this->config->days_old ) {
|
129 |
+
$query[ ] = 'AND post_date > %s';
|
130 |
+
$parameters[ ] = date( 'Y-m-d', strtotime( '-' . $this->config->days_old . ' days' ) );
|
131 |
+
}
|
132 |
+
|
133 |
+
$query[ ] = 'GROUP BY tr.term_taxonomy_id';
|
134 |
+
|
135 |
+
// Add minimum constraint
|
136 |
+
if ( $this->config->minimum > 1 ) {
|
137 |
+
$query[ ] = 'HAVING count >= %d';
|
138 |
+
$parameters[ ] = $this->config->minimum;
|
139 |
+
}
|
140 |
+
|
141 |
+
// Try to sort the result using SQL if possible
|
142 |
+
$order = $this->config->reverse ? 'DESC' : 'ASC';
|
143 |
+
$binary = $this->config->case_sensitive ? 'BINARY ' : '';
|
144 |
+
|
145 |
+
switch ( $this->config->order ) {
|
146 |
+
case 'random':
|
147 |
+
$query[ ] = 'ORDER BY RAND() ' . $order;
|
148 |
+
break;
|
149 |
+
|
150 |
+
case 'name':
|
151 |
+
$query[ ] = 'ORDER BY ' . $binary . 'name ' . $order;
|
152 |
+
break;
|
153 |
+
|
154 |
+
case 'slug':
|
155 |
+
$query[ ] = 'ORDER BY ' . $binary . 'slug ' . $order;
|
156 |
+
break;
|
157 |
+
|
158 |
+
case 'id':
|
159 |
+
$query[ ] = 'ORDER BY term_id ' . $order;
|
160 |
+
break;
|
161 |
+
|
162 |
+
case 'count':
|
163 |
+
$query[ ] = 'ORDER BY count ' . $order;
|
164 |
+
break;
|
165 |
+
}
|
166 |
+
|
167 |
+
// Add limit constraint
|
168 |
+
$query[ ] = 'LIMIT %d';
|
169 |
+
$parameters[ ] = $this->config->max;
|
170 |
+
|
171 |
+
// Build query
|
172 |
+
$query = join( "\n", $query );
|
173 |
+
$query = $this->db->prepare( $query, $parameters );
|
174 |
+
|
175 |
+
// Fetch terms from DB
|
176 |
+
$result = $this->db->get_results( $query );
|
177 |
+
$terms = array();
|
178 |
+
|
179 |
+
// Calculate sizes
|
180 |
+
$min_count = PHP_INT_MAX;
|
181 |
+
$max_count = 0;
|
182 |
+
|
183 |
+
foreach ( $result as $item ) {
|
184 |
+
if ( $item->count < $min_count ) {
|
185 |
+
$min_count = $item->count;
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( $item->count > $max_count ) {
|
189 |
+
$max_count = $item->count;
|
190 |
+
}
|
191 |
+
|
192 |
+
$item->taxonomy = $this->config->taxonomy;
|
193 |
+
$terms[ ] = new UTCW_Term( $item, $this->plugin );
|
194 |
+
}
|
195 |
+
|
196 |
+
$font_step = $this->calc_step( $min_count, $max_count, $this->config->size_from, $this->config->size_to );
|
197 |
+
|
198 |
+
foreach ( $terms as $term ) {
|
199 |
+
$term->size = $this->calc_size( $this->config->size_from, $term->count, $min_count, $font_step );
|
200 |
+
}
|
201 |
+
|
202 |
+
// Set colors
|
203 |
+
switch ( $this->config->color ) {
|
204 |
+
case 'random':
|
205 |
+
foreach ( $terms as $term ) {
|
206 |
+
$term->color = sprintf( UTCW_HEX_COLOR_FORMAT, rand() % 255, rand() % 255, rand() % 255 );
|
207 |
+
}
|
208 |
+
break;
|
209 |
+
|
210 |
+
case 'set':
|
211 |
+
if ( $this->config->color_set ) {
|
212 |
+
foreach ( $terms as $term ) {
|
213 |
+
$term->color = $this->config->color_set[ array_rand( $this->config->color_set ) ];
|
214 |
+
}
|
215 |
+
}
|
216 |
+
break;
|
217 |
+
|
218 |
+
case 'span':
|
219 |
+
if ( $this->config->color_span_from && $this->config->color_span_to ) {
|
220 |
+
preg_match_all( '/[0-9a-f]{2}/i', $this->config->color_span_from, $cf_rgb_matches );
|
221 |
+
list( $red_from, $green_from, $blue_from ) = array_map( 'hexdec', $cf_rgb_matches[ 0 ] );
|
222 |
+
|
223 |
+
preg_match_all( '/[0-9a-f]{2}/i', $this->config->color_span_to, $ct_rgb_matches );
|
224 |
+
list( $red_to, $green_to, $blue_to ) = array_map( 'hexdec', $ct_rgb_matches[ 0 ] );
|
225 |
+
|
226 |
+
$colors = new stdClass;
|
227 |
+
$colors->red_from = $red_from;
|
228 |
+
$colors->red_to = $red_to;
|
229 |
+
$colors->green_from = $green_from;
|
230 |
+
$colors->green_to = $green_to;
|
231 |
+
$colors->blue_from = $blue_from;
|
232 |
+
$colors->blue_to = $blue_to;
|
233 |
+
|
234 |
+
foreach ( $terms as $term ) {
|
235 |
+
$term->color = $this->calc_color( $min_count, $max_count, $colors, $term->count );
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
// Last order by color if selected, this is the only order which can't be done in the DB
|
241 |
+
if ( $this->config->order == 'color' ) {
|
242 |
+
// Change the argument order to change the sort order
|
243 |
+
$sort_fn_arguments = $this->config->reverse ? '$b,$a' : '$a,$b';
|
244 |
+
|
245 |
+
// There's no difference in sortin case sensitive or case in-sensitive since
|
246 |
+
// the colors are always lower case and internally generated
|
247 |
+
|
248 |
+
$sort_fn = create_function( $sort_fn_arguments, 'return strcmp( $a->color, $b->color );' );
|
249 |
+
|
250 |
+
usort( $terms, $sort_fn );
|
251 |
+
}
|
252 |
+
|
253 |
+
return $terms;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Calculate term color
|
258 |
+
*
|
259 |
+
* @param int $min_count Min count of all the terms
|
260 |
+
* @param int $max_count Max count of all the terms
|
261 |
+
* @param stdClass $colors Object with red/green/blue_from/to properties
|
262 |
+
* @param int $count Count of current term
|
263 |
+
*
|
264 |
+
* @return string
|
265 |
+
* @since 2.0
|
266 |
+
*/
|
267 |
+
private function calc_color( $min_count, $max_count, stdClass $colors, $count ) {
|
268 |
+
$red_step = $this->calc_step( $min_count, $max_count, $colors->red_from, $colors->red_to );
|
269 |
+
$green_step = $this->calc_step( $min_count, $max_count, $colors->green_from, $colors->green_to );
|
270 |
+
$blue_step = $this->calc_step( $min_count, $max_count, $colors->blue_from, $colors->blue_to );
|
271 |
+
|
272 |
+
$red = $this->calc_size( $colors->red_from, $count, $min_count, $red_step );
|
273 |
+
$green = $this->calc_size( $colors->green_from, $count, $min_count, $green_step );
|
274 |
+
$blue = $this->calc_size( $colors->blue_from, $count, $min_count, $blue_step );
|
275 |
+
|
276 |
+
$color = sprintf( UTCW_HEX_COLOR_FORMAT, $red, $green, $blue );
|
277 |
+
|
278 |
+
return $color;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Calculate term size
|
283 |
+
*
|
284 |
+
* @param int $size_from Configured min size
|
285 |
+
* @param int $count Current count
|
286 |
+
* @param int $min_count Configured max count
|
287 |
+
* @param int $font_step Calculated step
|
288 |
+
*
|
289 |
+
* @return int
|
290 |
+
* @since 2.0
|
291 |
+
*/
|
292 |
+
private function calc_size( $size_from, $count, $min_count, $font_step ) {
|
293 |
+
return $size_from + ( ( $count - $min_count ) * $font_step );
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Calculate step size
|
298 |
+
*
|
299 |
+
* @param int $min Minimum count
|
300 |
+
* @param int $max Maximum count
|
301 |
+
* @param int $from Minimum size
|
302 |
+
* @param int $to Maximum size
|
303 |
+
*
|
304 |
+
* @return int
|
305 |
+
* @since 2.0
|
306 |
+
*/
|
307 |
+
private function calc_step( $min, $max, $from, $to ) {
|
308 |
+
if ( $min === $max ) {
|
309 |
+
return 0;
|
310 |
+
}
|
311 |
+
|
312 |
+
$spread = $max - $min;
|
313 |
+
$font_spread = $to - $from;
|
314 |
+
$step = $font_spread / $spread;
|
315 |
+
|
316 |
+
return $step;
|
317 |
+
}
|
318 |
+
}
|
utcw-render.php
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class for rendering the cloud
|
15 |
+
*
|
16 |
+
* @since 2.0
|
17 |
+
* @package utcw
|
18 |
+
* @subpackage main
|
19 |
+
*/
|
20 |
+
class UTCW_Render {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Reference to the Data class which contains the data to be rendered
|
24 |
+
*
|
25 |
+
* @var UTCW_Data
|
26 |
+
* @since 2.0
|
27 |
+
*/
|
28 |
+
private $data;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Reference to the current configuration
|
32 |
+
*
|
33 |
+
* @var UTCW_Config
|
34 |
+
* @since 2.0
|
35 |
+
*/
|
36 |
+
private $config;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Reference to the main plugin instance
|
40 |
+
*
|
41 |
+
* @var UTCW_Plugin
|
42 |
+
* @since 2.0
|
43 |
+
*/
|
44 |
+
private $plugin;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Unique ID for this widget configuration
|
48 |
+
*
|
49 |
+
* @var int
|
50 |
+
* @since 2.0
|
51 |
+
*/
|
52 |
+
private $id;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* CSS styles for this widget instance
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
* @since 2.0
|
59 |
+
*/
|
60 |
+
private $css = '';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Creates a new instance of the renderer
|
64 |
+
*
|
65 |
+
* @param UTCW_Config $config Configuration
|
66 |
+
* @param UTCW_Data $data Term data
|
67 |
+
* @param UTCW_Plugin $plugin Main plugin instance
|
68 |
+
*
|
69 |
+
* @since 2.0
|
70 |
+
*/
|
71 |
+
public function __construct( UTCW_Config $config, UTCW_Data $data, UTCW_Plugin $plugin ) {
|
72 |
+
$this->data = $data;
|
73 |
+
$this->config = $config;
|
74 |
+
$this->plugin = $plugin;
|
75 |
+
$this->id = base_convert( crc32( serialize( $config ) ), 10, 27 );
|
76 |
+
|
77 |
+
$this->build_css();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Renders the cloud as output
|
82 |
+
*
|
83 |
+
* @since 2.0
|
84 |
+
*/
|
85 |
+
public function render() {
|
86 |
+
echo $this->get_cloud();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns the cloud as a string
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
* @since 2.0
|
94 |
+
*/
|
95 |
+
public function get_cloud() {
|
96 |
+
$markup = array();
|
97 |
+
|
98 |
+
if ( $this->css ) {
|
99 |
+
$markup[ ] = $this->css;
|
100 |
+
}
|
101 |
+
|
102 |
+
if ( $this->config->before_widget ) {
|
103 |
+
$markup[ ] = $this->config->before_widget;
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( $this->config->show_title_text ) {
|
107 |
+
if ( $this->config->before_title ) {
|
108 |
+
$markup[ ] = $this->config->before_title;
|
109 |
+
}
|
110 |
+
|
111 |
+
$markup[ ] = $this->plugin->apply_filters( 'widget_title', $this->config->title );
|
112 |
+
|
113 |
+
if ( $this->config->after_title ) {
|
114 |
+
$markup[ ] = $this->config->after_title;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
$markup[ ] = '<div class="widget_tag_cloud utcw-' . $this->id . '">';
|
119 |
+
|
120 |
+
$terms = array();
|
121 |
+
|
122 |
+
foreach ( $this->data->get_terms() as $term ) {
|
123 |
+
$color = $term->color ? ';color:' . $term->color : '';
|
124 |
+
$title = $this->config->show_title ? sprintf( ' title="' . _n( '%s topic', '%s topics', $term->count ) . '"', $term->count ) : '';
|
125 |
+
|
126 |
+
$terms[ ] = sprintf(
|
127 |
+
'%s<a class="tag-link-%s" href="%s" style="font-size:%spx%s"%s>%s</a>%s',
|
128 |
+
$this->config->prefix,
|
129 |
+
$term->term_id,
|
130 |
+
$term->link,
|
131 |
+
$term->size,
|
132 |
+
$color,
|
133 |
+
$title,
|
134 |
+
$term->name,
|
135 |
+
$this->config->suffix
|
136 |
+
);
|
137 |
+
}
|
138 |
+
|
139 |
+
$markup[ ] = join( $this->config->separator, $terms );
|
140 |
+
|
141 |
+
$markup[ ] = '</div>';
|
142 |
+
|
143 |
+
if ( $this->config->debug ) {
|
144 |
+
$markup[ ] = sprintf( "<!-- Ultimate Tag Cloud Debug information:\n%s -->", print_r( $this->data, true ) );
|
145 |
+
}
|
146 |
+
|
147 |
+
if ( $this->config->after_widget ) {
|
148 |
+
$markup[ ] = $this->config->after_widget;
|
149 |
+
}
|
150 |
+
|
151 |
+
return join( '', $markup );
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Builds the CSS needed to properly style the cloud
|
156 |
+
*
|
157 |
+
* @since 2.0
|
158 |
+
*/
|
159 |
+
private function build_css() {
|
160 |
+
$main_styles = array( 'word-wrap:break-word' );
|
161 |
+
|
162 |
+
if ( ! $this->has_default_value( 'text_transform' ) ) {
|
163 |
+
$main_styles[ ] = sprintf( 'text-transform:%s', $this->config->text_transform );
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( ! $this->has_default_value( 'letter_spacing' ) ) {
|
167 |
+
$main_styles[ ] = sprintf( 'letter-spacing:%spx', $this->config->letter_spacing );
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( ! $this->has_default_value( 'word_spacing' ) ) {
|
171 |
+
$main_styles[ ] = sprintf( 'word-spacing:%spx', $this->config->word_spacing );
|
172 |
+
}
|
173 |
+
|
174 |
+
$link_styles = array();
|
175 |
+
|
176 |
+
if ( ! $this->has_default_value( 'link_underline' ) ) {
|
177 |
+
$link_styles[ ] = sprintf( 'text-decoration:%s', $this->config->link_underline === 'yes' ? 'underline' : 'none' );
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( ! $this->has_default_value( 'link_bold' ) ) {
|
181 |
+
$link_styles[ ] = sprintf( 'font-weight:%s', $this->config->link_bold === 'yes' ? 'bold' : 'normal' );
|
182 |
+
}
|
183 |
+
|
184 |
+
if ( ! $this->has_default_value( 'link_italic' ) ) {
|
185 |
+
$link_styles[ ] = sprintf( 'font-style:%s', $this->config->link_italic === 'yes' ? 'italic' : 'normal' );
|
186 |
+
}
|
187 |
+
|
188 |
+
if ( ! $this->has_default_value( 'link_bg_color' ) ) {
|
189 |
+
$link_styles[ ] = sprintf( 'background-color:%s', $this->config->link_bg_color );
|
190 |
+
}
|
191 |
+
|
192 |
+
if ( ! $this->has_default_value( 'link_border_style' ) && ! $this->has_default_value( 'link_border_color' ) && ! $this->has_default_value( 'link_border_width' ) ) {
|
193 |
+
$link_styles[ ] = sprintf( 'border:%s %spx %s', $this->config->link_border_style, $this->config->link_border_width, $this->config->link_border_color );
|
194 |
+
} else {
|
195 |
+
if ( ! $this->has_default_value( 'link_border_style' ) ) {
|
196 |
+
$link_styles[ ] = sprintf( 'border-style:%s', $this->config->link_border_style );
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( ! $this->has_default_value( 'link_border_color' ) ) {
|
200 |
+
$link_styles[ ] = sprintf( 'border-color:%s', $this->config->link_border_color );
|
201 |
+
}
|
202 |
+
|
203 |
+
if ( ! $this->has_default_value( 'link_border_width' ) ) {
|
204 |
+
$link_styles[ ] = sprintf( 'border-width:%spx', $this->config->link_border_width );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( ! $this->has_default_value( 'tag_spacing' ) ) {
|
209 |
+
$link_styles[ ] = sprintf( 'margin-right:%spx', $this->config->tag_spacing );
|
210 |
+
}
|
211 |
+
|
212 |
+
if ( ! $this->has_default_value( 'line_height' ) ) {
|
213 |
+
$link_styles[ ] = sprintf( 'line-height:%spx', $this->config->line_height );
|
214 |
+
}
|
215 |
+
|
216 |
+
$hover_styles = array();
|
217 |
+
|
218 |
+
if ( ! $this->has_default_value( 'hover_underline' ) ) {
|
219 |
+
$hover_styles[ ] = sprintf( 'text-decoration:%s', $this->config->hover_underline === 'yes' ? 'underline' : 'none' );
|
220 |
+
}
|
221 |
+
|
222 |
+
if ( ! $this->has_default_value( 'hover_bold' ) ) {
|
223 |
+
$hover_styles[ ] = sprintf( 'font-weight:%s', $this->config->hover_bold === 'yes' ? 'bold' : 'normal' );
|
224 |
+
}
|
225 |
+
|
226 |
+
if ( ! $this->has_default_value( 'hover_italic' ) ) {
|
227 |
+
$hover_styles[ ] = sprintf( 'font-style:%s', $this->config->hover_italic === 'yes' ? 'italic' : 'normal' );
|
228 |
+
}
|
229 |
+
|
230 |
+
if ( ! $this->has_default_value( 'hover_bg_color' ) ) {
|
231 |
+
$hover_styles[ ] = sprintf( 'background-color:%s', $this->config->hover_bg_color );
|
232 |
+
}
|
233 |
+
|
234 |
+
|
235 |
+
if ( ! $this->has_default_value( 'hover_border_style' ) && ! $this->has_default_value( 'hover_border_color' ) && ! $this->has_default_value( 'hover_border_width' ) ) {
|
236 |
+
$hover_styles[ ] = sprintf( 'border:%s %spx %s', $this->config->hover_border_style, $this->config->hover_border_width, $this->config->hover_border_color );
|
237 |
+
} else {
|
238 |
+
if ( ! $this->has_default_value( 'hover_border_style' ) ) {
|
239 |
+
$hover_styles[ ] = sprintf( 'border-style:%s', $this->config->hover_border_style );
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( ! $this->has_default_value( 'hover_border_color' ) ) {
|
243 |
+
$hover_styles[ ] = sprintf( 'border-color:%s', $this->config->hover_border_color );
|
244 |
+
}
|
245 |
+
|
246 |
+
if ( ! $this->has_default_value( 'hover_border_width' ) ) {
|
247 |
+
$hover_styles[ ] = sprintf( 'border-width:%spx', $this->config->hover_border_width );
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
if ( ! $this->has_default_value( 'hover_color' ) ) {
|
252 |
+
$hover_styles[ ] = sprintf( 'color:%s', $this->config->hover_color );
|
253 |
+
}
|
254 |
+
|
255 |
+
$styles = array();
|
256 |
+
|
257 |
+
if ( $main_styles ) {
|
258 |
+
$styles[ ] = sprintf( '.utcw-%s{%s}', $this->id, join( ';', $main_styles ) );
|
259 |
+
}
|
260 |
+
|
261 |
+
if ( $link_styles ) {
|
262 |
+
$styles[ ] = sprintf( '.utcw-%s a{%s}', $this->id, join( ';', $link_styles ) );
|
263 |
+
}
|
264 |
+
|
265 |
+
if ( $hover_styles ) {
|
266 |
+
$styles[ ] = sprintf( '.utcw-%s a:hover{%s}', $this->id, join( ';', $hover_styles ) );
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( $styles ) {
|
270 |
+
$this->css = sprintf( '<style type="text/css">%s</style>', join( '', $styles ) );
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Checks if option still has the default value
|
276 |
+
*
|
277 |
+
* @param string $option
|
278 |
+
*
|
279 |
+
* @return bool
|
280 |
+
* @since 2.0
|
281 |
+
*/
|
282 |
+
private function has_default_value( $option ) {
|
283 |
+
$defaults = $this->config->get_defaults();
|
284 |
+
return $this->config->$option === $defaults[ $option ];
|
285 |
+
}
|
286 |
+
}
|
utcw-term.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class to represent a term
|
15 |
+
*
|
16 |
+
* @since 2.0
|
17 |
+
* @package utcw
|
18 |
+
* @subpackage main
|
19 |
+
*/
|
20 |
+
class UTCW_Term {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Term ID
|
24 |
+
*
|
25 |
+
* @var int
|
26 |
+
* @since 2.0
|
27 |
+
*/
|
28 |
+
public $term_id;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Number of posts
|
32 |
+
*
|
33 |
+
* @var int
|
34 |
+
* @since 2.0
|
35 |
+
*/
|
36 |
+
public $count;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Term slug
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
* @since 2.0
|
43 |
+
*/
|
44 |
+
public $slug;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Term name
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
* @since 2.0
|
51 |
+
*/
|
52 |
+
public $name;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Term link
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
* @since 2.0
|
59 |
+
*/
|
60 |
+
public $link;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Term color
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
* @since 2.0
|
67 |
+
*/
|
68 |
+
public $color;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Term taxonomy
|
72 |
+
*
|
73 |
+
* @var string
|
74 |
+
* @since 2.0
|
75 |
+
*/
|
76 |
+
public $taxonomy;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Term size
|
80 |
+
*
|
81 |
+
* @var float
|
82 |
+
* @since 2.0
|
83 |
+
*/
|
84 |
+
public $size;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Creates a new term
|
88 |
+
*
|
89 |
+
* @param stdClass $input Object with properties term_id, count, slug, name, color and taxonomy
|
90 |
+
* @param UTCW_Plugin $plugin Reference to the plugin instance
|
91 |
+
*
|
92 |
+
* @since 2.0
|
93 |
+
*/
|
94 |
+
function __construct( stdClass $input, UTCW_Plugin $plugin ) {
|
95 |
+
|
96 |
+
if ( isset( $input->term_id ) && filter_var( $input->term_id, FILTER_VALIDATE_INT ) ) {
|
97 |
+
$this->term_id = intval( $input->term_id );
|
98 |
+
}
|
99 |
+
|
100 |
+
if ( isset( $input->count ) && filter_var( $input->count, FILTER_VALIDATE_INT ) ) {
|
101 |
+
$this->count = intval( $input->count );
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( isset( $input->slug ) && strlen( $input->slug ) > 0 && preg_match( '/^[0-9a-z\-]+/i', $input->slug ) ) {
|
105 |
+
$this->slug = $input->slug;
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( isset( $input->name ) && strlen( $input->name ) > 0 ) {
|
109 |
+
$this->name = $input->name;
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( isset( $input->color ) && strlen( $input->color ) > 0 && preg_match( UTCW_HEX_COLOR_REGEX, $input->color ) ) {
|
113 |
+
$this->color = $input->color;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( isset( $input->taxonomy ) && strlen( $input->taxonomy ) > 0 ) {
|
117 |
+
$this->taxonomy = $input->taxonomy;
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( $this->term_id && $this->taxonomy ) {
|
121 |
+
$this->link = $plugin->get_term_link( $this->term_id, $this->taxonomy );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
utcw-widget.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Widget class for WordPress integration
|
15 |
+
*
|
16 |
+
* @since 1.0
|
17 |
+
* @package utcw
|
18 |
+
* @subpackage main
|
19 |
+
*/
|
20 |
+
class UTCW extends WP_Widget {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Reference to the main plugin instance
|
24 |
+
*
|
25 |
+
* @var UTCW_Plugin
|
26 |
+
* @since 2.0
|
27 |
+
*/
|
28 |
+
private $plugin;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constructor
|
32 |
+
*
|
33 |
+
* @param UTCW_Plugin $plugin Optional. Plugin instance for dependency injection
|
34 |
+
*
|
35 |
+
* @return UTCW
|
36 |
+
* @since 1.0
|
37 |
+
*/
|
38 |
+
function __construct( UTCW_Plugin $plugin = null ) {
|
39 |
+
$options = array( 'description' => __( 'Highly configurable tag cloud', 'utcw' ) );
|
40 |
+
parent::WP_Widget( false, __( 'Ultimate Tag Cloud', 'utcw' ), $options );
|
41 |
+
|
42 |
+
$this->plugin = $plugin ? $plugin : UTCW_Plugin::get_instance();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Action handler for the form in the admin panel
|
47 |
+
*
|
48 |
+
* @param array $new_instance
|
49 |
+
* @param array $old_instance
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
* @since 1.0
|
53 |
+
*/
|
54 |
+
function update( array $new_instance, array $old_instance ) {
|
55 |
+
|
56 |
+
// Overwrite the form values with the saved configuration
|
57 |
+
if ( isset( $new_instance[ 'load_config' ] ) && isset( $new_instance[ 'load_config_name' ] ) && $new_instance[ 'load_config_name' ] ) {
|
58 |
+
$loaded_configuration = $this->plugin->load_configuration( $new_instance[ 'load_config_name' ] );
|
59 |
+
|
60 |
+
if ( $loaded_configuration ) {
|
61 |
+
$new_instance = $loaded_configuration;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
$config = new UTCW_Config( $new_instance, $this->plugin );
|
66 |
+
|
67 |
+
if ( isset( $new_instance[ 'save_config' ] ) && isset( $new_instance[ 'save_config_name' ] ) && $new_instance[ 'save_config_name' ] ) {
|
68 |
+
$this->plugin->save_configuration( $new_instance[ 'save_config_name' ], $config->get_instance() );
|
69 |
+
}
|
70 |
+
|
71 |
+
return $config->get_instance();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Function for handling the widget control in admin panel
|
76 |
+
*
|
77 |
+
* @param array $instance
|
78 |
+
*
|
79 |
+
* @return void|string
|
80 |
+
* @since 1.0
|
81 |
+
*/
|
82 |
+
function form( array $instance ) {
|
83 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
84 |
+
$config = new UTCW_Config( $instance, $this->plugin );
|
85 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
86 |
+
$configurations = $this->plugin->get_configurations();
|
87 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
88 |
+
$available_post_types = $this->plugin->get_allowed_post_types();
|
89 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
90 |
+
$available_taxonomies = $this->plugin->get_allowed_taxonomies_objects();
|
91 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
92 |
+
$users = $this->plugin->get_users();
|
93 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
94 |
+
$terms = $this->plugin->get_terms();
|
95 |
+
|
96 |
+
// Content of the widget settings form
|
97 |
+
require 'pages/settings.php';
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Function for rendering the widget
|
102 |
+
*
|
103 |
+
* @param array $args
|
104 |
+
*
|
105 |
+
* @param array $instance
|
106 |
+
*/
|
107 |
+
function widget( array $args, array $instance ) {
|
108 |
+
global $wpdb;
|
109 |
+
|
110 |
+
$input = array_merge( $instance, $args );
|
111 |
+
|
112 |
+
$config = new UTCW_Config( $input, $this->plugin );
|
113 |
+
$data = new UTCW_Data( $config, $this->plugin, $wpdb );
|
114 |
+
$render = new UTCW_Render( $config, $data, $this->plugin );
|
115 |
+
|
116 |
+
$render->render();
|
117 |
+
}
|
118 |
+
}
|
utcw.css
DELETED
@@ -1,97 +0,0 @@
|
|
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 |
-
}
|
19 |
-
.utcw-tab-button:hover {
|
20 |
-
opacity: 1;
|
21 |
-
}
|
22 |
-
.utcw-help {
|
23 |
-
float: right;
|
24 |
-
display: block;
|
25 |
-
width: 14px;
|
26 |
-
height: 14px;
|
27 |
-
border: solid 1px transparent;
|
28 |
-
-webkit-border-radius: 14px;
|
29 |
-
-moz-border-radius: 14px;
|
30 |
-
-khtml-border-radius: 14px;
|
31 |
-
border-radius: 14px;
|
32 |
-
text-align: center;
|
33 |
-
color: #fff;
|
34 |
-
font-weight: bold;
|
35 |
-
|
36 |
-
|
37 |
-
background-color: #6295fb;
|
38 |
-
background-image: -webkit-gradient(linear, left top, left bottom, from(#6295fb), to(#3265cb));
|
39 |
-
background-image: -webkit-linear-gradient(top, #6295fb, #3265cb);
|
40 |
-
background-image: -moz-linear-gradient(top, #6295fb, #3265cb);
|
41 |
-
background-image: -ms-linear-gradient(top, #6295fb, #3265cb);
|
42 |
-
background-image: -o-linear-gradient(top, #6295fb, #3265cb);
|
43 |
-
background-image: linear-gradient(top, #6295fb, #3265cb);
|
44 |
-
|
45 |
-
cursor: pointer;
|
46 |
-
}
|
47 |
-
.utcw-help:hover {
|
48 |
-
color: #fff;
|
49 |
-
}
|
50 |
-
.utcw-tooltip {
|
51 |
-
color:#000;
|
52 |
-
width: 200px;
|
53 |
-
text-align:center;
|
54 |
-
border:solid 1px #6295fb;
|
55 |
-
-webkit-border-radius:9px;
|
56 |
-
-moz-border-radius:9px;
|
57 |
-
-khtml-border-radius:9px;
|
58 |
-
border-radius:9px;
|
59 |
-
}
|
60 |
-
.utcw-tooltip ul {
|
61 |
-
list-style-type: circle;
|
62 |
-
margin: 10px 0;
|
63 |
-
}
|
64 |
-
.utcw-tooltip li {
|
65 |
-
margin: 0 0 0 20px;
|
66 |
-
}
|
67 |
-
.utcw h3 {
|
68 |
-
margin: 0;
|
69 |
-
}
|
70 |
-
|
71 |
-
.utcw-active {
|
72 |
-
font-weight: bold;
|
73 |
-
opacity: 1;
|
74 |
-
}
|
75 |
-
|
76 |
-
fieldset.utcw {
|
77 |
-
padding: 10px;
|
78 |
-
border: solid 1px #dfdfdf;
|
79 |
-
margin-bottom: 25px;
|
80 |
-
}
|
81 |
-
fieldset.utcw legend {
|
82 |
-
letter-spacing: 2px;
|
83 |
-
font-size: 16px;
|
84 |
-
}
|
85 |
-
.utcw-hidden {
|
86 |
-
display:none;
|
87 |
-
}
|
88 |
-
div.widget_utcw {
|
89 |
-
word-wrap: break-word;
|
90 |
-
}
|
91 |
-
.utcw .fullwidth {
|
92 |
-
width: 100%;
|
93 |
-
}
|
94 |
-
fieldset.utcw label.two-col {
|
95 |
-
width: 120px;
|
96 |
-
display: inline-block;
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utcw.js
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
/* Wayfarer Tooltip
|
2 |
-
* Version 1.0.9
|
3 |
-
* Author Abel Mohler
|
4 |
-
* URI: http://www.wayfarerweb.com/wtooltip.php
|
5 |
-
* Released with the MIT License: http://www.wayfarerweb.com/mit.php
|
6 |
-
*/
|
7 |
-
(function(a){a.fn.wTooltip=function(f,r){f=a.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(t,p,o){},callAfter:function(t,p,o){},clickAction:function(p,o){a(p).hide()},delay:0,timeout:0},f||{});if(!f.style&&typeof f.style!="object"){f.style={};f.style.zIndex="1000"}else{f.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},f.style||{})}if(typeof r=="function"){f.callAfter=r||f.callAfter}f.style.display="none",f.style.position="absolute";var m,l,q,c,k={},b=true,e=false,n=false,s=document.createElement("div"),g=(typeof document.body.style.maxWidth=="undefined")?true:false,j=(typeof a.talk=="function"&&typeof a.listen=="function")?true:false;if(f.id){s.id=f.id}if(f.className){s.className=f.className}f.degrade=(f.degrade&&g)?true:false;for(var d in f.style){s.style[d]=f.style[d]}function i(o){if(o){if(f.degrade){a(s).html(f.content.replace(/<\/?[^>]+>/gi,""))}else{a(s).html(f.content)}}}if(f.ajax){a.get(f.ajax,function(o){if(o){f.content=o}i(f.content)})}function h(p){function t(u){if(m&&!f.content){m=""}}function o(){if(!e&&f.auto){clearInterval(c);if(f.fadeOut){a(s).fadeOut(f.fadeOut,function(){t(p)})}else{t(p);s.style.display="none"}}if(typeof f.callAfter=="function"){f.callAfter(s,p,f)}if(j){f=a.listen(f)}}if(f.timeout>0){q=setTimeout(function(){o()},f.timeout)}else{o()}}a(s).hover(function(){e=true},function(){e=false;h(k)});if(j){f.key=s;f.plugin="wTooltip";f.channel="wayfarer";a.talk(f)}i(f.content&&!f.ajax);a(s).appendTo(f.appendTip);return this.each(function(){a(this).hover(function(){var p=this;clearTimeout(q);if((this.title||this.titleMemKeep)&&!f.degrade&&!f.content){m=this.title||this.titleMemKeep;if(this.title){this.titleMemKeep=this.title;this.title=""}}if(f.content&&f.degrade){this.title=s.innerHTML}function o(){if(typeof f.callBefore=="function"){f.callBefore(s,p,f)}if(j){f=a.listen(f)}var t;if(f.content){if(!f.degrade){t="block"}}else{if(m&&!f.degrade){a(s).html(unescape(m));t="block";m=""}else{t="none"}}if(f.auto){if(t=="block"&&f.fadeIn){a(s).fadeIn(f.fadeIn)}else{s.style.display=t}}}if(f.delay>0){l=setTimeout(function(){o()},f.delay)}else{o()}},function(){clearTimeout(l);var o=this;b=true;if(!f.follow||n||((f.offsetX<0&&(0-f.offsetX<a(s).outerWidth()))&&(f.offsetY>0&&0-f.offsetY<a(s).outerHeight()))){setTimeout(function(){c=setInterval(function(){h(o)},1)},1)}else{h(this)}});a(this).mousemove(function(v){k=this;if(f.follow||b){var y=a(window).scrollTop(),z=a(window).scrollLeft(),w=v.clientY+y+f.offsetY,t=v.clientX+z+f.offsetX,x=a(f.appendTip).outerHeight(),p=a(f.appendTip).innerHeight(),o=a(window).width()+z-a(s).outerWidth(),u=a(window).height()+y-a(s).outerHeight();w=(x>p)?w-(x-p):w;n=(w>u||t>o)?true:false;if(t-z<=0&&f.offsetX<0){t=z}else{if(t>o){t=o}}if(w-y<=0&&f.offsetY<0){w=y}else{if(w>u){w=u}}s.style.top=w+"px";s.style.left=t+"px";b=false}});if(typeof f.clickAction=="function"){a(this).click(function(){f.clickAction(s,this)})}})}})(jQuery);
|
8 |
-
|
9 |
-
var utcwActiveTab = [];
|
10 |
-
var wTooltipStyle={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1E3};
|
11 |
-
|
12 |
-
(function($){
|
13 |
-
|
14 |
-
$(document).ready(function() {
|
15 |
-
|
16 |
-
$('input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]').live('click', function() {
|
17 |
-
|
18 |
-
$("div[id$='set_chooser']").addClass('utcw-hidden');
|
19 |
-
$("div[id$='span_chooser']").addClass('utcw-hidden');
|
20 |
-
|
21 |
-
if ($(this).val() == 'set') {
|
22 |
-
$("div[id$='set_chooser']").removeClass('utcw-hidden');
|
23 |
-
} else if ($(this).val() == 'span') {
|
24 |
-
$("div[id$='span_chooser']").removeClass('utcw-hidden');
|
25 |
-
}
|
26 |
-
});
|
27 |
-
|
28 |
-
$('.utcw-tab-button').live('click', function() {
|
29 |
-
|
30 |
-
var $this = $(this);
|
31 |
-
|
32 |
-
if ( $this.data('id') == "utcw-__i__" ) {
|
33 |
-
return false;
|
34 |
-
}
|
35 |
-
|
36 |
-
$this.parent().find(".utcw-tab-button").removeClass("utcw-active");
|
37 |
-
$this.addClass("utcw-active");
|
38 |
-
|
39 |
-
$this.parent().find("fieldset.utcw").addClass("hidden");
|
40 |
-
$("#" + $this.data('tab') ).removeClass("hidden");
|
41 |
-
|
42 |
-
utcwActiveTab[ $this.data('id') ] = $this.data('tab');
|
43 |
-
|
44 |
-
return false;
|
45 |
-
});
|
46 |
-
});
|
47 |
-
})(jQuery);
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utcw.min.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.utcw-tab-button{border-top:solid 1px #dfdfdf;border-left:solid 1px #dfdfdf;border-right:solid 1px #dfdfdf;border-bottom:0;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:.5;cursor:pointer;-webkit-transition:opacity .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}.utcw h3{margin:0}.utcw-active{font-weight:bold;opacity:1}fieldset.utcw{padding:10px;border:solid 1px #dfdfdf;margin-bottom:25px}fieldset.utcw legend{letter-spacing:2px;font-size:16px}.utcw-hidden{display:none}div.widget_utcw{word-wrap:break-word}.utcw .fullwidth{width:100%}fieldset.utcw label.two-col{width:120px;display:inline-block}
|
|
utcw.min.js
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
/* Wayfarer Tooltip
|
2 |
-
* Version 1.0.9
|
3 |
-
* Author Abel Mohler
|
4 |
-
* URI: http://www.wayfarerweb.com/wtooltip.php
|
5 |
-
* Released with the MIT License: http://www.wayfarerweb.com/mit.php
|
6 |
-
*/
|
7 |
-
(function(a){a.fn.wTooltip=function(f,r){f=a.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(t,p,o){},callAfter:function(t,p,o){},clickAction:function(p,o){a(p).hide()},delay:0,timeout:0},f||{});if(!f.style&&typeof f.style!="object"){f.style={};f.style.zIndex="1000"}else{f.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},f.style||{})}if(typeof r=="function"){f.callAfter=r||f.callAfter}f.style.display="none",f.style.position="absolute";var m,l,q,c,k={},b=true,e=false,n=false,s=document.createElement("div"),g=(typeof document.body.style.maxWidth=="undefined")?true:false,j=(typeof a.talk=="function"&&typeof a.listen=="function")?true:false;if(f.id){s.id=f.id}if(f.className){s.className=f.className}f.degrade=(f.degrade&&g)?true:false;for(var d in f.style){s.style[d]=f.style[d]}function i(o){if(o){if(f.degrade){a(s).html(f.content.replace(/<\/?[^>]+>/gi,""))}else{a(s).html(f.content)}}}if(f.ajax){a.get(f.ajax,function(o){if(o){f.content=o}i(f.content)})}function h(p){function t(u){if(m&&!f.content){m=""}}function o(){if(!e&&f.auto){clearInterval(c);if(f.fadeOut){a(s).fadeOut(f.fadeOut,function(){t(p)})}else{t(p);s.style.display="none"}}if(typeof f.callAfter=="function"){f.callAfter(s,p,f)}if(j){f=a.listen(f)}}if(f.timeout>0){q=setTimeout(function(){o()},f.timeout)}else{o()}}a(s).hover(function(){e=true},function(){e=false;h(k)});if(j){f.key=s;f.plugin="wTooltip";f.channel="wayfarer";a.talk(f)}i(f.content&&!f.ajax);a(s).appendTo(f.appendTip);return this.each(function(){a(this).hover(function(){var p=this;clearTimeout(q);if((this.title||this.titleMemKeep)&&!f.degrade&&!f.content){m=this.title||this.titleMemKeep;if(this.title){this.titleMemKeep=this.title;this.title=""}}if(f.content&&f.degrade){this.title=s.innerHTML}function o(){if(typeof f.callBefore=="function"){f.callBefore(s,p,f)}if(j){f=a.listen(f)}var t;if(f.content){if(!f.degrade){t="block"}}else{if(m&&!f.degrade){a(s).html(unescape(m));t="block";m=""}else{t="none"}}if(f.auto){if(t=="block"&&f.fadeIn){a(s).fadeIn(f.fadeIn)}else{s.style.display=t}}}if(f.delay>0){l=setTimeout(function(){o()},f.delay)}else{o()}},function(){clearTimeout(l);var o=this;b=true;if(!f.follow||n||((f.offsetX<0&&(0-f.offsetX<a(s).outerWidth()))&&(f.offsetY>0&&0-f.offsetY<a(s).outerHeight()))){setTimeout(function(){c=setInterval(function(){h(o)},1)},1)}else{h(this)}});a(this).mousemove(function(v){k=this;if(f.follow||b){var y=a(window).scrollTop(),z=a(window).scrollLeft(),w=v.clientY+y+f.offsetY,t=v.clientX+z+f.offsetX,x=a(f.appendTip).outerHeight(),p=a(f.appendTip).innerHeight(),o=a(window).width()+z-a(s).outerWidth(),u=a(window).height()+y-a(s).outerHeight();w=(x>p)?w-(x-p):w;n=(w>u||t>o)?true:false;if(t-z<=0&&f.offsetX<0){t=z}else{if(t>o){t=o}}if(w-y<=0&&f.offsetY<0){w=y}else{if(w>u){w=u}}s.style.top=w+"px";s.style.left=t+"px";b=false}});if(typeof f.clickAction=="function"){a(this).click(function(){f.clickAction(s,this)})}})}})(jQuery);
|
8 |
-
var utcwActiveTab=[],wTooltipStyle={border:"solid 1px #6295fb",background:"#fff",color:"#000",padding:"5px",zIndex:1E3};
|
9 |
-
(function(a){a(document).ready(function(){a("input[id$=-color_none], input[id$=-color_random], input[id$=-color_set], input[id$=-color_span]").live("click",function(){a("div[id$='set_chooser']").addClass("utcw-hidden");a("div[id$='span_chooser']").addClass("utcw-hidden");"set"==a(this).val()?a("div[id$='set_chooser']").removeClass("utcw-hidden"):"span"==a(this).val()&&a("div[id$='span_chooser']").removeClass("utcw-hidden")});a(".utcw-tab-button").live("click",function(){var b=a(this);if("utcw-__i__"==
|
10 |
-
b.data("id"))return!1;b.parent().find(".utcw-tab-button").removeClass("utcw-active");b.addClass("utcw-active");b.parent().find("fieldset.utcw").addClass("hidden");a("#"+b.data("tab")).removeClass("hidden");utcwActiveTab[b.data("id")]=b.data("tab");return!1})})})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utcw.php
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate Tag Cloud Widget
|
4 |
+
* @author Rickard Andersson <rickard@0x539.se>
|
5 |
+
* @version 2.0
|
6 |
+
* @license GPLv2
|
7 |
+
* @package utcw
|
8 |
+
* @subpackage main
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Current version number
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
* @since 2.0
|
18 |
+
*/
|
19 |
+
define( 'UTCW_VERSION', '2.0-beta1' );
|
20 |
+
|
21 |
+
/**
|
22 |
+
* If development mode is currently enabled
|
23 |
+
*
|
24 |
+
* @var bool
|
25 |
+
* @since 2.0
|
26 |
+
*/
|
27 |
+
define( 'UTCW_DEV', false );
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Regular expression for matching hexadecimal colors
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
* @since 2.0
|
34 |
+
*/
|
35 |
+
define( 'UTCW_HEX_COLOR_REGEX', '/#([a-f0-9]{6}|[a-f0-9]{3})/i' );
|
36 |
+
|
37 |
+
/**
|
38 |
+
* printf format for rendering hexadecimal colors
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
* @since 2.0
|
42 |
+
*/
|
43 |
+
define( 'UTCW_HEX_COLOR_FORMAT', '#%02x%02x%02x' );
|
44 |
+
|
45 |
+
require_once 'utcw-config.php';
|
46 |
+
require_once 'utcw-widget.php';
|
47 |
+
require_once 'utcw-data.php';
|
48 |
+
require_once 'utcw-render.php';
|
49 |
+
require_once 'utcw-term.php';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Class for general plugin integration with WordPress
|
53 |
+
*
|
54 |
+
* @since 2.0
|
55 |
+
* @package utcw
|
56 |
+
* @subpackage main
|
57 |
+
*/
|
58 |
+
class UTCW_Plugin {
|
59 |
+
|
60 |
+
/**
|
61 |
+
* An array of which taxonomies are available
|
62 |
+
*
|
63 |
+
* @var array
|
64 |
+
* @since 2.0
|
65 |
+
*/
|
66 |
+
protected $allowed_taxonomies = array();
|
67 |
+
|
68 |
+
/**
|
69 |
+
* An array of which post types are available
|
70 |
+
*
|
71 |
+
* @var array
|
72 |
+
* @since 2.0
|
73 |
+
*/
|
74 |
+
protected $allowed_post_types = array();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Singleton instance
|
78 |
+
*
|
79 |
+
* @var UTCW_Plugin
|
80 |
+
* @since 2.0
|
81 |
+
*/
|
82 |
+
private static $instance;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Initializes the WordPress hooks needed
|
86 |
+
*
|
87 |
+
* @todo Add tests that these hooks are set
|
88 |
+
* @since 2.0
|
89 |
+
*/
|
90 |
+
private function __construct() {
|
91 |
+
add_action( 'admin_head-widgets.php', array( $this, 'init_admin_assets' ) );
|
92 |
+
add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
|
93 |
+
add_action( 'widgets_init', create_function( '', 'return register_widget("UTCW");' ) );
|
94 |
+
add_shortcode( 'utcw', array( $this, 'utcw_shortcode' ) );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Returns an instance of the plugin
|
99 |
+
*
|
100 |
+
* @static
|
101 |
+
* @return UTCW_Plugin
|
102 |
+
* @since 2.0
|
103 |
+
*/
|
104 |
+
public static function get_instance() {
|
105 |
+
if ( ! self::$instance ) {
|
106 |
+
self::$instance = new self;
|
107 |
+
}
|
108 |
+
|
109 |
+
return self::$instance;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Action handler for 'wp_loaded' hook
|
114 |
+
* Loads taxonomies and post types
|
115 |
+
*
|
116 |
+
* @since 2.0
|
117 |
+
*/
|
118 |
+
function wp_loaded() {
|
119 |
+
$this->allowed_taxonomies = get_taxonomies();
|
120 |
+
$this->allowed_post_types = get_post_types( array( 'public' => true ) );
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Shortcode handler for 'utcw' hook
|
125 |
+
*
|
126 |
+
* @param array $args
|
127 |
+
*
|
128 |
+
* @return string
|
129 |
+
* @since 2.0
|
130 |
+
*/
|
131 |
+
function utcw_shortcode( array $args ) {
|
132 |
+
global $wpdb;
|
133 |
+
|
134 |
+
$config = new UTCW_Config( $args, $this );
|
135 |
+
$data = new UTCW_Data( $config, $this, $wpdb );
|
136 |
+
$render = new UTCW_Render( $config, $data, $this );
|
137 |
+
|
138 |
+
return $render->get_cloud();
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Action handler for 'admin_head-widgets.php' hook
|
143 |
+
* Loads assets needed by the administration interface
|
144 |
+
*
|
145 |
+
* @since 2.0
|
146 |
+
*/
|
147 |
+
public function init_admin_assets() {
|
148 |
+
wp_enqueue_style( 'utcw-admin', plugins_url( 'ultimate-tag-cloud-widget/css/style.css' ), array(), UTCW_VERSION );
|
149 |
+
|
150 |
+
// In development mode, add the libraries and main file individually
|
151 |
+
if ( UTCW_DEV ) {
|
152 |
+
wp_enqueue_script( 'utcw-lib-jsuri', plugins_url( 'ultimate-tag-cloud-widget/js/lib/jsuri-1.1.1.min.js' ), array(), UTCW_VERSION, true );
|
153 |
+
wp_enqueue_script( 'utcw-lib-tooltip', plugins_url( 'ultimate-tag-cloud-widget/js/lib/tooltip.min.js' ), array( 'jquery' ), UTCW_VERSION, true );
|
154 |
+
wp_enqueue_script( 'utcw', plugins_url( 'ultimate-tag-cloud-widget/js/utcw.js' ), array( 'utcw-lib-jsuri', 'utcw-lib-tooltip', 'jquery' ), UTCW_VERSION, true );
|
155 |
+
} else {
|
156 |
+
wp_enqueue_script( 'utcw', plugins_url( 'ultimate-tag-cloud-widget/js/utcw.min.js' ), array( 'jquery' ), UTCW_VERSION, true );
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Returns an array with the names of allowed taxonomies
|
162 |
+
*
|
163 |
+
* @return array
|
164 |
+
* @since 2.0
|
165 |
+
*/
|
166 |
+
public function get_allowed_taxonomies() {
|
167 |
+
return $this->allowed_taxonomies;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Returns allowed taxonomies as objects
|
172 |
+
*
|
173 |
+
* @return array
|
174 |
+
* @since 2.0
|
175 |
+
*/
|
176 |
+
public function get_allowed_taxonomies_objects() {
|
177 |
+
return get_taxonomies( array(), 'objects' );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Returns an array with taxonomy as key and an array of term objects for each taxonomy. Like:
|
182 |
+
*
|
183 |
+
* @return array
|
184 |
+
* @since 2.0
|
185 |
+
*/
|
186 |
+
public function get_terms() {
|
187 |
+
$terms = array();
|
188 |
+
|
189 |
+
foreach ( $this->get_allowed_taxonomies() as $taxonomy ) {
|
190 |
+
$terms[ $taxonomy ] = get_terms( $taxonomy );
|
191 |
+
}
|
192 |
+
|
193 |
+
return $terms;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Returns an array with the names of allowed post types
|
198 |
+
*
|
199 |
+
* @return array
|
200 |
+
* @since 2.0
|
201 |
+
*/
|
202 |
+
public function get_allowed_post_types() {
|
203 |
+
return $this->allowed_post_types;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Returns the users on this blog
|
208 |
+
*
|
209 |
+
* @return array
|
210 |
+
* @since 2.0
|
211 |
+
*/
|
212 |
+
function get_users() {
|
213 |
+
global $wp_version;
|
214 |
+
|
215 |
+
if ( (float)$wp_version < 3.1 ) {
|
216 |
+
return get_users_of_blog();
|
217 |
+
} else {
|
218 |
+
return get_users();
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Saves the configuration
|
224 |
+
*
|
225 |
+
* @param string $name Name of configuration
|
226 |
+
* @param array $config Exported configuration from UTCW_Config
|
227 |
+
*
|
228 |
+
* @return bool
|
229 |
+
* @since 2.0
|
230 |
+
*/
|
231 |
+
function save_configuration( $name, array $config ) {
|
232 |
+
$configs = $this->get_configurations();
|
233 |
+
$configs[ $name ] = $config;
|
234 |
+
|
235 |
+
return update_option( 'utcw_saved_configs', $configs );
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Loads saved configuration
|
240 |
+
*
|
241 |
+
* @param string $name Name of configuration
|
242 |
+
*
|
243 |
+
* @return array|bool Returns an instance array on success and boolean false on failure
|
244 |
+
* @since 2.0
|
245 |
+
*/
|
246 |
+
function load_configuration( $name ) {
|
247 |
+
$configs = $this->get_configurations();
|
248 |
+
|
249 |
+
if ( isset( $configs[ $name ] ) ) {
|
250 |
+
return $configs[ $name ];
|
251 |
+
}
|
252 |
+
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Get saved configurations
|
258 |
+
*
|
259 |
+
* @return array
|
260 |
+
* @since 2.0
|
261 |
+
*/
|
262 |
+
function get_configurations() {
|
263 |
+
return get_option( 'utcw_saved_configs', array() );
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Returns boolean true if the current page request is for an authenticated user
|
268 |
+
*
|
269 |
+
* @return bool
|
270 |
+
* @since 2.0
|
271 |
+
*/
|
272 |
+
public function is_authenticated_user() {
|
273 |
+
return is_user_logged_in();
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Returns an absolute URI to the archive page for the term
|
278 |
+
*
|
279 |
+
* @param int $term_id Term ID
|
280 |
+
* @param string $taxonomy Taxonomy name
|
281 |
+
*
|
282 |
+
* @return string Returns URI on success and empty string on failure
|
283 |
+
* @since 2.0
|
284 |
+
*/
|
285 |
+
public function get_term_link( $term_id, $taxonomy ) {
|
286 |
+
$link = get_term_link( $term_id, $taxonomy );
|
287 |
+
|
288 |
+
return ! is_wp_error( $link ) ? $link : '';
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Check if the term exist for taxonomy
|
293 |
+
*
|
294 |
+
* @param int $term_id Term ID
|
295 |
+
* @param string $taxonomy Taxonomy name
|
296 |
+
*
|
297 |
+
* @return bool
|
298 |
+
* @since 2.0
|
299 |
+
*/
|
300 |
+
public function check_term_taxonomy( $term_id, $taxonomy ) {
|
301 |
+
return ! ! get_term( $term_id, $taxonomy );
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Apply filters
|
306 |
+
*
|
307 |
+
* @param string $tag
|
308 |
+
* @param mixed $value
|
309 |
+
*
|
310 |
+
* @return mixed|void
|
311 |
+
* @since 2.0
|
312 |
+
*/
|
313 |
+
public function apply_filters( $tag, $value ) {
|
314 |
+
return apply_filters( $tag, $value );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
// Instantiates the plugin
|
319 |
+
UTCW_Plugin::get_instance();
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Function for theme integration
|
323 |
+
*
|
324 |
+
* @param array $args
|
325 |
+
*
|
326 |
+
* @since 1.3
|
327 |
+
*/
|
328 |
+
function do_utcw( array $args ) {
|
329 |
+
$plugin = UTCW_Plugin::get_instance();
|
330 |
+
echo $plugin->utcw_shortcode( $args );
|
331 |
+
}
|