Kirki - Version 0.8.3

Version Description

April 5, 2014, dev time: 28 hours

  • New: Introduce a Field class
  • New: Introduce a Builder class
  • Tweak: Code Cleanups
  • New: Added ability to use 'option' as the setting type
  • Fix : Bugs in the color calculation class
  • Tweak: Everything gets sanitized in the "Field" class
  • Fix: Bugs in sortable field
  • Fix: Editor control had no description
  • New: Added a color-alpha control. To use it just set an rgba color as the default value.
  • Tweak: SCSS & CSS improvements
  • Fix: Various PHP notices and warnings when no fields are defined
  • Tweak: More efficient color sanitization method
  • Tweak: Improved number control presentation
  • Tweak: Improved the way background fields are handled
  • Tweak: Checkboxes styling
  • New: Allow using rgba values for background colors
  • Fix: CSS fix - :focus color for active section
  • New: Add a static 'prepare' method to the ScriptRegistry class
  • Fix: Issues with the URL when Kirki is embedded in a theme
Download this release

Release Info

Developer aristath
Plugin Icon 128x128 Kirki
Version 0.8.3
Comparing to
See all releases

Code changes from version 0.8.2 to 0.8.3

Files changed (51) hide show
  1. assets/css/customizer.css +146 -48
  2. assets/css/customizer.scss +469 -369
  3. assets/css/hint.css +0 -0
  4. assets/css/kirki-styles.css +0 -0
  5. assets/images/jquery.fs.stepper-arrows.png +0 -0
  6. assets/images/transparency-grid.png +0 -0
  7. assets/js/customizer.js +169 -73
  8. assets/js/jquery.fs.stepper.min.js +9 -0
  9. assets/js/serialize.js +0 -0
  10. assets/json/webfonts.json +0 -0
  11. assets/xml/colourlovers-top.xml +0 -0
  12. composer.json +0 -0
  13. config.codekit +0 -1243
  14. includes/Builder.php +48 -0
  15. includes/Config.php +72 -68
  16. includes/Control.php +0 -309
  17. includes/Controls.php +108 -52
  18. includes/Controls/ColorAlphaControl.php +28 -0
  19. includes/Controls/CustomControl.php +16 -1
  20. includes/Controls/EditorControl.php +13 -2
  21. includes/Controls/MultiCheckControl.php +7 -1
  22. includes/Controls/PaletteControl.php +7 -1
  23. includes/Controls/RadioButtonSetControl.php +7 -1
  24. includes/Controls/RadioImageControl.php +7 -1
  25. includes/Controls/SliderControl.php +7 -1
  26. includes/Controls/SortableControl.php +9 -3
  27. includes/Controls/SwitchControl.php +7 -1
  28. includes/Controls/ToggleControl.php +7 -1
  29. includes/Fields.php +585 -0
  30. includes/Fonts/FontRegistry.php +50 -50
  31. includes/Helpers/helpers.php +50 -43
  32. includes/Helpers/libraries/class-kirki-color.php +81 -71
  33. includes/Helpers/libraries/class-kirki-colourlovers.php +3 -2
  34. includes/Helpers/sanitize.php +15 -2
  35. includes/Kirki.php +49 -94
  36. includes/Scripts/Customizer/Branding.php +17 -12
  37. includes/Scripts/Customizer/Dependencies.php +6 -4
  38. includes/Scripts/Customizer/PostMessage.php +20 -22
  39. includes/Scripts/Customizer/Required.php +24 -18
  40. includes/Scripts/Customizer/Stepper.php +47 -0
  41. includes/Scripts/Customizer/Tooltips.php +7 -6
  42. includes/Scripts/Frontend/GoogleFonts.php +26 -18
  43. includes/Scripts/ScriptRegistry.php +6 -0
  44. includes/Setting.php +0 -193
  45. includes/Settings.php +40 -0
  46. includes/Styles/Customizer.php +4 -2
  47. includes/Styles/Frontend.php +57 -45
  48. kirki.php +9 -2
  49. languages/kirki-en_US.mo +0 -0
  50. languages/kirki-en_US.po +46 -44
  51. readme.txt +43 -12
assets/css/customizer.css CHANGED
@@ -6,10 +6,13 @@
6
  border-color: transparent !important;
7
  border-color: transparent !important; }
8
 
9
- .hint, [data-hint] {
 
10
  position: relative;
11
  display: inline-block; }
12
- .hint:before, .hint:after, [data-hint]:before, [data-hint]:after {
 
 
13
  position: absolute;
14
  -webkit-transform: translate3d(0, 0, 0);
15
  -moz-transform: translate3d(0, 0, 0);
@@ -20,12 +23,19 @@
20
  pointer-events: none;
21
  transition: 0.3s ease;
22
  transition-delay: 250ms; }
23
- .hint:hover:before, .hint:hover:after, .hint:focus:before, .hint:focus:after, [data-hint]:hover:before, [data-hint]:hover:after, [data-hint]:focus:before, [data-hint]:focus:after {
 
 
 
 
24
  visibility: visible;
25
  opacity: 1; }
26
- .hint:hover:before, .hint:hover:after, [data-hint]:hover:before, [data-hint]:hover:after {
27
- transition-delay: 0ms; }
28
- .hint:before, [data-hint]:before {
 
 
 
29
  content: '';
30
  position: absolute;
31
  background: transparent;
@@ -38,7 +48,8 @@
38
  border-left: 5px solid #333;
39
  left: -5px;
40
  top: 5px; }
41
- .hint:after, [data-hint]:after {
 
42
  content: attr(data-hint);
43
  background: #333;
44
  color: white;
@@ -89,37 +100,37 @@ li.customize-control {
89
  width: 22px;
90
  height: 22px; }
91
  .customize-control-multicheck input[type="checkbox"]:before {
92
- -webkit-transition: all 0.1s ease-in-out;
93
- -moz-transition: all 0.1s ease-in-out;
94
- transition: all 0.1s ease-in-out;
95
  content: "";
96
  position: absolute;
97
  left: 0;
98
  z-index: 1;
99
- width: 16px;
100
- height: 16px;
101
- border: 2px solid #f2f2f2; }
 
 
 
 
 
 
 
 
 
102
  .customize-control-multicheck input[type="checkbox"]:checked:before {
 
103
  -webkit-transform: rotate(-45deg);
104
  -moz-transform: rotate(-45deg);
105
  -ms-transform: rotate(-45deg);
106
  -o-transform: rotate(-45deg);
107
  transform: rotate(-45deg);
108
- height: 8px;
109
- top: 4px;
110
- left: 4px;
111
- border-color: #009688;
112
  border-top-style: none;
113
  border-right-style: none; }
114
- .customize-control-multicheck input[type="checkbox"]:after {
115
- content: "";
116
- position: absolute;
117
- left: 0;
118
- top: 0;
119
- width: 18px;
120
- height: 18px;
121
- background: #fff;
122
- cursor: pointer; }
123
 
124
  .customize-control-checkbox input[type="checkbox"] {
125
  position: relative;
@@ -129,37 +140,37 @@ li.customize-control {
129
  width: 22px;
130
  height: 22px; }
131
  .customize-control-checkbox input[type="checkbox"]:before {
132
- -webkit-transition: all 0.1s ease-in-out;
133
- -moz-transition: all 0.1s ease-in-out;
134
- transition: all 0.1s ease-in-out;
135
  content: "";
136
  position: absolute;
137
  left: 0;
138
  z-index: 1;
139
- width: 16px;
140
- height: 16px;
141
- border: 2px solid #f2f2f2; }
 
 
 
 
 
 
 
 
 
142
  .customize-control-checkbox input[type="checkbox"]:checked:before {
 
143
  -webkit-transform: rotate(-45deg);
144
  -moz-transform: rotate(-45deg);
145
  -ms-transform: rotate(-45deg);
146
  -o-transform: rotate(-45deg);
147
  transform: rotate(-45deg);
148
- height: 8px;
149
- top: 4px;
150
- left: 4px;
151
- border-color: #009688;
152
  border-top-style: none;
153
  border-right-style: none; }
154
- .customize-control-checkbox input[type="checkbox"]:after {
155
- content: "";
156
- position: absolute;
157
- left: 0;
158
- top: 0;
159
- width: 18px;
160
- height: 18px;
161
- background: #fff;
162
- cursor: pointer; }
163
 
164
  .customize-control-radio-buttonset label {
165
  padding: 5px 10px;
@@ -219,7 +230,7 @@ li.customize-control {
219
  left: 2%; }
220
  .customize-control-switch .Switch.Round,
221
  .customize-control-toggle .Switch.Round {
222
- padding: 0px 20px;
223
  border-radius: 40px;
224
  margin-top: 5px; }
225
  .customize-control-switch .Switch.Round .Toggle,
@@ -270,7 +281,7 @@ body.IE7 .Switch.Round {
270
  .customize-control-palette label.ui-button.ui-widget .ui-button-text span {
271
  padding: 10px 0;
272
  flex-grow: 1;
273
- font-size: 0px;
274
  line-height: 10px;
275
  color: transparent;
276
  -webkit-transition: all 200ms ease-in-out;
@@ -320,7 +331,94 @@ body.IE7 .Switch.Round {
320
  .customize-control-slider .ui-slider .ui-slider-range {
321
  position: absolute;
322
  z-index: 1;
323
- font-size: .7em;
324
  display: block;
325
  border: 0;
326
  background-position: 0 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  border-color: transparent !important;
7
  border-color: transparent !important; }
8
 
9
+ .hint,
10
+ [data-hint] {
11
  position: relative;
12
  display: inline-block; }
13
+ .hint:before, .hint:after,
14
+ [data-hint]:before,
15
+ [data-hint]:after {
16
  position: absolute;
17
  -webkit-transform: translate3d(0, 0, 0);
18
  -moz-transform: translate3d(0, 0, 0);
23
  pointer-events: none;
24
  transition: 0.3s ease;
25
  transition-delay: 250ms; }
26
+ .hint:hover:before, .hint:hover:after, .hint:focus:before, .hint:focus:after,
27
+ [data-hint]:hover:before,
28
+ [data-hint]:hover:after,
29
+ [data-hint]:focus:before,
30
+ [data-hint]:focus:after {
31
  visibility: visible;
32
  opacity: 1; }
33
+ .hint:hover:before, .hint:hover:after,
34
+ [data-hint]:hover:before,
35
+ [data-hint]:hover:after {
36
+ transition-delay: 0; }
37
+ .hint:before,
38
+ [data-hint]:before {
39
  content: '';
40
  position: absolute;
41
  background: transparent;
48
  border-left: 5px solid #333;
49
  left: -5px;
50
  top: 5px; }
51
+ .hint:after,
52
+ [data-hint]:after {
53
  content: attr(data-hint);
54
  background: #333;
55
  color: white;
100
  width: 22px;
101
  height: 22px; }
102
  .customize-control-multicheck input[type="checkbox"]:before {
 
 
 
103
  content: "";
104
  position: absolute;
105
  left: 0;
106
  z-index: 1;
107
+ width: 100%;
108
+ height: 100%;
109
+ border: none; }
110
+ .customize-control-multicheck input[type="checkbox"]:after {
111
+ content: "";
112
+ position: absolute;
113
+ left: 0;
114
+ top: 0;
115
+ width: 100%;
116
+ height: 100%;
117
+ background: #fff;
118
+ cursor: pointer; }
119
  .customize-control-multicheck input[type="checkbox"]:checked:before {
120
+ border: 4px solid #4caf50;
121
  -webkit-transform: rotate(-45deg);
122
  -moz-transform: rotate(-45deg);
123
  -ms-transform: rotate(-45deg);
124
  -o-transform: rotate(-45deg);
125
  transform: rotate(-45deg);
126
+ width: 14px;
127
+ height: 6px;
128
+ top: 6px;
129
+ left: 5px;
130
  border-top-style: none;
131
  border-right-style: none; }
132
+ .customize-control-multicheck input[type="checkbox"]:checked:after {
133
+ background: #f2f2f2; }
 
 
 
 
 
 
 
134
 
135
  .customize-control-checkbox input[type="checkbox"] {
136
  position: relative;
140
  width: 22px;
141
  height: 22px; }
142
  .customize-control-checkbox input[type="checkbox"]:before {
 
 
 
143
  content: "";
144
  position: absolute;
145
  left: 0;
146
  z-index: 1;
147
+ width: 100%;
148
+ height: 100%;
149
+ border: none; }
150
+ .customize-control-checkbox input[type="checkbox"]:after {
151
+ content: "";
152
+ position: absolute;
153
+ left: 0;
154
+ top: 0;
155
+ width: 100%;
156
+ height: 100%;
157
+ background: #fff;
158
+ cursor: pointer; }
159
  .customize-control-checkbox input[type="checkbox"]:checked:before {
160
+ border: 4px solid #4caf50;
161
  -webkit-transform: rotate(-45deg);
162
  -moz-transform: rotate(-45deg);
163
  -ms-transform: rotate(-45deg);
164
  -o-transform: rotate(-45deg);
165
  transform: rotate(-45deg);
166
+ width: 14px;
167
+ height: 6px;
168
+ top: 6px;
169
+ left: 5px;
170
  border-top-style: none;
171
  border-right-style: none; }
172
+ .customize-control-checkbox input[type="checkbox"]:checked:after {
173
+ background: #f2f2f2; }
 
 
 
 
 
 
 
174
 
175
  .customize-control-radio-buttonset label {
176
  padding: 5px 10px;
230
  left: 2%; }
231
  .customize-control-switch .Switch.Round,
232
  .customize-control-toggle .Switch.Round {
233
+ padding: 0 20px;
234
  border-radius: 40px;
235
  margin-top: 5px; }
236
  .customize-control-switch .Switch.Round .Toggle,
281
  .customize-control-palette label.ui-button.ui-widget .ui-button-text span {
282
  padding: 10px 0;
283
  flex-grow: 1;
284
+ font-size: 0;
285
  line-height: 10px;
286
  color: transparent;
287
  -webkit-transition: all 200ms ease-in-out;
331
  .customize-control-slider .ui-slider .ui-slider-range {
332
  position: absolute;
333
  z-index: 1;
334
+ font-size: 0.7em;
335
  display: block;
336
  border: 0;
337
  background-position: 0 0; }
338
+
339
+ .customize-control-color-alpha .kirki-alpha-container {
340
+ box-sizing: padding-box;
341
+ display: none;
342
+ border: 1px solid #dfdfdf;
343
+ border-top: none;
344
+ background: #fff;
345
+ padding: 0 11px 6px; }
346
+ .customize-control-color-alpha .kirki-alpha-container .transparency {
347
+ height: 24px;
348
+ width: 100%;
349
+ background-color: #fff;
350
+ background-image: url("../images/transparency-grid.png");
351
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
352
+ -webkit-border-radius: 3px;
353
+ -moz-border-radius: 3px;
354
+ border-radius: 3px;
355
+ padding: 0; }
356
+ .customize-control-color-alpha .kirki-alpha-container .ui-slider-handle {
357
+ color: #777;
358
+ background-color: #fff;
359
+ text-shadow: 0 1px 0 #fff;
360
+ text-decoration: none;
361
+ position: absolute;
362
+ z-index: 2;
363
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
364
+ border: 1px solid #aaa;
365
+ -webkit-border-radius: 4px;
366
+ -moz-border-radius: 4px;
367
+ border-radius: 4px;
368
+ opacity: 0.9;
369
+ margin-top: -2px;
370
+ height: 20px;
371
+ cursor: ew-resize;
372
+ font-size: 12px;
373
+ padding: 3px; }
374
+ .customize-control-color-alpha .kirki-alpha-container .ui-slider {
375
+ position: relative;
376
+ text-align: center;
377
+ width: 88%; }
378
+ .customize-control-color-alpha .wp-picker-container a.wp-picker-open ~ div.kirki-alpha-container {
379
+ display: block; }
380
+ .customize-control-color-alpha .customize-control-alphacolor .wp-picker-container .iris-picker {
381
+ border-bottom: none; }
382
+
383
+ .customize-control-number .stepper {
384
+ border-radius: 0px;
385
+ margin: 0 0 10px 0;
386
+ overflow: hidden;
387
+ position: relative;
388
+ width: 50%; }
389
+ .customize-control-number .stepper .stepper-input {
390
+ background: #F9F9F9;
391
+ border: 1px solid #ccc;
392
+ border-radius: 0px;
393
+ color: #333;
394
+ font-size: 13px;
395
+ line-height: 1.2;
396
+ margin: 0;
397
+ overflow: hidden;
398
+ padding: 9px 10px 10px;
399
+ width: 100%;
400
+ z-index: 49;
401
+ -moz-appearance: textfield; }
402
+ .customize-control-number .stepper .stepper-input::-webkit-inner-spin-button, .customize-control-number .stepper .stepper-input::-webkit-outer-spin-button {
403
+ -webkit-appearance: none;
404
+ margin: 0; }
405
+ .customize-control-number .stepper .stepper-input:focus {
406
+ background-color: #fff; }
407
+ .customize-control-number .stepper .stepper-arrow {
408
+ background: #eee url("../images/jquery.fs.stepper-arrows.png") no-repeat;
409
+ border: 1px solid #ccc;
410
+ cursor: pointer;
411
+ display: block;
412
+ height: 50%;
413
+ position: absolute;
414
+ right: 0;
415
+ text-indent: -99999px;
416
+ width: 20px;
417
+ z-index: 50; }
418
+ .customize-control-number .stepper .stepper-arrow.up {
419
+ background-position: center top;
420
+ border-bottom: none;
421
+ top: 0; }
422
+ .customize-control-number .stepper .stepper-arrow.down {
423
+ background-position: center bottom;
424
+ bottom: 0; }
assets/css/customizer.scss CHANGED
@@ -1,406 +1,506 @@
1
- @mixin material-checkbox() {
2
- position: relative;
3
- margin: 0 1rem 0 0;
4
- cursor: pointer;
5
- margin-bottom: 5px;
6
- width: 22px;
7
- height: 22px;
8
- &:before {
9
- -webkit-transition: all 0.1s ease-in-out;
10
- -moz-transition: all 0.1s ease-in-out;
11
- transition: all 0.1s ease-in-out;
12
- content: "";
13
- position: absolute;
14
- left: 0;
15
- z-index: 1;
16
- width: 16px;
17
- height: 16px;
18
- border: 2px solid #f2f2f2;
19
- }
20
- &:checked {
21
- &:before {
22
- -webkit-transform: rotate(-45deg);
23
- -moz-transform: rotate(-45deg);
24
- -ms-transform: rotate(-45deg);
25
- -o-transform: rotate(-45deg);
26
- transform: rotate(-45deg);
27
- height: 8px;
28
- top:4px;
29
- left: 4px;
30
- border-color: #009688;
31
- border-top-style: none;
32
- border-right-style: none;
33
- }
34
- }
35
- &:after {
36
- content: "";
37
- position: absolute;
38
- left: 0;
39
- top: 0;
40
- width: 18px;
41
- height: 18px;
42
- background: #fff;
43
- cursor: pointer;
44
- }
 
45
  }
46
-
47
  // Generic styles
48
  #customize-controls {
49
- #customize-header-actions {
50
 
51
- }
52
- #customize-info {
53
- .accordion-section-title {
54
- border-bottom: 1px solid rgba(0,0,0,.3);
55
- }
56
- }
57
- #customize-theme-controls {
58
- #accordion-section-themes {
59
 
60
- }
61
- .accordion-section {
62
- > .accordion-section-title {
63
- border-bottom: 1px solid rgba(0,0,0,.1);
64
- &:after {
65
- border-color: rgba(0,0,0,0) !important;
66
- border-color: transparent !important;
67
- }
68
- }
69
- }
70
- }
71
  }
72
-
73
  // Hints/Tooltips
74
- .hint, [data-hint] {
75
- position: relative;
76
- display: inline-block;
77
-
78
- &:before, &:after {
79
- position: absolute;
80
-
81
- // HACK: Trigger hardware accelerated rendering, otherwise transform was not
82
- // working on a hidden element
83
- -webkit-transform: translate3d(0, 0, 0);
84
- -moz-transform: translate3d(0, 0, 0);
85
- transform: translate3d(0, 0, 0);
86
-
87
- // HACK: visibility is set to hidden because IE & Opera don't support
88
- // pointer-events on HTML content yet because of which hovering a hidden tooltip
89
- // shows the tooltip.
90
- visibility: hidden;
91
- opacity: 0;
92
- z-index: 998;
93
- // shouldn't receive pointer events, otherwise even hovering tooltip will make it appear
94
- pointer-events: none;
95
-
96
- transition: 0.3s ease;
97
- transition-delay: 250ms;
98
- }
99
-
100
- &:hover:before, &:hover:after,
101
- &:focus:before, &:focus:after {
102
- visibility: visible;
103
- opacity: 1;
104
- }
105
-
106
- &:hover:before, &:hover:after {
107
- transition-delay: 0ms;
108
- }
109
- // tooltip arrow
110
- &:before {
111
- content: '';
112
- position: absolute;
113
- background: transparent;
114
- border: none;
115
- // move z-index 1 up than :after so that it shows over box-shadow
116
- z-index: 999;
117
- width: 0;
118
- height: 0;
119
- border-top: 5px solid transparent;
120
- border-bottom: 5px solid transparent;
121
- border-left: 5px solid #333;
122
- left: -5px;
123
- top: 5px;
124
- }
125
- // tooltip body
126
- &:after {
127
- content: attr(data-hint); // The magic!
128
- background: #333;
129
- color: white;
130
- padding: 5px 10px;
131
- font-size: 12px;
132
- line-height: 14px;
133
- height: auto;
134
- margin-bottom: -14px;
135
- width: 170px;
136
- max-width: 170px;
137
- display: block;
138
- white-space: normal;
139
- text-align: right;
140
- position: relative;
141
- top: -22px;
142
- left: -195px;
143
- }
144
  }
145
-
146
  // apply to all controls for tooltips
147
  li.customize-control {
148
- position: relative;
149
- a.tooltip.hint--left {
150
- display: block;
151
- position: absolute;
152
- top: 5px;
153
- right: -20px;
154
- border-radius: 50%;
155
- color: #999;
156
- border: none;
157
- line-height: 8px;
158
- width: 20px;
159
- height: 20px;
160
- }
161
  }
162
-
163
  // Radio-Image Controls
164
  .customize-control-radio-image {
165
- .image.ui-buttonset {
166
- input[type=radio] {
167
- height: auto;
168
- }
169
- label {
170
- border: 1px solid transparent;
171
- display: inline-block;
172
- margin-right: 5px;
173
- margin-bottom: 5px;
174
- &.ui-state-active {
175
- background: none;
176
- border-color: #333;
177
- }
178
- }
179
- }
180
  }
181
-
182
  // Multicheck Controls
183
  .customize-control-multicheck {
184
- input[type="checkbox"] {
185
- @include material-checkbox();
186
- }
187
  }
188
-
189
  // Checkbox Controls
190
  // Multicheck Controls
191
  .customize-control-checkbox {
192
- input[type="checkbox"] {
193
- @include material-checkbox();
194
- }
195
  }
196
-
197
  // Radio-Buttonset Controls
198
  .customize-control-radio-buttonset {
199
- input[type=radio] {
200
- }
201
- label {
202
- padding: 5px 10px;
203
- background: #f7f7f7;
204
- border-left: 1px solid #dedede;
205
- &.ui-state-active {
206
- background: #dedede;
207
- }
208
- &.ui-corner-left {
209
- border-radius: 3px 0 0 3px;
210
- border-left: 0;
211
- }
212
- &.ui-corner-right {
213
- border-radius: 0 3px 3px 0;
214
- }
215
- }
216
- }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  // Switch & toggle Controls
219
  .customize-control-switch,
220
  .customize-control-toggle {
221
- .Switch {
222
- position: relative;
223
- display: inline-block;
224
- font-size: 16px;
225
- font-weight: bold;
226
- color: #aaa;
227
- height: 18px;
228
- line-height: 27px;
229
- padding: 6px;
230
- border: 1px solid #ccc;
231
- border: 1px solid rgba(0,0,0,0.2);
232
- background: #f2f2f2;
233
- cursor: pointer;
234
- float: right;
235
- transition: all 0.15s ease-in-out;
236
- .Toggle {
237
- position: absolute;
238
- top: 1px;
239
- width: 37px;
240
- height: 25px;
241
- border: 1px solid #aaa;
242
- border: 1px solid rgba(0,0,0,0.2);
243
- background: #fff;
244
- z-index: 989;
245
- transition: all 0.15s ease-in-out;
246
- }
247
- .On,
248
- .Off {
249
- display: inline-block;
250
- width: 35px;
251
- position: relative;
252
- top: -5px;
253
- }
254
- .On {
255
- color: #333;
256
- }
257
- &.On {
258
- .Toggle {
259
- left: 54%;
260
- }
261
- }
262
- &.Off {
263
- .Toggle {
264
- left: 2%;
265
- }
266
- }
267
- &.Round {
268
- padding: 0px 20px;
269
- border-radius: 40px;
270
- margin-top: 5px;
271
- .Toggle {
272
- border-radius: 40px;
273
- width: 14px;
274
- height: 14px;
275
- }
276
- &.Off {
277
- .Toggle {
278
- left: 3%;
279
- }
280
- }
281
- &.On {
282
- color: #fff;
283
- background: #333;
284
- .Toggle {
285
- left: 58%;
286
- }
287
- }
288
- }
289
- }
 
 
 
 
 
 
290
  }
291
- body.IE7 .Switch { width: 78px; }
292
- body.IE7 .Switch.Round { width: 1px; }
293
-
294
  // Sortable Controls
295
  .customize-control-sortable {
296
- ul.ui-sortable {
297
- li {
298
- padding: 5px 10px;
299
- border: 1px solid #333;
300
- background: #fff;
301
- .dashicons {
302
- &.dashicons-menu {
303
- float: right;
304
- }
305
- &.visibility {
306
- margin-right: 10px;
307
- }
308
- }
309
- &.invisible {
310
- color: #aaa;
311
- border: 1px dashed #aaa;
312
- .dashicons.visibility {
313
- color: #aaa;
314
- }
315
- }
316
- }
317
- }
318
  }
319
-
320
  // Palette controls
321
  .customize-control-palette {
322
- label {
323
- &.ui-button.ui-widget {
324
- width: 95%;
325
- background: none;
326
- padding: 0;
327
- .ui-button-text {
328
- border-top: 3px solid transparent;
329
- border-bottom: 3px solid transparent;
330
- margin-bottom: 5px;
331
- display: flex;
332
- span {
333
- padding: 10px 0;
334
- flex-grow: 1;
335
- font-size: 0px;
336
- line-height: 10px;
337
- color: rgba(0,0,0,0);
338
- -webkit-transition: all 200ms ease-in-out;
339
- -moz-transition: all 200ms ease-in-out;
340
- -ms-transition: all 200ms ease-in-out;
341
- -o-transition: all 200ms ease-in-out;
342
- transition: all 200ms ease-in-out;
343
- &:hover {
344
- padding: 10px;
345
- flex-grow: 3;
346
- min-width: 60px;
347
- font-size: 10px;
348
- line-height: 10px;
349
- color: #000;
350
- }
351
- }
352
- }
353
- }
354
- &.ui-state-active {
355
- &.ui-button.ui-widget {
356
- span.ui-button-text {
357
- border: 3px solid #333;
358
- }
359
- }
360
- }
361
- }
362
  }
363
-
364
  // Slider Controls
365
  .customize-control-slider {
366
- input[type="text"] {
367
- border: none;
368
- text-align: center;
369
- padding: 0;
370
- margin: 0;
371
- font-size: 12px;
372
- box-shadow: none;
373
- color: #333;
374
- }
375
- .ui-slider {
376
- position: relative;
377
- text-align: left;
378
- height: 7px;
379
- border-radius: 3px;
380
- background: #f2f2f2;
381
- border: 1px solid #dedede;
382
- margin-top: 10px;
383
- margin-bottom: 20px;
384
- .ui-slider-handle {
385
- position: absolute;
386
- z-index: 2;
387
- width: 15px;
388
- height: 15px;
389
- top: -5px;
390
- border-radius: 50%;
391
- cursor: default;
392
- -ms-touch-action: none;
393
- touch-action: none;
394
- background: #333;
395
- border: 1px solid #333;
396
- }
397
- .ui-slider-range {
398
- position: absolute;
399
- z-index: 1;
400
- font-size: .7em;
401
- display: block;
402
- border: 0;
403
- background-position: 0 0;
404
- }
405
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  }
1
+ @mixin custom-checkbox() {
2
+ position: relative;
3
+ margin: 0 1rem 0 0;
4
+ cursor: pointer;
5
+ margin-bottom: 5px;
6
+ width: 22px;
7
+ height: 22px;
8
+ &:before {
9
+ content: "";
10
+ position: absolute;
11
+ left: 0;
12
+ z-index: 1;
13
+ width: 100%;
14
+ height: 100%;
15
+ border: none;
16
+ }
17
+ &:after {
18
+ content: "";
19
+ position: absolute;
20
+ left: 0;
21
+ top: 0;
22
+ width: 100%;
23
+ height: 100%;
24
+ background: #fff;
25
+ cursor: pointer;
26
+ }
27
+ &:checked {
28
+ &:before {
29
+ border: 4px solid #4caf50;
30
+ -webkit-transform: rotate(-45deg);
31
+ -moz-transform: rotate(-45deg);
32
+ -ms-transform: rotate(-45deg);
33
+ -o-transform: rotate(-45deg);
34
+ transform: rotate(-45deg);
35
+ width: 14px;
36
+ height: 6px;
37
+ top: 6px;
38
+ left: 5px;
39
+ border-top-style: none;
40
+ border-right-style: none;
41
+ }
42
+ &:after {
43
+ background: #f2f2f2;
44
+ }
45
+ }
46
  }
 
47
  // Generic styles
48
  #customize-controls {
49
+ #customize-header-actions {
50
 
51
+ }
52
+ #customize-info {
53
+ .accordion-section-title {
54
+ border-bottom: 1px solid rgba(0,0,0,.3);
55
+ }
56
+ }
57
+ #customize-theme-controls {
58
+ #accordion-section-themes {
59
 
60
+ }
61
+ .accordion-section {
62
+ > .accordion-section-title {
63
+ border-bottom: 1px solid rgba(0,0,0,.1);
64
+ &:after {
65
+ border-color: rgba(0,0,0,0) !important;
66
+ border-color: transparent !important;
67
+ }
68
+ }
69
+ }
70
+ }
71
  }
 
72
  // Hints/Tooltips
73
+ .hint,
74
+ [data-hint] {
75
+ position: relative;
76
+ display: inline-block;
77
+ &:before,
78
+ &:after {
79
+ position: absolute;
80
+ // HACK: Trigger hardware accelerated rendering, otherwise transform was not
81
+ // working on a hidden element
82
+ -webkit-transform: translate3d(0, 0, 0);
83
+ -moz-transform: translate3d(0, 0, 0);
84
+ transform: translate3d(0, 0, 0);
85
+ // HACK: visibility is set to hidden because IE & Opera don't support
86
+ // pointer-events on HTML content yet because of which hovering a hidden tooltip
87
+ // shows the tooltip.
88
+ visibility: hidden;
89
+ opacity: 0;
90
+ z-index: 998;
91
+ // shouldn't receive pointer events, otherwise even hovering tooltip will make it appear
92
+ pointer-events: none;
93
+ transition: 0.3s ease;
94
+ transition-delay: 250ms;
95
+ }
96
+ &:hover:before,
97
+ &:hover:after,
98
+ &:focus:before,
99
+ &:focus:after {
100
+ visibility: visible;
101
+ opacity: 1;
102
+ }
103
+ &:hover:before,
104
+ &:hover:after {
105
+ transition-delay: 0;
106
+ }
107
+ // tooltip arrow
108
+ &:before {
109
+ content: '';
110
+ position: absolute;
111
+ background: transparent;
112
+ border: none;
113
+ // move z-index 1 up than :after so that it shows over box-shadow
114
+ z-index: 999;
115
+ width: 0;
116
+ height: 0;
117
+ border-top: 5px solid transparent;
118
+ border-bottom: 5px solid transparent;
119
+ border-left: 5px solid #333;
120
+ left: -5px;
121
+ top: 5px;
122
+ }
123
+ // tooltip body
124
+ &:after {
125
+ content: attr(data-hint);
126
+ // The magic!
127
+ background: #333;
128
+ color: white;
129
+ padding: 5px 10px;
130
+ font-size: 12px;
131
+ line-height: 14px;
132
+ height: auto;
133
+ margin-bottom: -14px;
134
+ width: 170px;
135
+ max-width: 170px;
136
+ display: block;
137
+ white-space: normal;
138
+ text-align: right;
139
+ position: relative;
140
+ top: -22px;
141
+ left: -195px;
142
+ }
143
  }
 
144
  // apply to all controls for tooltips
145
  li.customize-control {
146
+ position: relative;
147
+ a.tooltip.hint--left {
148
+ display: block;
149
+ position: absolute;
150
+ top: 5px;
151
+ right: -20px;
152
+ border-radius: 50%;
153
+ color: #999;
154
+ border: none;
155
+ line-height: 8px;
156
+ width: 20px;
157
+ height: 20px;
158
+ }
159
  }
 
160
  // Radio-Image Controls
161
  .customize-control-radio-image {
162
+ .image.ui-buttonset {
163
+ input[type=radio] {
164
+ height: auto;
165
+ }
166
+ label {
167
+ border: 1px solid transparent;
168
+ display: inline-block;
169
+ margin-right: 5px;
170
+ margin-bottom: 5px;
171
+ &.ui-state-active {
172
+ background: none;
173
+ border-color: #333;
174
+ }
175
+ }
176
+ }
177
  }
 
178
  // Multicheck Controls
179
  .customize-control-multicheck {
180
+ input[type="checkbox"] {
181
+ @include custom-checkbox();
182
+ }
183
  }
 
184
  // Checkbox Controls
185
  // Multicheck Controls
186
  .customize-control-checkbox {
187
+ input[type="checkbox"] {
188
+ @include custom-checkbox();
189
+ }
190
  }
 
191
  // Radio-Buttonset Controls
192
  .customize-control-radio-buttonset {
193
+ input[type=radio] {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
+ }
196
+ label {
197
+ padding: 5px 10px;
198
+ background: #f7f7f7;
199
+ border-left: 1px solid #dedede;
200
+ &.ui-state-active {
201
+ background: #dedede;
202
+ }
203
+ &.ui-corner-left {
204
+ border-radius: 3px 0 0 3px;
205
+ border-left: 0;
206
+ }
207
+ &.ui-corner-right {
208
+ border-radius: 0 3px 3px 0;
209
+ }
210
+ }
211
+ }
212
  // Switch & toggle Controls
213
  .customize-control-switch,
214
  .customize-control-toggle {
215
+ .Switch {
216
+ position: relative;
217
+ display: inline-block;
218
+ font-size: 16px;
219
+ font-weight: bold;
220
+ color: #aaa;
221
+ height: 18px;
222
+ line-height: 27px;
223
+ padding: 6px;
224
+ border: 1px solid #ccc;
225
+ border: 1px solid rgba(0,0,0,0.2);
226
+ background: #f2f2f2;
227
+ cursor: pointer;
228
+ float: right;
229
+ transition: all 0.15s ease-in-out;
230
+ .Toggle {
231
+ position: absolute;
232
+ top: 1px;
233
+ width: 37px;
234
+ height: 25px;
235
+ border: 1px solid #aaa;
236
+ border: 1px solid rgba(0,0,0,0.2);
237
+ background: #fff;
238
+ z-index: 989;
239
+ transition: all 0.15s ease-in-out;
240
+ }
241
+ .On,
242
+ .Off {
243
+ display: inline-block;
244
+ width: 35px;
245
+ position: relative;
246
+ top: -5px;
247
+ }
248
+ .On {
249
+ color: #333;
250
+ }
251
+ &.On {
252
+ .Toggle {
253
+ left: 54%;
254
+ }
255
+ }
256
+ &.Off {
257
+ .Toggle {
258
+ left: 2%;
259
+ }
260
+ }
261
+ &.Round {
262
+ padding: 0 20px;
263
+ border-radius: 40px;
264
+ margin-top: 5px;
265
+ .Toggle {
266
+ border-radius: 40px;
267
+ width: 14px;
268
+ height: 14px;
269
+ }
270
+ &.Off {
271
+ .Toggle {
272
+ left: 3%;
273
+ }
274
+ }
275
+ &.On {
276
+ color: #fff;
277
+ background: #333;
278
+ .Toggle {
279
+ left: 58%;
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ body.IE7 .Switch {
286
+ width: 78px;
287
+ }
288
+ body.IE7 .Switch.Round {
289
+ width: 1px;
290
  }
 
 
 
291
  // Sortable Controls
292
  .customize-control-sortable {
293
+ ul.ui-sortable {
294
+ li {
295
+ padding: 5px 10px;
296
+ border: 1px solid #333;
297
+ background: #fff;
298
+ .dashicons {
299
+ &.dashicons-menu {
300
+ float: right;
301
+ }
302
+ &.visibility {
303
+ margin-right: 10px;
304
+ }
305
+ }
306
+ &.invisible {
307
+ color: #aaa;
308
+ border: 1px dashed #aaa;
309
+ .dashicons.visibility {
310
+ color: #aaa;
311
+ }
312
+ }
313
+ }
314
+ }
315
  }
 
316
  // Palette controls
317
  .customize-control-palette {
318
+ label {
319
+ &.ui-button.ui-widget {
320
+ width: 95%;
321
+ background: none;
322
+ padding: 0;
323
+ .ui-button-text {
324
+ border-top: 3px solid transparent;
325
+ border-bottom: 3px solid transparent;
326
+ margin-bottom: 5px;
327
+ display: flex;
328
+ span {
329
+ padding: 10px 0;
330
+ flex-grow: 1;
331
+ font-size: 0;
332
+ line-height: 10px;
333
+ color: rgba(0,0,0,0);
334
+ -webkit-transition: all 200ms ease-in-out;
335
+ -moz-transition: all 200ms ease-in-out;
336
+ -ms-transition: all 200ms ease-in-out;
337
+ -o-transition: all 200ms ease-in-out;
338
+ transition: all 200ms ease-in-out;
339
+ &:hover {
340
+ padding: 10px;
341
+ flex-grow: 3;
342
+ min-width: 60px;
343
+ font-size: 10px;
344
+ line-height: 10px;
345
+ color: #000;
346
+ }
347
+ }
348
+ }
349
+ }
350
+ &.ui-state-active {
351
+ &.ui-button.ui-widget {
352
+ span.ui-button-text {
353
+ border: 3px solid #333;
354
+ }
355
+ }
356
+ }
357
+ }
358
  }
 
359
  // Slider Controls
360
  .customize-control-slider {
361
+ input[type="text"] {
362
+ border: none;
363
+ text-align: center;
364
+ padding: 0;
365
+ margin: 0;
366
+ font-size: 12px;
367
+ box-shadow: none;
368
+ color: #333;
369
+ }
370
+ .ui-slider {
371
+ position: relative;
372
+ text-align: left;
373
+ height: 7px;
374
+ border-radius: 3px;
375
+ background: #f2f2f2;
376
+ border: 1px solid #dedede;
377
+ margin-top: 10px;
378
+ margin-bottom: 20px;
379
+ .ui-slider-handle {
380
+ position: absolute;
381
+ z-index: 2;
382
+ width: 15px;
383
+ height: 15px;
384
+ top: -5px;
385
+ border-radius: 50%;
386
+ cursor: default;
387
+ -ms-touch-action: none;
388
+ touch-action: none;
389
+ background: #333;
390
+ border: 1px solid #333;
391
+ }
392
+ .ui-slider-range {
393
+ position: absolute;
394
+ z-index: 1;
395
+ font-size: 0.7em;
396
+ display: block;
397
+ border: 0;
398
+ background-position: 0 0;
399
+ }
400
+ }
401
+ }
402
+ // Color-Alpha Controls
403
+ .customize-control-color-alpha {
404
+ .kirki-alpha-container {
405
+ box-sizing: padding-box;
406
+ display: none;
407
+ border: 1px solid #dfdfdf;
408
+ border-top: none;
409
+ background: #fff;
410
+ padding: 0 11px 6px;
411
+ .transparency {
412
+ height: 24px;
413
+ width: 100%;
414
+ background-color: #fff;
415
+ background-image: url("../images/transparency-grid.png");
416
+ box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
417
+ -webkit-border-radius: 3px;
418
+ -moz-border-radius: 3px;
419
+ border-radius: 3px;
420
+ padding: 0;
421
+ }
422
+ .ui-slider-handle {
423
+ color: #777;
424
+ background-color: #fff;
425
+ text-shadow: 0 1px 0 #fff;
426
+ text-decoration: none;
427
+ position: absolute;
428
+ z-index: 2;
429
+ box-shadow: 0 1px 2px rgba(0,0,0,0.2);
430
+ border: 1px solid #aaa;
431
+ -webkit-border-radius: 4px;
432
+ -moz-border-radius: 4px;
433
+ border-radius: 4px;
434
+ opacity: 0.9;
435
+ margin-top: -2px;
436
+ height: 20px;
437
+ cursor: ew-resize;
438
+ font-size: 12px;
439
+ padding: 3px;
440
+ }
441
+ .ui-slider {
442
+ position: relative;
443
+ text-align: center;
444
+ width: 88%;
445
+ }
446
+ }
447
+ .wp-picker-container a.wp-picker-open ~ div.kirki-alpha-container {
448
+ display: block;
449
+ }
450
+ .customize-control-alphacolor .wp-picker-container .iris-picker {
451
+ border-bottom: none;
452
+ }
453
+ }
454
+
455
+ // Number Controls
456
+ .customize-control-number {
457
+ .stepper {
458
+ border-radius: 0px;
459
+ margin: 0 0 10px 0;
460
+ overflow: hidden;
461
+ position: relative;
462
+ width: 50%;
463
+ .stepper-input {
464
+ background: #F9F9F9;
465
+ border: 1px solid #ccc;
466
+ border-radius: 0px;
467
+ color: #333;
468
+ font-size: 13px;
469
+ line-height: 1.2;
470
+ margin: 0;
471
+ overflow: hidden;
472
+ padding: 9px 10px 10px;
473
+ width: 100%;
474
+ z-index: 49;
475
+ -moz-appearance: textfield;
476
+ &::-webkit-inner-spin-button,
477
+ &::-webkit-outer-spin-button {
478
+ -webkit-appearance: none; margin: 0;
479
+ }
480
+ &:focus {
481
+ background-color: #fff;
482
+ }
483
+ }
484
+ .stepper-arrow {
485
+ background: #eee url("../images/jquery.fs.stepper-arrows.png") no-repeat;
486
+ border: 1px solid #ccc;
487
+ cursor: pointer;
488
+ display: block;
489
+ height: 50%;
490
+ position: absolute;
491
+ right: 0;
492
+ text-indent: -99999px;
493
+ width: 20px;
494
+ z-index: 50;
495
+ &.up {
496
+ background-position: center top;
497
+ border-bottom: none;
498
+ top: 0;
499
+ }
500
+ &.down {
501
+ background-position: center bottom;
502
+ bottom: 0;
503
+ }
504
+ }
505
+ }
506
  }
assets/css/hint.css CHANGED
File without changes
assets/css/kirki-styles.css CHANGED
File without changes
assets/images/jquery.fs.stepper-arrows.png ADDED
Binary file
assets/images/transparency-grid.png ADDED
Binary file
assets/js/customizer.js CHANGED
@@ -1,6 +1,6 @@
1
  jQuery.noConflict();
2
  /** Fire up jQuery - let's dance! */
3
- jQuery(document).ready(function($){
4
  $("a.tooltip").tooltip();
5
  });
6
 
@@ -10,7 +10,7 @@ jQuery(document).ready(function($) {
10
  $('.kirki-sortable > ul ~ input').each(function() {
11
  var value = $(this).val();
12
  try {
13
- value = unserialize( value );
14
  } catch (err) {
15
  return;
16
  }
@@ -22,24 +22,24 @@ jQuery(document).ready(function($) {
22
  });
23
  $('.kirki-sortable > ul').each(function() {
24
  $(this).sortable()
25
- .disableSelection()
26
- .on( "sortstop", function( event, ui ) {
27
- kirkiUpdateSortable(ui.item.parent());
28
- })
29
- .find('li').each(function() {
30
- $(this).find('i.visibility').click(function() {
31
- $(this).toggleClass('dashicons-visibility-faint').parents('li:eq(0)').toggleClass('invisible');
32
- });
33
- })
34
- .click(function() {
35
- kirkiUpdateSortable( $(this).parents('ul:eq(0)') );
36
- })
37
  });
38
 
39
 
40
  // Switch Click
41
  $('.Switch').click(function() {
42
- if ($(this).hasClass('On')){
43
  $(this).parent().find('input:checkbox').attr('checked', true);
44
  $(this).removeClass('On').addClass('Off');
45
  } else {
@@ -49,71 +49,167 @@ jQuery(document).ready(function($) {
49
  });
50
 
51
  });
 
52
  function kirkiUpdateSortable(ul) {
53
  "use strict";
54
  var $ = jQuery;
55
  var values = [];
56
  ul.find('li').each(function() {
57
- if ( ! $(this).is('.invisible') ) {
58
- values.push( $(this).attr('data-value') );
59
  }
60
  });
61
- ul.siblings('input').eq(0).val( serialize( values ) ).trigger('change');
62
  }
63
 
64
 
65
- ( function( $ ) {
66
- wp.customizerCtrlEditor = {
67
-
68
- init: function() {
69
-
70
- $(window).load(function(){
71
-
72
- $('textarea.wp-editor-area').each(function(){
73
- var tArea = $(this),
74
- id = tArea.attr('id'),
75
- input = $('input[data-customize-setting-link="'+ id +'"]'),
76
- editor = tinyMCE.get(id),
77
- setChange,
78
- content;
79
-
80
- if(editor){
81
- editor.onChange.add(function (ed, e) {
82
- ed.save();
83
- content = editor.getContent();
84
- clearTimeout(setChange);
85
- setChange = setTimeout(function(){
86
- input.val(content).trigger('change');
87
- },500);
88
- });
89
- }
90
-
91
- if(editor){
92
- editor.onChange.add(function (ed, e) {
93
- ed.save();
94
- content = editor.getContent();
95
- clearTimeout(setChange);
96
- setChange = setTimeout(function(){
97
- input.val(content).trigger('change');
98
- },500);
99
- });
100
- }
101
-
102
- tArea.css({
103
- visibility: 'visible'
104
- }).on('keyup', function(){
105
- content = tArea.val();
106
- clearTimeout(setChange);
107
- setChange = setTimeout(function(){
108
- input.val(content).trigger('change');
109
- },500);
110
- });
111
- });
112
- });
113
- }
114
-
115
- };
116
-
117
- wp.customizerCtrlEditor.init();
118
-
119
- } )( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery.noConflict();
2
  /** Fire up jQuery - let's dance! */
3
+ jQuery(document).ready(function($) {
4
  $("a.tooltip").tooltip();
5
  });
6
 
10
  $('.kirki-sortable > ul ~ input').each(function() {
11
  var value = $(this).val();
12
  try {
13
+ value = unserialize(value);
14
  } catch (err) {
15
  return;
16
  }
22
  });
23
  $('.kirki-sortable > ul').each(function() {
24
  $(this).sortable()
25
+ .disableSelection()
26
+ .on("sortstop", function(event, ui) {
27
+ kirkiUpdateSortable(ui.item.parent());
28
+ })
29
+ .find('li').each(function() {
30
+ $(this).find('i.visibility').click(function() {
31
+ $(this).toggleClass('dashicons-visibility-faint').parents('li:eq(0)').toggleClass('invisible');
32
+ });
33
+ })
34
+ .click(function() {
35
+ kirkiUpdateSortable($(this).parents('ul:eq(0)'));
36
+ })
37
  });
38
 
39
 
40
  // Switch Click
41
  $('.Switch').click(function() {
42
+ if ($(this).hasClass('On')) {
43
  $(this).parent().find('input:checkbox').attr('checked', true);
44
  $(this).removeClass('On').addClass('Off');
45
  } else {
49
  });
50
 
51
  });
52
+
53
  function kirkiUpdateSortable(ul) {
54
  "use strict";
55
  var $ = jQuery;
56
  var values = [];
57
  ul.find('li').each(function() {
58
+ if (!$(this).is('.invisible')) {
59
+ values.push($(this).attr('data-value'));
60
  }
61
  });
62
+ ul.siblings('input').eq(0).val(serialize(values)).trigger('change');
63
  }
64
 
65
 
66
+ (function($) {
67
+ wp.customizerCtrlEditor = {
68
+
69
+ init: function() {
70
+
71
+ $(window).load(function() {
72
+
73
+ $('textarea.wp-editor-area').each(function() {
74
+ var tArea = $(this),
75
+ id = tArea.attr('id'),
76
+ input = $('input[data-customize-setting-link="' + id + '"]'),
77
+ editor = tinyMCE.get(id),
78
+ setChange,
79
+ content;
80
+
81
+ if (editor) {
82
+ editor.onChange.add(function(ed, e) {
83
+ ed.save();
84
+ content = editor.getContent();
85
+ clearTimeout(setChange);
86
+ setChange = setTimeout(function() {
87
+ input.val(content).trigger('change');
88
+ }, 500);
89
+ });
90
+ }
91
+
92
+ if (editor) {
93
+ editor.onChange.add(function(ed, e) {
94
+ ed.save();
95
+ content = editor.getContent();
96
+ clearTimeout(setChange);
97
+ setChange = setTimeout(function() {
98
+ input.val(content).trigger('change');
99
+ }, 500);
100
+ });
101
+ }
102
+
103
+ tArea.css({
104
+ visibility: 'visible'
105
+ }).on('keyup', function() {
106
+ content = tArea.val();
107
+ clearTimeout(setChange);
108
+ setChange = setTimeout(function() {
109
+ input.val(content).trigger('change');
110
+ }, 500);
111
+ });
112
+ });
113
+ });
114
+ }
115
+
116
+ };
117
+
118
+ wp.customizerCtrlEditor.init();
119
+
120
+ })(jQuery);
121
+
122
+ jQuery(document).ready(function($) {
123
+
124
+ Color.prototype.toString = function(remove_alpha) {
125
+ if (remove_alpha == 'no-alpha') {
126
+ return this.toCSS('rgba', '1').replace(/\s+/g, '');
127
+ }
128
+ if (this._alpha < 1) {
129
+ return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
130
+ }
131
+ var hex = parseInt(this._color, 10).toString(16);
132
+ if (this.error) return '';
133
+ if (hex.length < 6) {
134
+ for (var i = 6 - hex.length - 1; i >= 0; i--) {
135
+ hex = '0' + hex;
136
+ }
137
+ }
138
+ return '#' + hex;
139
+ };
140
+
141
+ $('.kirki-color-control').each(function() {
142
+ var $control = $(this),
143
+ value = $control.val().replace(/\s+/g, '');
144
+ // Manage Palettes
145
+ var palette_input = $control.attr('data-palette');
146
+ if (palette_input == 'false' || palette_input == false) {
147
+ var palette = false;
148
+ } else if (palette_input == 'true' || palette_input == true) {
149
+ var palette = true;
150
+ } else {
151
+ var palette = $control.attr('data-palette').split(",");
152
+ }
153
+ $control.wpColorPicker({ // change some things with the color picker
154
+ clear: function(event, ui) {
155
+ // TODO reset Alpha Slider to 100
156
+ },
157
+ change: function(event, ui) {
158
+ // send ajax request to wp.customizer to enable Save & Publish button
159
+ var _new_value = $control.val();
160
+ var key = $control.attr('data-customize-setting-link');
161
+ wp.customize(key, function(obj) {
162
+ obj.set(_new_value);
163
+ });
164
+ // change the background color of our transparency container whenever a color is updated
165
+ var $transparency = $control.parents('.wp-picker-container:first').find('.transparency');
166
+ // we only want to show the color at 100% alpha
167
+ $transparency.css('backgroundColor', ui.color.toString('no-alpha'));
168
+ },
169
+ palettes: palette // remove the color palettes
170
+ });
171
+ $('<div class="kirki-alpha-container"><div class="slider-alpha"></div><div class="transparency"></div></div>').appendTo($control.parents('.wp-picker-container'));
172
+ var $alpha_slider = $control.parents('.wp-picker-container:first').find('.slider-alpha');
173
+ // if in format RGBA - grab A channel value
174
+ if (value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)) {
175
+ var alpha_val = parseFloat(value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]) * 100;
176
+ var alpha_val = parseInt(alpha_val);
177
+ } else {
178
+ var alpha_val = 100;
179
+ }
180
+ $alpha_slider.slider({
181
+ slide: function(event, ui) {
182
+ $(this).find('.ui-slider-handle').text(ui.value); // show value on slider handle
183
+ // send ajax request to wp.customizer to enable Save & Publish button
184
+ var _new_value = $control.val();
185
+ var key = $control.attr('data-customize-setting-link');
186
+ wp.customize(key, function(obj) {
187
+ obj.set(_new_value);
188
+ });
189
+ },
190
+ create: function(event, ui) {
191
+ var v = $(this).slider('value');
192
+ $(this).find('.ui-slider-handle').text(v);
193
+ },
194
+ value: alpha_val,
195
+ range: "max",
196
+ step: 1,
197
+ min: 1,
198
+ max: 100
199
+ }); // slider
200
+ $alpha_slider.slider().on('slidechange', function(event, ui) {
201
+ var new_alpha_val = parseFloat(ui.value),
202
+ iris = $control.data('a8cIris'),
203
+ color_picker = $control.data('wpWpColorPicker');
204
+ iris._color._alpha = new_alpha_val / 100.0;
205
+ $control.val(iris._color.toString());
206
+ color_picker.toggler.css({
207
+ backgroundColor: $control.val()
208
+ });
209
+ // fix relationship between alpha slider and the 'side slider not updating.
210
+ var get_val = $control.val();
211
+ $($control).wpColorPicker('color', get_val);
212
+ });
213
+ }); // each
214
+
215
+ });
assets/js/jquery.fs.stepper.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Stepper v3.0.7 - 2014-11-25
3
+ * A jQuery plugin for cross browser number inputs. Part of the Formstone Library.
4
+ * http://formstone.it/stepper/
5
+ *
6
+ * Copyright 2014 Ben Plum; MIT Licensed
7
+ */
8
+
9
+ !function(a){"use strict";function b(b){b=a.extend({},l,b||{});for(var d=a(this),e=0,f=d.length;f>e;e++)c(d.eq(e),b);return d}function c(b,c){if(!b.hasClass("stepper-input")){c=a.extend({},c,b.data("stepper-options"));var f=parseFloat(b.attr("min")),g=parseFloat(b.attr("max")),h=parseFloat(b.attr("step"))||1;b.addClass("stepper-input").wrap('<div class="stepper '+c.customClass+'" />').after('<span class="stepper-arrow up">'+c.labels.up+'</span><span class="stepper-arrow down">'+c.labels.down+"</span>");var i=b.parent(".stepper"),k=a.extend({$stepper:i,$input:b,$arrow:i.find(".stepper-arrow"),min:void 0===typeof f||isNaN(f)?!1:f,max:void 0===typeof g||isNaN(g)?!1:g,step:void 0===typeof h||isNaN(h)?1:h,timer:null},c);k.digits=j(k.step),b.is(":disabled")&&i.addClass("disabled"),i.on("keypress",".stepper-input",k,d),i.on("touchstart.stepper mousedown.stepper",".stepper-arrow",k,e),b.data("stepper",k)}}function d(a){var b=a.data;(38===a.keyCode||40===a.keyCode)&&(a.preventDefault(),g(b,38===a.keyCode?b.step:-b.step))}function e(b){b.preventDefault(),b.stopPropagation(),f(b);var c=b.data;if(!c.$input.is(":disabled")&&!c.$stepper.hasClass("disabled")){var d=a(b.target).hasClass("up")?c.step:-c.step;c.timer=h(c.timer,125,function(){g(c,d,!1)}),g(c,d),a("body").on("touchend.stepper mouseup.stepper",c,f)}}function f(b){b.preventDefault(),b.stopPropagation();var c=b.data;i(c.timer),a("body").off(".stepper")}function g(a,b){var c=parseFloat(a.$input.val()),d=b;void 0===typeof c||isNaN(c)?d=a.min!==!1?a.min:0:a.min!==!1&&c<a.min?d=a.min:d+=c;var e=(d-a.min)%a.step;0!==e&&(d-=e),a.min!==!1&&d<a.min&&(d=a.min),a.max!==!1&&d>a.max&&(d-=a.step),d!==c&&(d=k(d,a.digits),a.$input.val(d).trigger("change"))}function h(a,b,c){return i(a),setInterval(c,b)}function i(a){a&&(clearInterval(a),a=null)}function j(a){var b=String(a);return b.indexOf(".")>-1?b.length-b.indexOf(".")-1:0}function k(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}var l={customClass:"",labels:{up:"Up",down:"Down"}},m={defaults:function(b){return l=a.extend(l,b||{}),"object"==typeof this?a(this):!0},destroy:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$stepper.off(".stepper").find(".stepper-arrow").remove(),b.$input.unwrap().removeClass("stepper-input"))})},disable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled","disabled"),b.$stepper.addClass("disabled"))})},enable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled",null),b.$stepper.removeClass("disabled"))})}};a.fn.stepper=function(a){return m[a]?m[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:b.apply(this,arguments)},a.stepper=function(a){"defaults"===a&&m.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,this);
assets/js/serialize.js CHANGED
File without changes
assets/json/webfonts.json CHANGED
File without changes
assets/xml/colourlovers-top.xml CHANGED
File without changes
composer.json CHANGED
File without changes
config.codekit DELETED
@@ -1,1243 +0,0 @@
1
- {
2
- "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
- "creatorBuild": "18493",
4
- "files": {
5
- "\/assets\/css\/hint.css": {
6
- "fileType": 16,
7
- "ignore": 0,
8
- "ignoreWasSetByUser": 0,
9
- "inputAbbreviatedPath": "\/assets\/css\/hint.css",
10
- "outputAbbreviatedPath": "No Output Path",
11
- "outputPathIsOutsideProject": 0,
12
- "outputPathIsSetByUser": 0
13
- },
14
- "\/assets\/css\/jquery-ui-1.10.0.custom.css": {
15
- "fileType": 16,
16
- "ignore": 0,
17
- "ignoreWasSetByUser": 0,
18
- "inputAbbreviatedPath": "\/assets\/css\/jquery-ui-1.10.0.custom.css",
19
- "outputAbbreviatedPath": "No Output Path",
20
- "outputPathIsOutsideProject": 0,
21
- "outputPathIsSetByUser": 0
22
- },
23
- "\/assets\/css\/kirki-styles.css": {
24
- "fileType": 16,
25
- "ignore": 0,
26
- "ignoreWasSetByUser": 0,
27
- "inputAbbreviatedPath": "\/assets\/css\/kirki-styles.css",
28
- "outputAbbreviatedPath": "No Output Path",
29
- "outputPathIsOutsideProject": 0,
30
- "outputPathIsSetByUser": 0
31
- },
32
- "\/assets\/images\/1c.png": {
33
- "fileType": 32768,
34
- "ignore": 0,
35
- "ignoreWasSetByUser": 0,
36
- "initialSize": 138,
37
- "inputAbbreviatedPath": "\/assets\/images\/1c.png",
38
- "outputAbbreviatedPath": "\/assets\/images\/1c.png",
39
- "outputPathIsOutsideProject": 0,
40
- "outputPathIsSetByUser": 0,
41
- "processed": 0
42
- },
43
- "\/assets\/images\/2cl.png": {
44
- "fileType": 32768,
45
- "ignore": 0,
46
- "ignoreWasSetByUser": 0,
47
- "initialSize": 2984,
48
- "inputAbbreviatedPath": "\/assets\/images\/2cl.png",
49
- "outputAbbreviatedPath": "\/assets\/images\/2cl.png",
50
- "outputPathIsOutsideProject": 0,
51
- "outputPathIsSetByUser": 0,
52
- "processed": 0
53
- },
54
- "\/assets\/images\/2cr.png": {
55
- "fileType": 32768,
56
- "ignore": 0,
57
- "ignoreWasSetByUser": 0,
58
- "initialSize": 2985,
59
- "inputAbbreviatedPath": "\/assets\/images\/2cr.png",
60
- "outputAbbreviatedPath": "\/assets\/images\/2cr.png",
61
- "outputPathIsOutsideProject": 0,
62
- "outputPathIsSetByUser": 0,
63
- "processed": 0
64
- },
65
- "\/assets\/images\/3cl.png": {
66
- "fileType": 32768,
67
- "ignore": 0,
68
- "ignoreWasSetByUser": 0,
69
- "initialSize": 3156,
70
- "inputAbbreviatedPath": "\/assets\/images\/3cl.png",
71
- "outputAbbreviatedPath": "\/assets\/images\/3cl.png",
72
- "outputPathIsOutsideProject": 0,
73
- "outputPathIsSetByUser": 0,
74
- "processed": 0
75
- },
76
- "\/assets\/images\/3cm.png": {
77
- "fileType": 32768,
78
- "ignore": 0,
79
- "ignoreWasSetByUser": 0,
80
- "initialSize": 3036,
81
- "inputAbbreviatedPath": "\/assets\/images\/3cm.png",
82
- "outputAbbreviatedPath": "\/assets\/images\/3cm.png",
83
- "outputPathIsOutsideProject": 0,
84
- "outputPathIsSetByUser": 0,
85
- "processed": 0
86
- },
87
- "\/assets\/images\/3cr.png": {
88
- "fileType": 32768,
89
- "ignore": 0,
90
- "ignoreWasSetByUser": 0,
91
- "initialSize": 3050,
92
- "inputAbbreviatedPath": "\/assets\/images\/3cr.png",
93
- "outputAbbreviatedPath": "\/assets\/images\/3cr.png",
94
- "outputPathIsOutsideProject": 0,
95
- "outputPathIsSetByUser": 0,
96
- "processed": 0
97
- },
98
- "\/assets\/js\/customizer.js": {
99
- "fileType": 64,
100
- "ignore": 0,
101
- "ignoreWasSetByUser": 0,
102
- "inputAbbreviatedPath": "\/assets\/js\/customizer.js",
103
- "outputAbbreviatedPath": "\/assets\/js\/min\/customizer-min.js",
104
- "outputPathIsOutsideProject": 0,
105
- "outputPathIsSetByUser": 0,
106
- "outputStyle": 1,
107
- "syntaxCheckerStyle": 1
108
- },
109
- "\/assets\/js\/serialize.js": {
110
- "fileType": 64,
111
- "ignore": 0,
112
- "ignoreWasSetByUser": 0,
113
- "inputAbbreviatedPath": "\/assets\/js\/serialize.js",
114
- "outputAbbreviatedPath": "\/assets\/js\/min\/serialize-min.js",
115
- "outputPathIsOutsideProject": 0,
116
- "outputPathIsSetByUser": 0,
117
- "outputStyle": 1,
118
- "syntaxCheckerStyle": 1
119
- },
120
- "\/includes\/Config.php": {
121
- "fileType": 8192,
122
- "ignore": 0,
123
- "ignoreWasSetByUser": 0,
124
- "inputAbbreviatedPath": "\/includes\/Config.php",
125
- "outputAbbreviatedPath": "No Output Path",
126
- "outputPathIsOutsideProject": 0,
127
- "outputPathIsSetByUser": 0
128
- },
129
- "\/includes\/Control.php": {
130
- "fileType": 8192,
131
- "ignore": 0,
132
- "ignoreWasSetByUser": 0,
133
- "inputAbbreviatedPath": "\/includes\/Control.php",
134
- "outputAbbreviatedPath": "No Output Path",
135
- "outputPathIsOutsideProject": 0,
136
- "outputPathIsSetByUser": 0
137
- },
138
- "\/includes\/Controls.php": {
139
- "fileType": 8192,
140
- "ignore": 0,
141
- "ignoreWasSetByUser": 0,
142
- "inputAbbreviatedPath": "\/includes\/Controls.php",
143
- "outputAbbreviatedPath": "No Output Path",
144
- "outputPathIsOutsideProject": 0,
145
- "outputPathIsSetByUser": 0
146
- },
147
- "\/includes\/Controls\/CustomControl.php": {
148
- "fileType": 8192,
149
- "ignore": 0,
150
- "ignoreWasSetByUser": 0,
151
- "inputAbbreviatedPath": "\/includes\/Controls\/CustomControl.php",
152
- "outputAbbreviatedPath": "No Output Path",
153
- "outputPathIsOutsideProject": 0,
154
- "outputPathIsSetByUser": 0
155
- },
156
- "\/includes\/Controls\/EditorControl.php": {
157
- "fileType": 8192,
158
- "ignore": 0,
159
- "ignoreWasSetByUser": 0,
160
- "inputAbbreviatedPath": "\/includes\/Controls\/EditorControl.php",
161
- "outputAbbreviatedPath": "No Output Path",
162
- "outputPathIsOutsideProject": 0,
163
- "outputPathIsSetByUser": 0
164
- },
165
- "\/includes\/Controls\/MultiCheckControl.php": {
166
- "fileType": 8192,
167
- "ignore": 0,
168
- "ignoreWasSetByUser": 0,
169
- "inputAbbreviatedPath": "\/includes\/Controls\/MultiCheckControl.php",
170
- "outputAbbreviatedPath": "No Output Path",
171
- "outputPathIsOutsideProject": 0,
172
- "outputPathIsSetByUser": 0
173
- },
174
- "\/includes\/Controls\/NumberControl.php": {
175
- "fileType": 8192,
176
- "ignore": 0,
177
- "ignoreWasSetByUser": 0,
178
- "inputAbbreviatedPath": "\/includes\/Controls\/NumberControl.php",
179
- "outputAbbreviatedPath": "No Output Path",
180
- "outputPathIsOutsideProject": 0,
181
- "outputPathIsSetByUser": 0
182
- },
183
- "\/includes\/Controls\/PaletteControl.php": {
184
- "fileType": 8192,
185
- "ignore": 0,
186
- "ignoreWasSetByUser": 0,
187
- "inputAbbreviatedPath": "\/includes\/Controls\/PaletteControl.php",
188
- "outputAbbreviatedPath": "No Output Path",
189
- "outputPathIsOutsideProject": 0,
190
- "outputPathIsSetByUser": 0
191
- },
192
- "\/includes\/Controls\/RadioButtonSetControl.php": {
193
- "fileType": 8192,
194
- "ignore": 0,
195
- "ignoreWasSetByUser": 0,
196
- "inputAbbreviatedPath": "\/includes\/Controls\/RadioButtonSetControl.php",
197
- "outputAbbreviatedPath": "No Output Path",
198
- "outputPathIsOutsideProject": 0,
199
- "outputPathIsSetByUser": 0
200
- },
201
- "\/includes\/Controls\/RadioImageControl.php": {
202
- "fileType": 8192,
203
- "ignore": 0,
204
- "ignoreWasSetByUser": 0,
205
- "inputAbbreviatedPath": "\/includes\/Controls\/RadioImageControl.php",
206
- "outputAbbreviatedPath": "No Output Path",
207
- "outputPathIsOutsideProject": 0,
208
- "outputPathIsSetByUser": 0
209
- },
210
- "\/includes\/Controls\/SortableControl.php": {
211
- "fileType": 8192,
212
- "ignore": 0,
213
- "ignoreWasSetByUser": 0,
214
- "inputAbbreviatedPath": "\/includes\/Controls\/SortableControl.php",
215
- "outputAbbreviatedPath": "No Output Path",
216
- "outputPathIsOutsideProject": 0,
217
- "outputPathIsSetByUser": 0
218
- },
219
- "\/includes\/Controls\/SwitchControl.php": {
220
- "fileType": 8192,
221
- "ignore": 0,
222
- "ignoreWasSetByUser": 0,
223
- "inputAbbreviatedPath": "\/includes\/Controls\/SwitchControl.php",
224
- "outputAbbreviatedPath": "No Output Path",
225
- "outputPathIsOutsideProject": 0,
226
- "outputPathIsSetByUser": 0
227
- },
228
- "\/includes\/Controls\/ToggleControl.php": {
229
- "fileType": 8192,
230
- "ignore": 0,
231
- "ignoreWasSetByUser": 0,
232
- "inputAbbreviatedPath": "\/includes\/Controls\/ToggleControl.php",
233
- "outputAbbreviatedPath": "No Output Path",
234
- "outputPathIsOutsideProject": 0,
235
- "outputPathIsSetByUser": 0
236
- },
237
- "\/includes\/Fonts\/FontRegistry.php": {
238
- "fileType": 8192,
239
- "ignore": 0,
240
- "ignoreWasSetByUser": 0,
241
- "inputAbbreviatedPath": "\/includes\/Fonts\/FontRegistry.php",
242
- "outputAbbreviatedPath": "No Output Path",
243
- "outputPathIsOutsideProject": 0,
244
- "outputPathIsSetByUser": 0
245
- },
246
- "\/includes\/Helpers\/deprecated.php": {
247
- "fileType": 8192,
248
- "ignore": 0,
249
- "ignoreWasSetByUser": 0,
250
- "inputAbbreviatedPath": "\/includes\/Helpers\/deprecated.php",
251
- "outputAbbreviatedPath": "No Output Path",
252
- "outputPathIsOutsideProject": 0,
253
- "outputPathIsSetByUser": 0
254
- },
255
- "\/includes\/Helpers\/helpers.php": {
256
- "fileType": 8192,
257
- "ignore": 0,
258
- "ignoreWasSetByUser": 0,
259
- "inputAbbreviatedPath": "\/includes\/Helpers\/helpers.php",
260
- "outputAbbreviatedPath": "No Output Path",
261
- "outputPathIsOutsideProject": 0,
262
- "outputPathIsSetByUser": 0
263
- },
264
- "\/includes\/Helpers\/libraries\/class-kirki-color.php": {
265
- "fileType": 8192,
266
- "ignore": 0,
267
- "ignoreWasSetByUser": 0,
268
- "inputAbbreviatedPath": "\/includes\/Helpers\/libraries\/class-kirki-color.php",
269
- "outputAbbreviatedPath": "No Output Path",
270
- "outputPathIsOutsideProject": 0,
271
- "outputPathIsSetByUser": 0
272
- },
273
- "\/includes\/Helpers\/libraries\/class-kirki-colourlovers.php": {
274
- "fileType": 8192,
275
- "ignore": 0,
276
- "ignoreWasSetByUser": 0,
277
- "inputAbbreviatedPath": "\/includes\/Helpers\/libraries\/class-kirki-colourlovers.php",
278
- "outputAbbreviatedPath": "No Output Path",
279
- "outputPathIsOutsideProject": 0,
280
- "outputPathIsSetByUser": 0
281
- },
282
- "\/includes\/Helpers\/sanitize.php": {
283
- "fileType": 8192,
284
- "ignore": 0,
285
- "ignoreWasSetByUser": 0,
286
- "inputAbbreviatedPath": "\/includes\/Helpers\/sanitize.php",
287
- "outputAbbreviatedPath": "No Output Path",
288
- "outputPathIsOutsideProject": 0,
289
- "outputPathIsSetByUser": 0
290
- },
291
- "\/includes\/Kirki.php": {
292
- "fileType": 8192,
293
- "ignore": 0,
294
- "ignoreWasSetByUser": 0,
295
- "inputAbbreviatedPath": "\/includes\/Kirki.php",
296
- "outputAbbreviatedPath": "No Output Path",
297
- "outputPathIsOutsideProject": 0,
298
- "outputPathIsSetByUser": 0
299
- },
300
- "\/includes\/Scripts\/Customizer\/Branding.php": {
301
- "fileType": 8192,
302
- "ignore": 0,
303
- "ignoreWasSetByUser": 0,
304
- "inputAbbreviatedPath": "\/includes\/Scripts\/Customizer\/Branding.php",
305
- "outputAbbreviatedPath": "No Output Path",
306
- "outputPathIsOutsideProject": 0,
307
- "outputPathIsSetByUser": 0
308
- },
309
- "\/includes\/Scripts\/Customizer\/Dependencies.php": {
310
- "fileType": 8192,
311
- "ignore": 0,
312
- "ignoreWasSetByUser": 0,
313
- "inputAbbreviatedPath": "\/includes\/Scripts\/Customizer\/Dependencies.php",
314
- "outputAbbreviatedPath": "No Output Path",
315
- "outputPathIsOutsideProject": 0,
316
- "outputPathIsSetByUser": 0
317
- },
318
- "\/includes\/Scripts\/Customizer\/PostMessage.php": {
319
- "fileType": 8192,
320
- "ignore": 0,
321
- "ignoreWasSetByUser": 0,
322
- "inputAbbreviatedPath": "\/includes\/Scripts\/Customizer\/PostMessage.php",
323
- "outputAbbreviatedPath": "No Output Path",
324
- "outputPathIsOutsideProject": 0,
325
- "outputPathIsSetByUser": 0
326
- },
327
- "\/includes\/Scripts\/Customizer\/Required.php": {
328
- "fileType": 8192,
329
- "ignore": 0,
330
- "ignoreWasSetByUser": 0,
331
- "inputAbbreviatedPath": "\/includes\/Scripts\/Customizer\/Required.php",
332
- "outputAbbreviatedPath": "No Output Path",
333
- "outputPathIsOutsideProject": 0,
334
- "outputPathIsSetByUser": 0
335
- },
336
- "\/includes\/Scripts\/Customizer\/Tooltips.php": {
337
- "fileType": 8192,
338
- "ignore": 0,
339
- "ignoreWasSetByUser": 0,
340
- "inputAbbreviatedPath": "\/includes\/Scripts\/Customizer\/Tooltips.php",
341
- "outputAbbreviatedPath": "No Output Path",
342
- "outputPathIsOutsideProject": 0,
343
- "outputPathIsSetByUser": 0
344
- },
345
- "\/includes\/Scripts\/EnqueueScript.php": {
346
- "fileType": 8192,
347
- "ignore": 0,
348
- "ignoreWasSetByUser": 0,
349
- "inputAbbreviatedPath": "\/includes\/Scripts\/EnqueueScript.php",
350
- "outputAbbreviatedPath": "No Output Path",
351
- "outputPathIsOutsideProject": 0,
352
- "outputPathIsSetByUser": 0
353
- },
354
- "\/includes\/Scripts\/Frontend\/GoogleFonts.php": {
355
- "fileType": 8192,
356
- "ignore": 0,
357
- "ignoreWasSetByUser": 0,
358
- "inputAbbreviatedPath": "\/includes\/Scripts\/Frontend\/GoogleFonts.php",
359
- "outputAbbreviatedPath": "No Output Path",
360
- "outputPathIsOutsideProject": 0,
361
- "outputPathIsSetByUser": 0
362
- },
363
- "\/includes\/Scripts\/ScriptRegistry.php": {
364
- "fileType": 8192,
365
- "ignore": 0,
366
- "ignoreWasSetByUser": 0,
367
- "inputAbbreviatedPath": "\/includes\/Scripts\/ScriptRegistry.php",
368
- "outputAbbreviatedPath": "No Output Path",
369
- "outputPathIsOutsideProject": 0,
370
- "outputPathIsSetByUser": 0
371
- },
372
- "\/includes\/Setting.php": {
373
- "fileType": 8192,
374
- "ignore": 0,
375
- "ignoreWasSetByUser": 0,
376
- "inputAbbreviatedPath": "\/includes\/Setting.php",
377
- "outputAbbreviatedPath": "No Output Path",
378
- "outputPathIsOutsideProject": 0,
379
- "outputPathIsSetByUser": 0
380
- },
381
- "\/includes\/Styles.php": {
382
- "fileType": 8192,
383
- "ignore": 0,
384
- "ignoreWasSetByUser": 0,
385
- "inputAbbreviatedPath": "\/includes\/Styles.php",
386
- "outputAbbreviatedPath": "No Output Path",
387
- "outputPathIsOutsideProject": 0,
388
- "outputPathIsSetByUser": 0
389
- },
390
- "\/includes\/Styles\/Customizer.php": {
391
- "fileType": 8192,
392
- "ignore": 0,
393
- "ignoreWasSetByUser": 0,
394
- "inputAbbreviatedPath": "\/includes\/Styles\/Customizer.php",
395
- "outputAbbreviatedPath": "No Output Path",
396
- "outputPathIsOutsideProject": 0,
397
- "outputPathIsSetByUser": 0
398
- },
399
- "\/includes\/Styles\/Frontend.php": {
400
- "fileType": 8192,
401
- "ignore": 0,
402
- "ignoreWasSetByUser": 0,
403
- "inputAbbreviatedPath": "\/includes\/Styles\/Frontend.php",
404
- "outputAbbreviatedPath": "No Output Path",
405
- "outputPathIsOutsideProject": 0,
406
- "outputPathIsSetByUser": 0
407
- },
408
- "\/kirki.php": {
409
- "fileType": 8192,
410
- "ignore": 0,
411
- "ignoreWasSetByUser": 0,
412
- "inputAbbreviatedPath": "\/kirki.php",
413
- "outputAbbreviatedPath": "No Output Path",
414
- "outputPathIsOutsideProject": 0,
415
- "outputPathIsSetByUser": 0
416
- }
417
- },
418
- "hooks": [
419
- ],
420
- "lastSavedByUser": "Aristeides",
421
- "manualImportLinks": {
422
- },
423
- "projectAttributes": {
424
- "bowerAbbreviatedPath": "",
425
- "displayValue": "kirki",
426
- "displayValueWasSetByUser": 0,
427
- "iconImageName": "globe_brown"
428
- },
429
- "projectSettings": {
430
- "alwaysUseExternalServer": 0,
431
- "animateCSSInjections": 1,
432
- "autoApplyPSLanguageSettingsStyle": 0,
433
- "autoprefixerBrowserString": "> 1%, last 2 versions, Firefox ESR, Opera 12.1",
434
- "autoSyncProjectSettingsFile": 1,
435
- "browserRefreshDelay": 0,
436
- "coffeeAutoOutputPathEnabled": 1,
437
- "coffeeAutoOutputPathFilenamePattern": "*.js",
438
- "coffeeAutoOutputPathRelativePath": "",
439
- "coffeeAutoOutputPathReplace1": "",
440
- "coffeeAutoOutputPathReplace2": "",
441
- "coffeeAutoOutputPathStyle": 0,
442
- "coffeeCreateSourceMap": 0,
443
- "coffeeLintFlags2": {
444
- "arrow_spacing": {
445
- "active": 0,
446
- "flagValue": -1
447
- },
448
- "camel_case_classes": {
449
- "active": 1,
450
- "flagValue": -1
451
- },
452
- "colon_assignment_spacing": {
453
- "active": 0,
454
- "flagValue": 1
455
- },
456
- "cyclomatic_complexity": {
457
- "active": 0,
458
- "flagValue": 10
459
- },
460
- "duplicate_key": {
461
- "active": 1,
462
- "flagValue": -1
463
- },
464
- "empty_constructor_needs_parens": {
465
- "active": 0,
466
- "flagValue": -1
467
- },
468
- "ensure_comprehensions": {
469
- "active": 1,
470
- "flagValue": -1
471
- },
472
- "indentation": {
473
- "active": 1,
474
- "flagValue": 2
475
- },
476
- "line_endings": {
477
- "active": 0,
478
- "flagValue": 0
479
- },
480
- "max_line_length": {
481
- "active": 0,
482
- "flagValue": 150
483
- },
484
- "missing_fat_arrows": {
485
- "active": 0,
486
- "flagValue": -1
487
- },
488
- "newlines_after_classes": {
489
- "active": 0,
490
- "flagValue": 3
491
- },
492
- "no_backticks": {
493
- "active": 1,
494
- "flagValue": -1
495
- },
496
- "no_debugger": {
497
- "active": 1,
498
- "flagValue": -1
499
- },
500
- "no_empty_functions": {
501
- "active": 0,
502
- "flagValue": -1
503
- },
504
- "no_empty_param_list": {
505
- "active": 0,
506
- "flagValue": -1
507
- },
508
- "no_implicit_braces": {
509
- "active": 1,
510
- "flagValue": -1
511
- },
512
- "no_implicit_parens": {
513
- "active": 0,
514
- "flagValue": -1
515
- },
516
- "no_interpolation_in_single_quotes": {
517
- "active": 0,
518
- "flagValue": -1
519
- },
520
- "no_plusplus": {
521
- "active": 0,
522
- "flagValue": -1
523
- },
524
- "no_stand_alone_at": {
525
- "active": 1,
526
- "flagValue": -1
527
- },
528
- "no_tabs": {
529
- "active": 1,
530
- "flagValue": -1
531
- },
532
- "no_throwing_strings": {
533
- "active": 1,
534
- "flagValue": -1
535
- },
536
- "no_trailing_semicolons": {
537
- "active": 1,
538
- "flagValue": -1
539
- },
540
- "no_trailing_whitespace": {
541
- "active": 1,
542
- "flagValue": -1
543
- },
544
- "no_unnecessary_double_quotes": {
545
- "active": 0,
546
- "flagValue": -1
547
- },
548
- "no_unnecessary_fat_arrows": {
549
- "active": 1,
550
- "flagValue": -1
551
- },
552
- "non_empty_constructor_needs_parens": {
553
- "active": 0,
554
- "flagValue": -1
555
- },
556
- "prefer_english_operator": {
557
- "active": 0,
558
- "flagValue": -1
559
- },
560
- "space_operators": {
561
- "active": 0,
562
- "flagValue": -1
563
- },
564
- "spacing_after_comma": {
565
- "active": 1,
566
- "flagValue": -1
567
- }
568
- },
569
- "coffeeMinifyOutput": 1,
570
- "coffeeOutputStyle": 0,
571
- "coffeeSyntaxCheckerStyle": 1,
572
- "externalServerAddress": "http:\/\/localhost:8888",
573
- "externalServerPreviewPathAddition": "",
574
- "genericWebpageFileExtensionsString": "html, htm, shtml, shtm, xhtml, php, jsp, asp, aspx, erb, ctp",
575
- "hamlAutoOutputPathEnabled": 1,
576
- "hamlAutoOutputPathFilenamePattern": "*.html",
577
- "hamlAutoOutputPathRelativePath": "",
578
- "hamlAutoOutputPathReplace1": "",
579
- "hamlAutoOutputPathReplace2": "",
580
- "hamlAutoOutputPathStyle": 0,
581
- "hamlEscapeHTMLCharacters": 0,
582
- "hamlNoEscapeInAttributes": 0,
583
- "hamlOutputFormat": 2,
584
- "hamlOutputStyle": 0,
585
- "hamlUseCDATA": 0,
586
- "hamlUseDoubleQuotes": 0,
587
- "hamlUseUnixNewlines": 0,
588
- "jadeAutoOutputPathEnabled": 1,
589
- "jadeAutoOutputPathFilenamePattern": "*.html",
590
- "jadeAutoOutputPathRelativePath": "",
591
- "jadeAutoOutputPathReplace1": "",
592
- "jadeAutoOutputPathReplace2": "",
593
- "jadeAutoOutputPathStyle": 0,
594
- "jadeCompileDebug": 1,
595
- "jadeOutputStyle": 0,
596
- "javascriptAutoOutputPathEnabled": 1,
597
- "javascriptAutoOutputPathFilenamePattern": "*-min.js",
598
- "javascriptAutoOutputPathRelativePath": "\/min",
599
- "javascriptAutoOutputPathReplace1": "",
600
- "javascriptAutoOutputPathReplace2": "",
601
- "javascriptAutoOutputPathStyle": 2,
602
- "javascriptCreateSourceMap": 1,
603
- "javascriptOutputStyle": 1,
604
- "javascriptSyntaxCheckerStyle": 1,
605
- "jsCheckerReservedNamesString": "",
606
- "jsHintFlags2": {
607
- "asi": {
608
- "active": 0,
609
- "flagValue": -1
610
- },
611
- "bitwise": {
612
- "active": 1,
613
- "flagValue": -1
614
- },
615
- "boss": {
616
- "active": 0,
617
- "flagValue": -1
618
- },
619
- "browser": {
620
- "active": 1,
621
- "flagValue": -1
622
- },
623
- "browserify": {
624
- "active": 0,
625
- "flagValue": -1
626
- },
627
- "camelcase": {
628
- "active": 0,
629
- "flagValue": -1
630
- },
631
- "couch": {
632
- "active": 0,
633
- "flagValue": -1
634
- },
635
- "curly": {
636
- "active": 1,
637
- "flagValue": -1
638
- },
639
- "debug": {
640
- "active": 0,
641
- "flagValue": -1
642
- },
643
- "devel": {
644
- "active": 0,
645
- "flagValue": -1
646
- },
647
- "dojo": {
648
- "active": 0,
649
- "flagValue": -1
650
- },
651
- "elision": {
652
- "active": 1,
653
- "flagValue": -1
654
- },
655
- "eqeqeq": {
656
- "active": 1,
657
- "flagValue": -1
658
- },
659
- "eqnull": {
660
- "active": 0,
661
- "flagValue": -1
662
- },
663
- "es3": {
664
- "active": 0,
665
- "flagValue": -1
666
- },
667
- "esnext": {
668
- "active": 0,
669
- "flagValue": -1
670
- },
671
- "evil": {
672
- "active": 0,
673
- "flagValue": -1
674
- },
675
- "expr": {
676
- "active": 0,
677
- "flagValue": -1
678
- },
679
- "forin": {
680
- "active": 0,
681
- "flagValue": -1
682
- },
683
- "freeze": {
684
- "active": 1,
685
- "flagValue": -1
686
- },
687
- "funcscope": {
688
- "active": 0,
689
- "flagValue": -1
690
- },
691
- "globalstrict": {
692
- "active": 0,
693
- "flagValue": -1
694
- },
695
- "immed": {
696
- "active": 0,
697
- "flagValue": -1
698
- },
699
- "indent": {
700
- "active": 0,
701
- "flagValue": 4
702
- },
703
- "iterator": {
704
- "active": 0,
705
- "flagValue": -1
706
- },
707
- "jasmine": {
708
- "active": 0,
709
- "flagValue": -1
710
- },
711
- "jquery": {
712
- "active": 1,
713
- "flagValue": -1
714
- },
715
- "lastsemic": {
716
- "active": 0,
717
- "flagValue": -1
718
- },
719
- "latedef": {
720
- "active": 1,
721
- "flagValue": -1
722
- },
723
- "laxbreak": {
724
- "active": 0,
725
- "flagValue": -1
726
- },
727
- "laxcomma": {
728
- "active": 0,
729
- "flagValue": -1
730
- },
731
- "loopfunc": {
732
- "active": 0,
733
- "flagValue": -1
734
- },
735
- "maxcomplexity": {
736
- "active": 0,
737
- "flagValue": 10
738
- },
739
- "maxdepth": {
740
- "active": 0,
741
- "flagValue": 3
742
- },
743
- "maxlen": {
744
- "active": 0,
745
- "flagValue": 150
746
- },
747
- "maxparams": {
748
- "active": 0,
749
- "flagValue": 3
750
- },
751
- "maxstatements": {
752
- "active": 0,
753
- "flagValue": 4
754
- },
755
- "mocha": {
756
- "active": 0,
757
- "flagValue": -1
758
- },
759
- "mootools": {
760
- "active": 0,
761
- "flagValue": -1
762
- },
763
- "moz": {
764
- "active": 0,
765
- "flagValue": -1
766
- },
767
- "multistr": {
768
- "active": 0,
769
- "flagValue": -1
770
- },
771
- "newcap": {
772
- "active": 1,
773
- "flagValue": -1
774
- },
775
- "noarg": {
776
- "active": 1,
777
- "flagValue": -1
778
- },
779
- "node": {
780
- "active": 0,
781
- "flagValue": -1
782
- },
783
- "noempty": {
784
- "active": 0,
785
- "flagValue": -1
786
- },
787
- "nonbsp": {
788
- "active": 0,
789
- "flagValue": -1
790
- },
791
- "nonew": {
792
- "active": 1,
793
- "flagValue": -1
794
- },
795
- "nonstandard": {
796
- "active": 0,
797
- "flagValue": -1
798
- },
799
- "notypeof": {
800
- "active": 1,
801
- "flagValue": -1
802
- },
803
- "noyield": {
804
- "active": 0,
805
- "flagValue": -1
806
- },
807
- "onecase": {
808
- "active": 0,
809
- "flagValue": -1
810
- },
811
- "phantom": {
812
- "active": 0,
813
- "flagValue": -1
814
- },
815
- "plusplus": {
816
- "active": 0,
817
- "flagValue": -1
818
- },
819
- "proto": {
820
- "active": 0,
821
- "flagValue": -1
822
- },
823
- "prototypejs": {
824
- "active": 0,
825
- "flagValue": -1
826
- },
827
- "qunit": {
828
- "active": 0,
829
- "flagValue": -1
830
- },
831
- "regexp": {
832
- "active": 1,
833
- "flagValue": -1
834
- },
835
- "rhino": {
836
- "active": 0,
837
- "flagValue": -1
838
- },
839
- "scripturl": {
840
- "active": 0,
841
- "flagValue": -1
842
- },
843
- "shadow": {
844
- "active": 0,
845
- "flagValue": -1
846
- },
847
- "shelljs": {
848
- "active": 0,
849
- "flagValue": -1
850
- },
851
- "singleGroups": {
852
- "active": 0,
853
- "flagValue": -1
854
- },
855
- "strict": {
856
- "active": 0,
857
- "flagValue": -1
858
- },
859
- "sub": {
860
- "active": 0,
861
- "flagValue": -1
862
- },
863
- "supernew": {
864
- "active": 0,
865
- "flagValue": -1
866
- },
867
- "typed": {
868
- "active": 0,
869
- "flagValue": -1
870
- },
871
- "undef": {
872
- "active": 1,
873
- "flagValue": -1
874
- },
875
- "unused": {
876
- "active": 1,
877
- "flagValue": -1
878
- },
879
- "withstmt": {
880
- "active": 0,
881
- "flagValue": -1
882
- },
883
- "worker": {
884
- "active": 0,
885
- "flagValue": -1
886
- },
887
- "wsh": {
888
- "active": 0,
889
- "flagValue": -1
890
- },
891
- "yui": {
892
- "active": 0,
893
- "flagValue": -1
894
- }
895
- },
896
- "jsLintFlags2": {
897
- "ass": {
898
- "active": 0,
899
- "flagValue": -1
900
- },
901
- "bitwise": {
902
- "active": 0,
903
- "flagValue": -1
904
- },
905
- "browser": {
906
- "active": 1,
907
- "flagValue": -1
908
- },
909
- "closure": {
910
- "active": 0,
911
- "flagValue": -1
912
- },
913
- "continue": {
914
- "active": 0,
915
- "flagValue": -1
916
- },
917
- "debug": {
918
- "active": 0,
919
- "flagValue": -1
920
- },
921
- "devel": {
922
- "active": 0,
923
- "flagValue": -1
924
- },
925
- "eqeq": {
926
- "active": 0,
927
- "flagValue": -1
928
- },
929
- "evil": {
930
- "active": 0,
931
- "flagValue": -1
932
- },
933
- "forin": {
934
- "active": 0,
935
- "flagValue": -1
936
- },
937
- "indent": {
938
- "active": 0,
939
- "flagValue": 4
940
- },
941
- "maxlen": {
942
- "active": 0,
943
- "flagValue": 150
944
- },
945
- "newcap": {
946
- "active": 0,
947
- "flagValue": -1
948
- },
949
- "node": {
950
- "active": 0,
951
- "flagValue": -1
952
- },
953
- "nomen": {
954
- "active": 0,
955
- "flagValue": -1
956
- },
957
- "plusplus": {
958
- "active": 0,
959
- "flagValue": -1
960
- },
961
- "properties": {
962
- "active": 0,
963
- "flagValue": -1
964
- },
965
- "regexp": {
966
- "active": 0,
967
- "flagValue": -1
968
- },
969
- "rhino": {
970
- "active": 0,
971
- "flagValue": -1
972
- },
973
- "sloppy": {
974
- "active": 0,
975
- "flagValue": -1
976
- },
977
- "stupid": {
978
- "active": 0,
979
- "flagValue": -1
980
- },
981
- "sub": {
982
- "active": 0,
983
- "flagValue": -1
984
- },
985
- "todo": {
986
- "active": 0,
987
- "flagValue": -1
988
- },
989
- "unparam": {
990
- "active": 0,
991
- "flagValue": -1
992
- },
993
- "vars": {
994
- "active": 0,
995
- "flagValue": -1
996
- },
997
- "white": {
998
- "active": 0,
999
- "flagValue": -1
1000
- }
1001
- },
1002
- "kitAutoOutputPathEnabled": 1,
1003
- "kitAutoOutputPathFilenamePattern": "*.html",
1004
- "kitAutoOutputPathRelativePath": "",
1005
- "kitAutoOutputPathReplace1": "",
1006
- "kitAutoOutputPathReplace2": "",
1007
- "kitAutoOutputPathStyle": 0,
1008
- "lessAllowInsecureImports": 0,
1009
- "lessAutoOutputPathEnabled": 1,
1010
- "lessAutoOutputPathFilenamePattern": "*.css",
1011
- "lessAutoOutputPathRelativePath": "..\/css",
1012
- "lessAutoOutputPathReplace1": "less",
1013
- "lessAutoOutputPathReplace2": "css",
1014
- "lessAutoOutputPathStyle": 2,
1015
- "lessCreateSourceMap": 0,
1016
- "lessDisableJavascript": 0,
1017
- "lessIeCompatibility": 1,
1018
- "lessOutputStyle": 0,
1019
- "lessRelativeURLS": 0,
1020
- "lessStrictImports": 0,
1021
- "lessStrictMath": 0,
1022
- "lessStrictUnits": 0,
1023
- "markdownAutoOutputPathEnabled": 1,
1024
- "markdownAutoOutputPathFilenamePattern": "*.html",
1025
- "markdownAutoOutputPathRelativePath": "",
1026
- "markdownAutoOutputPathReplace1": "",
1027
- "markdownAutoOutputPathReplace2": "",
1028
- "markdownAutoOutputPathStyle": 0,
1029
- "markdownEnableFootnotes": 0,
1030
- "markdownEnableSmartyPants": 1,
1031
- "markdownExpandTabs": 1,
1032
- "reloadFileURLs": 0,
1033
- "sassAutoOutputPathEnabled": 1,
1034
- "sassAutoOutputPathFilenamePattern": "*.css",
1035
- "sassAutoOutputPathRelativePath": "..\/css",
1036
- "sassAutoOutputPathReplace1": "sass",
1037
- "sassAutoOutputPathReplace2": "css",
1038
- "sassAutoOutputPathStyle": 2,
1039
- "sassCreateSourceMap": 0,
1040
- "sassDebugStyle": 0,
1041
- "sassDecimalPrecision": 10,
1042
- "sassOutputStyle": 0,
1043
- "sassUseLibsass": 0,
1044
- "shouldRunAutoprefixer": 0,
1045
- "shouldRunBless": 0,
1046
- "skippedItemsString": ".svn, .git, .hg, log, _logs, _cache, cache, logs, node_modules",
1047
- "slimAutoOutputPathEnabled": 1,
1048
- "slimAutoOutputPathFilenamePattern": "*.html",
1049
- "slimAutoOutputPathRelativePath": "",
1050
- "slimAutoOutputPathReplace1": "",
1051
- "slimAutoOutputPathReplace2": "",
1052
- "slimAutoOutputPathStyle": 0,
1053
- "slimCompileOnly": 0,
1054
- "slimLogicless": 0,
1055
- "slimOutputFormat": 0,
1056
- "slimOutputStyle": 1,
1057
- "slimRailsCompatible": 0,
1058
- "stylusAutoOutputPathEnabled": 1,
1059
- "stylusAutoOutputPathFilenamePattern": "*.css",
1060
- "stylusAutoOutputPathRelativePath": "..\/css",
1061
- "stylusAutoOutputPathReplace1": "stylus",
1062
- "stylusAutoOutputPathReplace2": "css",
1063
- "stylusAutoOutputPathStyle": 2,
1064
- "stylusCreateSourceMap": 0,
1065
- "stylusDebugStyle": 0,
1066
- "stylusImportCSS": 0,
1067
- "stylusOutputStyle": 0,
1068
- "stylusResolveRelativeURLS": 0,
1069
- "typescriptAutoOutputPathEnabled": 1,
1070
- "typescriptAutoOutputPathFilenamePattern": "*.js",
1071
- "typescriptAutoOutputPathRelativePath": "\/js",
1072
- "typescriptAutoOutputPathReplace1": "",
1073
- "typescriptAutoOutputPathReplace2": "",
1074
- "typescriptAutoOutputPathStyle": 2,
1075
- "typescriptCreateDeclarationFile": 0,
1076
- "typescriptCreateSourceMap": 0,
1077
- "typescriptMinifyOutput": 0,
1078
- "typescriptModuleType": 0,
1079
- "typescriptNoImplicitAny": 0,
1080
- "typescriptPreserveConstEnums": 0,
1081
- "typescriptRemoveComments": 0,
1082
- "typescriptSuppressImplicitAnyIndexErrors": 0,
1083
- "typescriptTargetECMAVersion": 0,
1084
- "uglifyDefinesString": "",
1085
- "uglifyFlags2": {
1086
- "ascii-only": {
1087
- "active": 0,
1088
- "flagValue": -1
1089
- },
1090
- "booleans": {
1091
- "active": 1,
1092
- "flagValue": -1
1093
- },
1094
- "bracketize": {
1095
- "active": 0,
1096
- "flagValue": -1
1097
- },
1098
- "cascade": {
1099
- "active": 1,
1100
- "flagValue": -1
1101
- },
1102
- "comments": {
1103
- "active": 1,
1104
- "flagValue": -1
1105
- },
1106
- "comparisons": {
1107
- "active": 1,
1108
- "flagValue": -1
1109
- },
1110
- "compress": {
1111
- "active": 1,
1112
- "flagValue": -1
1113
- },
1114
- "conditionals": {
1115
- "active": 1,
1116
- "flagValue": -1
1117
- },
1118
- "dead_code": {
1119
- "active": 0,
1120
- "flagValue": -1
1121
- },
1122
- "drop_console": {
1123
- "active": 0,
1124
- "flagValue": -1
1125
- },
1126
- "drop_debugger": {
1127
- "active": 1,
1128
- "flagValue": -1
1129
- },
1130
- "eval": {
1131
- "active": 0,
1132
- "flagValue": -1
1133
- },
1134
- "evaluate": {
1135
- "active": 1,
1136
- "flagValue": -1
1137
- },
1138
- "hoist_funs": {
1139
- "active": 1,
1140
- "flagValue": -1
1141
- },
1142
- "hoist_vars": {
1143
- "active": 0,
1144
- "flagValue": -1
1145
- },
1146
- "if_return": {
1147
- "active": 1,
1148
- "flagValue": -1
1149
- },
1150
- "indent-level": {
1151
- "active": 0,
1152
- "flagValue": 4
1153
- },
1154
- "indent-start": {
1155
- "active": 0,
1156
- "flagValue": 0
1157
- },
1158
- "inline-script": {
1159
- "active": 0,
1160
- "flagValue": -1
1161
- },
1162
- "join_vars": {
1163
- "active": 1,
1164
- "flagValue": -1
1165
- },
1166
- "keep_fargs": {
1167
- "active": 0,
1168
- "flagValue": -1
1169
- },
1170
- "loops": {
1171
- "active": 1,
1172
- "flagValue": -1
1173
- },
1174
- "mangle": {
1175
- "active": 1,
1176
- "flagValue": -1
1177
- },
1178
- "max-line-len": {
1179
- "active": 1,
1180
- "flagValue": 32000
1181
- },
1182
- "negate_iife": {
1183
- "active": 1,
1184
- "flagValue": -1
1185
- },
1186
- "properties": {
1187
- "active": 1,
1188
- "flagValue": -1
1189
- },
1190
- "pure_getters": {
1191
- "active": 0,
1192
- "flagValue": -1
1193
- },
1194
- "quote-keys": {
1195
- "active": 0,
1196
- "flagValue": -1
1197
- },
1198
- "screw-ie8": {
1199
- "active": 0,
1200
- "flagValue": -1
1201
- },
1202
- "semicolons": {
1203
- "active": 1,
1204
- "flagValue": -1
1205
- },
1206
- "sequences": {
1207
- "active": 1,
1208
- "flagValue": -1
1209
- },
1210
- "sort": {
1211
- "active": 0,
1212
- "flagValue": -1
1213
- },
1214
- "space-colon": {
1215
- "active": 1,
1216
- "flagValue": -1
1217
- },
1218
- "toplevel": {
1219
- "active": 0,
1220
- "flagValue": -1
1221
- },
1222
- "unsafe": {
1223
- "active": 0,
1224
- "flagValue": -1
1225
- },
1226
- "unused": {
1227
- "active": 0,
1228
- "flagValue": -1
1229
- },
1230
- "warnings": {
1231
- "active": 0,
1232
- "flagValue": -1
1233
- },
1234
- "width": {
1235
- "active": 1,
1236
- "flagValue": 80
1237
- }
1238
- },
1239
- "uglifyReservedNamesString": "$",
1240
- "websiteRelativeRoot": ""
1241
- },
1242
- "settingsFileVersion": "2"
1243
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Builder.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Kirki;
4
+
5
+ use Kirki;
6
+ use Kirki\Settings;
7
+ use Kirki\Controls;
8
+
9
+ class Builder {
10
+
11
+ public $settings;
12
+ private $controls;
13
+
14
+ public function __construct() {
15
+
16
+ $this->settings = new Settings();
17
+ $this->controls = new Controls();
18
+ add_action( 'customize_register', array( $this, 'build' ), 99 );
19
+
20
+ }
21
+
22
+ /**
23
+ * Build the customizer fields.
24
+ * Parses all fields and creates the setting & control for each of them.
25
+ */
26
+ public function build( $wp_customize ) {
27
+ $fields = Kirki::fields()->get_all();
28
+
29
+ // Early exit if controls are not set or if they're empty
30
+ if ( empty( $fields ) ) {
31
+ return;
32
+ }
33
+
34
+ foreach ( $fields as $field ) {
35
+ $this->build_field( $wp_customize, $field );
36
+ }
37
+
38
+ }
39
+
40
+ /**
41
+ * Build a single field
42
+ */
43
+ public function build_field( $wp_customize, $field ) {
44
+ $this->settings->add( $wp_customize, $field );
45
+ $this->controls->add( $wp_customize, $field );
46
+ }
47
+
48
+ }
includes/Config.php CHANGED
@@ -4,80 +4,84 @@ namespace Kirki;
4
 
5
  class Config {
6
 
7
- /** @var array The configuration values for Kirki */
8
- private $config = null;
9
-
10
- /**
11
- * Constructor
12
- */
13
- public function __construct() {
14
- }
15
-
16
- /**
17
- * Get a configuration value
18
- *
19
- * @param string $key The configuration key we are interested in
20
- * @param string $default The default value if that configuration is not set
21
- *
22
- * @return mixed
23
- */
24
- public function get( $key, $default='' ) {
25
-
26
- $cfg = $this->get_all();
27
- return isset( $cfg[$key] ) ? $cfg[$key] : $default;
28
-
29
- }
30
-
31
- /**
32
- * Get a configuration value or throw an exception if that value is mandatory
33
- *
34
- * @param string $key The configuration key we are interested in
35
- *
36
- * @return mixed
37
- */
38
- public function getOrThrow( $key ) {
39
-
40
- $cfg = $this->get_all();
41
- if ( isset( $cfg[$key] ) ) {
42
- return $cfg[$key];
43
- }
44
-
45
- throw new RuntimeException( sprintf( "Configuration key %s is mandatory and has not been specified", $key ) );
46
-
47
- }
48
-
49
- /**
50
- * Get the configuration options for the Kirki customizer.
51
- *
52
- * @uses 'kirki/config' filter.
53
- */
54
- public function get_all() {
55
-
56
- if ( is_null( $this->config ) ) {
57
-
58
- // Get configuration from the filter
59
- $this->config = apply_filters( 'kirki/config', array() );
60
-
61
- // Merge a default configuration with the one we got from the user to make sure nothing is missing
62
- $default_config = array(
63
- 'stylesheet_id' => 'kirki-styles'
64
- );
65
- $this->config = array_merge( $default_config, $this->config );
66
- if ( isset( $this->config['logo_image'] ) ) {
67
- $this->config['logo_image'] = esc_url_raw( $this->config['logo_image'] );
68
- }
69
- if ( isset( $this->config['description'] ) ) {
70
- $this->config['description'] = esc_html( $this->config['description'] );
71
- }
 
 
 
72
 
73
  // Get the translation strings.
74
  $this->config['i18n'] = ( ! isset( $this->config['i18n'] ) ) ? array() : $this->config['i18n'];
75
  $this->config['i18n'] = array_merge( $this->translation_strings(), $this->config['i18n'] );
76
 
77
- }
 
 
78
 
79
- return $this->config;
80
- }
81
 
82
  /**
83
  * The i18n strings
4
 
5
  class Config {
6
 
7
+ /** @var array The configuration values for Kirki */
8
+ private $config = null;
9
+
10
+ /**
11
+ * Constructor
12
+ */
13
+ public function __construct() {
14
+ }
15
+
16
+ /**
17
+ * Get a configuration value
18
+ *
19
+ * @param string $key The configuration key we are interested in
20
+ * @param string $default The default value if that configuration is not set
21
+ *
22
+ * @return mixed
23
+ */
24
+ public function get( $key, $default='' ) {
25
+
26
+ $cfg = $this->get_all();
27
+ return isset( $cfg[$key] ) ? $cfg[$key] : $default;
28
+
29
+ }
30
+
31
+ /**
32
+ * Get a configuration value or throw an exception if that value is mandatory
33
+ *
34
+ * @param string $key The configuration key we are interested in
35
+ *
36
+ * @return mixed
37
+ */
38
+ public function getOrThrow( $key ) {
39
+
40
+ $cfg = $this->get_all();
41
+ if ( isset( $cfg[$key] ) ) {
42
+ return $cfg[$key];
43
+ }
44
+
45
+ throw new RuntimeException( sprintf( "Configuration key %s is mandatory and has not been specified", $key ) );
46
+
47
+ }
48
+
49
+ /**
50
+ * Get the configuration options for the Kirki customizer.
51
+ *
52
+ * @uses 'kirki/config' filter.
53
+ */
54
+ public function get_all() {
55
+
56
+ if ( is_null( $this->config ) ) {
57
+
58
+ // Get configuration from the filter
59
+ $this->config = apply_filters( 'kirki/config', array() );
60
+
61
+ // Merge a default configuration with the one we got from the user to make sure nothing is missing
62
+ $default_config = array(
63
+ 'stylesheet_id' => 'kirki-styles',
64
+ 'capability' => 'edit_theme_options',
65
+ 'logo_image' => '',
66
+ 'description' => '',
67
+ 'url_path' => '',
68
+ 'options_type' => 'theme_mod',
69
+ );
70
+ $this->config = array_merge( $default_config, $this->config );
71
+
72
+ $this->config['logo_image'] = esc_url_raw( $this->config['logo_image'] );
73
+ $this->config['description'] = esc_html( $this->config['description'] );
74
+ $this->config['url_path'] = esc_url_raw( $this->config['url_path'] );
75
 
76
  // Get the translation strings.
77
  $this->config['i18n'] = ( ! isset( $this->config['i18n'] ) ) ? array() : $this->config['i18n'];
78
  $this->config['i18n'] = array_merge( $this->translation_strings(), $this->config['i18n'] );
79
 
80
+ }
81
+
82
+ return $this->config;
83
 
84
+ }
 
85
 
86
  /**
87
  * The i18n strings
includes/Control.php DELETED
@@ -1,309 +0,0 @@
1
- <?php
2
-
3
- namespace Kirki;
4
-
5
- use Kirki;
6
- use Kirki\Controls\CustomControl;
7
- use Kirki\Controls\EditorControl;
8
- use Kirki\Controls\MultiCheckControl;
9
- use Kirki\Controls\NumberControl;
10
- use Kirki\Controls\PaletteControl;
11
- use Kirki\Controls\RadioButtonSetControl;
12
- use Kirki\Controls\RadioImageControl;
13
- use Kirki\Controls\SliderControl;
14
- use Kirki\Controls\SortableControl;
15
- use Kirki\Controls\SwitchControl;
16
- use Kirki\Controls\ToggleControl;
17
-
18
- class Control {
19
-
20
- /**
21
- * Cleanup a single controls.
22
- */
23
- public static function sanitize( $control ) {
24
-
25
- /**
26
- * If ['default'] is not set, set an empty value
27
- */
28
- if ( ! isset( $control['default'] ) ) {
29
- $control['default'] = '';
30
- }
31
-
32
- /**
33
- * Sanitize label
34
- */
35
- $control['label'] = ( isset( $control['label'] ) ) ? esc_html( $control['label'] ) : '';
36
-
37
- /**
38
- * sanitize description
39
- */
40
- $control['description'] = ( isset( $control['description'] ) ) ? esc_html( $control['description'] ) : '';
41
-
42
- /**
43
- * Compatibility tweak
44
- *
45
- * Previous verions of the Kirki Customizer had the 'description' field mapped to the new 'help'
46
- * and instead of 'description' we were using 'subtitle'.
47
- * This has been deprecated in favor of WordPress core's 'description' field that was recently introduced.
48
- *
49
- */
50
- if ( isset( $control['subtitle'] ) ) {
51
- // Use old arguments form.
52
- $control['help'] = ( isset( $control['description'] ) ) ? $control['description'] : '';
53
- $control['description'] = $control['subtitle'];
54
- }
55
- $control['description'] = isset( $control['description'] ) ? $control['description'] : '';
56
- $control['help'] = isset( $control['help'] ) ? esc_html( $control['help'] ) : '';
57
-
58
- /**
59
- * Compatibility tweak
60
- *
61
- * Previous versions of the Kirki customizer used 'setting' istead of 'settings'.
62
- */
63
- if ( ! isset( $control['settings'] ) && isset( $control['setting'] ) ) {
64
- $control['settings'] = $control['setting'];
65
- }
66
-
67
- $control['required'] = isset( $control['required'] ) ? $control['required'] : array();
68
- $control['transport'] = isset( $control['transport'] ) ? $control['transport'] : 'refresh';
69
-
70
- /**
71
- * Sortable controls need a serialized array as the default value.
72
- * Since we're using normal arrays to set our defaults when defining the fields, we need to serialize that value here.
73
- */
74
- if ( 'sortable' == $control['type'] && isset( $control['default'] ) && ! empty( $control['default'] ) ) {
75
- $control['default'] = maybe_serialize( $control['default'] );
76
- }
77
-
78
- return $control;
79
-
80
- }
81
-
82
- /**
83
- * Add our fields.
84
- * We use the default WordPress Core Customizer fields when possible
85
- * and only add our own custom controls when needed.
86
- */
87
- public function add( $wp_customize, $control ) {
88
-
89
- $i18n = Kirki::i18n();
90
-
91
- $control = self::sanitize( $control );
92
-
93
- // Text, Dropdown Pages, Textarea, Select, checkbox & radio controls
94
- if ( in_array( $control['type'], array( 'text', 'dropdown-pages', 'textarea', 'select', 'checkbox', 'radio' ) ) ) {
95
- $wp_customize->add_control( new \WP_Customize_Control( $wp_customize, $control['settings'], $control ) );
96
- }
97
-
98
- // Color controls
99
- elseif ( 'color' == $control['type'] ) {
100
- $wp_customize->add_control( new \WP_Customize_Color_Control( $wp_customize, $control['settings'], $control ) );
101
- }
102
-
103
- // Image Controls
104
- elseif ( 'image' == $control['type'] ) {
105
- $wp_customize->add_control( new \WP_Customize_Image_Control( $wp_customize, $control['settings'], $control ) );
106
- }
107
-
108
- // Upload Controls
109
- elseif ( 'upload' == $control['type'] ) {
110
- $wp_customize->add_control( new \WP_Customize_Upload_Control( $wp_customize, $control['settings'], $control ) );
111
- }
112
-
113
- // Switch Controls
114
- elseif ( 'switch' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'switch' == $control['mode'] ) ) {
115
- $wp_customize->add_control( new SwitchControl( $wp_customize, $control['settings'], $control ) );
116
- }
117
-
118
- // Toggle Controls
119
- elseif ( 'toggle' == $control['type'] || ( 'checkbox' == $control['type'] && isset( $control['mode'] ) && 'toggle' == $control['mode'] ) ) {
120
- $wp_customize->add_control( new ToggleControl( $wp_customize, $control['settings'], $control ) );
121
- }
122
-
123
- // Radio-Buttonset Controls
124
- elseif ( 'radio-buttonset' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'buttonset' == $control['mode'] ) ) {
125
- $wp_customize->add_control( new RadioButtonSetControl( $wp_customize, $control['settings'], $control ) );
126
- }
127
-
128
- // Radio-Image Controls
129
- elseif ( 'radio-image' == $control['type'] || ( 'radio' == $control['type'] && isset( $control['mode'] ) && 'image' == $control['mode'] ) ) {
130
- $wp_customize->add_control( new RadioImageControl( $wp_customize, $control['settings'], $control ) );
131
- }
132
-
133
- // Sortable Controls
134
- elseif ( 'sortable' == $control['type'] ) {
135
- $wp_customize->add_control( new SortableControl( $wp_customize, $control['settings'], $control ) );
136
- }
137
-
138
- // Slider Controls
139
- elseif ( 'slider' == $control['type'] ) {
140
- $wp_customize->add_control( new SliderControl( $wp_customize, $control['settings'], $control ) );
141
- }
142
-
143
- // Number Controls
144
- elseif ( 'number' == $control['type'] ) {
145
- $wp_customize->add_control( new NumberControl( $wp_customize, $control['settings'], $control ) );
146
- }
147
-
148
- // Multicheck Controls
149
- elseif ( 'multicheck' == $control['type'] ) {
150
- $wp_customize->add_control( new MultiCheckControl( $wp_customize, $control['settings'], $control ) );
151
- }
152
-
153
- // Palette Control
154
- elseif ( 'palette' == $control['type'] ) {
155
- $wp_customize->add_control( new PaletteControl( $wp_customize, $control['settings'], $control ) );
156
- }
157
-
158
- // Custom Control
159
- elseif ( in_array( $control['type'], array( 'custom', 'group-title', 'group_title' ) ) ) {
160
- $wp_customize->add_control( new CustomControl( $wp_customize, $control['settings'], $control ) );
161
- }
162
-
163
- // Custom Control
164
- elseif ( 'editor' == $control['type'] ) {
165
- $wp_customize->add_control( new EditorControl( $wp_customize, $control['settings'], $control ) );
166
- }
167
-
168
- // Background Controls
169
- elseif ( 'background' == $control['type'] ) {
170
- /**
171
- * The background control is a multi-control element
172
- * so it requires extra steps to be created
173
- */
174
- if ( isset( $control['default']['color'] ) ) {
175
- $wp_customize->add_control( new \WP_Customize_Color_Control( $wp_customize, $control['settings'] . '_color', array(
176
- 'label' => isset( $control['label'] ) ? $control['label'] : '',
177
- 'section' => $control['section'],
178
- 'settings' => $control['settings'] . '_color',
179
- 'priority' => $control['priority'],
180
- 'help' => $control['help'],
181
- 'description' => $i18n['background-color'],
182
- 'required' => $control['required'],
183
- 'transport' => $control['transport']
184
- ) ) );
185
- }
186
-
187
- if ( isset( $control['default']['image'] ) ) {
188
- $wp_customize->add_control( new \WP_Customize_Image_Control( $wp_customize, $control['settings'] . '_image', array(
189
- 'label' => '',
190
- 'section' => $control['section'],
191
- 'settings' => $control['settings'] . '_image',
192
- 'priority' => $control['priority'] + 1,
193
- 'help' => '',
194
- 'description' => $i18n['background-image'],
195
- 'required' => $control['required'],
196
- 'transport' => $control['transport']
197
- ) ) );
198
- }
199
-
200
- if ( isset( $control['default']['repeat'] ) ) {
201
- $wp_customize->add_control( $control['settings'] . '_repeat', array(
202
- 'type' => 'select',
203
- 'label' => '',
204
- 'section' => $control['section'],
205
- 'settings' => $control['settings'] . '_repeat',
206
- 'priority' => $control['priority'] + 2,
207
- 'choices' => array(
208
- 'no-repeat' => $i18n['no-repeat'],
209
- 'repeat' => $i18n['repeat-all'],
210
- 'repeat-x' => $i18n['repeat-x'],
211
- 'repeat-y' => $i18n['repeat-y'],
212
- 'inherit' => $i18n['inherit'],
213
- ),
214
- 'help' => '',
215
- 'description' => $i18n['background-repeat'],
216
- 'required' => $control['required'],
217
- 'transport' => $control['transport']
218
- ) );
219
- }
220
-
221
- if ( isset( $control['default']['size'] ) ) {
222
- $wp_customize->add_control( $control['settings'] . '_size', array(
223
- 'type' => 'radio',
224
- 'label' => '',
225
- 'section' => $control['section'],
226
- 'settings' => $control['settings'] . '_size',
227
- 'priority' => $control['priority'] + 3,
228
- 'choices' => array(
229
- 'inherit' => $i18n['inherit'],
230
- 'cover' => $i18n['cover'],
231
- 'contain' => $i18n['contain'],
232
- ),
233
- 'help' => '',
234
- 'mode' => 'buttonset',
235
- 'description' => $i18n['background-size'],
236
- 'required' => $control['required'],
237
- 'transport' => $control['transport']
238
- ) );
239
- }
240
-
241
- if ( isset( $control['default']['attach'] ) ) {
242
- $wp_customize->add_control( $control['settings'] . '_attach', array(
243
- 'label' => '',
244
- 'type' => 'radio',
245
- 'section' => $control['section'],
246
- 'settings' => $control['settings'] . '_attach',
247
- 'priority' => $control['priority'] + 4,
248
- 'choices' => array(
249
- 'inherit' => $i18n['inherit'],
250
- 'fixed' => $i18n['fixed'],
251
- 'scroll' => $i18n['scroll'],
252
- ),
253
- 'help' => '',
254
- 'mode' => 'buttonset',
255
- 'description' => $i18n['background-attachment'],
256
- 'required' => $control['required'],
257
- 'transport' => $control['transport']
258
- ) );
259
- }
260
-
261
- if ( isset( $control['default']['position'] ) ) {
262
- $wp_customize->add_control( $control['settings'] . '_position', array(
263
- 'type' => 'select',
264
- 'label' => '',
265
- 'section' => $control['section'],
266
- 'settings' => $control['settings'] . '_position',
267
- 'priority' => $control['priority'] + 5,
268
- 'choices' => array(
269
- 'left-top' => $i18n['left-top'],
270
- 'left-center' => $i18n['left-center'],
271
- 'left-bottom' => $i18n['left-bottom'],
272
- 'right-top' => $i18n['right-top'],
273
- 'right-center' => $i18n['right-center'],
274
- 'right-bottom' => $i18n['right-bottom'],
275
- 'center-top' => $i18n['center-top'],
276
- 'center-center' => $i18n['center-center'],
277
- 'center-bottom' => $i18n['center-bottom'],
278
- ),
279
- 'help' => '',
280
- 'description' => $i18n['background-position'],
281
- 'required' => $control['required'],
282
- 'transport' => $control['transport']
283
- ) );
284
- }
285
-
286
- if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
287
- $wp_customize->add_control( new SliderControl( $wp_customize, $control['settings'] . '_opacity', array(
288
- 'label' => '',
289
- 'section' => $control['section'],
290
- 'settings' => $control['settings'] . '_opacity',
291
- 'priority' => $control['priority'] + 6,
292
- 'choices' => array(
293
- 'min' => 0,
294
- 'max' => 100,
295
- 'step' => 1,
296
- ),
297
- 'help' => '',
298
- 'description' => $i18n['background-opacity'],
299
- 'required' => $control['required'],
300
- 'transport' => $control['transport']
301
- ) ) );
302
-
303
- }
304
-
305
- }
306
-
307
- }
308
-
309
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Controls.php CHANGED
@@ -2,67 +2,123 @@
2
 
3
  namespace Kirki;
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  class Controls {
6
 
7
- /** @var array An array that defines which custom control types are available and the corresponding class name */
8
- public static $CONTROL_TYPES = array(
9
- 'multicheck' => 'MultiCheckControl',
10
- 'number' => 'NumberControl',
11
- 'radio-buttonset' => 'RadioButtonSetControl',
12
- 'radio-image' => 'RadioImageControl',
13
- 'slider' => 'SliderControl',
14
- 'sortable' => 'SortableControl',
15
- 'switch' => 'SwitchControl',
16
- 'toggle' => 'ToggleControl',
17
- 'palette' => 'PaletteControl',
18
- 'custom' => 'CustomControl',
19
- 'editor' => 'EditorControl',
20
- );
21
-
22
- /** @var array The controls */
23
- private $controls = null;
24
-
25
- /**
26
- * Constructor
27
- */
28
  public function __construct() {
29
- // Hook into WP
30
- $this->register_hooks();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  /**
34
- * Get the controls for the Kirki customizer.
35
- *
36
- * @uses 'kirki/controls' filter.
37
  */
38
- public function get_all() {
39
- if ( $this->controls == null ) {
40
- $user_controls = apply_filters( 'kirki/controls', array() );
41
-
42
- $this->controls = array();
43
- foreach ( $user_controls as $control ) {
44
- $this->controls[] = Control::sanitize( $control );
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
- return $this->controls;
49
  }
50
 
51
- /**
52
- * Hook into WP
53
- */
54
- private function register_hooks() {
55
- add_action( 'customize_register', array( $this, 'include_files' ), 99 );
56
- }
57
-
58
- /**
59
- * Include the custom control files. Because they depend on the WP_Cs
60
- */
61
- public function include_files() {
62
- $path = KIRKI_PATH . '/includes/Controls';
63
- foreach ( self::$CONTROL_TYPES as $typeId => $className ) {
64
- include_once( $path . '/' . $className . '.php' );
65
- }
66
- }
67
-
68
  }
2
 
3
  namespace Kirki;
4
 
5
+ use Kirki;
6
+ use Kirki\Controls\CustomControl;
7
+ use Kirki\Controls\EditorControl;
8
+ use Kirki\Controls\MultiCheckControl;
9
+ use Kirki\Controls\NumberControl;
10
+ use Kirki\Controls\PaletteControl;
11
+ use Kirki\Controls\RadioButtonSetControl;
12
+ use Kirki\Controls\RadioImageControl;
13
+ use Kirki\Controls\SliderControl;
14
+ use Kirki\Controls\SortableControl;
15
+ use Kirki\Controls\SwitchControl;
16
+ use Kirki\Controls\ToggleControl;
17
+ use Kirki\Controls\ColorAlphaControl;
18
+
19
  class Controls {
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  public function __construct() {
22
+ global $wp_customize;
23
+ // add_action( 'customize_register', array( $this, 'register_control_type' ) );
24
+ }
25
+
26
+ public function register_control_type( $wp_customize ) {
27
+ $wp_customize->register_control_type( '\Kirki\Controls\CustomControl' );
28
+ $wp_customize->register_control_type( '\Kirki\Controls\EditorControl' );
29
+ $wp_customize->register_control_type( '\Kirki\Controls\MulticheckControl' );
30
+ $wp_customize->register_control_type( '\Kirki\Controls\NumberControl' );
31
+ $wp_customize->register_control_type( '\Kirki\Controls\PaletteControl' );
32
+ $wp_customize->register_control_type( '\Kirki\Controls\RadioImageControl' );
33
+ $wp_customize->register_control_type( '\Kirki\Controls\SliderControl' );
34
+ $wp_customize->register_control_type( '\Kirki\Controls\SortableControl' );
35
+ $wp_customize->register_control_type( '\Kirki\Controls\SwitchControl' );
36
+ $wp_customize->register_control_type( '\Kirki\Controls\ToggleControl' );
37
+ $wp_customize->register_control_type( '\Kirki\Controls\ColorAlphaControl' );
38
+ $wp_customize->register_control_type( '\Kirki\Controls\TabControl' );
39
  }
40
 
41
  /**
42
+ * Add our fields.
43
+ * We use the default WordPress Core Customizer fields when possible
44
+ * and only add our own custom controls when needed.
45
  */
46
+ public function add( $wp_customize, $field ) {
47
+
48
+ switch ( $field['type'] ) {
49
+
50
+ case 'color' :
51
+ $wp_customize->add_control( new \WP_Customize_Color_Control( $wp_customize, $field['id'], $field ) );
52
+ break;
53
+
54
+ case 'color-alpha' :
55
+ $wp_customize->add_control( new ColorAlphaControl( $wp_customize, $field['id'], $field ) );
56
+ break;
57
+
58
+ case 'image' :
59
+ $wp_customize->add_control( new \WP_Customize_Image_Control( $wp_customize, $field['id'], $field ) );
60
+ break;
61
+
62
+ case 'upload' :
63
+ $wp_customize->add_control( new \WP_Customize_Upload_Control( $wp_customize, $field['id'], $field ) );
64
+ break;
65
+
66
+ case 'switch' :
67
+ $wp_customize->add_control( new SwitchControl( $wp_customize, $field['id'], $field ) );
68
+ break;
69
+
70
+ case 'toggle' :
71
+ $wp_customize->add_control( new ToggleControl( $wp_customize, $field['id'], $field ) );
72
+ break;
73
+
74
+ case 'radio-buttonset' :
75
+ $wp_customize->add_control( new RadioButtonSetControl( $wp_customize, $field['id'], $field ) );
76
+ break;
77
+
78
+ case 'radio-image' :
79
+ $wp_customize->add_control( new RadioImageControl( $wp_customize, $field['id'], $field ) );
80
+ break;
81
+
82
+ case 'sortable' :
83
+ $wp_customize->add_control( new SortableControl( $wp_customize, $field['id'], $field ) );
84
+ break;
85
+
86
+ case 'slider' :
87
+ $wp_customize->add_control( new SliderControl( $wp_customize, $field['id'], $field ) );
88
+ break;
89
+
90
+ case 'number' :
91
+ $wp_customize->add_control( new NumberControl( $wp_customize, $field['id'], $field ) );
92
+ break;
93
+
94
+ case 'multicheck' :
95
+ $wp_customize->add_control( new MultiCheckControl( $wp_customize, $field['id'], $field ) );
96
+ break;
97
+
98
+ case 'palette' :
99
+ $wp_customize->add_control( new PaletteControl( $wp_customize, $field['id'], $field ) );
100
+ break;
101
+
102
+ case 'custom' :
103
+ $wp_customize->add_control( new CustomControl( $wp_customize, $field['id'], $field ) );
104
+ break;
105
+
106
+ case 'editor' :
107
+ $wp_customize->add_control( new EditorControl( $wp_customize, $field['id'], $field ) );
108
+ break;
109
+
110
+ case 'background' :
111
+ // Do nothing.
112
+ // The 'background' field is just the sum of its sub-fields
113
+ // which are created individually.
114
+ break;
115
+
116
+ default :
117
+ $wp_customize->add_control( new \WP_Customize_Control( $wp_customize, $field['id'], $field ) );
118
+ break;
119
+
120
  }
121
 
 
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
includes/Controls/ColorAlphaControl.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Kirki\Controls;
4
+
5
+ class ColorAlphaControl extends \WP_Customize_Control {
6
+
7
+ public $type = 'color-alpha';
8
+ public $palette = true;
9
+ public $default = '#FFFFFF';
10
+
11
+ protected function render() {
12
+ $id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );
13
+ $class = 'customize-control customize-control-' . $this->type; ?>
14
+ <li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>">
15
+ <?php $this->render_content(); ?>
16
+ </li>
17
+ <?php }
18
+
19
+ public function render_content() { ?>
20
+ <label>
21
+ <?php
22
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
23
+ ?>
24
+ <span class="customize-control-title"><?php echo $this->label; ?></span>
25
+ <input type="text" data-palette="<?php echo esc_textarea( $this->palette ); ?>" data-default-color="<?php echo $this->default; ?>" value="<?php echo intval( $this->value() ); ?>" class="kirki-color-control" <?php $this->link(); ?> />
26
+ </label>
27
+ <?php }
28
+ }
includes/Controls/CustomControl.php CHANGED
@@ -8,12 +8,27 @@ class CustomControl extends \WP_Customize_Control {
8
 
9
  public function render_content() { ?>
10
  <label>
 
 
 
11
  <?php if ( ! empty( $this->label ) ) : ?>
12
- <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
13
  <?php endif;
14
  if ( ! empty( $this->description ) ) : ?>
 
 
 
15
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
16
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
17
  <?php echo $this->value(); ?>
18
  </label>
19
  <?php
8
 
9
  public function render_content() { ?>
10
  <label>
11
+ <?php
12
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
13
+ ?>
14
  <?php if ( ! empty( $this->label ) ) : ?>
15
+ <span class="customize-control-title"><?php echo $this->label; ?></span>
16
  <?php endif;
17
  if ( ! empty( $this->description ) ) : ?>
18
+ <?php
19
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
20
+ ?>
21
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
22
  <?php endif; ?>
23
+ <?php
24
+ /**
25
+ * The value is defined by the developer in the field configuration as the default value.
26
+ * There is no user input on this field, it's a raw HTML/JS field and we don not sanitize it.
27
+ * Do not be alarmed, this is not a security issue.
28
+ * In order for someone to be able to change this they would have to have access to your filesystem.
29
+ * If that happens, they can change whatever they want anyways. This field is not a concern.
30
+ */
31
+ ?>
32
  <?php echo $this->value(); ?>
33
  </label>
34
  <?php
includes/Controls/EditorControl.php CHANGED
@@ -9,14 +9,25 @@ class EditorControl extends \WP_Customize_Control {
9
  public function render_content() { ?>
10
 
11
  <label>
12
- <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
 
 
 
 
 
 
 
 
 
 
 
13
  <input type="hidden" <?php $this->link(); ?> value="<?php echo esc_textarea( $this->value() ); ?>">
14
  <?php
15
  $settings = array(
16
  'textarea_name' => $this->id,
17
  'teeny' => true
18
  );
19
- wp_editor( $this->value(), $this->id, $settings );
20
 
21
  do_action('admin_footer');
22
  do_action('admin_print_footer_scripts');
9
  public function render_content() { ?>
10
 
11
  <label>
12
+ <span class="customize-control-title">
13
+ <?php
14
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
15
+ ?>
16
+ <?php echo $this->label; ?>
17
+ <?php if ( ! empty( $this->description ) ) : ?>
18
+ <?php
19
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
20
+ ?>
21
+ <span class="description customize-control-description"><?php echo $this->description; ?></span>
22
+ <?php endif; ?>
23
+ </span>
24
  <input type="hidden" <?php $this->link(); ?> value="<?php echo esc_textarea( $this->value() ); ?>">
25
  <?php
26
  $settings = array(
27
  'textarea_name' => $this->id,
28
  'teeny' => true
29
  );
30
+ wp_editor( esc_textarea( $this->value() ), $this->id, $settings );
31
 
32
  do_action('admin_footer');
33
  do_action('admin_print_footer_scripts');
includes/Controls/MultiCheckControl.php CHANGED
@@ -54,8 +54,14 @@ class MultiCheckControl extends \WP_Customize_Control {
54
  } ?>
55
  <label class='tf-multicheck-container'>
56
  <span class="customize-control-title">
57
- <?php echo esc_html( $this->label ); ?>
 
 
 
58
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
59
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
60
  <?php endif; ?>
61
  </span>
54
  } ?>
55
  <label class='tf-multicheck-container'>
56
  <span class="customize-control-title">
57
+ <?php
58
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
59
+ ?>
60
+ <?php echo $this->label; ?>
61
  <?php if ( ! empty( $this->description ) ) : ?>
62
+ <?php
63
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
64
+ ?>
65
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
66
  <?php endif; ?>
67
  </span>
includes/Controls/PaletteControl.php CHANGED
@@ -20,8 +20,14 @@ class PaletteControl extends \WP_Customize_Control {
20
 
21
  ?>
22
  <span class="customize-control-title">
23
- <?php echo esc_html( $this->label ); ?>
 
 
 
24
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
25
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
26
  <?php endif; ?>
27
  </span>
20
 
21
  ?>
22
  <span class="customize-control-title">
23
+ <?php
24
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
25
+ ?>
26
+ <?php echo $this->label; ?>
27
  <?php if ( ! empty( $this->description ) ) : ?>
28
+ <?php
29
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
30
+ ?>
31
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
32
  <?php endif; ?>
33
  </span>
includes/Controls/RadioButtonSetControl.php CHANGED
@@ -20,8 +20,14 @@ class RadioButtonSetControl extends \WP_Customize_Control {
20
 
21
  ?>
22
  <span class="customize-control-title">
23
- <?php echo esc_html( $this->label ); ?>
 
 
 
24
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
25
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
26
  <?php endif; ?>
27
  </span>
20
 
21
  ?>
22
  <span class="customize-control-title">
23
+ <?php
24
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
25
+ ?>
26
+ <?php echo $this->label; ?>
27
  <?php if ( ! empty( $this->description ) ) : ?>
28
+ <?php
29
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
30
+ ?>
31
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
32
  <?php endif; ?>
33
  </span>
includes/Controls/RadioImageControl.php CHANGED
@@ -20,8 +20,14 @@ class RadioImageControl extends \WP_Customize_Control {
20
 
21
  ?>
22
  <span class="customize-control-title">
23
- <?php echo esc_html( $this->label ); ?>
 
 
 
24
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
25
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
26
  <?php endif; ?>
27
  </span>
20
 
21
  ?>
22
  <span class="customize-control-title">
23
+ <?php
24
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
25
+ ?>
26
+ <?php echo $this->label; ?>
27
  <?php if ( ! empty( $this->description ) ) : ?>
28
+ <?php
29
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
30
+ ?>
31
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
32
  <?php endif; ?>
33
  </span>
includes/Controls/SliderControl.php CHANGED
@@ -15,8 +15,14 @@ class SliderControl extends \WP_Customize_Control {
15
  <label>
16
 
17
  <span class="customize-control-title">
18
- <?php echo esc_html( $this->label ); ?>
 
 
 
19
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
20
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
21
  <?php endif; ?>
22
  </span>
15
  <label>
16
 
17
  <span class="customize-control-title">
18
+ <?php
19
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
20
+ ?>
21
+ <?php echo $this->label; ?>
22
  <?php if ( ! empty( $this->description ) ) : ?>
23
+ <?php
24
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
25
+ ?>
26
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
27
  <?php endif; ?>
28
  </span>
includes/Controls/SortableControl.php CHANGED
@@ -23,8 +23,14 @@ class SortableControl extends \WP_Customize_Control {
23
  ?>
24
  <label class='kirki-sortable'>
25
  <span class="customize-control-title">
26
- <?php echo esc_html( $this->label ); ?>
 
 
 
27
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
28
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
29
  <?php endif; ?>
30
  </span>
@@ -32,7 +38,7 @@ class SortableControl extends \WP_Customize_Control {
32
  <?php
33
  $values = $this->value();
34
  $values = $values == '' ? array_keys( $this->choices ) : $values;
35
- $values = is_serialized( $values ) ? unserialize( $values ) : $values;
36
  $this->visible_button = count( $values ) != count( $this->choices ) ? true : '';
37
  $visibleButton = '<i class="dashicons dashicons-visibility visibility"></i>';
38
  ?>
@@ -46,7 +52,7 @@ class SortableControl extends \WP_Customize_Control {
46
  <?php endforeach; ?>
47
  </ul>
48
  <div style='clear: both'></div>
49
- <?php $values = ! is_serialized( $values ) ? serialize( $values ) : $values; ?>
50
  <input type='hidden' <?php $this->link(); ?> value='<?php echo esc_attr( $values ) ?>'/>
51
  </label>
52
  <?php
23
  ?>
24
  <label class='kirki-sortable'>
25
  <span class="customize-control-title">
26
+ <?php
27
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
28
+ ?>
29
+ <?php echo $this->label; ?>
30
  <?php if ( ! empty( $this->description ) ) : ?>
31
+ <?php
32
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
33
+ ?>
34
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
35
  <?php endif; ?>
36
  </span>
38
  <?php
39
  $values = $this->value();
40
  $values = $values == '' ? array_keys( $this->choices ) : $values;
41
+ $values = maybe_unserialize( $values );
42
  $this->visible_button = count( $values ) != count( $this->choices ) ? true : '';
43
  $visibleButton = '<i class="dashicons dashicons-visibility visibility"></i>';
44
  ?>
52
  <?php endforeach; ?>
53
  </ul>
54
  <div style='clear: both'></div>
55
+ <?php $values = maybe_serialize( $values ); ?>
56
  <input type='hidden' <?php $this->link(); ?> value='<?php echo esc_attr( $values ) ?>'/>
57
  </label>
58
  <?php
includes/Controls/SwitchControl.php CHANGED
@@ -17,8 +17,14 @@ class SwitchControl extends \WP_Customize_Control {
17
  <div class="switch-info">
18
  <input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
19
  </div>
20
- <?php echo esc_html( $this->label ); ?>
 
 
 
21
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
22
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
23
  <?php endif; ?>
24
  <?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
17
  <div class="switch-info">
18
  <input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
19
  </div>
20
+ <?php
21
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
22
+ ?>
23
+ <?php echo $this->label; ?>
24
  <?php if ( ! empty( $this->description ) ) : ?>
25
+ <?php
26
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
27
+ ?>
28
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
29
  <?php endif; ?>
30
  <?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
includes/Controls/ToggleControl.php CHANGED
@@ -14,8 +14,14 @@ class ToggleControl extends \WP_Customize_Control {
14
  <div class="switch-info">
15
  <input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
16
  </div>
17
- <?php echo esc_html( $this->label ); ?>
 
 
 
18
  <?php if ( ! empty( $this->description ) ) : ?>
 
 
 
19
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
20
  <?php endif; ?>
21
  <?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
14
  <div class="switch-info">
15
  <input style="display: none;" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
16
  </div>
17
+ <?php
18
+ // The label has already been sanitized in the Fields class, no need to re-sanitize it.
19
+ ?>
20
+ <?php echo $this->label; ?>
21
  <?php if ( ! empty( $this->description ) ) : ?>
22
+ <?php
23
+ // The description has already been sanitized in the Fields class, no need to re-sanitize it.
24
+ ?>
25
  <span class="description customize-control-description"><?php echo $this->description; ?></span>
26
  <?php endif; ?>
27
  <?php $classes = ( esc_attr( $this->value() ) ) ? ' On' : ' Off'; ?>
includes/Fields.php ADDED
@@ -0,0 +1,585 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Kirki;
4
+
5
+ use Kirki;
6
+
7
+ class Fields {
8
+
9
+ /** @var array The controls */
10
+ private $fields = null;
11
+
12
+ /**
13
+ * Get an array of all the fields
14
+ */
15
+ public function get_all() {
16
+
17
+ if ( $this->fields == null ) {
18
+
19
+ $fields = apply_filters( 'kirki/controls', array() );
20
+ $fields = apply_filters( 'kirki/fields', $fields );
21
+ $fields = $this->build_background_fields( $fields );
22
+
23
+ $this->fields = array();
24
+ foreach ( $fields as $field ) {
25
+ $field = $this->sanitize_field( $field );
26
+ $this->fields[$field['settings']] = $field;
27
+ }
28
+
29
+ }
30
+
31
+ return $this->fields;
32
+ }
33
+
34
+ /**
35
+ * Sanitizes the field
36
+ *
37
+ * @param array the field definition
38
+ * @return array
39
+ */
40
+ public function sanitize_field( $field ) {
41
+
42
+ $field['default'] = $this->sanitize_default( $field );
43
+ $field['label'] = $this->sanitize_label( $field );
44
+ $field['help'] = $this->sanitize_help( $field );
45
+ $field['description'] = $this->sanitize_description( $field );
46
+ $field['required'] = $this->sanitize_required( $field );
47
+ $field['transport'] = $this->sanitize_transport( $field );
48
+ $field['type'] = $this->sanitize_control_type( $field );
49
+ $field['option_type'] = $this->sanitize_type( $field );
50
+ $field['section'] = $this->sanitize_section( $field );
51
+ $field['settings'] = $this->sanitize_settings( $field );
52
+ $field['priority'] = $this->sanitize_priority( $field );
53
+ $field['choices'] = $this->sanitize_choices( $field );
54
+ $field['output'] = $this->sanitize_output( $field );
55
+ $field['sanitize_callback'] = $this->sanitize_callback( $field );
56
+ $field['js_vars'] = $this->sanitize_js_vars( $field );
57
+ $field['id'] = $this->sanitize_id( $field );
58
+ $field['capability'] = $this->sanitize_capability( $field );
59
+
60
+ return $field;
61
+
62
+ }
63
+
64
+ /**
65
+ * Sanitizes the control type.
66
+ *
67
+ * @param array the field definition
68
+ * @return string. If not set, then defaults to text.
69
+ */
70
+ public function sanitize_control_type( $field ) {
71
+
72
+ if ( ! isset( $field['type'] ) ) {
73
+ return 'text';
74
+ }
75
+
76
+ if ( 'checkbox' == $field['type'] ) {
77
+
78
+ $field['type'] = ( isset( $field['mode'] ) && 'switch' == $field['mode'] ) ? 'switch' : $field['type'];
79
+ $field['type'] = ( isset( $field['mode'] ) && 'toggle' == $field['mode'] ) ? 'toggle' : $field['type'];
80
+
81
+ } elseif ( 'radio' == $field['type'] ) {
82
+
83
+ $field['type'] = ( isset( $field['mode'] ) && 'buttonset' == $field['mode'] ) ? 'radio-buttonset' : $field['type'];
84
+ $field['type'] = ( isset( $field['mode'] ) && 'image' == $field['mode'] ) ? 'radio-image' : $field['type'];
85
+
86
+ } elseif ( 'group-title' == $field['type'] || 'group_title' == $field['type'] ) {
87
+
88
+ $field['type'] = 'custom';
89
+
90
+ } elseif ( 'color' == $field['type'] && false !== strpos( $field['default'], 'rgba' ) ) {
91
+
92
+ $field['type'] = 'color-alpha';
93
+
94
+ }
95
+
96
+ return esc_attr( $field['type'] );
97
+
98
+ }
99
+
100
+ /**
101
+ * Sanitizes the setting type.
102
+ *
103
+ * @param array the field definition
104
+ * @return string. (theme_mod|option)
105
+ */
106
+ public function sanitize_type( $field ) {
107
+ $config = Kirki::config()->get_all();
108
+ return esc_attr( $config['options_type'] );
109
+ }
110
+
111
+ /**
112
+ * Sanitizes the setting permissions.
113
+ *
114
+ * @param array the field definition
115
+ * @return string. (theme_mod|option)
116
+ */
117
+ public function sanitize_capability( $field ) {
118
+ if ( ! isset( $field['capability'] ) ) {
119
+ $config = Kirki::config()->get_all();
120
+ return esc_attr( $config['capability'] );
121
+ } else {
122
+ return esc_attr( $field['capability'] );
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Sanitizes the setting name
128
+ *
129
+ * @param array the field definition
130
+ * @return string.
131
+ */
132
+ public function sanitize_settings( $field ) {
133
+
134
+ /**
135
+ * Compatibility tweak
136
+ * Previous versions of the Kirki customizer used 'setting' istead of 'settings'.
137
+ */
138
+ if ( ! isset( $field['settings'] ) && isset( $field['setting'] ) ) {
139
+ $field['settings'] = $field['setting'];
140
+ }
141
+
142
+ return esc_attr( $field['settings'] );
143
+
144
+ }
145
+
146
+ /**
147
+ * Sanitizes the control label.
148
+ *
149
+ * @param array the field definition
150
+ * @return string
151
+ */
152
+ public function sanitize_label( $field ) {
153
+ return ( isset( $field['label'] ) ) ? esc_html( $field['label'] ) : '';
154
+ }
155
+
156
+ /**
157
+ * Sanitizes the control section
158
+ *
159
+ * @param array the field definition
160
+ * @return string
161
+ */
162
+ public function sanitize_section( $field ) {
163
+ return sanitize_key( $field['section'] );
164
+ }
165
+
166
+ /**
167
+ * Sanitizes the control id
168
+ *
169
+ * @param array the field definition
170
+ * @return string
171
+ */
172
+ public function sanitize_id( $field ) {
173
+ $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) );
174
+ return sanitize_key( $id );
175
+ }
176
+
177
+ /**
178
+ * Sanitizes the setting default value
179
+ *
180
+ * @param array the field definition
181
+ * @return mixed
182
+ */
183
+ public function sanitize_default( $field ) {
184
+ // If ['default'] is not set, set an empty value
185
+ if ( ! isset( $field['default'] ) ) {
186
+ $field['default'] = '';
187
+ }
188
+
189
+ /**
190
+ * Sortable controls need a serialized array as the default value.
191
+ * Since we're using normal arrays to set our defaults when defining the fields, we need to serialize that value here.
192
+ */
193
+ if ( 'sortable' == $field['type'] && isset( $field['default'] ) && ! empty( $field['default'] ) ) {
194
+ $field['default'] = maybe_serialize( $field['default'] );
195
+ }
196
+
197
+ return $field['default'];
198
+
199
+ }
200
+
201
+ /**
202
+ * Sanitizes the control description
203
+ *
204
+ * @param array the field definition
205
+ * @return string
206
+ */
207
+ public function sanitize_description( $field ) {
208
+
209
+ /**
210
+ * Compatibility tweak
211
+ *
212
+ * Previous verions of the Kirki Customizer had the 'description' field mapped to the new 'help'
213
+ * and instead of 'description' we were using 'subtitle'.
214
+ * This has been deprecated in favor of WordPress core's 'description' field that was recently introduced.
215
+ *
216
+ */
217
+ if ( isset( $field['subtitle'] ) ) {
218
+ $field['description'] = $field['subtitle'];
219
+ }
220
+
221
+ return ( isset( $field['description'] ) ) ? esc_html( $field['description'] ) : '';
222
+
223
+ }
224
+
225
+ /**
226
+ * Sanitizes the control help
227
+ *
228
+ * @param array the field definition
229
+ * @return string
230
+ */
231
+ public function sanitize_help( $field ) {
232
+
233
+ /**
234
+ * Compatibility tweak
235
+ *
236
+ * Previous verions of the Kirki Customizer had the 'description' field mapped to the new 'help'
237
+ * and instead of 'description' we were using 'subtitle'.
238
+ * This has been deprecated in favor of WordPress core's 'description' field that was recently introduced.
239
+ *
240
+ */
241
+ if ( isset( $field['subtitle'] ) ) {
242
+ // Use old arguments form.
243
+ $field['help'] = ( isset( $field['description'] ) ) ? $field['description'] : '';
244
+ }
245
+ return isset( $field['help'] ) ? esc_html( $field['help'] ) : '';
246
+
247
+ }
248
+
249
+ /**
250
+ * Sanitizes the control choices.
251
+ *
252
+ * @param array the field definition
253
+ * @return array
254
+ */
255
+ public function sanitize_choices( $field ) {
256
+ return isset( $field['choices'] ) ? $field['choices'] : array();
257
+ }
258
+
259
+ /**
260
+ * Sanitizes the control output
261
+ *
262
+ * @param array the field definition
263
+ * @return array
264
+ */
265
+ public function sanitize_output( $field ) {
266
+ // Further sanitization on the values of the array happens near the output.
267
+ // This just makes sure the value is defined to avoid errors.
268
+ return isset( $field['output'] ) ? $field['output'] : null;
269
+ }
270
+
271
+ /**
272
+ * Sanitizes the control transport.
273
+ *
274
+ * @param array the field definition
275
+ * @return string postMessage|refresh (defaults to refresh)
276
+ */
277
+ public function sanitize_transport( $field ) {
278
+ return ( isset( $field['transport'] ) && 'postMessage' == $field['transport'] ) ? 'postMessage' : 'refresh';
279
+ }
280
+
281
+ /**
282
+ * Sanitizes the setting sanitize_callback
283
+ *
284
+ * @param array the field definition
285
+ * @return mixed the sanitization callback for this setting
286
+ */
287
+ public function sanitize_callback( $field ) {
288
+
289
+ if ( isset( $field['sanitize_callback'] ) && ! empty( $field['sanitize_callback'] ) ) {
290
+ return $field['sanitize_callback'];
291
+ } else { // Fallback callback
292
+ return self::fallback_callback( $field['type'] );
293
+ }
294
+
295
+ }
296
+
297
+ /**
298
+ * Sanitizes the control js_vars.
299
+ *
300
+ * @param array the field definition
301
+ * @return array
302
+ */
303
+ public function sanitize_js_vars( $field ) {
304
+ if ( isset( $field['js_vars'] ) ) {
305
+ return $field['js_vars'];
306
+ } else {
307
+ return null;
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Sanitizes the control required argument.
313
+ *
314
+ * @param array the field definition
315
+ * @return array
316
+ */
317
+ public function sanitize_required( $field ) {
318
+ // The individual options of the array get sanitized in the Required class.
319
+ // We're just making sure this is defined here.
320
+ return isset( $field['required'] ) ? $field['required'] : array();
321
+ }
322
+
323
+ /**
324
+ * Sanitizes the control priority
325
+ *
326
+ * @param array the field definition
327
+ * @return int
328
+ */
329
+ public function sanitize_priority( $field ) {
330
+
331
+ if ( isset( $field['priority'] ) ) {
332
+ return intval( $field['priority'] );
333
+ } else {
334
+ return 10;
335
+ }
336
+
337
+ }
338
+
339
+ /**
340
+ * Build the background fields.
341
+ * Takes a single field with type = background and explodes it to multiple controls.
342
+ */
343
+ public function build_background_fields( $fields ) {
344
+ $i18n = Kirki::i18n();
345
+
346
+ foreach ( $fields as $field ) {
347
+
348
+ if ( 'background' == $field['type'] ) {
349
+
350
+ // Set any unset values to avoid PHP warnings below.
351
+ $field['settings'] = ( ! isset( $field['settings'] ) && isset( $field['setting'] ) ) ? $field['setting'] : $field['settings'];
352
+ $field['section'] = ( isset( $field['section'] ) ) ? $field['section'] : 'background';
353
+ $field['help'] = ( isset( $field['help'] ) ) ? $field['help'] : '';
354
+ $field['description'] = ( isset( $field['description'] ) ) ? $field['description'] : $i18n['background-color'];
355
+ $field['required'] = ( isset( $field['required'] ) ) ? $field['required'] : array();
356
+ $field['transport'] = ( isset( $field['transport'] ) ) ? $field['transport'] : 'refresh';
357
+ $field['default'] = ( isset( $field['default'] ) ) ? $field['default'] : array();
358
+ $field['priority'] = ( isset( $field['priority'] ) ) ? $field['priority'] : 10;
359
+
360
+ if ( isset( $field['default']['color'] ) ) {
361
+ $color_mode = ( false !== strpos( $field['default']['color'], 'rgba' ) ) ? 'color-alpha' : 'color';
362
+ $fields[] = array(
363
+ 'type' => $color_mode,
364
+ 'label' => isset( $field['label'] ) ? $field['label'] : '',
365
+ 'section' => $field['section'],
366
+ 'settings' => $field['settings'] . '_color',
367
+ 'priority' => $field['priority'],
368
+ 'help' => $field['help'],
369
+ 'description' => $field['description'],
370
+ 'required' => $field['required'],
371
+ 'transport' => $field['transport'],
372
+ 'default' => $field['default']['color'],
373
+ );
374
+ }
375
+
376
+ if ( isset( $field['default']['image'] ) ) {
377
+ $fields[] = array(
378
+ 'type' => 'image',
379
+ 'label' => '',
380
+ 'section' => $field['section'],
381
+ 'settings' => $field['settings'] . '_image',
382
+ 'priority' => $field['priority'] + 1,
383
+ 'help' => '',
384
+ 'description' => $i18n['background-image'],
385
+ 'required' => $field['required'],
386
+ 'transport' => $field['transport'],
387
+ 'default' => $field['default']['image'],
388
+ );
389
+ }
390
+
391
+ if ( isset( $field['default']['repeat'] ) ) {
392
+ $fields[] = array(
393
+ 'type' => 'select',
394
+ 'label' => '',
395
+ 'section' => $field['section'],
396
+ 'settings' => $field['settings'] . '_',
397
+ 'priority' => $field['priority'] + 2,
398
+ 'choices' => array(
399
+ 'no-repeat' => $i18n['no-repeat'],
400
+ 'repeat' => $i18n['repeat-all'],
401
+ 'repeat-x' => $i18n['repeat-x'],
402
+ 'repeat-y' => $i18n['repeat-y'],
403
+ 'inherit' => $i18n['inherit'],
404
+ ),
405
+ 'help' => '',
406
+ 'description' => $i18n['background-repeat'],
407
+ 'required' => $field['required'],
408
+ 'transport' => $field['transport'],
409
+ 'default' => $field['default']['repeat'],
410
+ );
411
+ }
412
+
413
+ if ( isset( $field['default']['size'] ) ) {
414
+ $fields[] = array(
415
+ 'type' => 'radio-buttonset',
416
+ 'label' => '',
417
+ 'section' => $field['section'],
418
+ 'settings' => $field['settings'] . '_size',
419
+ 'priority' => $field['priority'] + 3,
420
+ 'choices' => array(
421
+ 'inherit' => $i18n['inherit'],
422
+ 'cover' => $i18n['cover'],
423
+ 'contain' => $i18n['contain'],
424
+ ),
425
+ 'help' => '',
426
+ 'description' => $i18n['background-size'],
427
+ 'required' => $field['required'],
428
+ 'transport' => $field['transport'],
429
+ 'default' => $field['default']['size'],
430
+ );
431
+ }
432
+
433
+ if ( isset( $field['default']['attach'] ) ) {
434
+ $fields[] = array(
435
+ 'label' => '',
436
+ 'type' => 'radio-buttonset',
437
+ 'section' => $field['section'],
438
+ 'settings' => $field['settings'] . '_attach',
439
+ 'priority' => $field['priority'] + 4,
440
+ 'choices' => array(
441
+ 'inherit' => $i18n['inherit'],
442
+ 'fixed' => $i18n['fixed'],
443
+ 'scroll' => $i18n['scroll'],
444
+ ),
445
+ 'help' => '',
446
+ 'description' => $i18n['background-attachment'],
447
+ 'required' => $field['required'],
448
+ 'transport' => $field['transport'],
449
+ 'default' => $field['default']['attach'],
450
+ );
451
+ }
452
+
453
+ if ( isset( $field['default']['position'] ) ) {
454
+ $fields[] = array(
455
+ 'type' => 'select',
456
+ 'label' => '',
457
+ 'section' => $field['section'],
458
+ 'settings' => $field['settings'] . '_position',
459
+ 'priority' => $field['priority'] + 5,
460
+ 'choices' => array(
461
+ 'left-top' => $i18n['left-top'],
462
+ 'left-center' => $i18n['left-center'],
463
+ 'left-bottom' => $i18n['left-bottom'],
464
+ 'right-top' => $i18n['right-top'],
465
+ 'right-center' => $i18n['right-center'],
466
+ 'right-bottom' => $i18n['right-bottom'],
467
+ 'center-top' => $i18n['center-top'],
468
+ 'center-center' => $i18n['center-center'],
469
+ 'center-bottom' => $i18n['center-bottom'],
470
+ ),
471
+ 'help' => '',
472
+ 'description' => $i18n['background-position'],
473
+ 'required' => $field['required'],
474
+ 'transport' => $field['transport'],
475
+ 'default' => $field['default']['position'],
476
+ );
477
+ }
478
+
479
+ if ( isset( $field['default']['opacity'] ) && $field['default']['opacity'] ) {
480
+ $fields[] = array(
481
+ 'type' => 'slider',
482
+ 'label' => '',
483
+ 'section' => $field['section'],
484
+ 'settings' => $field['settings'] . '_opacity',
485
+ 'priority' => $field['priority'] + 6,
486
+ 'choices' => array(
487
+ 'min' => 0,
488
+ 'max' => 100,
489
+ 'step' => 1,
490
+ ),
491
+ 'help' => '',
492
+ 'description' => $i18n['background-opacity'],
493
+ 'required' => $field['required'],
494
+ 'transport' => $field['transport'],
495
+ 'default' => $field['default']['opacity'],
496
+ );
497
+
498
+ }
499
+
500
+ }
501
+
502
+ }
503
+
504
+ return $fields;
505
+
506
+ }
507
+
508
+ /**
509
+ * Sanitizes the control transport.
510
+ *
511
+ * @param string the control type
512
+ * @return string the function name of a sanitization callback
513
+ */
514
+ public static function fallback_callback( $field_type ) {
515
+
516
+ switch ( $field_type ) {
517
+ case 'checkbox' :
518
+ $sanitize_callback = 'kirki_sanitize_checkbox';
519
+ break;
520
+ case 'color' :
521
+ $sanitize_callback = 'sanitize_hex_color';
522
+ break;
523
+ case 'color-alpha' :
524
+ $sanitize_callback = 'esc_js';
525
+ break;
526
+ case 'image' :
527
+ $sanitize_callback = 'esc_url_raw';
528
+ break;
529
+ case 'radio' :
530
+ $sanitize_callback = 'kirki_sanitize_choice';
531
+ break;
532
+ case 'radio-image' :
533
+ $sanitize_callback = 'kirki_sanitize_choice';
534
+ break;
535
+ case 'radio-buttonset' :
536
+ $sanitize_callback = 'kirki_sanitize_choice';
537
+ break;
538
+ case 'toggle' :
539
+ $sanitize_callback = 'kirki_sanitize_checkbox';
540
+ break;
541
+ case 'switch' :
542
+ $sanitize_callback = 'kirki_sanitize_checkbox';
543
+ break;
544
+ case 'select' :
545
+ $sanitize_callback = 'kirki_sanitize_choice';
546
+ break;
547
+ case 'dropdown-pages' :
548
+ $sanitize_callback = 'kirki_sanitize_choice';
549
+ break;
550
+ case 'slider' :
551
+ $sanitize_callback = 'kirki_sanitize_number';
552
+ break;
553
+ case 'text' :
554
+ $sanitize_callback = 'esc_textarea';
555
+ break;
556
+ case 'textarea' :
557
+ $sanitize_callback = 'esc_textarea';
558
+ break;
559
+ case 'editor' :
560
+ $sanitize_callback = 'esc_textarea';
561
+ break;
562
+ case 'upload' :
563
+ $sanitize_callback = 'esc_url_raw';
564
+ break;
565
+ case 'number' :
566
+ $sanitize_callback = 'kirki_sanitize_number';
567
+ break;
568
+ case 'multicheck' :
569
+ $sanitize_callback = 'esc_attr';
570
+ break;
571
+ case 'sortable' :
572
+ $sanitize_callback = 'kirki_sanitize_sortable';
573
+ break;
574
+ case 'palette' :
575
+ $sanitize_callback = 'kirki_sanitize_choice';
576
+ break;
577
+ default :
578
+ $sanitize_callback = 'kirki_sanitize_unfiltered';
579
+ }
580
+
581
+ return $sanitize_callback;
582
+
583
+ }
584
+
585
+ }
includes/Fonts/FontRegistry.php CHANGED
@@ -12,19 +12,19 @@ Use Kirki;
12
  */
13
  class FontRegistry {
14
 
15
- /** @var array */
16
- private $standard_fonts = null;
17
 
18
- /** @var array */
19
- private $google_fonts = null;
20
 
21
- /**
22
- * Constructor
23
- */
24
- public function __construct() {
25
- }
26
 
27
- /**
28
  * Compile font options from different sources.
29
  *
30
  * @return array All available fonts.
@@ -71,7 +71,7 @@ class FontRegistry {
71
  */
72
  public function get_google_font_uri( $fonts, $weight = 400, $subset = 'all' ) {
73
  // De-dupe the fonts
74
- $allowed_fonts = $this->get_google_fonts();
75
  $fonts = array_unique( $fonts );
76
  $family = array();
77
 
@@ -122,12 +122,12 @@ class FontRegistry {
122
  * @return array The available subsets.
123
  */
124
  public function get_google_font_subsets() {
125
- $i18n = Kirki::i18n();
126
  return array(
127
  'all' => $i18n['all'],
128
  'cyrillic' => $i18n['cyrillic'],
129
  'cyrillic-ext' => $i18n['cyrillic-ext'],
130
- 'devanagari' => $i18n['devangari'],
131
  'greek' => $i18n['greek'],
132
  'greek-ext' => $i18n['greek-ext'],
133
  'khmer' => $i18n['khmer'],
@@ -183,25 +183,25 @@ class FontRegistry {
183
  * @return array Standard websafe fonts.
184
  */
185
  public function get_standard_fonts() {
186
- $i18n = Kirki::i18n();
187
- if ($this->standard_fonts==null) {
188
- $this->standard_fonts = apply_filters('kirki/fonts/standard_fonts', array(
189
- 'serif' => array(
190
- 'label' => $i18n['serif'],
191
- 'stack' => 'Georgia,Times,"Times New Roman",serif'
192
- ),
193
- 'sans-serif' => array(
194
- 'label' => $i18n['sans-serif'],
195
- 'stack' => '"Helvetica Neue",Helvetica,Arial,sans-serif'
196
- ),
197
- 'monospace' => array(
198
- 'label' => $i18n['monospace'],
199
- 'stack' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace'
200
- )
201
- ));
202
- }
203
-
204
- return $this->standard_fonts;
205
  }
206
 
207
 
@@ -242,7 +242,7 @@ class FontRegistry {
242
  return $value;
243
  }
244
 
245
- return '';
246
  }
247
 
248
  /**
@@ -251,23 +251,23 @@ class FontRegistry {
251
  * @return array All Google Fonts.
252
  */
253
  public function get_google_fonts() {
254
- if ($this->google_fonts==null) {
255
- // Get the list of fonts from our json file and convert to an array
256
- $fonts = json_decode(file_get_contents(KIRKI_PATH . '/assets/json/webfonts.json'), true);
257
-
258
- $google_fonts = array();
259
- foreach ($fonts['items'] as $font) {
260
- $google_fonts[$font['family']] = array(
261
- 'label' => $font['family'],
262
- 'variants' => $font['variants'],
263
- 'subsets' => $font['subsets'],
264
- );
265
- }
266
-
267
- $this->google_fonts = apply_filters('kirki/fonts/google_fonts', $google_fonts);
268
- }
269
-
270
- return $this->google_fonts;
271
  }
272
 
273
  }
12
  */
13
  class FontRegistry {
14
 
15
+ /** @var array */
16
+ private $standard_fonts = null;
17
 
18
+ /** @var array */
19
+ private $google_fonts = null;
20
 
21
+ /**
22
+ * Constructor
23
+ */
24
+ public function __construct() {
25
+ }
26
 
27
+ /**
28
  * Compile font options from different sources.
29
  *
30
  * @return array All available fonts.
71
  */
72
  public function get_google_font_uri( $fonts, $weight = 400, $subset = 'all' ) {
73
  // De-dupe the fonts
74
+ $allowed_fonts = $this->get_google_fonts();
75
  $fonts = array_unique( $fonts );
76
  $family = array();
77
 
122
  * @return array The available subsets.
123
  */
124
  public function get_google_font_subsets() {
125
+ $i18n = Kirki::i18n();
126
  return array(
127
  'all' => $i18n['all'],
128
  'cyrillic' => $i18n['cyrillic'],
129
  'cyrillic-ext' => $i18n['cyrillic-ext'],
130
+ 'devanagari' => $i18n['devanagari'],
131
  'greek' => $i18n['greek'],
132
  'greek-ext' => $i18n['greek-ext'],
133
  'khmer' => $i18n['khmer'],
183
  * @return array Standard websafe fonts.
184
  */
185
  public function get_standard_fonts() {
186
+ $i18n = Kirki::i18n();
187
+ if ($this->standard_fonts==null) {
188
+ $this->standard_fonts = apply_filters('kirki/fonts/standard_fonts', array(
189
+ 'serif' => array(
190
+ 'label' => $i18n['serif'],
191
+ 'stack' => 'Georgia,Times,"Times New Roman",serif'
192
+ ),
193
+ 'sans-serif' => array(
194
+ 'label' => $i18n['sans-serif'],
195
+ 'stack' => '"Helvetica Neue",Helvetica,Arial,sans-serif'
196
+ ),
197
+ 'monospace' => array(
198
+ 'label' => $i18n['monospace'],
199
+ 'stack' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace'
200
+ )
201
+ ));
202
+ }
203
+
204
+ return $this->standard_fonts;
205
  }
206
 
207
 
242
  return $value;
243
  }
244
 
245
+ return '';
246
  }
247
 
248
  /**
251
  * @return array All Google Fonts.
252
  */
253
  public function get_google_fonts() {
254
+ if ($this->google_fonts==null) {
255
+ // Get the list of fonts from our json file and convert to an array
256
+ $fonts = json_decode(file_get_contents(KIRKI_PATH . '/assets/json/webfonts.json'), true);
257
+
258
+ $google_fonts = array();
259
+ foreach ($fonts['items'] as $font) {
260
+ $google_fonts[$font['family']] = array(
261
+ 'label' => $font['family'],
262
+ 'variants' => $font['variants'],
263
+ 'subsets' => $font['subsets'],
264
+ );
265
+ }
266
+
267
+ $this->google_fonts = apply_filters('kirki/fonts/google_fonts', $google_fonts);
268
+ }
269
+
270
+ return $this->google_fonts;
271
  }
272
 
273
  }
includes/Helpers/helpers.php CHANGED
@@ -20,34 +20,34 @@ function kirki_update() {
20
  $version = get_option( 'kirki_version' );
21
  $version = ( ! $version ) ? '0' : $version;
22
  // < 0.6.1 -> 0.6.2
23
- if ( ! get_option( 'kirki_version' ) ) {
24
  /**
25
  * In versions 0.6.0 & 0.6.1 there was a bug and some fields were saved as ID_opacity istead if ID
26
  * This will fix the wrong settings naming and save new settings.
27
  */
28
- $control_ids = array();
29
- $controls = Kirki::controls()->get_all();
30
 
31
- foreach ( $controls as $control ) {
32
- $control = \Kirki\Control::sanitize( $control );
33
 
34
- if ( 'background' != $control['type'] ) {
35
- $control_ids[] = $control['settings'];
36
  }
37
 
38
  }
39
 
40
- foreach ( $control_ids as $control_id ) {
41
 
42
- if ( get_theme_mod( $control_id . '_opacity' ) && ! get_theme_mod( $control_id ) ) {
43
- update_theme_mod( $control_id, get_theme_mod( $control_id . '_opacity' ) );
44
  }
45
 
46
  }
47
 
48
  }
49
 
50
- if ( version_compare( Kirki::$version, $version ) ) {
51
  update_option( 'kirki_version', Kirki::$version );
52
  }
53
 
@@ -55,44 +55,51 @@ function kirki_update() {
55
  add_action( 'wp', 'kirki_update' );
56
 
57
  /**
58
- * A wrapper function for get_theme_mod.
59
- *
60
- * This will be a bit more generic and will future-proof the plugin
61
- * in case we ever decide to switch to using options instead of theme mods.
62
- *
63
- * An additional benefit is that it also gets the default values
64
- * without the need to manually define them like in get_theme_mod();
65
- *
66
- * It's recommended that you add the following to your theme/plugin before using this function:
67
- *
68
- if ( ! function_exists( 'kirki_get_option' ) ) :
69
- function kirki_get_option( $option ) {
70
- get_theme_mod( $option, '' );
71
- }
72
- endif;
73
- *
74
- * If the plugin is not installed, the above function will NOT get the right value,
75
- * but at least no fatal errors will occur.
76
  */
77
- function kirki_get_option( $option ) {
78
-
79
- // Get the array of controls
80
- $controls = Kirki::controls()->get_all();
81
- foreach ( $controls as $control ) {
82
- $setting = $control['settings'];
83
- $default = ( isset( $control['default'] ) ) ? $control['default'] : '';
84
- // Get the theme_mod and pass the default value as well
85
- if ( $option == $setting ) {
86
- $value = get_theme_mod( $option, $default );
 
 
 
 
 
 
 
 
 
 
 
87
  }
 
 
 
88
  }
 
 
 
 
 
 
 
 
 
89
 
90
- if ( isset( $value ) ) {
91
- return $value;
 
 
92
  }
93
 
94
- // fallback to returning an empty string
95
- return '';
96
 
97
  }
98
 
20
  $version = get_option( 'kirki_version' );
21
  $version = ( ! $version ) ? '0' : $version;
22
  // < 0.6.1 -> 0.6.2
23
+ if ( ! $version ) {
24
  /**
25
  * In versions 0.6.0 & 0.6.1 there was a bug and some fields were saved as ID_opacity istead if ID
26
  * This will fix the wrong settings naming and save new settings.
27
  */
28
+ $field_ids = array();
29
+ $fields = Kirki::fields()->get_all();
30
 
31
+ foreach ( $fields as $field ) {
32
+ $field = Kirki::field()->sanitize( $field );
33
 
34
+ if ( 'background' != $field['type'] ) {
35
+ $field_ids[] = $field['settings'];
36
  }
37
 
38
  }
39
 
40
+ foreach ( $field_ids as $field_id ) {
41
 
42
+ if ( get_theme_mod( $field_id . '_opacity' ) && ! get_theme_mod( $field_id ) ) {
43
+ set_theme_mod( $field_id, get_theme_mod( $field_id . '_opacity' ) );
44
  }
45
 
46
  }
47
 
48
  }
49
 
50
+ if ( ! $version || version_compare( Kirki::$version, $version ) ) {
51
  update_option( 'kirki_version', Kirki::$version );
52
  }
53
 
55
  add_action( 'wp', 'kirki_update' );
56
 
57
  /**
58
+ * Get the value of a field.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  */
60
+ function kirki_get_option( $option = '' ) {
61
+
62
+ // Make sure the class is instanciated
63
+ Kirki::get_instance();
64
+
65
+ // Get the array of all the fields.
66
+ $fields = Kirki::fields()->get_all();
67
+ // Get the config.
68
+ $config = Kirki::config()->get_all();
69
+
70
+ /**
71
+ * If no setting has been defined then return all.
72
+ */
73
+ if ( '' == $option ) {
74
+ if ( 'option' == $config['options_type'] ) {
75
+ $values = array();
76
+ foreach ( $fields as $field ) {
77
+ $values[] = get_option( $field['settings'], $field['default'] );
78
+ }
79
+ } else {
80
+ $values = get_theme_mods();
81
  }
82
+
83
+ return $values;
84
+
85
  }
86
+ // If a value has been defined then we proceed.
87
+
88
+ // Early exit if this option does not exist
89
+ if ( ! isset( $fields[$option] ) ) {
90
+ return;
91
+ }
92
+
93
+ $option_name = $fields[$option]['settings'];
94
+ $default = $fields[$option]['default'];
95
 
96
+ if ( 'option' == $config['options_type'] ) {
97
+ $value = get_option( $option_name, $default );
98
+ } else {
99
+ $value = get_theme_mod( $option_name, $default );
100
  }
101
 
102
+ return $value;
 
103
 
104
  }
105
 
includes/Helpers/libraries/class-kirki-color.php CHANGED
@@ -7,10 +7,16 @@
7
  */
8
  class Kirki_Color {
9
 
10
- /**
11
- * Sanitize hex colors
12
- */
13
- public static function sanitize_hex( $color, $hash = true ) {
 
 
 
 
 
 
14
 
15
  // Remove any spaces and special characters before and after the string
16
  $color = trim( $color. ' \t\n\r\0\x0B' );
@@ -18,50 +24,30 @@ class Kirki_Color {
18
  // Remove any trailing '#' symbols from the color value
19
  $color = str_replace( '#', '', $color );
20
 
21
- // If there are more than 6 characters, only keep the first 6.
22
- $color = ( strlen( $color ) > 6 ) ? substr( $color, 0, 6 ) : 'ffffff';
23
-
24
- // Check the validity of the hex (also takes care of wrong values like "transparent")
25
- $color = ( empty( $color ) || ! ctype_xdigit( $color ) ) ? 'ffffff' : $color;
26
-
27
- if ( strlen( $color ) == 6 ) {
28
- $hex = $color; // If string consists of 6 characters, then this is our color
29
- } else {
30
-
31
- // String is shorter than 6 characters.
32
- // We will have to do some calculations below to get the actual 6-digit hex value.
33
-
34
- // If the string is longer than 3 characters, only keep the first 3.
35
- $color = ( strlen( $color ) > 3 ) ? substr( $color, 0, 3 ) : $color;
36
-
37
- // If this is a 3-character string, format it to 6 characters.
38
- if ( 3 == strlen( $color ) ) {
39
-
40
- $red = substr( $color, 0, 1 ) . substr( $color, 0, 1 );
41
- $green = substr( $color, 1, 1 ) . substr( $color, 1, 1 );
42
- $blue = substr( $color, 2, 1 ) . substr( $color, 2, 1 );
43
-
44
- $hex = $red . $green . $blue;
45
-
46
- }
47
-
48
- // If this is shorter than 3 characters, do some voodoo.
49
- if ( 2 == strlen( $color ) ) {
50
- $hex = $color . $color . $color;
51
- } else if ( 1 == strlen( $color ) ) {
52
- $hex = $color . $color . $color . $color . $color . $color;
53
- }
54
 
 
 
 
 
 
55
  }
 
56
 
57
  return ( ! $hash ) ? $hex : '#' . $hex;
58
 
59
  }
60
 
61
- /*
62
- * Gets the rgb value of the $hex color.
63
- * Returns an array.
64
- */
 
 
 
65
  public static function get_rgb( $hex, $implode = false ) {
66
 
67
  // Remove any trailing '#' symbols from the color value
@@ -78,9 +64,13 @@ class Kirki_Color {
78
 
79
  }
80
 
81
- /*
82
- * Gets the rgba value of a color.
83
- */
 
 
 
 
84
  public static function get_rgba( $hex = '#fff', $opacity = 100 ) {
85
 
86
  $hex = self::sanitize_hex( $hex, false );
@@ -107,10 +97,12 @@ class Kirki_Color {
107
 
108
  }
109
 
110
- /*
111
- * Gets the brightness of the $hex color.
112
- * Returns a value between 0 and 255
113
- */
 
 
114
  public static function get_brightness( $hex ) {
115
 
116
  $hex = self::sanitize_hex( $hex, false );
@@ -124,10 +116,13 @@ class Kirki_Color {
124
 
125
  }
126
 
127
- /*
128
- * Adjusts brightness of the $hex color.
129
- * the $steps variable is a value between -255 (darken) and 255 (lighten)
130
- */
 
 
 
131
  public static function adjust_brightness( $hex, $steps ) {
132
 
133
  $hex = self::sanitize_hex( $hex, false );
@@ -152,11 +147,16 @@ class Kirki_Color {
152
 
153
  }
154
 
155
- /*
156
- * Mixes 2 hex colors.
157
- * the "percentage" variable is the percent of the first color
158
- * to be used it the mix. default is 50 (equal mix)
159
- */
 
 
 
 
 
160
  public static function mix_colors( $hex1, $hex2, $percentage ) {
161
 
162
  $hex1 = self::sanitize_hex( $hex1, false );
@@ -182,9 +182,12 @@ class Kirki_Color {
182
 
183
  }
184
 
185
- /*
186
- * Convert a hex color to HSV
187
- */
 
 
 
188
  public static function hex_to_hsv( $hex ) {
189
 
190
  $hex = self::sanitize_hex( $hex, false );
@@ -195,9 +198,12 @@ class Kirki_Color {
195
 
196
  }
197
 
198
- /*
199
- * Convert an RGB array to HSV
200
- */
 
 
 
201
  public static function rgb_to_hsv( $color = array() ) {
202
  $r = $color[0];
203
  $g = $color[1];
@@ -249,21 +255,25 @@ class Kirki_Color {
249
  return $hsl;
250
  }
251
 
252
- /*
253
- * Get the brightest color from an array of colors.
254
- * Return the key of the array if $context = 'key'
255
- * Return the hex value of the color if $context = 'value'
256
- */
 
 
 
 
257
  public static function brightest_color( $colors = array(), $context = 'key' ) {
258
 
259
  $brightest = false;
260
 
261
  foreach ( $colors as $color ) {
262
  $color = self::sanitize_hex( $color, false );
263
- $brightness = self::get_brightness( $hex );
264
 
265
- if ( ! $brightest || self::get_brightness( $hex ) > self::get_brightness( $brightest ) ) {
266
- $brightest = $hex;
267
  }
268
  }
269
 
7
  */
8
  class Kirki_Color {
9
 
10
+ /**
11
+ * Sanitises a HEX value.
12
+ * The way this works is by splitting the string in 6 substrings.
13
+ * Each sub-string is individually sanitized, and the result is then returned.
14
+ *
15
+ * @var string The hex value of a color
16
+ * @param boolean Whether we want to include a hash (#) at the beginning or not
17
+ * @return string The sanitized hex color.
18
+ */
19
+ public static function sanitize_hex( $color = '#FFFFFF', $hash = true ) {
20
 
21
  // Remove any spaces and special characters before and after the string
22
  $color = trim( $color. ' \t\n\r\0\x0B' );
24
  // Remove any trailing '#' symbols from the color value
25
  $color = str_replace( '#', '', $color );
26
 
27
+ // If the string is 6 characters long then use it in pairs.
28
+ if ( 3 == strlen( $color ) ) {
29
+ $color = substr( $color, 0, 1 ) . substr( $color, 0, 1 ) . substr( $color, 1, 1 ) . substr( $color, 1, 1 ) . substr( $color, 2, 1 ) . substr( $color, 2, 1 );
30
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ $substr = array();
33
+ for ( $i = 0; $i <= 5; $i++ ) {
34
+ $default = ( 0 == $i ) ? 'F' : ( $substr[$i-1] );
35
+ $substr[$i] = substr( $color, $i, 1 );
36
+ $substr[$i] = ( ! $substr[$i] || ! ctype_xdigit( $substr[$i] ) ) ? $default : $substr[$i];
37
  }
38
+ $hex = implode( '', $substr );
39
 
40
  return ( ! $hash ) ? $hex : '#' . $hex;
41
 
42
  }
43
 
44
+ /**
45
+ * Gets the rgb value of the $hex color.
46
+ *
47
+ * @var string The hex value of a color
48
+ * @param boolean Whether we want to implode the values or not
49
+ * @return mixed array|string
50
+ */
51
  public static function get_rgb( $hex, $implode = false ) {
52
 
53
  // Remove any trailing '#' symbols from the color value
64
 
65
  }
66
 
67
+ /**
68
+ * Gets the rgb value of the $hex color.
69
+ *
70
+ * @var string The hex value of a color
71
+ * @param int Opacity level (1-100)
72
+ * @return string
73
+ */
74
  public static function get_rgba( $hex = '#fff', $opacity = 100 ) {
75
 
76
  $hex = self::sanitize_hex( $hex, false );
97
 
98
  }
99
 
100
+ /**
101
+ * Gets the brightness of the $hex color.
102
+ *
103
+ * @var string The hex value of a color
104
+ * @return int value between 0 and 255
105
+ */
106
  public static function get_brightness( $hex ) {
107
 
108
  $hex = self::sanitize_hex( $hex, false );
116
 
117
  }
118
 
119
+ /**
120
+ * Adjusts brightness of the $hex color.
121
+ *
122
+ * @var string The hex value of a color
123
+ * @param int a value between -255 (darken) and 255 (lighten)
124
+ * @return string returns hex color
125
+ */
126
  public static function adjust_brightness( $hex, $steps ) {
127
 
128
  $hex = self::sanitize_hex( $hex, false );
147
 
148
  }
149
 
150
+ /**
151
+ * Mixes 2 hex colors.
152
+ * the "percentage" variable is the percent of the first color
153
+ * to be used it the mix. default is 50 (equal mix)
154
+ *
155
+ * @var string The hex value of color 1
156
+ * @var string The hex value of color 2
157
+ * @param int a value between 0 and 100
158
+ * @return string returns hex color
159
+ */
160
  public static function mix_colors( $hex1, $hex2, $percentage ) {
161
 
162
  $hex1 = self::sanitize_hex( $hex1, false );
182
 
183
  }
184
 
185
+ /**
186
+ * Convert hex color to hsv
187
+ *
188
+ * @var string The hex value of color 1
189
+ * @return array returns array( 'h', 's', 'v' )
190
+ */
191
  public static function hex_to_hsv( $hex ) {
192
 
193
  $hex = self::sanitize_hex( $hex, false );
198
 
199
  }
200
 
201
+ /**
202
+ * Convert hex color to hsv
203
+ *
204
+ * @var array The rgb color to conver array( 'r', 'g', 'b' )
205
+ * @return array returns array( 'h', 's', 'v' )
206
+ */
207
  public static function rgb_to_hsv( $color = array() ) {
208
  $r = $color[0];
209
  $g = $color[1];
255
  return $hsl;
256
  }
257
 
258
+ /**
259
+ * Get the brightest color from an array of colors.
260
+ * Return the key of the array if $context = 'key'
261
+ * Return the hex value of the color if $context = 'value'
262
+ *
263
+ * @var array flat array of hex colors
264
+ * @param string 'key' or 'value'
265
+ * @return mixed int|string
266
+ */
267
  public static function brightest_color( $colors = array(), $context = 'key' ) {
268
 
269
  $brightest = false;
270
 
271
  foreach ( $colors as $color ) {
272
  $color = self::sanitize_hex( $color, false );
273
+ $brightness = self::get_brightness( $color );
274
 
275
+ if ( ! $brightest || self::get_brightness( $color ) > self::get_brightness( $brightest ) ) {
276
+ $brightest = $color;
277
  }
278
  }
279
 
includes/Helpers/libraries/class-kirki-colourlovers.php CHANGED
@@ -20,7 +20,8 @@ class Kirki_Colourlovers {
20
  public static function parse( $xml = null ) {
21
 
22
  // XML copied from http://www.colourlovers.com/api/palettes/top?numResults=100
23
- $xml_url = ( is_null( $xml ) ) ? KIRKI_URL . '/assets/xml/colourlovers-top.xml' : $xml;
 
24
  $feed_xml = simplexml_load_file( $xml_url );
25
  $palettes = array();
26
 
@@ -183,6 +184,6 @@ class Kirki_Colourlovers {
183
 
184
  return $palette;
185
 
186
- }
187
 
188
  }
20
  public static function parse( $xml = null ) {
21
 
22
  // XML copied from http://www.colourlovers.com/api/palettes/top?numResults=100
23
+ $root = ( '' != $config['url_path'] ) ? $config['url_path'] : KIRKI_URL;
24
+ $xml_url = ( is_null( $xml ) ) ? trailingslashit( $root ) . 'assets/xml/colourlovers-top.xml' : $xml;
25
  $feed_xml = simplexml_load_file( $xml_url );
26
  $palettes = array();
27
 
184
 
185
  return $palette;
186
 
187
+ }
188
 
189
  }
includes/Helpers/sanitize.php CHANGED
@@ -29,9 +29,9 @@ function kirki_sanitize_number( $value ) {
29
  function kirki_sanitize_choice( $input, $setting ) {
30
 
31
  global $wp_customize;
32
- $control = $wp_customize->get_control( $setting->id );
33
 
34
- return ( array_key_exists( $input, $control->choices ) ) ? $input : $setting->default;
35
 
36
  }
37
 
@@ -111,6 +111,19 @@ function kirki_sanitize_bg_position( $value ) {
111
 
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * DOES NOT SANITIZE ANYTHING.
116
  *
29
  function kirki_sanitize_choice( $input, $setting ) {
30
 
31
  global $wp_customize;
32
+ $field = $wp_customize->get_control( $setting->id );
33
 
34
+ return ( array_key_exists( $input, $field->choices ) ) ? $input : $setting->default;
35
 
36
  }
37
 
111
 
112
  }
113
 
114
+ /**
115
+ * Sanitize sortable controls
116
+ *
117
+ * @since 0.8.3
118
+ */
119
+
120
+ function kirki_sanitize_sortable( $value ) {
121
+ if ( is_serialized( $value ) ) {
122
+ return $value;
123
+ } else {
124
+ return serialize( $value );
125
+ }
126
+ }
127
  /**
128
  * DOES NOT SANITIZE ANYTHING.
129
  *
includes/Kirki.php CHANGED
@@ -3,10 +3,9 @@
3
  use Kirki\Fonts\FontRegistry;
4
  use Kirki\Scripts\ScriptRegistry;
5
  use Kirki\Config;
6
- use Kirki\Setting;
7
- use Kirki\Control;
8
- use Kirki\Controls;
9
  use Kirki\Styles;
 
 
10
 
11
  spl_autoload_register( function( $class ) {
12
  if ( stripos( $class, 'Kirki' ) === 0 ) {
@@ -21,44 +20,48 @@ spl_autoload_register( function( $class ) {
21
  */
22
  class Kirki {
23
 
24
- /** @var Kirki The only instance of this class */
25
- public static $instance = null;
26
 
27
- /** @var string Version number */
28
- public static $version = '0.8.2';
29
 
30
- /** @var Config Configuration */
31
  public $config = null;
32
 
33
- /** @var Controls */
34
- public $controls = null;
35
 
36
- /** @var FontRegistry The font registry */
37
- public $font_registry = null;
38
 
39
- /** @var scripts */
40
- public $scripts = null;
41
 
42
- /** @var $settings */
43
- public $setting = null;
 
 
 
 
 
 
 
 
44
 
45
- /**
46
- * Access the single instance of this class
47
- * @return Kirki
48
- */
49
- public static function get_instance() {
50
- if ( self::$instance==null ) {
51
- self::$instance = new Kirki();
52
- }
53
- return self::$instance;
54
- }
55
 
56
- /**
57
- * Shortcut method to get the configuration of the single instance.
58
- */
59
- public static function config() {
60
- return self::get_instance()->config;
61
- }
62
 
63
  /**
64
  * Shortcut method to get the translation strings
@@ -69,75 +72,27 @@ class Kirki {
69
  return $options['i18n'];
70
  }
71
 
72
- /**
73
- * Shortcut method to get the controls of the single instance.
74
- */
75
- public static function controls() {
76
- return self::get_instance()->controls;
77
- }
78
-
79
- /**
80
- * Shortcut method to get the font registry.
81
- */
82
- public static function fonts() {
83
- return self::get_instance()->font_registry;
84
- }
85
-
86
- /**
87
- * Constructor is private, should only be called by get_instance()
88
- */
89
- private function __construct() {
90
- // Include all files we need
91
- $this->include_files();
92
-
93
- // Create our main objects
94
- $this->config = new Config();
95
- $this->setting = new Setting();
96
- $this->controls = new Controls();
97
- $this->control = new Control();
98
- $this->font_registry = new FontRegistry();
99
- $this->scripts = new ScriptRegistry();
100
- $this->styles = new Styles();
101
-
102
- // Hook into WP
103
- $this->register_hooks();
104
- }
105
-
106
  /**
107
- * Build the controls
108
  */
109
- public function customizer_init( $wp_customize ) {
110
- $controls = Kirki::controls()->get_all();
111
-
112
- // Early exit if controls are not set or if they're empty
113
- if ( empty( $controls ) ) {
114
- return;
115
- }
116
-
117
- foreach ( $controls as $control ) {
118
- $this->setting->add( $wp_customize, $control );
119
- $this->control->add( $wp_customize, $control );
120
- }
121
  }
122
 
123
- /**
124
- * Hook into WP
125
- */
126
- private function register_hooks() {
127
- add_action( 'customize_register', array( $this, 'customizer_init' ), 99 );
128
- }
129
-
130
  /**
131
- * Include helper files we need
132
- */
133
- private function include_files() {
134
 
135
- include_once( KIRKI_PATH . '/includes/Helpers/libraries/class-kirki-color.php' );
136
- include_once( KIRKI_PATH . '/includes/Helpers/libraries/class-kirki-colourlovers.php' );
 
 
 
 
137
 
138
- include_once( KIRKI_PATH . '/includes/Helpers/deprecated.php' );
139
- include_once( KIRKI_PATH . '/includes/Helpers/sanitize.php' );
140
- include_once( KIRKI_PATH . '/includes/Helpers/helpers.php' );
141
 
142
  }
143
 
3
  use Kirki\Fonts\FontRegistry;
4
  use Kirki\Scripts\ScriptRegistry;
5
  use Kirki\Config;
 
 
 
6
  use Kirki\Styles;
7
+ use Kirki\Fields;
8
+ use Kirki\Builder;
9
 
10
  spl_autoload_register( function( $class ) {
11
  if ( stripos( $class, 'Kirki' ) === 0 ) {
20
  */
21
  class Kirki {
22
 
23
+ /** @var Kirki The only instance of this class */
24
+ public static $instance = null;
25
 
26
+ /** @var string Version number */
27
+ public static $version = '0.8.3';
28
 
29
+ /** @var Config Configuration */
30
  public $config = null;
31
 
32
+ /** @var FontRegistry The font registry */
33
+ public $font_registry = null;
34
 
35
+ /** @var scripts */
36
+ public $scripts = null;
37
 
38
+ /** @var field */
39
+ public $fields = null;
40
 
41
+ /**
42
+ * Access the single instance of this class
43
+ * @return Kirki
44
+ */
45
+ public static function get_instance() {
46
+ if ( self::$instance==null ) {
47
+ self::$instance = new Kirki();
48
+ }
49
+ return self::$instance;
50
+ }
51
 
52
+ /**
53
+ * Shortcut method to call the Field class
54
+ */
55
+ public static function fields() {
56
+ return self::get_instance()->fields;
57
+ }
 
 
 
 
58
 
59
+ /**
60
+ * Shortcut method to get the configuration of the single instance.
61
+ */
62
+ public static function config() {
63
+ return self::get_instance()->config;
64
+ }
65
 
66
  /**
67
  * Shortcut method to get the translation strings
72
  return $options['i18n'];
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
+ * Shortcut method to get the font registry.
77
  */
78
+ public static function fonts() {
79
+ return self::get_instance()->font_registry;
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
 
 
 
 
 
 
 
82
  /**
83
+ * Constructor is private, should only be called by get_instance()
84
+ */
85
+ private function __construct() {
86
 
87
+ // Create our main objects
88
+ $this->font_registry = new FontRegistry();
89
+ $this->config = new Config();
90
+ $this->fields = new Fields();
91
+ $this->scripts = new ScriptRegistry();
92
+ $this->styles = new Styles();
93
 
94
+ // Hook into WP
95
+ $init = new Builder();
 
96
 
97
  }
98
 
includes/Scripts/Customizer/Branding.php CHANGED
@@ -4,6 +4,7 @@ namespace Kirki\Scripts\Customizer;
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
 
7
 
8
  class Branding extends EnqueueScript {
9
 
@@ -13,18 +14,22 @@ class Branding extends EnqueueScript {
13
  */
14
  public function customize_controls_print_scripts() {
15
 
16
- $options = Kirki::config()->get_all(); ?>
17
-
18
- <?php if ( isset( $options['logo_image'] ) || isset( $options['description'] ) ) : ?>
19
- <script>jQuery(document).ready(function($) { "use strict";
20
- <?php if ( isset( $options['logo_image'] ) ) : ?>
21
- $( 'div#customize-info .preview-notice' ).replaceWith( '<img src="<?php echo $options['logo_image']; ?>">' );
22
- <?php endif; ?>
23
- <?php if ( isset( $options['description'] ) ) : ?>
24
- $( 'div#customize-info .accordion-section-content' ).replaceWith( '<div class="accordion-section-content"><div class="theme-description"><?php echo $options['description']; ?></div></div>' );
25
- <?php endif; ?>
26
- });</script>
27
- <?php endif;
 
 
 
 
28
 
29
  }
30
 
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
7
+ use Kirki\Scripts\ScriptRegistry;
8
 
9
  class Branding extends EnqueueScript {
10
 
14
  */
15
  public function customize_controls_print_scripts() {
16
 
17
+ $options = Kirki::config()->get_all();
18
+ $script = '';
19
+ if ( '' != $options['logo_image'] || '' != $options['description'] ) {
20
+
21
+ if ( '' != $options['logo_image'] ) {
22
+ $script .= '$( \'div#customize-info .preview-notice\' ).replaceWith( \'<img src="' . $options['logo_image'] . '">\' );';
23
+ }
24
+ if ( '' != $options['description'] ) {
25
+ $script .= '$( \'div#customize-info .accordion-section-content\' ).replaceWith( \'<div class="accordion-section-content"><div class="theme-description">' . $options['description'] . '</div></div>\' );';
26
+ }
27
+
28
+ }
29
+
30
+ if ( '' != $script ) {
31
+ echo ScriptRegistry::prepare( $script );
32
+ }
33
 
34
  }
35
 
includes/Scripts/Customizer/Dependencies.php CHANGED
@@ -12,13 +12,15 @@ class Dependencies extends EnqueueScript {
12
  */
13
  public function customize_controls_enqueue_scripts() {
14
 
15
- $controls = Kirki::config()->get_all();
16
- $kirki_url = isset( $config['url_path'] ) ? $config['url_path'] : KIRKI_URL;
17
 
18
- wp_enqueue_script( 'kirki_customizer_js', $kirki_url . 'assets/js/customizer.js', array( 'jquery', 'customize-controls' ) );
19
- wp_enqueue_script( 'serialize-js', $kirki_url . 'assets/js/serialize.js');
 
20
  wp_enqueue_script( 'jquery-ui-core' );
21
  wp_enqueue_script( 'jquery-ui-tooltip' );
 
22
 
23
  }
24
 
12
  */
13
  public function customize_controls_enqueue_scripts() {
14
 
15
+ $config = Kirki::config()->get_all();
16
+ $kirki_url = ( '' != $config['url_path'] )? $config['url_path'] : KIRKI_URL;
17
 
18
+ wp_enqueue_script( 'kirki_customizer_js', trailingslashit( $kirki_url ) . 'assets/js/customizer.js', array( 'jquery', 'customize-controls' ) );
19
+ wp_enqueue_script( 'serialize-js', trailingslashit( $kirki_url ) . 'assets/js/serialize.js' );
20
+ wp_enqueue_script( 'jquery-stepper-min-js', trailingslashit( $kirki_url ) . 'assets/js/jquery.fs.stepper.min.js', array( 'jquery' ) );
21
  wp_enqueue_script( 'jquery-ui-core' );
22
  wp_enqueue_script( 'jquery-ui-tooltip' );
23
+ wp_enqueue_script( 'jquery-stepper-min-js' );
24
 
25
  }
26
 
includes/Scripts/Customizer/PostMessage.php CHANGED
@@ -4,6 +4,7 @@ namespace Kirki\Scripts\Customizer;
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
 
7
 
8
  class PostMessage extends EnqueueScript {
9
 
@@ -38,30 +39,27 @@ class PostMessage extends EnqueueScript {
38
  if ( ! isset( $wp_customize ) ) {
39
  return;
40
  }
41
- ?>
42
 
43
- <?php $controls = Kirki::controls()->get_all(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- <script type="text/javascript">
46
- ( function( $ ) {
47
- <?php foreach ( $controls as $control ) : ?>
48
- <?php if ( isset( $control['transport'] ) && isset( $control['js_vars'] ) && 'postMessage' == $control['transport'] ) : ?>
49
- <?php foreach ( $control['js_vars'] as $js_vars ) : ?>
50
- wp.customize( '<?php echo $control["settings"]; ?>', function( value ) {
51
- value.bind( function( newval ) {
52
- <?php if ( 'html' == $js_vars['function'] ) : ?>
53
- $( '<?php echo esc_js( $js_vars["element"] ); ?>' ).html( newval );
54
- <?php elseif ( 'css' == $js_vars['function'] ) : ?>
55
- $('<?php echo esc_js( $js_vars["element"] ); ?>').css('<?php echo esc_js( $js_vars["property"] ); ?>', newval );
56
- <?php endif; ?>
57
- } );
58
- } );
59
- <?php endforeach; ?>
60
- <?php endif; ?>
61
- <?php endforeach; ?>
62
- } )( jQuery );
63
- </script>
64
- <?php
65
 
66
  }
67
 
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
7
+ use Kirki\Scripts\ScriptRegistry;
8
 
9
  class PostMessage extends EnqueueScript {
10
 
39
  if ( ! isset( $wp_customize ) ) {
40
  return;
41
  }
 
42
 
43
+ $fields = Kirki::fields()->get_all();
44
+ $script = '';
45
+ foreach ( $fields as $field ) {
46
+ if ( isset( $field['transport'] ) && ! is_null( $field['js_vars'] ) && 'postMessage' == $field['transport'] ) {
47
+ foreach ( $field['js_vars'] as $js_vars ) {
48
+ $script .= 'wp.customize( \'' . $field['settings'] . '\', function( value ) {';
49
+ $script .= 'value.bind( function( newval ) {';
50
+ if ( 'html' == $js_vars['function'] ) {
51
+ $script .= '$( \'' . esc_js( $js_vars["element"] ) . '\' ).html( newval );';
52
+ } elseif ( 'css' == $js_vars['function'] ) {
53
+ $script .= '$(\'' . esc_js( $js_vars["element"] ) . '\').css(\'' . esc_js( $js_vars["property"] ) . '\', newval );';
54
+ }
55
+ $script .= '}); });';
56
+ }
57
+ }
58
+ }
59
 
60
+ if ( '' != $script ) {
61
+ echo ScriptRegistry::prepare( $script );
62
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  }
65
 
includes/Scripts/Customizer/Required.php CHANGED
@@ -4,6 +4,7 @@ namespace Kirki\Scripts\Customizer;
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
 
7
 
8
  class Required extends EnqueueScript {
9
 
@@ -12,30 +13,25 @@ class Required extends EnqueueScript {
12
  */
13
  function customize_controls_print_footer_scripts() {
14
 
15
- $controls = Kirki::controls()->get_all();
16
 
17
  // Early exit if no controls are defined
18
- if ( empty( $controls ) ) {
19
  return;
20
  }
21
 
22
  $script = '';
23
 
24
- foreach ( $controls as $control ) {
25
 
26
- $required = ( isset( $control['required'] ) ) ? $control['required'] : false;
27
- $setting = $control['settings'];
28
 
29
  if ( $required ) {
30
 
31
  $show = false;
32
  foreach ( $required as $dependency ) {
33
  // Find the type of the dependency control
34
- foreach ( $controls as $control ) {
35
- if ( $dependency['setting'] == $control['settings'] ) {
36
- $type = $control['type'];
37
- }
38
- }
39
 
40
  // If "operator" is not set then set it to "=="
41
  if ( ! isset( $dependency['operator'] ) ) {
@@ -59,7 +55,16 @@ class Required extends EnqueueScript {
59
  }
60
 
61
  // The target element
62
- $target = '#customize-control-' . $setting;
 
 
 
 
 
 
 
 
 
63
 
64
  if ( ! isset( $dependency['operator'] ) ) {
65
  $dependency['operator'] = '==';
@@ -81,18 +86,19 @@ class Required extends EnqueueScript {
81
  }
82
 
83
  // Get the initial status
 
84
  if ( '==' == $dependency['operator'] ) {
85
- $show = ( $show && ( $dependency['value'] == kirki_get_option( $setting ) ) ) ? true : $show;
86
  } elseif ( '!=' == $dependency['operator'] ) {
87
- $show = ( $show && ( $dependency['value'] != kirki_get_option( $setting ) ) ) ? true : $show;
88
  } elseif ( '>=' == $dependency['operator'] ) {
89
- $show = ( $show && ( $dependency['value'] >= kirki_get_option( $setting ) ) ) ? true : $show;
90
  } elseif ( '<=' == $dependency['operator'] ) {
91
- $show = ( $show && ( $dependency['value'] <= kirki_get_option( $setting ) ) ) ? true : $show;
92
  } elseif ( '>' == $dependency['operator'] ) {
93
- $show = ( $show && ( $dependency['value'] > kirki_get_option( $setting ) ) ) ? true : $show;
94
  } elseif ( '<' == $dependency['operator'] ) {
95
- $show = ( $show && ( $dependency['value'] < kirki_get_option( $setting ) ) ) ? true : $show;
96
  }
97
 
98
  // if initial status is hidden then hide the control
@@ -116,7 +122,7 @@ class Required extends EnqueueScript {
116
 
117
  // If there's a script then echo it wrapped.
118
  if ( ! empty( $script ) ) {
119
- echo '<script>jQuery(document).ready(function($) {' . $script . '});</script>';
120
  }
121
 
122
  }
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
7
+ use Kirki\Scripts\ScriptRegistry;
8
 
9
  class Required extends EnqueueScript {
10
 
13
  */
14
  function customize_controls_print_footer_scripts() {
15
 
16
+ $fields = Kirki::fields()->get_all();
17
 
18
  // Early exit if no controls are defined
19
+ if ( empty( $fields ) ) {
20
  return;
21
  }
22
 
23
  $script = '';
24
 
25
+ foreach ( $fields as $field ) {
26
 
27
+ $required = ( isset( $field['required'] ) ) ? $field['required'] : false;
 
28
 
29
  if ( $required ) {
30
 
31
  $show = false;
32
  foreach ( $required as $dependency ) {
33
  // Find the type of the dependency control
34
+ $type = $fields[$dependency['setting']]['type'];
 
 
 
 
35
 
36
  // If "operator" is not set then set it to "=="
37
  if ( ! isset( $dependency['operator'] ) ) {
55
  }
56
 
57
  // The target element
58
+ $target = '#customize-control-' . $field['settings'];
59
+ // if this is a background control then make sure we target all sub-controls
60
+ if ( 'background' == $field['type'] ) {
61
+ $target = '#customize-control-' . $control['settings'] . '_color, ';
62
+ $target .= '#customize-control-' . $control['settings'] . '_image, ';
63
+ $target .= '#customize-control-' . $control['settings'] . '_repeat, ';
64
+ $target .= '#customize-control-' . $control['settings'] . '_size, ';
65
+ $target .= '#customize-control-' . $control['settings'] . '_position, ';
66
+ $target .= '#customize-control-' . $control['settings'] . '_attach';
67
+ }
68
 
69
  if ( ! isset( $dependency['operator'] ) ) {
70
  $dependency['operator'] = '==';
86
  }
87
 
88
  // Get the initial status
89
+ $value = kirki_get_option( $field['settings'] );
90
  if ( '==' == $dependency['operator'] ) {
91
+ $show = ( $show && ( $dependency['value'] == $value ) ) ? true : $show;
92
  } elseif ( '!=' == $dependency['operator'] ) {
93
+ $show = ( $show && ( $dependency['value'] != $value ) ) ? true : $show;
94
  } elseif ( '>=' == $dependency['operator'] ) {
95
+ $show = ( $show && ( $dependency['value'] >= $value ) ) ? true : $show;
96
  } elseif ( '<=' == $dependency['operator'] ) {
97
+ $show = ( $show && ( $dependency['value'] <= $value ) ) ? true : $show;
98
  } elseif ( '>' == $dependency['operator'] ) {
99
+ $show = ( $show && ( $dependency['value'] > $value ) ) ? true : $show;
100
  } elseif ( '<' == $dependency['operator'] ) {
101
+ $show = ( $show && ( $dependency['value'] < $value ) ) ? true : $show;
102
  }
103
 
104
  // if initial status is hidden then hide the control
122
 
123
  // If there's a script then echo it wrapped.
124
  if ( ! empty( $script ) ) {
125
+ echo ScriptRegistry::prepare( $script );
126
  }
127
 
128
  }
includes/Scripts/Customizer/Stepper.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Kirki\Scripts\Customizer;
4
+
5
+ use Kirki;
6
+ use Kirki\Scripts\EnqueueScript;
7
+ use Kirki\Scripts\ScriptRegistry;
8
+
9
+ class Stepper extends EnqueueScript {
10
+
11
+ /**
12
+ * Add the help bubble
13
+ */
14
+ function customize_controls_print_footer_scripts() {
15
+
16
+ $fields = Kirki::fields()->get_all();
17
+ $scripts = array();
18
+
19
+ foreach ( $fields as $field ) {
20
+
21
+ if ( 'number' == $field['type'] ) {
22
+ $scripts[] = '$( "#customize-control-' . $field['settings'] . ' input[type=\'number\']").stepper();';
23
+ }
24
+
25
+ }
26
+
27
+ // No need to echo anything if the script is empty
28
+ if ( empty( $scripts ) ) {
29
+ return;
30
+ }
31
+
32
+ // Make sure we don't add any duplicates
33
+ $scripts = array_unique( $scripts );
34
+ // Convert array to string
35
+ $script = implode( '', $scripts );
36
+
37
+ echo ScriptRegistry::prepare( $script );
38
+
39
+ }
40
+
41
+ public function customize_controls_print_scripts() {}
42
+
43
+ public function customize_controls_enqueue_scripts() {}
44
+
45
+ public function wp_footer() {}
46
+
47
+ }
includes/Scripts/Customizer/Tooltips.php CHANGED
@@ -4,6 +4,7 @@ namespace Kirki\Scripts\Customizer;
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
 
7
 
8
  class Tooltips extends EnqueueScript {
9
 
@@ -12,17 +13,17 @@ class Tooltips extends EnqueueScript {
12
  */
13
  function customize_controls_print_footer_scripts() {
14
 
15
- $controls = Kirki::controls()->get_all();
16
 
17
  $scripts = array();
18
  $script = '';
19
 
20
- foreach ( $controls as $control ) {
21
 
22
- if ( ! empty( $control['help'] ) ) {
23
- $bubble_content = $control['help'];
24
  $content = "<a href='#' class='tooltip hint--left' data-hint='" . strip_tags( esc_html( $bubble_content ) ) . "'><span class='dashicons dashicons-info'></span></a>";
25
- $scripts[] = '$( "' . $content . '" ).prependTo( "#customize-control-' . $control['settings'] . '" );';
26
  }
27
 
28
  }
@@ -37,7 +38,7 @@ class Tooltips extends EnqueueScript {
37
  // Convert array to string
38
  $script = implode( '', $scripts );
39
 
40
- echo '<script type="text/javascript">jQuery(document).ready(function( $ ) {' . $script . '});</script>';
41
 
42
  }
43
 
4
 
5
  use Kirki;
6
  use Kirki\Scripts\EnqueueScript;
7
+ use Kirki\Scripts\ScriptRegistry;
8
 
9
  class Tooltips extends EnqueueScript {
10
 
13
  */
14
  function customize_controls_print_footer_scripts() {
15
 
16
+ $fields = Kirki::fields()->get_all();
17
 
18
  $scripts = array();
19
  $script = '';
20
 
21
+ foreach ( $fields as $field ) {
22
 
23
+ if ( ! empty( $field['help'] ) ) {
24
+ $bubble_content = $field['help'];
25
  $content = "<a href='#' class='tooltip hint--left' data-hint='" . strip_tags( esc_html( $bubble_content ) ) . "'><span class='dashicons dashicons-info'></span></a>";
26
+ $scripts[] = '$( "' . $content . '" ).prependTo( "#customize-control-' . $field['settings'] . '" );';
27
  }
28
 
29
  }
38
  // Convert array to string
39
  $script = implode( '', $scripts );
40
 
41
+ echo ScriptRegistry::prepare( $script );
42
 
43
  }
44
 
includes/Scripts/Frontend/GoogleFonts.php CHANGED
@@ -4,42 +4,50 @@ namespace Kirki\Scripts\Frontend;
4
 
5
  use Kirki;
6
 
7
- class GoogleFonts extends \Kirki {
8
 
9
- function __construct() {
10
  add_action( 'wp_enqueue_scripts', array( $this, 'google_font' ), 105 );
11
  }
12
 
13
  function google_link() {
14
 
15
- $controls = Kirki::controls()->get_all();
16
- $config = $this->config;
 
 
 
 
17
 
18
  // Get an array of all the google fonts
19
  $google_fonts = Kirki::fonts()->get_google_fonts();
20
 
21
  $fonts = array();
22
- foreach ( $controls as $control ) {
23
 
24
- // The value of this control
25
- $value = get_theme_mod( $control['settings'], $control['default'] );
26
 
27
- if ( isset( $control['output'] ) ) {
28
  // Check if this is a font-family control
29
- $is_font_family = isset( $control['output']['property'] ) && 'font-family' == $control['output']['property'] ? true : false;
30
 
31
  // Check if this is a font-weight control
32
- $is_font_weight = isset( $control['output']['property'] ) && 'font-weight' == $control['output']['property'] ? true : false;
33
 
34
  // Check if this is a font subset control
35
- $is_font_subset = isset( $control['output']['property'] ) && 'font-subset' == $control['output']['property'] ? true : false;
36
-
37
- if ( $is_font_family ) {
38
- $fonts[]['font-family'] = $value;
39
- } else if ( $is_font_weight ) {
40
- $fonts[]['font-weight'] = $value;
41
- } else if ( $is_font_subset ) {
42
- $fonts[]['subsets'] = $value;
 
 
 
 
 
 
43
  }
44
 
45
  }
4
 
5
  use Kirki;
6
 
7
+ class GoogleFonts {
8
 
9
+ public function __construct() {
10
  add_action( 'wp_enqueue_scripts', array( $this, 'google_font' ), 105 );
11
  }
12
 
13
  function google_link() {
14
 
15
+ $fields = Kirki::fields()->get_all();
16
+
17
+ // Early exit if no fields are found.
18
+ if ( ! $fields || empty( $fields ) ) {
19
+ return;
20
+ }
21
 
22
  // Get an array of all the google fonts
23
  $google_fonts = Kirki::fonts()->get_google_fonts();
24
 
25
  $fonts = array();
26
+ foreach ( $fields as $field ) {
27
 
28
+ if ( isset( $field['output'] ) ) {
 
29
 
 
30
  // Check if this is a font-family control
31
+ $is_font_family = isset( $field['output']['property'] ) && 'font-family' == $field['output']['property'] ? true : false;
32
 
33
  // Check if this is a font-weight control
34
+ $is_font_weight = isset( $field['output']['property'] ) && 'font-weight' == $field['output']['property'] ? true : false;
35
 
36
  // Check if this is a font subset control
37
+ $is_font_subset = isset( $field['output']['property'] ) && 'font-subset' == $field['output']['property'] ? true : false;
38
+
39
+ if ( $is_font_family || $is_font_weight || $is_font_subset ) {
40
+ // The value of this control
41
+ $value = kirki_get_option( $field['settings'] );
42
+
43
+ if ( $is_font_family ) {
44
+ $fonts[]['font-family'] = $value;
45
+ } else if ( $is_font_weight ) {
46
+ $fonts[]['font-weight'] = $value;
47
+ } else if ( $is_font_subset ) {
48
+ $fonts[]['subsets'] = $value;
49
+ }
50
+
51
  }
52
 
53
  }
includes/Scripts/ScriptRegistry.php CHANGED
@@ -7,6 +7,7 @@ use Kirki\Scripts\Customizer\Branding;
7
  use Kirki\Scripts\Customizer\PostMessage;
8
  use Kirki\Scripts\Customizer\Required;
9
  use Kirki\Scripts\Customizer\Tooltips;
 
10
  use Kirki\Scripts\Frontend\GoogleFonts;
11
 
12
  class ScriptRegistry {
@@ -19,7 +20,12 @@ class ScriptRegistry {
19
  $required = new Required();
20
  $tooltips = new Tooltips();
21
  $googlefonts = new GoogleFonts();
 
22
 
23
  }
24
 
 
 
 
 
25
  }
7
  use Kirki\Scripts\Customizer\PostMessage;
8
  use Kirki\Scripts\Customizer\Required;
9
  use Kirki\Scripts\Customizer\Tooltips;
10
+ use Kirki\Scripts\Customizer\Stepper;
11
  use Kirki\Scripts\Frontend\GoogleFonts;
12
 
13
  class ScriptRegistry {
20
  $required = new Required();
21
  $tooltips = new Tooltips();
22
  $googlefonts = new GoogleFonts();
23
+ $stepper = new Stepper();
24
 
25
  }
26
 
27
+ public static function prepare( $script ) {
28
+ return '<script>jQuery(document).ready(function($) { "use strict"; ' . $script . '});</script>';
29
+ }
30
+
31
  }
includes/Setting.php DELETED
@@ -1,193 +0,0 @@
1
- <?php
2
-
3
- namespace Kirki;
4
-
5
- class Setting {
6
-
7
- public $setting_type = null;
8
- public $capability = null;
9
- public $option_name = null;
10
-
11
- /**
12
- * The class construct
13
- */
14
- public function __construct() {
15
- $this->setting_type = 'theme_mod';
16
- $this->option_name = 'kirki';
17
- $this->capability = 'edit_theme_options';
18
- }
19
-
20
- /**
21
- * Add a setting
22
- */
23
- public function add( $wp_customize, $control ) {
24
-
25
- if ( 'option' == $this->setting_type ) {
26
- $control['settings'] = $this->option_name . '[' . $control['settings'] . ']';
27
- }
28
-
29
- if ( 'background' == $control['type'] ) {
30
-
31
- if ( isset( $control['default']['color'] ) ) {
32
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_color]' : $control['settings'] . '_color';
33
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['color'], 'sanitize_hex_color' );
34
- }
35
-
36
- if ( isset( $control['default']['image'] ) ) {
37
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_image]' : $control['settings'] . '_image';
38
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['image'], 'esc_url_raw' );
39
- }
40
- if ( isset( $control['default']['repeat'] ) ) {
41
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_repeat]' : $control['settings'] . '_repeat';
42
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['repeat'], 'kirki_sanitize_bg_repeat' );
43
- }
44
-
45
- if ( isset( $control['default']['size'] ) ) {
46
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_size]' : $control['settings'] . '_size';
47
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['size'], 'kirki_sanitize_bg_size' );
48
- }
49
-
50
- if ( isset( $control['default']['attach'] ) ) {
51
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_attach]' : $control['settings'] . '_attach';
52
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['attach'], 'kirki_sanitize_bg_attach' );
53
- }
54
-
55
- if ( isset( $control['default']['position'] ) ) {
56
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_position]' : $control['settings'] . '_position';
57
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['position'], 'kirki_sanitize_bg_position' );
58
- }
59
-
60
- if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
61
- $option_name = ( 'option' == $this->setting_type ) ? $this->option_name . '[' . $control['settings'] . '_opacity]' : $control['settings'] . '_opacity';
62
- $this->add_setting( $wp_customize, $control, $option_name, $control['default']['opacity'], 'absint' );
63
- }
64
- } else {
65
- $this->add_setting( $wp_customize, $control );
66
- }
67
-
68
- }
69
-
70
- /**
71
- * Get the value of an option.
72
- * If no value has been set then get the default value.
73
- *
74
- * For now we can only handle theme_mods
75
- */
76
- public function get( $setting = '' ) {
77
-
78
- // Get the array of controls
79
- $controls = Kirki::controls()->get_all();
80
- foreach ( $controls as $control ) {
81
-
82
- $setting = $control['settings'];
83
- $default = ( isset( $control['default'] ) ) ? $control['default'] : '';
84
- // Get the theme_mod and pass the default value as well
85
- if ( $option == $setting ) {
86
-
87
- if ( 'theme_mod' == $this->setting_type ) {
88
- $value = get_theme_mod( $option, $default );
89
- } elseif ( 'option' == $this->setting_type ) {
90
- $value = get_option( $option, $default );
91
- }
92
-
93
- }
94
-
95
- }
96
-
97
- if ( isset( $value ) ) {
98
- return $value;
99
- }
100
-
101
- // fallback to returning an empty string
102
- return '';
103
-
104
- }
105
-
106
- public function add_setting( $wp_customize, $control, $id_override = null, $default_override = null, $callback = null ) {
107
-
108
- $id = ( ! is_null( $id_override ) ) ? $id_override : $control['settings'];
109
- $default = ( ! is_null( $default_override ) ) ? $default_override : $control['default'];
110
- $callback = ( ! is_null( $callback ) ) ? $callback : $this->sanitize_callback( $control['type'] );
111
-
112
- $wp_customize->add_setting( $id, array(
113
- 'default' => $default,
114
- 'type' => $this->setting_type,
115
- 'capability' => $this->capability,
116
- 'transport' => isset( $control['transport'] ) ? $control['transport'] : 'refresh',
117
- 'sanitize_callback' => isset( $control['sanitize_callback'] ) ? $control['sanitize_callback'] : $callback,
118
- ) );
119
-
120
- }
121
-
122
- /**
123
- * Get the sanitize_callback based on the control type
124
- */
125
- public function sanitize_callback( $control_type ) {
126
-
127
- switch ( $control_type ) {
128
- case 'checkbox' :
129
- $sanitize_callback = 'kirki_sanitize_checkbox';
130
- break;
131
- case 'color' :
132
- $sanitize_callback = 'sanitize_hex_color';
133
- break;
134
- case 'image' :
135
- $sanitize_callback = 'esc_url_raw';
136
- break;
137
- case 'radio' :
138
- $sanitize_callback = 'kirki_sanitize_choice';
139
- break;
140
- case 'radio-image' :
141
- $sanitize_callback = 'kirki_sanitize_choice';
142
- break;
143
- case 'radio-buttonset' :
144
- $sanitize_callback = 'kirki_sanitize_choice';
145
- break;
146
- case 'toggle' :
147
- $sanitize_callback = 'kirki_sanitize_checkbox';
148
- break;
149
- case 'switch' :
150
- $sanitize_callback = 'kirki_sanitize_checkbox';
151
- break;
152
- case 'select' :
153
- $sanitize_callback = 'kirki_sanitize_choice';
154
- break;
155
- case 'dropdown-pages' :
156
- $sanitize_callback = 'kirki_sanitize_choice';
157
- break;
158
- case 'slider' :
159
- $sanitize_callback = 'kirki_sanitize_number';
160
- break;
161
- case 'text' :
162
- $sanitize_callback = 'esc_textarea';
163
- break;
164
- case 'textarea' :
165
- $sanitize_callback = 'esc_textarea';
166
- break;
167
- case 'editor' :
168
- $sanitize_callback = 'esc_textarea';
169
- break;
170
- case 'upload' :
171
- $sanitize_callback = 'esc_url_raw';
172
- break;
173
- case 'number' :
174
- $sanitize_callback = 'kirki_sanitize_number';
175
- break;
176
- case 'multicheck' :
177
- $sanitize_callback = 'esc_attr';
178
- break;
179
- case 'sortable' :
180
- $sanitize_callback = 'esc_attr';
181
- break;
182
- case 'palette' :
183
- $sanitize_callback = 'kirki_sanitize_choice';
184
- break;
185
- default :
186
- $sanitize_callback = 'kirki_sanitize_unfiltered';
187
- }
188
-
189
- return $sanitize_callback;
190
-
191
- }
192
-
193
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Settings.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Kirki;
4
+
5
+ use Kirki;
6
+
7
+ class Settings {
8
+
9
+ /**
10
+ * Add a setting
11
+ */
12
+ public function add( $wp_customize, $field ) {
13
+
14
+ if ( 'background' == $field['type'] ) {
15
+ // Do nothing.
16
+ // The 'background' field is just the sum of its sub-fields
17
+ // which are created individually.
18
+ } else {
19
+ $this->add_setting( $wp_customize, $field );
20
+ }
21
+
22
+ }
23
+
24
+ public function add_setting( $wp_customize, $field, $id_override = null, $default_override = null, $callback = null ) {
25
+
26
+ $id = ( ! is_null( $id_override ) ) ? $id_override : $field['settings'];
27
+ $default = ( ! is_null( $default_override ) ) ? $default_override : $field['default'];
28
+ $callback = ( ! is_null( $callback ) ) ? $callback : $field['sanitize_callback'];
29
+
30
+ $wp_customize->add_setting( $id, array(
31
+ 'default' => $default,
32
+ 'type' => $field['option_type'],
33
+ 'capability' => 'edit_theme_options',
34
+ 'transport' => $field['transport'],
35
+ 'sanitize_callback' => $callback,
36
+ ) );
37
+
38
+ }
39
+
40
+ }
includes/Styles/Customizer.php CHANGED
@@ -15,7 +15,9 @@ class Customizer {
15
  * Enqueue the stylesheets required.
16
  */
17
  function customizer_styles() {
18
- wp_enqueue_style( 'kirki-customizer-css', KIRKI_URL . '/assets/css/customizer.css', NULL, '0.5' );
 
 
19
  }
20
 
21
  /**
@@ -36,7 +38,7 @@ class Customizer {
36
  // Background styles
37
  $styles .= '#customize-controls .wp-full-overlay-sidebar-content{background-color:' . $color_back . ';}';
38
  $styles .= '#customize-theme-controls .accordion-section-title, #customize-info .accordion-section-title,#customize-info .accordion-section-title:hover,#customize-info.open .accordion-section-title{background-color:' . $color_back . ';color:' . $color_font . ';}';
39
- $styles .= '#customize-theme-controls .control-section .accordion-section-title:hover,.control-section.control-panel>.accordion-section-title:after{background-color:' . \Kirki_Color::adjust_brightness( $color_back, -10 ) . ';color:' . $color_font . ';}';
40
  $styles .= '#customize-theme-controls .control-section.control-panel>h3.accordion-section-title:focus:after, #customize-theme-controls .control-section.control-panel>h3.accordion-section-title:hover:after{background-color:' . \Kirki_Color::adjust_brightness( $color_back, -20 ) . ';color:' . $color_font . ';}';
41
  $styles .= '#customize-theme-controls .control-section.open .accordion-section-title{background-color:' . $color_accent . ' !important;color:' . $color_font . ' !important;}';
42
 
15
  * Enqueue the stylesheets required.
16
  */
17
  function customizer_styles() {
18
+ $config = Kirki::config()->get_all();
19
+ $root = ( '' != $config['url_path'] ) ? $config['url_path'] : KIRKI_URL;
20
+ wp_enqueue_style( 'kirki-customizer-css', trailingslashit( $root ) . 'assets/css/customizer.css', NULL, '0.5' );
21
  }
22
 
23
  /**
38
  // Background styles
39
  $styles .= '#customize-controls .wp-full-overlay-sidebar-content{background-color:' . $color_back . ';}';
40
  $styles .= '#customize-theme-controls .accordion-section-title, #customize-info .accordion-section-title,#customize-info .accordion-section-title:hover,#customize-info.open .accordion-section-title{background-color:' . $color_back . ';color:' . $color_font . ';}';
41
+ $styles .= '#customize-theme-controls .control-section .accordion-section-title:hover,#customize-theme-controls .control-section .accordion-section-title:focus,.control-section.control-panel>.accordion-section-title:after{background-color:' . \Kirki_Color::adjust_brightness( $color_back, -10 ) . ';color:' . $color_font . ';}';
42
  $styles .= '#customize-theme-controls .control-section.control-panel>h3.accordion-section-title:focus:after, #customize-theme-controls .control-section.control-panel>h3.accordion-section-title:hover:after{background-color:' . \Kirki_Color::adjust_brightness( $color_back, -20 ) . ';color:' . $color_font . ';}';
43
  $styles .= '#customize-theme-controls .control-section.open .accordion-section-title{background-color:' . $color_accent . ' !important;color:' . $color_font . ' !important;}';
44
 
includes/Styles/Frontend.php CHANGED
@@ -22,20 +22,21 @@ class Frontend {
22
  * Add a dummy, empty stylesheet if no stylesheet_id has been defined and we need one.
23
  */
24
  function frontend_styles() {
25
- $config = Kirki::config();
26
- $controls = Kirki::controls()->get_all();
27
 
28
- $kirki_url = $config->get('url_path', KIRKI_URL);
29
- $kirki_stylesheet = $config->getOrThrow('stylesheet_id');
30
 
31
- foreach( $controls as $control ) {
32
- if ( isset( $control['output'] ) ) {
33
  $uses_output = true;
34
  }
35
  }
36
 
 
 
37
  if ( isset( $uses_output ) && $uses_output && $kirki_stylesheet === 'kirki-styles' ) {
38
- wp_enqueue_style( 'kirki-styles', $kirki_url . 'assets/css/kirki-styles.css', NULL, NULL );
39
  }
40
 
41
  }
@@ -64,12 +65,12 @@ class Frontend {
64
  }
65
 
66
 
67
- function control_styles( $control, $styles, $element, $property, $units ) {
68
 
69
- $value = get_theme_mod( $control['settings'], $control['default'] );
70
 
71
  // Color controls
72
- if ( 'color' == $control['type'] ) {
73
 
74
  $color = \Kirki_Color::sanitize_hex( $value );
75
  $styles[$element][$property] = $color;
@@ -77,33 +78,39 @@ class Frontend {
77
  }
78
 
79
  // Background Controls
80
- elseif ( 'background' == $control['type'] ) {
81
-
82
- if ( isset( $control['default']['color'] ) ) {
83
- $bg_color = \Kirki_Color::sanitize_hex( get_theme_mod( $control['settings'] . '_color', $control['default']['color'] ) );
 
 
 
 
 
 
84
  }
85
- if ( isset( $control['default']['image'] ) ) {
86
- $bg_image = get_theme_mod( $control['settings'] . '_image', $control['default']['image'] );
87
  $bg_image = esc_url_raw( $bg_image );
88
  }
89
- if ( isset( $control['default']['repeat'] ) ) {
90
- $bg_repeat = get_theme_mod( $control['settings'] . '_repeat', $control['default']['repeat'] );
91
  $bg_repeat = kirki_sanitize_bg_repeat( $bg_repeat );
92
  }
93
- if ( isset( $control['default']['size'] ) ) {
94
- $bg_size = get_theme_mod( $control['settings'] . '_size', $control['default']['size'] );
95
  $bg_size = kirki_sanitize_bg_size( $bg_size );
96
  }
97
- if ( isset( $control['default']['attach'] ) ) {
98
- $bg_attach = get_theme_mod( $control['settings'] . '_attach', $control['default']['attach'] );
99
  $bg_attach = kirki_sanitize_bg_attach( $bg_attach );
100
  }
101
- if ( isset( $control['default']['position'] ) ) {
102
- $bg_position = get_theme_mod( $control['settings'] . '_position', $control['default']['position'] );
103
  $bg_position = kirki_sanitize_bg_position( $bg_position );
104
  }
105
- if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
106
- $bg_opacity = get_theme_mod( $control['settings'] . '_opacity', $control['default']['opacity'] );
107
  $bg_opacity = kirki_sanitize_number( $bg_opacity );
108
  if ( isset( $bg_color ) ) {
109
  // If we're using an opacity other than 100, then convert the color to RGBA.
@@ -136,15 +143,15 @@ class Frontend {
136
  }
137
 
138
  // Font controls
139
- elseif ( array( $control['output'] ) && isset( $control['output']['property'] ) && in_array( $control['output']['property'], array( 'font-family', 'font-size', 'font-weight' ) ) ) {
140
 
141
- $is_font_family = isset( $control['output']['property'] ) && 'font-family' == $control['output']['property'] ? true : false;
142
- $is_font_size = isset( $control['output']['property'] ) && 'font-size' == $control['output']['property'] ? true : false;
143
- $is_font_weight = isset( $control['output']['property'] ) && 'font-weight' == $control['output']['property'] ? true : false;
144
 
145
  if ( 'font-family' == $property ) {
146
 
147
- $styles[$control['output']['element']]['font-family'] = $value;
148
 
149
  } else if ( 'font-size' == $property ) {
150
 
@@ -171,36 +178,41 @@ class Frontend {
171
 
172
  function loop_controls() {
173
 
174
- $controls = Kirki::controls()->get_all();
175
  $styles = array();
176
 
177
- foreach ( $controls as $control ) {
 
 
 
 
 
178
  $element = '';
179
  $property = '';
180
  $units = '';
181
 
182
- // Only continue if $control['output'] is set
183
- if ( isset( $control['output'] ) ) {
184
 
185
  // Check if this is an array of style definitions
186
- $multiple_styles = isset( $control['output'][0]['element'] ) ? true : false;
187
 
188
  if ( ! $multiple_styles ) { // single style
189
 
190
- // If $control['output'] is not an array, then use the string as the target element
191
- if ( is_string( $control['output'] ) ) {
192
- $element = $control['output'];
193
  } else {
194
- $element = isset( $control['output']['element'] ) ? $control['output']['element'] : '';
195
- $property = isset( $control['output']['property'] ) ? $control['output']['property'] : '';
196
- $units = isset( $control['output']['units'] ) ? $control['output']['units'] : '';
197
  }
198
 
199
- $styles = $this->control_styles( $control, $styles, $element, $property, $units );
200
 
201
  } else { // Multiple styles set
202
 
203
- foreach ( $control['output'] as $style ) {
204
 
205
  if ( ! array( $style ) ) {
206
  $element = $style;
@@ -210,7 +222,7 @@ class Frontend {
210
  $units = isset( $style['units'] ) ? $style['units'] : '';
211
  }
212
 
213
- $styles = $this->control_styles( $control, $styles, $element, $property, $units );
214
 
215
  }
216
 
22
  * Add a dummy, empty stylesheet if no stylesheet_id has been defined and we need one.
23
  */
24
  function frontend_styles() {
25
+ $config = Kirki::config()->get_all();
26
+ $fields = Kirki::fields()->get_all();
27
 
28
+ $kirki_stylesheet = Kirki::config()->getOrThrow( 'stylesheet_id' );
 
29
 
30
+ foreach( $fields as $field ) {
31
+ if ( isset( $field['output'] ) ) {
32
  $uses_output = true;
33
  }
34
  }
35
 
36
+ $root = ( '' != $config['url_path'] ) ? $config['url_path'] : KIRKI_URL;
37
+
38
  if ( isset( $uses_output ) && $uses_output && $kirki_stylesheet === 'kirki-styles' ) {
39
+ wp_enqueue_style( 'kirki-styles', trailingslashit( $root ) . 'assets/css/kirki-styles.css', NULL, NULL );
40
  }
41
 
42
  }
65
  }
66
 
67
 
68
+ function setting_styles( $field, $styles, $element, $property, $units ) {
69
 
70
+ $value = kirki_get_option( $field['settings'] );
71
 
72
  // Color controls
73
+ if ( 'color' == $field['type'] ) {
74
 
75
  $color = \Kirki_Color::sanitize_hex( $value );
76
  $styles[$element][$property] = $color;
78
  }
79
 
80
  // Background Controls
81
+ elseif ( 'background' == $field['type'] ) {
82
+
83
+ if ( isset( $field['default']['color'] ) ) {
84
+ $color_mode = ( false !== strpos( $field['default']['color'], 'rgba' ) ) ? 'color-alpha' : 'color';
85
+ $value = kirki_get_option( $field['settings'] . '_color' );
86
+ if ( 'color-alpha' == $color_mode ) {
87
+ $bg_color = esc_js( $value );
88
+ } else {
89
+ $bg_color = \Kirki_Color::sanitize_hex( $value );
90
+ }
91
  }
92
+ if ( isset( $field['default']['image'] ) ) {
93
+ $bg_image = kirki_get_option( $field['settings'] . '_image' );
94
  $bg_image = esc_url_raw( $bg_image );
95
  }
96
+ if ( isset( $field['default']['repeat'] ) ) {
97
+ $bg_repeat = kirki_get_option( $field['settings'] . '_repeat' );
98
  $bg_repeat = kirki_sanitize_bg_repeat( $bg_repeat );
99
  }
100
+ if ( isset( $field['default']['size'] ) ) {
101
+ $bg_size = kirki_get_option( $field['settings'] . '_size' );
102
  $bg_size = kirki_sanitize_bg_size( $bg_size );
103
  }
104
+ if ( isset( $field['default']['attach'] ) ) {
105
+ $bg_attach = kirki_get_option( $field['settings'] . '_attach' );
106
  $bg_attach = kirki_sanitize_bg_attach( $bg_attach );
107
  }
108
+ if ( isset( $field['default']['position'] ) ) {
109
+ $bg_position = kirki_get_option( $field['settings'] . '_position' );
110
  $bg_position = kirki_sanitize_bg_position( $bg_position );
111
  }
112
+ if ( isset( $field['default']['opacity'] ) && $field['default']['opacity'] ) {
113
+ $bg_opacity = kirki_get_option( $field['settings'] . '_opacity' );
114
  $bg_opacity = kirki_sanitize_number( $bg_opacity );
115
  if ( isset( $bg_color ) ) {
116
  // If we're using an opacity other than 100, then convert the color to RGBA.
143
  }
144
 
145
  // Font controls
146
+ elseif ( array( $field['output'] ) && isset( $field['output']['property'] ) && in_array( $field['output']['property'], array( 'font-family', 'font-size', 'font-weight' ) ) ) {
147
 
148
+ $is_font_family = isset( $field['output']['property'] ) && 'font-family' == $field['output']['property'] ? true : false;
149
+ $is_font_size = isset( $field['output']['property'] ) && 'font-size' == $field['output']['property'] ? true : false;
150
+ $is_font_weight = isset( $field['output']['property'] ) && 'font-weight' == $field['output']['property'] ? true : false;
151
 
152
  if ( 'font-family' == $property ) {
153
 
154
+ $styles[$field['output']['element']]['font-family'] = $value;
155
 
156
  } else if ( 'font-size' == $property ) {
157
 
178
 
179
  function loop_controls() {
180
 
181
+ $fields = Kirki::fields()->get_all();
182
  $styles = array();
183
 
184
+ // Early exit if no fields are found.
185
+ if ( ! $fields || empty( $fields ) ) {
186
+ return;
187
+ }
188
+
189
+ foreach ( $fields as $field ) {
190
  $element = '';
191
  $property = '';
192
  $units = '';
193
 
194
+ // Only continue if $field['output'] is set
195
+ if ( isset( $field['output'] ) ) {
196
 
197
  // Check if this is an array of style definitions
198
+ $multiple_styles = isset( $field['output'][0]['element'] ) ? true : false;
199
 
200
  if ( ! $multiple_styles ) { // single style
201
 
202
+ // If $field['output'] is not an array, then use the string as the target element
203
+ if ( is_string( $field['output'] ) ) {
204
+ $element = $field['output'];
205
  } else {
206
+ $element = isset( $field['output']['element'] ) ? $field['output']['element'] : '';
207
+ $property = isset( $field['output']['property'] ) ? $field['output']['property'] : '';
208
+ $units = isset( $field['output']['units'] ) ? $field['output']['units'] : '';
209
  }
210
 
211
+ $styles = $this->setting_styles( $field, $styles, $element, $property, $units );
212
 
213
  } else { // Multiple styles set
214
 
215
+ foreach ( $field['output'] as $style ) {
216
 
217
  if ( ! array( $style ) ) {
218
  $element = $style;
222
  $units = isset( $style['units'] ) ? $style['units'] : '';
223
  }
224
 
225
+ $styles = $this->setting_styles( $field, $styles, $element, $property, $units );
226
 
227
  }
228
 
kirki.php CHANGED
@@ -4,8 +4,8 @@ Plugin Name: Kirki Framework
4
  Plugin URI: http://kirki.org
5
  Description: An options framework using and extending the WordPress Customizer
6
  Author: Aristeides Stathopoulos
7
- Author URI: http://press.codes
8
- Version: 0.8.2
9
  Text Domain: kirki
10
  */
11
 
@@ -16,6 +16,13 @@ if ( ! defined( 'KIRKI_URL' ) ) {
16
  define( 'KIRKI_URL', plugin_dir_url( __FILE__ ) );
17
  }
18
 
 
 
 
 
 
 
 
19
  // Include the main kirki class
20
  include_once( KIRKI_PATH . '/includes/Kirki.php' );
21
 
4
  Plugin URI: http://kirki.org
5
  Description: An options framework using and extending the WordPress Customizer
6
  Author: Aristeides Stathopoulos
7
+ Author URI: http://aristeides.com
8
+ Version: 0.8.3
9
  Text Domain: kirki
10
  */
11
 
16
  define( 'KIRKI_URL', plugin_dir_url( __FILE__ ) );
17
  }
18
 
19
+ // Include helper files
20
+ include_once( KIRKI_PATH . '/includes/Helpers/libraries/class-kirki-color.php' );
21
+ include_once( KIRKI_PATH . '/includes/Helpers/libraries/class-kirki-colourlovers.php' );
22
+ include_once( KIRKI_PATH . '/includes/Helpers/deprecated.php' );
23
+ include_once( KIRKI_PATH . '/includes/Helpers/sanitize.php' );
24
+ include_once( KIRKI_PATH . '/includes/Helpers/helpers.php' );
25
+
26
  // Include the main kirki class
27
  include_once( KIRKI_PATH . '/includes/Kirki.php' );
28
 
languages/kirki-en_US.mo CHANGED
Binary file
languages/kirki-en_US.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Kirki Framework\n"
4
- "POT-Creation-Date: 2015-03-30 22:16+0200\n"
5
- "PO-Revision-Date: 2015-03-30 22:17+0200\n"
6
  "Last-Translator: Stathopoulos Aristeides <info@aristeides.com>\n"
7
  "Language-Team: Stathopoulos Aristeides <info@aristeides.com>\n"
8
  "Language: en_US\n"
@@ -19,165 +19,167 @@ msgstr ""
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
21
 
22
- #: includes/Config.php:88
23
  msgid "Background Color"
24
  msgstr "Background Color"
25
 
26
- #: includes/Config.php:89
27
  msgid "Background Image"
28
  msgstr "Background Image"
29
 
30
- #: includes/Config.php:90
31
  msgid "No Repeat"
32
  msgstr "No Repeat"
33
 
34
- #: includes/Config.php:91
35
  msgid "Repeat All"
36
  msgstr "Repeat All"
37
 
38
- #: includes/Config.php:92
39
  msgid "Repeat Horizontally"
40
  msgstr "Repeat Horizontally"
41
 
42
- #: includes/Config.php:93
43
  msgid "Repeat Vertically"
44
  msgstr "Repeat Vertically"
45
 
46
- #: includes/Config.php:94
 
 
47
  msgid "Inherit"
48
  msgstr "Inherit"
49
 
50
- #: includes/Config.php:95
51
  msgid "Background Repeat"
52
  msgstr "Background Repeat"
53
 
54
- #: includes/Config.php:96
55
  msgid "Cover"
56
  msgstr "Cover"
57
 
58
- #: includes/Config.php:97
59
  msgid "Contain"
60
  msgstr "Contain"
61
 
62
- #: includes/Config.php:98
63
  msgid "Background Size"
64
  msgstr "Background Size"
65
 
66
- #: includes/Config.php:99
67
  msgid "Fixed"
68
  msgstr "Fixed"
69
 
70
- #: includes/Config.php:100
71
  msgid "Scroll"
72
  msgstr "Scroll"
73
 
74
- #: includes/Config.php:101
75
  msgid "Background Attachment"
76
  msgstr "Background Attachment"
77
 
78
- #: includes/Config.php:102
79
  msgid "Left Top"
80
  msgstr "Left Top"
81
 
82
- #: includes/Config.php:103
83
  msgid "Left Center"
84
  msgstr "Left Center"
85
 
86
- #: includes/Config.php:104
87
  msgid "Left Bottom"
88
  msgstr "Left Bottom"
89
 
90
- #: includes/Config.php:105
91
  msgid "Right Top"
92
  msgstr "Right Top"
93
 
94
- #: includes/Config.php:106
95
  msgid "Right Center"
96
  msgstr "Right Center"
97
 
98
- #: includes/Config.php:107
99
  msgid "Right Bottom"
100
  msgstr "Right Bottom"
101
 
102
- #: includes/Config.php:108
103
  msgid "Center Top"
104
  msgstr "Center Top"
105
 
106
- #: includes/Config.php:109
107
  msgid "Center Center"
108
  msgstr "Center Center"
109
 
110
- #: includes/Config.php:110
111
  msgid "Center Bottom"
112
  msgstr "Center Bottom"
113
 
114
- #: includes/Config.php:111
115
  msgid "Background Position"
116
  msgstr "Background Position"
117
 
118
- #: includes/Config.php:112
119
  msgid "Background Opacity"
120
  msgstr "Background Opacity"
121
 
122
- #: includes/Config.php:113
123
  msgid "ON"
124
  msgstr "ON"
125
 
126
- #: includes/Config.php:114
127
  msgid "OFF"
128
  msgstr "OFF"
129
 
130
- #: includes/Config.php:115
131
  msgid "All"
132
  msgstr "All"
133
 
134
- #: includes/Config.php:116
135
  msgid "Cyrillic"
136
  msgstr "Cyrillic"
137
 
138
- #: includes/Config.php:117
139
  msgid "Cyrillic Extended"
140
  msgstr "Cyrillic Extended"
141
 
142
- #: includes/Config.php:118
143
  msgid "Devanagari"
144
  msgstr "Devanagari"
145
 
146
- #: includes/Config.php:119
147
  msgid "Greek"
148
  msgstr "Greek"
149
 
150
- #: includes/Config.php:120
151
  msgid "Greek Extended"
152
  msgstr "Greek Extended"
153
 
154
- #: includes/Config.php:121
155
  msgid "Khmer"
156
  msgstr "Khmer"
157
 
158
- #: includes/Config.php:122
159
  msgid "Latin"
160
  msgstr "Latin"
161
 
162
- #: includes/Config.php:123
163
  msgid "Latin Extended"
164
  msgstr "Latin Extended"
165
 
166
- #: includes/Config.php:124
167
  msgid "Vietnamese"
168
  msgstr "Vietnamese"
169
 
170
- #: includes/Config.php:125
171
  msgctxt "font style"
172
  msgid "Serif"
173
  msgstr "Serif"
174
 
175
- #: includes/Config.php:126
176
  msgctxt "font style"
177
  msgid "Sans Serif"
178
  msgstr "Sans Serif"
179
 
180
- #: includes/Config.php:127
181
  msgctxt "font style"
182
- msgid "Monospace"
183
- msgstr "Monospace"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Kirki Framework\n"
4
+ "POT-Creation-Date: 2015-03-30 01:57+0200\n"
5
+ "PO-Revision-Date: 2015-03-30 01:57+0200\n"
6
  "Last-Translator: Stathopoulos Aristeides <info@aristeides.com>\n"
7
  "Language-Team: Stathopoulos Aristeides <info@aristeides.com>\n"
8
  "Language: en_US\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
21
 
22
+ #: includes/Control.php:179
23
  msgid "Background Color"
24
  msgstr "Background Color"
25
 
26
+ #: includes/Control.php:192
27
  msgid "Background Image"
28
  msgstr "Background Image"
29
 
30
+ #: includes/Control.php:206 includes/Helpers/sanitize.php:45
31
  msgid "No Repeat"
32
  msgstr "No Repeat"
33
 
34
+ #: includes/Control.php:207 includes/Helpers/sanitize.php:46
35
  msgid "Repeat All"
36
  msgstr "Repeat All"
37
 
38
+ #: includes/Control.php:208 includes/Helpers/sanitize.php:47
39
  msgid "Repeat Horizontally"
40
  msgstr "Repeat Horizontally"
41
 
42
+ #: includes/Control.php:209 includes/Helpers/sanitize.php:48
43
  msgid "Repeat Vertically"
44
  msgstr "Repeat Vertically"
45
 
46
+ #: includes/Control.php:210 includes/Control.php:227
47
+ #: includes/Control.php:247 includes/Helpers/sanitize.php:49
48
+ #: includes/Helpers/sanitize.php:63 includes/Helpers/sanitize.php:79
49
  msgid "Inherit"
50
  msgstr "Inherit"
51
 
52
+ #: includes/Control.php:213
53
  msgid "Background Repeat"
54
  msgstr "Background Repeat"
55
 
56
+ #: includes/Control.php:228 includes/Helpers/sanitize.php:64
57
  msgid "Cover"
58
  msgstr "Cover"
59
 
60
+ #: includes/Control.php:229 includes/Helpers/sanitize.php:65
61
  msgid "Contain"
62
  msgstr "Contain"
63
 
64
+ #: includes/Control.php:233
65
  msgid "Background Size"
66
  msgstr "Background Size"
67
 
68
+ #: includes/Control.php:248 includes/Helpers/sanitize.php:80
69
  msgid "Fixed"
70
  msgstr "Fixed"
71
 
72
+ #: includes/Control.php:249 includes/Helpers/sanitize.php:81
73
  msgid "Scroll"
74
  msgstr "Scroll"
75
 
76
+ #: includes/Control.php:253
77
  msgid "Background Attachment"
78
  msgstr "Background Attachment"
79
 
80
+ #: includes/Control.php:267 includes/Helpers/sanitize.php:95
81
  msgid "Left Top"
82
  msgstr "Left Top"
83
 
84
+ #: includes/Control.php:268 includes/Helpers/sanitize.php:96
85
  msgid "Left Center"
86
  msgstr "Left Center"
87
 
88
+ #: includes/Control.php:269 includes/Helpers/sanitize.php:97
89
  msgid "Left Bottom"
90
  msgstr "Left Bottom"
91
 
92
+ #: includes/Control.php:270 includes/Helpers/sanitize.php:98
93
  msgid "Right Top"
94
  msgstr "Right Top"
95
 
96
+ #: includes/Control.php:271 includes/Helpers/sanitize.php:99
97
  msgid "Right Center"
98
  msgstr "Right Center"
99
 
100
+ #: includes/Control.php:272 includes/Helpers/sanitize.php:100
101
  msgid "Right Bottom"
102
  msgstr "Right Bottom"
103
 
104
+ #: includes/Control.php:273 includes/Helpers/sanitize.php:101
105
  msgid "Center Top"
106
  msgstr "Center Top"
107
 
108
+ #: includes/Control.php:274 includes/Helpers/sanitize.php:102
109
  msgid "Center Center"
110
  msgstr "Center Center"
111
 
112
+ #: includes/Control.php:275 includes/Helpers/sanitize.php:103
113
  msgid "Center Bottom"
114
  msgstr "Center Bottom"
115
 
116
+ #: includes/Control.php:278
117
  msgid "Background Position"
118
  msgstr "Background Position"
119
 
120
+ #: includes/Control.php:296
121
  msgid "Background Opacity"
122
  msgstr "Background Opacity"
123
 
124
+ #: includes/Controls/SwitchControl.php:26
125
  msgid "ON"
126
  msgstr "ON"
127
 
128
+ #: includes/Controls/SwitchControl.php:27
129
  msgid "OFF"
130
  msgstr "OFF"
131
 
132
+ #: includes/Fonts/FontRegistry.php:125
133
  msgid "All"
134
  msgstr "All"
135
 
136
+ #: includes/Fonts/FontRegistry.php:126
137
  msgid "Cyrillic"
138
  msgstr "Cyrillic"
139
 
140
+ #: includes/Fonts/FontRegistry.php:127
141
  msgid "Cyrillic Extended"
142
  msgstr "Cyrillic Extended"
143
 
144
+ #: includes/Fonts/FontRegistry.php:128
145
  msgid "Devanagari"
146
  msgstr "Devanagari"
147
 
148
+ #: includes/Fonts/FontRegistry.php:129
149
  msgid "Greek"
150
  msgstr "Greek"
151
 
152
+ #: includes/Fonts/FontRegistry.php:130
153
  msgid "Greek Extended"
154
  msgstr "Greek Extended"
155
 
156
+ #: includes/Fonts/FontRegistry.php:131
157
  msgid "Khmer"
158
  msgstr "Khmer"
159
 
160
+ #: includes/Fonts/FontRegistry.php:132
161
  msgid "Latin"
162
  msgstr "Latin"
163
 
164
+ #: includes/Fonts/FontRegistry.php:133
165
  msgid "Latin Extended"
166
  msgstr "Latin Extended"
167
 
168
+ #: includes/Fonts/FontRegistry.php:134
169
  msgid "Vietnamese"
170
  msgstr "Vietnamese"
171
 
172
+ #: includes/Fonts/FontRegistry.php:187
173
  msgctxt "font style"
174
  msgid "Serif"
175
  msgstr "Serif"
176
 
177
+ #: includes/Fonts/FontRegistry.php:191
178
  msgctxt "font style"
179
  msgid "Sans Serif"
180
  msgstr "Sans Serif"
181
 
182
+ #: includes/Fonts/FontRegistry.php:195
183
  msgctxt "font style"
184
+ msgid "Monospaced"
185
+ msgstr "Monospaced"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: aristath, fovoc
3
  Tags: customizer, options famework, theme mods
4
  Donate link: http://kirki.org/
5
  Requires at least: 4.0
6
- Tested up to: 4.1.1
7
- Stable tag: 0.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,6 +27,7 @@ The following controls are included:
27
  * Radio
28
  * Checkbox
29
  * Color
 
30
  * Dropdown Pages
31
  * Image
32
  * Background
@@ -47,27 +48,57 @@ For documentation and examples on how to use these controls, please visit [kirki
47
 
48
 
49
  == Installation ==
50
- From your dashboarad go to Plugins => Add New.
51
- Search for \"Kirki\" and install it.
52
- Once you isntall it, activate it.
 
 
53
  For configuration instructions please visit http://kirki.org/#configuration
54
 
 
 
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  = 0.8.2 =
59
 
 
 
60
  * Fix: Autoloader could not properly include files due to strtolower()
61
 
62
  = 0.8.1 =
63
 
64
- March 30, 2014, dev time: 30 minutes
65
 
66
  * Fix: Translation strings now overridable using the config filter.
67
 
68
  = 0.8.0 =
69
 
70
- March 30, 2014, dev time: 32 hours
71
 
72
  * Improvement: OOP redesign (props @vpratfr)
73
  * New: Added Palette control
@@ -88,7 +119,7 @@ March 30, 2014, dev time: 32 hours
88
 
89
  = 0.7.1 =
90
 
91
- March 15, 2014, dev time: 2 hours
92
 
93
  * Removed: Remove the `kirki_get_option` function that was introduced in 0.7 as it's not working properly yet.
94
  * Fix: Undefined index notice when a default value for the control was not defined
@@ -97,7 +128,7 @@ March 15, 2014, dev time: 2 hours
97
 
98
  = 0.7 =
99
 
100
- March 14, 2014, dev time: 10 hours
101
 
102
  * Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
103
  * Fix: Background opacity affects background-position of bg image
@@ -119,7 +150,7 @@ March 14, 2014, dev time: 10 hours
119
 
120
  = 0.6.2 =
121
 
122
- March 2, 2014, dev time: 3 hours
123
 
124
  * Fix: Frontend styles were not properly enqueued (props @dmgawel)
125
  * New: Allow multiple output styles per control defined as an array of arrays.
@@ -130,14 +161,14 @@ March 2, 2014, dev time: 3 hours
130
 
131
  = 0.6.1 =
132
 
133
- 2014-02-25, dev time: 1 hours
134
 
135
  * Fix: Sortables controls had a JS conflict
136
  * Fix: Switches & Toggles were not properly working
137
 
138
  = 0.6.0 =
139
 
140
- 2014-02-25, dev time: 9 hours
141
 
142
  * Fix: Tooltips now properly working
143
  * New: Added checkbox switches
3
  Tags: customizer, options famework, theme mods
4
  Donate link: http://kirki.org/
5
  Requires at least: 4.0
6
+ Tested up to: 4.2
7
+ Stable tag: 0.8.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  * Radio
28
  * Checkbox
29
  * Color
30
+ * Color-Alpha
31
  * Dropdown Pages
32
  * Image
33
  * Background
48
 
49
 
50
  == Installation ==
51
+
52
+ **Method 1: Use as a plugin**
53
+ From your dashboard go to Plugins => Add New.
54
+ Search for "Kirki" and install it.
55
+ Once you install it, activate it.
56
  For configuration instructions please visit http://kirki.org/#configuration
57
 
58
+ **Method 2: Embed in your theme**
59
+ Please visit http://kirki.org for documentation and instructions.
60
 
61
  == Changelog ==
62
 
63
+ = 0.8.3 =
64
+
65
+ April 5, 2014, dev time: 28 hours
66
+
67
+ * New: Introduce a Field class
68
+ * New: Introduce a Builder class
69
+ * Tweak: Code Cleanups
70
+ * New: Added ability to use 'option' as the setting type
71
+ * Fix : Bugs in the color calculation class
72
+ * Tweak: Everything gets sanitized in the "Field" class
73
+ * Fix: Bugs in sortable field
74
+ * Fix: Editor control had no description
75
+ * New: Added a color-alpha control. To use it just set an rgba color as the default value.
76
+ * Tweak: SCSS & CSS improvements
77
+ * Fix: Various PHP notices and warnings when no fields are defined
78
+ * Tweak: More efficient color sanitization method
79
+ * Tweak: Improved number control presentation
80
+ * Tweak: Improved the way background fields are handled
81
+ * Tweak: Checkboxes styling
82
+ * New: Allow using rgba values for background colors
83
+ * Fix: CSS fix - :focus color for active section
84
+ * New: Add a static 'prepare' method to the ScriptRegistry class
85
+ * Fix: Issues with the URL when Kirki is embedded in a theme
86
+
87
  = 0.8.2 =
88
 
89
+ March 30, 2015, dev time: 5 minutes
90
+
91
  * Fix: Autoloader could not properly include files due to strtolower()
92
 
93
  = 0.8.1 =
94
 
95
+ March 30, 2015, dev time: 30 minutes
96
 
97
  * Fix: Translation strings now overridable using the config filter.
98
 
99
  = 0.8.0 =
100
 
101
+ March 30, 2015, dev time: 32 hours
102
 
103
  * Improvement: OOP redesign (props @vpratfr)
104
  * New: Added Palette control
119
 
120
  = 0.7.1 =
121
 
122
+ March 15, 2015, dev time: 2 hours
123
 
124
  * Removed: Remove the `kirki_get_option` function that was introduced in 0.7 as it's not working properly yet.
125
  * Fix: Undefined index notice when a default value for the control was not defined
128
 
129
  = 0.7 =
130
 
131
+ March 14, 2015, dev time: 10 hours
132
 
133
  * Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
134
  * Fix: Background opacity affects background-position of bg image
150
 
151
  = 0.6.2 =
152
 
153
+ March 2, 2015, dev time: 3 hours
154
 
155
  * Fix: Frontend styles were not properly enqueued (props @dmgawel)
156
  * New: Allow multiple output styles per control defined as an array of arrays.
161
 
162
  = 0.6.1 =
163
 
164
+ 2015-02-25, dev time: 1 hours
165
 
166
  * Fix: Sortables controls had a JS conflict
167
  * Fix: Switches & Toggles were not properly working
168
 
169
  = 0.6.0 =
170
 
171
+ 2015-02-25, dev time: 9 hours
172
 
173
  * Fix: Tooltips now properly working
174
  * New: Added checkbox switches