Search & Filter - Version 1.0.2

Version Description

Download this release

Release Info

Developer DesignsAndCode
Plugin Icon 128x128 Search & Filter
Version 1.0.2
Comparing to
See all releases

Version 1.0.2

admin/github.css ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+
3
+ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
4
+
5
+ */
6
+
7
+ pre code {
8
+ display: block; padding: 0.5em;
9
+ color: #333;
10
+ background: #f8f8ff
11
+ }
12
+
13
+ pre .comment,
14
+ pre .template_comment,
15
+ pre .diff .header,
16
+ pre .javadoc {
17
+ color: #998;
18
+ font-style: italic
19
+ }
20
+
21
+ pre .keyword,
22
+ pre .css .rule .keyword,
23
+ pre .winutils,
24
+ pre .javascript .title,
25
+ pre .nginx .title,
26
+ pre .subst,
27
+ pre .request,
28
+ pre .status {
29
+ color: #333;
30
+ font-weight: bold
31
+ }
32
+
33
+ pre .number,
34
+ pre .hexcolor,
35
+ pre .ruby .constant {
36
+ color: #099;
37
+ }
38
+
39
+ pre .string,
40
+ pre .tag .value,
41
+ pre .phpdoc,
42
+ pre .tex .formula {
43
+ color: #d14
44
+ }
45
+
46
+ pre .title,
47
+ pre .id {
48
+ color: #900;
49
+ font-weight: bold
50
+ }
51
+
52
+ pre .javascript .title,
53
+ pre .lisp .title,
54
+ pre .clojure .title,
55
+ pre .subst {
56
+ font-weight: normal
57
+ }
58
+
59
+ pre .class .title,
60
+ pre .haskell .type,
61
+ pre .vhdl .literal,
62
+ pre .tex .command {
63
+ color: #458;
64
+ font-weight: bold
65
+ }
66
+
67
+ pre .tag,
68
+ pre .tag .title,
69
+ pre .rules .property,
70
+ pre .django .tag .keyword {
71
+ color: #000080;
72
+ font-weight: normal
73
+ }
74
+
75
+ pre .attribute,
76
+ pre .variable,
77
+ pre .lisp .body {
78
+ color: #008080
79
+ }
80
+
81
+ pre .regexp {
82
+ color: #009926
83
+ }
84
+
85
+ pre .class {
86
+ color: #458;
87
+ font-weight: bold
88
+ }
89
+
90
+ pre .symbol,
91
+ pre .ruby .symbol .string,
92
+ pre .lisp .keyword,
93
+ pre .tex .special,
94
+ pre .prompt {
95
+ color: #990073
96
+ }
97
+
98
+ pre .built_in,
99
+ pre .lisp .title,
100
+ pre .clojure .built_in {
101
+ color: #0086b3
102
+ }
103
+
104
+ pre .preprocessor,
105
+ pre .pi,
106
+ pre .doctype,
107
+ pre .shebang,
108
+ pre .cdata {
109
+ color: #999;
110
+ font-weight: bold
111
+ }
112
+
113
+ pre .deletion {
114
+ background: #fdd
115
+ }
116
+
117
+ pre .addition {
118
+ background: #dfd
119
+ }
120
+
121
+ pre .diff .change {
122
+ background: #0086b3
123
+ }
124
+
125
+ pre .chunk {
126
+ color: #aaa
127
+ }
admin/icon.png ADDED
Binary file
admin/style.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .tablenav
3
+ {
4
+ display:none;
5
+ }
6
+
7
+ .of-caption
8
+ {
9
+ margin-top: 13px;
10
+ margin-bottom: 23px;
11
+ padding: 10px;
12
+ overflow: hidden;
13
+ -webkit-border-radius: 3px;
14
+ border-radius: 3px;
15
+ border: 1px solid #eee;
16
+ background: #fbfbfb;
17
+ }
18
+
19
+ .wp-list-table
20
+ {
21
+ margin-top: 23px;
22
+ margin-bottom: 23px;
23
+ }
24
+
25
+ .wp-list-table td
26
+ {
27
+ padding-bottom:10px;
28
+ padding-top:10px;
29
+
30
+ }
31
+
32
+ .of-url, .of-url .number
33
+ {
34
+ color:#d14;
35
+ }
36
+
37
+ pre code
38
+ {
39
+ background-color:#eeeeee;
40
+ font-size:12px;
41
+ }
admin/syntax.default.min.css ADDED
@@ -0,0 +1 @@
 
1
+ pre code{display:block;padding:.5em;background:#f0f0f0}pre code,pre .subst,pre .tag .title,pre .lisp .title,pre .clojure .built_in,pre .nginx .title{color:black}pre .string,pre .title,pre .constant,pre .parent,pre .tag .value,pre .rules .value,pre .rules .value .number,pre .preprocessor,pre .ruby .symbol,pre .ruby .symbol .string,pre .aggregate,pre .template_tag,pre .django .variable,pre .smalltalk .class,pre .addition,pre .flow,pre .stream,pre .bash .variable,pre .apache .tag,pre .apache .cbracket,pre .tex .command,pre .tex .special,pre .erlang_repl .function_or_atom,pre .markdown .header{color:#800}pre .comment,pre .annotation,pre .template_comment,pre .diff .header,pre .chunk,pre .markdown .blockquote{color:#888}pre .number,pre .date,pre .regexp,pre .literal,pre .smalltalk .symbol,pre .smalltalk .char,pre .go .constant,pre .change,pre .markdown .bullet,pre .markdown .link_url{color:#080}pre .label,pre .javadoc,pre .ruby .string,pre .decorator,pre .filter .argument,pre .localvars,pre .array,pre .attr_selector,pre .important,pre .pseudo,pre .pi,pre .doctype,pre .deletion,pre .envvar,pre .shebang,pre .apache .sqbracket,pre .nginx .built_in,pre .tex .formula,pre .erlang_repl .reserved,pre .prompt,pre .markdown .link_label,pre .vhdl .attribute,pre .clojure .attribute,pre .coffeescript .property{color:#88F}pre .keyword,pre .id,pre .phpdoc,pre .title,pre .built_in,pre .aggregate,pre .css .tag,pre .javadoctag,pre .phpdoc,pre .yardoctag,pre .smalltalk .class,pre .winutils,pre .bash .variable,pre .apache .tag,pre .go .typename,pre .tex .command,pre .markdown .strong,pre .request,pre .status{font-weight:bold}pre .markdown .emphasis{font-style:italic}pre .nginx .built_in{font-weight:normal}pre .coffeescript .javascript,pre .javascript .xml,pre .tex .formula,pre .xml .javascript,pre .xml .vbscript,pre .xml .css,pre .xml .cdata{opacity:.5}
admin/syntax.highlight.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(D,E){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=F.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function G(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.bash=function(a){var g="true false";var e="if then else elif fi for break continue while in do done echo exit return set declare";var c={cN:"variable",b:"\\$[a-zA-Z0-9_#]+"};var b={cN:"variable",b:"\\${([^}]|\\\\})+}"};var h={cN:"string",b:'"',e:'"',i:"\\n",c:[a.BE,c,b],r:0};var d={cN:"string",b:"'",e:"'",c:[{b:"''"}],r:0};var f={cN:"test_condition",b:"",e:"",c:[h,d,c,b],k:{literal:g},r:0};return{k:{keyword:e,literal:g},c:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",r:10},c,b,a.HCM,h,d,a.inherit(f,{b:"\\[ ",e:" \\]",r:0}),a.inherit(f,{b:"\\[\\[ ",e:" \\]\\]"})]}}(hljs);hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",i:"\\n",c:[{b:"\\\\/"}]},{b:"<",e:">;",sL:"xml"}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}(hljs);hljs.LANGUAGES.css=function(a){var b={cN:"function",b:a.IR+"\\(",e:"\\)",c:[a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:"import page media charset",c:[b,a.ASM,a.QSM,a.NM]},{cN:"tag",b:a.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[b,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:"^(>>>|\\.\\.\\.) "};var c=[{cN:"string",b:"(u|b)?r?'''",e:"'''",c:[f],r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',c:[f],r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[a.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[a.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[a.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:":",i:"[${=;\\n]",c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:"(</|->|\\?)",c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:"@",e:"$"},{b:"\\b(print|exec)\\("}])}}(hljs);hljs.LANGUAGES.sql=function(a){return{cI:true,c:[{cN:"operator",b:"(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}}(hljs);hljs.LANGUAGES.ini=function(a){return{cI:true,i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM]}]}]}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},a.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10,c:["self"]}]}}(hljs);
admin/tomorrow-night-eighties.css ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tomorrow Night Eighties Theme */
2
+ /* Original theme - https://github.com/chriskempson/tomorrow-theme */
3
+ /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
4
+ .tomorrow-comment, pre .comment, pre .title {
5
+ color: #999999;
6
+ }
7
+
8
+ .tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
9
+ color: #f2777a;
10
+ }
11
+
12
+ .tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
13
+ color: #f99157;
14
+ }
15
+
16
+ .tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
17
+ color: #ffcc66;
18
+ }
19
+
20
+ .tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
21
+ color: #99cc99;
22
+ }
23
+
24
+ .tomorrow-aqua, pre .css .hexcolor {
25
+ color: #66cccc;
26
+ }
27
+
28
+ .tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
29
+ color: #6699cc;
30
+ }
31
+
32
+ .tomorrow-purple, pre .keyword, pre .javascript .function {
33
+ color: #cc99cc;
34
+ }
35
+
36
+ pre code {
37
+ display: block;
38
+ background: #2d2d2d;
39
+ color: #cccccc;
40
+ padding: 0.5em;
41
+ }
42
+
43
+ pre .coffeescript .javascript,
44
+ pre .javascript .xml,
45
+ pre .tex .formula,
46
+ pre .xml .javascript,
47
+ pre .xml .vbscript,
48
+ pre .xml .css,
49
+ pre .xml .cdata {
50
+ opacity: 0.5;
51
+ }
admin/tomorrow-night.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tomorrow Night Theme */
2
+ /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
3
+ /* Original theme - https://github.com/chriskempson/tomorrow-theme */
4
+ /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
5
+ .tomorrow-comment, pre .comment, pre .title {
6
+ color: #969896;
7
+ }
8
+
9
+ .tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
10
+ color: #cc6666;
11
+ }
12
+
13
+ .tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
14
+ color: #de935f;
15
+ }
16
+
17
+ .tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
18
+ color: #f0c674;
19
+ }
20
+
21
+ .tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
22
+ color: #b5bd68;
23
+ }
24
+
25
+ .tomorrow-aqua, pre .css .hexcolor {
26
+ color: #8abeb7;
27
+ }
28
+
29
+ .tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
30
+ color: #81a2be;
31
+ }
32
+
33
+ .tomorrow-purple, pre .keyword, pre .javascript .function {
34
+ color: #b294bb;
35
+ }
36
+
37
+ pre code {
38
+ display: block;
39
+ background: #1d1f21;
40
+ color: #c5c8c6;
41
+ padding: 0.5em;
42
+ }
43
+
44
+ pre .coffeescript .javascript,
45
+ pre .javascript .xml,
46
+ pre .tex .formula,
47
+ pre .xml .javascript,
48
+ pre .xml .vbscript,
49
+ pre .xml .css,
50
+ pre .xml .cdata {
51
+ opacity: 0.5;
52
+ }
of-admin.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Set up Admin menus & pages
5
+ */
6
+
7
+ add_action('admin_menu', 'searchandfilter_menu_pages');
8
+
9
+ function searchandfilter_menu_pages()
10
+ {
11
+ // Add the top-level admin menu
12
+ $page_title = 'Search &amp; Filter Settings';
13
+ $menu_title = 'Search &amp; Filter';
14
+ $capability = 'manage_options';
15
+ $menu_slug = 'searchandfilter-settings';
16
+ $function = 'searchandfilter_settings';
17
+ $icon_url = SEARCHANDFILTER_PLUGIN_URL.'/admin/icon.png';
18
+ add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url);
19
+
20
+ // Add submenu page with same slug as parent to ensure no duplicates
21
+ $sub_menu_title = 'Settings';
22
+ //add_submenu_page($menu_slug, $page_title, $sub_menu_title, $capability, $menu_slug, $function);
23
+
24
+ // Now add the submenu page for Help
25
+ $submenu_page_title = 'Search &amp; Filter Help';
26
+ $submenu_title = 'Help';
27
+ $submenu_slug = 'searchandfilter-help';
28
+ $submenu_function = 'searchandfilter_help';
29
+ //add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
30
+ }
31
+
32
+ function searchandfilter_settings()
33
+ {
34
+ if (!current_user_can('manage_options')) {
35
+ wp_die('You do not have sufficient permissions to access this page.');
36
+ }
37
+ echo '
38
+ <script type="text/javascript">
39
+ jQuery(function() {
40
+ jQuery(\'pre code\').each(function(i, e) {hljs.highlightBlock(e)});
41
+ });
42
+ </script>
43
+ ';
44
+ echo '<div class="wrap"><div id="icon-plugins" class="icon32"></div>';
45
+ echo '<h2>Search &amp; Filter</h2>';
46
+ echo "<h3>About</h3>";
47
+ echo '<div class="of-caption">
48
+ Search &amp; Filter is a simple search and filtering plugin for Wordpress brought to you by <a href="http://www.designsandcode.com" target="_blank">Designs &amp; Code</a>.<br /><br />
49
+ It is essentially an advancement of the Wordpress search box, adding taxonomy filters to really refine your searches!<br /><br />
50
+ You can search by Category, Tag, Custom Taxonomy or any combination of these easily - you can even remove the search box and simply use it as a filtering system for your posts and pages.
51
+ </div>';
52
+ echo "<h3>How To Use</h3>";
53
+ echo '<div class="of-caption">
54
+ To display Search &amp; Filter all you need to do is a use a shortcode:<br />
55
+
56
+ <pre><code class="string">[searchandfilter taxonomies="category,post_tag"]</code></pre>
57
+
58
+ This will display a search box, a category dropdown and a tag dropdown. You can use the shortcode within posts/pages and widget areas.<br /><br />
59
+
60
+ To use this within a theme file you simple need to call the `do_shorcode` function with the shortcode above within the theme file:<br />
61
+
62
+ <pre><code class="php">&lt;?php echo do_shortcode( \'[searchandfilter taxonomies="category,post_tag"]\' ); ?&gt;</code></pre>
63
+ </div>';
64
+
65
+
66
+ echo "<h3>Variables</h3>";
67
+
68
+ //display table
69
+ $ofVarListTable = new OF_Variable_List_Table();
70
+ $ofVarListTable->prepare_items();
71
+ $ofVarListTable->display();
72
+
73
+ echo "<h3>Your Public Taxonomies</h3>";
74
+
75
+ //Prepare Taxonomy elements
76
+ $ofTaxListTable = new OF_Taxonomy_List_Table();
77
+ $ofTaxListTable->prepare_items();
78
+ $ofTaxListTable->display();
79
+
80
+ echo "<h3>Styling</h3>";
81
+ echo '<div class="of-caption">
82
+ Search &amp; Filter uses standard inputs and selects, form elements are contained in an unordered list - styling should be easy. <a href="'.SEARCHANDFILTER_PLUGIN_URL . '/style.css'.'" target="_blank">Please see CSS file for base styles used.</a>
83
+ </div>';
84
+
85
+ echo "<h3>Search &amp; Filter Prefers Clean URLs!</h3>";
86
+ echo '<div class="of-caption">
87
+ If any fields are submitted that have blank values they do not get added to the URL, for example, if the search box is empty when submitting, you will not find a `?s=` in the URL.<br /><br />
88
+
89
+ In addition to this, if permalinks are enabled, when you submit a search, Search &amp; Filter will try to remove `category_name` from the url and instead rewrites the URL to first obey a clean category URL with the rest of the query string following.<br /><br />
90
+
91
+ This url:<br />
92
+ <pre><code class="of-url">www.yourdomain.com/?s=searchterm&amp;category_name=uncategorized&amp;tag=shoes&ampcustomtaxonomy=customvalue</code></pre><br />
93
+
94
+ Becomes:<br />
95
+ <pre><code class="of-url">www.yourdomain.com/category/uncategorized/?s=searchterm&amp;tag=shoes&amp;customtaxonomy=customvalue</code></pre><br />
96
+
97
+ The built in Wordpress rewrites wouldn\'t normally handle this.
98
+
99
+
100
+ </div>';
101
+
102
+ echo "<h3>Links</h3>";
103
+ echo '<div class="of-caption">
104
+ <ul>
105
+ <li><a href="http://www.designsandcode.com/447/wordpress-search-filter-plugin-for-taxonomies/" target="_blank">Plugin Tutorial and Support Page</a></li>
106
+ <li><a href="http://wordpress.org/plugins/search-filter" target="_blank">Plugin on WordPress.org</a> (waiting for approval)</li>
107
+ <li><a href="https://github.com/rmorse/wp-search-filter" target="_blank">Plugin on Github</a></li>
108
+ </ul>
109
+ </div>';
110
+
111
+ echo '</div>';
112
+ }
113
+
114
+ function searchandfilter_help()
115
+ {
116
+ if (!current_user_can('manage_options')) {
117
+ wp_die('You do not have sufficient permissions to access this page.');
118
+ }
119
+
120
+ // Render the HTML for the Help page or include a file that does
121
+ }
122
+
123
+ /*
124
+ * Add `settings` link on plugin page next to `activate`
125
+ */
126
+
127
+ add_filter('plugin_action_links_'.SEARCHANDFILTER_BASENAME, 'searchandfilter_plugin_action_links', 10, 2);
128
+
129
+ function searchandfilter_plugin_action_links($links, $file)
130
+ {
131
+ static $this_plugin;
132
+
133
+ if (!$this_plugin)
134
+ {
135
+ $this_plugin = SEARCHANDFILTER_BASENAME;
136
+ }
137
+ //var_dump($this_plugin);
138
+ if ($file == $this_plugin)
139
+ {
140
+ // The "page" query string value must be equal to the slug
141
+ // of the Settings admin page we defined earlier, which in
142
+ // this case equals "myplugin-settings".
143
+ $settings_link = '<a href="' . get_admin_url() . 'admin.php?page=searchandfilter-settings">Settings</a>';
144
+ array_unshift($links, $settings_link);
145
+ }
146
+
147
+ return $links;
148
+ }
149
+
150
+ ?>
of-list-table.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Table rendering
4
+ */
5
+
6
+ if(!class_exists('WP_List_Table')){
7
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
8
+ }
9
+
10
+ class OF_Taxonomy_List_Table extends WP_List_Table {
11
+
12
+ private $taxonomy_data = array();
13
+
14
+ function __construct()
15
+ {
16
+ global $status, $page;
17
+ parent::__construct(array(
18
+ 'singular'=> 'wp_list_of_taxonomy', //Singular label
19
+ 'plural' => 'wp_list_of_taxonomies', //plural label, also this well be one of the table css class
20
+ 'ajax' => false //We won't support Ajax for this table
21
+ ));
22
+
23
+ $args = array(
24
+ 'public' => true,
25
+ );
26
+ $output = 'object'; // or objects
27
+ $operator = 'and'; // 'and' or 'or'
28
+ $taxonomies = get_taxonomies( $args, $output, $operator );
29
+
30
+ //var_dump($taxonomies['post_tag']['labels']['all_items']); - all items should be used in the drop downs
31
+
32
+ $counter = 0;
33
+ if ( $taxonomies )
34
+ {
35
+ foreach ( $taxonomies as $taxonomy )
36
+ {
37
+ $ttaxonomydata = array(
38
+ "ID" => $counter,
39
+ "name" => $taxonomy->name,
40
+ "label" => $taxonomy->labels->name,
41
+ "posttypes" => implode(', ', $taxonomy->object_type)
42
+ );
43
+
44
+ $this->taxonomy_data[] = $ttaxonomydata;
45
+ }
46
+ }
47
+ }
48
+
49
+ function get_columns(){
50
+ $columns = array(
51
+ 'name' => 'Name',
52
+ 'label' => 'Label',
53
+ 'posttypes' => 'Post Types'
54
+ );
55
+ return $columns;
56
+ }
57
+
58
+ function prepare_items() {
59
+ $columns = $this->get_columns();
60
+ $hidden = array();
61
+ $sortable = array();
62
+ $this->_column_headers = array($columns, $hidden, $sortable);
63
+ $this->items = $this->taxonomy_data;
64
+ }
65
+
66
+ function column_default( $item, $column_name ) {
67
+ switch( $column_name )
68
+ {
69
+ case 'name':
70
+ case 'label':
71
+ case 'posttypes':
72
+ return $item[ $column_name ];
73
+ default:
74
+ return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
75
+ }
76
+ }
77
+
78
+
79
+ function get_sortable_columns()
80
+ {
81
+ $sortable_columns = array(
82
+ );
83
+ return $sortable_columns;
84
+ }
85
+ }
86
+
87
+
88
+
89
+ class OF_Variable_List_Table extends WP_List_Table {
90
+
91
+ private $taxonomy_data = array();
92
+
93
+ function __construct()
94
+ {
95
+ parent::__construct(array(
96
+ 'singular'=> 'wp_list_of_variable', //Singular label
97
+ 'plural' => 'wp_list_of_variables', //plural label, also this well be one of the table css class
98
+ 'ajax' => false //We won't support Ajax for this table
99
+ ));
100
+
101
+ //var_dump($taxonomies['post_tag']['labels']['all_items']); - all items should be used in the drop downs
102
+ $counter = 0;
103
+ $args = array(
104
+ 'public' => true,
105
+ );
106
+ $output = 'names'; // or objects
107
+ $taxonomies = get_taxonomies( $args, $output );
108
+ $fulltaxonomylist = implode(",",$taxonomies);
109
+
110
+ $this->taxonomy_data[] = array(
111
+ "ID" => $counter,
112
+ "name" => "taxonomies",
113
+ "defaultval" => "&nbsp;",
114
+ "options" => "<em>Comma seperated list of any taxonomy names found in the Public Taxonomies table below.</em>",
115
+ "info" => "Example using all your taxonomies (copy &amp; paste!):<pre><code class='string'>[searchandfilter taxonomies=\"".$fulltaxonomylist."\"]</code></pre>"
116
+ );
117
+ $counter++;
118
+
119
+ $this->taxonomy_data[] = array(
120
+ "ID" => $counter,
121
+ "name" => "seach",
122
+ "defaultval" => "1",
123
+ "options" => "0 - hide the search box<br />1 - display search box",
124
+ "info" => "The search box is shown by default, ommit from shortcode unless you specifically want to hide it - then set it with a value of 0."
125
+ );
126
+ $counter++;
127
+
128
+ $this->taxonomy_data[] = array(
129
+ "ID" => $counter,
130
+ "name" => "submitlabel",
131
+ "defaultval" => "Submit",
132
+ "options" => "<em>Any string</em>",
133
+ "info" => "This is the text label on the submit button."
134
+ );
135
+ $counter++;
136
+
137
+ }
138
+
139
+ function get_columns(){
140
+ $columns = array(
141
+ 'name' => 'Name',
142
+ 'defaultval' => 'Default Value',
143
+ 'options' => 'Options',
144
+ 'info' => 'Additonal Information'
145
+ );
146
+ return $columns;
147
+ }
148
+
149
+ function prepare_items() {
150
+ $columns = $this->get_columns();
151
+ $hidden = array();
152
+ $sortable = array();
153
+ $this->_column_headers = array($columns, $hidden, $sortable);
154
+ $this->items = $this->taxonomy_data;
155
+ }
156
+ function column_default( $item, $column_name )
157
+ {
158
+ switch( $column_name )
159
+ {
160
+ case 'name':
161
+ case 'defaultval':
162
+ case 'options':
163
+ case 'info':
164
+ return $item[ $column_name ];
165
+ default:
166
+ return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
167
+ }
168
+ }
169
+
170
+
171
+
172
+ }
173
+
174
+
175
+ ?>
readme.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Search & Filter ===
2
+ Contributors: DesignsAndCode
3
+ Donate link:
4
+ Tags: wordpress, category, filter, taxonomy, search
5
+ Requires at least: 3.5
6
+ Tested up to: 3.6
7
+ Stable tag: 1.0.2
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Search and Filtering for Custom Posts, Categories, Tags and Taxonomies
12
+
13
+ == Installation ==
14
+
15
+ == Frequently Asked Questions ==
16
+
17
+ == Screenshots ==
18
+
19
+ == Changelog ==
20
+
21
+ == Upgrade Notice ==
22
+
23
+ == Description ==
24
+
search-filter.php ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Search & Filter
4
+ Plugin URI: http://www.designsandcode.com/447/wordpress-search-filter-plugin-for-taxonomies/
5
+ Description: Search and Filtering system for Pages, Posts, Categories, Tags and Taxonomies
6
+ Author: Designs & Code
7
+ Author URI: http://www.designsandcode.com/
8
+ Version: 1.0.1
9
+ Text Domain: searchandfilter
10
+ License: GPLv2
11
+ */
12
+
13
+ // TO DO - i18n http://codex.wordpress.org/I18n_for_WordPress_Developers
14
+
15
+ /*
16
+ * Set up Plugin Globals
17
+ */
18
+ if (!defined('SEARCHANDFILTER_VERSION_NUM'))
19
+ define('SEARCHANDFILTER_VERSION_NUM', '1.0.2');
20
+
21
+ if (!defined('SEARCHANDFILTER_THEME_DIR'))
22
+ define('SEARCHANDFILTER_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template());
23
+
24
+ if (!defined('SEARCHANDFILTER_PLUGIN_NAME'))
25
+ define('SEARCHANDFILTER_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/'));
26
+
27
+ if (!defined('SEARCHANDFILTER_PLUGIN_DIR'))
28
+ define('SEARCHANDFILTER_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . SEARCHANDFILTER_PLUGIN_NAME);
29
+
30
+ if (!defined('SEARCHANDFILTER_PLUGIN_URL'))
31
+ define('SEARCHANDFILTER_PLUGIN_URL', WP_PLUGIN_URL . '/' . SEARCHANDFILTER_PLUGIN_NAME);
32
+
33
+ if (!defined('SEARCHANDFILTER_BASENAME'))
34
+ define('SEARCHANDFILTER_BASENAME', plugin_basename(__FILE__));
35
+
36
+ if (!defined('SEARCHANDFILTER_VERSION_KEY'))
37
+ define('SEARCHANDFILTER_VERSION_KEY', 'searchandfilter_version');
38
+
39
+
40
+
41
+ //form prefix for plugin
42
+ if (!defined('SEARCHANDFILTER_FPRE'))
43
+ define('SEARCHANDFILTER_FPRE', 'of');
44
+
45
+ add_option(SEARCHANDFILTER_VERSION_KEY, SEARCHANDFILTER_VERSION_NUM);
46
+
47
+ /*
48
+ * Set up Plugin Globals
49
+ */
50
+ if ( ! class_exists( 'SearchAndFilter' ) )
51
+ {
52
+ class SearchAndFilter
53
+ {
54
+ private $has_search_posted = false;
55
+ private $hasqmark = false;
56
+ private $urlparams = "/";
57
+ private $searchterm = "";
58
+ private $tagid = 0;
59
+ private $catid = 0;
60
+ private $defaults = array();
61
+ private $frmreserved = array();
62
+ private $taxonomylist = array();
63
+
64
+ public function __construct()
65
+ {
66
+ // Set up reserved taxonomies
67
+ $this->frmreserved = array(SEARCHANDFILTER_FPRE."category", SEARCHANDFILTER_FPRE."search", SEARCHANDFILTER_FPRE."post_tag", SEARCHANDFILTER_FPRE."submitted");
68
+
69
+ // Add shortcode support for widgets
70
+ add_shortcode('searchandfilter', array($this, 'shortcode'));
71
+ add_filter('widget_text', 'do_shortcode');
72
+
73
+ // Check the header to see if the form has been submitted
74
+ add_action( 'get_header', array( $this, 'check_posts' ) );
75
+
76
+ // Add styles
77
+ add_action( 'wp_enqueue_scripts', array($this, 'of_enqueue_styles') );
78
+ add_action( 'admin_enqueue_scripts', array($this, 'of_enqueue_admin_ss') );
79
+ }
80
+
81
+ public function of_enqueue_styles()
82
+ {
83
+ wp_enqueue_style( 'searchandfilter', SEARCHANDFILTER_PLUGIN_URL . '/style.css', false, 1.0, 'all' );
84
+ }
85
+ public function of_enqueue_admin_ss($hook)
86
+ {
87
+
88
+ if( 'toplevel_page_searchandfilter-settings' == $hook )
89
+ {
90
+ wp_enqueue_style( 'of_syntax_style', SEARCHANDFILTER_PLUGIN_URL.'/admin/github.css', false, 1.0, 'all' ); //more highlight styles http://softwaremaniacs.org/media/soft/highlight/test.html
91
+ wp_enqueue_style( 'of_style', SEARCHANDFILTER_PLUGIN_URL.'/admin/style.css', false, 1.0, 'all' );
92
+ wp_enqueue_script( 'of_syntax_script', SEARCHANDFILTER_PLUGIN_URL.'/admin/syntax.highlight.min.js' );
93
+ }
94
+ }
95
+
96
+ public function shortcode($atts, $content = null)
97
+ {
98
+ // extract the attributes into variables
99
+ extract(shortcode_atts(array(
100
+ 'search' => 1,
101
+ 'taxonomies' => null,
102
+ 'submitlabel' => "Submit"
103
+ ), $atts));
104
+ $taxonomies = explode(",",$taxonomies);
105
+ $this->taxonomylist = $taxonomies;
106
+
107
+ //set all form defaults / dropdowns etc
108
+ $this->set_defaults();
109
+
110
+ return $this->get_search_filter_form($search, $submitlabel, $taxonomies);
111
+ }
112
+
113
+ /*
114
+ * check to set defaults - to be called after the shortcodes have been init so we can grab the wanted list of taxonomies
115
+ */
116
+
117
+ public function set_defaults()
118
+ {
119
+ //var_dump( $this->taxonomylist);
120
+
121
+ if(is_category())
122
+ {
123
+ $category = get_category( get_query_var( 'cat' ) );
124
+ $this->defaults[SEARCHANDFILTER_FPRE.'category'] = $category->cat_ID;
125
+ }
126
+ else
127
+ {
128
+ $this->defaults[SEARCHANDFILTER_FPRE.'category'] = 0;
129
+ }
130
+
131
+ //grab search term for prefilling search input
132
+ if(isset($_GET['s']))
133
+ {
134
+ $this->searchterm = esc_attr($_GET['s']);
135
+ }
136
+
137
+ //check to see if tag is set
138
+ if(isset($_GET['tag']))
139
+ {//Else check the URL for the tag attribute
140
+ $tagslug = esc_attr($_GET['tag']);
141
+ $tagobj = get_term_by('slug',$tagslug,'post_tag');
142
+ $this->defaults[SEARCHANDFILTER_FPRE.'post_tag'] = 0;
143
+ if(isset($tagobj->term_id))
144
+ {
145
+ $this->defaults[SEARCHANDFILTER_FPRE.'post_tag'] = $tagobj->term_id;
146
+ }
147
+ }
148
+ else
149
+ {//else it is still possible that the URL could be website.com/tag/testtag -
150
+ if(is_tag())
151
+ {
152
+ $tag = get_term_by("slug",get_query_var( 'tag' ), "post_tag");
153
+ $this->defaults[SEARCHANDFILTER_FPRE.'post_tag'] = $tag->term_id;
154
+ }
155
+ else
156
+ {
157
+ $this->defaults[SEARCHANDFILTER_FPRE.'post_tag'] = 0;
158
+ }
159
+ }
160
+
161
+ //loop through all the gets
162
+ foreach($_GET as $key=>$val)
163
+ {
164
+ if(!in_array(SEARCHANDFILTER_FPRE.$key, $this->frmreserved))
165
+ {//make sure the get is not a reserved get as they have already been handled above
166
+
167
+ //now check it is a desired key
168
+ if(in_array($key, $this->taxonomylist))
169
+ {
170
+ $taxslug = esc_attr($val);
171
+ $taxobj = get_term_by('slug',$taxslug,$key);
172
+ $this->defaults[SEARCHANDFILTER_FPRE.$key] = 0;
173
+ if(isset($taxobj->term_id))
174
+ {
175
+ $this->defaults[SEARCHANDFILTER_FPRE.$key] = $taxobj->term_id;
176
+ }
177
+ }
178
+ }
179
+ }
180
+
181
+ //now we may be on a taxonomy page
182
+ if(is_tax())
183
+ {
184
+ $taxobj = get_queried_object();
185
+ $taxid = $taxobj->term_id;
186
+ $this->defaults[SEARCHANDFILTER_FPRE.$taxobj->taxonomy] = $taxobj->term_id;
187
+ }
188
+
189
+ }
190
+
191
+ /*
192
+ * check to see if form has been submitted and handle vars
193
+ */
194
+
195
+ public function check_posts()
196
+ {
197
+ if(isset($_POST[SEARCHANDFILTER_FPRE.'submitted']))
198
+ {
199
+ if($_POST[SEARCHANDFILTER_FPRE.'submitted']==="1")
200
+ {
201
+ //set var to confirm the form was posted
202
+ $this->has_search_posted = true;
203
+ }
204
+ }
205
+
206
+ /* CATEGORIES */
207
+ if((isset($_POST[SEARCHANDFILTER_FPRE.'category']))&&($this->has_search_posted))
208
+ {
209
+ $this->defaults[SEARCHANDFILTER_FPRE.'category'] = esc_attr($_POST[SEARCHANDFILTER_FPRE.'category']);
210
+ $catobj = get_category($this->defaults[SEARCHANDFILTER_FPRE.'category']);
211
+
212
+ if(isset($catobj->slug))
213
+ {
214
+ // deal with category firstm so we can build a url like:
215
+ // site.com/category/products/?tag=atag&s=searchterm
216
+ // rather than:
217
+ // site.com/?category_name=products&tag=atag&s=searchterm
218
+
219
+ if(get_option('permalink_structure'))
220
+ {//if has permalinks use nice formatting as above
221
+
222
+ $catrel = trim(str_replace(home_url(), "", get_category_link( $catobj->term_id )), "/")."/"; //get full category link, remvoe the home url to get relative, trim traling slashed, the append slash at the end
223
+ $this->urlparams .= $catrel;// old - not reliable - "category/".$catobj->slug."/";
224
+
225
+ }
226
+ else
227
+ {//otherwise stick everything in to the query string and let wp deal with it
228
+
229
+ if(!$this->hasqmark)
230
+ {
231
+ $this->urlparams .= "?";
232
+ $this->hasqmark = true;
233
+ }
234
+ else
235
+ {
236
+ $this->urlparams .= "&";
237
+ }
238
+
239
+ $this->urlparams .= "category_name=".$catobj->slug;
240
+ }
241
+ }
242
+ }
243
+
244
+ /* SEARCH BOX */
245
+ if((isset($_POST[SEARCHANDFILTER_FPRE.'search']))&&($this->has_search_posted))
246
+ {
247
+ $this->searchterm = urlencode($_POST[SEARCHANDFILTER_FPRE.'search']);
248
+
249
+ if($this->searchterm!="")
250
+ {
251
+ if(!$this->hasqmark)
252
+ {
253
+ $this->urlparams .= "?";
254
+ $this->hasqmark = true;
255
+ }
256
+ else
257
+ {
258
+ $this->urlparams .= "&";
259
+ }
260
+ $this->urlparams .= "s=".$this->searchterm;
261
+ }
262
+ }
263
+
264
+ /* TAGS */
265
+ if((isset($_POST[SEARCHANDFILTER_FPRE.'post_tag']))&&($this->has_search_posted))
266
+ {//If the search form has been submitted with a new tag filter
267
+ $this->defaults[SEARCHANDFILTER_FPRE.'post_tag'] = esc_attr($_POST[SEARCHANDFILTER_FPRE.'post_tag']);
268
+ $tagobj = get_tag($this->defaults[SEARCHANDFILTER_FPRE.'post_tag']);
269
+ if(isset($tagobj->slug))
270
+ {
271
+ if(!$this->hasqmark)
272
+ {
273
+ $this->urlparams .= "?";
274
+ $this->hasqmark = true;
275
+ }
276
+ else
277
+ {
278
+ $this->urlparams .= "&";
279
+ }
280
+ $this->urlparams .= "tag=".$tagobj->slug;
281
+ }
282
+ }
283
+
284
+
285
+ //now we have dealt with the all the special case variables - search, tags, categories
286
+
287
+ /* TAXONOMIES */
288
+ //loop through the posts - double check that it is the search form that has been posted, otherwise we could be looping through the posts submitted from an entirely unrelated form
289
+ foreach($_POST as $key=>$val)
290
+ {
291
+ if(!in_array($key, $this->frmreserved))
292
+ {//if the key is not in the reserved array (ie, on a custom taxonomy - not tags, categories, search term)
293
+ //echo ($key).": ".$val."<br />";
294
+
295
+ // strip off all prefixes for custom taxonomies - we just want to do a redirect - no processing
296
+ if (strpos($key, SEARCHANDFILTER_FPRE) === 0)
297
+ {
298
+ $key = substr($key, strlen(SEARCHANDFILTER_FPRE));
299
+ }
300
+
301
+ $temptax = esc_attr($val);
302
+ $taxobj = get_term_by('id',$temptax,$key);
303
+
304
+ if(isset($taxobj->slug))
305
+ {
306
+ if(!$this->hasqmark)
307
+ {
308
+ $this->urlparams .= "?";
309
+ $this->hasqmark = true;
310
+ }
311
+ else
312
+ {
313
+ $this->urlparams .= "&";
314
+ }
315
+
316
+ $this->urlparams .= $key."=".$taxobj->slug;
317
+ }
318
+
319
+
320
+ //$this->defaults[$key] = $val;
321
+ //echo $key.": ".$val;
322
+
323
+ }
324
+ }
325
+
326
+ if($this->has_search_posted)
327
+ {//if the search has been posted, redirect to the newly formed url with all the right params
328
+
329
+ wp_redirect( site_url().$this->urlparams );
330
+ }
331
+
332
+ }
333
+
334
+ public function get_search_filter_form($search, $submitlabel, $taxonomies)
335
+ {
336
+ //ob_start();
337
+ $returnvar = '';
338
+
339
+ $returnvar .= '
340
+ <form action="" method="post" class="searchandfilter">
341
+ <p>
342
+ <ul>';
343
+
344
+ if($search==1)
345
+ {
346
+ $returnvar .= '<li><input type="text" name="ofsearch" placeholder="Search &hellip;" value="'.$this->searchterm.'"></li>';
347
+ }
348
+
349
+ foreach($taxonomies as $taxonomy)
350
+ {
351
+
352
+ $taxonomydata = get_taxonomy($taxonomy);
353
+ //var_dump($taxonomydata);
354
+ if($taxonomydata)
355
+ {
356
+ $returnvar .= "<li>";
357
+ $taxonomychildren = get_categories('name=of'.$taxonomy.'&taxonomy='.$taxonomy);
358
+ $returnvar .= $this->generate_dropdown($taxonomychildren, $taxonomy, $this->tagid, $taxonomydata->labels);
359
+ $returnvar .= "</li>";
360
+ }
361
+
362
+ }
363
+
364
+ $returnvar .= "</ul>";
365
+
366
+ $returnvar .=
367
+ '<p>
368
+ <input type="hidden" name="'.SEARCHANDFILTER_FPRE.'submitted" value="1">
369
+ <input type="submit" value="'.$submitlabel.'">
370
+ </p>
371
+ </p>
372
+ </form>';
373
+
374
+ return $returnvar;
375
+ }
376
+ public function generate_dropdown($dropdata, $name, $currentid = 0, $labels = null)
377
+ {
378
+ $returnvar = "";
379
+
380
+ $returnvar .= '<select class="postform" name="'.SEARCHANDFILTER_FPRE.$name.'">';
381
+ if(isset($labels))
382
+ {
383
+ if($labels->all_items!="")
384
+ {
385
+ $returnvar .= '<option class="level-0" value="0">'.$labels->all_items.'</option>';
386
+ }
387
+ else
388
+ {
389
+ $returnvar .= '<option class="level-0" value="0">All '.$labels->name.'</option>';
390
+ }
391
+ }
392
+
393
+ foreach($dropdata as $dropdown)
394
+ {
395
+ $selected = "";
396
+ if(isset($this->defaults[SEARCHANDFILTER_FPRE.$name]))
397
+ {
398
+ if($this->defaults[SEARCHANDFILTER_FPRE.$name]==$dropdown->term_id)
399
+ {
400
+ $selected = ' selected="selected"';
401
+ }
402
+ }
403
+ $returnvar .= '<option class="level-0" value="'.$dropdown->term_id.'"'.$selected.'>'.$dropdown->cat_name.'</option>';
404
+
405
+ }
406
+ $returnvar .= "</select>";
407
+
408
+ return $returnvar;
409
+ }
410
+ }
411
+ }
412
+
413
+ if ( class_exists( 'SearchAndFilter' ) )
414
+ {
415
+ global $SearchAndFilter;
416
+ $SearchAndFilter = new SearchAndFilter();
417
+ }
418
+
419
+ /*
420
+ * Includes
421
+ */
422
+
423
+ // classes
424
+ require_once(SEARCHANDFILTER_PLUGIN_DIR."/of-list-table.php");
425
+
426
+ // admin screens & plugin mods
427
+ require_once(SEARCHANDFILTER_PLUGIN_DIR."/of-admin.php");
428
+
429
+
430
+ ?>
style.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Search & Filter Styles */
2
+
3
+ .searchandfilter p
4
+ {
5
+ margin-top: 1em;
6
+ display:inline-block;
7
+ }
8
+
9
+ .searchandfilter ul
10
+ {
11
+ display:inline-block;
12
+ }
13
+
14
+ .searchandfilter li
15
+ {
16
+ list-style: none;
17
+ display:inline-block;
18
+ padding-right:10px;
19
+ }
20
+
21
+ /* If in a widget area make a single column by adding display block */
22
+ .widget-area .searchandfilter li, .widget-area .searchandfilter p
23
+ {
24
+ display:block;
25
+ }