Cookie Law / GDPR Info - Version 1.0.1

Version Description

Download this release

Release Info

Developer richardashby
Plugin Icon Cookie Law / GDPR Info
Version 1.0.1
Comparing to
See all releases

Version 1.0.1

Files changed (45) hide show
  1. admin/bgrins-spectrum/LICENSE +20 -0
  2. admin/bgrins-spectrum/README.md +27 -0
  3. admin/bgrins-spectrum/drop-arrow.png +0 -0
  4. admin/bgrins-spectrum/my-colours.js +12 -0
  5. admin/bgrins-spectrum/spectrum.css +406 -0
  6. admin/bgrins-spectrum/spectrum.js +1563 -0
  7. admin/cli-admin-page.php +578 -0
  8. admin/cli-admin.php +441 -0
  9. cookie-law-info.php +105 -0
  10. css/cli-admin-style.css +102 -0
  11. css/cli-style.css +98 -0
  12. css/cli-tables.css +199 -0
  13. css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  14. css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  15. css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  16. css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  17. css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  18. css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  19. css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  20. css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  21. css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  22. css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  23. css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  24. css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  25. css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  26. css/smoothness/jquery-ui-1.8.20.custom.css +305 -0
  27. images/collapse.png +0 -0
  28. images/cross.png +0 -0
  29. images/expand.png +0 -0
  30. images/overlay.png +0 -0
  31. images/td_back.gif +0 -0
  32. images/tick.png +0 -0
  33. js/admin-ui-controller.js +98 -0
  34. js/cli-script.js +88 -0
  35. js/cookielawinfo.js +140 -0
  36. js/jquery-ui-1.8.20.custom.min.js +13 -0
  37. js/jquery.cookie.js +47 -0
  38. php/custom-post-types.php +129 -0
  39. php/functions.php +273 -0
  40. php/shortcodes.php +237 -0
  41. readme.txt +189 -0
  42. screenshot-1.png +0 -0
  43. screenshot-2.png +0 -0
  44. screenshot-3.png +0 -0
  45. screenshot-4.png +0 -0
admin/bgrins-spectrum/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2011, Brian Grinstead, http://briangrinstead.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
admin/bgrins-spectrum/README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Spectrum
2
+ ## The No Hassle Colorpicker
3
+
4
+ I wanted a colorpicker that didn't require images, and that had an API that made sense to me as a developer who has worked with color in a number of applications. I had used existing plugins (which I was quite grateful for), but decided that I would make a smaller, simpler one.
5
+
6
+ I started using canvas, then switched to CSS gradients, since it turned out to be easier to manage, and worked better across browsers.
7
+
8
+ See demo and docs: http://bgrins.github.com/spectrum/
9
+
10
+ Thanks to the following places:
11
+
12
+ * http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio: Aspect ratio using CSS only
13
+ * https://github.com/DavidDurman/FlexiColorPicker for saturation/value gradient constants
14
+ * http://upload.wikimedia.org/wikipedia/commons/a/ad/HueScale.svg: For hue gradient contants
15
+
16
+ The tool I use for measuring JavaScript size: http://closure-compiler.appspot.com/home
17
+
18
+ // ==ClosureCompiler==
19
+ // @compilation_level SIMPLE_OPTIMIZATIONS
20
+ // @output_file_name default.js
21
+ // @code_url https://raw.github.com/bgrins/spectrum/master/spectrum.js
22
+ // ==/ClosureCompiler==
23
+
24
+ Here is the JavaScript size
25
+
26
+ Original Size: 35.93KB (11.25KB gzipped)
27
+ Compiled Size: 17.56KB (6.79KB gzipped)
admin/bgrins-spectrum/drop-arrow.png ADDED
Binary file
admin/bgrins-spectrum/my-colours.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function() {
2
+ var colour_selectors = "#cli-colour-btn-accept, #cli-colour-btn-decline, #cli-colour-btn-readmore, #cli-colour-link-accept, #cli-colour-link-decline, #cli-colour-link-readmore, #cli-colour-text, #cli-colour-background, #cli-colour-border, #cli-colour-link-button-1, #cli-colour-btn-button-1";
3
+ jQuery(colour_selectors).spectrum({
4
+ showPalette: false,
5
+ palette: [
6
+ ['#f00', '#ff0', '#0f0'],
7
+ ['#00f', '#333', '#fff']
8
+ ],
9
+ showInitial: true,
10
+ preferredFormat: "hex"
11
+ });
12
+ });
admin/bgrins-spectrum/spectrum.css ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***
2
+ Spectrum: The No Hassle Colorpicker
3
+ https://github.com/bgrins/spectrum
4
+
5
+ Author: Brian Grinstead
6
+ License: MIT
7
+ ***/
8
+
9
+ .sp-container {
10
+ position:absolute;
11
+ top:0;
12
+ left:0;
13
+ display:inline-block;
14
+ *display: inline;
15
+ *zoom: 1;
16
+ z-index: 2147483647;
17
+ overflow: hidden;
18
+ }
19
+ .sp-container.sp-flat {
20
+ position: relative;
21
+ }
22
+
23
+ /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
24
+ .sp-top {
25
+ position:relative;
26
+ width: 100%;
27
+ display:inline-block;
28
+ }
29
+ .sp-top-inner {
30
+ position:absolute;
31
+ top:0;
32
+ left:0;
33
+ bottom:0;
34
+ right:0;
35
+ }
36
+ .sp-color {
37
+ position: absolute;
38
+ top:0;
39
+ left:0;
40
+ bottom:0;
41
+ right:20%;
42
+ }
43
+ .sp-hue {
44
+ position: absolute;
45
+ top:0;
46
+ right:0;
47
+ bottom:0;
48
+ left:84%;
49
+ height: 100%;
50
+ }
51
+ .sp-fill {
52
+ padding-top: 80%;
53
+ }
54
+ .sp-sat, .sp-val {
55
+ position: absolute;
56
+ top:0;
57
+ left:0;
58
+ right:0;
59
+ bottom:0;
60
+ }
61
+
62
+ /* Don't allow text selection */
63
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider , .sp-container.sp-dragging .sp-input, .sp-container button {
64
+ -webkit-user-select:none;
65
+ -moz-user-select: none;
66
+ -o-user-select:none;
67
+ user-select: none;
68
+ }
69
+
70
+ .sp-container.sp-input-disabled .sp-input-container {
71
+ display: none;
72
+ }
73
+ .sp-container.sp-buttons-disabled .sp-button-container {
74
+ display: none;
75
+ }
76
+ .sp-palette-only .sp-picker-container {
77
+ display: none;
78
+ }
79
+ .sp-palette-disabled .sp-palette-container {
80
+ display: none;
81
+ }
82
+
83
+ .sp-initial-disabled .sp-initial {
84
+ display: none;
85
+ }
86
+
87
+
88
+ /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
89
+ .sp-sat {
90
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
91
+ background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
92
+ background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
93
+ background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
94
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
95
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
96
+ }
97
+ .sp-val {
98
+ background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
99
+ background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
100
+ background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
101
+ background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
102
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
103
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
104
+ }
105
+
106
+ .sp-hue {
107
+ background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
108
+ background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
109
+ background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
110
+ background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
111
+ background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
112
+ }
113
+
114
+ /* IE filters do not support multiple color stops.
115
+ Generate 6 divs, line them up, and do two color gradients for each.
116
+ Yes, really.
117
+ */
118
+
119
+ .sp-1 {
120
+ height:17%;
121
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
122
+ }
123
+ .sp-2 {
124
+ height:16%;
125
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
126
+ }
127
+ .sp-3 {
128
+ height:17%;
129
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
130
+ }
131
+ .sp-4 {
132
+ height:17%;
133
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
134
+ }
135
+ .sp-5 {
136
+ height:16%;
137
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
138
+ }
139
+ .sp-6 {
140
+ height:17%;
141
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
142
+ }
143
+
144
+ /* Clearfix hack */
145
+ .sp-cf:before, .sp-cf:after { content: ""; display: table; }
146
+ .sp-cf:after { clear: both; }
147
+ .sp-cf { *zoom: 1; }
148
+
149
+ /* Mobile devices, make hue slider bigger so it is easier to slide */
150
+ @media (max-device-width: 480px) {
151
+ .sp-color { right: 40%; }
152
+ .sp-hue { left: 63%; }
153
+ .sp-fill { padding-top: 60%; }
154
+ }
155
+
156
+ .sp-dragger {
157
+ border-radius: 5px;
158
+ height: 5px;
159
+ width: 5px;
160
+ border: 1px solid #fff;
161
+ background: #000;
162
+ cursor: pointer;
163
+ position:absolute;
164
+ top:0;
165
+ left: 0;
166
+ }
167
+ .sp-slider {
168
+ position: absolute;
169
+ top:0;
170
+ cursor:pointer;
171
+ height: 3px;
172
+ left: -1px;
173
+ right: -1px;
174
+ border: 1px solid #000;
175
+ background: white;
176
+ opacity: .8;
177
+ }
178
+
179
+ /* Basic display options (colors, fonts, global widths) */
180
+ .sp-container {
181
+ border-radius: 0;
182
+ background-color: #ECECEC;
183
+ border: solid 1px #f0c49B;
184
+ padding: 0;
185
+ }
186
+ .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue
187
+ {
188
+ font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
189
+ -webkit-box-sizing: border-box;
190
+ -moz-box-sizing: border-box;
191
+ -ms-box-sizing: border-box;
192
+ box-sizing: border-box;
193
+ }
194
+ .sp-top
195
+ {
196
+ margin-bottom: 3px;
197
+ }
198
+ .sp-color, .sp-hue
199
+ {
200
+ border: solid 1px #666;
201
+ }
202
+
203
+ /* Input */
204
+ .sp-input-container {
205
+ float:right;
206
+ width: 100px;
207
+ margin-bottom: 4px;
208
+ }
209
+ .sp-initial-disabled .sp-input-container {
210
+ width: 100%;
211
+ }
212
+ .sp-input {
213
+ font-size: 12px !important;
214
+ border: 1px inset;
215
+ padding: 4px 5px;
216
+ margin: 0;
217
+ width: 100%;
218
+ background:transparent;
219
+ border-radius: 3px;
220
+ color: #222;
221
+ }
222
+ .sp-input:focus {
223
+ border: 1px solid orange;
224
+ }
225
+ .sp-input.sp-validation-error
226
+ {
227
+ border: 1px solid red;
228
+ background: #fdd;
229
+ }
230
+ .sp-picker-container , .sp-palette-container
231
+ {
232
+ float:left;
233
+ position: relative;
234
+ padding: 10px;
235
+ padding-bottom: 300px;
236
+ margin-bottom: -290px;
237
+ }
238
+ .sp-picker-container
239
+ {
240
+ width: 172px;
241
+ border-left: solid 1px #fff;
242
+ }
243
+
244
+ /* Palettes */
245
+ .sp-palette-container
246
+ {
247
+ border-right: solid 1px #ccc;
248
+ }
249
+
250
+ .sp-palette span {
251
+ display: block;
252
+ position:relative;
253
+ float:left;
254
+ width: 24px;
255
+ height: 15px;
256
+ margin: 3px;
257
+ cursor: pointer;
258
+ border:solid 2px transparent;
259
+ }
260
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active {
261
+ border-color: orange;
262
+ }
263
+
264
+ /* Initial */
265
+ .sp-initial
266
+ {
267
+ float: left;
268
+ border: solid 1px #333;
269
+ }
270
+ .sp-initial span {
271
+ width: 30px;
272
+ height: 25px;
273
+ border:none;
274
+ display:block;
275
+ float:left;
276
+ margin:0;
277
+ }
278
+
279
+ /* Buttons */
280
+ .sp-button-container {
281
+ float: right;
282
+ }
283
+
284
+ /* Replacer (the little preview div that shows up instead of the <input>) */
285
+ .sp-replacer {
286
+ margin:0;
287
+ overflow:hidden;
288
+ cursor:pointer;
289
+ padding: 4px;
290
+ display:inline-block;
291
+ *zoom: 1;
292
+ *display: inline;
293
+ border: solid 1px #91765d;
294
+ background: #eee;
295
+ color: #333;
296
+ vertical-align: middle;
297
+ }
298
+ .sp-replacer:hover, .sp-replacer.sp-active {
299
+ border-color: #F0C49B;
300
+ color: #111;
301
+ }
302
+ .sp-dd {
303
+ padding: 2px 0;
304
+ height: 16px;
305
+ line-height: 16px;
306
+ float:left;
307
+ font-size:10px;
308
+ }
309
+ .sp-preview {
310
+ width:25px;
311
+ height: 20px;
312
+ border: solid 1px #222;
313
+ margin-right: 5px;
314
+ float:left;
315
+ }
316
+
317
+ .sp-palette
318
+ {
319
+ *width: 220px;
320
+ max-width: 220px;
321
+ }
322
+ .sp-palette span
323
+ {
324
+ width:16px;
325
+ height: 16px;
326
+ margin:2px 1px;
327
+ border: solid 1px #d0d0d0;
328
+ }
329
+
330
+ .sp-container
331
+ {
332
+ padding-bottom:0;
333
+ }
334
+
335
+
336
+ /* Buttons: http://hellohappy.org/css3-buttons/ */
337
+ .sp-container button {
338
+ background-color: #eeeeee;
339
+ background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
340
+ background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
341
+ background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
342
+ background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
343
+ background-image: linear-gradient(top, #eeeeee, #cccccc);
344
+ border: 1px solid #ccc;
345
+ border-bottom: 1px solid #bbb;
346
+ border-radius: 3px;
347
+ color: #333;
348
+ font-size: 14px;
349
+ line-height: 1;
350
+ padding: 5px 4px;
351
+ text-align: center;
352
+ text-shadow: 0 1px 0 #eee;
353
+ vertical-align: middle;
354
+ }
355
+ .sp-container button:hover {
356
+ background-color: #dddddd;
357
+ background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
358
+ background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
359
+ background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
360
+ background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
361
+ background-image: linear-gradient(top, #dddddd, #bbbbbb);
362
+ border: 1px solid #bbb;
363
+ border-bottom: 1px solid #999;
364
+ cursor: pointer;
365
+ text-shadow: 0 1px 0 #ddd;
366
+ }
367
+ .sp-container button:active {
368
+ border: 1px solid #aaa;
369
+ border-bottom: 1px solid #888;
370
+ -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
371
+ -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
372
+ -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
373
+ -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
374
+ box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
375
+ }
376
+ .sp-cancel
377
+ {
378
+ font-size: 11px;
379
+ color: #d93f3f !important;
380
+ margin:0;
381
+ padding:2px;
382
+ margin-right: 5px;
383
+ vertical-align: middle;
384
+ text-decoration:none;
385
+
386
+ }
387
+ .sp-cancel:hover
388
+ {
389
+ color: #d93f3f !important;
390
+ text-decoration: underline;
391
+ }
392
+
393
+
394
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active
395
+ {
396
+ border-color: #000;
397
+ }
398
+ .sp-palette span.sp-thumb-light.sp-thumb-active
399
+ {
400
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
401
+ }
402
+
403
+ .sp-palette span.sp-thumb-dark.sp-thumb-active
404
+ {
405
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
406
+ }
admin/bgrins-spectrum/spectrum.js ADDED
@@ -0,0 +1,1563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Spectrum: The No Hassle Colorpicker
2
+ // https://github.com/bgrins/spectrum
3
+ // Author: Brian Grinstead
4
+ // License: MIT
5
+ // Requires: jQuery, spectrum.css
6
+
7
+ (function (window, $, undefined) {
8
+ var defaultOpts = {
9
+
10
+ // Events
11
+ beforeShow: noop,
12
+ move: noop,
13
+ change: noop,
14
+ show: noop,
15
+ hide: noop,
16
+
17
+ // Options
18
+ color: false,
19
+ flat: false,
20
+ showInput: false,
21
+ showButtons: true,
22
+ showInitial: false,
23
+ showPalette: false,
24
+ showPaletteOnly: false,
25
+ showSelectionPalette: true,
26
+ localStorageKey: false,
27
+ maxSelectionSize: 7,
28
+ cancelText: "cancel",
29
+ chooseText: "choose",
30
+ preferredFormat: false,
31
+ className: "",
32
+ theme: "sp-light",
33
+ palette: ['fff', '000'],
34
+ selectionPalette: []
35
+ },
36
+ spectrums = [],
37
+ IE = $.browser.msie,
38
+ replaceInput = [
39
+ "<div class='sp-replacer'>",
40
+ "<div class='sp-preview'></div>",
41
+ "<div class='sp-dd'>&#9660;</div>",
42
+ "</div>"
43
+ ].join(''),
44
+ markup = (function () {
45
+
46
+ // IE does not support gradients with multiple stops, so we need to simulate
47
+ // that for the rainbow slider with 8 divs that each have a single gradient
48
+ var gradientFix = "";
49
+ if (IE) {
50
+ for (var i = 1; i <= 6; i++) {
51
+ gradientFix += "<div class='sp-" + i + "'></div>";
52
+ }
53
+ }
54
+
55
+ return [
56
+ "<div class='sp-container'>",
57
+ "<div class='sp-palette-container'>",
58
+ "<div class='sp-palette sp-thumb sp-cf'></div>",
59
+ "</div>",
60
+ "<div class='sp-picker-container'>",
61
+ "<div class='sp-top sp-cf'>",
62
+ "<div class='sp-fill'></div>",
63
+ "<div class='sp-top-inner'>",
64
+ "<div class='sp-color'>",
65
+ "<div class='sp-sat'>",
66
+ "<div class='sp-val'>",
67
+ "<div class='sp-dragger'></div>",
68
+ "</div>",
69
+ "</div>",
70
+ "</div>",
71
+ "<div class='sp-hue'>",
72
+ "<div class='sp-slider'></div>",
73
+ gradientFix,
74
+ "</div>",
75
+ "</div>",
76
+ "</div>",
77
+ "<div class='sp-input-container sp-cf'>",
78
+ "<input class='sp-input' type='text' spellcheck='false' />",
79
+ "</div>",
80
+ "<div class='sp-initial sp-thumb sp-cf'></div>",
81
+ "<div class='sp-button-container sp-cf'>",
82
+ "<a class='sp-cancel' href='#'></a>",
83
+ "<button class='sp-choose'></button>",
84
+ "</div>",
85
+ "</div>",
86
+ "</div>"
87
+ ].join("");
88
+ })(),
89
+ paletteTemplate = function (p, color, className) {
90
+ var html = [];
91
+ for (var i = 0; i < p.length; i++) {
92
+ var tiny = tinycolor(p[i]);
93
+ var c = tiny.toHsl().l < .5 ? "sp-thumb-dark" : "sp-thumb-light";
94
+ c += (tinycolor.equals(color, p[i])) ? " sp-thumb-active" : "";
95
+ html.push('<span title="' + tiny.toHexString() + '" data-color="' + tiny.toHexString() + '" style="background-color:' + tiny.toRgbString() + ';" class="' + c + '"></span>');
96
+ }
97
+ return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
98
+ };
99
+
100
+ function hideAll() {
101
+ for (var i = 0; i < spectrums.length; i++) {
102
+ if (spectrums[i]) {
103
+ spectrums[i].hide();
104
+ }
105
+ }
106
+ }
107
+ function instanceOptions(o, callbackContext) {
108
+ var opts = $.extend({}, defaultOpts, o);
109
+ opts.callbacks = {
110
+ 'move': bind(opts.move, callbackContext),
111
+ 'change': bind(opts.change, callbackContext),
112
+ 'show': bind(opts.show, callbackContext),
113
+ 'hide': bind(opts.hide, callbackContext),
114
+ 'beforeShow': bind(opts.beforeShow, callbackContext)
115
+ };
116
+
117
+ return opts;
118
+ }
119
+
120
+ function spectrum(element, o) {
121
+
122
+ var opts = instanceOptions(o, element),
123
+ flat = opts.flat,
124
+ showPaletteOnly = opts.showPaletteOnly,
125
+ showPalette = opts.showPalette || showPaletteOnly,
126
+ showInitial = opts.showInitial && !flat,
127
+ showInput = opts.showInput,
128
+ showSelectionPalette = opts.showSelectionPalette,
129
+ localStorageKey = opts.localStorageKey,
130
+ theme = opts.theme,
131
+ callbacks = opts.callbacks,
132
+ resize = throttle(reflow, 10),
133
+ visible = false,
134
+ dragWidth = 0,
135
+ dragHeight = 0,
136
+ dragHelperHeight = 0,
137
+ slideHeight = 0,
138
+ slideWidth = 0,
139
+ slideHelperHeight = 0,
140
+ currentHue = 0,
141
+ currentSaturation = 0,
142
+ currentValue = 0,
143
+ palette = opts.palette.slice(0),
144
+ paletteArray = $.isArray(palette[0]) ? palette : [palette],
145
+ selectionPalette = opts.selectionPalette.slice(0),
146
+ draggingClass = "sp-dragging";
147
+
148
+ var doc = element.ownerDocument,
149
+ body = doc.body,
150
+ boundElement = $(element),
151
+ container = $(markup, doc).addClass(theme),
152
+ dragger = container.find(".sp-color"),
153
+ dragHelper = container.find(".sp-dragger"),
154
+ slider = container.find(".sp-hue"),
155
+ slideHelper = container.find(".sp-slider"),
156
+ textInput = container.find(".sp-input"),
157
+ paletteContainer = container.find(".sp-palette"),
158
+ initialColorContainer = container.find(".sp-initial"),
159
+ cancelButton = container.find(".sp-cancel"),
160
+ chooseButton = container.find(".sp-choose"),
161
+ isInput = boundElement.is("input"),
162
+ shouldReplace = isInput && !flat,
163
+ replacer = (shouldReplace) ? $(replaceInput).addClass(theme) : $([]),
164
+ offsetElement = (shouldReplace) ? replacer : boundElement,
165
+ previewElement = replacer.find(".sp-preview"),
166
+ initialColor = opts.color || (isInput && boundElement.val()),
167
+ colorOnShow = false,
168
+ preferredFormat = opts.preferredFormat,
169
+ currentPreferredFormat = preferredFormat,
170
+ clickoutFiresChange = !opts.showButtons;
171
+
172
+ chooseButton.text(opts.chooseText);
173
+ cancelButton.text(opts.cancelText);
174
+
175
+ function initialize() {
176
+
177
+ if (IE) {
178
+ container.find("*:not(input)").attr("unselectable", "on");
179
+ }
180
+
181
+ container.toggleClass("sp-flat", flat);
182
+ container.toggleClass("sp-input-disabled", !showInput);
183
+ container.toggleClass("sp-buttons-disabled", !opts.showButtons || flat);
184
+ container.toggleClass("sp-palette-disabled", !showPalette);
185
+ container.toggleClass("sp-palette-only", showPaletteOnly);
186
+ container.toggleClass("sp-initial-disabled", !showInitial);
187
+ container.addClass(opts.className);
188
+
189
+ if (shouldReplace) {
190
+ boundElement.hide().after(replacer);
191
+ }
192
+
193
+ if (flat) {
194
+ boundElement.after(container).hide();
195
+ }
196
+ else {
197
+ $(body).append(container.hide());
198
+ }
199
+ if (localStorageKey && window.localStorage) {
200
+ try {
201
+ selectionPalette = window.localStorage[localStorageKey].split(",");
202
+ }
203
+ catch (e) {
204
+
205
+ }
206
+ }
207
+
208
+ offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
209
+ toggle();
210
+
211
+ e.stopPropagation();
212
+
213
+ if (!$(e.target).is("input")) {
214
+ e.preventDefault();
215
+ }
216
+ });
217
+
218
+ // Prevent clicks from bubbling up to document. This would cause it to be hidden.
219
+ container.click(stopPropagation);
220
+
221
+ // Handle user typed input
222
+ textInput.change(setFromTextInput);
223
+ textInput.bind("paste", function () {
224
+ setTimeout(setFromTextInput, 1);
225
+ });
226
+ textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
227
+
228
+ cancelButton.bind("click.spectrum", function (e) {
229
+ e.stopPropagation();
230
+ e.preventDefault();
231
+ hide();
232
+ });
233
+
234
+ chooseButton.bind("click.spectrum", function (e) {
235
+ e.stopPropagation();
236
+ e.preventDefault();
237
+
238
+ if (isValid()) {
239
+ updateOriginalInput(true);
240
+ hide();
241
+ }
242
+ });
243
+
244
+ draggable(slider, function (dragX, dragY) {
245
+ currentHue = (dragY / slideHeight);
246
+ move();
247
+ }, dragStart, dragStop);
248
+
249
+ draggable(dragger, function (dragX, dragY) {
250
+ currentSaturation = dragX / dragWidth;
251
+ currentValue = (dragHeight - dragY) / dragHeight;
252
+ move();
253
+ }, dragStart, dragStop);
254
+
255
+ if (!!initialColor) {
256
+ set(initialColor);
257
+ addColorToSelectionPalette(initialColor);
258
+ }
259
+ else {
260
+ updateUI();
261
+ }
262
+
263
+ if (flat) {
264
+ show();
265
+ }
266
+
267
+ function palletElementClick(e) {
268
+ if (e.data && e.data.ignore) {
269
+ set($(this).data("color"));
270
+ move();
271
+ }
272
+ else {
273
+ set($(this).data("color"));
274
+ updateOriginalInput(true);
275
+ move();
276
+ hide();
277
+ }
278
+
279
+ return false;
280
+ }
281
+
282
+ var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
283
+ paletteContainer.delegate("span", paletteEvent, palletElementClick);
284
+ initialColorContainer.delegate("span::nth-child(1)", paletteEvent, { ignore: true }, palletElementClick);
285
+ }
286
+ function addColorToSelectionPalette(color) {
287
+ if (showSelectionPalette) {
288
+ selectionPalette.push(tinycolor(color).toHexString());
289
+ if (localStorageKey && window.localStorage) {
290
+ window.localStorage[localStorageKey] = selectionPalette.join(",");
291
+ }
292
+ }
293
+ }
294
+
295
+ function getUniqueSelectionPalette() {
296
+ var unique = [];
297
+ var p = selectionPalette;
298
+ var paletteLookup = {};
299
+
300
+ if (showPalette) {
301
+
302
+ for (var i = 0; i < paletteArray.length; i++) {
303
+ for (var j = 0; j < paletteArray[i].length; j++) {
304
+ var hex = tinycolor(paletteArray[i][j]).toHexString();
305
+ paletteLookup[hex] = true;
306
+ }
307
+ }
308
+
309
+ for (var i = 0; i < p.length; i++) {
310
+ var color = tinycolor(p[i]);
311
+ var hex = color.toHexString();
312
+
313
+ if (!paletteLookup.hasOwnProperty(hex)) {
314
+ unique.push(p[i]);
315
+ paletteLookup[hex] = true;
316
+ }
317
+ }
318
+ }
319
+
320
+ return unique.reverse().slice(0, opts.maxSelectionSize);
321
+ }
322
+ function drawPalette() {
323
+
324
+ var currentColor = get();
325
+
326
+ var html = $.map(paletteArray, function (palette, i) {
327
+ return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i);
328
+ });
329
+
330
+ if (selectionPalette) {
331
+ html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection"));
332
+ }
333
+
334
+ paletteContainer.html(html.join(""));
335
+ }
336
+ function drawInitial() {
337
+ if (showInitial) {
338
+ var initial = colorOnShow;
339
+ var current = get();
340
+ initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial"));
341
+ }
342
+ }
343
+ function dragStart() {
344
+ if (dragHeight === 0 || dragWidth === 0 || slideHeight === 0) {
345
+ reflow();
346
+ }
347
+ container.addClass(draggingClass);
348
+ }
349
+ function dragStop() {
350
+ container.removeClass(draggingClass);
351
+ }
352
+ function setFromTextInput() {
353
+ var tiny = tinycolor(textInput.val());
354
+ if (tiny.ok) {
355
+ set(tiny);
356
+ }
357
+ else {
358
+ textInput.addClass("sp-validation-error");
359
+ }
360
+ }
361
+
362
+ function toggle() {
363
+ (visible) ? hide() : show();
364
+ }
365
+
366
+ function show() {
367
+ if (visible) {
368
+ reflow();
369
+ return;
370
+ }
371
+ if (callbacks.beforeShow(get()) === false) return;
372
+
373
+ hideAll();
374
+ visible = true;
375
+
376
+ $(doc).bind("click.spectrum", hide);
377
+ $(window).bind("resize.spectrum", resize);
378
+ replacer.addClass("sp-active");
379
+ container.show();
380
+
381
+ if (showPalette) {
382
+ drawPalette();
383
+ }
384
+ reflow();
385
+ updateUI();
386
+
387
+ colorOnShow = get();
388
+
389
+ drawInitial();
390
+ callbacks.show(colorOnShow);
391
+ }
392
+
393
+ function hide() {
394
+ if (!visible || flat) { return; }
395
+ visible = false;
396
+
397
+ $(doc).unbind("click.spectrum", hide);
398
+ $(window).unbind("resize.spectrum", resize);
399
+
400
+ replacer.removeClass("sp-active");
401
+ container.hide();
402
+
403
+ var colorHasChanged = !tinycolor.equals(get(), colorOnShow);
404
+
405
+ if (colorHasChanged) {
406
+ if (clickoutFiresChange) {
407
+ updateOriginalInput(true);
408
+ }
409
+ else {
410
+ revert();
411
+ }
412
+ }
413
+
414
+ callbacks.hide(get());
415
+ }
416
+
417
+ function revert() {
418
+ set(colorOnShow, true);
419
+ }
420
+
421
+ function set(color, ignoreFormatChange) {
422
+ if (tinycolor.equals(color, get())) {
423
+ return;
424
+ }
425
+
426
+ var newColor = tinycolor(color);
427
+ var newHsv = newColor.toHsv();
428
+
429
+ currentHue = newHsv.h;
430
+ currentSaturation = newHsv.s;
431
+ currentValue = newHsv.v;
432
+
433
+ updateUI();
434
+
435
+ if (!ignoreFormatChange) {
436
+ currentPreferredFormat = preferredFormat || newColor.format;
437
+ }
438
+ }
439
+
440
+ function get() {
441
+ return tinycolor.fromRatio({ h: currentHue, s: currentSaturation, v: currentValue });
442
+ }
443
+
444
+ function isValid() {
445
+ return !textInput.hasClass("sp-validation-error");
446
+ }
447
+
448
+ function move() {
449
+ updateUI();
450
+
451
+ callbacks.move(get());
452
+ }
453
+
454
+ function updateUI() {
455
+
456
+ textInput.removeClass("sp-validation-error");
457
+
458
+ updateHelperLocations();
459
+
460
+ // Update dragger background color (gradients take care of saturation and value).
461
+ var flatColor = tinycolor({ h: currentHue, s: "1.0", v: "1.0" });
462
+ dragger.css("background-color", flatColor.toHexString());
463
+
464
+ var realColor = get(),
465
+ realHex = realColor.toHexString();
466
+
467
+ // Update the replaced elements background color (with actual selected color)
468
+ previewElement.css("background-color", realHex);
469
+
470
+ // Update the text entry input as it changes happen
471
+ if (showInput) {
472
+ textInput.val(realColor.toString(currentPreferredFormat));
473
+ }
474
+
475
+ if (showPalette) {
476
+ drawPalette();
477
+ }
478
+
479
+ drawInitial();
480
+ }
481
+
482
+ function updateHelperLocations() {
483
+ var h = currentHue;
484
+ var s = currentSaturation;
485
+ var v = currentValue;
486
+
487
+ // Where to show the little circle in that displays your current selected color
488
+ var dragX = s * dragWidth;
489
+ var dragY = dragHeight - (v * dragHeight);
490
+ dragX = Math.max(
491
+ -dragHelperHeight,
492
+ Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
493
+ );
494
+ dragY = Math.max(
495
+ -dragHelperHeight,
496
+ Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
497
+ );
498
+ dragHelper.css({
499
+ "top": dragY,
500
+ "left": dragX
501
+ });
502
+
503
+ // Where to show the bar that displays your current selected hue
504
+ var slideY = (currentHue) * slideHeight;
505
+ slideHelper.css({
506
+ "top": slideY - slideHelperHeight
507
+ });
508
+ }
509
+
510
+ function updateOriginalInput(fireCallback) {
511
+ var color = get();
512
+
513
+ if (isInput) {
514
+ boundElement.val(color.toString(currentPreferredFormat)).change();
515
+ }
516
+
517
+ var hasChanged = !tinycolor.equals(color, colorOnShow);
518
+ colorOnShow = color;
519
+
520
+ // Update the selection palette with the current color
521
+ addColorToSelectionPalette(color);
522
+ if (fireCallback && hasChanged) {
523
+ callbacks.change(color);
524
+ }
525
+ }
526
+
527
+ function reflow() {
528
+ dragWidth = dragger.width();
529
+ dragHeight = dragger.height();
530
+ dragHelperHeight = dragHelper.height();
531
+ slideWidth = slider.width();
532
+ slideHeight = slider.height();
533
+ slideHelperHeight = slideHelper.height();
534
+
535
+ if (!flat) {
536
+ container.offset(getOffset(container, offsetElement));
537
+ }
538
+
539
+ updateHelperLocations();
540
+ }
541
+
542
+ function destroy() {
543
+ boundElement.show();
544
+ offsetElement.unbind("click.spectrum touchstart.spectrum");
545
+ container.remove();
546
+ replacer.remove();
547
+ spectrums[spect.id] = null;
548
+ }
549
+
550
+ initialize();
551
+
552
+ var spect = {
553
+ show: show,
554
+ hide: hide,
555
+ set: function (c) {
556
+ set(c);
557
+ updateOriginalInput();
558
+ },
559
+ get: get,
560
+ destroy: destroy,
561
+ container: container
562
+ };
563
+
564
+ spect.id = spectrums.push(spect) - 1;
565
+
566
+ return spect;
567
+ }
568
+
569
+ /**
570
+ * checkOffset - get the offset below/above and left/right element depending on screen position
571
+ * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
572
+ */
573
+ function getOffset(picker, input) {
574
+ var extraY = 0;
575
+ var dpWidth = picker.outerWidth();
576
+ var dpHeight = picker.outerHeight();
577
+ var inputWidth = input.outerWidth();
578
+ var inputHeight = input.outerHeight();
579
+ var doc = picker[0].ownerDocument;
580
+ var docElem = doc.documentElement;
581
+ var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
582
+ var viewHeight = docElem.clientHeight + $(doc).scrollTop();
583
+ var offset = input.offset();
584
+ offset.top += inputHeight;
585
+
586
+ offset.left -=
587
+ Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
588
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
589
+
590
+ offset.top -=
591
+ Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
592
+ Math.abs(dpHeight + inputHeight - extraY) : extraY));
593
+
594
+ return offset;
595
+ }
596
+
597
+ /**
598
+ * noop - do nothing
599
+ */
600
+ function noop() {
601
+
602
+ }
603
+
604
+ /**
605
+ * stopPropagation - makes the code only doing this a little easier to read in line
606
+ */
607
+ function stopPropagation(e) {
608
+ e.stopPropagation();
609
+ }
610
+
611
+ /**
612
+ * Create a function bound to a given object
613
+ * Thanks to underscore.js
614
+ */
615
+ function bind(func, obj) {
616
+ var slice = Array.prototype.slice;
617
+ var args = slice.call(arguments, 2);
618
+ return function () {
619
+ return func.apply(obj, args.concat(slice.call(arguments)));
620
+ }
621
+ }
622
+
623
+ /**
624
+ * Lightweight drag helper. Handles containment within the element, so that
625
+ * when dragging, the x is within [0,element.width] and y is within [0,element.height]
626
+ */
627
+ function draggable(element, onmove, onstart, onstop) {
628
+ onmove = onmove || function () { };
629
+ onstart = onstart || function () { };
630
+ onstop = onstop || function () { };
631
+ var doc = element.ownerDocument || document;
632
+ var dragging = false;
633
+ var offset = {};
634
+ var maxHeight = 0;
635
+ var maxWidth = 0;
636
+ var IE = $.browser.msie;
637
+ var hasTouch = ('ontouchstart' in window);
638
+
639
+ var duringDragEvents = {};
640
+ duringDragEvents["selectstart"] = prevent;
641
+ duringDragEvents["dragstart"] = prevent;
642
+ duringDragEvents[(hasTouch ? "touchmove" : "mousemove")] = move;
643
+ duringDragEvents[(hasTouch ? "touchend" : "mouseup")] = stop;
644
+
645
+ function prevent(e) {
646
+ if (e.stopPropagation) {
647
+ e.stopPropagation();
648
+ }
649
+ if (e.preventDefault) {
650
+ e.preventDefault();
651
+ }
652
+ e.returnValue = false;
653
+ }
654
+
655
+ function move(e) {
656
+ if (dragging) {
657
+ // Mouseup happened outside of window
658
+ if (IE && !(document.documentMode >= 9) && !e.button) {
659
+ return stop();
660
+ }
661
+
662
+ var touches = e.originalEvent.touches;
663
+ var pageX = touches ? touches[0].pageX : e.pageX;
664
+ var pageY = touches ? touches[0].pageY : e.pageY;
665
+
666
+ var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
667
+ var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
668
+
669
+ if (hasTouch) {
670
+ // Stop scrolling in iOS
671
+ prevent(e);
672
+ }
673
+
674
+ onmove.apply(element, [dragX, dragY]);
675
+ }
676
+ }
677
+ function start(e) {
678
+ var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
679
+ var touches = e.originalEvent.touches;
680
+
681
+ if (!rightclick && !dragging) {
682
+ if (onstart.apply(element, arguments) !== false) {
683
+ dragging = true;
684
+ maxHeight = $(element).height();
685
+ maxWidth = $(element).width();
686
+ offset = $(element).offset();
687
+
688
+ $(doc).bind(duringDragEvents);
689
+ $(doc.body).addClass("sp-dragging");
690
+
691
+ if (!hasTouch) {
692
+ move(e);
693
+ }
694
+
695
+ prevent(e);
696
+ }
697
+ }
698
+ }
699
+ function stop() {
700
+ if (dragging) {
701
+ $(doc).unbind(duringDragEvents);
702
+ $(doc.body).removeClass("sp-dragging");
703
+ onstop.apply(element, arguments);
704
+ }
705
+ dragging = false;
706
+ }
707
+
708
+ $(element).bind(hasTouch ? "touchstart" : "mousedown", start);
709
+ }
710
+
711
+ function throttle(func, wait, debounce) {
712
+ var timeout;
713
+ return function () {
714
+ var context = this, args = arguments;
715
+ var throttler = function () {
716
+ timeout = null;
717
+ func.apply(context, args);
718
+ };
719
+ if (debounce) clearTimeout(timeout);
720
+ if (debounce || !timeout) timeout = setTimeout(throttler, wait);
721
+ };
722
+ }
723
+
724
+
725
+ /**
726
+ * Define a jQuery plugin
727
+ */
728
+ var dataID = "spectrum.id";
729
+ $.fn.spectrum = function (opts, extra) {
730
+ if (typeof opts == "string") {
731
+ if (opts == "get") {
732
+ return spectrums[this.eq(0).data(dataID)].get();
733
+ } else if (opts == "container") {
734
+ return spectrums[$(this).data(dataID)].container;
735
+ }
736
+
737
+ return this.each(function () {
738
+ var spect = spectrums[$(this).data(dataID)];
739
+ if (spect) {
740
+ if (opts == "show") { spect.show(); }
741
+ if (opts == "hide") { spect.hide(); }
742
+ if (opts == "set") { spect.set(extra); }
743
+ if (opts == "destroy") {
744
+ spect.destroy();
745
+ $(this).removeData(dataID);
746
+ }
747
+ }
748
+ });
749
+ }
750
+
751
+ // Initializing a new one
752
+ return this.spectrum("destroy").each(function () {
753
+ var spect = spectrum(this, opts);
754
+ $(this).data(dataID, spect.id);
755
+ });
756
+ };
757
+
758
+ $.fn.spectrum.load = true;
759
+ $.fn.spectrum.loadOpts = {};
760
+ $.fn.spectrum.draggable = draggable;
761
+
762
+ $.fn.spectrum.processNativeColorInputs = function() {
763
+ var supportsColor = $("<input type='color' />")[0].type === "color";
764
+ if (!supportsColor) {
765
+ $("input[type=color]").spectrum({
766
+ preferredFormat: "hex6"
767
+ });
768
+ }
769
+ };
770
+
771
+ $(function () {
772
+ if ($.fn.spectrum.load) {
773
+ $.fn.spectrum.processNativeColorInputs();
774
+ }
775
+ });
776
+
777
+ })(this, jQuery);
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+ // TinyColor.js - <https://github.com/bgrins/TinyColor> - 2011 Brian Grinstead - v0.5
786
+
787
+ (function (window) {
788
+
789
+ var trimLeft = /^[\s,#]+/,
790
+ trimRight = /\s+$/,
791
+ tinyCounter = 0,
792
+ math = Math,
793
+ mathRound = math.round,
794
+ mathMin = math.min,
795
+ mathMax = math.max,
796
+ mathRandom = math.random,
797
+ parseFloat = window.parseFloat;
798
+
799
+ function tinycolor(color, opts) {
800
+
801
+ // If input is already a tinycolor, return itself
802
+ if (typeof color == "object" && color.hasOwnProperty("_tc_id")) {
803
+ return color;
804
+ }
805
+
806
+ var rgb = inputToRGB(color);
807
+ var r = rgb.r, g = rgb.g, b = rgb.b, a = parseFloat(rgb.a), format = rgb.format;
808
+
809
+ return {
810
+ ok: rgb.ok,
811
+ format: format,
812
+ _tc_id: tinyCounter++,
813
+ alpha: a,
814
+ toHsv: function () {
815
+ var hsv = rgbToHsv(r, g, b);
816
+ return { h: hsv.h, s: hsv.s, v: hsv.v, a: a };
817
+ },
818
+ toHsvString: function () {
819
+ var hsv = rgbToHsv(r, g, b);
820
+ var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
821
+ return (a == 1) ?
822
+ "hsv(" + h + ", " + s + "%, " + v + "%)" :
823
+ "hsva(" + h + ", " + s + "%, " + v + "%, " + a + ")";
824
+ },
825
+ toHsl: function () {
826
+ var hsl = rgbToHsl(r, g, b);
827
+ return { h: hsl.h, s: hsl.s, l: hsl.l, a: a };
828
+ },
829
+ toHslString: function () {
830
+ var hsl = rgbToHsl(r, g, b);
831
+ var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
832
+ return (a == 1) ?
833
+ "hsl(" + h + ", " + s + "%, " + l + "%)" :
834
+ "hsla(" + h + ", " + s + "%, " + l + "%, " + a + ")";
835
+ },
836
+ toHex: function () {
837
+ return rgbToHex(r, g, b);
838
+ },
839
+ toHexString: function (force6Char) {
840
+ return '#' + rgbToHex(r, g, b, force6Char);
841
+ },
842
+ toRgb: function () {
843
+ return { r: mathRound(r), g: mathRound(g), b: mathRound(b), a: a };
844
+ },
845
+ toRgbString: function () {
846
+ return (a == 1) ?
847
+ "rgb(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ")" :
848
+ "rgba(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ", " + a + ")";
849
+ },
850
+ toName: function () {
851
+ return hexNames[rgbToHex(r, g, b)] || false;
852
+ },
853
+ toFilter: function () {
854
+ var hex = rgbToHex(r, g, b);
855
+ var alphaHex = Math.round(parseFloat(a) * 255).toString(16);
856
+ return "progid:DXImageTransform.Microsoft.gradient(startColorstr=#" +
857
+ alphaHex + hex + ",endColorstr=#" + alphaHex + hex + ")";
858
+ },
859
+ toString: function (format) {
860
+ format = format || this.format;
861
+ var formattedString = false;
862
+ if (format === "rgb") {
863
+ formattedString = this.toRgbString();
864
+ }
865
+ if (format === "hex") {
866
+ formattedString = this.toHexString();
867
+ }
868
+ if (format === "hex6") {
869
+ formattedString = this.toHexString(true);
870
+ }
871
+ if (format === "name") {
872
+ formattedString = this.toName();
873
+ }
874
+ if (format === "hsl") {
875
+ formattedString = this.toHslString();
876
+ }
877
+ if (format === "hsv") {
878
+ formattedString = this.toHsvString();
879
+ }
880
+
881
+ return formattedString || this.toHexString();
882
+ }
883
+ };
884
+ }
885
+
886
+ // If input is an object, force 1 into "1.0" to handle ratios properly
887
+ // String input requires "1.0" as input, so 1 will be treated as 1
888
+ tinycolor.fromRatio = function(color) {
889
+
890
+ if (typeof color == "object") {
891
+ for (var i in color) {
892
+ if (color[i] === 1) {
893
+ color[i] = "1.0";
894
+ }
895
+ }
896
+ }
897
+
898
+ return tinycolor(color);
899
+
900
+ }
901
+
902
+ // Given a string or object, convert that input to RGB
903
+ // Possible string inputs:
904
+ //
905
+ // "red"
906
+ // "#f00" or "f00"
907
+ // "#ff0000" or "ff0000"
908
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
909
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
910
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
911
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
912
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
913
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
914
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
915
+ //
916
+ function inputToRGB(color) {
917
+
918
+ var rgb = { r: 0, g: 0, b: 0 };
919
+ var a = 1;
920
+ var ok = false;
921
+ var format = false;
922
+
923
+ if (typeof color == "string") {
924
+ color = stringInputToObject(color);
925
+ }
926
+
927
+ if (typeof color == "object") {
928
+ if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
929
+ rgb = rgbToRgb(color.r, color.g, color.b);
930
+ ok = true;
931
+ format = "rgb";
932
+ }
933
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
934
+ rgb = hsvToRgb(color.h, color.s, color.v);
935
+ ok = true;
936
+ format = "hsv";
937
+ }
938
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
939
+ var rgb = hslToRgb(color.h, color.s, color.l);
940
+ ok = true;
941
+ format = "hsl";
942
+ }
943
+
944
+ if (color.hasOwnProperty("a")) {
945
+ a = color.a;
946
+ }
947
+ }
948
+
949
+ rgb.r = mathMin(255, mathMax(rgb.r, 0));
950
+ rgb.g = mathMin(255, mathMax(rgb.g, 0));
951
+ rgb.b = mathMin(255, mathMax(rgb.b, 0));
952
+
953
+
954
+ // Don't let the range of [0,255] come back in [0,1].
955
+ // Potentially lose a little bit of precision here, but will fix issues where
956
+ // .5 gets interpreted as half of the total, instead of half of 1.
957
+ // If it was supposed to be 128, this was already taken care of in the conversion function
958
+ if (rgb.r < 1) { rgb.r = mathRound(rgb.r); }
959
+ if (rgb.g < 1) { rgb.g = mathRound(rgb.g); }
960
+ if (rgb.b < 1) { rgb.b = mathRound(rgb.b); }
961
+
962
+ return {
963
+ ok: ok,
964
+ format: (color && color.format) || format,
965
+ r: rgb.r,
966
+ g: rgb.g,
967
+ b: rgb.b,
968
+ a: a
969
+ };
970
+ }
971
+
972
+
973
+
974
+ // Conversion Functions
975
+ // --------------------
976
+
977
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
978
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
979
+
980
+ // `rgbToRgb`
981
+ // Handle bounds / percentage checking to conform to CSS color spec
982
+ // <http://www.w3.org/TR/css3-color/>
983
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
984
+ // *Returns:* { r, g, b } in [0, 255]
985
+ function rgbToRgb(r, g, b) {
986
+ return {
987
+ r: bound01(r, 255) * 255,
988
+ g: bound01(g, 255) * 255,
989
+ b: bound01(b, 255) * 255
990
+ };
991
+ }
992
+
993
+ // `rgbToHsl`
994
+ // Converts an RGB color value to HSL.
995
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
996
+ // *Returns:* { h, s, l } in [0,1]
997
+ function rgbToHsl(r, g, b) {
998
+
999
+ r = bound01(r, 255);
1000
+ g = bound01(g, 255);
1001
+ b = bound01(b, 255);
1002
+
1003
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1004
+ var h, s, l = (max + min) / 2;
1005
+
1006
+ if (max == min) {
1007
+ h = s = 0; // achromatic
1008
+ }
1009
+ else {
1010
+ var d = max - min;
1011
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1012
+ switch (max) {
1013
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1014
+ case g: h = (b - r) / d + 2; break;
1015
+ case b: h = (r - g) / d + 4; break;
1016
+ }
1017
+
1018
+ h /= 6;
1019
+ }
1020
+
1021
+ return { h: h, s: s, l: l };
1022
+ }
1023
+
1024
+ // `hslToRgb`
1025
+ // Converts an HSL color value to RGB.
1026
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
1027
+ // *Returns:* { r, g, b } in the set [0, 255]
1028
+ function hslToRgb(h, s, l) {
1029
+ var r, g, b;
1030
+
1031
+ h = bound01(h, 360);
1032
+ s = bound01(s, 100);
1033
+ l = bound01(l, 100);
1034
+
1035
+ function hue2rgb(p, q, t) {
1036
+ if (t < 0) t += 1;
1037
+ if (t > 1) t -= 1;
1038
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
1039
+ if (t < 1 / 2) return q;
1040
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
1041
+ return p;
1042
+ }
1043
+
1044
+ if (s == 0) {
1045
+ r = g = b = l; // achromatic
1046
+ }
1047
+ else {
1048
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1049
+ var p = 2 * l - q;
1050
+ r = hue2rgb(p, q, h + 1 / 3);
1051
+ g = hue2rgb(p, q, h);
1052
+ b = hue2rgb(p, q, h - 1 / 3);
1053
+ }
1054
+
1055
+ return { r: r * 255, g: g * 255, b: b * 255 };
1056
+ }
1057
+
1058
+ // `rgbToHsv`
1059
+ // Converts an RGB color value to HSV
1060
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
1061
+ // *Returns:* { h, s, v } in [0,1]
1062
+ function rgbToHsv(r, g, b) {
1063
+
1064
+ r = bound01(r, 255);
1065
+ g = bound01(g, 255);
1066
+ b = bound01(b, 255);
1067
+
1068
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1069
+ var h, s, v = max;
1070
+
1071
+ var d = max - min;
1072
+ s = max == 0 ? 0 : d / max;
1073
+
1074
+ if (max == min) {
1075
+ h = 0; // achromatic
1076
+ }
1077
+ else {
1078
+ switch (max) {
1079
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1080
+ case g: h = (b - r) / d + 2; break;
1081
+ case b: h = (r - g) / d + 4; break;
1082
+ }
1083
+ h /= 6;
1084
+ }
1085
+ return { h: h, s: s, v: v };
1086
+ }
1087
+
1088
+ // `hsvToRgb`
1089
+ // Converts an HSV color value to RGB.
1090
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
1091
+ // *Returns:* { r, g, b } in the set [0, 255]
1092
+ function hsvToRgb(h, s, v) {
1093
+ var r, g, b;
1094
+
1095
+ h = bound01(h, 360) * 6;
1096
+ s = bound01(s, 100);
1097
+ v = bound01(v, 100);
1098
+
1099
+ var i = math.floor(h),
1100
+ f = h - i,
1101
+ p = v * (1 - s),
1102
+ q = v * (1 - f * s),
1103
+ t = v * (1 - (1 - f) * s),
1104
+ mod = i % 6,
1105
+ r = [v, q, p, p, t, v][mod],
1106
+ g = [t, v, v, q, p, p][mod],
1107
+ b = [p, p, t, v, v, q][mod];
1108
+
1109
+ return { r: r * 255, g: g * 255, b: b * 255 };
1110
+ }
1111
+
1112
+ // `rgbToHex`
1113
+ // Converts an RGB color to hex
1114
+ // Assumes r, g, and b are contained in the set [0, 255]
1115
+ // Returns a 3 or 6 character hex
1116
+ function rgbToHex(r, g, b, force6Char) {
1117
+ function pad(c) {
1118
+ return c.length == 1 ? '0' + c : '' + c;
1119
+ }
1120
+
1121
+ var hex = [
1122
+ pad(mathRound(r).toString(16)),
1123
+ pad(mathRound(g).toString(16)),
1124
+ pad(mathRound(b).toString(16))
1125
+ ];
1126
+
1127
+ // Return a 3 character hex if possible
1128
+ if (!force6Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
1129
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
1130
+ }
1131
+
1132
+ return hex.join("");
1133
+ }
1134
+
1135
+ // `equals`
1136
+ // Can be called with any tinycolor input
1137
+ tinycolor.equals = function (color1, color2) {
1138
+ if (!color1 || !color2) { return false; }
1139
+ return tinycolor(color1).toHex() == tinycolor(color2).toHex();
1140
+ };
1141
+ tinycolor.random = function () {
1142
+ return tinycolor.fromRatio({
1143
+ r: mathRandom(),
1144
+ g: mathRandom(),
1145
+ b: mathRandom()
1146
+ });
1147
+ };
1148
+
1149
+
1150
+ // Modification Functions
1151
+ // ----------------------
1152
+ // Thanks to less.js for some of the basics here
1153
+ // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
1154
+
1155
+
1156
+ tinycolor.desaturate = function (color, amount) {
1157
+ var hsl = tinycolor(color).toHsl();
1158
+ hsl.s -= ((amount || 10) / 100);
1159
+ hsl.s = clamp01(hsl.s);
1160
+ return tinycolor(hsl);
1161
+ };
1162
+ tinycolor.saturate = function (color, amount) {
1163
+ var hsl = tinycolor(color).toHsl();
1164
+ hsl.s += ((amount || 10) / 100);
1165
+ hsl.s = clamp01(hsl.s);
1166
+ return tinycolor(hsl);
1167
+ };
1168
+ tinycolor.greyscale = function (color) {
1169
+ return tinycolor.desaturate(color, 100);
1170
+ };
1171
+ tinycolor.lighten = function (color, amount) {
1172
+ var hsl = tinycolor(color).toHsl();
1173
+ hsl.l += ((amount || 10) / 100);
1174
+ hsl.l = clamp01(hsl.l);
1175
+ return tinycolor(hsl);
1176
+ };
1177
+ tinycolor.darken = function (color, amount) {
1178
+ var hsl = tinycolor(color).toHsl();
1179
+ hsl.l -= ((amount || 10) / 100);
1180
+ hsl.l = clamp01(hsl.l);
1181
+ return tinycolor(hsl);
1182
+ };
1183
+ tinycolor.complement = function (color) {
1184
+ var hsl = tinycolor(color).toHsl();
1185
+ hsl.h = (hsl.h + .5) % 1;
1186
+ return tinycolor(hsl);
1187
+ };
1188
+
1189
+
1190
+ // Combination Functions
1191
+ // ---------------------
1192
+ // Thanks to jQuery xColor for some of the ideas behind these
1193
+ // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
1194
+
1195
+ tinycolor.triad = function (color) {
1196
+ var hsl = tinycolor(color).toHsl();
1197
+ var h = hsl.h * 360;
1198
+ return [
1199
+ tinycolor(color),
1200
+ tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
1201
+ tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
1202
+ ];
1203
+ };
1204
+ tinycolor.tetrad = function (color) {
1205
+ var hsl = tinycolor(color).toHsl();
1206
+ var h = hsl.h * 360;
1207
+ return [
1208
+ tinycolor(color),
1209
+ tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
1210
+ tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
1211
+ tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
1212
+ ];
1213
+ };
1214
+ tinycolor.splitcomplement = function (color) {
1215
+ var hsl = tinycolor(color).toHsl();
1216
+ var h = hsl.h * 360;
1217
+ return [
1218
+ tinycolor(color),
1219
+ tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
1220
+ tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
1221
+ ];
1222
+ };
1223
+ tinycolor.analogous = function (color, results, slices) {
1224
+ results = results || 6;
1225
+ slices = slices || 30;
1226
+
1227
+ var hsl = tinycolor(color).toHsl();
1228
+ var part = 360 / slices
1229
+ var ret = [tinycolor(color)];
1230
+
1231
+ hsl.h *= 360;
1232
+
1233
+ for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
1234
+ hsl.h = (hsl.h + part) % 360;
1235
+ ret.push(tinycolor(hsl));
1236
+ }
1237
+ return ret;
1238
+ };
1239
+ tinycolor.monochromatic = function (color, results) {
1240
+ results = results || 6;
1241
+ var hsv = tinycolor(color).toHsv();
1242
+ var h = hsv.h, s = hsv.s, v = hsv.v;
1243
+ var ret = [];
1244
+ var modification = 1 / results;
1245
+
1246
+ while (results--) {
1247
+ ret.push(tinycolor({ h: h, s: s, v: v }));
1248
+ v = (v + modification) % 1;
1249
+ }
1250
+
1251
+ return ret;
1252
+ };
1253
+ tinycolor.readable = function (color1, color2) {
1254
+ var a = tinycolor(color1).toRgb(), b = tinycolor(color2).toRgb();
1255
+ return (
1256
+ (b.r - a.r) * (b.r - a.r) +
1257
+ (b.g - a.g) * (b.g - a.g) +
1258
+ (b.b - a.b) * (b.b - a.b)
1259
+ ) > 0x28A4;
1260
+ };
1261
+
1262
+ // Big List of Colors
1263
+ // ---------
1264
+ // <http://www.w3.org/TR/css3-color/#svg-color>
1265
+ var names = tinycolor.names = {
1266
+ aliceblue: "f0f8ff",
1267
+ antiquewhite: "faebd7",
1268
+ aqua: "0ff",
1269
+ aquamarine: "7fffd4",
1270
+ azure: "f0ffff",
1271
+ beige: "f5f5dc",
1272
+ bisque: "ffe4c4",
1273
+ black: "000",
1274
+ blanchedalmond: "ffebcd",
1275
+ blue: "00f",
1276
+ blueviolet: "8a2be2",
1277
+ brown: "a52a2a",
1278
+ burlywood: "deb887",
1279
+ burntsienna: "ea7e5d",
1280
+ cadetblue: "5f9ea0",
1281
+ chartreuse: "7fff00",
1282
+ chocolate: "d2691e",
1283
+ coral: "ff7f50",
1284
+ cornflowerblue: "6495ed",
1285
+ cornsilk: "fff8dc",
1286
+ crimson: "dc143c",
1287
+ cyan: "0ff",
1288
+ darkblue: "00008b",
1289
+ darkcyan: "008b8b",
1290
+ darkgoldenrod: "b8860b",
1291
+ darkgray: "a9a9a9",
1292
+ darkgreen: "006400",
1293
+ darkgrey: "a9a9a9",
1294
+ darkkhaki: "bdb76b",
1295
+ darkmagenta: "8b008b",
1296
+ darkolivegreen: "556b2f",
1297
+ darkorange: "ff8c00",
1298
+ darkorchid: "9932cc",
1299
+ darkred: "8b0000",
1300
+ darksalmon: "e9967a",
1301
+ darkseagreen: "8fbc8f",
1302
+ darkslateblue: "483d8b",
1303
+ darkslategray: "2f4f4f",
1304
+ darkslategrey: "2f4f4f",
1305
+ darkturquoise: "00ced1",
1306
+ darkviolet: "9400d3",
1307
+ deeppink: "ff1493",
1308
+ deepskyblue: "00bfff",
1309
+ dimgray: "696969",
1310
+ dimgrey: "696969",
1311
+ dodgerblue: "1e90ff",
1312
+ firebrick: "b22222",
1313
+ floralwhite: "fffaf0",
1314
+ forestgreen: "228b22",
1315
+ fuchsia: "f0f",
1316
+ gainsboro: "dcdcdc",
1317
+ ghostwhite: "f8f8ff",
1318
+ gold: "ffd700",
1319
+ goldenrod: "daa520",
1320
+ gray: "808080",
1321
+ green: "008000",
1322
+ greenyellow: "adff2f",
1323
+ grey: "808080",
1324
+ honeydew: "f0fff0",
1325
+ hotpink: "ff69b4",
1326
+ indianred: "cd5c5c",
1327
+ indigo: "4b0082",
1328
+ ivory: "fffff0",
1329
+ khaki: "f0e68c",
1330
+ lavender: "e6e6fa",
1331
+ lavenderblush: "fff0f5",
1332
+ lawngreen: "7cfc00",
1333
+ lemonchiffon: "fffacd",
1334
+ lightblue: "add8e6",
1335
+ lightcoral: "f08080",
1336
+ lightcyan: "e0ffff",
1337
+ lightgoldenrodyellow: "fafad2",
1338
+ lightgray: "d3d3d3",
1339
+ lightgreen: "90ee90",
1340
+ lightgrey: "d3d3d3",
1341
+ lightpink: "ffb6c1",
1342
+ lightsalmon: "ffa07a",
1343
+ lightseagreen: "20b2aa",
1344
+ lightskyblue: "87cefa",
1345
+ lightslategray: "789",
1346
+ lightslategrey: "789",
1347
+ lightsteelblue: "b0c4de",
1348
+ lightyellow: "ffffe0",
1349
+ lime: "0f0",
1350
+ limegreen: "32cd32",
1351
+ linen: "faf0e6",
1352
+ magenta: "f0f",
1353
+ maroon: "800000",
1354
+ mediumaquamarine: "66cdaa",
1355
+ mediumblue: "0000cd",
1356
+ mediumorchid: "ba55d3",
1357
+ mediumpurple: "9370db",
1358
+ mediumseagreen: "3cb371",
1359
+ mediumslateblue: "7b68ee",
1360
+ mediumspringgreen: "00fa9a",
1361
+ mediumturquoise: "48d1cc",
1362
+ mediumvioletred: "c71585",
1363
+ midnightblue: "191970",
1364
+ mintcream: "f5fffa",
1365
+ mistyrose: "ffe4e1",
1366
+ moccasin: "ffe4b5",
1367
+ navajowhite: "ffdead",
1368
+ navy: "000080",
1369
+ oldlace: "fdf5e6",
1370
+ olive: "808000",
1371
+ olivedrab: "6b8e23",
1372
+ orange: "ffa500",
1373
+ orangered: "ff4500",
1374
+ orchid: "da70d6",
1375
+ palegoldenrod: "eee8aa",
1376
+ palegreen: "98fb98",
1377
+ paleturquoise: "afeeee",
1378
+ palevioletred: "db7093",
1379
+ papayawhip: "ffefd5",
1380
+ peachpuff: "ffdab9",
1381
+ peru: "cd853f",
1382
+ pink: "ffc0cb",
1383
+ plum: "dda0dd",
1384
+ powderblue: "b0e0e6",
1385
+ purple: "800080",
1386
+ red: "f00",
1387
+ rosybrown: "bc8f8f",
1388
+ royalblue: "4169e1",
1389
+ saddlebrown: "8b4513",
1390
+ salmon: "fa8072",
1391
+ sandybrown: "f4a460",
1392
+ seagreen: "2e8b57",
1393
+ seashell: "fff5ee",
1394
+ sienna: "a0522d",
1395
+ silver: "c0c0c0",
1396
+ skyblue: "87ceeb",
1397
+ slateblue: "6a5acd",
1398
+ slategray: "708090",
1399
+ slategrey: "708090",
1400
+ snow: "fffafa",
1401
+ springgreen: "00ff7f",
1402
+ steelblue: "4682b4",
1403
+ tan: "d2b48c",
1404
+ teal: "008080",
1405
+ thistle: "d8bfd8",
1406
+ tomato: "ff6347",
1407
+ turquoise: "40e0d0",
1408
+ violet: "ee82ee",
1409
+ wheat: "f5deb3",
1410
+ white: "fff",
1411
+ whitesmoke: "f5f5f5",
1412
+ yellow: "ff0",
1413
+ yellowgreen: "9acd32"
1414
+ };
1415
+
1416
+ // Make it easy to access colors via `hexNames[hex]`
1417
+ var hexNames = tinycolor.hexNames = flip(names);
1418
+
1419
+
1420
+ // Utilities
1421
+ // ---------
1422
+
1423
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
1424
+ function flip(o) {
1425
+ var flipped = {};
1426
+ for (var i in o) {
1427
+ if (o.hasOwnProperty(i)) {
1428
+ flipped[o[i]] = i;
1429
+ }
1430
+ }
1431
+ return flipped;
1432
+ }
1433
+
1434
+ // Take input from [0, n] and return it as [0, 1]
1435
+ function bound01(n, max) {
1436
+ if (isOnePointZero(n)) { n = "100%"; }
1437
+
1438
+ var processPercent = isPercentage(n);
1439
+ n = mathMin(max, mathMax(0, parseFloat(n)));
1440
+
1441
+ // Automatically convert percentage into number
1442
+ if (processPercent) {
1443
+ n = n * (max / 100);
1444
+ }
1445
+
1446
+ // Handle floating point rounding errors
1447
+ if ((math.abs(n - max) < 0.000001)) {
1448
+ return 1;
1449
+ }
1450
+ else if (n >= 1) {
1451
+ return (n % max) / parseFloat(max);
1452
+ }
1453
+ return n;
1454
+ }
1455
+
1456
+ // Force a number between 0 and 1
1457
+ function clamp01(val) {
1458
+ return mathMin(1, mathMax(0, val));
1459
+ }
1460
+
1461
+ // Parse an integer into hex
1462
+ function parseHex(val) {
1463
+ return parseInt(val, 16);
1464
+ }
1465
+
1466
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
1467
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
1468
+ function isOnePointZero(n) {
1469
+ return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
1470
+ }
1471
+
1472
+ // Check to see if string passed in is a percentage
1473
+ function isPercentage(n) {
1474
+ return typeof n === "string" && n.indexOf('%') != -1;
1475
+ }
1476
+
1477
+ var matchers = (function () {
1478
+
1479
+ // <http://www.w3.org/TR/css3-values/#integers>
1480
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
1481
+
1482
+ // <http://www.w3.org/TR/css3-values/#number-value>
1483
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
1484
+
1485
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
1486
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
1487
+
1488
+ // Actual matching.
1489
+ // Parentheses and commas are optional, but not required.
1490
+ // Whitespace can take the place of commas or opening paren
1491
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
1492
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
1493
+
1494
+ return {
1495
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
1496
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
1497
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
1498
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
1499
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
1500
+ hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1501
+ hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1502
+ };
1503
+ })();
1504
+
1505
+ // `stringInputToObject`
1506
+ // Permissive string parsing. Take in a number of formats, and output an object
1507
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
1508
+ function stringInputToObject(color) {
1509
+
1510
+ color = color.replace(trimLeft, '').replace(trimRight, '').toLowerCase();
1511
+ var named = false;
1512
+ if (names[color]) {
1513
+ color = names[color];
1514
+ named = true;
1515
+ }
1516
+ else if (color == 'transparent') {
1517
+ return { r: 0, g: 0, b: 0, a: 0 };
1518
+ }
1519
+
1520
+ // Try to match string input using regular expressions.
1521
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
1522
+ // Just return an object and let the conversion functions handle that.
1523
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
1524
+ var match;
1525
+ if ((match = matchers.rgb.exec(color))) {
1526
+ return { r: match[1], g: match[2], b: match[3] };
1527
+ }
1528
+ if ((match = matchers.rgba.exec(color))) {
1529
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
1530
+ }
1531
+ if ((match = matchers.hsl.exec(color))) {
1532
+ return { h: match[1], s: match[2], l: match[3] };
1533
+ }
1534
+ if ((match = matchers.hsla.exec(color))) {
1535
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
1536
+ }
1537
+ if ((match = matchers.hsv.exec(color))) {
1538
+ return { h: match[1], s: match[2], v: match[3] };
1539
+ }
1540
+ if ((match = matchers.hex6.exec(color))) {
1541
+ return {
1542
+ r: parseHex(match[1]),
1543
+ g: parseHex(match[2]),
1544
+ b: parseHex(match[3]),
1545
+ format: named ? "name" : "hex"
1546
+ };
1547
+ }
1548
+ if ((match = matchers.hex3.exec(color))) {
1549
+ return {
1550
+ r: parseHex(match[1] + '' + match[1]),
1551
+ g: parseHex(match[2] + '' + match[2]),
1552
+ b: parseHex(match[3] + '' + match[3]),
1553
+ format: named ? "name" : "hex"
1554
+ };
1555
+ }
1556
+
1557
+ return false;
1558
+ }
1559
+
1560
+ // Everything is ready, expose to window
1561
+ window.tinycolor = tinycolor;
1562
+
1563
+ })(this);
admin/cli-admin-page.php ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ ===============================================================================
4
+
5
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
6
+
7
+ This program is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License, version 2, as
9
+ published by the Free Software Foundation.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+
22
+ /** Displays admin page within WP dashboard */
23
+ function cookielawinfo_print_admin_page() {
24
+
25
+ // Lock out non-admins:
26
+ if ( !current_user_can( 'manage_options' ) ) {
27
+ wp_die( 'You do not have sufficient permission to perform this operation' );
28
+ }
29
+
30
+ // Get options:
31
+ $the_options = cookielawinfo_get_admin_settings();
32
+
33
+ // Check if form has been set:
34
+ if ( isset( $_POST['update_admin_settings_form'] ) ) {
35
+ // Check nonce:
36
+ check_admin_referer( 'cookielawinfo-update-' . CLI_SETTINGS_FIELD );
37
+ foreach ( $the_options as $key => $value ) {
38
+ if (isset($_POST[$key . '_field'])) {
39
+ // Store sanitised values only:
40
+ $the_options[$key] = cookielawinfo_sanitise($key, $_POST[$key . '_field']);
41
+ }
42
+ }
43
+ update_option(CLI_SETTINGS_FIELD, $the_options);
44
+ echo '<div class="updated"><p><strong>Settings Updated.</strong></p></div>';
45
+ }
46
+ else if ( isset ( $_POST['delete_all_settings'] ) ) {
47
+ // Check nonce:
48
+ check_admin_referer( 'cookielawinfo-update-' . CLI_SETTINGS_FIELD );
49
+ cookielawinfo_delete_settings();
50
+ $the_options = cookielawinfo_get_admin_settings();
51
+ }
52
+ else if ( isset ( $_POST['revert_to_previous_settings'] ) ) {
53
+ if ( !cookielawinfo_copy_old_settings_to_new() ) {
54
+ echo '<h3>ERROR MIGRATING SETTINGS (ERROR: 2)</h3>';
55
+ }
56
+ $the_options = cookielawinfo_get_admin_settings();
57
+ }
58
+
59
+ // Print form here:
60
+
61
+
62
+ echo '<div class="wrap">';
63
+
64
+ ?>
65
+ <h2>Cookie Law Settings</h2>
66
+
67
+
68
+ <?php
69
+
70
+ // Migration controller:
71
+ if ( isset ( $_POST['cli-migration-button'] ) ) {
72
+ if ( isset( $_POST['cli-migration_field'] ) ) {
73
+ switch ( $_POST['cli-migration_field'] ) {
74
+ case '2':
75
+ // Migrate but keep
76
+ if ( !cookielawinfo_migrate_to_new_version() ) {
77
+ echo '<h3>ERROR MIGRATING SETTINGS (ERROR: 2)</h3>';
78
+ }
79
+ break;
80
+ case '3':
81
+ // Just use this version
82
+ cookielawinfo_update_to_latest_version_number();
83
+ break;
84
+ default:
85
+ // Form error, ignore
86
+ echo '<h3>Error processing migration request (ERROR: 4)</h3>';
87
+ break;
88
+ }
89
+ }
90
+ $the_options = cookielawinfo_get_admin_settings();
91
+ }
92
+
93
+
94
+ echo '<form method="post" action="' . esc_url ( $_SERVER["REQUEST_URI"] ) . '">';
95
+
96
+ // Set nonce:
97
+ if ( function_exists('wp_nonce_field') )
98
+ wp_nonce_field('cookielawinfo-update-' . CLI_SETTINGS_FIELD);
99
+
100
+ ?>
101
+
102
+ <div class="cli-plugin-container">
103
+ <div class="cli-plugin-left-col width-62">
104
+ <div class="pad-10">
105
+
106
+ <!-- Toolbar -->
107
+ <div class="cli-plugin-toolbar top">
108
+ <div class="left">
109
+
110
+ <?php
111
+ // Outputs the "cookie bar is on/off" message in the header
112
+ $img_tag = '<img id="cli-plugin-status-icon" src="' . CLI_PLUGIN_URL . 'images/';
113
+ $span_tag = '<span id="header_on_off_alert">';
114
+ if ( $the_options['is_on'] == true ) {
115
+ $img_tag .= 'tick.png" alt="tick icon" />';
116
+ $span_tag .= 'Your Cookie Law Info bar is switched on</span>';
117
+ }
118
+ else {
119
+ $img_tag .= 'cross.png" alt="cross icon" />';
120
+ $span_tag .= 'Your Cookie Law Info bar is switched off</span>';
121
+ }
122
+ echo $img_tag . $span_tag;
123
+ ?>
124
+
125
+ </div>
126
+ <div class="right">
127
+ <input type="submit" name="update_admin_settings_form" value="Update Settings" class="button-primary" />
128
+ </div>
129
+ </div>
130
+
131
+
132
+ <!-- Accordion -->
133
+ <div id="cookielawinfo-accordion">
134
+
135
+
136
+ <h3><a href="#">Settings</a></h3>
137
+ <div>
138
+ <h4>The Cookie Bar</h4>
139
+ <table class="form-table">
140
+ <tr valign="top">
141
+ <th scope="row"><label for="is_on_field">Cookie Bar is currently:</label></th>
142
+ <td>
143
+ <input type="radio" id="is_on_field_yes" name="is_on_field" class="styled" value="true" <?php echo ( $the_options['is_on'] == true ) ? ' checked="checked" />' : ' />'; ?> On
144
+ <input type="radio" id="is_on_field_no" name="is_on_field" class="styled" value="false" <?php echo ( $the_options['is_on'] == false ) ? ' checked="checked" />' : ' />'; ?> Off
145
+ <span id="header_on_off_field_warning"></span>
146
+ </td>
147
+ </tr>
148
+ <tr valign="top">
149
+ <th scope="row"><label for="notify_position_vertical_field">Cookie Bar will be show in:</label></th>
150
+ <td>
151
+ <select name="notify_position_vertical_field" class="vvv_combobox">
152
+ <?php
153
+ if ( $the_options['notify_position_vertical'] == "top" ) {
154
+ echo '<option value="top" selected="selected">Header</option>';
155
+ echo '<option value="bottom">Footer</option>';
156
+ }
157
+ else {
158
+ echo '<option value="top">Header</option>';
159
+ echo '<option value="bottom" selected="selected">Footer</option>';
160
+ }
161
+ ?>
162
+ </select>
163
+ </td>
164
+ </tr>
165
+ <tr valign="top">
166
+ <th scope="row"><label for="notify_animate_show_field">On load</label></th>
167
+ <td>
168
+ <select name="notify_animate_show_field" class="vvv_combobox">
169
+ <?php
170
+ if ( $the_options['notify_animate_show'] == true ) {
171
+ echo '<option value="true" selected="selected">Animate</option>';
172
+ echo '<option value="false">Sticky</option>';
173
+ }
174
+ else {
175
+ echo '<option value="true">Animate</option>';
176
+ echo '<option value="false" selected="selected">Sticky</option>';
177
+ }
178
+ ?>
179
+ </select>
180
+ </td>
181
+ </tr>
182
+ <tr valign="top">
183
+ <th scope="row"><label for="notify_animate_hide_field">On hide</label></th>
184
+ <td>
185
+ <select name="notify_animate_hide_field" class="vvv_combobox">
186
+ <?php
187
+ if ( $the_options['notify_animate_hide'] == true ) {
188
+ echo '<option value="true" selected="selected">Animate</option>';
189
+ echo '<option value="false">Disappear</option>';
190
+ }
191
+ else {
192
+ echo '<option value="true">Animate</option>';
193
+ echo '<option value="false" selected="selected">Disappear</option>';
194
+ }
195
+ ?>
196
+ </select>
197
+ </td>
198
+ </tr>
199
+ </table>
200
+
201
+ <h4>The Show Again Tab</h4>
202
+ <table class="form-table">
203
+ <tr valign="top">
204
+ <th scope="row"><label for="showagain_tab_field">Use Show Again Tab?</label></th>
205
+ <td>
206
+ <input type="radio" id="showagain_tab_field_yes" name="showagain_tab_field" class="styled" value="true" <?php echo ( $the_options['showagain_tab'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
207
+ <input type="radio" id="showagain_tab_field_no" name="showagain_tab_field" class="styled" value="false" <?php echo ( $the_options['showagain_tab'] == false ) ? ' checked="checked" />' : ' />'; ?> No
208
+ </td>
209
+ </tr>
210
+ <tr valign="top">
211
+ <th scope="row"><label for="notify_position_horizontal_field">Tab Position</label></th>
212
+ <td>
213
+ <select name="notify_position_horizontal_field" class="vvv_combobox">
214
+ <?php
215
+ if ( $the_options['notify_position_horizontal'] == "right" ) {
216
+ echo '<option value="right" selected="selected">Right</option>';
217
+ echo '<option value="left">Left</option>';
218
+ }
219
+ else {
220
+ echo '<option value="right">Right</option>';
221
+ echo '<option value="left" selected="selected">Left</option>';
222
+ }
223
+ ?>
224
+ </select>
225
+ </td>
226
+ </tr>
227
+ <tr valign="top">
228
+ <th scope="row"><label for="showagain_x_position_field">From Left Margin</label></th>
229
+ <td>
230
+ <input type="text" name="showagain_x_position_field" value="<?php echo $the_options['showagain_x_position'] ?>" />
231
+ <span class="cli-plugin-example">Specify px&nbsp;or&nbsp;&#37;, e.g. <em>"100px" or "30%"</em></span>
232
+ </td>
233
+ </tr>
234
+ <tr valign="top">
235
+ <th scope="row"><label for="showagain_text">Show More Text</label></th>
236
+ <td>
237
+ <input type="text" name="showagain_text_field" value="<?php echo $the_options['showagain_text'] ?>" />
238
+
239
+ </td>
240
+ </tr>
241
+ </table>
242
+
243
+ </div>
244
+
245
+
246
+ <h3><a href="#">Cookie Law Message Bar</a></h3>
247
+ <div>
248
+ <table class="form-table">
249
+ <tr valign="top">
250
+ <th scope="row"><label for="notify_message_field">Message</label></th>
251
+ <td>
252
+ <?php
253
+ echo '<textarea name="notify_message_field" class="vvv_textbox">';
254
+ echo apply_filters('format_to_edit', stripslashes($the_options['notify_message'])) . '</textarea>';
255
+ ?>
256
+ <span class="cli-plugin-example">Shortcodes allowed: see settngs section "Using the Shortcodes". <br /><em>Examples: "We use cookies on this website [cookie_accept] to find out how to delete cookies [cookie_link]."</em></span>
257
+ </td>
258
+ </tr>
259
+ <tr valign="top">
260
+ <th scope="row"><label for="background_field">Cookie Bar Colour</label></th>
261
+ <td>
262
+ <?php
263
+ echo '<input type="text" name="background_field" id="cli-colour-background" value="' .$the_options['background']. '" />';
264
+ ?>
265
+ </td>
266
+ </tr>
267
+ <tr valign="top">
268
+ <th scope="row"><label for="text_field">Text Colour</label></th>
269
+ <td>
270
+ <?php
271
+ echo '<input type="text" name="text_field" id="cli-colour-text" value="' .$the_options['text']. '" />';
272
+ ?>
273
+ </td>
274
+ </tr>
275
+ <tr valign="top">
276
+ <th scope="row"><label for="border_on_field">Show Border?</label></th>
277
+ <td>
278
+ <!-- Border on/off -->
279
+ <input type="radio" id="border_on_field_yes" name="border_on_field" class="styled" value="true" <?php echo ( $the_options['border_on'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
280
+ <input type="radio" id="border_on_field_no" name="border_on_field" class="styled" value="false" <?php echo ( $the_options['border_on'] == false ) ? ' checked="checked" />' : ' />'; ?> No
281
+ </td>
282
+ </tr>
283
+ <tr valign="top">
284
+ <th scope="row"><label for="border_field">Border Colour</label></th>
285
+ <td>
286
+ <?php
287
+ echo '<input type="text" name="border_field" id="cli-colour-border" value="' .$the_options['border']. '" />';
288
+ ?>
289
+ </td>
290
+ </tr>
291
+ <tr valign="top">
292
+ <th scope="row"><label for="font_family_field">Font</label></th>
293
+ <td>
294
+ <select name="font_family_field" class="vvv_combobox">
295
+ <?php cookielawinfo_print_combobox_options( cookielawinfo_get_fonts(), $the_options['font_family'] ) ?>
296
+ </select>
297
+ </td>
298
+ </tr>
299
+ </table>
300
+ </div>
301
+
302
+
303
+ <h3><a href="#">Customise Buttons</a></h3>
304
+ <div>
305
+
306
+ <h4>Main Button <code>[cookie_button]</code></h4>
307
+ <p>This button/link can be customised to either simply close the cookie bar, or follow a link. You can also customise the colours and styles, and show it as a link or a button.</p>
308
+ <table class="form-table">
309
+ <tr valign="top">
310
+ <th scope="row"><label for="button_1_text_field">Link Text</label></th>
311
+ <td>
312
+ <input type="text" name="button_1_text_field" value="<?php echo $the_options['button_1_text'] ?>" />
313
+ </td>
314
+ </tr>
315
+ <tr valign="top">
316
+ <th scope="row"><label for="button_1_action_field">Action</label></th>
317
+ <td>
318
+ <select name="button_1_action_field" id="cli-plugin-button-1-action" class="vvv_combobox">
319
+ <?php cookielawinfo_print_combobox_options( cookielawinfo_get_js_actions(), $the_options['button_1_action'] ) ?>
320
+ </select>
321
+ </td>
322
+ </tr>
323
+ <tr valign="top" class="cli-plugin-row">
324
+ <th scope="row"><label for="button_1_url_field">Link URL</label></th>
325
+ <td>
326
+ <input type="text" name="button_1_url_field" id="button_1_url_field" value="<?php echo $the_options['button_1_url'] ?>" />
327
+ <span class="cli-plugin-example"><em>Button will only link to URL if Action = Show URL</em></span>
328
+ </td>
329
+ </tr>
330
+
331
+ <tr valign="top" class="cli-plugin-row">
332
+ <th scope="row"><label for="button_1_new_win_field">Open link in new window?</label></th>
333
+ <td>
334
+ <input type="radio" id="button_1_new_win_field_yes" name="button_1_new_win_field" class="styled" value="true" <?php echo ( $the_options['button_1_new_win'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
335
+ <input type="radio" id="button_1_new_win_field_no" name="button_1_new_win_field" class="styled" value="false" <?php echo ( $the_options['button_1_new_win'] == false ) ? ' checked="checked" />' : ' />'; ?> No
336
+ </td>
337
+ </tr>
338
+ <tr valign="top">
339
+ <th scope="row"><label for="button_1_link_colour_field">Link colour</label></th>
340
+ <td>
341
+ <?php
342
+ echo '<input type="text" name="button_1_link_colour_field" id="cli-colour-link-button-1" value="' .$the_options['button_1_link_colour']. '" />';
343
+ ?>
344
+ </td>
345
+ </tr>
346
+ <tr valign="top">
347
+ <th scope="row"><label for="button_1_as_button_field">Show as button?</label></th>
348
+ <td>
349
+ <input type="radio" id="button_1_as_button_field_yes" name="button_1_as_button_field" class="styled" value="true" <?php echo ( $the_options['button_1_as_button'] == true ) ? ' checked="checked" />' : ' />'; ?> Button
350
+ <input type="radio" id="button_1_as_button_field_no" name="button_1_as_button_field" class="styled" value="false" <?php echo ( $the_options['button_1_as_button'] == false ) ? ' checked="checked" />' : ' />'; ?> Link
351
+ </td>
352
+ </tr>
353
+ <tr valign="top">
354
+ <th scope="row"><label for="button_1_button_colour_field">Button colour</label></th>
355
+ <td>
356
+ <?php
357
+ echo '<input type="text" name="button_1_button_colour_field" id="cli-colour-btn-button-1" value="' .$the_options['button_1_button_colour']. '" />';
358
+ ?>
359
+ </td>
360
+ </tr>
361
+ <tr valign="top">
362
+ <th scope="row"><label for="button_1_button_size_field">Button Size</label></th>
363
+ <td>
364
+ <select name="button_1_button_size_field" class="vvv_combobox">
365
+ <?php cookielawinfo_print_combobox_options( cookielawinfo_get_button_sizes(), $the_options['button_1_button_size'] ); ?>
366
+ </select>
367
+ </td>
368
+ </tr>
369
+ </table><!-- end custom button -->
370
+
371
+
372
+ <h4>Read More Link <code>[cookie_link]</code></h4>
373
+ <p>This button/link can be used to provide a link out to your Privacy & Cookie Policy. You can customise it any way you like.</p>
374
+ <table class="form-table">
375
+ <tr valign="top">
376
+ <th scope="row"><label for="button_2_text_field">Link Text</label></th>
377
+ <td>
378
+ <input type="text" name="button_2_text_field" value="<?php echo $the_options['button_2_text'] ?>" />
379
+ </td>
380
+ </tr>
381
+ <tr valign="top">
382
+ <th scope="row"><label for="button_2_url_field">Link URL</label></th>
383
+ <td>
384
+ <input type="text" name="button_2_url_field" id="button_2_url_field" value="<?php echo $the_options['button_2_url'] ?>" />
385
+ </td>
386
+ </tr>
387
+ <tr valign="top">
388
+ <th scope="row"><label for="button_2_link_colour_field">Link colour</label></th>
389
+ <td>
390
+ <?php
391
+ echo '<input type="text" name="button_2_link_colour_field" id="cli-colour-link-button-1" value="' .$the_options['button_2_link_colour']. '" />';
392
+ ?>
393
+ </td>
394
+ </tr>
395
+
396
+
397
+ <tr valign="top">
398
+ <th scope="row"><label for="button_2_new_win_field">Open link in new window?</label></th>
399
+ <td>
400
+ <input type="radio" id="button_2_new_win_field_yes" name="button_2_new_win_field" class="styled" value="true" <?php echo ( $the_options['button_2_new_win'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
401
+ <input type="radio" id="button_2_new_win_field_no" name="button_2_new_win_field" class="styled" value="false" <?php echo ( $the_options['button_2_new_win'] == false ) ? ' checked="checked" />' : ' />'; ?> No
402
+ </td>
403
+ </tr>
404
+ <tr valign="top">
405
+ <th scope="row"><label for="button_2_as_button_field">Show as button?</label></th>
406
+ <td>
407
+ <input type="radio" id="button_2_as_button_field_yes" name="button_2_as_button_field" class="styled" value="true" <?php echo ( $the_options['button_2_as_button'] == true ) ? ' checked="checked" />' : ' />'; ?> Button
408
+ <input type="radio" id="button_2_as_button_field_no" name="button_2_as_button_field" class="styled" value="false" <?php echo ( $the_options['button_2_as_button'] == false ) ? ' checked="checked" />' : ' />'; ?> Link
409
+ </td>
410
+ </tr>
411
+ <tr valign="top">
412
+ <th scope="row"><label for="button_2_button_colour_field">Button colour</label></th>
413
+ <td>
414
+ <?php
415
+ echo '<input type="text" name="button_2_button_colour_field" id="cli-colour-btn-button-1" value="' .$the_options['button_2_button_colour']. '" />';
416
+ ?>
417
+ </td>
418
+ </tr>
419
+ <tr valign="top">
420
+ <th scope="row"><label for="button_2_button_size_field">Button Size</label></th>
421
+ <td>
422
+ <select name="button_2_button_size_field" class="vvv_combobox">
423
+ <?php cookielawinfo_print_combobox_options( cookielawinfo_get_button_sizes(), $the_options['button_2_button_size'] ); ?>
424
+ </select>
425
+ </td>
426
+ </tr>
427
+ </table><!-- end custom button -->
428
+
429
+ </div>
430
+
431
+ <h3><a href="#">Using the Shortcodes</a></h3>
432
+ <div class="cli-help">
433
+ <h4>Cookie bar shortcodes</h4>
434
+ <p>You can enter the shortcodes in the "message" field of the Cookie Law Info bar. They add nicely formatted buttons and/or links into the cookie bar, without you having to add any HTML.</p>
435
+ <p>The shortcodes are:</p>
436
+
437
+ <pre>[cookie_accept]</pre><span>If you just want a standard green "Accept" button that closes the header and nothing more, use this shortcode. It is already styled, you don't need to customise it.</span>
438
+
439
+ <pre>[cookie_accept colour="red"]</pre><span>Alternatively you can add a colour value. Choose from: red, blue, orange, yellow, green or pink.<br /><em>Careful to use the British spelling of "colour" for the attribute.</em></span>
440
+
441
+ <pre>[cookie_button]</pre><span>This is the "main button" you customise above.</span>
442
+
443
+ <pre>[cookie_link]</pre><span>This is the "read more" link you customise above.</span>
444
+
445
+ <h4>Other shortcodes</h4>
446
+ <p>These shortcodes can be used in pages and posts on your website. It is not recommended to use these inside the cookie bar itself.</p>
447
+
448
+ <pre>[cookie_audit]</pre><span>This prints out a nice table of cookies, in line with the guidance given by the ICO. <em>You need to enter the cookies your website uses via the Cookie Law Info menu in your WordPress dashboard.</em></span>
449
+
450
+ <pre>[cookie_delete]</pre><span>This shortcode will display a normal HTML link which when clicked, will delete the cookie set by Cookie Law Info (this cookie is used to remember that the cookie bar is closed).</span>
451
+
452
+ </div>
453
+
454
+
455
+ <h3><a href="#">Advanced</a></h3>
456
+ <div>
457
+ <p>Sometimes themes apply settings that clash with plugins. If that happens, try adjusting these settings.</p>
458
+
459
+ <table class="form-table">
460
+ <tr valign="top">
461
+ <th scope="row"><label for="use_colour_picker_field">Use colour picker on this page?</label></th>
462
+ <td>
463
+ <input type="radio" id="use_colour_picker_field_yes" name="use_colour_picker_field" class="styled" value="true" <?php echo ( $the_options['use_colour_picker'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
464
+ <input type="radio" id="use_colour_picker_field_no" name="use_colour_picker_field" class="styled" value="false" <?php echo ( $the_options['use_colour_picker'] == false ) ? ' checked="checked" />' : ' />'; ?> No
465
+ <span class="cli-plugin-example"><em>You will need to refresh your browser once the page re-loads in order to show the colour pickers.</em></span>
466
+ </td>
467
+ </tr>
468
+ <tr valign="top">
469
+ <th scope="row">Reset all values</th>
470
+ <td>
471
+ <input type="submit" name="delete_all_settings" value="Delete settings and reset" class="button-secondary" onclick="return confirm('Are you sure you want to delete all your settings?');" />
472
+ <span class="cli-plugin-example"><em>Warning: this will actually delete your current settings.</em></span>
473
+ </td>
474
+ </tr>
475
+ <!--
476
+ <tr valign="top">
477
+ <th scope="row">Revert to previous version's settings</th>
478
+ <td>
479
+ <input type="submit" name="revert_to_previous_settings" value="Revert to old settings" class="button-secondary" onclick="return confirm('You will lose your current settings. Are you sure?');" />
480
+ <span class="cli-plugin-example"><em>Warning: this will actually delete your current settings.</em></span>
481
+ </td>
482
+ </tr>
483
+ -->
484
+ </table>
485
+
486
+ </div>
487
+
488
+ </div><!-- end of cookielawinfo-accordion -->
489
+
490
+
491
+ <!-- Second save button -->
492
+ <div class="cli-plugin-toolbar bottom">
493
+ <div class="left">
494
+
495
+ </div>
496
+ <div class="right">
497
+ <input type="submit" name="update_admin_settings_form" value="Update Settings" class="button-primary" />
498
+ </div>
499
+ </div>
500
+
501
+
502
+ </form><!-- end of main settings form -->
503
+
504
+
505
+ </div><!-- end of pad-5 -->
506
+ </div><!-- end of cli-plugin-left-col (62%) -->
507
+
508
+ <!-- Dashboard Sidebar -->
509
+ <div class="cli-plugin-right-col width-38">
510
+ <div class="pad-10">
511
+
512
+
513
+ <div id="cli-plugin-migrate">
514
+ <h3>Where did my settings go?</h3>
515
+ <p>Cookie Law Info version 0.9 has been updated and has new settings. <strong>Your previous settings are safe.</strong></p>
516
+ <p>You can either copy over your old settings to this version, or use the new default values. </p>
517
+ <form method="post" action="<?php esc_url ( $_SERVER["REQUEST_URI"] ) ?>">
518
+ <p><label for="cli-migration">Would you like to:</label></p>
519
+ <ul>
520
+ <li><input type="radio" id="cli-migration_field_yes" name="cli-migration_field" class="styled" value="2" /> Use previous settings</li>
521
+ <li><input type="radio" id="cli-migration_field_yes" name="cli-migration_field" class="styled" value="3" checked="checked" /> Start afresh with the new version</li>
522
+ </ul>
523
+ <input type="submit" name="cli-migration-button" value="Update" class="button-secondary" onclick="return confirm('Are you sure you want to migrate settings?');" />
524
+ </form>
525
+ <p>If you want to go back to the previous version you can always download it again from <a href="http://www.cookielawinfo.com">CookieLawInfo.com.</a></p>
526
+ </div>
527
+
528
+ <h3>Help</h3>
529
+ <ul>
530
+ <li><a href="http://www.cookielawinfo.com/wordpress-plugin/">Plugin Homepage</a></li>
531
+ <li><a href="http://wordpress.org/support/plugin/cookie-law-info/">Plugin Support</a></li>
532
+ <li><a href="http://wordpress.org/support/plugin/cookie-law-info/">Report a Bug</a></li>
533
+ <li><a href="http://www.cookielawinfo.com/contact/">Suggest a Feature</a></li>
534
+ <li><a href="http://www.cookielawinfo.com">About the law</a></li>
535
+ </ul>
536
+
537
+ <br />
538
+ <br />
539
+ <br />
540
+
541
+ <div>
542
+ <form action="http://cookielawinfo.us5.list-manage.com/subscribe/post?u=b32779d828ef2e37e68e1580d&amp;id=71af66b86e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
543
+ <h3><label for="mce-EMAIL">Subscribe to our mailing list</label></h3>
544
+ <p>Occasional updates on plugin updates, compliance requirements, who's doing what and industry best practice.</p>
545
+ <input type="email" value="" name="EMAIL" class="vvv_textfield" id="mce-EMAIL" placeholder="email address" required>
546
+ <div class="">
547
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button-secondary">
548
+ </div>
549
+ <p>We will not send you spam or pass your details to 3rd Parties.</p>
550
+ </form>
551
+ </div><!--End mc_embed_signup-->
552
+
553
+ </div>
554
+ </div><!-- end of cli-plugin-right-col (38%) -->
555
+
556
+ </div><!-- end of cli-plugin-container -->
557
+
558
+
559
+ <?php
560
+ if ( !cookielawinfo_has_migrated() ) {
561
+ ?>
562
+ <script type="text/javascript">
563
+ jQuery(document).ready(function() {
564
+ jQuery('#cli-plugin-migrate').slideDown();
565
+ });
566
+ </script>
567
+ <?php
568
+ }
569
+
570
+ //DEBUG:
571
+ echo cookielawinfo_debug_admin_settings( true );
572
+ echo cookielawinfo_debug_echo (cookielawinfo_get_json_settings() );
573
+
574
+ echo '</div><!-- end wrap -->';
575
+
576
+ }
577
+
578
+ ?>
admin/cli-admin.php ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ ===============================================================================
4
+
5
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
6
+
7
+ This program is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License, version 2, as
9
+ published by the Free Software Foundation.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+
22
+
23
+
24
+ /**
25
+ Returns default settings
26
+ If you override the settings here, be ultra careful to use escape characters!
27
+ */
28
+ function cookielawinfo_get_default_settings() {
29
+ $settings_v0_9 = array(
30
+ 'animate_speed_hide' => '500',
31
+ 'animate_speed_show' => '500',
32
+ 'background' => '#fff',
33
+ 'background_url' => '',
34
+ 'border' => '#444',
35
+ 'border_on' => true,
36
+ 'button_1_text' => 'Accept',
37
+ 'button_1_url' => '#',
38
+ 'button_1_action' => '#cookie_action_close_header',
39
+ 'button_1_link_colour' => '#fff',
40
+ 'button_1_new_win' => false,
41
+ 'button_1_as_button' => true,
42
+ 'button_1_button_colour' => '#000',
43
+ 'button_1_button_size' => 'medium',
44
+ 'button_2_text' => 'Read More',
45
+ 'button_2_url' => get_site_url(),
46
+ 'button_2_action' => 'CONSTANT_OPEN_URL',
47
+ 'button_2_link_colour' => '#444',
48
+ 'button_2_new_win' => true,
49
+ 'button_2_as_button' => false,
50
+ 'button_2_button_colour' => '#333',
51
+ 'button_2_button_size' => 'medium',
52
+ 'font_family' => 'inherit', // Pick the family, not the easy name (see helper function below)
53
+ 'is_on' => true,
54
+ 'notify_animate_hide' => true,
55
+ 'notify_animate_show' => false,
56
+ 'notify_div_id' => '#cookie-law-info-bar',
57
+ 'notify_position_horizontal' => 'right', // left | right
58
+ 'notify_position_vertical' => 'bottom', // 'top' = header | 'bottom' = footer
59
+ 'notify_message' => addslashes ( 'This website uses cookies to improve your experience. We\'ll assume you\'re ok with this, but you can opt-out if you wish.[cookie_button] [cookie_link]' ),
60
+ 'showagain_background' => '#fff',
61
+ 'showagain_border' => '#000',
62
+ 'showagain_text' => addslashes ( 'Privacy & Cookies Policy' ),
63
+ 'showagain_div_id' => '#cookie-law-info-again',
64
+ 'showagain_tab' => true,
65
+ 'showagain_x_position' => '100px',
66
+ 'text' => '#000',
67
+ 'use_colour_picker' => true
68
+ );
69
+ return $settings_v0_9;
70
+ }
71
+
72
+
73
+ /**
74
+ Delete the values in all fields
75
+ WARNING - this has a predictable result i.e. will delete saved settings! Once deleted,
76
+ the get_admin_options() function will not find saved settings so will return default values
77
+ */
78
+ function cookielawinfo_delete_settings() {
79
+ if ( defined ( 'CLI_ADMIN_OPTIONS_NAME' ) ) {
80
+ delete_option( CLI_ADMIN_OPTIONS_NAME );
81
+ }
82
+ if ( defined ( 'CLI_SETTINGS_FIELD' ) ) {
83
+ delete_option( CLI_SETTINGS_FIELD );
84
+ }
85
+ }
86
+
87
+
88
+ /**
89
+ Retrieves admin setting: use colour picker in admin panel?
90
+ Default is true
91
+ Useful if issues with WP Theme and need to disable
92
+ */
93
+ function cookielawinfo_colourpicker_enabled() {
94
+ $settings = cookielawinfo_get_admin_settings();
95
+ return $settings['use_colour_picker'];
96
+ }
97
+
98
+
99
+
100
+ /** Retrieves (and sanitises) settings */
101
+ function cookielawinfo_get_admin_settings() {
102
+ $settings = cookielawinfo_get_default_settings();
103
+ $stored_options = get_option( CLI_SETTINGS_FIELD );
104
+ if ( !empty( $stored_options ) ) {
105
+ foreach ( $stored_options as $key => $option ) {
106
+ $settings[$key] = cookielawinfo_sanitise( $key, $option );
107
+ }
108
+ }
109
+ update_option( CLI_SETTINGS_FIELD, $settings );
110
+ return $settings;
111
+ }
112
+
113
+
114
+ /** Updates latest version number of plugin */
115
+ function cookielawinfo_update_to_latest_version_number() {
116
+ update_option( CLI_MIGRATED_VERSION, CLI_LATEST_VERSION_NUMBER );
117
+ }
118
+
119
+
120
+ /** Returns true if user is on latest version of plugin */
121
+ function cookielawinfo_has_migrated() {
122
+ // Test for previous version. If doesn't exist then safe to say are fresh install:
123
+ $old_settings = get_option( CLI_ADMIN_OPTIONS_NAME );
124
+ if ( empty( $old_settings ) ) {
125
+ return true;
126
+ }
127
+ // Test for latest version number
128
+ $version = get_option( CLI_MIGRATED_VERSION );
129
+ if ( empty ( $version ) ) {
130
+ // No version stored; not yet migrated:
131
+ return false;
132
+ }
133
+ if ( $version == CLI_LATEST_VERSION_NUMBER ) {
134
+ // Are on latest version
135
+ return true;
136
+ }
137
+ echo 'VERSION: ' . $version . '<br /> V2: ' . CLI_LATEST_VERSION_NUMBER;
138
+ // If you got this far then you're on an inbetween version
139
+ return false;
140
+ }
141
+
142
+ function cookielawinfo_copy_old_settings_to_new() {
143
+ $new_settings = cookielawinfo_get_admin_settings();
144
+ $old_settings = get_option( CLI_ADMIN_OPTIONS_NAME );
145
+
146
+ if ( empty( $old_settings ) ) {
147
+ // Something went wrong:
148
+ return false;
149
+ }
150
+ else {
151
+ // Copy over settings:
152
+ $new_settings['background'] = $old_settings['colour_bg'];
153
+ $new_settings['border'] = $old_settings['colour_border'];
154
+ $new_settings['button_1_action'] = 'CONSTANT_OPEN_URL';
155
+ $new_settings['button_1_text'] = $old_settings['link_text'];
156
+ $new_settings['button_1_url'] = $old_settings['link_url'];
157
+ $new_settings['button_1_link_colour'] = $old_settings['colour_link'];
158
+ $new_settings['button_1_new_win'] = $old_settings['link_opens_new_window'];
159
+ $new_settings['button_1_as_button'] = $old_settings['show_as_button'];
160
+ $new_settings['button_1_button_colour'] = $old_settings['colour_button_bg'];
161
+ $new_settings['notify_message'] = $old_settings['message_text'];
162
+ $new_settings['text'] = $old_settings['colour_text'];
163
+
164
+ // Save new values:
165
+ update_option( CLI_SETTINGS_FIELD, $new_settings );
166
+ }
167
+ return true;
168
+ }
169
+
170
+ /** Migrates settings from version 0.8.3 to version 0.9 */
171
+ function cookielawinfo_migrate_to_new_version() {
172
+
173
+ if ( cookielawinfo_has_migrated() ) {
174
+ return false;
175
+ }
176
+
177
+ if ( !cookielawinfo_copy_old_settings_to_new() ) {
178
+ return false;
179
+ }
180
+
181
+ // Register that have completed:
182
+ cookielawinfo_update_to_latest_version_number();
183
+ return true;
184
+ }
185
+
186
+
187
+ /**
188
+ Returns list of HTML tags allowed in HTML fields for use in declaration of wp_kset field validation.
189
+
190
+ Deliberately allows class and ID declarations to assist with custom CSS styling.
191
+ To customise further, see the excellent article at: http://ottopress.com/2010/wp-quickie-kses/
192
+ */
193
+ function cookielawinfo_allowed_html() {
194
+ $allowed_html = array(
195
+ // Allowed: <a href="" id="" class="" title="" target="">...</a>
196
+ // Not allowed: <a href="javascript(...);">...</a>
197
+ 'a' => array(
198
+ 'href' => array(),
199
+ 'id' => array(),
200
+ 'class' => array(),
201
+ 'title' => array(),
202
+ 'target' => array()
203
+ ),
204
+ 'b' => array(),
205
+ 'br' => array(
206
+ 'id' => array(),
207
+ 'class' => array()
208
+ ),
209
+ 'div' => array(
210
+ 'id' => array(),
211
+ 'class' => array()
212
+ ),
213
+ 'em' => array (),
214
+ 'i' => array(),
215
+ 'img' => array(
216
+ 'src' => array(),
217
+ 'id' => array(),
218
+ 'class' => array(),
219
+ 'alt' => array()
220
+ ),
221
+ 'p' => array (
222
+ 'id' => array(),
223
+ 'class' => array()
224
+ ),
225
+ 'span' => array(
226
+ 'id' => array(),
227
+ 'class' => array()
228
+ ),
229
+ 'strong' => array(),
230
+ );
231
+ return $allowed_html;
232
+ }
233
+
234
+
235
+ /**
236
+ Returns list of allowed protocols, for use in declaration of wp_kset field validation.
237
+ N.B. JavaScript is specifically disallowed for security reasons.
238
+ Don't even trust your own database, as you don't know if another plugin has written to your settings.
239
+ */
240
+ function cookielawinfo_allowed_protocols() {
241
+ // Additional options: 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'
242
+ return array ('http', 'https');
243
+ }
244
+
245
+
246
+ /**
247
+ Returns sanitised content based on field-specific rules defined here
248
+ Used for both read AND write operations
249
+ */
250
+ function cookielawinfo_sanitise($key, $value) {
251
+ $ret = null;
252
+
253
+ switch ($key) {
254
+ // Convert all boolean values from text to bool:
255
+ case 'is_on':
256
+ case 'border_on':
257
+ case 'notify_animate_show':
258
+ case 'notify_animate_hide':
259
+ case 'showagain_tab':
260
+ case 'use_colour_picker':
261
+ case 'button_1_new_win':
262
+ case 'button_1_as_button':
263
+ case 'button_2_new_win':
264
+ case 'button_2_as_button':
265
+ if ( $value == 'true' || $value === true ) {
266
+ $ret = true;
267
+ }
268
+ elseif ( $value == 'false' || $value === false ) {
269
+ $ret = false;
270
+ }
271
+ else {
272
+ // Unexpected value returned from radio button, go fix the HTML.
273
+ // Failover = assign null.
274
+ $ret = 'fffffff';
275
+ }
276
+ break;
277
+ // Any hex colour e.g. '#f00', '#FE01ab' '#ff0000' but not 'f00' or 'ff0000':
278
+ case 'background':
279
+ case 'text':
280
+ case 'border':
281
+ case 'showagain_background':
282
+ case 'showagain_border':
283
+ case 'button_1_link_colour':
284
+ case 'button_1_button_colour':
285
+ case 'button_2_link_colour':
286
+ case 'button_2_button_colour':
287
+ if ( preg_match( '/^#[a-f0-9]{6}|#[a-f0-9]{3}$/i', $value ) ) {
288
+ // Was: '/^#([0-9a-fA-F]{1,2}){3}$/i' which allowed e.g. '#00dd' (error)
289
+ $ret = $value;
290
+ }
291
+ else {
292
+ // Failover = assign '#000' (black)
293
+ $ret = '#000';
294
+ }
295
+ break;
296
+ // Allow some HTML, but no JavaScript:
297
+ case 'notify_message':
298
+ $ret = wp_kses( $value, cookielawinfo_allowed_html(), cookielawinfo_allowed_protocols() );
299
+ break;
300
+ // URLs only:
301
+ case 'button_1_url':
302
+ case 'button_2_url':
303
+ $ret = esc_url( $value );
304
+ break;
305
+ // Basic sanitisation for all the rest:
306
+ default:
307
+ $ret = sanitize_text_field( $value );
308
+ break;
309
+ }
310
+ return $ret;
311
+ }
312
+
313
+
314
+ /**
315
+ Registers menu options
316
+ Hooked into admin_menu
317
+ */
318
+ function cookielawinfo_register_custom_menu_page() {
319
+ add_submenu_page(
320
+ 'edit.php?post_type=cookielawinfo',
321
+ 'Cookie Law Settings',
322
+ 'Cookie Law Settings',
323
+ 'manage_options',
324
+ 'cookie-law-info',
325
+ 'cookielawinfo_print_admin_page'
326
+ );
327
+ }
328
+
329
+
330
+ /**
331
+ Registers dashboard scripts and styles used for Cookie Law Info plugin settings panel
332
+ Important: these scripts only load on the plugin settings page (avoids conflicts)
333
+ Hooked into admin_enqueue_script
334
+ */
335
+ function cookielawinfo_custom_dashboard_styles( $hook ) {
336
+ if ( 'cookielawinfo_page_cookie-law-info' != $hook )
337
+ return;
338
+
339
+ wp_register_style( 'cookielawinfo-admin-style', plugins_url('/cookie-law-info/css/cli-admin-style.css') );
340
+ wp_enqueue_style( 'cookielawinfo-admin-style' );
341
+
342
+ if ( cookielawinfo_colourpicker_enabled() ) {
343
+ wp_enqueue_script('spectrum-colorpicker', plugins_url('/cookie-law-info/admin/bgrins-spectrum/spectrum.js'), array('jquery'));
344
+ wp_register_style( 'spectrum-style', plugins_url('/cookie-law-info/admin/bgrins-spectrum/spectrum.css') );
345
+ wp_enqueue_style( 'spectrum-style' );
346
+ }
347
+
348
+ wp_enqueue_script('jquery-ui-custom', plugins_url('/cookie-law-info/js/jquery-ui-1.8.20.custom.min.js'), array('jquery'));
349
+ wp_enqueue_script('admin-ui-controller', plugins_url('/cookie-law-info/js/admin-ui-controller.js'), array('jquery'));
350
+
351
+ wp_register_style( 'jquery-ui-custom', plugins_url('/cookie-law-info/css/smoothness/jquery-ui-1.8.20.custom.css') );
352
+ wp_enqueue_style( 'jquery-ui-custom' );
353
+ }
354
+
355
+
356
+ /**
357
+ Adds custom script to admin panel to run the colour pickers
358
+ Important: these scripts only load on the plugin settings page (avoids conflicts)
359
+ Hooked into admin_footer
360
+ */
361
+ function cookielawinfo_custom_dashboard_styles_my_colours() {
362
+ if( cookielawinfo_colourpicker_enabled() ) {
363
+ wp_enqueue_script('spectrum-custom', plugins_url('/cookie-law-info/admin/bgrins-spectrum/my-colours.js'));
364
+ }
365
+ }
366
+
367
+
368
+ /**
369
+ Returns list of available jQuery actions
370
+ Used by buttons/links in header
371
+ */
372
+ function cookielawinfo_get_js_actions() {
373
+ $js_actions = array(
374
+ 'Close Header' => '#cookie_action_close_header',
375
+ 'Open URL' => 'CONSTANT_OPEN_URL' // Don't change this value, is used by jQuery
376
+ );
377
+ return $js_actions;
378
+ }
379
+
380
+
381
+ /**
382
+ Function returns list of supported fonts
383
+ Used when printing admin form (for combo box)
384
+ */
385
+ function cookielawinfo_get_fonts() {
386
+ $fonts = Array(
387
+ 'Default theme font' => 'inherit',
388
+ 'Sans Serif' => 'Helvetica, Arial, sans-serif',
389
+ 'Serif' => 'Georgia, Times New Roman, Times, serif',
390
+ 'Arial' => 'Arial, Helvetica, sans-serif',
391
+ 'Arial Black' => 'Arial Black,Gadget,sans-serif',
392
+ 'Georgia' => 'Georgia, serif',
393
+ 'Helvetica' => 'Helvetica, sans-serif',
394
+ 'Lucida' => 'Lucida Sans Unicode, Lucida Grande, sans-serif',
395
+ 'Tahoma' => 'Tahoma, Geneva, sans-serif',
396
+ 'Times New Roman' => 'Times New Roman, Times, serif',
397
+ 'Trebuchet' => 'Trebuchet MS, sans-serif',
398
+ 'Verdana' => 'Verdana, Geneva'
399
+ );
400
+ return $fonts;
401
+ }
402
+
403
+
404
+ /**
405
+ Returns button sizes (dependent upon CSS implemented - careful if editing)
406
+ Used when printing admin form (for combo boxes)
407
+ */
408
+ function cookielawinfo_get_button_sizes() {
409
+ $sizes = Array(
410
+ 'Extra Large' => 'super',
411
+ 'Large' => 'large',
412
+ 'Medium' => 'medium',
413
+ 'Small' => 'small'
414
+ );
415
+ return $sizes;
416
+ }
417
+
418
+
419
+ /**
420
+ Prints a combobox based on options and selected=match value
421
+
422
+ Parameters:
423
+ $options = array of options (suggest using helper functions)
424
+ $selected = which of those options should be selected (allows just one; is case sensitive)
425
+
426
+ Outputs (based on array ( $key => $value ):
427
+ <option value=$value>$key</option>
428
+ <option value=$value selected="selected">$key</option>
429
+ */
430
+ function cookielawinfo_print_combobox_options( $options, $selected ) {
431
+ foreach ( $options as $key => $value ) {
432
+ echo '<option value="' . $value . '"';
433
+ if ( $value == $selected ) {
434
+ echo ' selected="selected"';
435
+ }
436
+ echo '>' . $key . '</option>';
437
+ }
438
+ }
439
+
440
+
441
+ ?>
cookie-law-info.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Cookie Law Info
4
+ Plugin URI: http://wordpress.org/extend/plugins/cookie-law-info/description/
5
+ Description: A simple way of 'implied consent' to show your website complies with the EU Cookie Law, which came into force on 26 May 2012.
6
+ Author: Richard Ashby
7
+ Author URI: http://www.cookielawinfo.com/
8
+ Version: 1.0.1
9
+ License: GPL2
10
+
11
+ ===============================================================================
12
+
13
+ Whilst writing this plugin, somebody very close to me passed away from
14
+ prostate cancer.
15
+
16
+ If you found this software useful, please consider making a donation to
17
+ cancer research. Your donation, no matter how small, makes a real difference.
18
+
19
+ Thank You.
20
+
21
+ http://uk.movember.com/mospace/1853714/
22
+ www.cancerresearchuk.org
23
+
24
+ ===============================================================================
25
+
26
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
27
+
28
+ This program is free software; you can redistribute it and/or modify
29
+ it under the terms of the GNU General Public License, version 2, as
30
+ published by the Free Software Foundation.
31
+
32
+ This program is distributed in the hope that it will be useful,
33
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
34
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35
+ GNU General Public License for more details.
36
+
37
+ You should have received a copy of the GNU General Public License
38
+ along with this program; if not, write to the Free Software
39
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
40
+
41
+ */
42
+
43
+
44
+
45
+ // Failsafe setting (will catch any missed debug function calls), switch off ("false") in live:
46
+ define ( 'CLI_PLUGIN_DEVELOPMENT_MODE', false );
47
+
48
+ define ( 'CLI_PLUGIN_PATH', plugin_dir_path(__FILE__) );
49
+ define ( 'CLI_PLUGIN_URL', plugins_url() . '/cookie-law-info/');
50
+ define ( 'CLI_DB_KEY_PREFIX', 'CookieLawInfo-' );
51
+ define ( 'CLI_LATEST_VERSION_NUMBER', '0.9' );
52
+ define ( 'CLI_SETTINGS_FIELD', CLI_DB_KEY_PREFIX . CLI_LATEST_VERSION_NUMBER );
53
+ define ( 'CLI_MIGRATED_VERSION', CLI_DB_KEY_PREFIX . 'MigratedVersion' );
54
+
55
+ // Previous version settings (depreciated from 0.9 onwards):
56
+ define ( 'CLI_ADMIN_OPTIONS_NAME', 'CookieLawInfo-0.8.3' );
57
+
58
+
59
+ require_once CLI_PLUGIN_PATH . 'php/functions.php';
60
+ require_once CLI_PLUGIN_PATH . 'admin/cli-admin.php';
61
+ require_once CLI_PLUGIN_PATH . 'admin/cli-admin-page.php';
62
+ require_once CLI_PLUGIN_PATH . 'php/shortcodes.php';
63
+ require_once CLI_PLUGIN_PATH . 'php/custom-post-types.php';
64
+
65
+
66
+ // General, including script handling and uninstall:
67
+ register_activation_hook( __FILE__, 'cookielawinfo_activate' );
68
+ add_action( 'admin_menu', 'cookielawinfo_register_custom_menu_page' );
69
+ add_action( 'wp_enqueue_scripts', 'cookielawinfo_enqueue_frontend_scripts' );
70
+ add_action( 'wp_footer', 'cookielawinfo_inject_cli_script' );
71
+
72
+ // Shortcodes:
73
+ add_shortcode( 'delete_cookies', 'cookielawinfo_delete_cookies_shortcode' ); // a shortcode [delete_cookies (text="Delete Cookies")]
74
+ add_shortcode( 'cookie_audit', 'cookielawinfo_table_shortcode' ); // a shortcode [cookie_audit style="winter"]
75
+ add_shortcode( 'cookie_accept', 'cookielawinfo_shortcode_accept_button' ); // a shortcode [cookie_accept (colour="red")]
76
+ add_shortcode( 'cookie_link', 'cookielawinfo_shortcode_more_link' ); // a shortcode [cookie_link]
77
+ add_shortcode( 'cookie_button', 'cookielawinfo_shortcode_main_button' ); // a shortcode [cookie_button]
78
+
79
+ // Dashboard styles:
80
+ add_action( 'admin_enqueue_scripts', 'cookielawinfo_custom_dashboard_styles' );
81
+ add_action( 'admin_footer', 'cookielawinfo_custom_dashboard_styles_my_colours' );
82
+
83
+ // Cookie Audit custom post type functions:
84
+ add_action( 'admin_init', 'cookielawinfo_custom_posts_admin_init' );
85
+ add_action( 'init', 'cookielawinfo_register_custom_post_type' );
86
+ add_action( 'save_post', 'cookielawinfo_save_custom_metaboxes' );
87
+ add_filter( 'manage_edit-cookielawinfo_columns', 'cookielawinfo_edit_columns' );
88
+ add_action( 'manage_posts_custom_column', 'cookielawinfo_custom_columns' );
89
+
90
+
91
+ /** Register the uninstall function */
92
+ function cookielawinfo_activate() {
93
+ register_uninstall_hook( __FILE__, 'cookielawinfo_uninstall_plugin' );
94
+ }
95
+
96
+
97
+ /** Uninstalls the plugin (removes settings) */
98
+ function cookielawinfo_uninstall_plugin() {
99
+ delete_option( CLI_ADMIN_OPTIONS_NAME );
100
+ delete_option( CLI_MIGRATED_VERSION );
101
+ delete_option( CLI_SETTINGS_FIELD );
102
+ }
103
+
104
+
105
+ ?>
css/cli-admin-style.css ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #cli-plugin-migrate {
2
+ background: #C5E3BF;
3
+ border: 1px solid #98A148;
4
+ color: #000;
5
+ margin: 0 0 20px 0;
6
+ padding: 10px;
7
+ display: none;
8
+ }
9
+
10
+ .vvv_combobox {
11
+ width: 100%;
12
+ }
13
+ .vvv_textbox {
14
+ height: 150px;
15
+ width: 100%;
16
+ }
17
+ .form-table input[type="text"], .vvv_textfield {
18
+ width:100%;
19
+ height: 24px;
20
+ margin-bottom: 5px;
21
+ }
22
+ .cli-plugin-example {
23
+ display: block;
24
+ }
25
+ #cookielawinfo-accordion h4 {
26
+ border-bottom: 1px solid #ccc;
27
+ line-height: 110%;
28
+ padding: 5px;
29
+ }
30
+ #cookielawinfo-accordion h4 code {
31
+ padding-left: 40px;
32
+ background: transparent;
33
+ }
34
+ .cli-help pre {
35
+ font-weight: bold;
36
+ }
37
+ .cli-help span {
38
+ margin: 0 0 30px 15px;
39
+ display: block;
40
+ }
41
+ .cli-plugin-toolbar {
42
+ height: 40px;
43
+ width: 100%;
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+ .cli-plugin-toolbar .left {
48
+ float: left;
49
+ margin: 0;
50
+ padding: 0;
51
+ }
52
+ .cli-plugin-toolbar .left img {
53
+ vertical-align: text-bottom;
54
+ margin-right: 10px;
55
+ }
56
+ .cli-plugin-toolbar .right {
57
+ float: right;
58
+ margin: 0;
59
+ padding: 0;
60
+ }
61
+ .cli-plugin-toolbar.top {
62
+ margin-bottom: -5px;
63
+ }
64
+ .cli-plugin-toolbar.bottom {
65
+ margin-top: 12px;
66
+ }
67
+ #header_on_off_field_warning {
68
+ margin-left: 30px;
69
+ }
70
+ .warning { /* called by jQuery in admin-ui-controller.js */
71
+ color: #f00;
72
+ font-weight: bold;
73
+ }
74
+ .cli-plugin-container {
75
+ overflow: hidden;
76
+ width: 100%;
77
+ }
78
+ .cli-plugin-left-col {
79
+ float: left;
80
+ padding-bottom: 500em;
81
+ margin-bottom: -500em;
82
+ }
83
+ .cli-plugin-right-col {
84
+ float: left;
85
+ margin-right: -1px; /* For IE */
86
+ padding-bottom: 500em;
87
+ margin-bottom: -500em;
88
+ }
89
+
90
+ .cli-plugin-container.width-50 { width: 50%; }
91
+ .cli-plugin-container.width-60 { width: 60%; }
92
+ .cli-plugin-container.width-70 { width: 70%; }
93
+ .cli-plugin-container.width-80 { width: 80%; }
94
+ .cli-plugin-container.width-90 { width: 90%; }
95
+ .cli-plugin-left-col.width-50, .cli-plugin-right-col.width-50 { width: 50%; }
96
+ .cli-plugin-left-col.width-62, .cli-plugin-right-col.width-62 { width: 62%; } /* Golden Ratio */
97
+ .cli-plugin-left-col.width-38, .cli-plugin-right-col.width-38 { width: 38%; } /* Golden Ratio */
98
+ .cli-plugin-left-col.width-f220, .cli-plugin-right-col.width-f220 { width: 220px; }
99
+ .cli-plugin-container div.pad-5, .cli-plugin-left-col div.pad-5, .cli-plugin-right-col div.pad-5 { padding: 5px; }
100
+ .cli-plugin-container div.pad-10, .cli-plugin-left-col div.pad-10, .cli-plugin-right-col div.pad-10 { padding: 10px; }
101
+ .width-60 { width: 60%; }
102
+ .width-100 { width: 100%; }
css/cli-style.css ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #cookie-law-info-bar {
2
+ border: 0;
3
+ font-size: 10pt;
4
+ margin: 0 auto;
5
+ padding: 5px 0;
6
+ text-align: center;
7
+ width: 100%;
8
+ z-index: 9999;
9
+ }
10
+ #cookie-law-info-again {
11
+ font-size: 10pt;
12
+ margin: 0;
13
+ padding: 2px 10px;
14
+ text-align: center;
15
+ z-index: 9999;
16
+ cursor: pointer;
17
+ }
18
+ #cookie-law-info-bar span {
19
+ vertical-align: middle;
20
+ }
21
+ /** Buttons (http://papermashup.com/demos/css-buttons) */
22
+ .cli-plugin-button, .cli-plugin-button:visited {
23
+ background: #222 url('../images/overlay.png') repeat-x;
24
+ display: inline-block;
25
+ padding: 5px 10px 6px;
26
+ color: #fff;
27
+ text-decoration: none;
28
+ -moz-border-radius: 6px;
29
+ -webkit-border-radius: 6px;
30
+ -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
31
+ -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
32
+ text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
33
+ border-bottom: 1px solid rgba(0,0,0,0.25);
34
+ position: relative;
35
+ cursor: pointer;
36
+ margin: auto 10px;
37
+ }
38
+ .cli-plugin-button:hover {
39
+ background-color: #111;
40
+ color: #fff;
41
+ }
42
+ .cli-plugin-button:active {
43
+ top: 1px;
44
+ }
45
+ .small.cli-plugin-button, .small.cli-plugin-button:visited {
46
+ font-size: 11px;
47
+ }
48
+ .cli-plugin-button, .cli-plugin-button:visited,
49
+ .medium.cli-plugin-button, .medium.cli-plugin-button:visited {
50
+ font-size: 13px;
51
+ font-weight: bold;
52
+ line-height: 1;
53
+ text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
54
+ }
55
+ .large.cli-plugin-button, .large.cli-plugin-button:visited {
56
+ font-size: 14px;
57
+ padding: 8px 14px 9px;
58
+ }
59
+ .super.cli-plugin-button, .super.cli-plugin-button:visited {
60
+ font-size: 34px;
61
+ padding: 8px 14px 9px;
62
+ }
63
+ .pink.cli-plugin-button, .magenta.cli-plugin-button:visited {
64
+ background-color: #e22092;
65
+ }
66
+ .pink.cli-plugin-button:hover {
67
+ background-color: #c81e82;
68
+ }
69
+ .green.cli-plugin-button, .green.cli-plugin-button:visited {
70
+ background-color: #91bd09;
71
+ }
72
+ .green.cli-plugin-button:hover {
73
+ background-color: #749a02;
74
+ }
75
+ .red.cli-plugin-button, .red.cli-plugin-button:visited {
76
+ background-color: #e62727;
77
+ }
78
+ .red.cli-plugin-button:hover {
79
+ background-color: #cf2525;
80
+ }
81
+ .orange.cli-plugin-button, .orange.cli-plugin-button:visited {
82
+ background-color: #ff5c00;
83
+ }
84
+ .orange.cli-plugin-button:hover {
85
+ background-color: #d45500;
86
+ }
87
+ .blue.cli-plugin-button, .blue.cli-plugin-button:visited {
88
+ background-color: #2981e4;
89
+ }
90
+ .blue.cli-plugin-button:hover {
91
+ background-color: #2575cf;
92
+ }
93
+ .yellow.cli-plugin-button, .yellow.cli-plugin-button:visited {
94
+ background-color: #ffb515;
95
+ }
96
+ .yellow.cli-plugin-button:hover {
97
+ background-color: #fc9200;
98
+ }
css/cli-tables.css ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ For more styles try: http://icant.co.uk/csstablegallery/
3
+ ----
4
+ Generic styles:
5
+ Here you could e.g. customise width of column 1 and 2,
6
+ or add a generic roll-over effect on table rows
7
+ */
8
+ .cookielawinfo-column-1 {
9
+ width: 25%;
10
+ }
11
+ .cookielawinfo-column-2 {
12
+ width: 10%;
13
+ }
14
+ .cookielawinfo-column-3 {
15
+ width: 15%;
16
+ }
17
+ .cookielawinfo-column-4 {
18
+ width: 50%;}
19
+ }
20
+ .cookielawinfo-row {
21
+
22
+ }
23
+ td.cookielawinfo-row:hover {
24
+ }
25
+
26
+
27
+ /** Simple style */
28
+ .cookielawinfo-simple thead {
29
+ width: 100%;
30
+ }
31
+ .cookielawinfo-simple td {
32
+ padding: 5px 5px 5px 0;
33
+ vertical-align: top;
34
+ }
35
+ .cookielawinfo-simple thead th {
36
+ padding-right: 10px;
37
+ text-align: left;
38
+ }
39
+
40
+
41
+ /** Modern style */
42
+ .cookielawinfo-modern {
43
+ border: 1px solid #e3e3e3;
44
+ background-color: #f2f2f2;
45
+ width: 100%;
46
+ border-radius: 6px;
47
+ -webkit-border-radius: 6px;
48
+ -moz-border-radius: 6px;
49
+ }
50
+ .cookielawinfo-modern td, .cookielawinfo-modern th {
51
+ padding: 5px;
52
+ color: #333;
53
+ }
54
+ .cookielawinfo-modern thead {
55
+ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
56
+ padding: .2em 0 .2em .5em;
57
+ text-align: left;
58
+ color: #4B4B4B;
59
+ background-color: #C8C8C8;
60
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#e3e3e3), color-stop(.6,#B3B3B3));
61
+ background-image: -moz-linear-gradient(top, #D6D6D6, #B0B0B0, #B3B3B3 90%);
62
+ border-bottom: solid 1px #999;
63
+ }
64
+ .cookielawinfo-modern th {
65
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
66
+ font-size: 17px;
67
+ line-height: 20px;
68
+ font-style: normal;
69
+ font-weight: normal;
70
+ text-align: left;
71
+ text-shadow: white 1px 1px 1px;
72
+ }
73
+ .cookielawinfo-modern td {
74
+ line-height: 20px;
75
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
76
+ font-size: 14px;
77
+ border-bottom: 1px solid #fff;
78
+ border-top: 1px solid #fff;
79
+ }
80
+ .cookielawinfo-modern tr.cookielawinfo-row:hover {
81
+ background-color: #fff;
82
+ }
83
+
84
+
85
+ /** Elegant style */
86
+ .cookielawinfo-elegant {
87
+ border: 1px solid #DFDFDF;
88
+ background-color: #F9F9F9;
89
+ width: 100%;
90
+ -moz-border-radius: 3px;
91
+ -webkit-border-radius: 3px;
92
+ border-radius: 3px;
93
+ font-family: Arial,"Bitstream Vera Sans",Helvetica,Verdana,sans-serif;
94
+ color: #333;
95
+ }
96
+ .cookielawinfo-elegant tr {
97
+ border-top-color: white;
98
+ border-bottom: 1px solid #DFDFDF;
99
+ color: #555;
100
+ }
101
+ .cookielawinfo-elegant th {
102
+ text-shadow: rgba(255, 255, 255, 0.796875) 0px 1px 0px;
103
+ font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
104
+ font-weight: normal;
105
+ padding: 7px 7px 8px;
106
+ text-align: left;
107
+ line-height: 1.3em;
108
+ font-size: 14px;
109
+ }
110
+ .cookielawinfo-elegant td {
111
+ font-size: 12px;
112
+ padding: 4px 7px 2px;
113
+ vertical-align: top;
114
+ }
115
+
116
+
117
+ /** Rounded style */
118
+ .cookielawinfo-rounded {
119
+ background-color: #f5f5f5;
120
+ padding: 5px;
121
+ border-radius: 5px;
122
+ -moz-border-radius: 5px;
123
+ -webkit-border-radius: 5px;
124
+ border: 1px solid #ebebeb;
125
+ }
126
+ .cookielawinfo-rounded td, .rounded th {
127
+ padding: 1px 5px;
128
+ }
129
+ .cookielawinfo-rounded thead {
130
+ text-shadow: 0 1px 0 white;
131
+ color: #999;
132
+ }
133
+ .cookielawinfo-rounded th {
134
+ text-align: left;
135
+ text-transform: uppercase;
136
+ font-size: 11pt;
137
+ border-bottom: 1px solid #fff;
138
+ padding: 1px 5px;
139
+ }
140
+ .cookielawinfo-rounded td {
141
+ font-size: 10pt;
142
+ padding: 5px;
143
+ }
144
+ .cookielawinfo-rounded tr.cookielawinfo-row:hover {
145
+ background-color: #fff;
146
+ }
147
+
148
+
149
+ /** Classic Style */
150
+ table.cookielawinfo-classic {
151
+ font-family: Verdana, Arial, Helvetica, sans-serif;
152
+ border-collapse: collapse;
153
+ border-left: 1px solid #ccc;
154
+ border-top: 1px solid #ccc;
155
+ color: #333;
156
+ }
157
+ table.cookielawinfo-classic thead tr th {
158
+ text-transform: uppercase;
159
+ background: #e2e2e2;
160
+ }
161
+ table.cookielawinfo-classic tfoot tr th, table.cookielawinfo-classic tfoot tr td {
162
+ text-transform: uppercase;
163
+ color: #000;
164
+ font-weight: bold;
165
+ }
166
+ table.cookielawinfo-classic tfoot tr th {
167
+ width: 20%;
168
+ }
169
+ table.cookielawinfo-classic tfoot tr td {
170
+ width: 80%;
171
+ }
172
+ table.cookielawinfo-classic td, table.cookielawinfo-classic th {
173
+ border-right: 1px solid #ccc;
174
+ border-bottom: 1px solid #ccc;
175
+ padding: 5px;
176
+ line-height: 1.8em;
177
+ font-size: 0.8em;
178
+ vertical-align: top;
179
+ width: 20%;
180
+ }
181
+ table.cookielawinfo-classic tr.odd th, table.cookielawinfo-classic tr.odd td {
182
+ background: #efefef;
183
+ }
184
+
185
+
186
+ /* "Winter Blues" CSS theme for CSS Table Gallery (http://icant.co.uk/csstablegallery/) by Gunta Klavina (http://www.klavina.com) */
187
+ table.cookielawinfo-winter {font: 85% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif;padding: 0; margin: 10px 0 20px; border-collapse: collapse; color: #333; background: #F3F5F7;}
188
+ table.cookielawinfo-winter a {color: #3A4856; text-decoration: none; border-bottom: 1px solid #C6C8CB;}
189
+ table.cookielawinfo-winter a:visited {color: #777;}
190
+ table.cookielawinfo-winter a:hover {color: #000;}
191
+ table.cookielawinfo-winter caption {text-align: left; text-transform: uppercase; padding-bottom: 10px; font: 200% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif;}
192
+ table.cookielawinfo-winter thead th {background: #3A4856; padding: 15px 10px; color: #fff; text-align: left; font-weight: normal;}
193
+ table.cookielawinfo-winter tbody {border-left: 1px solid #EAECEE; border-right: 1px solid #EAECEE;}
194
+ table.cookielawinfo-winter tbody {border-bottom: 1px solid #EAECEE;}
195
+ table.cookielawinfo-winter tbody td, table.cookielawinfo-winter tbody th {padding: 10px; background: url("../images/td_back.gif") repeat-x; text-align: left;}
196
+ table.cookielawinfo-winter tbody tr {background: #F3F5F7;}
197
+ table.cookielawinfo-winter tbody tr.odd {background: #F0F2F4;}
198
+ table.cookielawinfo-winter tbody tr:hover {background: #EAECEE; color: #111;}
199
+ table.cookielawinfo-winter tfoot td, table.cookielawinfo-winter tfoot th, table.cookielawinfo-winter tfoot tr {text-align: left; font: 120% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif; text-transform: uppercase; background: #fff; padding: 10px;}
css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
css/smoothness/images/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png ADDED
Binary file
css/smoothness/images/ui-icons_222222_256x240.png ADDED
Binary file
css/smoothness/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
css/smoothness/images/ui-icons_454545_256x240.png ADDED
Binary file
css/smoothness/images/ui-icons_888888_256x240.png ADDED
Binary file
css/smoothness/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
css/smoothness/jquery-ui-1.8.20.custom.css ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery UI CSS Framework 1.8.20
3
+ *
4
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Theming/API
9
+ */
10
+
11
+ /* Layout helpers
12
+ ----------------------------------*/
13
+ .ui-helper-hidden { display: none; }
14
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
17
+ .ui-helper-clearfix:after { clear: both; }
18
+ .ui-helper-clearfix { zoom: 1; }
19
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
20
+
21
+
22
+ /* Interaction Cues
23
+ ----------------------------------*/
24
+ .ui-state-disabled { cursor: default !important; }
25
+
26
+
27
+ /* Icons
28
+ ----------------------------------*/
29
+
30
+ /* states and images */
31
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
32
+
33
+
34
+ /* Misc visuals
35
+ ----------------------------------*/
36
+
37
+ /* Overlays */
38
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
39
+
40
+
41
+ /*!
42
+ * jQuery UI CSS Framework 1.8.20
43
+ *
44
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
45
+ * Dual licensed under the MIT or GPL Version 2 licenses.
46
+ * http://jquery.org/license
47
+ *
48
+ * http://docs.jquery.com/UI/Theming/API
49
+ *
50
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
51
+ */
52
+
53
+
54
+ /* Component containers
55
+ ----------------------------------*/
56
+ .ui-widget { /*font-family: Verdana,Arial,sans-serif; font-size: 1.1em;*/ }
57
+ .ui-widget .ui-widget { /*font-size: 1em;*/ }
58
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { /*font-family: Verdana,Arial,sans-serif; font-size: 1em;*/ }
59
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
60
+ .ui-widget-content a { color: #222222; }
61
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
62
+ .ui-widget-header a { color: #222222; }
63
+
64
+ /* Interaction states
65
+ ----------------------------------*/
66
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
67
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
68
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
69
+ .ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
70
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
71
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
72
+ .ui-widget :active { outline: none; }
73
+
74
+ /* Interaction Cues
75
+ ----------------------------------*/
76
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
77
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
78
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
79
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
80
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
81
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
82
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
83
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
84
+
85
+ /* Icons
86
+ ----------------------------------*/
87
+
88
+ /* states and images */
89
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
90
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
91
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
92
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
93
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
94
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
95
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
96
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
97
+
98
+ /* positioning */
99
+ .ui-icon-carat-1-n { background-position: 0 0; }
100
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
101
+ .ui-icon-carat-1-e { background-position: -32px 0; }
102
+ .ui-icon-carat-1-se { background-position: -48px 0; }
103
+ .ui-icon-carat-1-s { background-position: -64px 0; }
104
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
105
+ .ui-icon-carat-1-w { background-position: -96px 0; }
106
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
107
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
108
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
109
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
110
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
111
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
112
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
113
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
114
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
115
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
116
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
117
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
118
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
119
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
120
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
121
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
122
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
123
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
124
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
125
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
126
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
127
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
128
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
129
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
130
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
131
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
132
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
133
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
134
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
135
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
136
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
137
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
138
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
139
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
140
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
141
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
142
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
143
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
144
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
145
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
146
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
147
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
148
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
149
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
150
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
151
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
152
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
153
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
154
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
155
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
156
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
157
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
158
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
159
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
160
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
161
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
162
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
163
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
164
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
165
+ .ui-icon-extlink { background-position: -32px -80px; }
166
+ .ui-icon-newwin { background-position: -48px -80px; }
167
+ .ui-icon-refresh { background-position: -64px -80px; }
168
+ .ui-icon-shuffle { background-position: -80px -80px; }
169
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
170
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
171
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
172
+ .ui-icon-folder-open { background-position: -16px -96px; }
173
+ .ui-icon-document { background-position: -32px -96px; }
174
+ .ui-icon-document-b { background-position: -48px -96px; }
175
+ .ui-icon-note { background-position: -64px -96px; }
176
+ .ui-icon-mail-closed { background-position: -80px -96px; }
177
+ .ui-icon-mail-open { background-position: -96px -96px; }
178
+ .ui-icon-suitcase { background-position: -112px -96px; }
179
+ .ui-icon-comment { background-position: -128px -96px; }
180
+ .ui-icon-person { background-position: -144px -96px; }
181
+ .ui-icon-print { background-position: -160px -96px; }
182
+ .ui-icon-trash { background-position: -176px -96px; }
183
+ .ui-icon-locked { background-position: -192px -96px; }
184
+ .ui-icon-unlocked { background-position: -208px -96px; }
185
+ .ui-icon-bookmark { background-position: -224px -96px; }
186
+ .ui-icon-tag { background-position: -240px -96px; }
187
+ .ui-icon-home { background-position: 0 -112px; }
188
+ .ui-icon-flag { background-position: -16px -112px; }
189
+ .ui-icon-calendar { background-position: -32px -112px; }
190
+ .ui-icon-cart { background-position: -48px -112px; }
191
+ .ui-icon-pencil { background-position: -64px -112px; }
192
+ .ui-icon-clock { background-position: -80px -112px; }
193
+ .ui-icon-disk { background-position: -96px -112px; }
194
+ .ui-icon-calculator { background-position: -112px -112px; }
195
+ .ui-icon-zoomin { background-position: -128px -112px; }
196
+ .ui-icon-zoomout { background-position: -144px -112px; }
197
+ .ui-icon-search { background-position: -160px -112px; }
198
+ .ui-icon-wrench { background-position: -176px -112px; }
199
+ .ui-icon-gear { background-position: -192px -112px; }
200
+ .ui-icon-heart { background-position: -208px -112px; }
201
+ .ui-icon-star { background-position: -224px -112px; }
202
+ .ui-icon-link { background-position: -240px -112px; }
203
+ .ui-icon-cancel { background-position: 0 -128px; }
204
+ .ui-icon-plus { background-position: -16px -128px; }
205
+ .ui-icon-plusthick { background-position: -32px -128px; }
206
+ .ui-icon-minus { background-position: -48px -128px; }
207
+ .ui-icon-minusthick { background-position: -64px -128px; }
208
+ .ui-icon-close { background-position: -80px -128px; }
209
+ .ui-icon-closethick { background-position: -96px -128px; }
210
+ .ui-icon-key { background-position: -112px -128px; }
211
+ .ui-icon-lightbulb { background-position: -128px -128px; }
212
+ .ui-icon-scissors { background-position: -144px -128px; }
213
+ .ui-icon-clipboard { background-position: -160px -128px; }
214
+ .ui-icon-copy { background-position: -176px -128px; }
215
+ .ui-icon-contact { background-position: -192px -128px; }
216
+ .ui-icon-image { background-position: -208px -128px; }
217
+ .ui-icon-video { background-position: -224px -128px; }
218
+ .ui-icon-script { background-position: -240px -128px; }
219
+ .ui-icon-alert { background-position: 0 -144px; }
220
+ .ui-icon-info { background-position: -16px -144px; }
221
+ .ui-icon-notice { background-position: -32px -144px; }
222
+ .ui-icon-help { background-position: -48px -144px; }
223
+ .ui-icon-check { background-position: -64px -144px; }
224
+ .ui-icon-bullet { background-position: -80px -144px; }
225
+ .ui-icon-radio-off { background-position: -96px -144px; }
226
+ .ui-icon-radio-on { background-position: -112px -144px; }
227
+ .ui-icon-pin-w { background-position: -128px -144px; }
228
+ .ui-icon-pin-s { background-position: -144px -144px; }
229
+ .ui-icon-play { background-position: 0 -160px; }
230
+ .ui-icon-pause { background-position: -16px -160px; }
231
+ .ui-icon-seek-next { background-position: -32px -160px; }
232
+ .ui-icon-seek-prev { background-position: -48px -160px; }
233
+ .ui-icon-seek-end { background-position: -64px -160px; }
234
+ .ui-icon-seek-start { background-position: -80px -160px; }
235
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
236
+ .ui-icon-seek-first { background-position: -80px -160px; }
237
+ .ui-icon-stop { background-position: -96px -160px; }
238
+ .ui-icon-eject { background-position: -112px -160px; }
239
+ .ui-icon-volume-off { background-position: -128px -160px; }
240
+ .ui-icon-volume-on { background-position: -144px -160px; }
241
+ .ui-icon-power { background-position: 0 -176px; }
242
+ .ui-icon-signal-diag { background-position: -16px -176px; }
243
+ .ui-icon-signal { background-position: -32px -176px; }
244
+ .ui-icon-battery-0 { background-position: -48px -176px; }
245
+ .ui-icon-battery-1 { background-position: -64px -176px; }
246
+ .ui-icon-battery-2 { background-position: -80px -176px; }
247
+ .ui-icon-battery-3 { background-position: -96px -176px; }
248
+ .ui-icon-circle-plus { background-position: 0 -192px; }
249
+ .ui-icon-circle-minus { background-position: -16px -192px; }
250
+ .ui-icon-circle-close { background-position: -32px -192px; }
251
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
252
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
253
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
254
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
255
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
256
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
257
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
258
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
259
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
260
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
261
+ .ui-icon-circle-check { background-position: -208px -192px; }
262
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
263
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
264
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
265
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
266
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
267
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
268
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
269
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
270
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
271
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
272
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
273
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
274
+
275
+
276
+ /* Misc visuals
277
+ ----------------------------------*/
278
+
279
+ /* Corner radius */
280
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
281
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
282
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
283
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
284
+
285
+ /* Overlays */
286
+ .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
287
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
288
+ * jQuery UI Accordion 1.8.20
289
+ *
290
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
291
+ * Dual licensed under the MIT or GPL Version 2 licenses.
292
+ * http://jquery.org/license
293
+ *
294
+ * http://docs.jquery.com/UI/Accordion#theming
295
+ */
296
+ /* IE/Win - Fix animation bug - #4615 */
297
+ .ui-accordion { width: 100%; }
298
+ .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
299
+ .ui-accordion .ui-accordion-li-fix { display: inline; }
300
+ .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
301
+ .ui-accordion .ui-accordion-header a { display: block; /*font-size: 1em;*/ padding: .5em .5em .5em .7em; }
302
+ .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
303
+ .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
304
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
305
+ .ui-accordion .ui-accordion-content-active { display: block; }
images/collapse.png ADDED
Binary file
images/cross.png ADDED
Binary file
images/expand.png ADDED
Binary file
images/overlay.png ADDED
Binary file
images/td_back.gif ADDED
Binary file
images/tick.png ADDED
Binary file
js/admin-ui-controller.js ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+
3
+ // You can override the icon names here, in case you prefer your own or have URL issues:
4
+ // E.g. "http://mysite.com/cross.png/images/cross.png" would have "cross.png" replaced twice...
5
+ // Styling should be done in your custom CSS
6
+ var cookie_bar_on_icon = "tick.png";
7
+ var cookie_bar_off_icon = "cross.png";
8
+
9
+ // jQuery only CSS:
10
+ jQuery('HTML').addClass('JS');
11
+
12
+ /*
13
+ Work in progress... open same tab position between saves
14
+ If you are a web developer and fancy beating me to this, please get in touch... :)
15
+
16
+ DONE:
17
+ if 'cliopentab' GET param is set:
18
+ find out value of 'cliopentab'
19
+ call accordion with 'cliopentab' value
20
+
21
+ TO DO:
22
+ on accordion changing the active div:
23
+ update form action with &cliopentab= <div number>:
24
+ parse form action
25
+ if 'cliopentab' GET param is set:
26
+ update 'cliopentab' value with <div number>
27
+ else:
28
+ add &cliopentab= <div number>
29
+ */
30
+ function getURLParameter(name) {
31
+ return decodeURI(
32
+ (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
33
+ );
34
+ }
35
+ switch ( getURLParameter("cliopentab") ) {
36
+ case "0":
37
+ jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 0 } );
38
+ break;
39
+ case "2":
40
+ jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 2 } );
41
+ break;
42
+ case "3":
43
+ jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 3 } );
44
+ break;
45
+ case "1":
46
+ default:
47
+ jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 1 } );
48
+ }
49
+
50
+
51
+ // Cookie bar is on/off message handling:
52
+ var f = jQuery("#header_on_off_alert");
53
+ var t = jQuery("#header_on_off_field_warning");
54
+ var icon = jQuery("#cli-plugin-status-icon");
55
+
56
+ jQuery('#is_on_field_yes').click(function(){
57
+ // Cookie bar is on
58
+ f.text("Your Cookie Law Info bar is switched on");
59
+ t.text("Your Cookie Law Info bar is switched on");
60
+ t.removeClass('warning');
61
+ swap_icon( cookie_bar_on_icon );
62
+ });
63
+ jQuery('#is_on_field_no').click(function(){
64
+ // Cookie bar is off
65
+ f.text("Your Cookie Law Info bar is switched off");
66
+ t.text("Your Cookie Law Info bar is switched off");
67
+ t.addClass('warning');
68
+ swap_icon( cookie_bar_off_icon );
69
+ });
70
+ function swap_icon(new_icon) {
71
+ old_icon = ( new_icon == cookie_bar_off_icon ) ? cookie_bar_on_icon : cookie_bar_off_icon;
72
+ var original_src = icon.attr('src');
73
+ var new_src = original_src.replace(old_icon, new_icon);
74
+ icon.attr('src', new_src);
75
+ }
76
+
77
+
78
+ // Toggle admin display to show/hide action/URL fields
79
+ var rows = jQuery('.cli-plugin-row');
80
+ var combobox = jQuery('#cli-plugin-button-1-action');
81
+
82
+ toggle_combobox();
83
+
84
+ combobox.change(function() {
85
+ toggle_combobox();
86
+ });
87
+
88
+ function toggle_combobox() {
89
+ var selected = jQuery("#cli-plugin-button-1-action option:selected").val();
90
+ if ( selected == "CONSTANT_OPEN_URL" ) {
91
+ rows.show();
92
+ }
93
+ else {
94
+ rows.hide();
95
+ }
96
+ }
97
+
98
+ });
js/cli-script.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function doCookie(dc_message, dc_link_tag, dc_speed_down, dc_speed_up, dc_adipose_speed, dc_sticky, js_array, doc_base) {
2
+
3
+ var ACCEPT_COOKIE_NAME = 'viewed_cookie_policy';
4
+ var hasViewedPolicy = jQuery.cookie(ACCEPT_COOKIE_NAME);
5
+
6
+ var expand_button = "<img src='" + doc_base + "/expand.png' height='32' width='32' class='icon' alt='Click to expand EU Cookie Law policy header' />";
7
+ var collapse_button = "<img src='" + doc_base + "/collapse.png' height='32' width='32' class='icon' alt='Click to collapse EU Cookie Law policy header' />";
8
+
9
+ function displayHeader() {
10
+ if (dc_sticky) {
11
+ jQuery("#cookie-header").show();
12
+ jQuery('#adipose-tab').hide();
13
+ }
14
+ else {
15
+ jQuery("#cookie-header").slideDown(dc_speed_down, function wwffrRRt() {
16
+ jQuery('#adipose-tab').hide(); });
17
+ }
18
+ }
19
+
20
+ function recursiveStrip(field) {
21
+ if (field.charAt(0) == "#") {
22
+ field = field.substring(1, field.length);
23
+ }
24
+ else {
25
+ return "#" + field;
26
+ }
27
+ return recursiveStrip(field);
28
+ }
29
+
30
+ // Split testing:
31
+ var option_a = "";
32
+ var option_b = "<div id='cookie-header'><div class='left-panel'>" + dc_message + dc_link_tag + "</div><div class='right-panel'><a href='#' id='cookie_policy_close'>" + collapse_button + "</a></div></div><div id='adipose-tab'><a href='#' id='adipose-tab-open'>" + expand_button + "</a></div>";
33
+
34
+ // On page ready, plugin the header HTML and hide it
35
+ jQuery('body').prepend(option_b);
36
+ jQuery('#cookie-header').hide();
37
+ jQuery('#adipose-tab').hide();
38
+
39
+ var palette = eval("(" + js_array + ")");
40
+ jQuery('#cookie-header').css({
41
+ 'background-color': recursiveStrip(palette['colour_bg']),
42
+ 'color': recursiveStrip(palette['colour_text']),
43
+ 'border-bottom': '4px solid' + recursiveStrip(palette['colour_border'])
44
+ });
45
+ jQuery('.cookie-link-button').css({
46
+ 'background-color': recursiveStrip(palette['colour_button_bg']),
47
+ 'color': recursiveStrip(palette['colour_link'])
48
+ });
49
+ jQuery('.cookie-link-text').css({
50
+ 'color': recursiveStrip(palette['colour_link'])
51
+ });
52
+ jQuery('#adipose-tab').css({
53
+ 'background-color': recursiveStrip(palette['colour_adipose']),
54
+ 'color': recursiveStrip(palette['colour_link']),
55
+ 'border': '1px solid' + recursiveStrip(palette['colour_border'])
56
+ });
57
+
58
+ // On page load, if no cookie has been set then display (un-hide) the header, and hide the adipose-tab:
59
+ if (hasViewedPolicy == null) {
60
+ // Display:
61
+ displayHeader()
62
+ }
63
+ else {
64
+ // if a cookie has been set, you still want to show the adipose-tab but hide the header
65
+ jQuery('#adipose-tab').slideDown(dc_adipose_speed);
66
+ }
67
+
68
+ // action event listener for "show header" event:
69
+ jQuery("#adipose-tab-open").click(function() {
70
+ jQuery('#adipose-tab').slideUp(dc_adipose_speed, function slideShow() {
71
+ jQuery("#cookie-header").slideDown(dc_speed_down);
72
+ });
73
+ });
74
+
75
+ // action event listener to capture delete cookies message
76
+ jQuery("#cookie_policy_delete").click(function() {
77
+ jQuery.cookie(ACCEPT_COOKIE_NAME, null, { expires: 7, path: '/' });
78
+ });
79
+
80
+ // action event listeners to capture "hide" events:
81
+ jQuery("#cookie_policy_close").click(function() {
82
+ // Set cookie:
83
+ jQuery.cookie(ACCEPT_COOKIE_NAME, 'yes', { expires: 7, path: '/' });
84
+ // Hide the header:
85
+ jQuery("#cookie-header").slideUp(dc_speed_up, function slideHide() {
86
+ jQuery('#adipose-tab').slideDown(dc_adipose_speed) });
87
+ });
88
+ }
js/cookielawinfo.js ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function cli_show_cookiebar( html, json_payload ) {
2
+ var ACCEPT_COOKIE_NAME = 'viewed_cookie_policy';
3
+ var ACCEPT_COOKIE_EXPIRE = 365;
4
+ var settings = eval('(' + json_payload +')');
5
+
6
+ jQuery('body').prepend(html);
7
+ var cached_header = jQuery(settings.notify_div_id);
8
+ var cached_showagain_tab = jQuery(settings.showagain_div_id);
9
+ var btn_accept = jQuery('#cookie_hdr_accept');
10
+ var btn_decline = jQuery('#cookie_hdr_decline');
11
+ var btn_moreinfo = jQuery('#cookie_hdr_moreinfo');
12
+ var btn_settings = jQuery('#cookie_hdr_settings');
13
+
14
+ cached_header.hide();
15
+ if ( !settings.showagain_tab ) {
16
+ cached_showagain_tab.hide();
17
+ }
18
+
19
+ var hdr_args = {
20
+ 'background-color': settings.background,
21
+ 'background-image': 'url(' + settings.background_url + ')',
22
+ 'color': settings.text,
23
+ 'font-family': settings.font_family
24
+ };
25
+ var showagain_args = {
26
+ 'background-color': settings.background,
27
+ 'color': l1hs(settings.text),
28
+ 'position': 'fixed',
29
+ 'font-family': settings.font_family
30
+ };
31
+ if ( settings.border_on ) {
32
+ var border_to_hide = 'border-' + settings.notify_position_vertical;
33
+ showagain_args['border'] = '1px solid ' + l1hs(settings.border);
34
+ showagain_args[border_to_hide] = 'none';
35
+ }
36
+ if ( settings.notify_position_vertical == "top" ) {
37
+ if ( settings.border_on ) {
38
+ hdr_args['border-bottom'] = '4px solid ' + l1hs(settings.border);
39
+ }
40
+ showagain_args.top = '0';
41
+ }
42
+ else if ( settings.notify_position_vertical == "bottom" ) {
43
+ if ( settings.border_on ) {
44
+ hdr_args['border-top'] = '4px solid ' + l1hs(settings.border);
45
+ }
46
+ hdr_args['position'] = 'fixed';
47
+ hdr_args['bottom'] = '0';
48
+ showagain_args.bottom = '0';
49
+ }
50
+ if ( settings.notify_position_horizontal == "left" ) {
51
+ showagain_args.left = settings.showagain_x_position;
52
+ }
53
+ else if ( settings.notify_position_horizontal == "right" ) {
54
+ showagain_args.right = settings.showagain_x_position;
55
+ }
56
+ cached_header.css( hdr_args );
57
+ cached_showagain_tab.css( showagain_args );
58
+
59
+ if (jQuery.cookie(ACCEPT_COOKIE_NAME) == null) {
60
+ displayHeader();
61
+ }
62
+ else {
63
+ cached_header.hide();
64
+ }
65
+
66
+ var main_button = jQuery('.cli-plugin-main-button');
67
+ main_button.css( 'color', settings.button_1_link_colour );
68
+
69
+ if ( settings.button_1_as_button ) {
70
+ main_button.css('background-color', settings.button_1_button_colour);
71
+
72
+ main_button.hover(function() {
73
+ jQuery(this).css('background-color', settings.button_1_button_hover);
74
+ },
75
+ function() {
76
+ jQuery(this).css('background-color', settings.button_1_button_colour);
77
+ });
78
+ }
79
+ var main_link = jQuery('.cli-plugin-main-link');
80
+ main_link.css( 'color', settings.button_2_link_colour );
81
+
82
+ if ( settings.button_2_as_button ) {
83
+ main_link.css('background-color', settings.button_2_button_colour);
84
+
85
+ main_link.hover(function() {
86
+ jQuery(this).css('background-color', settings.button_2_button_hover);
87
+ },
88
+ function() {
89
+ jQuery(this).css('background-color', settings.button_2_button_colour);
90
+ });
91
+ }
92
+
93
+ // Action event listener for "show header" event:
94
+ cached_showagain_tab.click(function() {
95
+ cached_showagain_tab.slideUp(settings.animate_speed_hide, function slideShow() {
96
+ cached_header.slideDown(settings.animate_speed_show);
97
+ });
98
+ });
99
+
100
+ // Action event listener to capture delete cookies shortcode click. This simply deletes the viewed_cookie_policy cookie. To use:
101
+ // <a href='#' id='cookielawinfo-cookie-delete' class='cookie_hdr_btn'>Delete Cookies</a>
102
+ jQuery("#cookielawinfo-cookie-delete").click(function() {
103
+ jQuery.cookie(ACCEPT_COOKIE_NAME, null, { expires: 365, path: '/' });
104
+ return false;
105
+ });
106
+
107
+ // Action event listener for debug cookies value link. To use:
108
+ // <a href='#' id='cookielawinfo-debug-cookie'>Show Cookie Value</a>
109
+ jQuery("#cookielawinfo-debug-cookie").click(function() {
110
+ alert("Cookie value: " + jQuery.cookie(ACCEPT_COOKIE_NAME));
111
+ return false;
112
+ });
113
+
114
+ // action event listeners to capture "accept/continue" events:
115
+ jQuery("#cookie_action_close_header").click(function() {
116
+ // Set cookie then hide header:
117
+ jQuery.cookie(ACCEPT_COOKIE_NAME, 'yes', { expires: ACCEPT_COOKIE_EXPIRE, path: '/' });
118
+
119
+ if (settings.notify_animate_hide) {
120
+ cached_header.slideUp(settings.animate_speed_hide);
121
+ }
122
+ else {
123
+ cached_header.hide();
124
+ }
125
+ cached_showagain_tab.slideDown(settings.animate_speed_show);
126
+ return false;
127
+ });
128
+
129
+ function displayHeader() {
130
+ if (settings.notify_animate_show) {
131
+ cached_header.slideDown(settings.animate_speed_show);
132
+ }
133
+ else {
134
+ cached_header.show();
135
+ }
136
+ cached_showagain_tab.hide();
137
+ }
138
+
139
+ };
140
+ function l1hs(str){if(str.charAt(0)=="#"){str=str.substring(1,str.length);}else{return "#"+str;}return l1hs(str);}
js/jquery-ui-1.8.20.custom.min.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.8.20 - 2012-04-30
2
+ * https://github.com/jquery/jquery-ui
3
+ * Includes: jquery.ui.core.js
4
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
5
+ (function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.20",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30
6
+ * https://github.com/jquery/jquery-ui
7
+ * Includes: jquery.ui.widget.js
8
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
9
+ (function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30
10
+ * https://github.com/jquery/jquery-ui
11
+ * Includes: jquery.ui.accordion.js
12
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
13
+ (function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.20",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);;
js/jquery.cookie.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Cookie Plugin
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2011, Klaus Hartl
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.opensource.org/licenses/GPL-2.0
9
+ */
10
+ (function(jQuery) {
11
+ jQuery.cookie = function(key, value, options) {
12
+
13
+ // key and at least value given, set cookie...
14
+ if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
15
+ options = jQuery.extend({}, options);
16
+
17
+ if (value === null || value === undefined) {
18
+ options.expires = -1;
19
+ }
20
+
21
+ if (typeof options.expires === 'number') {
22
+ var days = options.expires, t = options.expires = new Date();
23
+ t.setDate(t.getDate() + days);
24
+ }
25
+
26
+ value = String(value);
27
+
28
+ return (document.cookie = [
29
+ encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
30
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
31
+ options.path ? '; path=' + options.path : '',
32
+ options.domain ? '; domain=' + options.domain : '',
33
+ options.secure ? '; secure' : ''
34
+ ].join(''));
35
+ }
36
+
37
+ // key and possibly options given, get cookie...
38
+ options = value || {};
39
+ var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
40
+
41
+ var pairs = document.cookie.split('; ');
42
+ for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
43
+ if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
44
+ }
45
+ return null;
46
+ };
47
+ })(jQuery);
php/custom-post-types.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ ===============================================================================
4
+
5
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
6
+
7
+ This program is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License, version 2, as
9
+ published by the Free Software Foundation.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+
22
+ /** Registers custom post type*/
23
+ function cookielawinfo_register_custom_post_type() {
24
+ $labels = array(
25
+ 'name' => _x('Cookie Law Info', 'post type general name'),
26
+ 'singular_name' => _x('Cookie', 'post type singular name'),
27
+ 'add_new' => _x('Add New', 'cookie type'),
28
+ 'add_new_item' => __('Add New Cookie Type'),
29
+ 'edit_item' => __('Edit Cookie Type'),
30
+ 'new_item' => __('New Cookie Type'),
31
+ 'view_item' => __('View Cookie Type'),
32
+ 'search_items' => __('Search Cookies'),
33
+ 'not_found' => __('Nothing found'),
34
+ 'not_found_in_trash' => __('Nothing found in Trash'),
35
+ 'parent_item_colon' => ''
36
+ );
37
+ $args = array(
38
+ 'labels' => $labels,
39
+ 'public' => true,
40
+ 'publicly_queryable' => true,
41
+ 'show_ui' => true,
42
+ 'query_var' => true,
43
+ //'menu_icon' => CLI_PLUGIN_URL . '/images/icon.gif',
44
+ 'rewrite' => true,
45
+ 'capability_type' => 'post',
46
+ 'hierarchical' => false,
47
+ 'menu_position' => null,
48
+ 'supports' => array( 'title','editor','thumbnail' )
49
+ );
50
+ register_post_type( 'cookielawinfo' , $args );
51
+ }
52
+
53
+
54
+ /**
55
+ Add custom meta boxes to Cookie Audit custom post type.
56
+ - Cookie Type (e.g. session, permanent)
57
+ - Cookie Duration (e.g. 2 hours, days, years, etc)
58
+ */
59
+ function cookielawinfo_custom_posts_admin_init() {
60
+ add_meta_box("cookie_type", "Cookie Type", "cookielawinfo_cookie_type", "cookielawinfo", "normal", "low");
61
+ add_meta_box("cookie_duration", "Cookie Duration", "cookielawinfo_cookie_duration", "cookielawinfo", "normal", "low");
62
+ }
63
+
64
+
65
+ /** Display the custom meta box for cookie_type */
66
+ function cookielawinfo_cookie_type() {
67
+ global $post;
68
+ $custom = get_post_custom( $post->ID );
69
+ $cookie_type = $custom["cookie_type"][0];
70
+ ?>
71
+ <label>Cookie Type:</label>
72
+ <input name="cookie_type" value="<?php echo sanitize_text_field( $cookie_type ); ?>" />
73
+ <?php
74
+ }
75
+
76
+
77
+ /** Display the custom meta box for cookie_duration */
78
+ function cookielawinfo_cookie_duration() {
79
+ global $post;
80
+ $custom = get_post_custom( $post->ID );
81
+ $cookie_duration = $custom["cookie_duration"][0];
82
+ ?>
83
+ <label>Cookie Duration:</label>
84
+ <input name="cookie_duration" value="<?php echo sanitize_text_field( $cookie_duration ); ?>" />
85
+ <?php
86
+ }
87
+
88
+
89
+ /** Saves all form data from custom post meta boxes, including saitisation of input */
90
+ function cookielawinfo_save_custom_metaboxes(){
91
+ global $post;
92
+ update_post_meta( $post->ID, "cookie_type", sanitize_text_field( $_POST["cookie_type"] ) );
93
+ update_post_meta( $post->ID, "cookie_duration", sanitize_text_field( $_POST["cookie_duration"] ) );
94
+ }
95
+
96
+
97
+ /** Apply column names to the custom post type table */
98
+ function cookielawinfo_edit_columns( $columns ) {
99
+ $columns = array(
100
+ "cb" => "<input type=\"checkbox\" />",
101
+ "title" => "Cookie Name",
102
+ "type" => "Type",
103
+ "duration" => "Duration",
104
+ "description" => "Description"
105
+ );
106
+ return $columns;
107
+ }
108
+
109
+
110
+ /** Add column data to custom post type table columns */
111
+ function cookielawinfo_custom_columns( $column ) {
112
+ global $post;
113
+
114
+ switch ( $column ) {
115
+ case "description":
116
+ the_excerpt();
117
+ break;
118
+ case "type":
119
+ $custom = get_post_custom();
120
+ echo $custom["cookie_type"][0];
121
+ break;
122
+ case "duration":
123
+ $custom = get_post_custom();
124
+ echo $custom["cookie_duration"][0];
125
+ break;
126
+ }
127
+ }
128
+
129
+ ?>
php/functions.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2, as
7
+ published by the Free Software Foundation.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+
20
+ /**
21
+ Returns JSON object containing the settings for the main script
22
+ REFACTOR / DEBUG: may need to use addslashes( ... ) else breaks JSON
23
+ */
24
+ function cookielawinfo_get_json_settings() {
25
+ $settings = cookielawinfo_get_admin_settings();
26
+
27
+ // DEBUG hex:
28
+ // preg_match('/^#[a-f0-9]{6}|#[a-f0-9]{3}$/i', $hex)
29
+ // DEBUG json_encode - issues across different versions of PHP!
30
+ // $str = json_encode( $slim_settings, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP );
31
+
32
+ // Slim down JSON objects to the bare bones:
33
+ $slim_settings = array(
34
+ 'animate_speed_hide' => $settings['animate_speed_hide'],
35
+ 'animate_speed_show' => $settings['animate_speed_show'],
36
+ 'background' => $settings['background'],
37
+ 'border' => $settings['border'],
38
+ 'border_on' => $settings['border_on'],
39
+ 'button_1_button_colour' => $settings['button_1_button_colour'],
40
+ 'button_1_button_hover' => (su_hex_shift( $settings['button_1_button_colour'], 'down', 20 )),
41
+ 'button_1_link_colour' => $settings['button_1_link_colour'],
42
+ 'button_1_as_button' => $settings['button_1_as_button'],
43
+ 'button_2_button_colour' => $settings['button_2_button_colour'],
44
+ 'button_2_button_hover' => (su_hex_shift( $settings['button_2_button_colour'], 'down', 20 )),
45
+ 'button_2_link_colour' => $settings['button_2_link_colour'],
46
+ 'button_2_as_button' => $settings['button_2_as_button'],
47
+ 'font_family' => $settings['font_family'],
48
+ 'notify_animate_hide' => $settings['notify_animate_hide'],
49
+ 'notify_animate_show' => $settings['notify_animate_show'],
50
+ 'notify_div_id' => $settings['notify_div_id'],
51
+ 'notify_position_horizontal' => $settings['notify_position_horizontal'],
52
+ 'notify_position_vertical' => $settings['notify_position_vertical'],
53
+ 'showagain_tab' => $settings['showagain_tab'],
54
+ 'showagain_background' => $settings['showagain_background'],
55
+ 'showagain_border' => $settings['showagain_border'],
56
+ 'showagain_div_id' => $settings['showagain_div_id'],
57
+ 'showagain_x_position' => $settings['showagain_x_position'],
58
+ 'text' => $settings['text']
59
+ );
60
+ $str = json_encode( $slim_settings );
61
+ /*
62
+ DEBUG:
63
+ if ( $str == null | $str == '') {
64
+ $str = 'error: json is empty';
65
+ }
66
+ */
67
+ return $str;
68
+ }
69
+
70
+
71
+ /**
72
+ Outputs the cookie control script in the footer
73
+ N.B. This script MUST be output in the footer.
74
+
75
+ This function should be attached to the wp_footer action hook.
76
+ */
77
+ function cookielawinfo_inject_cli_script() {
78
+ $the_options = cookielawinfo_get_admin_settings();
79
+
80
+ if ( $the_options['is_on'] == true ) {
81
+
82
+ // $str processes shortcodes:
83
+ $str = addslashes ( do_shortcode( stripslashes ( $the_options['notify_message'] ) ) );
84
+
85
+ // You can construct your own HTML and CSS here if needed.
86
+ $notify_html = '<div id="' . cookielawinfo_remove_hash( $the_options["notify_div_id"] ) . '"><span>' . $str . '</span></div>';
87
+
88
+ if ( $the_options['showagain_tab'] === true ) {
89
+ $notify_html .= '<div id="' . cookielawinfo_remove_hash( $the_options["showagain_div_id"] ) . '"><span="#" id="cookie_hdr_showagain">' . $the_options["showagain_text"] . '</span></div>';
90
+ }
91
+
92
+ echo '<script type="text/javascript">';
93
+ echo ' jQuery(document).ready(function() {';
94
+ echo " cli_show_cookiebar('" . $notify_html . "', '" . cookielawinfo_get_json_settings() . "');";
95
+ echo ' });';
96
+ echo '</script>';
97
+ }
98
+ }
99
+
100
+
101
+ /**
102
+ Outputs frontend scripts in the header.
103
+ N.B. These scripts MUST be output in the header.
104
+
105
+ This function should be attached to the wp_enqueue_script action hook, not wp_head!
106
+ Else gets output in footer (incorrect).
107
+ */
108
+ function cookielawinfo_enqueue_frontend_scripts() {
109
+ $the_options = cookielawinfo_get_admin_settings();
110
+ if ( $the_options['is_on'] == true ) {
111
+ wp_enqueue_script( 'jquery-cookie', CLI_PLUGIN_URL . 'js/jquery.cookie.js', array('jquery') );
112
+
113
+ wp_register_style( 'cookielawinfo-style', CLI_PLUGIN_URL . 'css/cli-style.css' );
114
+ wp_enqueue_style( 'cookielawinfo-style' );
115
+
116
+ // 0.9:
117
+ wp_enqueue_script( 'cookie-law-info-script', CLI_PLUGIN_URL . 'js/cookielawinfo.js', array( 'jquery' ) );
118
+ }
119
+ wp_register_style( 'cookielawinfo-table-style', CLI_PLUGIN_URL . 'css/cli-tables.css' );
120
+ wp_enqueue_style( 'cookielawinfo-table-style' );
121
+ }
122
+
123
+
124
+ /**
125
+ * Color shift a hex value by a specific percentage factor
126
+ * By http://www.phpkode.com/source/s/shortcodes-ultimate/shortcodes-ultimate/lib/color.php
127
+ * Adapted by Richard Ashby; amended error handling to use failovers not messages, so app continues
128
+ *
129
+ * @param string $supplied_hex Any valid hex value. Short forms e.g. #333 accepted.
130
+ * @param string $shift_method How to shift the value e.g( +,up,lighter,>)
131
+ * @param integer $percentage Percentage in range of [0-100] to shift provided hex value by
132
+ * @return string shifted hex value
133
+ * @version 1.0 2008-03-28
134
+ */
135
+ function su_hex_shift( $supplied_hex, $shift_method, $percentage = 50 ) {
136
+ $shifted_hex_value = null;
137
+ $valid_shift_option = FALSE;
138
+ $current_set = 1;
139
+ $RGB_values = array( );
140
+ $valid_shift_up_args = array( 'up', '+', 'lighter', '>' );
141
+ $valid_shift_down_args = array( 'down', '-', 'darker', '<' );
142
+ $shift_method = strtolower( trim( $shift_method ) );
143
+
144
+ // Check Factor
145
+ if ( !is_numeric( $percentage ) || ($percentage = ( int ) $percentage) < 0 || $percentage > 100 ) {
146
+ //trigger_error( "Invalid factor", E_USER_ERROR );
147
+ return $supplied_hex;
148
+ }
149
+
150
+ // Check shift method
151
+ foreach ( array( $valid_shift_down_args, $valid_shift_up_args ) as $options ) {
152
+ foreach ( $options as $method ) {
153
+ if ( $method == $shift_method ) {
154
+ $valid_shift_option = !$valid_shift_option;
155
+ $shift_method = ( $current_set === 1 ) ? '+' : '-';
156
+ break 2;
157
+ }
158
+ }
159
+ ++$current_set;
160
+ }
161
+
162
+ if ( !$valid_shift_option ) {
163
+ //trigger_error( "Invalid shift method", E_USER_ERROR );
164
+ return $supplied_hex;
165
+ }
166
+
167
+ // Check Hex string
168
+ switch ( strlen( $supplied_hex = ( str_replace( '#', '', trim( $supplied_hex ) ) ) ) ) {
169
+ case 3:
170
+ if ( preg_match( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', $supplied_hex ) ) {
171
+ $supplied_hex = preg_replace( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', '\\1\\1\\2\\2\\3\\3', $supplied_hex );
172
+ } else {
173
+ //trigger_error( "Invalid hex color value", E_USER_ERROR );
174
+ return $supplied_hex;
175
+ }
176
+ break;
177
+ case 6:
178
+ if ( !preg_match( '/^[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}$/i', $supplied_hex ) ) {
179
+ //trigger_error( "Invalid hex color value", E_USER_ERROR );
180
+ return $supplied_hex;
181
+ }
182
+ break;
183
+ default:
184
+ //trigger_error( "Invalid hex color length", E_USER_ERROR );
185
+ return $supplied_hex;
186
+ }
187
+
188
+ // Start shifting
189
+ $RGB_values['R'] = hexdec( $supplied_hex{0} . $supplied_hex{1} );
190
+ $RGB_values['G'] = hexdec( $supplied_hex{2} . $supplied_hex{3} );
191
+ $RGB_values['B'] = hexdec( $supplied_hex{4} . $supplied_hex{5} );
192
+
193
+ foreach ( $RGB_values as $c => $v ) {
194
+ switch ( $shift_method ) {
195
+ case '-':
196
+ $amount = round( ((255 - $v) / 100) * $percentage ) + $v;
197
+ break;
198
+ case '+':
199
+ $amount = $v - round( ($v / 100) * $percentage );
200
+ break;
201
+ default:
202
+ // trigger_error( "Oops. Unexpected shift method", E_USER_ERROR );
203
+ return $supplied_hex;
204
+ }
205
+
206
+ $shifted_hex_value .= $current_value = (
207
+ strlen( $decimal_to_hex = dechex( $amount ) ) < 2
208
+ ) ? '0' . $decimal_to_hex : $decimal_to_hex;
209
+ }
210
+
211
+ return '#' . $shifted_hex_value;
212
+ }
213
+
214
+
215
+ /** Removes leading # characters from a string */
216
+ function cookielawinfo_remove_hash( $str ) {
217
+ if ( $str{0} == "#" ) {
218
+ $str = substr( $str, 1, strlen($str) );
219
+ }
220
+ else {
221
+ return $str;
222
+ }
223
+ return cookielawinfo_remove_hash( $str );
224
+ }
225
+
226
+
227
+ /**
228
+ Explodes hex colour from 3 to 6 characters.
229
+ If string is not 3 chars on input, will return original string
230
+ */
231
+ function cookielawinfo_make_hex_colour_6_chars( $hex ) {
232
+ $str = cookielawinfo_remove_hash( $hex );
233
+ if ( strlen( $str ) == 3 ) {
234
+ $hex = '#' . $str[0] . $str[0] . $str[1] . $str[1] . $str[2] . $str[2];
235
+ }
236
+ return $hex;
237
+ }
238
+
239
+
240
+ /** Debug assistance: JS alertbox for any passed value of $gubbins */
241
+ function cookielawinfo_debug_alertbox( $gubbins ) {
242
+ if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
243
+ return;
244
+ echo '<script type="text/javascript"> alert("' . $gubbins .'")</script>';
245
+ }
246
+
247
+
248
+ /** Echoes out a debug string of your choice (but only if in development mode) */
249
+ function cookielawinfo_debug_echo( $gubbins ) {
250
+ if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
251
+ return;
252
+ echo '<br />START OF DEBUG STRING>>>' . $gubbins . '<<< END OF DEBUG STRING<br />';
253
+ }
254
+
255
+
256
+ /** Debug: output saved settings to footer of admin panel */
257
+ function cookielawinfo_debug_admin_settings( $break ) {
258
+ if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
259
+ return;
260
+ $settings = cookielawinfo_get_admin_settings();
261
+ $ret = '<p>Settings: ';
262
+ foreach ( $settings as $key => $option ) {
263
+ $ret .= $key . ' = ' . $option . '; ';
264
+ if ( $break )
265
+ $ret .= '<br />';
266
+ }
267
+ $ret .= '</p>';
268
+ return $ret;
269
+ }
270
+
271
+ /* Debug script for JS: var s=eval("("+json_payload+")");var t='';for(p in s){if(!s.hasOwnProperty(p)){continue;}t+=p+" = "+s[p]+"\n";}alert(t);alert(html); */
272
+
273
+ ?>
php/shortcodes.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ ===============================================================================
4
+
5
+ Copyright 2012 Richard Ashby (email : richard.ashby@mediacreek.com)
6
+
7
+ This program is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License, version 2, as
9
+ published by the Free Software Foundation.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program; if not, write to the Free Software
18
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ */
21
+
22
+
23
+ /**
24
+ A shortcode that outputs a link which will delete the cookie used to track
25
+ whether or not a vistor has dismissed the header message (i.e. so it doesn't
26
+ keep on showing on all pages)
27
+
28
+ Usage: [delete_cookies]
29
+ [delete_cookies linktext="delete cookies"]
30
+
31
+ N.B. This shortcut does not block cookies, or delete any other cookies!
32
+ */
33
+ function cookielawinfo_delete_cookies_shortcode( $atts ) {
34
+ extract( shortcode_atts( array(
35
+ 'text' => 'Delete Cookies'
36
+ ), $atts ) );
37
+ return "<a href='' id='cookielawinfo-cookie-delete'>{$text}</a>";
38
+ }
39
+
40
+
41
+ /**
42
+ A nice shortcode to output a table of cookies you have saved, output in ascending
43
+ alphabetical order. If there are no cookie records found a single empty row is shown.
44
+ You can customise the 'not shown' message (see commented code below)
45
+
46
+ N.B. This only shows the information you entered on the "cookie" admin page, it
47
+ does not necessarily mean you comply with the cookie law. It is up to you, or
48
+ the website owner, to make sure you have conducted an appropriate cookie audit
49
+ and are informing website visitors of the actual cookies that are being stored.
50
+
51
+ Usage: [cookie_audit]
52
+ [cookie_audit style="winter"]
53
+ [cookie_audit not_shown_message="No records found"]
54
+ [cookie_audit style="winter" not_shown_message="Not found"]
55
+
56
+ Styles included: simple, classic, modern, rounded, elegant, winter.
57
+ Default style applied: classic.
58
+
59
+ Additional styles: You can customise the CSS by editing the CSS file itself,
60
+ included with plugin.
61
+ */
62
+ function cookielawinfo_table_shortcode( $atts ) {
63
+ extract( shortcode_atts( array(
64
+ 'style' => 'classic',
65
+ 'not_shown_message' => ''
66
+ ), $atts ) );
67
+
68
+ $args = array(
69
+ 'post_type' => 'cookielawinfo',
70
+ 'posts_per_page' => 10,
71
+ 'order' => 'ASC',
72
+ 'orderby' => 'title'
73
+ );
74
+ $cookies = new WP_Query( $args );
75
+
76
+ $ret = '<table class="cookielawinfo-' . $style . '"><thead>';
77
+ $ret .= '<th class="cookielawinfo-column-1">Cookie</th>';
78
+ $ret .= '<th class="cookielawinfo-column-2">Type</th>';
79
+ $ret .= '<th class="cookielawinfo-column-3">Duration</th>';
80
+ $ret .= '<th class="cookielawinfo-column-4">Description</th>';
81
+ $ret .= '</thead><tbody>';
82
+
83
+ if ( !$cookies->have_posts() ) {
84
+ $ret .= '<tr class="cookielawinfo-row"><td colspan="2" class="cookielawinfo-column-empty">' . $not_shown_message . '</td></tr>';
85
+ }
86
+
87
+ while ( $cookies->have_posts() ) : $cookies->the_post();
88
+ // Get custom fields:
89
+ $custom = get_post_custom( $post->ID );
90
+ $cookie_type = $custom["cookie_type"][0];
91
+ $cookie_duration = $custom["cookie_duration"][0];
92
+ // Output HTML:
93
+ $ret .= '<tr class="cookielawinfo-row"><td class="cookielawinfo-column-1">' . get_the_title() . '</td>';
94
+ $ret .= '<td class="cookielawinfo-column-2">' . $cookie_type .'</td>';
95
+ $ret .= '<td class="cookielawinfo-column-3">' . $cookie_duration .'</td>';
96
+ $ret .= '<td class="cookielawinfo-column-4">' . get_the_content() .'</td>';
97
+ $ret .= '</tr>';
98
+ endwhile;
99
+ $ret .= '</tbody></table>';
100
+ return $ret;
101
+ }
102
+
103
+
104
+ /** Returns HTML for a standard (green, medium sized) 'Accept' button */
105
+ function cookielawinfo_shortcode_accept_button( $atts ) {
106
+ extract( shortcode_atts( array(
107
+ 'colour' => 'green'
108
+ ), $atts ) );
109
+ return '<a href="#" id="cookie_action_close_header" class="medium cli-plugin-button ' . $colour . '">Accept</a>';
110
+ }
111
+
112
+
113
+ /** Returns HTML for a generic button */
114
+ function cookielawinfo_shortcode_more_link( $atts ) {
115
+ /*
116
+ $defaults = array(
117
+ 'button_2_text' => 'Accept',
118
+ 'button_2_url' => '#',
119
+ 'button_2_action' => '#cookie_action_close_header',
120
+
121
+ 'button_2_link_colour' => '#fff',
122
+ 'button_2_new_win' => false,
123
+ 'button_2_as_button' => true,
124
+ 'button_2_button_colour' => '0f0',
125
+ 'button_2_button_size' => 'medium'
126
+ );
127
+ $settings = wp_parse_args( cookielawinfo_get_admin_settings(), $defaults );
128
+
129
+ $class = '';
130
+ if ( $settings['button_2_as_button'] ) {
131
+ $class .= ' class="' . $settings['button_2_button_size'] . ' cli-plugin-button orange"';
132
+ }
133
+ else {
134
+ $class .= ' style="color:' . $settings['button_2_link_colour'] . ' !important;text-decoration:underline;"' ;
135
+ }
136
+
137
+ // If is action not URL then don't use URL!
138
+ $url = ( $settings['button_2_action'] == "CONSTANT_OPEN_URL" ) ? $settings['button_2_url'] : "#";
139
+
140
+ $link_tag = '<a href="' . $url . '" id="' . cookielawinfo_remove_hash ( $settings['button_2_action'] ) . '" ';
141
+ $link_tag .= ( $settings['button_2_new_win'] ) ? 'target="_new" ' : '' ;
142
+ $link_tag .= $class . ' >' . $settings['button_2_text'] . '</a>';
143
+
144
+ return $link_tag;
145
+ */
146
+ return cookielawinfo_shortcode_button_DRY_code( 'button_2' );
147
+ }
148
+
149
+
150
+ /** Returns HTML for a generic button */
151
+ function cookielawinfo_shortcode_main_button( $atts ) {
152
+ $defaults = array(
153
+ 'button_1_text' => 'Accept',
154
+ 'button_1_url' => '#',
155
+ 'button_1_action' => '#cookie_action_close_header',
156
+
157
+ 'button_1_link_colour' => '#fff',
158
+ 'button_1_new_win' => false,
159
+ 'button_1_as_button' => true,
160
+ 'button_1_button_colour' => '0f0',
161
+ 'button_1_button_size' => 'medium'
162
+ );
163
+ $settings = wp_parse_args( cookielawinfo_get_admin_settings(), $defaults );
164
+
165
+ $class = '';
166
+ if ( $settings['button_1_as_button'] ) {
167
+ $class .= ' class="' . $settings['button_1_button_size'] . ' cli-plugin-button cli-plugin-main-button"';
168
+ }
169
+ else {
170
+ $class .= ' class="cli-plugin-main-button" ' ;
171
+ }
172
+
173
+ // If is action not URL then don't use URL!
174
+ $url = ( $settings['button_1_action'] == "CONSTANT_OPEN_URL" ) ? $settings['button_1_url'] : "#";
175
+
176
+ $link_tag = '<a href="' . $url . '" id="' . cookielawinfo_remove_hash ( $settings['button_1_action'] ) . '" ';
177
+ $link_tag .= ( $settings['button_1_new_win'] ) ? 'target="_new" ' : '' ;
178
+ $link_tag .= $class . ' >' . $settings['button_1_text'] . '</a>';
179
+
180
+ return $link_tag;
181
+ }
182
+
183
+ /** Returns HTML for a generic button */
184
+ function cookielawinfo_shortcode_button_DRY_code( $name ) {
185
+ $arr = cookielawinfo_get_admin_settings();
186
+ $settings = array();
187
+ $class_name = '';
188
+
189
+ if ( $name == "button_1" ) {
190
+ $settings = array(
191
+ 'button_x_text' => $arr['button_1_text'],
192
+ 'button_x_url' => $arr['button_1_url'],
193
+ 'button_x_action' => $arr['button_1_action'],
194
+
195
+ 'button_x_link_colour' => $arr['button_1_link_colour'],
196
+ 'button_x_new_win' => $arr['button_1_new_win'],
197
+ 'button_x_as_button' => $arr['button_1_as_button'],
198
+ 'button_x_button_colour' => $arr['button_1_button_colour'],
199
+ 'button_x_button_size' => $arr['button_1_button_size']
200
+ );
201
+ $class_name = 'cli-plugin-main-button';
202
+ }
203
+ elseif ( $name == "button_2" ) {
204
+ $settings = array(
205
+ 'button_x_text' => $arr['button_2_text'],
206
+ 'button_x_url' => $arr['button_2_url'],
207
+ 'button_x_action' => $arr['button_2_action'],
208
+
209
+ 'button_x_link_colour' => $arr['button_2_link_colour'],
210
+ 'button_x_new_win' => $arr['button_2_new_win'],
211
+ 'button_x_as_button' => $arr['button_2_as_button'],
212
+ 'button_x_button_colour' => $arr['button_2_button_colour'],
213
+ 'button_x_button_size' => $arr['button_2_button_size']
214
+ );
215
+ $class_name = 'cli-plugin-main-link';
216
+ }
217
+
218
+ $class = '';
219
+ if ( $settings['button_x_as_button'] ) {
220
+ $class .= ' class="' . $settings['button_x_button_size'] . ' cli-plugin-button ' . $class_name . '"';
221
+ }
222
+ else {
223
+ $class .= ' class="' . $class_name . '" ' ;
224
+ }
225
+
226
+ // If is action not URL then don't use URL!
227
+ $url = ( $settings['button_x_action'] == "CONSTANT_OPEN_URL" ) ? $settings['button_x_url'] : "#";
228
+
229
+ $link_tag = '<a href="' . $url . '" id="' . cookielawinfo_remove_hash ( $settings['button_x_action'] ) . '" ';
230
+ $link_tag .= ( $settings['button_x_new_win'] ) ? 'target="_new" ' : '' ;
231
+ $link_tag .= $class . ' >' . $settings['button_x_text'] . '</a>';
232
+
233
+ return $link_tag;
234
+ }
235
+
236
+
237
+ ?>
readme.txt ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: richardashby
3
+ Donate link: http://www.movember.com/
4
+ Tags: eu cookie law, cookie law, eu privacy directive, privacy directive, cookies, privacy, compliance
5
+ Requires at least: 3.3.1
6
+ Tested up to: 3.3.2
7
+ Stable tag: 1.0.1
8
+ License: GPLv2
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ *UPDATED* A simple way to show how your website complies with the EU Cookie Law, which came into force on 26 May 2012.
12
+
13
+ == Description ==
14
+
15
+ This plugin adds a subtle banner to your website, either in the header or footer, to highlight your compliance status regarding the new EU Cookie Law.
16
+
17
+
18
+ It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
19
+
20
+
21
+ Inline with official ICO guidelines and current industry best practice, this plugin uses 'implied consent' to aid you in showing your compliance status. This is a deliberate design choice that does not proactively block cookies: it doesn't make your visitors take action before they can use your website, and will not interfere with blog comments and [Google] Analytics. This approach is aimed at reducing website visitor dropout and maintaining your vital analytics data.
22
+
23
+
24
+ Note: the EU Cookie Law is officially called the 'EU ePrivacy Directive'.
25
+
26
+
27
+ For a demo, [check out the EU Cookie Law website](http://www.cookielawinfo.com/ "Demo the EU Cookie Law plugin"), including the table of cookies on the Privacy Policy page.
28
+
29
+
30
+ Features:
31
+
32
+ * Fully customisable dropdown header: position, colours, styles, fonts, use HTML and shortcodes
33
+ * Website visitors can dismiss the message, so that will not be shown again (uses a cookie)
34
+ * Optional "show again" tab - fully customisable including position shown on page
35
+ * NEW: "Cookie Audit" shortcode to construct a nicely-styled 'Privacy & Cookie Policy'
36
+ * NEW: shortcodes for fancy button styles
37
+ * Shortcode to allow visitor to delete cookie used to control header
38
+ * Able to switch header on/off without losing settings or having to disable plugin
39
+ * NEW: improved user interface
40
+ * NEW: improved help section
41
+
42
+ Coming soon:
43
+
44
+ * Language translations
45
+ * Cookie Law Info Plus - even more customisation and cookie control features
46
+
47
+ [Read more about the EU Cookie Law](http://www.cookielawinfo.com/ "More information about the EU Cookie Law")
48
+
49
+
50
+ == Installation ==
51
+
52
+ This section describes how to install the plugin and get it working.
53
+
54
+ 1. Upload the `cookie-law-info` folder to the `/wp-content/plugins/` directory
55
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
56
+ 3. Go to "Cookie Law Info / Cookie Law Settings" to configure the banner with your own text, colours and styles
57
+
58
+ To set up your Privacy & Cookie Policy Page:
59
+
60
+ 1. Add descriptions of the cookies your site uses. Go to "Cookie Law Info / Add New".
61
+ 2. Add a new page called e.g. Privacy and Cookie Policy
62
+ 3. Add the [cookie_audit] shortcode to your Privacy & Cookie Policy Page
63
+
64
+ Cookie table shortcode usage:
65
+
66
+ [cookie_audit]
67
+ [cookie_audit style="winter"]
68
+ [cookie_audit not_shown_message="No records found"]
69
+ [cookie_audit style="winter" not_shown_message="Not found"]
70
+
71
+ Parameters:
72
+
73
+ style (optional) - choose one of several table styles included with the plugin. Styles included: simple, classic, modern, rounded, elegant, winter (styles are cAsE sensitive). Default style applied: classic.
74
+ not_shown_message (optional) - if no cookie records are found, display this text. Default is blank (i.e. no message shown).
75
+
76
+
77
+ Delete header cookie usage:
78
+
79
+ [delete_cookies]
80
+ [delete_cookies linktext="delete cookies"]
81
+
82
+ Parameters:
83
+
84
+ linktext (optional) - the text shown in the link. Default is "Delete Cookies".
85
+
86
+
87
+ == Frequently Asked Questions ==
88
+
89
+ = What is the EU Cookie Law? =
90
+ More correctly, this is called the 'EU e-Privacy Directive'. Popular media refers to it as the 'EU Cookie Law'.
91
+ Under new EU privacy regulations, websites must make it clear to visitors what information about them is being stored. This specifically includes cookies. Even if cookies do not store information identifying an individual, you must still provide your visitor with information on what is being stored, by whom, what for, and so on.
92
+
93
+ Certain cookies are exempt from this- those deemed to be "strictly necessary" (e.g. WordPress stores session cookies for authentication, without these it wouldn't work) however cookies stored by analytics software like Google Analytics do not fall into this category.
94
+ See www.cookielawinfo.com for more information.
95
+
96
+ = What does this plugin do? =
97
+ This plugin will:
98
+
99
+ 1. Add a banner to the top of all pages on your website, notifying the visitor that you have a clearly defined privacy and cookie policy.
100
+ 2. Allow you to record which cookies your site uses, and:
101
+ 3. Neatly display a list of these cookies (via a shortcode). You can put this list on your Privacy & Cookie Policy page, for example.
102
+
103
+ = Does this plugin block all cookies? =
104
+ No, and neither does any other WordPress plugin - be aware that despite what you may believe, it is not currently technically possible to completely block all cookies on your WordPress website without first updating all plugins that use cookies in some way. That is beyond the scope of any single plugin.
105
+ A more realistic approach for WordPress website owners is to use what is called "implied consent". This should not be a message buried on your website rather something more prominent that is clear to your visitors. This plugin can be used to highlight your compliance status and use of cookies in this way.
106
+
107
+
108
+ = I'm not a UK/EU citizen, how can this law apply to me? =
109
+ If you have a significant proportion of visitors from the EU then this law also applies to you.
110
+ See www.cookielawinfo.com for more information.
111
+
112
+ = My website is not hosted in the UK/EU, am I exempt? =
113
+ No. The law is about protecting the privacy of EU citizens, so if your website has a significant proportion of visitors from the EU then this law also applies to you.
114
+ See www.cookielawinfo.com for more information.
115
+
116
+ = Do visitors now have to accept/refuse cookies in order to use websites? =
117
+ In short, no, although there is a great deal of ambiguity and misinformation around this law. What the law really gets at is privacy, not just cookies. The UK government, for example, plan on using a version of what is called "implied consent" on their own websites, which is a technique similar to what this plugin does.
118
+
119
+ Online Marketing experts Econsultancy provide their perspective on this interpretation. This plugin follows the same approach.
120
+
121
+ Further reading:
122
+
123
+ 1. [UK Cabinet Office approach](http://digital.cabinetoffice.gov.uk/2012/03/19/its-not-about-cookies-its-about-privacy/ "UK Government approach to the EU Cookie Law")
124
+ 2. [Econsultancy's solution](http://econsultancy.com/us/blog/9453-econsultancy-s-solution-to-eu-e-privacy-directive-compliance/ "Econsultancy's solution")
125
+
126
+ = Does this plugin stop cookies from being stored? =
127
+ No. Quite intentionally, this plugin will not do that. We have no way of knowing what plugins you use or how they work, so blocking/deleting cookies on a WordPress website/blog would possibly/probably break your site. Larger websites with huge budgets may well invest in such technology, but this plugin aims to help you provide a certain level of compliance without taking drastic action. If you do want blocking/deleting cookie functionality then (for now *) this is not the right plugin for you.
128
+
129
+ (*) Depending upon demand, this feature might be included in a future release.
130
+
131
+ = Does this plugin guarantee that I comply with this law? =
132
+ No.
133
+ As a generic plugin there's no way we can know anything about your specific circumstances. It can be used as part of an overall plan of action to comply, but just installing it and doing nothing more does nothing to help you. In all cases, you need to assess your own website's use of cookies and decide an appropriate course of action. If you are looking for specialist legal advice relating to your website you should always consult a lawyer.
134
+ See www.cookielawinfo.com for more information on what is required.
135
+
136
+ = The cookie law doesn't make much sense. How can we stop it? =
137
+ Many people agree with you. However it is here, it is law, and according to the Information Commissioner's Office (AKA 'the ICO') it will be enforced. We think it's best to take action to comply as well as petition. However there's no point just ignoring it, it is already here.
138
+
139
+ = How do I comply with the EU e-Privacy Directive (AKA 'the EU Cookie Law')? =
140
+ There are various interpretations of the law within the industry, and as such there is no simple answer. But the main way to ensure you are not penalised is to make some attempt at complying- reviewing your cookie use then using a plugin like this one is a good first step.
141
+ See www.cookielawinfo.com for more information.
142
+
143
+ = The cookie header isn't displaying =
144
+ First check you have installed the plugin and have activated it in the plugins panel.
145
+ To check if it is switched on or not, go to 'Settings / Cookie Law Info' and then enable the header by setting 'Display cookie bar?' to 'yes'.
146
+
147
+ = It would be great if your plugin also did XYZ =
148
+ Please email me and I'll consider adding that feature. It would be great to hear suggestions on how to improve it.
149
+
150
+ = The header doesn't work on my browser =
151
+ Please report a bug on the support forum. Be sure to include the following information:
152
+
153
+ * WordPress version e.g. 3.3.2 (found in bottom right hand corner of dashboard)
154
+ * Browser name and version e.g. FireFox 4.1
155
+ * Describe the problem
156
+
157
+ The more information you give, the quicker I can respond.
158
+
159
+ == Screenshots ==
160
+
161
+ 1. Cookie bar in footer (with default styles)
162
+ 2. Cookie bar "show again tab" (optional- can be switched off or position can be changed)
163
+ 3. Admin panel
164
+ 4. Cookie Audit - list your cookies
165
+ 5. Cookie table displayed on your Privacy Policy page
166
+
167
+ == Changelog ==
168
+
169
+ = 0.8.3 =
170
+ * First public release.
171
+
172
+ = 0.9 =
173
+ * Improved design & appearance
174
+ * Cookie Law Info bar can be shown in header or footer
175
+ * Customise fonts
176
+ * New animations on page load / close header
177
+ * Option to switch off "show again tab" - or position it anywhere horizontally in the header or footer. Additionally the styling has been improved and you are now able to customise the message.
178
+ * New button styles: better styling and effects, greater control
179
+ * Customise your message using HTML and 5 shortcodes with quick-start default options
180
+ * "Cookie Audit" module - document the cookies your site uses then display them in your privacy policy via a shortcode
181
+ * Enhanced dashboard
182
+ * Enhanced help section
183
+ * Refactored codebase, improved jQuery performance
184
+ * Bugs fixed: no more slashes in Message Box
185
+
186
+ == Upgrade Notice ==
187
+
188
+ = 0.9 =
189
+ Major upgrade with several new features including show in footer, custom fonts and a new shortcode for Privacy & Cookie policy page.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file