OptionTree - Version 1.0

Version Description

Download this release

Release Info

Developer valendesigns
Plugin Icon wp plugin OptionTree
Version 1.0
Comparing to
See all releases

Code changes from version 2.1.1 to 1.0

Files changed (91) hide show
  1. assets/css/ot-admin.css +0 -1376
  2. assets/css/style-classic.css +58 -0
  3. assets/css/style.css +948 -0
  4. assets/images/black_px.png +0 -0
  5. assets/images/btn.png +0 -0
  6. assets/images/colorpicker/color_bg.png +0 -0
  7. assets/images/empty.gif +0 -0
  8. assets/images/header.png +0 -0
  9. assets/images/header_classic.png +0 -0
  10. assets/images/icon_add.png +0 -0
  11. assets/images/icon_arrow.png +0 -0
  12. assets/images/icon_classic.png +0 -0
  13. assets/images/icon_dark.png +0 -0
  14. assets/images/icon_delete.png +0 -0
  15. assets/images/icon_edit.png +0 -0
  16. assets/images/icon_error.png +0 -0
  17. assets/images/icon_header.png +0 -0
  18. assets/images/icon_option.png +0 -0
  19. assets/images/icon_option_classic.png +0 -0
  20. assets/images/icon_up_down.png +0 -0
  21. assets/images/layout/dual-sidebar.png +0 -0
  22. assets/images/layout/full-width.png +0 -0
  23. assets/images/layout/left-dual-sidebar.png +0 -0
  24. assets/images/layout/left-sidebar.png +0 -0
  25. assets/images/layout/right-dual-sidebar.png +0 -0
  26. assets/images/layout/right-sidebar.png +0 -0
  27. assets/images/logo_classic.png +0 -0
  28. assets/images/logo_dark.png +0 -0
  29. assets/images/ot-dots.png +0 -0
  30. assets/images/ot-logo-mini.png +0 -0
  31. assets/images/ot-logo.png +0 -0
  32. assets/images/ot-menu-bg.png +0 -0
  33. assets/images/ot-menu-top-bg.png +0 -0
  34. assets/images/ot-select-hover.png +0 -0
  35. assets/images/ot-select.png +0 -0
  36. assets/images/ot-sub-header-bg.png +0 -0
  37. assets/images/ot-ui-light-sprite.png +0 -0
  38. assets/images/ot-ui-sprite.png +0 -0
  39. assets/images/{ot-pre-bg.gif → pre_bg.gif} +0 -0
  40. assets/images/pre_classic_bg.gif +0 -0
  41. assets/images/select.png +0 -0
  42. assets/images/tabs_bg.png +0 -0
  43. assets/images/tabs_bg_classic.png +0 -0
  44. assets/images/toggle_tabs.png +0 -0
  45. assets/images/white_px.png +0 -0
  46. assets/js/{ot-colorpicker.js → jquery.color.picker.js} +4 -2
  47. assets/js/jquery.option.tree.js +752 -0
  48. assets/js/jquery.table.dnd.js +382 -0
  49. assets/js/ot-admin.js +0 -538
  50. assets/test/test-data.txt +1 -0
  51. assets/test/test-options.xml +175 -0
  52. assets/theme-mode/demo-meta-boxes.php +0 -63
  53. assets/theme-mode/demo-theme-options.php +0 -476
  54. classes/class.admin.php +1113 -0
  55. front-end/docs.php +324 -0
  56. front-end/options.php +90 -0
  57. front-end/settings.php +264 -0
  58. functions/admin/category.php +112 -0
  59. functions/admin/checkbox.php +56 -0
  60. functions/admin/colorpicker.php +54 -0
  61. functions/admin/custom-post.php +112 -0
  62. functions/admin/export.php +70 -0
  63. functions/admin/heading.php +20 -0
  64. functions/admin/input.php +29 -0
  65. functions/admin/page.php +112 -0
  66. functions/admin/post.php +112 -0
  67. functions/admin/radio.php +56 -0
  68. functions/admin/select.php +45 -0
  69. functions/admin/tag.php +112 -0
  70. functions/admin/textarea.php +34 -0
  71. functions/admin/textblock.php +26 -0
  72. functions/admin/upload.php +50 -0
  73. functions/functions.load.php +31 -0
  74. functions/get-option-tree.php +46 -0
  75. includes/ot-functions-admin.php +0 -4135
  76. includes/ot-functions-compat.php +0 -364
  77. includes/ot-functions-deprecated.php +0 -99
  78. includes/ot-functions-docs-page.php +0 -976
  79. includes/ot-functions-option-types.php +0 -1886
  80. includes/ot-functions-settings-page.php +0 -570
  81. includes/ot-functions.php +0 -196
  82. includes/ot-meta-box-api.php +0 -286
  83. includes/ot-settings-api.php +0 -912
  84. index.php +63 -0
  85. languages/option-tree.pot +0 -1753
  86. license.txt +0 -674
  87. ot-loader.php +0 -520
  88. readme.txt +14 -272
  89. screenshot-1.png +0 -0
  90. screenshot-2.png +0 -0
  91. screenshot-3.png +0 -0
assets/css/ot-admin.css DELETED
@@ -1,1376 +0,0 @@
1
- /* --------------------------------------------------
2
- :: Screen Meta & Menu Icon
3
- ---------------------------------------------------*/
4
- .appearance_page_ot-theme-options #screen-meta {
5
- margin-right: 20px;
6
- margin-left: 2px;
7
- min-width: 533px;
8
- }
9
-
10
- /* --------------------------------------------------
11
- :: Messages
12
- ---------------------------------------------------*/
13
- .wrap.settings-wrap div.error,
14
- .wrap.settings-wrap div.updated {
15
- margin: 9px 5px 0px 2px !important;
16
- }
17
-
18
- /* --------------------------------------------------
19
- :: OptionTree Wrappers
20
- ---------------------------------------------------*/
21
- #option-tree-settings-api .metabox-holder {
22
- overflow: hidden;
23
- }
24
- #option-tree-settings-api .postbox {
25
- background: #fff;
26
- border: none;
27
- margin: 0 20px;
28
- }
29
- #option-tree-settings-api .inside {
30
- margin: 0px !important;
31
- padding: 0px !important;
32
- }
33
- #option-tree-settings-api .ui-tabs {
34
- background: #fff url(../images/ot-menu-bg.png) repeat-y 0 0;
35
- border: 1px solid #ccc;
36
- border-top: none;
37
- margin: 0px 5px 0 2px;
38
- min-width: 533px;
39
- padding-bottom: 5px;
40
- position: relative;
41
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
42
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
43
- -webkit-border-radius: 0 0 4px 4px;
44
- -khtml-border-radius: 0 0 4px 4px;
45
- -moz-border-radius: 0 0 4px 4px;
46
- -o-border-radius: 0 0 4px 4px;
47
- border-radius: 0 0 4px 4px;
48
- }
49
-
50
- /* --------------------------------------------------
51
- :: Header
52
- ---------------------------------------------------*/
53
- #option-tree-header-wrap {
54
- position: relative;
55
- }
56
- #option-tree-header {
57
- background: #464646;
58
- color: #ccc;
59
- display: block;
60
- margin: 11px 5px 0 2px;
61
- min-width: 535px;
62
- overflow: hidden;
63
- position: relative;
64
- background-image: -webkit-linear-gradient(bottom, #373737, #464646 5px);
65
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
66
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
67
- -webkit-border-radius: 4px 4px 0 0;
68
- -khtml-border-radius: 4px 4px 0 0;
69
- -moz-border-radius: 4px 4px 0 0;
70
- -o-border-radius: 4px 4px 0 0;
71
- border-radius: 4px 4px 0 0;
72
- }
73
- #option-tree-header li {
74
- display: block;
75
- float: left;
76
- margin: 0px;
77
- padding: 0px;
78
- }
79
- #option-tree-header li a {
80
- color: #ccc;
81
- text-decoration: none;
82
- }
83
- #option-tree-header li a:hover {
84
- color: #fafafa;
85
- }
86
- #option-tree-header #option-tree-logo a {
87
- background: transparent url(../images/ot-logo.png) no-repeat 13px center;
88
- border-right: 1px solid #333;
89
- display: block;
90
- float: left;
91
- height: 24px;
92
- line-height: 24px;
93
- padding: 3px 12px 3px 13px;
94
- text-indent: -9999px;
95
- width: 24px;
96
- }
97
- #option-tree-header li#option-tree-logo:hover {
98
- color: #fafafa;
99
- background-color: #3a3a3a;
100
- background-image: -ms-linear-gradient(bottom,#3a3a3a,#222);
101
- background-image: -moz-linear-gradient(bottom,#3a3a3a,#222);
102
- background-image: -o-linear-gradient(bottom,#3a3a3a,#222);
103
- background-image: -webkit-gradient(linear,left bottom,left top,from(#3a3a3a),to(#222));
104
- background-image: -webkit-linear-gradient(bottom,#3a3a3a,#222);
105
- background-image: linear-gradient(bottom,#3a3a3a,#222);
106
- -webkit-border-top-left-radius: 5px;
107
- -moz-border-radius-topleft: 5px;
108
- border-top-left-radius: 5px;
109
- }
110
- #option-tree-header #option-tree-version {
111
-
112
- }
113
- #option-tree-header #option-tree-version span {
114
- border-left: 1px solid #555;
115
- display: block;
116
- float: left;
117
- height: 24px;
118
- line-height: 24px;
119
- padding: 3px 12px 3px 12px;
120
- }
121
-
122
- /* --------------------------------------------------
123
- :: Sub Header
124
- ---------------------------------------------------*/
125
- #option-tree-sub-header {
126
- background: #fafafa url(../images/ot-sub-header-bg.png) repeat-x 0 0;
127
- border: 1px solid #ccc;
128
- border-top: none;
129
- display: block;
130
- margin: 0 5px 0 2px;
131
- min-width: 523px;
132
- overflow: hidden;
133
- padding: 5px;
134
- position: relative;
135
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
136
- box-shadow:0 1px 3px rgba(0,0,0,0.05);
137
- }
138
-
139
- /* --------------------------------------------------
140
- :: Tabs
141
- ---------------------------------------------------*/
142
- .wrap.settings-wrap .ui-tabs-nav {
143
- background: url(../images/ot-menu-top-bg.png) no-repeat right top;
144
- float: left;
145
- list-style: none;
146
- margin: 0 0 0 -4px;
147
- padding: 1em 0;
148
- width: 151px;
149
- }
150
- .wrap.settings-wrap .ui-tabs-nav li {
151
- border: 1px solid transparent;
152
- border-right-width: 0px;
153
- display: block; margin: 0;
154
- -webkit-border-radius: 3px 0 0 3px;
155
- -khtml-border-radius: 3px 0 0 3px;
156
- -moz-border-radius: 3px 0 0 3px;
157
- -o-border-radius: 3px 0 0 3px;
158
- border-radius: 3px 0 0 3px;
159
- }
160
- .wrap.settings-wrap .ui-tabs-nav li.ui-state-active {
161
- background: #fff;
162
- border-color: #ccc;
163
- color: #000;
164
- }
165
- .wrap.settings-wrap .ui-tabs-nav li a {
166
- color: #21759b;
167
- display: block;
168
- line-height: 18px;
169
- padding: 5px 5px 5px 12px;
170
- text-decoration: none;
171
- }
172
- .wrap.settings-wrap .ui-tabs-nav li a:hover,
173
- .wrap.settings-wrap .ui-tabs-nav li.ui-state-active a {
174
- color: #000;
175
- outline: none;
176
- }
177
- .wrap.settings-wrap .ui-tabs-panel {
178
- clear: both;
179
- }
180
- /* --------------------------------------------------
181
- :: Format Settings
182
- ---------------------------------------------------*/
183
- .format-settings {
184
- padding: 10px 0 20px 0;
185
- position: relative;
186
- width: 100%;
187
- }
188
-
189
- /* --------------------------------------------------
190
- :: Format Setting Label
191
- ---------------------------------------------------*/
192
- .format-setting-label {
193
- border-bottom: 1px dashed #ddd;
194
- margin: 0 0 14px 0;
195
- padding: 5px 0px 1px 0px;
196
- width: 100%;
197
- }
198
- #option-tree-settings-api .description h3,
199
- #option-tree-settings-api .format-setting-label .label,
200
- .metabox-holder .format-setting-label .label {
201
- background: none;
202
- border: none;
203
- color: #333;
204
- cursor: text;
205
- display: block;
206
- font-family: sans-serif !important;
207
- font-size: 1.2em !important;
208
- font-weight: bold !important;
209
- letter-spacing: 0;
210
- padding: 0 0 9px 0 !important;
211
- -webkit-user-select: text;
212
- text-shadow: none;
213
- }
214
-
215
- /* --------------------------------------------------
216
- :: Format Setting
217
- ---------------------------------------------------*/
218
- .format-setting {
219
- overflow: hidden;
220
- position: relative;
221
- width: 100%;
222
- }
223
- .format-setting .format-setting-inner {
224
- float: left;
225
- position: relative;
226
- width: 63%;
227
- }
228
- .format-setting.no-desc .format-setting-inner,
229
- .format-setting.wide-desc .format-setting-inner,
230
- .option-tree-list-item .format-setting-inner {
231
- width: 100%;
232
- }
233
- .format-setting .description {
234
- float: right;
235
- padding: 5px 0;
236
- width: 35%;
237
- }
238
- .format-setting.no-desc .description,
239
- .format-setting.wide-desc .description,
240
- .option-tree-list-item .description {
241
- float: none;
242
- width: 100%;
243
- }
244
- .list-item-description {
245
- padding-top: 10px;
246
- }
247
- #option-tree-settings-api h4 {
248
- color: #333;
249
- font-size: 1.12em;
250
- font-weight: bold;
251
- margin: 1em 0 0.5em 0;
252
- padding: 0;
253
- }
254
- #option-tree-settings-api h5 {
255
- color: #444;
256
- font-size: 1em;
257
- font-weight: bold;
258
- margin: 1em 0 0.5em 0;
259
- padding: 0;
260
- }
261
- #option-tree-settings-api p {
262
- margin: 0 0 1.5em 0 !important;
263
- }
264
- #post .format-setting-inner p {
265
- float: left;
266
- width: 100%;
267
- margin: 0 0 1.05em 0 !important;
268
- }
269
- .aside {
270
- border-bottom: 1px solid #eee;
271
- padding-bottom: 15px;
272
- margin-bottom: 15px;
273
- }
274
- .deprecated {
275
- border-bottom: 1px solid #eee;
276
- color: #b94029;
277
- padding-bottom: 15px;
278
- margin-bottom: 15px;
279
- }
280
- .warning {
281
- color: #b94029;
282
- }
283
- .docs-ul {
284
- line-height: 1.3em;
285
- margin: 0;
286
- padding: 0 0 1em 0;
287
- }
288
- .docs-ul li {
289
- list-style-type: square;
290
- margin-left: 20px;
291
- }
292
- #contextual-help-setting {
293
- float: left;
294
- padding: 10px 0 5px 0;
295
- width: 100%;
296
- }
297
- #contextual-help-label {
298
- float: left;
299
- padding-top: 20px;
300
- width: 100%;
301
- }
302
- #option_tree_settings_help {
303
- float: left;
304
- width: 100%;
305
- }
306
- #option-tree-settings-api blockquote {
307
- font-style: italic;
308
- padding-left: 15px;
309
- position: relative;
310
- }
311
- #option-tree-settings-api blockquote:before {
312
- color: #ccc;
313
- content: "\201C";
314
- display: block;
315
- font-size: 400%;
316
- font-style: normal;
317
- left: -10px;
318
- position: absolute;
319
- top: 10px;
320
- }
321
-
322
- @media only screen and (max-width: 900px) {
323
-
324
- .format-setting .description,
325
- .format-setting .format-setting-inner {
326
- width: 100%;
327
- }
328
-
329
- .format-setting .description {
330
- padding-top: 0px;
331
- };
332
- }
333
-
334
- /* --------------------------------------------------
335
- :: Code formatting
336
- ---------------------------------------------------*/
337
- #option-tree-settings-api code {
338
- background-color: #f1f1f1;
339
- color: #000;
340
- }
341
- #option-tree-settings-api pre {
342
- font-size: 13px;
343
- padding: 0;
344
- margin: 1.5em 0;
345
- line-height: 18px;
346
- overflow: auto;
347
- overflow-Y: hidden;
348
- padding-top: 18px;
349
- background: #f1f1f1;
350
- border-bottom: 1px solid #f1f1f1;
351
- margin-bottom: 20px;
352
- color: #000;
353
- white-space: pre-wrap;
354
- word-wrap: break-word;
355
- }
356
- #option-tree-settings-api pre code {
357
- padding: 0 18px 18px 18px;
358
- display: block;
359
- background: url(../images/ot-pre-bg.gif) repeat left top;
360
- }
361
-
362
- /* --------------------------------------------------
363
- :: Input & Upload
364
- ---------------------------------------------------*/
365
- input.option-tree-ui-upload-input,
366
- input.option-tree-ui-input {
367
- background: #fff;
368
- border: 1px solid #ccc !important;
369
- line-height: 17px;
370
- font-size: 12px;
371
- margin-bottom: 5px;
372
- padding: 7px 6px;
373
- position: relative;
374
- width: 100%;
375
- border-radius: 2px;
376
- -webkit-border-radius: 2px;
377
- -moz-border-radius: 2px;
378
- -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
379
- -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
380
- box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
381
- }
382
- input:focus.option-tree-ui-upload-input,
383
- input:focus.option-tree-ui-input {
384
- border-color: #bbb !important;
385
- }
386
-
387
- @media screen and (-webkit-min-device-pixel-ratio:0) {
388
-
389
- .option-tree-ui-input,
390
- .option-tree-ui-upload-input {
391
- padding: 5px 6px !important;
392
- };
393
- }
394
-
395
- /* --------------------------------------------------
396
- :: Upload
397
- ---------------------------------------------------*/
398
- div.option-tree-ui-media-wrap {
399
- margin: 5px 63px 0 0;
400
- min-height: 35px;
401
- position: relative;
402
- }
403
- .option-tree-ui-media-wrap img {
404
- background: #fafafa;
405
- border: 1px solid #ccc;
406
- padding: 4px;
407
- border-radius: 2px;
408
- -webkit-border-radius: 2px;
409
- -moz-border-radius: 2px;
410
- display: block;
411
- float: left;
412
- max-width: 100%;
413
- height: auto;
414
- -ms-interpolation-mode: bicubic;
415
- }
416
- .option-tree-ui-upload-parent {
417
- width: auto !important;
418
- margin-right: 53px;
419
- padding: 0px;
420
- position: relative;
421
- }
422
- .format-setting .ot_upload_media {
423
- top: 0px;
424
- margin: 0px !important;
425
- position: absolute;
426
- right: -53px;
427
- }
428
- .option-tree-ui-media-wrap a.option-tree-ui-remove-media {
429
- float: none !important;
430
- margin: 0px !important;
431
- position: absolute !important;
432
- right: -63px;
433
- top: 1px;
434
- }
435
-
436
- /* --------------------------------------------------
437
- :: Textarea
438
- ---------------------------------------------------*/
439
- .fill-area .description,
440
- .fill-area .format-setting-inner {
441
- width: 100% !important;
442
- }
443
-
444
- .wp-editor-area {
445
- display: block;
446
- }
447
- .textarea,
448
- .ot-metabox-wrapper textarea {
449
- width: 99.9%;
450
- border: 1px solid #ccc;
451
- font-family: Consolas, Monaco, monospace;
452
- line-height: 150%;
453
- outline: 0;
454
- padding: 10px;
455
- resize: vertical;
456
- }
457
- #contextual-help-setting .textarea {
458
- width: 99.75%;
459
- }
460
- .ot-metabox-wrapper .wp-editor-container {
461
- border: none;
462
- }
463
- .ot-metabox-wrapper textarea:focus {
464
- border-color: #bbb !important;
465
- }
466
-
467
- @media only screen and (max-width: 1105px) {
468
- .type-textarea .description, .type-textarea .format-setting-inner {
469
- width: 100%;
470
- };
471
- }
472
-
473
- /* --------------------------------------------------
474
- :: Setting Item with Drag & Drop
475
- ---------------------------------------------------*/
476
- .option-tree-setting-wrap { margin-top: 0px; }
477
- .option-tree-setting-wrap li { margin: 4px 0px; }
478
- .option-tree-setting {
479
- border: 1px solid #ccc;
480
- overflow: hidden;
481
- position: relative;
482
- -webkit-border-radius: 4px;
483
- -khtml-border-radius: 4px;
484
- -moz-border-radius: 4px;
485
- -o-border-radius: 4px;
486
- border-radius: 4px;
487
- }
488
- .option-tree-setting a {
489
- text-decoration: none;
490
- }
491
- .option-tree-setting .open {
492
- background: #fafafa;
493
- cursor: move;
494
- line-height: 21px;
495
- height: 21px;
496
- padding: 10px 100px 10px 10px;
497
- display: block;
498
- }
499
- .ui-state-disabled .option-tree-setting .open {
500
- cursor: default;
501
- }
502
- .option-tree-setting .open:hover {
503
- background: #fafafa url(../images/ot-dots.png) no-repeat 4px 15px;
504
- }
505
- .button-section {
506
- position: absolute;
507
- right: 0px;
508
- top: 1px;
509
- }
510
- .option-tree-setting.is-section {
511
- border: 1px solid #464646;
512
- }
513
- .option-tree-setting.is-section .open {
514
- background: #464646;
515
- color: #ccc;
516
- }
517
- .option-tree-setting.is-section .option-tree-ui-button {
518
- border-color: #151515 !important;
519
- }
520
- .format-setting .ui-sortable-helper .option-tree-setting .open {
521
- background: #fff url(../images/ot-dots.png) no-repeat 4px 15px;
522
- }
523
- .option-tree-setting.is-section .open:hover,
524
- .format-setting .ui-sortable-helper .option-tree-setting.is-section .open {
525
- background: #464646 url(../images/ot-dots.png) no-repeat 4px 15px;
526
- }
527
- .ui-state-highlight {
528
- border: 1px dashed #ccc;
529
- display: block;
530
- -webkit-border-radius: 4px;
531
- -moz-border-radius: 4px;
532
- border-radius: 4px;
533
- }
534
- .option-tree-setting-body {
535
- background: #fff;
536
- border-top: 1px solid #ccc;
537
- display: none;
538
- padding: 10px;
539
- -webkit-border-bottom-right-radius: 3px;
540
- -webkit-border-bottom-left-radius: 3px;
541
- -moz-border-radius-bottomright: 3px;
542
- -moz-border-radius-bottomleft: 3px;
543
- border-bottom-right-radius: 3px;
544
- border-bottom-left-radius: 3px;
545
- }
546
- li ul .format-settings {
547
- padding: 0 0 10px 0;
548
- }
549
- li ul .format-setting-label {
550
- border: none;
551
- padding: 0px;
552
- margin: 0px;
553
- }
554
-
555
- /* --------------------------------------------------
556
- :: Layouts
557
- ---------------------------------------------------*/
558
- #option_tree_layouts {
559
- display: none;
560
- padding-top: 12px;
561
- }
562
- #option-tree-options-layouts-form {
563
- left: 13px;
564
- position: absolute;
565
- top: 30px;
566
- z-index: 100;
567
- }
568
- .option-tree-save-layout {
569
- float: left;
570
- padding: 10px 0;
571
- }
572
- .option-tree-save-layout.active-layout {
573
- border-left: 1px solid #fff;
574
- padding-left: 9px;
575
- }
576
- .option-tree-save-layout .widefat {
577
- float: left;
578
- width: 128px !important;
579
- margin: 0;
580
- }
581
- .option-tree-save-layout button.blue {
582
- margin: 0 0 0 10px;
583
- }
584
- .option-tree-active-layout {
585
- border-right: 1px solid #ccc;
586
- float: left;
587
- padding: 10px 10px 10px 0;
588
- min-width: 126px;
589
- }
590
-
591
- /* --------------------------------------------------
592
- :: Select
593
- ---------------------------------------------------*/
594
- .select-group {
595
- margin-right: 53px;
596
- overflow: hidden;
597
- width: auto;
598
- }
599
- .select-wrapper {
600
- background: #fff url(../images/ot-select.png) no-repeat right center;
601
- border: 1px solid #ccc;
602
- display: block;
603
- float: left;
604
- font-size: 12px;
605
- height: 27px;
606
- margin: 0 5px 5px 0;
607
- width: auto;
608
- border-radius: 2px;
609
- -webkit-border-radius: 2px;
610
- -moz-border-radius: 2px;
611
- -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
612
- -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
613
- box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
614
- }
615
- .select-wrapper:hover {
616
- background-image: url(../images/ot-select-hover.png);
617
- border-color: #bbb;
618
- }
619
- select.option-tree-ui-select {
620
- cursor: pointer;
621
- filter: alpha(opacity: 0);
622
- font-size: 14px;
623
- height: 29px;
624
- margin: 0;
625
- -moz-opacity: 0;
626
- opacity: 0;
627
- padding: 0 !important;
628
- position: relative;
629
- width: inherit;
630
- z-index: 4;
631
- min-width: 118px;
632
- }
633
-
634
- select.option-tree-ui-select option {
635
- padding: 3px 15px !important;
636
- }
637
- .select-wrapper span {
638
- height: 27px;
639
- line-height: 27px;
640
- padding-left: 7px;
641
- position: absolute;
642
- z-index: 2;
643
- }
644
- #option-tree-options-layouts-form .select-wrapper {
645
- margin: 0px;
646
- }
647
- #option-tree-options-layouts-form select.option-tree-ui-select {
648
- min-width: 124px;
649
- }
650
- .type-measurement select.option-tree-ui-select {
651
- min-width: 68px !important;
652
- }
653
- .type-measurement .select-wrapper {
654
- position: absolute;
655
- right: 0px;
656
- top: 0px;
657
- }
658
-
659
- /* FireFox */
660
- @-moz-document url-prefix() {
661
- #option-tree-options-layouts-form .select-wrapper {
662
- left: 250px;
663
- };
664
- }
665
-
666
- /* Webkit */
667
- @media screen and (-webkit-min-device-pixel-ratio:0) {
668
-
669
- .select-wrapper span {
670
- height: 26px;
671
- line-height: 26px;
672
- };
673
- }
674
-
675
- /* Opera 11 */
676
- @media not screen and (1) {
677
- .select-wrapper {
678
- height: 26px;
679
- };
680
- }
681
-
682
- /* --------------------------------------------------
683
- :: Measurement
684
- ---------------------------------------------------*/
685
- .option-tree-ui-measurement-input-wrap {
686
- margin-right: 80px;
687
- }
688
-
689
- /* --------------------------------------------------
690
- :: Checkbox & Radio
691
- ---------------------------------------------------*/
692
- .format-setting.type-checkbox input,
693
- .format-setting.type-radio input {
694
- float: left;
695
- margin: 2px 5px 0 1px;
696
- }
697
- .format-setting.type-checkbox label,
698
- .format-setting.type-radio label {
699
- float: left;
700
- max-width: 90%;
701
- padding: 0px;
702
- }
703
- #option-tree-settings-api .format-setting.type-checkbox p,
704
- #option-tree-settings-api .format-setting.type-radio p {
705
- float: left;
706
- margin: 0.5em 0 !important;
707
- width: 100%;
708
- }
709
-
710
- /* --------------------------------------------------
711
- :: Radio Images
712
- ---------------------------------------------------*/
713
- .type-radio-image .option-tree-ui-radio-images {
714
- float: left;
715
- margin: 0 10px 10px 0px;
716
- }
717
- .type-radio-image .option-tree-ui-radio-images img {
718
- background: #fff;
719
- border: 1px solid #ccc;
720
- cursor: pointer;
721
- padding: 5px;
722
- border-radius: 3px;
723
- -webkit-border-radius: 3px;
724
- -moz-border-radius: 3px;
725
- }
726
- .type-radio-image .option-tree-ui-radio-images img.option-tree-ui-radio-image-selected,
727
- .type-radio-image .option-tree-ui-radio-images img:hover {
728
- border-color: #464646;
729
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
730
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
731
- }
732
-
733
- /* --------------------------------------------------
734
- :: Numeric Slider
735
- ---------------------------------------------------*/
736
- .type-numeric-slider .format-setting-inner {
737
- background: #fcfcfc;
738
- border: 1px solid #ccc;
739
- min-height: 41px;
740
- padding: 5px;
741
- -webkit-box-sizing: border-box;
742
- -moz-box-sizing: border-box;
743
- box-sizing: border-box;
744
- -webkit-border-radius: 3px;
745
- -moz-border-radius: 3px;
746
- border-radius: 3px;
747
- }
748
- .ot-numeric-slider-wrap {
749
- margin: 0 96px 0 0;
750
- }
751
- .ot-numeric-slider-wrap .ot-numeric-slider-helper-input {
752
- position: absolute;
753
- right: 5px;
754
- text-align: center;
755
- top: 5px;
756
- width: 90px;
757
- }
758
- .ot-numeric-slider.ui-slider {
759
- background: #fff;
760
- border: 1px solid #ccc;
761
- margin: 8px 8px 0 8px;
762
- position: relative;
763
- -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
764
- -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
765
- box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
766
- -webkit-border-radius: 2px;
767
- -moz-border-radius: 2px;
768
- border-radius: 2px;
769
- }
770
- .ot-numeric-slider.ui-slider-horizontal {
771
- height: 11px;
772
- }
773
- .ot-numeric-slider.ui-slider .ui-slider-handle {
774
- background-color: #21759b;
775
- border: 1px solid #21759b;
776
- border-bottom-color: #1e6a8d;
777
- cursor: pointer;
778
- display: block;
779
- height: 27px;
780
- margin: -9px -8px;
781
- outline: 0;
782
- position: absolute;
783
- width: 16px;
784
- background-image: -webkit-gradient(linear,left top,left bottom,from(#2a95c5),to(#21759b));
785
- background-image: -webkit-linear-gradient(top,#2a95c5,#21759b);
786
- background-image: -moz-linear-gradient(top,#2a95c5,#21759b);
787
- background-image: -ms-linear-gradient(top,#2a95c5,#21759b);
788
- background-image: -o-linear-gradient(top,#2a95c5,#21759b);
789
- background-image: linear-gradient(to bottom,#2a95c5,#21759b);
790
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
791
- -moz-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
792
- box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
793
- -webkit-border-radius: 3px;
794
- -moz-border-radius: 3px;
795
- border-radius: 3px;
796
- }
797
- .ot-numeric-slider.ui-slider .ui-slider-handle:hover {
798
- background-color: #278ab7;
799
- background-image: -webkit-gradient(linear,left top,left bottom,from(#2e9fd2),to(#21759b));
800
- background-image: -webkit-linear-gradient(top,#2e9fd2,#21759b);
801
- background-image: -moz-linear-gradient(top,#2e9fd2,#21759b);
802
- background-image: -ms-linear-gradient(top,#2e9fd2,#21759b);
803
- background-image: -o-linear-gradient(top,#2e9fd2,#21759b);
804
- background-image: linear-gradient(to bottom,#2e9fd2,#21759b);
805
- border-color: #1b607f;
806
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
807
- -moz-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
808
- box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
809
- }
810
-
811
- /* --------------------------------------------------
812
- :: Colorpicker
813
- ---------------------------------------------------*/
814
- .option-tree-ui-colorpicker-input-wrap {
815
- margin-right: 53px;
816
- position: relative;
817
- width: auto;
818
- }
819
- .format-settings .cp_box {
820
- background: #f1f1f1;
821
- border: 1px solid #ccc;
822
- bottom: 5px;
823
- height: 27px;
824
- position: absolute;
825
- right: -53px;
826
- width: 46px;
827
- -moz-border-radius: 2px;
828
- -webkit-border-radius: 2px;
829
- border-radius: 2px;
830
- }
831
- .ot_colorpicker {
832
- width: 342px;
833
- height: 170px;
834
- overflow: hidden;
835
- position: absolute;
836
- background: #fafafa url(../images/colorpicker/color_bg.png);
837
- font-family: Arial, Helvetica, sans-serif;
838
- display: none;
839
- border: 1px solid #bbb;
840
- -moz-border-radius: 2px;
841
- -webkit-border-radius: 2px;
842
- border-radius: 2px;
843
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
844
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
845
- z-index: 100;
846
- }
847
- .ot_colorpicker .colorpicker_color {
848
- width: 150px;
849
- height: 150px;
850
- left: 10px;
851
- top: 10px;
852
- position: absolute;
853
- background: #f00;
854
- overflow: hidden;
855
- cursor: crosshair;
856
- }
857
- .ot_colorpicker .colorpicker_color div {
858
- position: absolute;
859
- top: 0;
860
- left: 0;
861
- width: 150px;
862
- height: 150px;
863
- background: url(../images/colorpicker/color_overlay.png);
864
- }
865
- .ot_colorpicker .colorpicker_color div div {
866
- position: absolute;
867
- top: 0;
868
- left: 0;
869
- width: 11px;
870
- height: 11px;
871
- overflow: hidden;
872
- background: url(../images/colorpicker/color_select.gif);
873
- margin: -5px 0 0 -5px;
874
- }
875
- .ot_colorpicker .colorpicker_hue {
876
- position: absolute;
877
- top: 10px;
878
- left: 164px;
879
- width: 35px;
880
- height: 150px;
881
- cursor: n-resize;
882
- }
883
- .ot_colorpicker .colorpicker_hue div {
884
- position: absolute;
885
- width: 35px;
886
- height: 9px;
887
- overflow: hidden;
888
- background: url(../images/colorpicker/color_indicator.png) left top;
889
- margin: -5px 0 0 0;
890
- }
891
- .ot_colorpicker .colorpicker_new_color {
892
- position: absolute;
893
- width: 60px;
894
- height: 30px;
895
- right: 80px;
896
- top: 10px;
897
- background: #f00;
898
- }
899
- .ot_colorpicker .colorpicker_current_color {
900
- position: absolute;
901
- width: 60px;
902
- height: 30px;
903
- right: 10px;
904
- top: 10px;
905
- background: #f00;
906
- }
907
- .ot_colorpicker input {
908
- background-color: transparent !important;
909
- border: 1px solid transparent !important;
910
- position: absolute !important;
911
- font-size: 10px !important;
912
- font-family: Arial, Helvetica, sans-serif !important;
913
- color: #666 !important;
914
- top: 0px !important;
915
- right: 12px !important;
916
- text-align: right !important;
917
- margin: 0 !important;
918
- padding: 0 !important;
919
- height: 22px !important;
920
- line-height: 22px !important;
921
- }
922
- .ot_colorpicker .colorpicker_hex {
923
- position: absolute;
924
- width: 72px;
925
- height: 22px;
926
- background: url(../images/colorpicker/color_hex.png) top;
927
- left: 201px;
928
- bottom: 9px;
929
- }
930
- .ot_colorpicker .colorpicker_hex input {
931
- left: 13px;
932
- height: 22px;
933
- line-height: 22px;
934
- padding: 10px;
935
- }
936
- .ot_colorpicker .colorpicker_field {
937
- height: 22px;
938
- width: 62px;
939
- background-position: top;
940
- position: absolute;
941
- }
942
- .ot_colorpicker .colorpicker_field span {
943
- position: absolute;
944
- width: 12px;
945
- height: 22px;
946
- overflow: hidden;
947
- top: 0;
948
- right: 0;
949
- cursor: n-resize;
950
- }
951
- .ot_colorpicker .colorpicker_rgb_r {
952
- background-image: url(../images/colorpicker/color_rgb_r.png);
953
- top: 49px;
954
- left: 201px;
955
- }
956
- .ot_colorpicker .colorpicker_rgb_g {
957
- background-image: url(../images/colorpicker/color_rgb_g.png);
958
- top: 79px;
959
- left: 201px;
960
- }
961
- .ot_colorpicker .colorpicker_rgb_b {
962
- background-image: url(../images/colorpicker/color_rgb_b.png);
963
- top: 109px;
964
- left: 201px;
965
- }
966
- .ot_colorpicker .colorpicker_hsb_h {
967
- background-image: url(../images/colorpicker/color_hsb_h.png);
968
- top: 49px;
969
- right: 9px;
970
- }
971
- .ot_colorpicker .colorpicker_hsb_s {
972
- background-image: url(../images/colorpicker/color_hsb_s.png);
973
- top: 79px;
974
- right: 9px;
975
- }
976
- .ot_colorpicker .colorpicker_hsb_b {
977
- background-image: url(../images/colorpicker/color_hsb_b.png);
978
- top: 109px;
979
- right: 9px;
980
- }
981
- .ot_colorpicker .colorpicker_submit {
982
- position: absolute;
983
- width: 16px;
984
- height: 16px;
985
- background: url(../images/colorpicker/color_wheel.png) top;
986
- right: 10px;
987
- bottom: 10px;
988
- overflow: hidden;
989
- }
990
- .ot_colorpicker .colorpicker_focus {
991
- background-position: center;
992
- }
993
- .ot_colorpicker .colorpicker_hex.colorpicker_focus {
994
- background-position: bottom;
995
- }
996
- .ot_colorpicker .colorpicker_submit.colorpicker_focus {
997
- background-position: bottom;
998
- }
999
- .ot_colorpicker .colorpicker_slider {
1000
- background-position: bottom;
1001
- }
1002
-
1003
- @media not screen and (1) {
1004
- .format-settings .cp_box {
1005
- height: 26px;
1006
- };
1007
- }
1008
-
1009
- /* --------------------------------------------------
1010
- :: OptionTree UI Buttons
1011
- ---------------------------------------------------*/
1012
- .option-tree-ui-button,
1013
- .option-tree-ui-button.blue,
1014
- .option-tree-ui-button.red {
1015
- display: inline-block;
1016
- text-decoration: none;
1017
- float: left;
1018
- font-size: 12px;
1019
- line-height: 28px;
1020
- height: 29px;
1021
- margin: 5px;
1022
- padding: 0 14px 1px;
1023
- cursor: pointer;
1024
- border-width: 1px;
1025
- border-style: solid;
1026
- -webkit-appearance: none;
1027
- white-space: nowrap;
1028
- -webkit-border-radius: 3px;
1029
- -moz-border-radius: 3px;
1030
- border-radius: 3px;
1031
- -webkit-box-sizing: border-box;
1032
- -moz-box-sizing: border-box;
1033
- box-sizing: border-box;
1034
- }
1035
- button.option-tree-ui-button::-moz-focus-inner,
1036
- input[type="reset"].option-tree-ui-button::-moz-focus-inner,
1037
- input[type="button"].option-tree-ui-button::-moz-focus-inner,
1038
- input[type="submit"].option-tree-ui-button::-moz-focus-inner {
1039
- border-width: 1px 0;
1040
- border-style: solid none;
1041
- border-color: transparent;
1042
- padding: 0;
1043
- }
1044
- .option-tree-ui-button:active {
1045
- outline: 0;
1046
- }
1047
- .option-tree-ui-button.hidden {
1048
- display: none;
1049
- }
1050
- .option-tree-ui-button,
1051
- .option-tree-ui-button.red {
1052
- background: #f3f3f3;
1053
- background-image: -webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#f4f4f4));
1054
- background-image: -webkit-linear-gradient(top,#fefefe,#f4f4f4);
1055
- background-image: -moz-linear-gradient(top,#fefefe,#f4f4f4);
1056
- background-image: -o-linear-gradient(top,#fefefe,#f4f4f4);
1057
- background-image: linear-gradient(to bottom,#fefefe,#f4f4f4);
1058
- border-color: #bbb;
1059
- color: #333;
1060
- text-shadow: 0 1px 0 #fff;
1061
- }
1062
- .option-tree-ui-button.hover,
1063
- .option-tree-ui-button:hover,
1064
- .option-tree-ui-button.red:hover,
1065
- .option-tree-ui-button.focus,
1066
- .option-tree-ui-button:focus,
1067
- .option-tree-ui-button.red:focus {
1068
- background: #f3f3f3;
1069
- background-image: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#f3f3f3));
1070
- background-image: -webkit-linear-gradient(top,#fff,#f3f3f3);
1071
- background-image: -moz-linear-gradient(top,#fff,#f3f3f3);
1072
- background-image: -ms-linear-gradient(top,#fff,#f3f3f3);
1073
- background-image: -o-linear-gradient(top,#fff,#f3f3f3);
1074
- background-image: linear-gradient(to bottom,#fff,#f3f3f3);
1075
- border-color: #999;
1076
- color: #222;
1077
- }
1078
- .option-tree-ui-button.focus,
1079
- .option-tree-ui-button:focus,
1080
- .option-tree-ui-button.red:focus {
1081
- -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2);
1082
- box-shadow: 1px 1px 1px rgba(0,0,0,.2);
1083
- }
1084
- .option-tree-ui-button.active,
1085
- .option-tree-ui-button.active:hover,
1086
- .option-tree-ui-button.active:focus,
1087
- .option-tree-ui-button:active,
1088
- .option-tree-ui-button.red:active {
1089
- background: #eee;
1090
- background-image: -webkit-gradient(linear,left top,left bottom,from(#f4f4f4),to(#fefefe));
1091
- background-image: -webkit-linear-gradient(top,#f4f4f4,#fefefe);
1092
- background-image: -moz-linear-gradient(top,#f4f4f4,#fefefe);
1093
- background-image: -ms-linear-gradient(top,#f4f4f4,#fefefe);
1094
- background-image: -o-linear-gradient(top,#f4f4f4,#fefefe);
1095
- background-image: linear-gradient(to bottom,#f4f4f4,#fefefe);
1096
- border-color: #999;
1097
- color: #333;
1098
- text-shadow: 0 -1px 0 #fff;
1099
- -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,0.5);
1100
- box-shadow: inset 0 2px 5px -3px rgba(0,0,0,0.5);
1101
- }
1102
- .option-tree-ui-button[disabled],
1103
- .option-tree-ui-button:disabled,
1104
- .option-tree-ui-button.red[disabled],
1105
- .option-tree-ui-button.red:disabled,
1106
- .option-tree-ui-button.disabled {
1107
- color: #aaa!important;
1108
- border-color: #ddd!important;
1109
- background-image: -webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#f4f4f4))!important;
1110
- background-image: -webkit-linear-gradient(top,#f9f9f9,#f4f4f4)!important;
1111
- background-image: -moz-linear-gradient(top,#f9f9f9,#f4f4f4)!important;
1112
- background-image: -ms-linear-gradient(top,#f9f9f9,#f4f4f4)!important;
1113
- background-image: -o-linear-gradient(top,#f9f9f9,#f4f4f4)!important;
1114
- background-image: linear-gradient(to bottom,#f9f9f9,#f4f4f4)!important;
1115
- -webkit-box-shadow: none!important;
1116
- box-shadow: none!important;
1117
- text-shadow: 0 1px 0 #fff!important;
1118
- cursor: default;
1119
- }
1120
- .option-tree-ui-button.blue {
1121
- background-color: #21759b;
1122
- background-image: -webkit-gradient(linear,left top,left bottom,from(#2a95c5),to(#21759b));
1123
- background-image: -webkit-linear-gradient(top,#2a95c5,#21759b);
1124
- background-image: -moz-linear-gradient(top,#2a95c5,#21759b);
1125
- background-image: -ms-linear-gradient(top,#2a95c5,#21759b);
1126
- background-image: -o-linear-gradient(top,#2a95c5,#21759b);
1127
- background-image: linear-gradient(to bottom,#2a95c5,#21759b);
1128
- border-color: #21759b;
1129
- border-bottom-color: #1e6a8d;
1130
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
1131
- box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
1132
- color: #fff;
1133
- text-decoration: none;
1134
- text-shadow: 0 1px 0 rgba(0,0,0,0.1);
1135
- }
1136
- .option-tree-ui-button.blue.hover,
1137
- .option-tree-ui-button.blue:hover,
1138
- .option-tree-ui-button.blue.focus,
1139
- .option-tree-ui-button.blue:focus {
1140
- background-color: #278ab7;
1141
- background-image: -webkit-gradient(linear,left top,left bottom,from(#2e9fd2),to(#21759b));
1142
- background-image: -webkit-linear-gradient(top,#2e9fd2,#21759b);
1143
- background-image: -moz-linear-gradient(top,#2e9fd2,#21759b);
1144
- background-image: -ms-linear-gradient(top,#2e9fd2,#21759b);
1145
- background-image: -o-linear-gradient(top,#2e9fd2,#21759b);
1146
- background-image: linear-gradient(to bottom,#2e9fd2,#21759b);
1147
- border-color: #1b607f;
1148
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
1149
- box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
1150
- color: #fff;
1151
- text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
1152
- }
1153
- .option-tree-ui-button.blue.focus,
1154
- .option-tree-ui-button.blue:focus {
1155
- border-color: #0e3950;
1156
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6),1px 1px 2px rgba(0,0,0,0.4);
1157
- box-shadow: inset 0 1px 0 rgba(120,200,230,0.6),1px 1px 2px rgba(0,0,0,0.4);
1158
- }
1159
- .option-tree-ui-button.blue.active,
1160
- .option-tree-ui-button.blue.active:hover,
1161
- .option-tree-ui-button.blue.active:focus,
1162
- .option-tree-ui-button.blue:active {
1163
- background: #1b607f;
1164
- background-image: -webkit-gradient(linear,left top,left bottom,from(#21759b),to(#278ab7));
1165
- background-image: -webkit-linear-gradient(top,#21759b,#278ab7);
1166
- background-image: -moz-linear-gradient(top,#21759b,#278ab7);
1167
- background-image: -ms-linear-gradient(top,#21759b,#278ab7);
1168
- background-image: -o-linear-gradient(top,#21759b,#278ab7);
1169
- background-image: linear-gradient(to bottom,#21759b,#278ab7);
1170
- border-color: #124560 #2382ae #2382ae #2382ae;
1171
- color: rgba(255,255,255,0.95);
1172
- -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
1173
- box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
1174
- text-shadow: 0 1px 0 rgba(0,0,0,0.1);
1175
- }
1176
- .option-tree-ui-button.blue[disabled],
1177
- .option-tree-ui-button.blue:disabled,
1178
- .option-tree-ui-button.blue-disabled {
1179
- color: #94cde7!important;
1180
- background: #298cba!important;
1181
- border-color: #1b607f!important;
1182
- -webkit-box-shadow: none!important;
1183
- box-shadow: none!important;
1184
- text-shadow: 0 -1px 0 rgba(0,0,0,0.1)!important;
1185
- cursor: default;
1186
- }
1187
- .option-tree-ui-button.red {
1188
- background-color: #9b3221;
1189
- background-image: -webkit-gradient(linear,left top,left bottom,from(#c5402a),to(#9b3221));
1190
- background-image: -webkit-linear-gradient(top,#c5402a,#9b3221);
1191
- background-image: -moz-linear-gradient(top,#c5402a,#9b3221);
1192
- background-image: -ms-linear-gradient(top,#c5402a,#9b3221);
1193
- background-image: -o-linear-gradient(top,#c5402a,#9b3221);
1194
- background-image: linear-gradient(to bottom,#c5402a,#9b3221);
1195
- border-color: #9b3221;
1196
- border-bottom-color: #8d2e1e;
1197
- -webkit-box-shadow: inset 0 1px 0 rgba(229,134,119,0.5);
1198
- box-shadow: inset 0 1px 0 rgba(229,134,119,0.5);
1199
- color: #fff;
1200
- text-decoration: none;
1201
- text-shadow: 0 1px 0 rgba(0,0,0,0.1);
1202
- }
1203
- .option-tree-ui-button.red.hover,
1204
- .option-tree-ui-button.red:hover,
1205
- .option-tree-ui-button.red.focus,
1206
- .option-tree-ui-button.red:focus {
1207
- background-color: #b73b27;
1208
- background-image: -webkit-gradient(linear,left top,left bottom,from(#d2452e),to(#9b3221));
1209
- background-image: -webkit-linear-gradient(top,#d2452e,#9b3221);
1210
- background-image: -moz-linear-gradient(top,#d2452e,#9b3221);
1211
- background-image: -ms-linear-gradient(top,#d2452e,#9b3221);
1212
- background-image: -o-linear-gradient(top,#d2452e,#9b3221);
1213
- background-image: linear-gradient(to bottom,#d2452e,#9b3221);
1214
- border-color: #7f291b;
1215
- -webkit-box-shadow: inset 0 1px 0 rgba(229,134,119,0.6);
1216
- box-shadow: inset 0 1px 0 rgba(229,134,119,0.6);
1217
- color: #fff;
1218
- text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
1219
- }
1220
- .option-tree-ui-button.red.focus,
1221
- .option-tree-ui-button.red:focus {
1222
- border-color: #4f160d;
1223
- -webkit-box-shadow: inset 0 1px 0 rgba(229,134,119,0.6),1px 1px 2px rgba(0,0,0,0.4);
1224
- box-shadow: inset 0 1px 0 rgba(229,134,119,0.6),1px 1px 2px rgba(0,0,0,0.4);
1225
- }
1226
- .option-tree-ui-button.red.active,
1227
- .option-tree-ui-button.red.active:hover,
1228
- .option-tree-ui-button.red.active:focus,
1229
- .option-tree-ui-button.red:active {
1230
- background: #7f291b;
1231
- background-image: -webkit-gradient(linear,left top,left bottom,from(#9b3221),to(#b73b27));
1232
- background-image: -webkit-linear-gradient(top,#9b3221,#b73b27);
1233
- background-image: -moz-linear-gradient(top,#9b3221,#b73b27);
1234
- background-image: -ms-linear-gradient(top,#9b3221,#b73b27);
1235
- background-image: -o-linear-gradient(top,#9b3221,#b73b27);
1236
- background-image: linear-gradient(to bottom,#9b3221,#b73b27);
1237
- border-color: #611d12 #ad3523 #ad3523 #ad3523;
1238
- color: rgba(255,255,255,0.95);
1239
- -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
1240
- box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
1241
- text-shadow: 0 1px 0 rgba(0,0,0,0.1);
1242
- }
1243
- .option-tree-ui-button.red[disabled],
1244
- .option-tree-ui-button.red:disabled,
1245
- .option-tree-ui-button.red-disabled {
1246
- color: #94cde7!important;
1247
- background: #ba3c29!important;
1248
- border-color: #7f291b!important;
1249
- -webkit-box-shadow: none!important;
1250
- box-shadow: none!important;
1251
- text-shadow: 0 -1px 0 rgba(0,0,0,0.1)!important;
1252
- cursor: default;
1253
- }
1254
- .option-tree-ui-button.right {
1255
- float: right;
1256
- }
1257
- .option-tree-ui-button.hug-left {
1258
- margin-left: 0px;
1259
- }
1260
- .option-tree-ui-button.hug-right {
1261
- margin-right: 0px;
1262
- }
1263
- .option-tree-ui-button.pad {
1264
- padding: 0px 21px;
1265
- }
1266
- .option-tree-ui-button.left-item {
1267
- margin: 5px 0 5px 5px;
1268
- -webkit-border-top-right-radius: 0px;
1269
- -webkit-border-bottom-right-radius: 0px;
1270
- -moz-border-radius-topright: 0px;
1271
- -moz-border-radius-bottomright: 0px;
1272
- border-top-right-radius: 0px;
1273
- border-bottom-right-radius: 0px;
1274
- }
1275
- .option-tree-ui-button.center-item {
1276
- margin: 5px 0 5px -1px;
1277
- -webkit-border-radius: 0px;
1278
- -moz-border-radius: 0px;
1279
- border-radius: 0px;
1280
- }
1281
- .option-tree-ui-button.right-item {
1282
- margin: 5px 5px 5px -1px;
1283
- -webkit-border-top-left-radius: 0px;
1284
- -webkit-border-bottom-left-radius: 0px;
1285
- -moz-border-radius-topleft: 0px;
1286
- -moz-border-radius-bottomleft: 0px;
1287
- border-top-left-radius: 0px;
1288
- border-bottom-left-radius: 0px;
1289
- }
1290
- .option-tree-ui-buttons {
1291
- background: #fff;
1292
- border: 1px solid #ccc;
1293
- margin: 11px 5px 0 2px;
1294
- min-width: 523px;
1295
- overflow: hidden;
1296
- padding: 5px;
1297
- position: relative;
1298
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
1299
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
1300
- -webkit-border-radius: 4px;
1301
- -khtml-border-radius: 4px;
1302
- -moz-border-radius: 4px;
1303
- -o-border-radius: 4px;
1304
- border-radius: 4px;
1305
- }
1306
- .option-tree-ui-buttons.alt {
1307
- background: #f5f5f5;
1308
- border-color: #dfdfdf;
1309
- }
1310
- .option-tree-ui-buttons:before,
1311
- .option-tree-ui-buttons:after {
1312
- content: "\0020";
1313
- display: block;
1314
- height: 0;
1315
- visibility: hidden;
1316
- }
1317
- .option-tree-ui-buttons:after {
1318
- clear: both;
1319
- }
1320
- .option-tree-ui-buttons {
1321
- zoom: 1;
1322
- }
1323
- button.reset-settings {
1324
- position: relative;
1325
- top: -45px;
1326
- left: 8px;
1327
- }
1328
-
1329
- /* --------------------------------------------------
1330
- :: OptionTree UI Button Icons
1331
- ---------------------------------------------------*/
1332
- .option-tree-ui-button .icon {
1333
- background: url(../images/ot-ui-sprite.png) no-repeat;
1334
- display: inline-block;
1335
- float: left;
1336
- height: 18px;
1337
- margin-top: 4px;
1338
- opacity: 0.65;
1339
- overflow: hidden;
1340
- text-indent: -9999px;
1341
- width: 18px;
1342
- }
1343
- button.option-tree-ui-button .icon {
1344
- margin-top: -3px;
1345
- }
1346
- .option-tree-ui-button.light .icon {
1347
- background-image: url(../images/ot-ui-light-sprite.png);
1348
- opacity: 0.9;
1349
- }
1350
- .option-tree-ui-button.active .icon,
1351
- .option-tree-ui-button:hover .icon {
1352
- opacity: 1;
1353
- }
1354
- .option-tree-ui-button .icon.right-label {
1355
- margin-right: 10px;
1356
- }
1357
- .option-tree-ui-button .icon.left-label {
1358
- margin-left: 10px;
1359
- float: right;
1360
- }
1361
- .option-tree-ui-button .upload {
1362
- background-position: -0px -0px;
1363
- }
1364
- .option-tree-ui-button .trash-can {
1365
- background-position: -18px -0px;
1366
- }
1367
- .option-tree-ui-button .pencil,
1368
- .option-tree-ui-button .check {
1369
- background-position: -36px -0px;
1370
- }
1371
- .option-tree-ui-button:hover .pencil,
1372
- .option-tree-ui-button:hover .check,
1373
- .option-tree-ui-button.active .pencil,
1374
- .option-tree-ui-button.active .check {
1375
- background-position: -54px -0px;
1376
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/style-classic.css ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ a strong {
2
+ color: #1C6280 !important;
3
+ }
4
+ #framework_wrap #header {
5
+ background: #436d92 url(../images/header_classic.png) repeat-x left top;
6
+ border: 1px solid #1d507d;
7
+ }
8
+ #framework_wrap #header h1 {
9
+ background: url(../images/logo_classic.png) no-repeat 0 0;
10
+ }
11
+ #framework_wrap #header div.version {
12
+ color: #1a4b76;
13
+ text-shadow: 0 1px 0 #6694bd;
14
+ }
15
+ #framework_wrap #header span.icon {
16
+ background-image: url(../images/icon_option_classic.png);
17
+ }
18
+ #framework_wrap #content_wrap .info {
19
+ background: #f4f3ed;
20
+ border-bottom: 1px solid #dfdfdf;
21
+ }
22
+ #framework_wrap #content {
23
+ border-bottom: 1px solid #dfdfdf;
24
+ }
25
+ #framework_wrap #content .has-table table th {
26
+ background: #f4f3ee;
27
+ background-image: -moz-linear-gradient(top, #fdfdfc, #f4f3ee);
28
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fdfdfc), to(#f4f3ee));
29
+ }
30
+ .has-table table .col-heading {
31
+ background: #f7f6f1;
32
+ }
33
+ tbody tr.inline-edit-option td {
34
+ background: #eaf3fa;
35
+ }
36
+ #framework_wrap #content tbody tr.inline-edit-option td h3 {
37
+ border-bottom-color: #dae1e8;
38
+ }
39
+ #framework_wrap code {
40
+ background-color: #eaf3fa;
41
+ }
42
+ #framework_wrap pre {
43
+ background: #eaf3fa;
44
+ border-bottom: 1px solid #eaf3fa;
45
+ }
46
+ #framework_wrap pre code {
47
+ background-image: url(../images/pre_classic_bg.gif);
48
+ }
49
+ .ui-tabs {
50
+ background-image: url(../images/tabs_bg_classic.png);
51
+ }
52
+ .ui-tabs .ui-tabs-nav li a {
53
+ border-bottom: 1px solid #dfdfdf;
54
+ }
55
+ .ui-tabs .ui-tabs-nav li.ui-state-hover a {
56
+ background-color: #f1f8fd;
57
+ color: #555;
58
+ }
assets/css/style.css ADDED
@@ -0,0 +1,948 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* OptionTree */
2
+ #wpwrap {
3
+ min-width: 990px;
4
+ }
5
+ strong {
6
+ color: #000;
7
+ }
8
+ .clear {
9
+ clear: both;
10
+ }
11
+ .hide,
12
+ #contextual-help-link-wrap {
13
+ display: none;
14
+ }
15
+ .left {
16
+ float: left !important;
17
+ }
18
+ .right {
19
+ float: right !important;
20
+ }
21
+ p {
22
+ padding-bottom: 14px;
23
+ }
24
+ a {
25
+ text-decoration: none;
26
+ }
27
+ a strong {
28
+ color: #21759B !important;
29
+ }
30
+ a:hover strong {
31
+ color: #d54e21 !important;
32
+ }
33
+ #framework_wrap #header .error {
34
+ display: none !important;
35
+ }
36
+ #framework_wrap {
37
+ position: relative;
38
+ width: 788px;
39
+ margin: 15px;
40
+ }
41
+ #framework_wrap #header {
42
+ -webkit-border-top-left-radius: 8px;
43
+ -webkit-border-top-right-radius: 8px;
44
+ -moz-border-radius-topleft: 8px;
45
+ -moz-border-radius-topright: 8px;
46
+ border-top-left-radius: 8px;
47
+ border-top-right-radius: 8px;
48
+ background: #6d6d6d url(../images/header.png) repeat-x left top;
49
+ border: 1px solid #555;
50
+ height: 71px;
51
+ width: 785px;
52
+ position: relative;
53
+ }
54
+ #framework_wrap #header h1 {
55
+ width: 150px;
56
+ height: 31px;
57
+ background: url(../images/logo_dark.png) no-repeat 0 0;
58
+ text-indent: -9999px;
59
+ margin: 20px 0 0 20px;
60
+ }
61
+ #framework_wrap #header span.icon {
62
+ position: absolute;
63
+ display: block;
64
+ right: 20px;
65
+ top: 18px;
66
+ height: 32px;
67
+ width: 32px;
68
+ text-indent: -9999px;
69
+ background: url(../images/icon_option.png) no-repeat left center;
70
+ }
71
+ #framework_wrap #header div.version {
72
+ text-align: left;
73
+ position: absolute;
74
+ left: 170px;
75
+ top: 32px;
76
+ font-size: 9px !important;
77
+ line-height: 10px;
78
+ color: #444;
79
+ font-style: normal;
80
+ font-family: Verdana,Arial,sans-serif;
81
+ text-transform: uppercase;
82
+ font-weight: normal;
83
+ text-shadow: 0 1px 0 #888;
84
+ letter-spacing: -0.05em;
85
+ }
86
+ #framework_wrap #content_wrap {
87
+ border: 1px solid #aaa;
88
+ border-top: none;
89
+ background: #fff;
90
+ width: 785px;
91
+ position: relative;
92
+ }
93
+ #framework_wrap #content_wrap .info {
94
+ background: #eaf2fa;
95
+ background: #f9f9f9;
96
+ height: 35px;
97
+ border-top: 1px solid #fff;
98
+ border-bottom: 1px solid #e3e3e3;
99
+ }
100
+ a.toggle_tabs {
101
+ cursor: pointer;
102
+ background: url(../images/toggle_tabs.png) no-repeat -2px -1px;
103
+ display: block;
104
+ height: 22px;
105
+ width: 21px;
106
+ float: left;
107
+ text-indent: -9999px;
108
+ margin: 5px 5px 0 19px;
109
+ border: 1px solid #bbb;
110
+ -webkit-border-radius: 4px;
111
+ -moz-border-radius: 4px;
112
+ border-radius: 4px;
113
+ }
114
+ .no-tabs a.toggle_tabs {
115
+ display: none;
116
+ }
117
+ a:hover.toggle_tabs {
118
+ border-color: #666;
119
+ }
120
+ a.off {
121
+ background-position: -2px -26px;
122
+ }
123
+ #framework_wrap #content_wrap .bottom {
124
+ border-top: 1px solid #fff !important;
125
+ border-bottom: none !important;
126
+
127
+ background: #f1f1f1;
128
+ }
129
+ #framework_wrap #content_wrap .info input.button-framework {
130
+ float: right;
131
+ margin: 5px 20px 0 0;
132
+ padding: 4px 10px;
133
+ font-size: 11px;
134
+ height: 24px;
135
+ }
136
+ #framework_wrap #content_wrap .info input.add-item {
137
+ float: left;
138
+ margin-left: 20px;
139
+ }
140
+ #framework_wrap #content_wrap .info input.reset {
141
+ margin-left: 20px;
142
+ color: #d54e45;
143
+ float: left;
144
+ }
145
+ #framework_wrap #content_wrap a.reset {
146
+ margin-right: 10px;
147
+ color: #d54e45;
148
+ }
149
+ .ajax-message {
150
+ position: absolute;
151
+ left: 300px;
152
+ top: 100px;
153
+ width: 200px;
154
+ z-index: 100;
155
+ display: none;
156
+ overflow: visible;
157
+ }
158
+ #framework_wrap #content_wrap .message {
159
+ text-align: center;
160
+ color: #444;
161
+ text-shadow: 0 1px 0 #fff;
162
+ font-size: 12px;
163
+ line-height: 16px;
164
+ padding: 20px 10px;
165
+ background: #f3f3f3;
166
+ border: 1px solid #bbb;
167
+ -webkit-border-radius: 5px;
168
+ -moz-border-radius: 5px;
169
+ border-radius: 5px;
170
+ -moz-box-shadow: 0px 2px 5px #eee;
171
+ -webkit-box-shadow: 0px 2px 5px #eee;
172
+ box-shadow: 0px 2px 5px #eee;
173
+ }
174
+ #framework_wrap #content_wrap .message span {
175
+ display: block;
176
+ height: 16px;
177
+ width: 16px;
178
+ position: absolute;
179
+ left: -8px;
180
+ top: -8px;
181
+ background: url(../images/icon_add.png) no-repeat 0 0;
182
+ }
183
+ #framework_wrap #content_wrap .message.warning span {
184
+ background-image: url(../images/icon_error.png);
185
+ }
186
+ /* Primary Form Button */
187
+ #framework_wrap input.button-framework {
188
+ cursor: pointer;
189
+ font-size: 12px;
190
+ color: #444;
191
+ text-shadow: 0 1px 0 #fff;
192
+ background: #f3f3f3 url(../images/btn.png) repeat-x 0 0;
193
+ border: 1px solid #bbb;
194
+ padding: 5px 10px;
195
+ }
196
+ #framework_wrap input:hover.button-framework {
197
+ color: #000;
198
+ border-color: #666;
199
+ }
200
+ #framework_wrap a.button-framework {
201
+ cursor: pointer;
202
+ font-size: 12px;
203
+ color: #444;
204
+ text-shadow: 0 1px 0 #fff;
205
+ background: #f3f3f3 url(../images/btn.png) repeat-x 0 0;
206
+ border: 1px solid #bbb;
207
+ padding: 3px 10px 3px 10px;
208
+ -webkit-border-radius: 4px;
209
+ -moz-border-radius: 4px;
210
+ border-radius: 4px;
211
+ text-decoration: none;
212
+ float: left;
213
+ position: relative;
214
+ left: 1px;
215
+ }
216
+ #framework_wrap div.inline-edit-save a.button-framework {
217
+ padding: 2px 10px 2px 10px;
218
+ font-size: 11px;
219
+ }
220
+ #framework_wrap a:hover.button-framework {
221
+ color: #000;
222
+ border-color: #666;
223
+ }
224
+
225
+ /* Content Inner */
226
+ #framework_wrap #content {
227
+ padding: 0;
228
+ width: 785px;
229
+ border-bottom: 1px solid #e3e3e3;
230
+ position: relative;
231
+ }
232
+ .screenshot {
233
+ float: right;
234
+ margin-left: 1px;
235
+ position: relative;
236
+ width: 344px;
237
+ }
238
+ .screenshot img {
239
+ max-width: 334px;
240
+ padding: 4px;
241
+ border: 1px solid #ccc;
242
+ background: #fafafa;
243
+ border-color: #ccc #eee #eee #ccc;
244
+ -webkit-border-radius: 4px;
245
+ -moz-border-radius: 4px;
246
+ border-radius: 4px;
247
+ float: right;
248
+ }
249
+ .screenshot a {
250
+ text-decoration: none;
251
+ padding-left: 20px;
252
+ }
253
+ .screenshot a.remove {
254
+ background: url(../images/icon_delete.png) no-repeat 0 0;
255
+ display: block;
256
+ height: 16px;
257
+ width: 16px;
258
+ position: absolute;
259
+ bottom: -4px;
260
+ right: -4px;
261
+ text-indent: -9999px;
262
+ float: left;
263
+ padding: 0;
264
+ border: none;
265
+ }
266
+ .screenshot .no_image a.remove {
267
+ left: 0;
268
+ top: 2px;
269
+ }
270
+ .option-upload .element {
271
+ padding-bottom: 5px;
272
+ }
273
+ #framework_wrap #content h2 {
274
+ margin-bottom: 10px;
275
+ border-bottom: 1px solid #e5e5e5;
276
+ }
277
+ #framework_wrap #content h3 {
278
+ border-bottom: 1px solid #eee;
279
+ margin: 0 0 15px 0;
280
+ padding-bottom: 10px;
281
+ clear: both;
282
+ font-size: 14px;
283
+ }
284
+ h3.text-title {
285
+ font: italic 20px/30px Georgia,"Times New Roman","Bitstream Charter",Times,serif !important;
286
+ }
287
+ #framework_wrap #content tbody tr.inline-edit-option td h3 {
288
+ border-bottom-color: #ddd;
289
+ }
290
+ #framework_wrap #content .block {
291
+ display: block;
292
+ overflow: hidden;
293
+ padding: 20px;
294
+ }
295
+ #framework_wrap #content p {
296
+ font-size: 11px;
297
+ color: #555;
298
+ padding-bottom: 20px;
299
+ margin: 0;
300
+ }
301
+ #framework_wrap #content table {
302
+ border: 1px solid #dfdfdf;
303
+ width: 100%;
304
+ text-align: left;
305
+ border-spacing: 0;
306
+ border-style: solid;
307
+ border-width: 1px;
308
+ font-size: 11px !important;
309
+ text-shadow: 0 1px 0 #fff;
310
+ -webkit-border-radius: 4px;
311
+ -moz-border-radius: 4px;
312
+ border-radius: 4px;
313
+ }
314
+
315
+ #framework_wrap #content .has-table table th {
316
+ background: #f1f1f1;
317
+ background-image: -moz-linear-gradient(top, #f9f9f9, #f1f1f1);
318
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f1f1f1));
319
+ }
320
+ tbody tr:hover {
321
+ cursor: pointer;
322
+ }
323
+ tbody tr.inline-edit-option {
324
+ }
325
+ tbody tr.inline-edit-option td {
326
+ background: #f1f1f1;
327
+ border-top: 1px solid #fff;
328
+ border-left: 1px solid #fff;
329
+ border-right: 1px solid #fff;
330
+ }
331
+ tbody tr:hover.inline-edit-option {
332
+ cursor: default;
333
+ }
334
+ #framework_wrap #content .has-table table #framework-settings .dragging {
335
+ background: #666 url(../images/black_px.png) repeat-x 0 0;
336
+ color: #fff;
337
+ text-shadow: 0 1px 0 #000;
338
+ }
339
+ #framework_wrap #content .has-table table #framework-settings .dragging td {
340
+ border-color: #000;
341
+ }
342
+ #framework_wrap #content .has-table table #framework-settings .dragging .col-edit {
343
+ background: url(../images/icon_up_down.png) no-repeat 63px center;
344
+ }
345
+ #framework_wrap #content .has-table table #framework-settings .dragging a.edit-inline,
346
+ #framework_wrap #content .has-table table #framework-settings .dragging a.delete-inline {
347
+ display: none;
348
+ }
349
+ .col-title {
350
+ padding-left: 10px !important;
351
+ width: 200px;
352
+ }
353
+ .col-type {
354
+ width: 60px;
355
+ }
356
+ .col-edit {
357
+ width: 45px;
358
+ padding-left: 40px !important;
359
+ padding-right: 0px !important;
360
+ }
361
+ .has-table table tr:first-child {
362
+ cursor: default;
363
+ }
364
+ .has-table table .col-heading {
365
+ background: #eaf3fa;
366
+ }
367
+ .has-table table .col-heading td:first-child {
368
+ font-weight: bold;
369
+ background: transparent url(../images/icon_header.png) no-repeat 10px 11px;
370
+ padding-left: 30px !important;
371
+ }
372
+ .has-table table thead th,
373
+ .has-table table td {
374
+ border-bottom: 1px solid #dfdfdf;
375
+ }
376
+ .has-table table tr,
377
+ .has-table table td,
378
+ .has-table table th {
379
+ padding: 10px 10px;
380
+ font-size: 11px !important;
381
+ }
382
+ .has-table table th {
383
+ padding: 6px 10px;
384
+ font-size: 11px !important;
385
+ }
386
+ .has-table table a {
387
+ text-decoration: none;
388
+ }
389
+ /* Inline Edit */
390
+ .inline-edit-option {
391
+ display: none;
392
+ }
393
+ a.edit-inline,
394
+ a.delete-inline,
395
+ a.add-option {
396
+ background: url(../images/icon_edit.png) no-repeat 0 0;
397
+ display: block;
398
+ height: 16px;
399
+ width: 16px;
400
+ text-indent: -9999px;
401
+ float: left;
402
+ margin-right: 5px;
403
+ display: block;
404
+ }
405
+ a.delete-inline {
406
+ background-image: url(../images/icon_delete.png);
407
+ }
408
+ a.add-option {
409
+ background-image: url(../images/icon_add.png);
410
+ margin-left: 21px;
411
+ }
412
+ a:hover.edit-inline {
413
+ border-color: #666;
414
+ }
415
+ a:hover.delete-inline {
416
+ border-color: #d54e45;
417
+ }
418
+ #framework_wrap #content .option {
419
+ padding-bottom: 15px;
420
+ }
421
+ #framework_wrap #content .option .section {
422
+ overflow: hidden;
423
+ font-size: 11px;
424
+ }
425
+ #framework_wrap #content .option .section .element {
426
+ float: left;
427
+ margin: 0 15px 0 0;
428
+ width: 345px;
429
+ }
430
+ #framework_wrap #content .option-checkbox .section .element {
431
+ width: 25px;
432
+ }
433
+ #framework_wrap #content .option .section .description {
434
+ color: #555;
435
+ float: left;
436
+ font-size: 11px;
437
+ padding: 2px 10px 0 0;
438
+ width: 370px;
439
+ }
440
+ div.desc-text p {
441
+ color: #555;
442
+ font-size: 11px !important;
443
+ }
444
+ #framework_wrap #content .inline-edit-option .option .section .description {
445
+ width: 325px;
446
+ padding-top: 0px;
447
+ }
448
+ #framework_wrap #content .option-checkbox .section .description {
449
+ width: 540px;
450
+ }
451
+ #framework_wrap #content label {
452
+
453
+ }
454
+ .input_wrap {
455
+ padding: 4px 10px 12px 0;
456
+ float: left;
457
+ width: 350px;
458
+ }
459
+ .input_wrap input[type="checkbox"],
460
+ .input_wrap input[type="radio"] {
461
+ float: left;
462
+ width: 20px;
463
+ margin-top: 3px;
464
+ vertical-align: bottom;
465
+ }
466
+ .input_wrap input[type="radio"] {
467
+ margin-top: 4px;
468
+ }
469
+ .input_wrap label {
470
+ float: left;
471
+ width: 325px;
472
+ }
473
+ #framework_wrap #content label input {
474
+ margin-right: 5px;
475
+ display: block;
476
+ float: left;
477
+ }
478
+ #framework_wrap #content input[type="text"],
479
+ #framework_wrap #content select,
480
+ #framework_wrap #content textarea {
481
+ background: #fafafa;
482
+ border-color: #ccc #eee #eee #ccc;
483
+ border-style: solid;
484
+ border-width: 1px;
485
+ font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
486
+ font-size: 12px;
487
+ margin-bottom: 9px !important;
488
+ padding: 5px;
489
+ width: 344px;
490
+ display: block;
491
+ color: #888;
492
+ resize: none;
493
+ }
494
+ #framework_wrap #content tbody tr.inline-edit-option td input[type="text"],
495
+ #framework_wrap #content tbody tr.inline-edit-option td select,
496
+ #framework_wrap #content tbody tr.inline-edit-option td textarea {
497
+ background: #fff;
498
+ }
499
+ #framework_wrap #content input[type="text"].upload {
500
+ width: 281px;
501
+ float: left;
502
+ }
503
+ #framework_wrap #content input[type="text"].cp_input {
504
+ width: 312px !important;
505
+ float: left;
506
+ }
507
+ .cp_box {
508
+ float: right;
509
+ width: 25px;
510
+ height: 25px;
511
+ position: relative;
512
+ top: 1px;
513
+ border: 1px solid #ccc;
514
+ border-color: #ccc #eee #eee #ccc;
515
+ background: #fafafa;
516
+ -webkit-border-radius: 4px;
517
+ -moz-border-radius: 4px;
518
+ border-radius: 4px;
519
+ }
520
+ .cp_box div {
521
+ width: 13px;
522
+ height: 13px;
523
+ border: 1px solid #bbb;
524
+ border-color: #eee #ccc #ccc #eee;
525
+ background: #fafafa url(../images/empty.gif);
526
+ position: absolute;
527
+ left: 5px;
528
+ top: 5px;
529
+ box-shadow: 1px 1px 0px #ccc;
530
+ -webkit-box-shadow: 1px 1px 0px #ccc;
531
+ -moz-box-shadow: 1px 1px 0px #ccc;
532
+ }
533
+ #framework_wrap #content .element small {
534
+ float: left;
535
+ font-size: 9px;
536
+ line-height: 9px;
537
+ color: #999;
538
+ position: relative;
539
+ top: -5px;
540
+ left: 2px;
541
+ }
542
+ .upload_button,
543
+ .upload_file_button,
544
+ .ob_button {
545
+ float: right;
546
+ padding: 5px;
547
+ cursor: pointer;
548
+ color: #444;
549
+ text-shadow: 0 1px 0 #fff;
550
+ background: #f3f3f3 url(../images/btn.png) repeat-x 0 0 !important;
551
+ border: 1px solid #bbb;
552
+ position: relative;
553
+ right: -1px;
554
+ height: 27px;
555
+ }
556
+ #framework_wrap #content select {
557
+ height: 28px;
558
+ padding: 4px 5px;
559
+ }
560
+ #framework_wrap #content input[type="text"]:focus,
561
+ #framework_wrap #content select:focus,
562
+ #framework_wrap #content textarea:focus,
563
+ #framework_wrap #content input[type="text"]:hover,
564
+ #framework_wrap #content select:hover,
565
+ #framework_wrap #content textarea:hover {
566
+ background: #fff;
567
+ border-color: #bbb #eee #eee #bbb;
568
+ color: #333;
569
+ }
570
+ #framework_wrap *:focus {
571
+ outline: none;
572
+ }
573
+ #framework_wrap *::-moz-focus-inner {
574
+ border: none;
575
+ }
576
+ .bottom_btn {
577
+ float: left;
578
+ width: 100%;
579
+ padding-top: 15px;
580
+ }
581
+ #framework_wrap #content .select_wrapper {
582
+ -moz-border-radius: 4px;
583
+ -webkit-border-radius: 4px;
584
+ border-radius: 4px;
585
+ font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
586
+ font-size: 12px;
587
+ background: #fafafa url(../images/select.png) no-repeat right center;
588
+ border-color: #ccc #eee #eee #ccc;
589
+ border-style: solid;
590
+ border-width: 1px;
591
+ float: left;
592
+ height: 26px;
593
+ width: 344px;
594
+ margin: 0;
595
+ margin-bottom: 9px !important;
596
+ width: 344px;
597
+ display: block;
598
+ color: #888;
599
+ }
600
+ #framework_wrap #content .option-type .select_wrapper {
601
+ background-color: #fff;
602
+ }
603
+ #framework_wrap #content .select_wrapper:hover {
604
+ background-color: #fff;
605
+ border-color: #bbb #eee #eee #bbb;
606
+ color: #333;
607
+ }
608
+ #framework_wrap #content select.select {
609
+ cursor: pointer;
610
+ height: 28px;
611
+ margin: 0;
612
+ -moz-opacity: 0;
613
+ filter: alpha(opacity: 0);
614
+ opacity: 0;
615
+ padding: 0;
616
+ position: relative;
617
+ width: inherit;
618
+ z-index: 4;
619
+ }
620
+ #framework_wrap #content .select_wrapper span {
621
+ height: 26px;
622
+ line-height: 26px;
623
+ position: absolute;
624
+ z-index: 2;
625
+ padding-left: 6px;
626
+ }
627
+ /* Docs */
628
+ #framework_wrap #options_tabs.docs {
629
+ font-size: 11px !important;
630
+ color: #555;
631
+ }
632
+ #framework_wrap code {
633
+ font-size: 10px;
634
+ }
635
+ #framework_wrap ul.doc_list {
636
+ font-size: 11px !important;
637
+ padding-bottom: 20px;
638
+ }
639
+ #framework_wrap .doc_list li {
640
+ padding-bottom: 0px;
641
+ line-height: 12px;
642
+ list-style: disc;
643
+ margin-left: 16px;
644
+ }
645
+ #framework_wrap code {
646
+ background-color: #f1f1f1;
647
+ color: #000;
648
+ }
649
+ #framework_wrap pre {
650
+ font-size: 13px;
651
+ padding: 0;
652
+ margin: 0;
653
+ line-height: 18px;
654
+ overflow: auto;
655
+ overflow-Y: hidden;
656
+ padding-top: 18px;
657
+ background: #f1f1f1;
658
+ border-bottom: 1px solid #f1f1f1;
659
+ margin-bottom: 20px;
660
+ color: #000;
661
+ white-space:pre-wrap;
662
+ word-wrap:break-word;
663
+ }
664
+ #framework_wrap pre code {
665
+ padding: 0 18px 18px 18px;
666
+ display: block;
667
+ background: url(../images/pre_bg.gif) repeat left top; /*--Background of lined paper--*/
668
+ }
669
+ /* Tabs */
670
+ .options_tabs {
671
+ display: none;
672
+ }
673
+ .ui-tabs {
674
+ zoom: 1;
675
+ background: url(../images/tabs_bg.png) repeat-y 0 0;
676
+ }
677
+ .ui-tabs .options_tabs {
678
+ display: block;
679
+ }
680
+ .ui-tabs-panel .description {
681
+ width: 225px !important;
682
+ }
683
+ .ui-tabs-panel .inline-edit-option .description {
684
+ width: 200px !important;
685
+ }
686
+ .ui-tabs-panel h2 {
687
+ display: none;
688
+ }
689
+ .ui-tabs .ui-tabs-nav {
690
+ list-style: none;
691
+ position: relative;
692
+ float: left;
693
+ width: 148px;
694
+ word-wrap: break-word;
695
+ }
696
+ .ui-tabs .ui-tabs-nav li {
697
+ position: relative;
698
+ float: left;
699
+ display: block;
700
+ margin: 0;
701
+ padding: 0;
702
+ overflow: visible;
703
+ }
704
+ .ui-tabs .ui-tabs-nav li a {
705
+ float: left;
706
+ text-decoration: none;
707
+ display: block;
708
+ width: 127px;
709
+ padding: 8px 10px;
710
+ border-bottom: 1px solid #e3e3e3;
711
+ color: #21759B;
712
+ text-shadow: 0 1px 0 #fff;
713
+ background-image: url(../images/white_px.png);
714
+ background-repeat: repeat-x;
715
+ background-position: 0 0;
716
+ font-size: 11px;
717
+ }
718
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
719
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a:hover {
720
+ background: #fff;
721
+ color: #d54e45;
722
+ width: 128px;
723
+ }
724
+ .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
725
+ .ui-tabs .ui-tabs-nav li.ui-state-processing a {
726
+ cursor: text;
727
+ }
728
+ .ui-tabs .ui-tabs-nav li a,
729
+ .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
730
+ cursor: pointer;
731
+ }
732
+ .ui-tabs .ui-tabs-nav li.ui-state-hover a {
733
+ background-color: #eaf2fa;
734
+ color: #555;
735
+ }
736
+ .ui-tabs .ui-tabs-panel {
737
+ display: block;
738
+ float: right;
739
+ width: 595px;
740
+ min-height: 400px;
741
+ }
742
+ .ui-tabs .ui-tabs-hide {
743
+ display: none !important;
744
+ }
745
+ .options_tabs li.ui-tabs-selected span {
746
+ position: absolute;
747
+ left: -1px;
748
+ top: 12px;
749
+ height: 9px;
750
+ width: 8px;
751
+ background: url(../images/icon_arrow.png) no-repeat 0 0;
752
+ }
753
+
754
+ /* ColorPicker */
755
+ .colorpicker {
756
+ width: 342px;
757
+ height: 170px;
758
+ overflow: hidden;
759
+ position: absolute;
760
+ background: #fafafa url(../images/colorpicker/color_bg.png);
761
+ font-family: Arial, Helvetica, sans-serif;
762
+ display: none;
763
+ border: 1px solid #ccc;
764
+ border-color: #ddd #bbb #bbb #ddd;
765
+ -moz-border-radius: 4px;
766
+ -webkit-border-radius: 4px;
767
+ border-radius: 4px;
768
+ z-index: 100;
769
+ }
770
+ .colorpicker_color {
771
+ width: 150px;
772
+ height: 150px;
773
+ left: 10px;
774
+ top: 10px;
775
+ position: absolute;
776
+ background: #f00;
777
+ overflow: hidden;
778
+ cursor: crosshair;
779
+ }
780
+ .colorpicker_color div {
781
+ position: absolute;
782
+ top: 0;
783
+ left: 0;
784
+ width: 150px;
785
+ height: 150px;
786
+ background: url(../images/colorpicker/color_overlay.png);
787
+ }
788
+ .colorpicker_color div div {
789
+ position: absolute;
790
+ top: 0;
791
+ left: 0;
792
+ width: 11px;
793
+ height: 11px;
794
+ overflow: hidden;
795
+ background: url(../images/colorpicker/color_select.gif);
796
+ margin: -5px 0 0 -5px;
797
+ }
798
+ .colorpicker_hue {
799
+ position: absolute;
800
+ top: 10px;
801
+ left: 164px;
802
+ width: 35px;
803
+ height: 150px;
804
+ cursor: n-resize;
805
+ }
806
+ .colorpicker_hue div {
807
+ position: absolute;
808
+ width: 35px;
809
+ height: 9px;
810
+ overflow: hidden;
811
+ background: url(../images/colorpicker/color_indicator.png) left top;
812
+ margin: -5px 0 0 0;
813
+ }
814
+ .colorpicker_new_color {
815
+ position: absolute;
816
+ width: 60px;
817
+ height: 30px;
818
+ right: 80px;
819
+ top: 10px;
820
+ background: #f00;
821
+ }
822
+ .colorpicker_current_color {
823
+ position: absolute;
824
+ width: 60px;
825
+ height: 30px;
826
+ right: 10px;
827
+ top: 10px;
828
+ background: #f00;
829
+ }
830
+ .colorpicker input {
831
+ background-color: transparent;
832
+ border: 1px solid transparent;
833
+ position: absolute;
834
+ font-size: 10px;
835
+ font-family: Arial, Helvetica, sans-serif;
836
+ color: #666;
837
+ top: 6px;
838
+ right: 11px;
839
+ text-align: right;
840
+ margin: 0;
841
+ padding: 0;
842
+ height: 11px;
843
+ }
844
+ .colorpicker_hex {
845
+ position: absolute;
846
+ width: 72px;
847
+ height: 22px;
848
+ background: url(../images/colorpicker/color_hex.png) top;
849
+ left: 201px;
850
+ bottom: 9px;
851
+ }
852
+ .colorpicker_hex input {
853
+ right: 6px;
854
+ }
855
+ .colorpicker_field {
856
+ height: 22px;
857
+ width: 62px;
858
+ background-position: top;
859
+ position: absolute;
860
+ }
861
+ .colorpicker_field span {
862
+ position: absolute;
863
+ width: 12px;
864
+ height: 22px;
865
+ overflow: hidden;
866
+ top: 0;
867
+ right: 0;
868
+ cursor: n-resize;
869
+ }
870
+ .colorpicker_rgb_r {
871
+ background-image: url(../images/colorpicker/color_rgb_r.png);
872
+ top: 49px;
873
+ left: 201px;
874
+ }
875
+ .colorpicker_rgb_g {
876
+ background-image: url(../images/colorpicker/color_rgb_g.png);
877
+ top: 79px;
878
+ left: 201px;
879
+ }
880
+ .colorpicker_rgb_b {
881
+ background-image: url(../images/colorpicker/color_rgb_b.png);
882
+ top: 109px;
883
+ left: 201px;
884
+ }
885
+ .colorpicker_hsb_h {
886
+ background-image: url(../images/colorpicker/color_hsb_h.png);
887
+ top: 49px;
888
+ right: 9px;
889
+ }
890
+ .colorpicker_hsb_s {
891
+ background-image: url(../images/colorpicker/color_hsb_s.png);
892
+ top: 79px;
893
+ right: 9px;
894
+ }
895
+ .colorpicker_hsb_b {
896
+ background-image: url(../images/colorpicker/color_hsb_b.png);
897
+ top: 109px;
898
+ right: 9px;
899
+ }
900
+ .colorpicker_submit {
901
+ position: absolute;
902
+ width: 16px;
903
+ height: 16px;
904
+ background: url(../images/colorpicker/color_wheel.png) top;
905
+ right: 10px;
906
+ bottom: 10px;
907
+ overflow: hidden;
908
+ }
909
+ .colorpicker_focus {
910
+ background-position: center;
911
+ }
912
+ .colorpicker_hex.colorpicker_focus {
913
+ background-position: bottom;
914
+ }
915
+ .colorpicker_submit.colorpicker_focus {
916
+ background-position: bottom;
917
+ }
918
+ .colorpicker_slider {
919
+ background-position: bottom;
920
+ }
921
+
922
+ /* file input */
923
+ div.file_wrap {
924
+ position: relative;
925
+ float: left;
926
+ width: 345px;
927
+ }
928
+ div.fake_file {
929
+ position: absolute;
930
+ top: 0px;
931
+ left: 0px;
932
+ z-index: 1;
933
+ }
934
+ div.fake_file input.upload {
935
+ margin-right: 3px;
936
+ width: 279px !important;
937
+ }
938
+ input.file {
939
+ background: none;
940
+ position: relative;
941
+ text-align: right;
942
+ float: right;
943
+ height: 28px;
944
+ -moz-opacity: 0;
945
+ filter: alpha(opacity: 0);
946
+ opacity: 0;
947
+ z-index: 2;
948
+ }
assets/images/black_px.png ADDED
Binary file
assets/images/btn.png ADDED
Binary file
assets/images/colorpicker/color_bg.png CHANGED
Binary file
assets/images/empty.gif ADDED
Binary file
assets/images/header.png ADDED
Binary file
assets/images/header_classic.png ADDED
Binary file
assets/images/icon_add.png ADDED
Binary file
assets/images/icon_arrow.png ADDED
Binary file
assets/images/icon_classic.png ADDED
Binary file
assets/images/icon_dark.png ADDED
Binary file
assets/images/icon_delete.png ADDED
Binary file
assets/images/icon_edit.png ADDED
Binary file
assets/images/icon_error.png ADDED
Binary file
assets/images/icon_header.png ADDED
Binary file
assets/images/icon_option.png ADDED
Binary file
assets/images/icon_option_classic.png ADDED
Binary file
assets/images/icon_up_down.png ADDED
Binary file
assets/images/layout/dual-sidebar.png DELETED
Binary file
assets/images/layout/full-width.png DELETED
Binary file
assets/images/layout/left-dual-sidebar.png DELETED
Binary file
assets/images/layout/left-sidebar.png DELETED
Binary file
assets/images/layout/right-dual-sidebar.png DELETED
Binary file
assets/images/layout/right-sidebar.png DELETED
Binary file
assets/images/logo_classic.png ADDED
Binary file
assets/images/logo_dark.png ADDED
Binary file
assets/images/ot-dots.png DELETED
Binary file
assets/images/ot-logo-mini.png DELETED
Binary file
assets/images/ot-logo.png DELETED
Binary file
assets/images/ot-menu-bg.png DELETED
Binary file
assets/images/ot-menu-top-bg.png DELETED
Binary file
assets/images/ot-select-hover.png DELETED
Binary file
assets/images/ot-select.png DELETED
Binary file
assets/images/ot-sub-header-bg.png DELETED
Binary file
assets/images/ot-ui-light-sprite.png DELETED
Binary file
assets/images/ot-ui-sprite.png DELETED
Binary file
assets/images/{ot-pre-bg.gif → pre_bg.gif} RENAMED
File without changes
assets/images/pre_classic_bg.gif ADDED
Binary file
assets/images/select.png ADDED
Binary file
assets/images/tabs_bg.png ADDED
Binary file
assets/images/tabs_bg_classic.png ADDED
Binary file
assets/images/toggle_tabs.png ADDED
Binary file
assets/images/white_px.png ADDED
Binary file
assets/js/{ot-colorpicker.js → jquery.color.picker.js} RENAMED
@@ -1,8 +1,10 @@
1
  /**
 
2
  * Color picker
3
  * Author: Stefan Petre www.eyecon.ro
4
  *
5
  * Dependencies: jQuery
 
6
  */
7
  (function ($) {
8
  var ColorPicker = function () {
@@ -11,7 +13,7 @@
11
  inAction,
12
  charMin = 65,
13
  visible,
14
- tpl = '<div class="ot_colorpicker colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
15
  defaults = {
16
  eventName: 'click',
17
  onShow: function () {},
@@ -450,4 +452,4 @@
450
  ColorPickerShow: ColorPicker.show,
451
  ColorPickerSetColor: ColorPicker.setColor
452
  });
453
- })(jQuery);
1
  /**
2
+ *
3
  * Color picker
4
  * Author: Stefan Petre www.eyecon.ro
5
  *
6
  * Dependencies: jQuery
7
+ *
8
  */
9
  (function ($) {
10
  var ColorPicker = function () {
13
  inAction,
14
  charMin = 65,
15
  visible,
16
+ tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
17
  defaults = {
18
  eventName: 'click',
19
  onShow: function () {},
452
  ColorPickerShow: ColorPicker.show,
453
  ColorPickerSetColor: ColorPicker.setColor
454
  });
455
+ })(jQuery)
assets/js/jquery.option.tree.js ADDED
@@ -0,0 +1,752 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * Author: Derek Herman
4
+ * URL: http://valendesigns.com
5
+ * Email: derek@valendesigns.com
6
+ *
7
+ */
8
+
9
+ /**
10
+ *
11
+ * Delay
12
+ *
13
+ * Creates a way to delay events
14
+ * Dependencies: jQuery
15
+ *
16
+ */
17
+ (function ($) {
18
+ $.fn.delay = function(time,func){
19
+ return this.each(function(){
20
+ setTimeout(func,time);
21
+ });
22
+ };
23
+ })(jQuery);
24
+
25
+ /**
26
+ *
27
+ * Center AJAX
28
+ *
29
+ * Creates a way to center the AJAX message
30
+ * Dependencies: jQuery
31
+ *
32
+ */
33
+ (function ($) {
34
+ $.fn.ajaxMessage = function(html){
35
+ if (html) {
36
+ return $(this).animate({"top":( $(window).height() - $(this).height() ) / 2 - 200 + $(window).scrollTop() + "px"},100).fadeIn('fast').html(html).delay(3000, function(){$('.ajax-message').fadeOut()});
37
+ } else {
38
+ return $(this).animate({"top":( $(window).height() - $(this).height() ) / 2 - 200 + $(window).scrollTop() + "px"},100).fadeIn('fast').delay(3000, function(){$('.ajax-message').fadeOut()});
39
+ }
40
+ };
41
+ })(jQuery);
42
+
43
+ /**
44
+ *
45
+ * Style File
46
+ *
47
+ * Creates a way to cover file input with a better styled version
48
+ * Dependencies: jQuery
49
+ *
50
+ */
51
+ (function ($) {
52
+ styleFile = {
53
+ init: function () {
54
+ $('input.file').each(function(){
55
+ var uploadbutton = '<input class="upload_file_button" type="button" value="Upload" />';
56
+ $(this).wrap('<div class="file_wrap" />');
57
+ $(this).addClass('file').css('opacity', 0); //set to invisible
58
+ $(this).parent().append($('<div class="fake_file" />').append($('<input type="text" class="upload" />').attr('id',$(this).attr('id')+'_file')).append(uploadbutton));
59
+
60
+ $(this).bind('change', function() {
61
+ $('#'+$(this).attr('id')+'_file').val($(this).val());;
62
+ });
63
+ $(this).bind('mouseout', function() {
64
+ $('#'+$(this).attr('id')+'_file').val($(this).val());;
65
+ });
66
+ });
67
+ }
68
+ };
69
+ $(document).ready(function () {
70
+ styleFile.init()
71
+ })
72
+ })(jQuery);
73
+
74
+ /**
75
+ *
76
+ * Style Select
77
+ *
78
+ * Replace Select text
79
+ * Dependencies: jQuery
80
+ *
81
+ */
82
+ (function ($) {
83
+ styleSelect = {
84
+ init: function () {
85
+ $('.select_wrapper').each(function () {
86
+ $(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>');
87
+ });
88
+ $('.select').live('change', function () {
89
+ $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
90
+ });
91
+ $('.select').bind($.browser.msie ? 'click' : 'change', function(event) {
92
+ $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
93
+ });
94
+ }
95
+ };
96
+ $(document).ready(function () {
97
+ styleSelect.init()
98
+ })
99
+ })(jQuery);
100
+
101
+ /**
102
+ *
103
+ * Activate Tabs
104
+ *
105
+ * Tab style UI toggle
106
+ * Dependencies: jQuery, jQuery UI Core, jQuery UI Tabs
107
+ *
108
+ */
109
+ (function ($) {
110
+ activateTabs = {
111
+ init: function () {
112
+ // Activate
113
+ $("#options_tabs").tabs();
114
+ // Append Toggle Button
115
+ $('.top-info').append('<a href="" class="toggle_tabs">Tabs</a>');
116
+ // Toggle Tabs
117
+ $('.toggle_tabs').toggle(function() {
118
+ $("#options_tabs").tabs('destroy');
119
+ $(this).addClass('off');
120
+ }, function() {
121
+ $("#options_tabs").tabs();
122
+ $(this).removeClass('off');
123
+ });
124
+ }
125
+ };
126
+ $(document).ready(function () {
127
+ activateTabs.init()
128
+ })
129
+ })(jQuery);
130
+
131
+ /**
132
+ *
133
+ * Upload Option
134
+ *
135
+ * Allows window.send_to_editor to function properly using a private post_id
136
+ * Dependencies: jQuery, Media Upload, Thickbox
137
+ *
138
+ */
139
+ (function ($) {
140
+ uploadOption = {
141
+ init: function () {
142
+ var formfield,
143
+ formID,
144
+ btnContent = true;
145
+ // On Click
146
+ $('.upload_button').live("click", function () {
147
+ formfield = $(this).prev('input').attr('name');
148
+ formID = $(this).attr('rel');
149
+ tb_show('', 'media-upload.php?post_id='+formID+'&type=image&amp;TB_iframe=1');
150
+ return false;
151
+ });
152
+
153
+ window.original_send_to_editor = window.send_to_editor;
154
+ window.send_to_editor = function(html) {
155
+ if (formfield) {
156
+ itemurl = $(html).attr('href');
157
+ var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi;
158
+ var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi;
159
+ var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi;
160
+ var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi;
161
+ if (itemurl.match(image)) {
162
+ btnContent = '<img src="'+itemurl+'" alt="" /><a href="" class="remove">Remove Image</a>';
163
+ } else {
164
+ btnContent = '<div class="no_image">'+html+'<a href="" class="remove">Remove</a></div>';
165
+ }
166
+ $('#' + formfield).val(itemurl);
167
+ $('#' + formfield).next().next('div').slideDown().html(btnContent);
168
+ tb_remove();
169
+ } else {
170
+ window.original_send_to_editor(html);
171
+ }
172
+ }
173
+ }
174
+ };
175
+ $(document).ready(function () {
176
+ uploadOption.init()
177
+ })
178
+ })(jQuery);
179
+
180
+ /**
181
+ *
182
+ * Inline Edit Options
183
+ *
184
+ * Creates & Updates Options via Ajax
185
+ * Dependencies: jQuery
186
+ *
187
+ */
188
+ (function ($) {
189
+ inlineEditOption = {
190
+ init: function () {
191
+ var c = this,
192
+ d = $("tr.inline-edit-option");
193
+ $('.save-options', '#the-theme-options').live("click", function () {
194
+ inlineEditOption.save_options(this);
195
+ return false;
196
+ });
197
+ $('.reset', '#the-theme-options').live("click", function () {
198
+ var agree = confirm("Are you absolutely sure you wish to delete all of your saved Theme Option?");
199
+ if (agree) {
200
+ inlineEditOption.reset_options(this);
201
+ return false;
202
+ } else {
203
+ return false;
204
+ }
205
+ });
206
+ $('.import-data', '#import-data').live("click", function () {
207
+ inlineEditOption.import_data(this);
208
+ return false;
209
+ });
210
+ $("a.edit-inline").live("click", function (event) {
211
+ if ($("a.edit-inline").hasClass('disable')) {
212
+ event.preventDefault();
213
+ return false;
214
+ } else {
215
+ inlineEditOption.edit(this);
216
+ return false;
217
+ }
218
+ });
219
+ $("a.save").live("click", function () {
220
+ if ($("a.save").hasClass('add-save')) {
221
+ inlineEditOption.addSave(this);
222
+ return false;
223
+ } else {
224
+ inlineEditOption.editSave(this);
225
+ return false;
226
+ }
227
+ });
228
+ $("a.cancel").live("click", function () {
229
+ if ($("a.cancel").hasClass('undo-add')) {
230
+ inlineEditOption.undoAdd();
231
+ return false;
232
+ } else {
233
+ inlineEditOption.revert();
234
+ return false;
235
+ }
236
+ });
237
+ $("a.add-option").live("click", function (event) {
238
+ if ($(this).hasClass('disable')) {
239
+ event.preventDefault();
240
+ return false;
241
+ } else {
242
+ $.post(
243
+ ajaxurl,
244
+ { action:'option_tree_next_id', _ajax_nonce: $("#_ajax_nonce").val() },
245
+ function (response) {
246
+ c = parseInt(response) + 1;
247
+ inlineEditOption.add(c);
248
+ }
249
+ );
250
+ return false;
251
+ }
252
+ });
253
+ $('#framework-settings').tableDnD({
254
+ onDragClass: "dragging",
255
+ onDrop: function(table, row) {
256
+ d = {
257
+ action: "option_tree_sort",
258
+ id: $.tableDnD.serialize(),
259
+ _ajax_nonce: $("#_ajax_nonce").val()
260
+ };
261
+ $.post(ajaxurl, d, function (response) {
262
+
263
+ }, "html");
264
+ }
265
+ });
266
+ $('#upload-xml').submit(function() {
267
+ var agree = confirm("Are you sure you want to import these new settings?");
268
+ if (agree) {
269
+ return true;
270
+ }
271
+ return false;
272
+ });
273
+ $('.delete-inline').live("click", function (event) {
274
+ if ($("a.delete-inline").hasClass('disable')) {
275
+ event.preventDefault();
276
+ return false;
277
+ } else {
278
+ var agree = confirm("Are you sure you want to delete this option?");
279
+ if (agree) {
280
+ inlineEditOption.remove(this);
281
+ return false;
282
+ } else {
283
+ return false;
284
+ }
285
+ }
286
+ });
287
+ // Fade out message div
288
+ if ($('.ajax-message').hasClass('show')) {
289
+ $('.ajax-message').ajaxMessage();
290
+ }
291
+ // Remove Uploaded Image
292
+ $('.remove').live('click', function(event) {
293
+ $(this).hide();
294
+ $(this).parents().prev().prev('.upload').attr('value', '');
295
+ $(this).parents('.screenshot').slideUp();
296
+ });
297
+ // Hide the delete button on the first row
298
+ $('a.delete-inline', "#option-1").hide();
299
+ },
300
+ save_options: function (e) {
301
+ var d = {
302
+ action: "option_tree_array_save"
303
+ };
304
+ b = $(':input', '#the-theme-options').serialize();
305
+ d = b + "&" + $.param(d);
306
+ $.post(ajaxurl, d, function (r) {
307
+ if (r != -1) {
308
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Theme Options were saved</div>');
309
+ } else {
310
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Theme Options could not be saved</div>');
311
+ }
312
+ });
313
+ return false;
314
+ },
315
+ reset_options: function () {
316
+ var d = {
317
+ action: "option_tree_array_reset",
318
+ _ajax_nonce: $("#_ajax_nonce").val()
319
+ };
320
+ $.post(ajaxurl, d, function (r) {
321
+ if (r != -1) {
322
+ $('.screenshot').hide();
323
+ $(':input','#the-theme-options')
324
+ .not(':button, :submit, :reset, :hidden')
325
+ .val('')
326
+ .removeAttr('checked')
327
+ .removeAttr('selected');
328
+ $('.select').each(function () {
329
+ $(this).prev('span').text('-- Choose One --')
330
+ });
331
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Theme Options were deleted</div>');
332
+ } else {
333
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Theme Options could not be deleted</div>');
334
+ }
335
+ });
336
+ return false;
337
+ },
338
+ import_data: function (e) {
339
+ var d = {
340
+ action: "option_tree_import_data"
341
+ };
342
+ b = $(':input', '#import-data').serialize();
343
+ d = b + "&" + $.param(d);
344
+ $.post(ajaxurl, d, function (r) {
345
+ if (r != -1) {
346
+ $("textarea", "#import_options").val('');
347
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Your Theme Options data was successfully imported.</div>');
348
+ } else {
349
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Your Theme Options data could not be imported.</div>');
350
+ }
351
+ });
352
+ return false;
353
+ },
354
+ remove: function (b) {
355
+ var c = true;
356
+
357
+ // Set ID
358
+ c = $(b).parents("tr:first").attr('id');
359
+ c = c.substr(c.lastIndexOf("-") + 1);
360
+
361
+ d = {
362
+ action: "option_tree_delete",
363
+ id: c,
364
+ _ajax_nonce: $("#_ajax_nonce").val()
365
+ };
366
+ $.post(ajaxurl, d, function (r) {
367
+ if (r) {
368
+ if (r == 'removed') {
369
+ $("#option-" + c).remove();
370
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Option Deleted.</div>');
371
+ } else {
372
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
373
+ }
374
+ } else {
375
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
376
+ }
377
+ });
378
+ return false;
379
+ },
380
+ add: function (c) {
381
+ var e = this,
382
+ addRow, editRow = true, temp_select;
383
+ e.revert();
384
+
385
+ // Clone the blank main row
386
+ addRow = $('#inline-add').clone(true);
387
+ addRow = $(addRow).attr('id', 'option-'+c);
388
+
389
+ // Clone the blank edit row
390
+ editRow = $('#inline-edit').clone(true);
391
+
392
+ $('a.cancel', editRow).addClass('undo-add');
393
+ $('a.save', editRow).addClass('add-save');
394
+ $('a.edit-inline').addClass('disable');
395
+ $('a.delete-inline').addClass('disable');
396
+ $('a.add-option').addClass('disable');
397
+
398
+ // Set Colspan to 4
399
+ $('td', editRow).attr('colspan', 4);
400
+
401
+ // Add Row
402
+ $("#framework-settings tr:last").after(addRow);
403
+
404
+ // Add Row and hide
405
+ $(addRow).hide().after(editRow);
406
+
407
+ $('.item-data', addRow).attr('id', 'inline_'+c);
408
+
409
+ // Show The Editor
410
+ $(editRow).attr('id', 'edit-'+c).addClass('inline-editor').show();
411
+
412
+ $('.item_title', '#edit-'+c).focus();
413
+
414
+ $('.select').each(function () {
415
+ temp_select = $(this).prev('span').text();
416
+ if (temp_select == 'Heading') {
417
+ $('.option-desc', '#edit-'+c).hide();
418
+ $('.option-options', '#edit-'+c).hide();
419
+ }
420
+ });
421
+
422
+ $('.select').live('change', function () {
423
+ temp_select = $(this).prev('span').text();
424
+ if (temp_select == 'Heading') {
425
+ $('.option-desc', '#edit-'+c).hide();
426
+ $('.option-options', '#edit-'+c).hide();
427
+ } else if (
428
+ temp_select == 'Checkbox' ||
429
+ temp_select == 'Radio' ||
430
+ temp_select == 'Select'
431
+ ) {
432
+ $('.alternative').hide();
433
+ $('.regular').show();
434
+ $('.option-desc', '#edit-'+c).show();
435
+ $('.option-options', '#edit-'+c).show();
436
+ } else {
437
+ if (temp_select == 'Textarea') {
438
+ $('.regular').hide();
439
+ $('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
440
+ $('.option-desc', '#edit-'+c).show();
441
+ $('.option-options', '#edit-'+c).show();
442
+ } else if (
443
+ temp_select == 'Custom Post' ||
444
+ temp_select == 'Custom Posts'
445
+ ) {
446
+ $('.regular').hide();
447
+ $('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
448
+ $('.option-desc', '#edit-'+c).show();
449
+ $('.option-options', '#edit-'+c).show();
450
+ } else {
451
+ $('.option-desc', '#edit-'+c).show();
452
+ $('.option-options', '#edit-'+c).hide();
453
+ }
454
+ }
455
+ });
456
+
457
+ // Scroll
458
+ $('html, body').animate({ scrollTop: 2000 }, 500);
459
+
460
+ return false;
461
+ },
462
+ undoAdd: function (b) {
463
+ var e = this,
464
+ c = true;
465
+ e.revert();
466
+ c = $("#framework-settings tr:last").attr('id');
467
+ c = c.substr(c.lastIndexOf("-") + 1);
468
+
469
+ $("a.edit-inline").removeClass('disable');
470
+ $("a.delete-inline").removeClass('disable');
471
+ $("a.add-option").removeClass('disable');
472
+ $("#option-" + c).remove();
473
+
474
+ return false;
475
+ },
476
+ addSave: function (e) {
477
+ var d, b, c, f, g, itemId;
478
+ e = $("tr.inline-editor").attr("id");
479
+ e = e.substr(e.lastIndexOf("-") + 1);
480
+ f = $("#edit-" + e);
481
+ g = $("#inline_" + e);
482
+ itemId = $.trim($("input.item_id", f).val().toLowerCase()).replace(/(\s+)/g,'_');
483
+ if (!itemId) {
484
+ itemId = $.trim($("input.item_title", f).val().toLowerCase()).replace(/(\s+)/g,'_');
485
+ }
486
+ d = {
487
+ action: "option_tree_add",
488
+ id: e,
489
+ item_id: itemId,
490
+ item_title: $("input.item_title", f).val(),
491
+ item_desc: $("textarea.item_desc", f).val(),
492
+ item_type: $("select.item_type", f).val(),
493
+ item_options: $("input.item_options", f).val()
494
+ };
495
+ b = $("#edit-" + e + " :input").serialize();
496
+ d = b + "&" + $.param(d);
497
+ $.post(ajaxurl, d, function (r) {
498
+ if (r) {
499
+ if (r == 'updated') {
500
+ inlineEditOption.afterSave(e);
501
+ $("#edit-" + e).remove();
502
+ $("#option-" + e).show();
503
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Option Added.</div>');
504
+ $('#framework-settings').tableDnD({
505
+ onDragClass: "dragging",
506
+ onDrop: function(table, row) {
507
+ d = {
508
+ action: "option_tree_sort",
509
+ id: $.tableDnD.serialize(),
510
+ _ajax_nonce: $("#_ajax_nonce").val()
511
+ };
512
+ $.post(ajaxurl, d, function (response) {
513
+
514
+ }, "html");
515
+ }
516
+ });
517
+ } else {
518
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
519
+ }
520
+ } else {
521
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
522
+ }
523
+ });
524
+ return false;
525
+ },
526
+ edit: function (b) {
527
+ var e = this,
528
+ c, editRow, rowData, item_title, item_id, item_type, item_desc, item_options = true, temp_select;
529
+ e.revert();
530
+
531
+ c = $(b).parents("tr:first").attr('id');
532
+ c = c.substr(c.lastIndexOf("-") + 1);
533
+
534
+ // Clone the blank row
535
+ editRow = $('#inline-edit').clone(true);
536
+ $('td', editRow).attr('colspan', 4);
537
+ $("#option-" + c).hide().after(editRow);
538
+
539
+ // First Option Settings
540
+ if ("#option-" + c == '#option-1') {
541
+ $('.option').hide();
542
+ $('.option-title').show().css({"paddingBottom":"1px"});
543
+ $('.description', editRow).html('First item must be a heading.');
544
+ }
545
+
546
+ // Populate the option data
547
+ rowData = $('#inline_' + c);
548
+
549
+ // Item Title
550
+ item_title = $('.item_title', rowData).text();
551
+ $('.item_title', editRow).attr('value', item_title);
552
+
553
+ // Item ID
554
+ item_id = $('.item_id', rowData).text();
555
+ $('.item_id', editRow).attr('value', item_id);
556
+
557
+ // Item Type
558
+ item_type = $('.item_type', rowData).text();
559
+ $('select[name=item_type] option[value='+item_type+']', editRow).attr('selected', true);
560
+ var temp_item_type = $('select[name=item_type] option[value='+item_type+']', editRow).text();
561
+ $('.select_wrapper span', editRow).text(temp_item_type);
562
+
563
+ // Item Description
564
+ item_desc = $('.item_desc', rowData).text();
565
+ $('.item_desc', editRow).attr('value', item_desc);
566
+
567
+ // Item Options
568
+ item_options = $('.item_options', rowData).text();
569
+ $('.item_options', editRow).attr('value', item_options);
570
+
571
+
572
+ $('.select', editRow).each(function () {
573
+ temp_select = $(this).prev('span').text();
574
+ if (temp_select == 'Heading') {
575
+ $('.option-desc', editRow).hide();
576
+ $('.option-options', editRow).hide();
577
+ } else if (
578
+ temp_select == 'Checkbox' ||
579
+ temp_select == 'Radio' ||
580
+ temp_select == 'Select'
581
+ ) {
582
+ $('.option-desc', editRow).show();
583
+ $('.option-options', editRow).show();
584
+ } else {
585
+ if (temp_select == 'Textarea') {
586
+ $('.regular').hide();
587
+ $('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
588
+ $('.option-desc', editRow).show();
589
+ $('.option-options', editRow).show();
590
+ } else if (
591
+ temp_select == 'Custom Post' ||
592
+ temp_select == 'Custom Posts'
593
+ ) {
594
+ $('.regular').hide();
595
+ $('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
596
+ $('.option-desc', editRow).show();
597
+ $('.option-options', editRow).show();
598
+ } else {
599
+ $('.option-desc', editRow).show();
600
+ $('.option-options', editRow).hide();
601
+ }
602
+ }
603
+ });
604
+
605
+ $('.select').live('change', function () {
606
+ temp_select = $(this).prev('span').text();
607
+ if (temp_select == 'Heading') {
608
+ $('.option-desc', editRow).hide();
609
+ $('.option-options', editRow).hide();
610
+ } else if (
611
+ temp_select == 'Checkbox' ||
612
+ temp_select == 'Radio' ||
613
+ temp_select == 'Select'
614
+ ) {
615
+ $('.alternative').hide();
616
+ $('.regular').show();
617
+ $('.option-desc', editRow).show();
618
+ $('.option-options', editRow).show();
619
+ } else {
620
+ if (temp_select == 'Textarea') {
621
+ $('.regular').hide();
622
+ $('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
623
+ $('.option-desc', editRow).show();
624
+ $('.option-options', editRow).show();
625
+ } else if (
626
+ temp_select == 'Custom Post' ||
627
+ temp_select == 'Custom Posts'
628
+ ) {
629
+ $('.regular').hide();
630
+ $('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
631
+ $('.option-desc', editRow).show();
632
+ $('.option-options', editRow).show();
633
+ } else {
634
+ $('.option-desc', editRow).show();
635
+ $('.option-options', editRow).hide();
636
+ }
637
+ }
638
+ });
639
+
640
+ // Show The Editor
641
+ $(editRow).attr('id', 'edit-'+c).addClass('inline-editor').show();
642
+
643
+ // Scroll
644
+ var target = $('#edit-'+c);
645
+ if (c > 1) {
646
+ var top = target.offset().top;
647
+ $('html,body').animate({scrollTop: top}, 500);
648
+ return false;
649
+ }
650
+
651
+ return false;
652
+ },
653
+ editSave: function (e) {
654
+ var d, b, c, f, g, itemId;
655
+ e = $("tr.inline-editor").attr("id");
656
+ e = e.substr(e.lastIndexOf("-") + 1);
657
+ f = $("#edit-" + e);
658
+ g = $("#inline_" + e);
659
+ itemId = $.trim($("input.item_id", f).val().toLowerCase()).replace(/(\s+)/g,'_');
660
+ if (!itemId) {
661
+ itemId = $.trim($("input.item_title", f).val().toLowerCase()).replace(/(\s+)/g,'_');
662
+ }
663
+ d = {
664
+ action: "option_tree_edit",
665
+ id: e,
666
+ item_id: itemId,
667
+ item_title: $("input.item_title", f).val(),
668
+ item_desc: $("textarea.item_desc", f).val(),
669
+ item_type: $("select.item_type", f).val(),
670
+ item_options: $("input.item_options", f).val()
671
+ };
672
+ b = $("#edit-" + e + " :input").serialize();
673
+ d = b + "&" + $.param(d);
674
+ $.post(ajaxurl, d, function (r) {
675
+ if (r) {
676
+ if (r == 'updated') {
677
+ inlineEditOption.afterSave(e);
678
+ $("#edit-" + e).remove();
679
+ $("#option-" + e).show();
680
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Option Saved.</div>');
681
+ } else {
682
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
683
+ }
684
+ } else {
685
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
686
+ }
687
+ });
688
+ return false;
689
+ },
690
+ afterSave: function (e) {
691
+ var x, y, z,
692
+ n, m, o, p, q, r = true;
693
+ x = $("#edit-" + e);
694
+ y = $("#option-" + e);
695
+ z = $("#inline_" + e);
696
+ $('.option').show();
697
+ $('a.cancel', x).removeClass('undo-add');
698
+ $('a.save', x).removeClass('add-save');
699
+ $("a.add-option").removeClass('disable');
700
+ $('a.edit-inline').removeClass('disable');
701
+ $('a.delete-inline').removeClass('disable');
702
+ if (n = $("input.item_title", x).val()) {
703
+ if ($("select.item_type", x).val() != 'heading') {
704
+ $(y).removeClass('col-heading');
705
+ $('.col-title', y).attr('colspan', 1);
706
+ $(".col-key", y).show();
707
+ $(".col-type", y).show();
708
+ $(".col-title", y).text('- ' + n);
709
+ } else {
710
+ $(y).addClass('col-heading');
711
+ $('.col-title', y).attr('colspan', 3);
712
+ $(".col-key", y).hide();
713
+ $(".col-type", y).hide();
714
+ $(".col-title", y).text(n);
715
+ }
716
+ $(".item_title", z).text(n);
717
+ }
718
+ if (m = $.trim($("input.item_id", x).val().toLowerCase()).replace(/(\s+)/g,'_')) {
719
+ $(".col-key", y).text(m);
720
+ $(".item_id", z).text(m);
721
+ } else {
722
+ m = $.trim($("input.item_title", x).val().toLowerCase()).replace(/(\s+)/g,'_');
723
+ $(".col-key", y).text(m);
724
+ $(".item_id", z).text(m);
725
+ }
726
+ if (o = $("select.item_type option:selected", x).val()) {
727
+ $(".col-type", y).text(o);
728
+ $(".item_type", z).text(o);
729
+ }
730
+ if (p = $("textarea.item_desc", x).val()) {
731
+ $(".item_desc", z).text(p);
732
+ }
733
+ if (r = $("input.item_options", x).val()) {
734
+ $(".item_options", z).text(r);
735
+ }
736
+ },
737
+ revert: function () {
738
+ var b,
739
+ n, m, o, p, q, r = true;
740
+ if (b = $(".inline-editor").attr("id")) {
741
+ $('#'+ b).remove();
742
+ b = b.substr(b.lastIndexOf("-") + 1);
743
+ $('.option').show();
744
+ $("#option-" + b).show();
745
+ }
746
+ return false;
747
+ }
748
+ };
749
+ $(document).ready(function () {
750
+ inlineEditOption.init()
751
+ })
752
+ })(jQuery);
assets/js/jquery.table.dnd.js ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TableDnD plug-in for JQuery, allows you to drag and drop table rows
3
+ * You can set up various options to control how the system will work
4
+ * Copyright (c) Denis Howlett <denish@isocra.com>
5
+ * Licensed like jQuery, see http://docs.jquery.com/License.
6
+ *
7
+ * Configuration options:
8
+ *
9
+ * onDragStyle
10
+ * This is the style that is assigned to the row during drag. There are limitations to the styles that can be
11
+ * associated with a row (such as you can't assign a border--well you can, but it won't be
12
+ * displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
13
+ * a map (as used in the jQuery css(...) function).
14
+ * onDropStyle
15
+ * This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
16
+ * to what you can do. Also this replaces the original style, so again consider using onDragClass which
17
+ * is simply added and then removed on drop.
18
+ * onDragClass
19
+ * This class is added for the duration of the drag and then removed when the row is dropped. It is more
20
+ * flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
21
+ * is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
22
+ * stylesheet.
23
+ * onDrop
24
+ * Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
25
+ * and the row that was dropped. You can work out the new order of the rows by using
26
+ * table.rows.
27
+ * onDragStart
28
+ * Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
29
+ * table and the row which the user has started to drag.
30
+ * onAllowDrop
31
+ * Pass a function that will be called as a row is over another row. If the function returns true, allow
32
+ * dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
33
+ * the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
34
+ * scrollAmount
35
+ * This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
36
+ * window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
37
+ * FF3 beta
38
+ * dragHandle
39
+ * This is the name of a class that you assign to one or more cells in each row that is draggable. If you
40
+ * specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
41
+ * will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
42
+ * the whole row is draggable.
43
+ *
44
+ * Other ways to control behaviour:
45
+ *
46
+ * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
47
+ * that you don't want to be draggable.
48
+ *
49
+ * Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
50
+ * <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
51
+ * an ID as must all the rows.
52
+ *
53
+ * Other methods:
54
+ *
55
+ * $("...").tableDnDUpdate()
56
+ * Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
57
+ * This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
58
+ * The table maintains the original configuration (so you don't have to specify it again).
59
+ *
60
+ * $("...").tableDnDSerialize()
61
+ * Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
62
+ * called from anywhere and isn't dependent on the currentTable being set up correctly before calling
63
+ *
64
+ * Known problems:
65
+ * - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
66
+ *
67
+ * Version 0.2: 2008-02-20 First public version
68
+ * Version 0.3: 2008-02-07 Added onDragStart option
69
+ * Made the scroll amount configurable (default is 5 as before)
70
+ * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
71
+ * Added onAllowDrop to control dropping
72
+ * Fixed a bug which meant that you couldn't set the scroll amount in both directions
73
+ * Added serialize method
74
+ * Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
75
+ * draggable
76
+ * Improved the serialize method to use a default (and settable) regular expression.
77
+ * Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
78
+ */
79
+ jQuery.tableDnD = {
80
+ /** Keep hold of the current table being dragged */
81
+ currentTable : null,
82
+ /** Keep hold of the current drag object if any */
83
+ dragObject: null,
84
+ /** The current mouse offset */
85
+ mouseOffset: null,
86
+ /** Remember the old value of Y so that we don't do too much processing */
87
+ oldY: 0,
88
+
89
+ /** Actually build the structure */
90
+ build: function(options) {
91
+ // Set up the defaults if any
92
+
93
+ this.each(function() {
94
+ // This is bound to each matching table, set up the defaults and override with user options
95
+ this.tableDnDConfig = jQuery.extend({
96
+ onDragStyle: null,
97
+ onDropStyle: null,
98
+ // Add in the default class for whileDragging
99
+ onDragClass: "tDnD_whileDrag",
100
+ onDrop: null,
101
+ onDragStart: null,
102
+ scrollAmount: 5,
103
+ serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
104
+ serializeParamName: null, // If you want to specify another parameter name instead of the table ID
105
+ dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
106
+ }, options || {});
107
+ // Now make the rows draggable
108
+ jQuery.tableDnD.makeDraggable(this);
109
+ });
110
+
111
+ // Now we need to capture the mouse up and mouse move event
112
+ // We can use bind so that we don't interfere with other event handlers
113
+ jQuery(document)
114
+ .bind('mousemove', jQuery.tableDnD.mousemove)
115
+ .bind('mouseup', jQuery.tableDnD.mouseup);
116
+
117
+ // Don't break the chain
118
+ return this;
119
+ },
120
+
121
+ /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
122
+ makeDraggable: function(table) {
123
+ var config = table.tableDnDConfig;
124
+ if (table.tableDnDConfig.dragHandle) {
125
+ // We only need to add the event to the specified cells
126
+ var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
127
+ cells.each(function() {
128
+ // The cell is bound to "this"
129
+ jQuery(this).mousedown(function(ev) {
130
+ jQuery.tableDnD.dragObject = this.parentNode;
131
+ jQuery.tableDnD.currentTable = table;
132
+ jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
133
+ if (config.onDragStart) {
134
+ // Call the onDrop method if there is one
135
+ config.onDragStart(table, this);
136
+ }
137
+ return false;
138
+ });
139
+ })
140
+ } else {
141
+ // For backwards compatibility, we add the event to the whole row
142
+ var rows = jQuery("tr", table); // get all the rows as a wrapped set
143
+ rows.each(function() {
144
+ // Iterate through each row, the row is bound to "this"
145
+ var row = jQuery(this);
146
+ if (! row.hasClass("nodrag")) {
147
+ row.mousedown(function(ev) {
148
+ if (ev.target.tagName == "TD") {
149
+ jQuery.tableDnD.dragObject = this;
150
+ jQuery.tableDnD.currentTable = table;
151
+ jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
152
+ if (config.onDragStart) {
153
+ // Call the onDrop method if there is one
154
+ config.onDragStart(table, this);
155
+ }
156
+ return false;
157
+ }
158
+ }).css("cursor", "move"); // Store the tableDnD object
159
+ }
160
+ });
161
+ }
162
+ },
163
+
164
+ updateTables: function() {
165
+ this.each(function() {
166
+ // this is now bound to each matching table
167
+ if (this.tableDnDConfig) {
168
+ jQuery.tableDnD.makeDraggable(this);
169
+ }
170
+ })
171
+ },
172
+
173
+ /** Get the mouse coordinates from the event (allowing for browser differences) */
174
+ mouseCoords: function(ev){
175
+ if(ev.pageX || ev.pageY){
176
+ return {x:ev.pageX, y:ev.pageY};
177
+ }
178
+ return {
179
+ x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
180
+ y:ev.clientY + document.body.scrollTop - document.body.clientTop
181
+ };
182
+ },
183
+
184
+ /** Given a target element and a mouse event, get the mouse offset from that element.
185
+ To do this we need the element's position and the mouse position */
186
+ getMouseOffset: function(target, ev) {
187
+ ev = ev || window.event;
188
+
189
+ var docPos = this.getPosition(target);
190
+ var mousePos = this.mouseCoords(ev);
191
+ return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
192
+ },
193
+
194
+ /** Get the position of an element by going up the DOM tree and adding up all the offsets */
195
+ getPosition: function(e){
196
+ var left = 0;
197
+ var top = 0;
198
+ /** Safari fix -- thanks to Luis Chato for this! */
199
+ if (e.offsetHeight == 0) {
200
+ /** Safari 2 doesn't correctly grab the offsetTop of a table row
201
+ this is detailed here:
202
+ http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
203
+ the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
204
+ note that firefox will return a text node as a first child, so designing a more thorough
205
+ solution may need to take that into account, for now this seems to work in firefox, safari, ie */
206
+ e = e.firstChild; // a table cell
207
+ }
208
+
209
+ while (e.offsetParent){
210
+ left += e.offsetLeft;
211
+ top += e.offsetTop;
212
+ e = e.offsetParent;
213
+ }
214
+
215
+ left += e.offsetLeft;
216
+ top += e.offsetTop;
217
+
218
+ return {x:left, y:top};
219
+ },
220
+
221
+ mousemove: function(ev) {
222
+ if (jQuery.tableDnD.dragObject == null) {
223
+ return;
224
+ }
225
+
226
+ var dragObj = jQuery(jQuery.tableDnD.dragObject);
227
+ var config = jQuery.tableDnD.currentTable.tableDnDConfig;
228
+ var mousePos = jQuery.tableDnD.mouseCoords(ev);
229
+ var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
230
+ //auto scroll the window
231
+ var yOffset = window.pageYOffset;
232
+ if (document.all) {
233
+ // Windows version
234
+ //yOffset=document.body.scrollTop;
235
+ if (typeof document.compatMode != 'undefined' &&
236
+ document.compatMode != 'BackCompat') {
237
+ yOffset = document.documentElement.scrollTop;
238
+ }
239
+ else if (typeof document.body != 'undefined') {
240
+ yOffset=document.body.scrollTop;
241
+ }
242
+
243
+ }
244
+
245
+ if (mousePos.y-yOffset < config.scrollAmount) {
246
+ window.scrollBy(0, -config.scrollAmount);
247
+ } else {
248
+ var windowHeight = window.innerHeight ? window.innerHeight
249
+ : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
250
+ if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
251
+ window.scrollBy(0, config.scrollAmount);
252
+ }
253
+ }
254
+
255
+
256
+ if (y != jQuery.tableDnD.oldY) {
257
+ // work out if we're going up or down...
258
+ var movingDown = y > jQuery.tableDnD.oldY;
259
+ // update the old value
260
+ jQuery.tableDnD.oldY = y;
261
+ // update the style to show we're dragging
262
+ if (config.onDragClass) {
263
+ dragObj.addClass(config.onDragClass);
264
+ } else {
265
+ dragObj.css(config.onDragStyle);
266
+ }
267
+ // If we're over a row then move the dragged row to there so that the user sees the
268
+ // effect dynamically
269
+ var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
270
+ if (currentRow) {
271
+ // TODO worry about what happens when there are multiple TBODIES
272
+ if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
273
+ jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
274
+ } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
275
+ jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
276
+ }
277
+ }
278
+ }
279
+
280
+ return false;
281
+ },
282
+
283
+ /** We're only worried about the y position really, because we can only move rows up and down */
284
+ findDropTargetRow: function(draggedRow, y) {
285
+ var rows = jQuery.tableDnD.currentTable.rows;
286
+ for (var i=0; i<rows.length; i++) {
287
+ var row = rows[i];
288
+ var rowY = this.getPosition(row).y;
289
+ var rowHeight = parseInt(row.offsetHeight)/2;
290
+ if (row.offsetHeight == 0) {
291
+ rowY = this.getPosition(row.firstChild).y;
292
+ rowHeight = parseInt(row.firstChild.offsetHeight)/2;
293
+ }
294
+ // Because we always have to insert before, we need to offset the height a bit
295
+ if ((y > rowY - rowHeight) && (y < (rowY + rowHeight + rowHeight))) {
296
+ // that's the row we're over
297
+ // If it's the same as the current row, ignore it
298
+ if (row == draggedRow) {return null;}
299
+ var config = jQuery.tableDnD.currentTable.tableDnDConfig;
300
+ if (config.onAllowDrop) {
301
+ if (config.onAllowDrop(draggedRow, row)) {
302
+ return row;
303
+ } else {
304
+ return null;
305
+ }
306
+ } else {
307
+ // If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
308
+ var nodrop = jQuery(row).hasClass("nodrop");
309
+ if (! nodrop) {
310
+ return row;
311
+ } else {
312
+ return null;
313
+ }
314
+ }
315
+ return row;
316
+ }
317
+ }
318
+ return null;
319
+ },
320
+
321
+ mouseup: function(e) {
322
+ if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
323
+ var droppedRow = jQuery.tableDnD.dragObject;
324
+ var config = jQuery.tableDnD.currentTable.tableDnDConfig;
325
+ // If we have a dragObject, then we need to release it,
326
+ // The row will already have been moved to the right place so we just reset stuff
327
+ if (config.onDragClass) {
328
+ jQuery(droppedRow).removeClass(config.onDragClass);
329
+ } else {
330
+ jQuery(droppedRow).css(config.onDropStyle);
331
+ }
332
+ jQuery.tableDnD.dragObject = null;
333
+ if (config.onDrop) {
334
+ // Call the onDrop method if there is one
335
+ config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
336
+ }
337
+ jQuery.tableDnD.currentTable = null; // let go of the table too
338
+ }
339
+ },
340
+
341
+ serialize: function() {
342
+ if (jQuery.tableDnD.currentTable) {
343
+ return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
344
+ } else {
345
+ return "Error: No Table id set, you need to set an id on your table and every row";
346
+ }
347
+ },
348
+
349
+ serializeTable: function(table) {
350
+ var result = "";
351
+ var tableId = table.id;
352
+ var rows = table.rows;
353
+ for (var i=0; i<rows.length; i++) {
354
+ if (result.length > 0) result += "&";
355
+ var rowId = rows[i].id;
356
+ if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
357
+ rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
358
+ }
359
+
360
+ result += tableId + '[]=' + rowId;
361
+ }
362
+ return result;
363
+ },
364
+
365
+ serializeTables: function() {
366
+ var result = "";
367
+ this.each(function() {
368
+ // this is now bound to each matching table
369
+ result += jQuery.tableDnD.serializeTable(this);
370
+ });
371
+ return result;
372
+ }
373
+
374
+ }
375
+
376
+ jQuery.fn.extend(
377
+ {
378
+ tableDnD : jQuery.tableDnD.build,
379
+ tableDnDUpdate : jQuery.tableDnD.updateTables,
380
+ tableDnDSerialize: jQuery.tableDnD.serializeTables
381
+ }
382
+ );
assets/js/ot-admin.js DELETED
@@ -1,538 +0,0 @@
1
- /**
2
- * Option Tree UI
3
- *
4
- * Dependencies: jQuery, jQuery UI, ColorPicker
5
- *
6
- * @author Derek Herman (derek@valendesigns.com)
7
- */
8
- ;(function($) {
9
- OT_UI = {
10
- processing: false,
11
- init: function() {
12
- this.init_hide_body();
13
- this.init_sortable();
14
- this.init_add();
15
- this.init_edit();
16
- this.init_remove();
17
- this.init_edit_title()
18
- this.init_edit_id();
19
- this.init_activate_layout();
20
- this.init_upload();
21
- this.init_upload_remove();
22
- this.init_numeric_slider();
23
- this.init_tabs();
24
- this.init_radio_image_select();
25
- this.init_select_wrapper();
26
- this.fix_upload_parent();
27
- this.fix_colorpicker();
28
- this.fix_textarea();
29
- this.replicate_ajax();
30
- this.reset_settings();
31
- },
32
- init_hide_body: function(elm,type) {
33
- var css = '.option-tree-setting-body';
34
- if ( type == 'parent' ) {
35
- $(css).not( elm.parent().parent().children(css) ).hide();
36
- } else if ( type == 'child' ) {
37
- elm.closest('ul').find(css).not( elm.parent().parent().children(css) ).hide();
38
- } else if ( type == 'child-add' ) {
39
- elm.children().find(css).hide();
40
- } else if ( type == 'toggle' ) {
41
- elm.parent().parent().children(css).toggle();
42
- } else {
43
- $(css).hide();
44
- }
45
- },
46
- init_remove_active: function(elm,type) {
47
- var css = '.option-tree-setting-edit';
48
- if ( type == 'parent' ) {
49
- $(css).not(elm).removeClass('active');
50
- } else if ( type == 'child' ) {
51
- elm.closest('ul').find(css).not(elm).removeClass('active');
52
- } else if ( type == 'child-add' ) {
53
- elm.children().find(css).removeClass('active');
54
- } else {
55
- $(css).removeClass('active');
56
- }
57
- },
58
- init_sortable: function() {
59
- $('.option-tree-sortable').each( function() {
60
- if ( $(this).children('li').length ) {
61
- var elm = $(this);
62
- elm.show();
63
- elm.sortable({
64
- items: 'li:not(.ui-state-disabled)',
65
- handle: 'div.open',
66
- placeholder: 'ui-state-highlight',
67
- start: function (event, ui) {
68
- ui.placeholder.height(ui.item.height()-2);
69
- },
70
- stop: function(evt, ui) {
71
- setTimeout(
72
- function(){
73
- OT_UI.update_ids(elm);
74
- },
75
- 200
76
- )
77
- }
78
- });
79
- }
80
- });
81
- },
82
- init_add: function() {
83
- $('.option-tree-section-add').live('click', function(e) {
84
- e.preventDefault();
85
- OT_UI.add(this,'section');
86
- });
87
- $('.option-tree-setting-add').live('click', function(e) {
88
- e.preventDefault();
89
- OT_UI.add(this,'setting');
90
- });
91
- $('.option-tree-help-add').live('click', function(e) {
92
- e.preventDefault();
93
- OT_UI.add(this,'the_contextual_help');
94
- });
95
- $('.option-tree-choice-add').live('click', function(e) {
96
- e.preventDefault();
97
- OT_UI.add(this,'choice');
98
- });
99
- $('.option-tree-list-item-add').live('click', function(e) {
100
- e.preventDefault();
101
- OT_UI.add(this,'list_item');
102
- });
103
- $('.option-tree-list-item-setting-add').live('click', function(e) {
104
- e.preventDefault();
105
- if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
106
- alert(option_tree.setting_limit);
107
- return false;
108
- }
109
- OT_UI.add(this,'list_item_setting');
110
- });
111
- },
112
- init_edit: function() {
113
- $('.option-tree-setting-edit').live('click', function(e) {
114
- e.preventDefault();
115
- if ( $(this).parents().hasClass('option-tree-setting-body') ) {
116
- OT_UI.init_remove_active($(this),'child');
117
- OT_UI.init_hide_body($(this),'child');
118
- } else {
119
- OT_UI.init_remove_active($(this),'parent');
120
- OT_UI.init_hide_body($(this), 'parent');
121
- }
122
- $(this).toggleClass('active');
123
- OT_UI.init_hide_body($(this), 'toggle');
124
- });
125
- },
126
- init_remove: function() {
127
- $('.option-tree-setting-remove').live('click', function(event) {
128
- event.preventDefault();
129
- if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
130
- alert(option_tree.remove_no);
131
- return false;
132
- }
133
- var agree = confirm(option_tree.remove_agree);
134
- if (agree) {
135
- var list = $(this).parents('ul');
136
- OT_UI.remove(this);
137
- setTimeout( function() {
138
- OT_UI.update_ids(list);
139
- }, 200 );
140
- }
141
- return false;
142
- });
143
- },
144
- init_edit_title: function() {
145
- $('.option-tree-setting-title').live('keyup', function() {
146
- OT_UI.edit_title(this);
147
- });
148
- },
149
- init_edit_id: function() {
150
- $('.section-id').live('keyup', function(){
151
- OT_UI.update_id(this);
152
- });
153
- },
154
- init_activate_layout: function() {
155
- $('.option-tree-layout-activate').live('click', function() {
156
- var active = $(this).parents('.option-tree-setting').find('.open').text();
157
- $('.option-tree-layout-activate').removeClass('active');
158
- $(this).toggleClass('active');
159
- $('.active-layout-input').attr({'value':active});
160
- });
161
- $('#option-tree-options-layouts-form select').live('change', function() {
162
- var agree = confirm(option_tree.activate_layout_agree);
163
- if (agree) {
164
- $('#option-tree-options-layouts-form').submit();
165
- } else {
166
- var active = $('#the_current_layout').attr('value');
167
- $('#option-tree-options-layouts-form select option[value="' + active + '"]').attr({'selected':'selected'});
168
- $('#option-tree-options-layouts-form select').prev('span').replaceWith('<span>' + active + '</span>');
169
- }
170
- });
171
- },
172
- add: function(elm,type) {
173
- var self = this,
174
- list = '',
175
- list_class = '',
176
- name = '',
177
- post_id = 0,
178
- get_option = '',
179
- settings = '';
180
- if ( type == 'the_contextual_help' ) {
181
- list = $(elm).parent().find('ul:last');
182
- list_class = 'list-contextual-help';
183
- } else if ( type == 'choice' ) {
184
- list = $(elm).parent().children('ul');
185
- list_class = 'list-choice';
186
- } else if ( type == 'list_item' ) {
187
- list = $(elm).parent().children('ul');
188
- list_class = 'list-sub-setting';
189
- } else if ( type == 'list_item_setting' ) {
190
- list = $(elm).parent().children('ul');
191
- list_class = 'list-sub-setting';
192
- } else {
193
- list = $(elm).parent().find('ul:first');
194
- list_class = ( type == 'section' ) ? 'list-section' : 'list-setting';
195
- }
196
- name = list.data('name');
197
- post_id = list.data('id');
198
- get_option = list.data('getOption');
199
- settings = $('#'+name+'_settings_array').val();
200
- if ( this.processing === false ) {
201
- this.processing = true;
202
- var count = parseInt(list.children('li').length);
203
- if ( type == 'list_item' ) {
204
- list.find('li input.option-tree-setting-title', self).each(function(){
205
- var setting = $(this).attr('name'),
206
- regex = /\[([0-9]+)\]/,
207
- matches = setting.match(regex),
208
- id = null != matches ? parseInt(matches[1]) : 0;
209
- id++;
210
- if ( id > count) {
211
- count = id;
212
- }
213
- });
214
- }
215
- $.ajax({
216
- url: option_tree.ajax,
217
- type: 'post',
218
- data: {
219
- action: 'add_' + type,
220
- count: count,
221
- name: name,
222
- post_id: post_id,
223
- get_option: get_option,
224
- settings: settings,
225
- type: type
226
- },
227
- complete: function( data ) {
228
- if ( type == 'choice' || type == 'list_item_setting' ) {
229
- OT_UI.init_remove_active(list,'child-add');
230
- OT_UI.init_hide_body(list,'child-add');
231
- } else {
232
- OT_UI.init_remove_active();
233
- OT_UI.init_hide_body();
234
- }
235
- list.append('<li class="ui-state-default ' + list_class + '">' + data.responseText + '</li>');
236
- list.children().last().find('.option-tree-setting-edit').toggleClass('active');
237
- list.children().last().find('.option-tree-setting-body').toggle();
238
- list.children().last().find('.option-tree-setting-title').focus();
239
- if ( type != 'the_contextual_help' ) {
240
- OT_UI.update_ids(list);
241
- }
242
- setTimeout( function() {
243
- OT_UI.init_sortable();
244
- OT_UI.init_select_wrapper();
245
- }, 500);
246
- self.processing = false;
247
- }
248
- });
249
- }
250
- },
251
- remove: function(e) {
252
- $(e).parent().parent().parent('li').remove();
253
- },
254
- edit_title: function(e) {
255
- if ( this.timer ) {
256
- clearTimeout(e.timer);
257
- }
258
- this.timer = setTimeout( function() {
259
- $(e).parent().parent().parent().parent().parent().children('.open').text(e.value);
260
- }, 100);
261
- return true;
262
- },
263
- update_id: function(e) {
264
- if ( this.timer ) {
265
- clearTimeout(e.timer);
266
- }
267
- this.timer = setTimeout( function() {
268
- OT_UI.update_ids($(e).parents('ul'));
269
- }, 100);
270
- return true;
271
- },
272
- update_ids: function(list) {
273
- var last_section, section, list_items = list.children('li');
274
- list_items.each(function(index) {
275
- if ( $(this).hasClass('list-section') ) {
276
- section = $(this).find('.section-id').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
277
- if (!section) {
278
- section = $(this).find('.section-title').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
279
- }
280
- if (!section) {
281
- section = last_section;
282
- }
283
- }
284
- if ($(this).hasClass('list-setting') ) {
285
- $(this).find('.hidden-section').attr({'value':section});
286
- }
287
- last_section = section;
288
- });
289
- },
290
- init_upload: function() {
291
- $('.ot_upload_media').on('click', function() {
292
- var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
293
- post_id = $(this).attr('rel'),
294
- btnContent = '';
295
- if ( window.wp && wp.media ) {
296
- window.ot_media_frame = window.ot_media_frame || new wp.media.view.MediaFrame.Select({
297
- title: $(this).attr('title'),
298
- button: {
299
- text: option_tree.upload_text
300
- },
301
- multiple: false
302
- });
303
- window.ot_media_frame.on('select', function() {
304
- var attachment = window.ot_media_frame.state().get('selection').first(),
305
- href = attachment.attributes.url,
306
- mime = attachment.attributes.mime,
307
- regex = /^image\/(?:jpe?g|png|gif|x-icon)$/i;
308
- if ( mime.match(regex) ) {
309
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
310
- }
311
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="'+option_tree.remove_media_text+'"><span class="icon trash-can">'+option_tree.remove_media_text+'</span></a>';
312
- $('#'+field_id).val(href);
313
- $('#'+field_id+'_media').remove();
314
- $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
315
- $('#'+field_id+'_media').append(btnContent).slideDown();
316
- window.ot_media_frame.off('select');
317
- }).open();
318
- } else {
319
- var backup = window.send_to_editor,
320
- intval = window.setInterval(
321
- function() {
322
- if ( $('#TB_iframeContent').length > 0 && $('#TB_iframeContent').attr('src').indexOf( "&field_id=" ) !== -1 ) {
323
- $('#TB_iframeContent').contents().find('#tab-type_url').hide();
324
- }
325
- $('#TB_iframeContent').contents().find('.savesend .button').val(option_tree.upload_text);
326
- }, 50);
327
- tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
328
- window.send_to_editor = function(html) {
329
- var href = $(html).find('img').attr('src');
330
- if ( typeof href == 'undefined') {
331
- href = $(html).attr('src');
332
- }
333
- if ( typeof href == 'undefined') {
334
- href = $(html).attr('href');
335
- }
336
- var image = /\.(?:jpe?g|png|gif|ico)$/i;
337
- if (href.match(image) && OT_UI.url_exists(href)) {
338
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
339
- }
340
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="'+option_tree.remove_media_text+'"><span class="icon trash-can">'+option_tree.remove_media_text+'</span></a>';
341
- $('#'+field_id).val(href);
342
- $('#'+field_id+'_media').remove();
343
- $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
344
- $('#'+field_id+'_media').append(btnContent).slideDown();
345
- OT_UI.fix_upload_parent();
346
- tb_remove();
347
- window.clearInterval(intval);
348
- window.send_to_editor = backup;
349
- };
350
- }
351
- return false;
352
- });
353
- },
354
- init_upload_remove: function() {
355
- $('.option-tree-ui-remove-media').live('click', function(event) {
356
- event.preventDefault();
357
- var agree = confirm(option_tree.remove_agree);
358
- if (agree) {
359
- OT_UI.remove_image(this);
360
- return false;
361
- }
362
- return false;
363
- });
364
- },
365
- init_upload_fix: function(elm) {
366
- var id = $(elm).attr('id'),
367
- val = $(elm).val(),
368
- img = $(elm).parent().next('option-tree-ui-media-wrap').find('img'),
369
- src = img.attr('src'),
370
- btnContent = '';
371
- if ( val != src ) {
372
- img.attr('src', val);
373
- }
374
- if ( val !== '' && ( typeof src == 'undefined' || src == false ) && OT_UI.url_exists(val) ) {
375
- var image = /\.(?:jpe?g|png|gif|ico)$/i;
376
- if (val.match(image)) {
377
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+val+'" alt="" /></div>';
378
- }
379
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="'+option_tree.remove_media_text+'"><span class="icon trash-can">'+option_tree.remove_media_text+'</span></a>';
380
- $('#'+id).val(val);
381
- $('#'+id+'_media').remove();
382
- $('#'+id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+id+'_media" />');
383
- $('#'+id+'_media').append(btnContent).slideDown();
384
- } else if ( val == '' || ! OT_UI.url_exists(val) ) {
385
- $(elm).parent().next('.option-tree-ui-media-wrap').remove();
386
- }
387
- },
388
- init_numeric_slider: function() {
389
- $(".ot-numeric-slider-wrap").each(function() {
390
- var hidden = $(".ot-numeric-slider-hidden-input", this),
391
- value = hidden.val(),
392
- helper = $(".ot-numeric-slider-helper-input", this);
393
- if ( ! value ) {
394
- value = 0;
395
- helper.val(value)
396
- }
397
- $(".ot-numeric-slider", this).slider({
398
- min: hidden.data("min"),
399
- max: hidden.data("max"),
400
- step: hidden.data("step"),
401
- value: value,
402
- slide: function(event, ui) {
403
- hidden.add(helper).val(ui.value);
404
- }
405
- });
406
- });
407
- },
408
- init_tabs: function() {
409
- $(".wrap.settings-wrap .ui-tabs").tabs({
410
- fx: {
411
- opacity: "toggle",
412
- duration: "fast"
413
- }
414
- });
415
- $(".wrap.settings-wrap .ui-tabs a.ui-tabs-anchor").on("click", function(event, ui) {
416
- var obj = "input[name='_wp_http_referer']";
417
- if ( $(obj).length > 0 ) {
418
- var url = $(obj).val(),
419
- hash = $(this).attr('href');
420
- if ( url.indexOf("#") != -1 ) {
421
- var o = url.split("#")[1],
422
- n = hash.split("#")[1];
423
- url = url.replace(o, n);
424
- } else {
425
- url = url + hash;
426
- }
427
- $(obj).val(url);
428
- }
429
- });
430
- },
431
- init_radio_image_select: function() {
432
- $('.option-tree-ui-radio-image').live('click', function() {
433
- $(this).closest('.type-radio-image').find('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
434
- $(this).toggleClass('option-tree-ui-radio-image-selected');
435
- $(this).parent().find('.option-tree-ui-radio').attr('checked', true);
436
- });
437
- },
438
- init_select_wrapper: function() {
439
- $('.option-tree-ui-select').each(function () {
440
- if ( ! $(this).parent().hasClass('select-wrapper') ) {
441
- $(this).wrap('<div class="select-wrapper" />');
442
- $(this).parent('.select-wrapper').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
443
- }
444
- });
445
- $('.option-tree-ui-select').live('change', function () {
446
- $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
447
- });
448
- $('.option-tree-ui-select').bind($.browser.msie ? 'click' : 'change', function(event) {
449
- $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
450
- });
451
- },
452
- bind_colorpicker: function(field_id) {
453
- $('#'+field_id).ColorPicker({
454
- onSubmit: function(hsb, hex, rgb) {
455
- $('#'+field_id).val('#'+hex);
456
- },
457
- onBeforeShow: function () {
458
- $(this).ColorPickerSetColor(this.value);
459
- return false;
460
- },
461
- onChange: function (hsb, hex, rgb) {
462
- var bc = $.inArray(hex, [ 'FFFFFF', 'FFF', 'ffffff', 'fff' ]) != -1 ? 'ccc' : hex;
463
- $('#cp_'+field_id).css({'backgroundColor':'#'+hex,'borderColor':'#'+bc});
464
- $('#cp_'+field_id).prev('input').attr('value', '#'+hex);
465
- }
466
- })
467
- .bind('keyup', function(){
468
- $(this).ColorPickerSetColor(this.value);
469
- });
470
- },
471
- fix_upload_parent: function() {
472
- $('.option-tree-ui-upload-input').live('focus blur', function(){
473
- $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
474
- OT_UI.init_upload_fix(this);
475
- });
476
- },
477
- remove_image: function(e) {
478
- $(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
479
- $(e).parent('.option-tree-ui-media-wrap').remove();
480
- },
481
- fix_colorpicker: function() {
482
- $('.cp_input').live('blur', function() {
483
- $('.cp_input').each( function(index, el) {
484
- var val = $(el).val();
485
- var reg = /^[A-Fa-f0-9]{6}$/;
486
- if( reg.test(val) && val != '' ) {
487
- $(el).attr('value', '#'+val)
488
- } else if ( val == '' ) {
489
- $(this).next('.cp_box').css({'background':'#f1f1f1','border-color':'#ccc'});
490
- }
491
- });
492
- });
493
- },
494
- fix_textarea: function() {
495
- $('.wp-editor-area').focus( function(){
496
- $(this).parent('div').css({borderColor:'#bbb'});
497
- }).blur( function(){
498
- $(this).parent('div').css({borderColor:'#ccc'});
499
- });
500
- },
501
- replicate_ajax: function() {
502
- if (location.href.indexOf("#") != -1) {
503
- var url = $("input[name=\'_wp_http_referer\']").val(),
504
- hash = location.href.substr(location.href.indexOf("#"));
505
- $("input[name=\'_wp_http_referer\']").val( url + hash );
506
- this.scroll_to_top();
507
- }
508
- setTimeout( function() {
509
- $(".wrap.settings-wrap .fade").fadeOut("fast");
510
- }, 3000 );
511
- },
512
- reset_settings: function() {
513
- $(".reset-settings").live("click", function(event){
514
- var agree = confirm(option_tree.reset_agree);
515
- if (agree) {
516
- return true;
517
- } else {
518
- return false;
519
- }
520
- event.preventDefault();
521
- });
522
- },
523
- url_exists: function(url) {
524
- var http = new XMLHttpRequest();
525
- http.open('HEAD', url, false);
526
- http.send();
527
- return http.status!=404;
528
- },
529
- scroll_to_top: function() {
530
- setTimeout( function() {
531
- $(this).scrollTop(0);
532
- }, 50 );
533
- }
534
- };
535
- $(document).ready( function() {
536
- OT_UI.init();
537
- });
538
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/test/test-data.txt ADDED
@@ -0,0 +1 @@
 
1
+ YToxMzp7czoxNToiZ2VuZXJhbF9kZWZhdWx0IjtzOjEyOiJUZXN0IE9wdGlvbnMiO3M6NToiaW5wdXQiO3M6MTQ6IlRoaXMgaXMgYSB0ZXMhIjtzOjg6ImNoZWNrYm94IjtzOjM6InllcyI7czo1OiJyYWRpbyI7czoyOiJubyI7czo2OiJzZWxlY3QiO3M6MDoiIjtzOjg6InRleHRhcmVhIjtzOjI1OiJKdXN0IHNvbWUgbW9yZSB0ZXN0IGRhdGEhIjtzOjY6InVwbG9hZCI7czowOiIiO3M6MTE6ImNvbG9ycGlja2VyIjtzOjA6IiI7czo4OiJjYXRlZ29yeSI7czowOiIiO3M6MzoidGFnIjtzOjA6IiI7czo0OiJwb3N0IjtzOjA6IiI7czo0OiJwYWdlIjtzOjA6IiI7czoxMToiY3VzdG9tX3Bvc3QiO3M6MDoiIjt9
assets/test/test-options.xml ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <wp_option_tree>
3
+ <row>
4
+ <id>1</id>
5
+ <item_id>general_default</item_id>
6
+ <item_title>Test Options</item_title>
7
+ <item_desc></item_desc>
8
+ <item_type>heading</item_type>
9
+ <item_options></item_options>
10
+ <item_sort>1</item_sort>
11
+ </row>
12
+ <row>
13
+ <id>2</id>
14
+ <item_id>textblock</item_id>
15
+ <item_title>Textblock</item_title>
16
+ <item_desc>&amp;lt;h3&amp;gt;Textblock&amp;lt;/h3&amp;gt;
17
+ &amp;lt;p&amp;gt;Here is a &amp;lt;strong&amp;gt;textblock&amp;lt;/strong&amp;gt; with HTML in it. You can use this space to transition to the next section or subsection within a tab on the &amp;lt;em&amp;gt;Theme Options&amp;lt;/em&amp;gt; page. It&amp;#039;s use is strictly for the admin UI and is not for the front-end of the web site.&amp;lt;/p&amp;gt;</item_desc>
18
+ <item_type>textblock</item_type>
19
+ <item_options></item_options>
20
+ <item_sort>2</item_sort>
21
+ </row>
22
+ <row>
23
+ <id>3</id>
24
+ <item_id>input</item_id>
25
+ <item_title>Input</item_title>
26
+ <item_desc>You can save a simple string here. Maybe a link to feedburner or your Twitter username.</item_desc>
27
+ <item_type>input</item_type>
28
+ <item_options></item_options>
29
+ <item_sort>3</item_sort>
30
+ </row>
31
+ <row>
32
+ <id>4</id>
33
+ <item_id>checkbox</item_id>
34
+ <item_title>Checkbox</item_title>
35
+ <item_desc>You could ask a question with a checkbox. For example, do you want to activate asynchronous Google analytics?</item_desc>
36
+ <item_type>checkbox</item_type>
37
+ <item_options>yes</item_options>
38
+ <item_sort>4</item_sort>
39
+ </row>
40
+ <row>
41
+ <id>5</id>
42
+ <item_id>radio</item_id>
43
+ <item_title>Radio</item_title>
44
+ <item_desc>You could ask a question with a radio input. For example, do you want to activate asynchronous Google analytics?</item_desc>
45
+ <item_type>radio</item_type>
46
+ <item_options>yes,no</item_options>
47
+ <item_sort>5</item_sort>
48
+ </row>
49
+ <row>
50
+ <id>6</id>
51
+ <item_id>select</item_id>
52
+ <item_title>Select</item_title>
53
+ <item_desc>Use this to list different theme styles or choose some other important setting.</item_desc>
54
+ <item_type>select</item_type>
55
+ <item_options>yes,no</item_options>
56
+ <item_sort>6</item_sort>
57
+ </row>
58
+ <row>
59
+ <id>7</id>
60
+ <item_id>textarea</item_id>
61
+ <item_title>Textarea</item_title>
62
+ <item_desc>Here users can add custom code or text for use in your theme.</item_desc>
63
+ <item_type>textarea</item_type>
64
+ <item_options>6</item_options>
65
+ <item_sort>7</item_sort>
66
+ </row>
67
+ <row>
68
+ <id>8</id>
69
+ <item_id>upload</item_id>
70
+ <item_title>Upload</item_title>
71
+ <item_desc>Here you can upload any WordPress supported media. After uploading, hit the &amp;quot;Insert into Post&amp;quot; button. One caveat of this feature is that if you upload media on one site the URL will no be correct if you import the data to a new one. You&amp;#039;ll have to re-upload the media.</item_desc>
72
+ <item_type>upload</item_type>
73
+ <item_options></item_options>
74
+ <item_sort>8</item_sort>
75
+ </row>
76
+ <row>
77
+ <id>9</id>
78
+ <item_id>colorpicker</item_id>
79
+ <item_title>Colorpicker</item_title>
80
+ <item_desc>This is a very self explanatory feature. Use it to change the color of something.</item_desc>
81
+ <item_type>colorpicker</item_type>
82
+ <item_options></item_options>
83
+ <item_sort>9</item_sort>
84
+ </row>
85
+ <row>
86
+ <id>10</id>
87
+ <item_id>category</item_id>
88
+ <item_title>Category</item_title>
89
+ <item_desc>Choose from a list of categories and save as a single category ID for use in a function or loop.</item_desc>
90
+ <item_type>category</item_type>
91
+ <item_options></item_options>
92
+ <item_sort>10</item_sort>
93
+ </row>
94
+ <row>
95
+ <id>11</id>
96
+ <item_id>categories</item_id>
97
+ <item_title>Categories</item_title>
98
+ <item_desc>Choose from a list of categories and save multiple category ID&amp;#039;s for use in a function or loop.</item_desc>
99
+ <item_type>categories</item_type>
100
+ <item_options></item_options>
101
+ <item_sort>11</item_sort>
102
+ </row>
103
+ <row>
104
+ <id>12</id>
105
+ <item_id>tag</item_id>
106
+ <item_title>Tag</item_title>
107
+ <item_desc>Choose from a list of tags and save as a single tag ID for use in a function or loop.</item_desc>
108
+ <item_type>tag</item_type>
109
+ <item_options></item_options>
110
+ <item_sort>12</item_sort>
111
+ </row>
112
+ <row>
113
+ <id>13</id>
114
+ <item_id>tags</item_id>
115
+ <item_title>Tags</item_title>
116
+ <item_desc>Choose from a list of tags and save as multiple tag ID&amp;#039;s for use in a function or loop.</item_desc>
117
+ <item_type>tags</item_type>
118
+ <item_options></item_options>
119
+ <item_sort>13</item_sort>
120
+ </row>
121
+ <row>
122
+ <id>14</id>
123
+ <item_id>post</item_id>
124
+ <item_title>Post</item_title>
125
+ <item_desc>Choose from a list of posts and save as a single post ID for use in a function or loop.</item_desc>
126
+ <item_type>post</item_type>
127
+ <item_options></item_options>
128
+ <item_sort>14</item_sort>
129
+ </row>
130
+ <row>
131
+ <id>15</id>
132
+ <item_id>posts</item_id>
133
+ <item_title>Posts</item_title>
134
+ <item_desc>Choose from a list of posts and save as multiple post ID&amp;#039;s for use in a function or loop.</item_desc>
135
+ <item_type>posts</item_type>
136
+ <item_options></item_options>
137
+ <item_sort>15</item_sort>
138
+ </row>
139
+ <row>
140
+ <id>16</id>
141
+ <item_id>page</item_id>
142
+ <item_title>Page</item_title>
143
+ <item_desc>Choose from a list of pages and save as a single page ID for use in a function or loop.</item_desc>
144
+ <item_type>page</item_type>
145
+ <item_options></item_options>
146
+ <item_sort>16</item_sort>
147
+ </row>
148
+ <row>
149
+ <id>17</id>
150
+ <item_id>pages</item_id>
151
+ <item_title>Pages</item_title>
152
+ <item_desc>Choose from a list of pages and save as multiple page ID&amp;#039;s for use in a function or loop.</item_desc>
153
+ <item_type>pages</item_type>
154
+ <item_options></item_options>
155
+ <item_sort>17</item_sort>
156
+ </row>
157
+ <row>
158
+ <id>18</id>
159
+ <item_id>custom_post</item_id>
160
+ <item_title>Custom Post</item_title>
161
+ <item_desc>Choose from a list of any post type and save as a single ID for use in a function or loop.</item_desc>
162
+ <item_type>custom_post</item_type>
163
+ <item_options>attachment</item_options>
164
+ <item_sort>18</item_sort>
165
+ </row>
166
+ <row>
167
+ <id>19</id>
168
+ <item_id>custom_posts</item_id>
169
+ <item_title>Custom Posts</item_title>
170
+ <item_desc>Choose from a list of any post type and save as multiple ID&amp;#039;s for use in a function or loop.</item_desc>
171
+ <item_type>custom_posts</item_type>
172
+ <item_options>attachment</item_options>
173
+ <item_sort>19</item_sort>
174
+ </row>
175
+ </wp_option_tree>
assets/theme-mode/demo-meta-boxes.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- /**
3
- * Initialize the meta boxes.
4
- */
5
- add_action( 'admin_init', '_custom_meta_boxes' );
6
-
7
- /**
8
- * Meta Boxes demo code.
9
- *
10
- * You can find all the available option types
11
- * in demo-theme-options.php.
12
- *
13
- * @return void
14
- *
15
- * @access private
16
- * @since 2.0
17
- */
18
- function _custom_meta_boxes() {
19
-
20
- /**
21
- * Create a custom meta boxes array that we pass to
22
- * the OptionTree Meta Box API Class.
23
- */
24
- $my_meta_box = array(
25
- 'id' => 'my_meta_box',
26
- 'title' => 'Demo Meta Box',
27
- 'desc' => '',
28
- 'pages' => array( 'post' ),
29
- 'context' => 'normal',
30
- 'priority' => 'high',
31
- 'fields' => array(
32
- array(
33
- 'label' => 'Background',
34
- 'id' => 'my_background',
35
- 'type' => 'background',
36
- 'desc' => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
37
- 'std' => '',
38
- 'rows' => '',
39
- 'post_type' => '',
40
- 'taxonomy' => '',
41
- 'class' => ''
42
- ),
43
- array(
44
- 'label' => 'Category Checkbox',
45
- 'id' => 'my_category_checkbox',
46
- 'type' => 'category-checkbox',
47
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
48
- 'std' => '',
49
- 'rows' => '',
50
- 'post_type' => '',
51
- 'taxonomy' => '',
52
- 'class' => ''
53
- )
54
- )
55
- );
56
-
57
- /**
58
- * Register our meta boxes using the
59
- * ot_register_meta_box() function.
60
- */
61
- ot_register_meta_box( $my_meta_box );
62
-
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/theme-mode/demo-theme-options.php DELETED
@@ -1,476 +0,0 @@
1
- <?php
2
- /**
3
- * Initialize the options before anything else.
4
- */
5
- add_action( 'admin_init', '_custom_theme_options', 1 );
6
-
7
- /**
8
- * Theme Mode demo code of all the available option types.
9
- *
10
- * @return void
11
- *
12
- * @access private
13
- * @since 2.0
14
- */
15
- function _custom_theme_options() {
16
-
17
- /**
18
- * Get a copy of the saved settings array.
19
- */
20
- $saved_settings = get_option( 'option_tree_settings', array() );
21
-
22
- /**
23
- * Create a custom settings array that we pass to
24
- * the OptionTree Settings API Class.
25
- */
26
- $custom_settings = array(
27
- 'contextual_help' => array(
28
- 'content' => array(
29
- array(
30
- 'id' => 'general_help',
31
- 'title' => 'General',
32
- 'content' => '<p>Help content goes here!</p>'
33
- )
34
- ),
35
- 'sidebar' => '<p>Sidebar content goes here!</p>'
36
- ),
37
- 'sections' => array(
38
- array(
39
- 'title' => 'General',
40
- 'id' => 'general_default'
41
- ),
42
- array(
43
- 'title' => 'Miscellaneous ',
44
- 'id' => 'miscellaneous'
45
- )
46
- ),
47
- 'settings' => array(
48
- array(
49
- 'label' => 'Background',
50
- 'id' => 'my_background',
51
- 'type' => 'background',
52
- 'desc' => 'BlahLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
53
- 'std' => '',
54
- 'rows' => '',
55
- 'post_type' => '',
56
- 'taxonomy' => '',
57
- 'class' => '',
58
- 'section' => 'general_default'
59
- ),
60
- array(
61
- 'label' => 'Category Checkbox',
62
- 'id' => 'my_category_checkbox',
63
- 'type' => 'category-checkbox',
64
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
65
- 'std' => '',
66
- 'rows' => '',
67
- 'post_type' => '',
68
- 'taxonomy' => '',
69
- 'class' => '',
70
- 'section' => 'general_default'
71
- ),
72
- array(
73
- 'label' => 'Category Select',
74
- 'id' => 'my_category_select',
75
- 'type' => 'category-select',
76
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
77
- 'std' => '',
78
- 'rows' => '',
79
- 'post_type' => '',
80
- 'taxonomy' => '',
81
- 'class' => '',
82
- 'section' => 'general_default'
83
- ),
84
- array(
85
- 'label' => 'Checkbox',
86
- 'id' => 'my_checkbox',
87
- 'type' => 'checkbox',
88
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
89
- 'choices' => array(
90
- array (
91
- 'label' => 'Yes',
92
- 'value' => 'Yes'
93
- )
94
- ),
95
- 'std' => '',
96
- 'rows' => '',
97
- 'post_type' => '',
98
- 'taxonomy' => '',
99
- 'class' => '',
100
- 'section' => 'general_default'
101
- ),
102
- array(
103
- 'label' => 'Colorpicker',
104
- 'id' => 'my_colorpicker',
105
- 'type' => 'colorpicker',
106
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
107
- 'std' => '',
108
- 'rows' => '',
109
- 'post_type' => '',
110
- 'taxonomy' => '',
111
- 'class' => '',
112
- 'section' => 'general_default'
113
- ),
114
- array(
115
- 'label' => 'CSS',
116
- 'id' => 'my_css',
117
- 'type' => 'css',
118
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
119
- 'std' => '',
120
- 'rows' => '20',
121
- 'post_type' => '',
122
- 'taxonomy' => '',
123
- 'class' => '',
124
- 'section' => 'general_default'
125
- ),
126
- array(
127
- 'label' => 'Custom Post Type Checkbox',
128
- 'id' => 'my_custom_post_type_checkbox',
129
- 'type' => 'custom-post-type-checkbox',
130
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
131
- 'std' => '',
132
- 'rows' => '',
133
- 'post_type' => 'post',
134
- 'taxonomy' => '',
135
- 'class' => '',
136
- 'section' => 'general_default'
137
- ),
138
- array(
139
- 'label' => 'Custom Post Type Select',
140
- 'id' => 'my_custom_post_type_select',
141
- 'type' => 'custom-post-type-select',
142
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
143
- 'std' => '',
144
- 'rows' => '',
145
- 'post_type' => 'post',
146
- 'taxonomy' => '',
147
- 'class' => '',
148
- 'section' => 'general_default'
149
- ),
150
- array(
151
- 'label' => 'List Item',
152
- 'id' => 'my_list_item',
153
- 'type' => 'list-item',
154
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
155
- 'settings' => array(
156
- array(
157
- 'label' => 'Upload',
158
- 'id' => 'my_list_item_upload',
159
- 'type' => 'upload',
160
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
161
- 'std' => '',
162
- 'rows' => '',
163
- 'post_type' => '',
164
- 'taxonomy' => '',
165
- 'class' => ''
166
- ),
167
- array(
168
- 'label' => 'Text',
169
- 'id' => 'my_list_item_text',
170
- 'type' => 'text',
171
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
172
- 'std' => '',
173
- 'rows' => '',
174
- 'post_type' => '',
175
- 'taxonomy' => '',
176
- 'class' => ''
177
- ),
178
- array(
179
- 'label' => 'Textarea Simple',
180
- 'id' => 'my_list_item_textarea_simple',
181
- 'type' => 'textarea-simple',
182
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
183
- 'std' => '',
184
- 'rows' => '10',
185
- 'post_type' => '',
186
- 'taxonomy' => '',
187
- 'class' => ''
188
- )
189
- ),
190
- 'std' => '',
191
- 'rows' => '',
192
- 'post_type' => '',
193
- 'taxonomy' => '',
194
- 'class' => '',
195
- 'section' => 'general_default'
196
- ),
197
- array(
198
- 'label' => 'Measurement',
199
- 'id' => 'my_measurement',
200
- 'type' => 'measurement',
201
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
202
- 'std' => '',
203
- 'rows' => '',
204
- 'post_type' => '',
205
- 'taxonomy' => '',
206
- 'class' => '',
207
- 'section' => 'general_default'
208
- ),
209
- array(
210
- 'label' => 'Page Checkbox',
211
- 'id' => 'my_page_checkbox',
212
- 'type' => 'page-checkbox',
213
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
214
- 'std' => '',
215
- 'rows' => '',
216
- 'post_type' => '',
217
- 'taxonomy' => '',
218
- 'class' => '',
219
- 'section' => 'general_default'
220
- ),
221
- array(
222
- 'label' => 'Page Select',
223
- 'id' => 'my_page_select',
224
- 'type' => 'page-select',
225
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
226
- 'std' => '',
227
- 'rows' => '',
228
- 'post_type' => '',
229
- 'taxonomy' => '',
230
- 'class' => '',
231
- 'section' => 'general_default'
232
- ),
233
- array(
234
- 'label' => 'Post Checkbox',
235
- 'id' => 'my_post_checkbox',
236
- 'type' => 'post-checkbox',
237
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
238
- 'std' => '',
239
- 'rows' => '',
240
- 'post_type' => '',
241
- 'taxonomy' => '',
242
- 'class' => '',
243
- 'section' => 'general_default'
244
- ),
245
- array(
246
- 'label' => 'Post Select',
247
- 'id' => 'my_post_select',
248
- 'type' => 'post-select',
249
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
250
- 'std' => '',
251
- 'rows' => '',
252
- 'post_type' => '',
253
- 'taxonomy' => '',
254
- 'class' => '',
255
- 'section' => 'general_default'
256
- ),
257
- array(
258
- 'label' => 'Radio',
259
- 'id' => 'my_radio',
260
- 'type' => 'radio',
261
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
262
- 'choices' => array(
263
- array(
264
- 'label' => 'Yes',
265
- 'value' => 'yes'
266
- ),
267
- array(
268
- 'label' => 'No',
269
- 'value' => 'no'
270
- ),
271
- array(
272
- 'label' => 'Maybe',
273
- 'value' => 'maybe'
274
- )
275
- ),
276
- 'std' => 'yes',
277
- 'rows' => '',
278
- 'post_type' => '',
279
- 'taxonomy' => '',
280
- 'class' => '',
281
- 'section' => 'miscellaneous'
282
- ),
283
- array(
284
- 'label' => 'Radio Image',
285
- 'id' => 'my_radio_image',
286
- 'type' => 'radio-image',
287
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
288
- 'std' => 'right-sidebar',
289
- 'rows' => '',
290
- 'post_type' => '',
291
- 'taxonomy' => '',
292
- 'class' => '',
293
- 'section' => 'miscellaneous'
294
- ),
295
- array(
296
- 'label' => 'Select',
297
- 'id' => 'my_select',
298
- 'type' => 'select',
299
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
300
- 'choices' => array(
301
- array(
302
- 'label' => 'Yes',
303
- 'value' => 'yes'
304
- ),
305
- array(
306
- 'label' => 'No',
307
- 'value' => 'no'
308
- ),
309
- array(
310
- 'label' => 'Maybe',
311
- 'value' => 'maybe'
312
- )
313
- ),
314
- 'std' => 'maybe',
315
- 'rows' => '',
316
- 'post_type' => '',
317
- 'taxonomy' => '',
318
- 'class' => '',
319
- 'section' => 'miscellaneous'
320
- ),
321
- array(
322
- 'label' => 'Slider',
323
- 'id' => 'my_slider',
324
- 'type' => 'slider',
325
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
326
- 'std' => '',
327
- 'rows' => '',
328
- 'post_type' => '',
329
- 'taxonomy' => '',
330
- 'class' => '',
331
- 'section' => 'miscellaneous'
332
- ),
333
- array(
334
- 'label' => 'Tag Checkbox',
335
- 'id' => 'my_tag_checkbox',
336
- 'type' => 'tag-checkbox',
337
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
338
- 'std' => '',
339
- 'rows' => '',
340
- 'post_type' => '',
341
- 'taxonomy' => '',
342
- 'class' => '',
343
- 'section' => 'miscellaneous'
344
- ),
345
- array(
346
- 'label' => 'Tag Select',
347
- 'id' => 'my_tag_select',
348
- 'type' => 'tag-select',
349
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
350
- 'std' => '',
351
- 'rows' => '',
352
- 'post_type' => '',
353
- 'taxonomy' => '',
354
- 'class' => '',
355
- 'section' => 'miscellaneous'
356
- ),
357
- array(
358
- 'label' => 'Taxonomy Checkbox',
359
- 'id' => 'my_taxonomy_checkbox',
360
- 'type' => 'taxonomy-checkbox',
361
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
362
- 'std' => '',
363
- 'rows' => '',
364
- 'post_type' => '',
365
- 'taxonomy' => 'category,post_tag',
366
- 'class' => '',
367
- 'section' => 'miscellaneous'
368
- ),
369
- array(
370
- 'label' => 'Taxonomy Select',
371
- 'id' => 'my_taxonomy_select',
372
- 'type' => 'taxonomy-select',
373
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
374
- 'std' => '',
375
- 'rows' => '',
376
- 'post_type' => '',
377
- 'taxonomy' => 'category,post_tag',
378
- 'class' => '',
379
- 'section' => 'miscellaneous'
380
- ),
381
- array(
382
- 'label' => 'Text',
383
- 'id' => 'my_text',
384
- 'type' => 'text',
385
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
386
- 'std' => '',
387
- 'rows' => '',
388
- 'post_type' => '',
389
- 'taxonomy' => '',
390
- 'class' => '',
391
- 'section' => 'miscellaneous'
392
- ),
393
- array(
394
- 'label' => 'Textarea',
395
- 'id' => 'my_textarea',
396
- 'type' => 'textarea',
397
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
398
- 'std' => '',
399
- 'rows' => '15',
400
- 'post_type' => '',
401
- 'taxonomy' => '',
402
- 'class' => '',
403
- 'section' => 'miscellaneous'
404
- ),
405
- array(
406
- 'label' => 'Textarea Simple',
407
- 'id' => 'my_textarea_simple',
408
- 'type' => 'textarea-simple',
409
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
410
- 'std' => '',
411
- 'rows' => '10',
412
- 'post_type' => '',
413
- 'taxonomy' => '',
414
- 'class' => '',
415
- 'section' => 'miscellaneous'
416
- ),
417
- array(
418
- 'label' => 'Textblock',
419
- 'id' => 'my_textblock',
420
- 'type' => 'textblock',
421
- 'desc' => '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
422
- 'std' => '',
423
- 'rows' => '',
424
- 'post_type' => '',
425
- 'taxonomy' => '',
426
- 'class' => '',
427
- 'section' => 'miscellaneous'
428
- ),
429
- array(
430
- 'label' => 'Textblock Titled',
431
- 'id' => 'my_textblock_titled',
432
- 'type' => 'textblock-titled',
433
- 'desc' => '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
434
- 'std' => '',
435
- 'rows' => '',
436
- 'post_type' => '',
437
- 'taxonomy' => '',
438
- 'class' => '',
439
- 'section' => 'miscellaneous'
440
- ),
441
- array(
442
- 'label' => 'Typography',
443
- 'id' => 'my_typography',
444
- 'type' => 'typography',
445
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
446
- 'std' => '',
447
- 'rows' => '',
448
- 'post_type' => '',
449
- 'taxonomy' => '',
450
- 'class' => '',
451
- 'section' => 'miscellaneous'
452
- ),
453
- array(
454
- 'label' => 'Upload',
455
- 'id' => 'my_upload',
456
- 'type' => 'upload',
457
- 'desc' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
458
- 'std' => '',
459
- 'rows' => '',
460
- 'post_type' => '',
461
- 'taxonomy' => '',
462
- 'class' => '',
463
- 'section' => 'miscellaneous'
464
- )
465
- )
466
- );
467
-
468
- /* allow settings to be filtered before saving */
469
- $custom_settings = apply_filters( 'option_tree_settings_args', $custom_settings );
470
-
471
- /* settings are not the same update the DB */
472
- if ( $saved_settings !== $custom_settings ) {
473
- update_option( 'option_tree_settings', $custom_settings );
474
- }
475
-
476
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class.admin.php ADDED
@@ -0,0 +1,1113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * OptionTree Admin
4
+ *
5
+ * @package WordPress
6
+ * @subpackage OptionTree
7
+ * @since 1.0.0
8
+ * @author Derek Herman
9
+ */
10
+ class OT_Admin
11
+ {
12
+ private $table_name = NULL;
13
+ private $version = NULL;
14
+ private $option_array = array();
15
+
16
+ function __construct()
17
+ {
18
+ global $table_prefix;
19
+
20
+ $this->table_name = $table_prefix . 'option_tree';
21
+ $this->version = OT_VERSION;
22
+ $this->option_array = $this->option_tree_data();
23
+ }
24
+
25
+ /**
26
+ * Initiate Plugin & setup main options
27
+ *
28
+ * @uses get_option()
29
+ * @uses add_option()
30
+ * @uses option_tree_activate()
31
+ * @uses wp_redirect()
32
+ * @uses admin_url()
33
+ *
34
+ * @access public
35
+ * @since 1.0.0
36
+ *
37
+ * @return bool
38
+ */
39
+ function option_tree_init()
40
+ {
41
+ // check for activation
42
+ $check = get_option( 'option_tree_activation' );
43
+
44
+ // redirect on activation
45
+ if ($check != "set")
46
+ {
47
+ // set blank option values
48
+ foreach ( $this->option_array as $value )
49
+ {
50
+ $key = $value->item_id;
51
+ $new_options[$key] = '';
52
+ }
53
+
54
+ // add theme options
55
+ add_option( 'option_tree', $new_options );
56
+ add_option( 'option_tree_activation', 'set');
57
+
58
+ // load DB activation function if updating plugin
59
+ $this->option_tree_activate();
60
+
61
+ // Redirect
62
+ wp_redirect( admin_url().'admin.php?page=option_tree_settings#import_options' );
63
+ }
64
+ return false;
65
+ }
66
+
67
+ /**
68
+ * Plugin Table Structure
69
+ *
70
+ * @access public
71
+ * @since 1.0.0
72
+ *
73
+ * @param string $type
74
+ *
75
+ * @return string
76
+ */
77
+ function option_tree_table( $type = '')
78
+ {
79
+ if ( $type == 'create' )
80
+ {
81
+ $sql = "CREATE TABLE {$this->table_name} (
82
+ id mediumint(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
83
+ item_id VARCHAR(50) NOT NULL,
84
+ item_title VARCHAR(100) NOT NULL,
85
+ item_desc LONGTEXT,
86
+ item_type VARCHAR(30) NOT NULL,
87
+ item_options VARCHAR(250) DEFAULT NULL,
88
+ item_sort mediumint(9) DEFAULT '0' NOT NULL,
89
+ UNIQUE KEY (item_id)
90
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
91
+ }
92
+ return $sql;
93
+ }
94
+
95
+ /**
96
+ * Plugin Activation
97
+ *
98
+ * @uses get_var()
99
+ * @uses get_option()
100
+ * @uses dbDelta()
101
+ * @uses option_tree_table()
102
+ * @uses option_tree_default_data()
103
+ * @uses update_option()
104
+ * @uses add_option()
105
+ *
106
+ * @access public
107
+ * @since 1.0.0
108
+ *
109
+ * @return void
110
+ */
111
+ function option_tree_activate()
112
+ {
113
+ global $wpdb;
114
+
115
+ // check for table
116
+ $new_installation = $wpdb->get_var( "show tables like '$this->table_name'" ) != $this->table_name;
117
+
118
+ // check for installed version
119
+ $installed_ver = get_option( 'option_tree_version' );
120
+
121
+ // add/update table
122
+ if ( $installed_ver != $this->version )
123
+ {
124
+ // run query
125
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
126
+ dbDelta( $this->option_tree_table( 'create' ) );
127
+ }
128
+
129
+ // new install default data
130
+ if ( $new_installation )
131
+ {
132
+ $this->option_tree_default_data();
133
+ }
134
+
135
+ // New Version Update
136
+ if ( $installed_ver != $this->version )
137
+ {
138
+ update_option( 'option_tree_version', $this->version );
139
+ }
140
+ else if ( !$installed_ver )
141
+ {
142
+ add_option( 'option_tree_version', $this->version );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Plugin Deactivation delete options
148
+ *
149
+ * @uses delete_option()
150
+ *
151
+ * @access public
152
+ * @since 1.0.0
153
+ *
154
+ * @return void
155
+ */
156
+ function option_tree_deactivate()
157
+ {
158
+ // remove activation check & version
159
+ delete_option( 'option_tree_activation' );
160
+ delete_option( 'option_tree_version' );
161
+ }
162
+
163
+ /**
164
+ * Plugin Activation Default Data
165
+ *
166
+ * @uses query()
167
+ * @uses prepare()
168
+ *
169
+ * @access public
170
+ * @since 1.0.0
171
+ *
172
+ * @return void
173
+ */
174
+ function option_tree_default_data()
175
+ {
176
+ global $wpdb;
177
+
178
+ // default data
179
+ $wpdb->query( $wpdb->prepare( "
180
+ INSERT INTO {$this->table_name}
181
+ ( item_id, item_title, item_type )
182
+ VALUES ( %s, %s, %s ) ",
183
+ array('general_default','General','heading') ) );
184
+
185
+ $wpdb->query( $wpdb->prepare( "
186
+ INSERT INTO {$this->table_name}
187
+ ( item_id, item_title, item_type )
188
+ VALUES ( %s, %s, %s ) ",
189
+ array('test_input','Test Input','input') ) );
190
+ }
191
+
192
+ /**
193
+ * Restore Table Data if empty
194
+ *
195
+ * @uses delete_option()
196
+ * @uses option_tree_activate()
197
+ * @uses wp_redirect()
198
+ * @uses admin_url()
199
+ *
200
+ * @access public
201
+ * @since 1.0.0
202
+ *
203
+ * @return void
204
+ */
205
+ function option_tree_restore_default_data()
206
+ {
207
+ global $wpdb;
208
+
209
+ // drop table
210
+ $wpdb->query( "DROP TABLE $this->table_name" );
211
+
212
+ // remove activation check
213
+ delete_option( 'option_tree_version' );
214
+
215
+ // load DB activation function
216
+ $this->option_tree_activate();
217
+
218
+ // Redirect
219
+ wp_redirect( admin_url().'admin.php?page=option_tree_settings' );
220
+ }
221
+
222
+ /**
223
+ * Add Admin Menu Items & Test Actions
224
+ *
225
+ * @uses option_tree_export_xml()
226
+ * @uses option_tree_data()
227
+ * @uses get_results()
228
+ * @uses option_tree_restore_default_data()
229
+ * @uses option_tree_activate()
230
+ * @uses get_option()
231
+ * @uses option_tree_import_xml()
232
+ * @uses get_user_option()
233
+ * @uses add_object_page()
234
+ * @uses add_submenu_page()
235
+ * @uses add_action()
236
+ *
237
+ * @access public
238
+ * @since 1.0
239
+ *
240
+ * @param int $param
241
+ *
242
+ * @return void
243
+ */
244
+ function option_tree_admin()
245
+ {
246
+ global $wpdb;
247
+
248
+ // export XML - run before anything else
249
+ if ( isset($_GET['action']) && $_GET['action'] == 'export' )
250
+ option_tree_export_xml( $this->option_tree_data(), $this->table_name );
251
+
252
+ // grab saved table option
253
+ $test_options = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
254
+
255
+ // restore table if needed
256
+ if ( empty( $test_options ) )
257
+ $this->option_tree_restore_default_data();
258
+
259
+ // upgrade DB automatically
260
+ $this->option_tree_activate();
261
+
262
+ // load options array
263
+ $settings = get_option( 'option_tree' );
264
+
265
+ // upload xml data
266
+ $this->option_tree_import_xml();
267
+
268
+ // set admin color
269
+ $icon = ( get_user_option( 'admin_color' ) == 'classic' ) ? OT_PLUGIN_URL.'/assets/images/icon_classic.png' : OT_PLUGIN_URL.'/assets/images/icon_dark.png';
270
+
271
+ // create menu items
272
+ add_object_page( 'OptionTree', 'OptionTree', 'level_7', 'option_tree', array( $this, 'option_tree_options_page' ), $icon);
273
+ $option_tree_options = add_submenu_page( 'option_tree', 'OptionTree', 'Theme Options', 'level_7', 'option_tree', array( $this, 'option_tree_options_page' ) );
274
+ $option_tree_docs = add_submenu_page( 'option_tree', 'OptionTree', 'Documentation', 'level_7', 'option_tree_docs', array( $this, 'option_tree_docs_page' ) );
275
+ $option_tree_settings = add_submenu_page( 'option_tree', 'OptionTree', 'Settings', 'level_10', 'option_tree_settings', array( $this, 'option_tree_settings_page' ) );
276
+
277
+ // add menu items
278
+ add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
279
+ add_action( "admin_print_styles-$option_tree_docs", array( $this, 'option_tree_load' ) );
280
+ add_action( "admin_print_styles-$option_tree_settings", array( $this, 'option_tree_load' ) );
281
+ }
282
+
283
+ /**
284
+ * Load Scripts & Styles
285
+ *
286
+ * @uses wp_enqueue_style()
287
+ * @uses get_user_option()
288
+ * @uses add_thickbox()
289
+ * @uses wp_enqueue_script()
290
+ * @uses wp_deregister_style()
291
+ *
292
+ * @access public
293
+ * @since 1.0.0
294
+ *
295
+ * @return void
296
+ */
297
+ function option_tree_load()
298
+ {
299
+ // enqueue styles
300
+ wp_enqueue_style( 'option-tree-style', OT_PLUGIN_URL.'/assets/css/style.css', false, $this->version, 'screen');
301
+
302
+ // classic admin theme styles
303
+ if ( get_user_option( 'admin_color') == 'classic' )
304
+ wp_enqueue_style( 'option-tree-style-classic', OT_PLUGIN_URL.'/assets/css/style-classic.css', array( 'option-tree-style' ), $this->version, 'screen');
305
+
306
+ // enqueue scripts
307
+ add_thickbox();
308
+ wp_enqueue_script( 'jquery-table-dnd', OT_PLUGIN_URL.'/assets/js/jquery.table.dnd.js', array('jquery'), $this->version );
309
+ wp_enqueue_script( 'jquery-color-picker', OT_PLUGIN_URL.'/assets/js/jquery.color.picker.js', array('jquery'), $this->version );
310
+ wp_enqueue_script( 'jquery-option-tree', OT_PLUGIN_URL.'/assets/js/jquery.option.tree.js', array('jquery','media-upload','thickbox','jquery-ui-core','jquery-ui-tabs','jquery-table-dnd','jquery-color-picker'), $this->version );
311
+
312
+ // remove GD star rating conflicts
313
+ wp_deregister_style( 'gdsr-jquery-ui-core' );
314
+ wp_deregister_style( 'gdsr-jquery-ui-theme' );
315
+ }
316
+
317
+ /**
318
+ * Grab the wp_option_tree table options array
319
+ *
320
+ * @uses get_results()
321
+ *
322
+ * @access public
323
+ * @since 1.0.0
324
+ *
325
+ * @return array
326
+ */
327
+ function option_tree_data()
328
+ {
329
+ global $wpdb;
330
+
331
+ // create an array of options
332
+ $db_options = $wpdb->get_results( "SELECT * FROM {$this->table_name} ORDER BY item_sort ASC" );
333
+ return $db_options;
334
+ }
335
+
336
+ /**
337
+ * Theme Options Page
338
+ *
339
+ * @uses get_option()
340
+ * @uses get_option_page_ID()
341
+ * @uses option_tree_check_post_lock()
342
+ * @uses option_tree_check_post_lock()
343
+ * @uses option_tree_notice_post_locked()
344
+ *
345
+ * @access public
346
+ * @since 1.0.0
347
+ *
348
+ * @return string
349
+ */
350
+ function option_tree_options_page()
351
+ {
352
+ // set
353
+ $ot_array = $this->option_array;
354
+
355
+ // load saved option_tree
356
+ $settings = get_option( 'option_tree' );
357
+
358
+ // private page ID
359
+ $post_id = $this->get_option_page_ID( 'media' );
360
+
361
+ // set post lock
362
+ if ( $last = $this->option_tree_check_post_lock( $post_id ) )
363
+ {
364
+ $message = $this->option_tree_notice_post_locked( $post_id );
365
+ }
366
+ else
367
+ {
368
+ $this->option_tree_set_post_lock( $post_id );
369
+ }
370
+
371
+ // Grab Options Page
372
+ include( OT_PLUGIN_DIR.'/front-end/options.php' );
373
+ }
374
+
375
+ /**
376
+ * Settings Page
377
+ *
378
+ * @uses get_option()
379
+ * @uses get_option_page_ID()
380
+ * @uses option_tree_check_post_lock()
381
+ * @uses option_tree_check_post_lock()
382
+ * @uses option_tree_notice_post_locked()
383
+ *
384
+ * @access public
385
+ * @since 1.0.0
386
+ *
387
+ * @return string
388
+ */
389
+ function option_tree_settings_page()
390
+ {
391
+ $ot_array = $this->option_array;
392
+
393
+ // Load Saved Options
394
+ $settings = get_option('option_tree');
395
+
396
+ // private page ID
397
+ $post_id = $this->get_option_page_ID( 'options' );
398
+
399
+ // set post lock
400
+ if ( $last = $this->option_tree_check_post_lock( $post_id ) )
401
+ {
402
+ $message = $this->option_tree_notice_post_locked( $post_id );
403
+ }
404
+ else
405
+ {
406
+ $this->option_tree_set_post_lock( $post_id );
407
+ }
408
+
409
+ // Get Settings Page
410
+ include( OT_PLUGIN_DIR.'/front-end/settings.php');
411
+ }
412
+
413
+ /**
414
+ * Documentation Page
415
+ *
416
+ * @access public
417
+ * @since 1.0.0
418
+ *
419
+ * @return string
420
+ */
421
+ function option_tree_docs_page()
422
+ {
423
+ // Get Settings Page
424
+ include( OT_PLUGIN_DIR.'/front-end/docs.php');
425
+ }
426
+
427
+ /**
428
+ * Save Theme Option via AJAX
429
+ *
430
+ * @uses check_ajax_referer()
431
+ * @uses update_option()
432
+ * @uses option_tree_set_post_lock()
433
+ * @uses get_option_page_ID()
434
+ *
435
+ * @access public
436
+ * @since 1.0.0
437
+ *
438
+ * @return void
439
+ */
440
+ function option_tree_array_save()
441
+ {
442
+ // Check AJAX Referer
443
+ check_ajax_referer( '_theme_options', '_ajax_nonce' );
444
+
445
+ // set option values
446
+ foreach ( $this->option_array as $value )
447
+ {
448
+ // checkbox
449
+ if (
450
+ isset( $_REQUEST['checkboxes'] ) &&
451
+ ( $value->item_type == "checkbox" ||
452
+ $value->item_type == "posts" ||
453
+ $value->item_type == "pages" ||
454
+ $value->item_type == "categories" ||
455
+ $value->item_type == "tags" ||
456
+ $value->item_type == "custom_posts"
457
+ )
458
+ )
459
+ {
460
+ foreach( $_REQUEST['checkboxes'] as $key => $val )
461
+ {
462
+ if ($key == $value->item_id)
463
+ {
464
+ $values = implode(',',$val);
465
+ $new_settings[$key] = $values;
466
+ }
467
+ }
468
+ // no checkbox values
469
+ if ( !isset( $_REQUEST['checkboxes'] ) )
470
+ {
471
+ $key = $value->item_id;
472
+ $values = null;
473
+ $new_settings[$key] = $values;
474
+ }
475
+ // radio
476
+ }
477
+ else if ( isset( $_REQUEST['radios'] ) && $value->item_type == "radio" )
478
+ {
479
+ // grab radio array()
480
+ foreach( $_REQUEST['radios'] as $key => $val)
481
+ {
482
+ if ($key == $value->item_id)
483
+ {
484
+ $values = implode(',',$val);
485
+ $new_settings[$key] = $values;
486
+ }
487
+ }
488
+ // everything else
489
+ }
490
+ else
491
+ {
492
+ $key = trim( $value->item_id );
493
+ if ( isset( $_REQUEST[$key] ) )
494
+ {
495
+ $val = $_REQUEST[$key];
496
+ $new_settings[$key] = $val;
497
+ }
498
+ }
499
+ }
500
+
501
+ // Update Theme Options
502
+ update_option( 'option_tree', $new_settings );
503
+ $this->option_tree_set_post_lock( $this->get_option_page_ID( 'media' ) );
504
+
505
+ die();
506
+
507
+ }
508
+
509
+ /**
510
+ * Reset Theme Option via AJAX
511
+ *
512
+ * @uses check_ajax_referer()
513
+ * @uses update_option()
514
+ *
515
+ * @access public
516
+ * @since 1.0.0
517
+ *
518
+ * @return void
519
+ */
520
+ function option_tree_array_reset()
521
+ {
522
+ // Check AJAX Referer
523
+ check_ajax_referer( '_theme_options', '_ajax_nonce' );
524
+
525
+ // clear option values
526
+ foreach ( $this->option_array as $value )
527
+ {
528
+ $key = $value->item_id;
529
+ $new_options[$key] = '';
530
+ }
531
+
532
+ // update theme Options
533
+ update_option( 'option_tree', $new_options );
534
+
535
+ die();
536
+ }
537
+
538
+ /**
539
+ * Insert Row into Option Setting Table via AJAX
540
+ *
541
+ * @uses check_ajax_referer()
542
+ * @uses get_results()
543
+ * @uses insert()
544
+ * @uses get_var()
545
+ *
546
+ * @access public
547
+ * @since 1.0.0
548
+ *
549
+ * @return void
550
+ */
551
+ function option_tree_add() {
552
+ global $wpdb;
553
+
554
+ // check AJAX referer
555
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
556
+
557
+ // grab fresh options array
558
+ $ot_array = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
559
+
560
+ // get form data
561
+ $id = $_POST['id'];
562
+ $item_id = htmlspecialchars(stripslashes(trim($_POST['item_id'])), ENT_QUOTES,'UTF-8',true);
563
+ $item_title = htmlspecialchars(stripslashes(trim($_POST['item_title'])), ENT_QUOTES,'UTF-8',true);
564
+ $item_desc = htmlspecialchars(stripslashes(trim($_POST['item_desc'])), ENT_QUOTES,'UTF-8',true);
565
+ $item_type = htmlspecialchars(stripslashes(trim($_POST['item_type'])), ENT_QUOTES,'UTF-8',true);
566
+ $item_options = htmlspecialchars(stripslashes(trim($_POST['item_options'])), ENT_QUOTES,'UTF-8',true);
567
+
568
+ // validate item key
569
+ foreach( $ot_array as $value )
570
+ {
571
+ if ( $item_id == $value->item_id )
572
+ {
573
+ die( "That option key is already in use." );
574
+ }
575
+ }
576
+
577
+ // verify key is alphanumeric
578
+ if ( eregi( '[^a-z0-9_]', $item_id ) )
579
+ die("You must enter a valid option key.");
580
+
581
+ // verify title
582
+ if (strlen($item_title) < 1 )
583
+ die("You must give your option a title.");
584
+
585
+ if ( $item_type == 'textarea' && !is_numeric( $item_options ) )
586
+ die("The row value must be numeric.");
587
+
588
+ // update row
589
+ $wpdb->insert( $this->table_name,
590
+ array(
591
+ 'item_id' => $item_id,
592
+ 'item_title' => $item_title,
593
+ 'item_desc' => $item_desc,
594
+ 'item_type' => $item_type,
595
+ 'item_options' => $item_options,
596
+ 'item_sort' => $id
597
+ )
598
+ );
599
+
600
+ // verify values in the DB are updated
601
+ $updated = $wpdb->get_var("
602
+ SELECT id
603
+ FROM {$this->table_name}
604
+ WHERE item_id = '$item_id'
605
+ AND item_title = '$item_title'
606
+ AND item_type = '$item_type'
607
+ AND item_options = '$item_options'
608
+ ");
609
+
610
+ // if updated
611
+ if ( $updated )
612
+ {
613
+ die('updated');
614
+ }
615
+ else
616
+ {
617
+ die("There was an error, please try again.");
618
+ }
619
+ }
620
+
621
+ /**
622
+ * Update Option Setting Table via AJAX
623
+ *
624
+ * @uses check_ajax_referer()
625
+ * @uses get_results()
626
+ * @uses update()
627
+ * @uses get_var()
628
+ *
629
+ * @access public
630
+ * @since 1.0.0
631
+ *
632
+ * @return void
633
+ */
634
+ function option_tree_edit() {
635
+ global $wpdb;
636
+
637
+ // Check AJAX Referer
638
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
639
+
640
+ // grab fresh options array
641
+ $ot_array = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
642
+
643
+ // get form data
644
+ $id = $_POST['id'];
645
+ $item_id = htmlspecialchars(stripslashes(trim($_POST['item_id'])), ENT_QUOTES,'UTF-8',true);
646
+ $item_title = htmlspecialchars(stripslashes(trim($_POST['item_title'])), ENT_QUOTES,'UTF-8',true);
647
+ $item_desc = htmlspecialchars(stripslashes(trim($_POST['item_desc'])), ENT_QUOTES,'UTF-8',true);
648
+ $item_type = htmlspecialchars(stripslashes(trim($_POST['item_type'])), ENT_QUOTES,'UTF-8',true);
649
+ $item_options = htmlspecialchars(stripslashes(trim($_POST['item_options'])), ENT_QUOTES,'UTF-8',true);
650
+
651
+ // validate item key
652
+ foreach($ot_array as $value)
653
+ {
654
+ if ( $value->item_sort == $id )
655
+ {
656
+ if ($item_id == $value->item_id && $value->item_sort != $id)
657
+ {
658
+ die("That option key is already in use.");
659
+ }
660
+ }
661
+ else if ($item_id == $value->item_id && $value->id != $id)
662
+ {
663
+ die("That option key is already in use.");
664
+ }
665
+ }
666
+
667
+ // verify key is alphanumeric
668
+ if ( eregi( '[^a-z0-9_]', $item_id ) )
669
+ die("You must enter a valid option key.");
670
+
671
+ // verify title
672
+ if ( strlen( $item_title ) < 1 )
673
+ die("You must give your option a title.");
674
+
675
+ if ( $item_type == 'textarea' && !is_numeric( $item_options ) )
676
+ die("The row value must be numeric.");
677
+
678
+ // update row
679
+ $wpdb->update( $this->table_name,
680
+ array(
681
+ 'item_id' => $item_id,
682
+ 'item_title' => $item_title,
683
+ 'item_desc' => $item_desc,
684
+ 'item_type' => $item_type,
685
+ 'item_options' => $item_options
686
+ ),
687
+ array(
688
+ 'id' => $id
689
+ )
690
+ );
691
+
692
+ // verify values in the DB are updated
693
+ $updated = $wpdb->get_var("
694
+ SELECT id
695
+ FROM {$this->table_name}
696
+ WHERE item_id = '$item_id'
697
+ AND item_title = '$item_title'
698
+ AND item_type = '$item_type'
699
+ AND item_options = '$item_options'
700
+ ");
701
+
702
+ // if updated
703
+ if ( $updated )
704
+ {
705
+ die('updated');
706
+ }
707
+ else
708
+ {
709
+ die("There was an error, please try again.");
710
+ }
711
+ }
712
+
713
+ /**
714
+ * Remove Option via AJAX
715
+ *
716
+ * @uses check_ajax_referer()
717
+ * @uses query()
718
+ *
719
+ * @access public
720
+ * @since 1.0.0
721
+ *
722
+ * @return void
723
+ */
724
+ function option_tree_delete()
725
+ {
726
+ global $wpdb;
727
+
728
+ // check AJAX referer
729
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
730
+
731
+ // grab ID
732
+ $id = $_REQUEST['id'];
733
+
734
+ // delete item
735
+ $wpdb->query("
736
+ DELETE FROM $this->table_name
737
+ WHERE id = '$id'
738
+ ");
739
+
740
+ die('removed');
741
+ }
742
+
743
+ /**
744
+ * Get Option ID via AJAX
745
+ *
746
+ * @uses check_ajax_referer()
747
+ * @uses delete_post_meta()
748
+ *
749
+ * @access public
750
+ * @since 1.0.0
751
+ *
752
+ * @return void
753
+ */
754
+ function option_tree_next_id()
755
+ {
756
+ global $wpdb;
757
+
758
+ // check AJAX referer
759
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
760
+
761
+ // get ID
762
+ $id = $wpdb->get_var( "SELECT id FROM {$this->table_name} ORDER BY id DESC LIMIT 1" );
763
+
764
+ // return ID
765
+ die($id);
766
+ }
767
+
768
+ /**
769
+ * Update Sort Order via AJAX
770
+ *
771
+ * @uses check_ajax_referer()
772
+ * @uses update()
773
+ *
774
+ * @access public
775
+ * @since 1.0.0
776
+ *
777
+ * @return void
778
+ */
779
+ function option_tree_sort() {
780
+ global $wpdb;
781
+
782
+ // check AJAX referer
783
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
784
+
785
+ // create an array of IDs
786
+ $fields = explode('&', $_REQUEST['id']);
787
+
788
+ // set order
789
+ $order = 0;
790
+
791
+ // update the sort order
792
+ foreach( $fields as $field ) {
793
+ $order++;
794
+ $key = explode('=', $field);
795
+ $id = urldecode($key[1]);
796
+ $wpdb->update( $this->table_name,
797
+ array(
798
+ 'item_sort' => $order
799
+ ),
800
+ array(
801
+ 'id' => $id
802
+ )
803
+ );
804
+ }
805
+ die();
806
+ }
807
+
808
+ /**
809
+ * Upload XML Option Data
810
+ *
811
+ * @access public
812
+ * @since 1.0.0
813
+ *
814
+ * @return void
815
+ */
816
+ function option_tree_import_xml()
817
+ {
818
+ global $wpdb;
819
+
820
+ // action == upload
821
+ if ( isset($_GET['action']) && $_GET['action'] == 'upload' )
822
+ {
823
+ // fail no file
824
+ if ( $_FILES["import"]['name'] == null )
825
+ {
826
+ header("Location: admin.php?page=option_tree_settings&nofile=true#import_options");
827
+ die();
828
+ }
829
+ // fail errors
830
+ else if ( $_FILES["import"]["error"] > 0 )
831
+ {
832
+ header("Location: admin.php?page=option_tree_settings&error=true#import_options");
833
+ die();
834
+ }
835
+ else
836
+ {
837
+ // success - it's XML
838
+ if ( preg_match( "/(.xml)$/i", $_FILES["import"]['name'] ) )
839
+ {
840
+ $rawdata = file_get_contents( $_FILES["import"]["tmp_name"] );
841
+ $new_options = new SimpleXMLElement( $rawdata );
842
+
843
+ // drop table
844
+ $wpdb->query( "DROP TABLE $this->table_name" );
845
+
846
+ // create table
847
+ $wpdb->query( $this->option_tree_table( 'create' ) );
848
+
849
+ // insert data
850
+ foreach ( $new_options->row as $value )
851
+ {
852
+ $wpdb->insert( $this->table_name,
853
+ array(
854
+ 'item_id' => $value->item_id,
855
+ 'item_title' => $value->item_title,
856
+ 'item_desc' => $value->item_desc,
857
+ 'item_type' => $value->item_type,
858
+ 'item_options' => $value->item_options
859
+ )
860
+ );
861
+ }
862
+ // success redirect
863
+ header("Location: admin.php?page=option_tree_settings&xml=true#import_options");
864
+ die();
865
+ }
866
+ // fail
867
+ else
868
+ {
869
+ // redirect
870
+ header("Location: admin.php?page=option_tree_settings&error=true#import_options");
871
+ die();
872
+ }
873
+ }
874
+ }
875
+ }
876
+
877
+ /**
878
+ * Import Option Data via AJAX
879
+ *
880
+ * @uses check_ajax_referer()
881
+ * @uses update()
882
+ *
883
+ * @access public
884
+ * @since 1.0.0
885
+ *
886
+ * @return void
887
+ */
888
+ function option_tree_import_data()
889
+ {
890
+ global $wpdb;
891
+
892
+ // check AJAX referer
893
+ check_ajax_referer( '_import_data', '_ajax_nonce' );
894
+
895
+ // Get Data
896
+ $string = $_REQUEST['import_options'];
897
+
898
+ // Unserialize The Array
899
+ $new_options = unserialize( base64_decode( $string ) );
900
+
901
+ // check if array()
902
+ if ( is_array( $new_options ) )
903
+ {
904
+ // delete old options
905
+ delete_option( 'option_tree' );
906
+
907
+ // create new options
908
+ add_option('option_tree', $new_options);
909
+
910
+ // redirect
911
+ die();
912
+ }
913
+ // failed
914
+ die(-1);
915
+ }
916
+
917
+ /**
918
+ * Returns the ID of a cutom post tpye
919
+ *
920
+ * @uses get_results()
921
+ *
922
+ * @access public
923
+ * @since 1.0.0
924
+ *
925
+ * @param string $page_title
926
+ *
927
+ * @return int
928
+ */
929
+ function get_option_page_ID( $page_title = '' )
930
+ {
931
+ global $wpdb;
932
+
933
+ return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '{$page_title}' AND post_type = 'option-tree' AND post_status != 'trash'");
934
+ }
935
+
936
+ /**
937
+ * Register custom post type & create two posts
938
+ *
939
+ * @uses get_results()
940
+ *
941
+ * @access public
942
+ * @since 1.0.0
943
+ *
944
+ * @return void
945
+ */
946
+ function create_option_post()
947
+ {
948
+ register_post_type( 'option-tree', array(
949
+ 'labels' => array(
950
+ 'name' => __( 'Options' ),
951
+ ),
952
+ 'public' => true,
953
+ 'show_ui' => false,
954
+ 'capability_type' => 'post',
955
+ 'exclude_from_search' => true,
956
+ 'hierarchical' => false,
957
+ 'rewrite' => false,
958
+ 'supports' => array( 'title', 'editor' ),
959
+ 'can_export' => true,
960
+ 'show_in_nav_menus' => false,
961
+ ) );
962
+
963
+ // create a private page to attach media to
964
+ if ( isset($_GET['page']) && $_GET['page'] == 'option_tree' )
965
+ {
966
+ // look for custom page
967
+ $page_id = $this->get_option_page_ID( 'media' );
968
+
969
+ // no page create it
970
+ if ( ! $page_id )
971
+ {
972
+ // create post object
973
+ $_p = array();
974
+ $_p['post_title'] = 'Media';
975
+ $_p['post_status'] = 'private';
976
+ $_p['post_type'] = 'option-tree';
977
+ $_p['comment_status'] = 'closed';
978
+ $_p['ping_status'] = 'closed';
979
+
980
+ // insert the post into the database
981
+ $page_id = wp_insert_post( $_p );
982
+ }
983
+ }
984
+
985
+ // create a private page for settings page
986
+ if ( isset($_GET['page']) && $_GET['page'] == 'option_tree_settings' )
987
+ {
988
+ // look for custom page
989
+ $page_id = $this->get_option_page_ID( 'options' );
990
+
991
+ // no page create it
992
+ if ( ! $page_id )
993
+ {
994
+ // create post object
995
+ $_p = array();
996
+ $_p['post_title'] = 'Options';
997
+ $_p['post_status'] = 'private';
998
+ $_p['post_type'] = 'option-tree';
999
+ $_p['comment_status'] = 'closed';
1000
+ $_p['ping_status'] = 'closed';
1001
+
1002
+ // insert the post into the database
1003
+ $page_id = wp_insert_post( $_p );
1004
+ }
1005
+ }
1006
+ }
1007
+
1008
+ /**
1009
+ * Outputs the notice message to say that someone else is editing this post at the moment.
1010
+ *
1011
+ * @uses get_userdata()
1012
+ * @uses get_post_meta()
1013
+ * @uses esc_html()
1014
+ *
1015
+ * @access public
1016
+ * @since 1.0.0
1017
+ *
1018
+ * @param int $post_id
1019
+ *
1020
+ * @return string
1021
+ */
1022
+ function option_tree_notice_post_locked( $post_id )
1023
+ {
1024
+ if ( !$post_id )
1025
+ return false;
1026
+
1027
+ $last_user = get_userdata( get_post_meta( $post_id, '_edit_last', true ) );
1028
+ $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
1029
+ $the_page = ( $_GET['page'] == 'option_tree' ) ? __('Theme Options') : __('Settings');
1030
+
1031
+ $message = sprintf( __( 'Warning: %s is currently editing the %s.' ), esc_html( $last_user_name ), $the_page );
1032
+ return '<div class="message warning"><span>&nbsp;</span>'.$message.'</div>';
1033
+ }
1034
+
1035
+ /**
1036
+ * Check to see if the post is currently being edited by another user.
1037
+ *
1038
+ * @uses get_post_meta()
1039
+ * @uses apply_filters()
1040
+ * @uses get_current_user_id()
1041
+ *
1042
+ * @access public
1043
+ * @since 1.0.0
1044
+ *
1045
+ * @param int $post_id
1046
+ *
1047
+ * @return bool
1048
+ */
1049
+ function option_tree_check_post_lock( $post_id )
1050
+ {
1051
+ if ( !$post_id )
1052
+ return false;
1053
+
1054
+ $lock = get_post_meta( $post_id, '_edit_lock', true );
1055
+ $last = get_post_meta( $post_id, '_edit_last', true );
1056
+
1057
+ $time_window = apply_filters( 'wp_check_post_lock_window', 30 );
1058
+
1059
+ if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
1060
+ return $last;
1061
+
1062
+ return false;
1063
+ }
1064
+
1065
+ /**
1066
+ * Mark the post as currently being edited by the current user
1067
+ *
1068
+ * @uses update_post_meta()
1069
+ * @uses get_current_user_id()
1070
+ *
1071
+ * @access public
1072
+ * @since 1.0.0
1073
+ *
1074
+ * @param int $post_id
1075
+ *
1076
+ * @return bool
1077
+ */
1078
+ function option_tree_set_post_lock( $post_id )
1079
+ {
1080
+ if ( !$post_id )
1081
+ return false;
1082
+
1083
+ if ( 0 == get_current_user_id() )
1084
+ return false;
1085
+
1086
+ $now = time();
1087
+
1088
+ update_post_meta( $post_id, '_edit_lock', $now );
1089
+ update_post_meta( $post_id, '_edit_last', get_current_user_id() );
1090
+ }
1091
+
1092
+ /**
1093
+ * Remove the post lock
1094
+ *
1095
+ * @uses delete_post_meta()
1096
+ *
1097
+ * @access public
1098
+ * @since 1.0.0
1099
+ *
1100
+ * @param int $post_id
1101
+ *
1102
+ * @return bool
1103
+ */
1104
+ function option_tree_remove_post_lock( $post_id )
1105
+ {
1106
+ if ( !$post_id )
1107
+ return false;
1108
+
1109
+ delete_post_meta( $post_id, '_edit_lock' );
1110
+ delete_post_meta( $post_id, '_edit_last' );
1111
+ }
1112
+
1113
+ }
front-end/docs.php ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed'); ?>
2
+
3
+ <div id="framework_wrap" class="wrap">
4
+
5
+ <div id="header">
6
+ <h1>OptionTree</h1>
7
+ <span class="icon">&nbsp;</span>
8
+ <div class="version">
9
+ <?php echo OT_VERSION; ?>
10
+ </div>
11
+ </div>
12
+
13
+ <div id="content_wrap">
14
+
15
+ <div class="info top-info"></div>
16
+
17
+ <div id="content">
18
+ <div id="options_tabs" class="docs">
19
+
20
+ <ul class="options_tabs">
21
+ <li><a href="#general">Usage &amp; Examples</a><span></span></li>
22
+ <li><a href="#option_types">Option Types</a><span></span></li>
23
+ <li><a href="#settings">Creating Options</a><span></span></li>
24
+ </ul>
25
+
26
+ <div id="general" class="block">
27
+ <h2>Usage &amp; Examples</h2>
28
+ <h3>Function Reference/get_option_tree</h3>
29
+
30
+ <h3>Description</h3>
31
+ <p>Displays or returns a value from the 'option_tree' array.</p>
32
+
33
+ <h3>Usage</h3>
34
+ <p><code>&lt;?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?&gt;</code></p>
35
+
36
+ <h3>Default Usage</h3>
37
+ <pre><code>get_option_tree(
38
+ 'item_id' => '',
39
+ 'options' => '',
40
+ 'echo' => 'false',
41
+ 'is_array' => 'false',
42
+ 'offset' => -1,
43
+ );</code></pre>
44
+
45
+ <h3>Parameters</h3>
46
+ <p>
47
+ <code><strong>$item_id</strong></code>
48
+ <br />&nbsp;&nbsp;(<em>string</em>) (<em>required</em>) Enter a unique Option Key to get a returned value or array.
49
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;Default: <em>None</em>
50
+ </p>
51
+ <p>
52
+ <code><strong>$options</strong></code>
53
+ <br />&nbsp;&nbsp;(<em>array</em>) (<em>optional</em>) Used to cut down on database queries in template files.
54
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;Default: <em>None</em>
55
+ </p>
56
+ <p>
57
+ <code><strong>$echo</strong></code>
58
+ <br />&nbsp;&nbsp;(<em>boolean</em>) (<em>optional</em>) Echo the output.
59
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;Default: FALSE
60
+ </p>
61
+ <p>
62
+ <code><strong>$is_array</strong></code>
63
+ <br />&nbsp;&nbsp;(<em>boolean</em>) (<em>optional</em>) Used to indicate the $item_id is an array of values.
64
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;Default: FALSE
65
+ </p>
66
+ <p>
67
+ <code><strong>$offset</strong></code>
68
+ <br />&nbsp;&nbsp;(<em>integer</em>) (<em>optional</em>) Numeric offset key for the $item_id array, -1 will return all values (an array starts at 0).
69
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;Default: -1
70
+ </p>
71
+
72
+
73
+ <h3>Examples</h3>
74
+ <p>
75
+ This example assigns the value of the <code>get_option('option_tree')</code> array to the variable <code>$theme_options</code> for use in PHP. You would then add this code to the top of your header.php file and use that variable as the <code>$options</code> variable in the <code>get_option_tree()</code> function. This helps to reduce database queries anytime you want to request multiple theme options in a template files. This is optional, but may help speed up things up.
76
+ <pre><code>&lt?php $theme_options = get_option('option_tree'); ?&gt;</code></pre>
77
+ </p>
78
+
79
+ <p>
80
+ This example returns the $item_id value.
81
+ <pre><code>&lt?php
82
+ if ( function_exists( 'get_option_tree' ) ) {
83
+ get_option_tree( 'test_option' );
84
+ }
85
+ ?&gt;</code></pre>
86
+ </p>
87
+
88
+ <p>
89
+ These examples will echo the $item_id value.
90
+ <pre><code>&lt?php
91
+ if ( function_exists( 'get_option_tree') ) {
92
+ get_option_tree( 'test_option', '', true );
93
+ }
94
+ ?&gt;
95
+
96
+ &lt?php
97
+ if ( function_exists( 'get_option_tree') ) {
98
+ echo get_option_tree( 'test_option' );
99
+ }
100
+ ?&gt;</code></pre>
101
+ </p>
102
+
103
+ <p>
104
+ This example will echo the value of $item_id by grabbing the first offset key in the array. At the moment, this will only work if the item_type is a checkbox.
105
+ <pre><code>&lt?php
106
+ if ( function_exists( 'get_option_tree' ) ) {
107
+ get_option_tree( 'test_option', '', true, true, 0 );
108
+ }
109
+ ?&gt;</code></pre>
110
+ </p>
111
+
112
+ <p>
113
+ This example assigns the value of $item_id to the variable $ids for use in PHP. As well, it uses the <code>$theme_options</code> variable I set in the first example above in my header.php file to reduce database queries. It then loops through all the array items and echos an unordered list of page links (navigation).
114
+ <pre><code>&lt?php
115
+ if ( function_exists( 'get_option_tree' ) ) {
116
+ // set an array of page id's
117
+ $ids = get_option_tree( 'list_of_page_ids', $theme_options, false, true, -1 );
118
+
119
+ // loop through id's & echo custom navigation
120
+ echo '&lt;ul&gt;';
121
+ foreach( $ids as $id ) {
122
+ echo '&lt;li&gt;&lt;a href="'.get_permalink($id).'"&gt;'.get_the_title($id).'&lt;/a&gt;&lt;/li&gt;';
123
+ }
124
+ echo '&lt;/ul&gt;';
125
+ }
126
+ ?&gt;</code></pre>
127
+ OR a more WordPress version would be:<br /><br />
128
+ <pre><code>&lt?php
129
+ if ( function_exists( 'get_option_tree' ) ) {
130
+ // set an array of page id's
131
+ $ids = get_option_tree( 'list_of_page_ids', $theme_options, false, true, -1 );
132
+
133
+ // echo custom navigation using wp_list_pages()
134
+ echo '&lt;ul&gt;';
135
+ wp_list_pages(
136
+ array(
137
+ 'include' => $ids,
138
+ 'title_li' => ''
139
+ )
140
+ );
141
+ echo '&lt;/ul&gt;';
142
+ }
143
+ ?&gt;</code></pre>
144
+ </p>
145
+
146
+ </div>
147
+
148
+ <div id="option_types" class="block">
149
+ <h2>Option Types</h2>
150
+ <h3>Overview of available Option Types.</h3>
151
+
152
+ <p>
153
+ <strong>Heading</strong>:<br />
154
+ Used only in the WordPress Admin area to logical separate Theme Options into sections for easy editing. A Heading will create a navigation menu item on the <a href="<?php echo admin_url().'admin.php?page=option_tree'; ?>"><strong>Theme Options</strong></a> page. You would NEVER use this in your themes template files.
155
+ </p>
156
+
157
+ <p>
158
+ <strong>Textblock</strong>:<br />
159
+ Used only in the WordPress Admin area. A Textblock will allow you to create &amp; display HTML on your <a href="<?php echo admin_url().'admin.php?page=option_tree'; ?>"><strong>Theme Options</strong></a> page. You can then use the Textblock to add a more detailed set of instruction on how the options are used in your theme. You would NEVER use this in your themes template files.
160
+ </p>
161
+
162
+ <p>
163
+ <strong>Input</strong>:<br />
164
+ The Input option type would be used to save a simple string value. Maybe a link to feedburner, your Twitter username, or Google Analytics ID. Any optional or required text that is of reasonably short character length.
165
+ </p>
166
+
167
+ <p>
168
+ <strong>Checkbox</strong>:<br />
169
+ A Checkbox option type could ask a question. For example, "Do you want to activate asynchronous Google analytics?" would be a simple one checkbox question. You could have more complex usages but the idea is that you can easily grab the value of the checkbox and use it in you theme. In this situation you would test if the checkbox has a value and execute a block of code if it does and do nothing if it doesn't.
170
+ </p>
171
+
172
+ <p>
173
+ <strong>Radio</strong>:<br />
174
+ A Radio option type could ask a question. For example, "Do you want to activate the custom navigation?" could require a yes or no answer with a radio option. In this situation you would test if the radio has a value of 'yes' and execute a block of code, or if it's 'no' execute a different block of code. Since a radio has to be one or the other nothing will execute if you have not saved the options yet.
175
+ </p>
176
+
177
+ <p>
178
+ <strong>Select</strong>:<br />
179
+ Could use the Select option type to list different theme styles or choose any other setting that would be chosen from a select option list.
180
+ </p>
181
+
182
+ <p>
183
+ <strong>Textarea</strong>:<br />
184
+ With the Textarea option type users can add custom code or text for use in the theme.
185
+ </p>
186
+
187
+ <p>
188
+ <strong>Upload</strong>:<br />
189
+ The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "<strong style="color:red;">Insert into Post</strong>" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You'll have to re-upload or FTP any media to your new server and change the URIs if necessary.
190
+ </p>
191
+
192
+ <p>
193
+ <strong>Colorpicker</strong>:<br />
194
+ A Colorpicker is a very self explanatory feature that saves hex HTML color codes. Use it to set/change the color of something in your theme.
195
+ </p>
196
+
197
+ <p>
198
+ <strong>Post</strong>:<br />
199
+ The Post option type is an option select list of post IDs. It will return a single post ID for use in a custom function or loop.
200
+ </p>
201
+
202
+ <p>
203
+ <strong>Posts</strong>:<br />
204
+ The Posts option type is a checkbox list of post IDs. It will return an array of multiple post IDs for use in a custom function or loop.
205
+ </p>
206
+
207
+ <p>
208
+ <strong>Page</strong>:<br />
209
+ The Page option type is an option select list of page IDs. It will return a single page ID for use in a custom function or loop.
210
+ </p>
211
+
212
+ <p>
213
+ <strong>Pages</strong>:<br />
214
+ The Pages option type is a checkbox list of page IDs. It will return an array of multiple page IDs for use in a custom function or loop.
215
+ </p>
216
+
217
+ <p>
218
+ <strong>Category</strong>:<br />
219
+ The Category type is an option select list of category IDs. It will return a single category ID for use in a custom function or loop.
220
+ </p>
221
+
222
+ <p>
223
+ <strong>Categories</strong>:<br />
224
+ The Categories option type is a checkbox list of category IDs. It will return an array of multiple category IDs for use in a custom function or loop.
225
+ </p>
226
+
227
+ <p>
228
+ <strong>Tag</strong>:<br />
229
+ The Tag option type is an option select list of tag IDs. It will return a single tag ID for use in a custom function or loop.
230
+ </p>
231
+
232
+ <p>
233
+ <strong>Tags</strong>:<br />
234
+ The Tags option type is a checkbox list of tag IDs. It will return an array of multiple tag IDs for use in a custom function or loop.
235
+ </p>
236
+
237
+ <p>
238
+ <strong>Custom Post</strong>:<br />
239
+ The Custom Post option type is an option select list of IDs from any available wordpress post type or custom post type. It will return a single ID for use in a custom function or loop. Custom Post requires the post_type you are querying when created.
240
+ </p>
241
+
242
+ <p>
243
+ <strong>Custom Posts</strong>:<br />
244
+ The Custom Posts option type is a checkbox list of IDs from any available wordpress post type or custom post type. It will return an array of multiple IDs for use in a custom function or loop. Custom Posts requires the post_type you are querying when created.
245
+ </p>
246
+
247
+ </div>
248
+
249
+ <div id="settings" class="block">
250
+ <h2>Creating Options</h2>
251
+ <h3>Overview of available Theme Option fields.</h3>
252
+
253
+ <p>
254
+ <strong>Title</strong>:<br />
255
+ The Title field should be a short but descriptive block of text 100 characters or less with no HTML.
256
+ </p>
257
+
258
+ <p>
259
+ <strong>Option Key</strong>:<br />
260
+ The Option Key field is a unique alphanumeric key used to differentiate each theme option (underscores are acceptable). Also, the plugin will lowercase any text you write in this field and bridge all spaces with an underscore automatically.
261
+ </p>
262
+
263
+ <p style="padding-bottom:5px">
264
+ <strong>Option Type</strong>:<br />
265
+ You are required to choose one of the supported option types. They are:
266
+ </p>
267
+ <ul class="doc_list">
268
+ <li>Heading</li>
269
+ <li>Textblock</li>
270
+ <li>Input</li>
271
+ <li>Checkbox</li>
272
+ <li>Radio</li>
273
+ <li>Select</li>
274
+ <li>Textarea</li>
275
+ <li>Upload</li>
276
+ <li>Colorpicker</li>
277
+ <li>Post</li>
278
+ <li>Posts</li>
279
+ <li>Page</li>
280
+ <li>Pages</li>
281
+ <li>Category</li>
282
+ <li>Categories</li>
283
+ <li>Tag</li>
284
+ <li>Tags</li>
285
+ <li>Custom Post</li>
286
+ <li>Custom Posts</li>
287
+ </ul>
288
+
289
+ <p>
290
+ <strong>Description</strong>:<br />
291
+ Enter a detailed description of the option for end users to read. However, if the option type is a Textblock, enter the text you want to display (HTML is allowed).
292
+ </p>
293
+
294
+ <p>
295
+ <strong>Options</strong>:<br />
296
+ Enter a comma separated list of options in this field. For example, you could have "One,Two,Three" or just a single value like "Yes" for a checkbox.
297
+ </p>
298
+
299
+ <p>
300
+ <strong>Row Count</strong>:<br />
301
+ Enter a numeric value for the number of rows in your textarea.
302
+ </p>
303
+
304
+ <p style="padding-bottom:5px">
305
+ <strong>Post Type</strong>:<br />
306
+ Enter your custom post_type. These are the default post types available with WordPress. You can also add your own custom post_type.
307
+ </p>
308
+ <ul class="doc_list">
309
+ <li>post</li>
310
+ <li>page</li>
311
+ <li>attachment</li>
312
+ <li>any</li>
313
+ </ul>
314
+
315
+ </div>
316
+
317
+ <br class="clear" />
318
+ </div>
319
+ </div>
320
+ <div class="info bottom"></div>
321
+ </div>
322
+
323
+ </div>
324
+ <!-- [END] framework_wrap -->
front-end/options.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed'); ?>
2
+
3
+ <div id="framework_wrap" class="wrap">
4
+
5
+ <div id="header">
6
+ <h1>OptionTree</h1>
7
+ <span class="icon">&nbsp;</span>
8
+ <div class="version">
9
+ <?php echo OT_VERSION; ?>
10
+ </div>
11
+ </div>
12
+
13
+ <div id="content_wrap">
14
+
15
+ <form method="post" id="the-theme-options">
16
+
17
+ <div class="info top-info">
18
+
19
+ <input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit"/>
20
+
21
+ </div>
22
+
23
+ <div class="ajax-message<?php if ( isset( $message ) ) { echo ' show'; } ?>">
24
+
25
+ <?php if ( isset( $message ) ) { echo $message; } ?>
26
+
27
+ </div>
28
+
29
+ <div id="content">
30
+
31
+ <div id="options_tabs">
32
+
33
+ <ul class="options_tabs">
34
+ <?php
35
+ foreach ( $ot_array as $value )
36
+ {
37
+ if ( $value->item_type == 'heading' )
38
+ {
39
+ echo '<li><a href="#option_'.$value->item_id.'">' . htmlspecialchars_decode( $value->item_title ).'</a><span></span></li>';
40
+ }
41
+ }
42
+ ?>
43
+ </ul>
44
+
45
+ <?php
46
+ // set count
47
+ $count = 0;
48
+ // loop options & load corresponding function
49
+ foreach ( $ot_array as $value )
50
+ {
51
+ $count++;
52
+ if ( $value->item_type == 'upload' )
53
+ {
54
+ $int = $post_id;
55
+ }
56
+ else if ( $value->item_type == 'textarea' )
57
+ {
58
+ $int = ( is_numeric( trim( $value->item_options ) ) ) ? trim( $value->item_options ) : 8;
59
+ }
60
+ else
61
+ {
62
+ $int = $count;
63
+ }
64
+ call_user_func_array( 'option_tree_' . $value->item_type, array( $value, $settings, $int ) );
65
+ }
66
+ // close heading
67
+ echo '</div>';
68
+ ?>
69
+
70
+ <br class="clear" />
71
+
72
+ </div>
73
+
74
+ </div>
75
+
76
+ <div class="info bottom">
77
+
78
+ <input type="submit" value="<?php _e('Reset Options') ?>" class="button-framework reset" name="reset"/>
79
+ <input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit"/>
80
+
81
+ </div>
82
+
83
+ <?php wp_nonce_field( '_theme_options', '_ajax_nonce', false ); ?>
84
+
85
+ </form>
86
+
87
+ </div>
88
+
89
+ </div>
90
+ <!-- [END] framework_wrap -->
front-end/settings.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed'); ?>
2
+
3
+ <div id="framework_wrap" class="wrap">
4
+
5
+ <div id="header">
6
+ <h1>OptionTree</h1>
7
+ <span class="icon">&nbsp;</span>
8
+ <div class="version">
9
+ <?php echo OT_VERSION; ?>
10
+ </div>
11
+ </div>
12
+
13
+ <div id="content_wrap">
14
+
15
+ <div class="info top-info">
16
+ </div>
17
+
18
+ <div class="ajax-message<?php if ( isset($_GET['xml']) || isset($_GET['error']) || isset($_GET['nofile']) || isset($_GET['empty']) || isset( $message ) ) { echo ' show'; } ?>">
19
+ <?php if(isset($_GET['xml'])) { echo '<div class="message"><span>&nbsp;</span>Theme Options Created</div>'; } ?>
20
+ <?php if(isset($_GET['error'])) { echo '<div class="message warning"><span>&nbsp;</span>Wrong File Type!</div>'; } ?>
21
+ <?php if(isset($_GET['nofile'])) { echo '<div class="message warning"><span>&nbsp;</span>Please add a file.</div>'; } ?>
22
+ <?php if(isset($_GET['empty'])) { echo '<div class="message warning"><span>&nbsp;</span>An error occurred while importing your data.</div>'; } ?>
23
+ <?php if ( isset( $message ) ) { echo $message; } ?>
24
+ </div>
25
+
26
+ <div id="content">
27
+ <div id="options_tabs">
28
+ <ul class="options_tabs">
29
+ <li><a href="#tree_settings">Create</a><span></span></li>
30
+ <li><a href="#import_options">Import</a><span></span></li>
31
+ <li><a href="#export_options">Export</a><span></span></li>
32
+ </ul>
33
+
34
+ <div id="tree_settings" class="block has-table">
35
+ <form method="post" id="theme-options" class="option-tree-settings">
36
+ <h2>Create</h2>
37
+ <h3>Create the Theme Options</h3>
38
+ <p><strong style="color:red;">WARNING!</strong> If you're unsure or not completely positive that you should be editing these options, you should read the <a href="<?php echo admin_url().'admin.php?page=option_tree_docs'; ?>"><strong>Documentation</strong></a> first.</p>
39
+ <p>You can create as many Theme Options as your project requires and use them how you see fit. When you add an option here, it will be available on the <a href="<?php echo admin_url().'admin.php?page=option_tree'; ?>"><strong>Theme Options</strong></a> page for use in your theme. To break your Theme Options into sections, add a "<strong>heading</strong>" option type and a new navigation menu item will be created.</p>
40
+ <p>All of the Theme Options can be sorted and rearranged to your liking with <strong>Drag &amp; Drop</strong>. Don't worry about the order in which you create your options, you can always reorder them.</p>
41
+ <table cellspacing="0">
42
+ <thead>
43
+ <tr>
44
+ <th class="col-title">Title</th>
45
+ <th class="col-key">Key</th>
46
+ <th class="col-type">Type</th>
47
+ <th class="col-edit"><a href="javascript:;" class="add-option">Add Option</a></th>
48
+ </tr>
49
+ </thead>
50
+ <tfoot>
51
+ <tr>
52
+ <th class="col-title">Title</th>
53
+ <th class="col-key">Key</th>
54
+ <th class="col-type">Type</th>
55
+ <th class="col-edit"><a href="javascript:;" class="add-option">Add Option</a></th>
56
+ </tr>
57
+ </tfoot>
58
+ <tbody id="framework-settings" class="dragable">
59
+ <?php
60
+ $count = 0;
61
+ foreach ( $ot_array as $value ) {
62
+ $count++;
63
+ $heading = ($value->item_type == 'heading') ? true : false; ?>
64
+ <tr id="option-<?php echo $value->id; ?>" class="<?php echo ($heading) ? 'col-heading ' : ''; ?><?php echo ($count==1) ? 'nodrag nodrop' : ''; ?>">
65
+ <td class="col-title"<?php echo ($heading) ? ' colspan="3"' : ''; ?>><?php echo (!$heading) ? '&ndash; ' : ''; ?><?php echo htmlspecialchars_decode( $value->item_title ); ?></td>
66
+ <td class="col-key<?php echo ($heading) ? ' hide' : ''; ?>"><?php echo htmlspecialchars(stripslashes($value->item_id)); ?></td>
67
+ <td class="col-type<?php echo ($heading) ? ' hide' : ''; ?>"><?php echo $value->item_type; ?></td>
68
+ <td class="col-edit">
69
+ <a href="javascript:;" class="edit-inline">Edit</a>
70
+ <a href="javascript:;" class="delete-inline">Delete</a>
71
+ <div class="hidden item-data" id="inline_<?php echo $value->id; ?>">
72
+ <div class="item_title"><?php echo htmlspecialchars_decode( $value->item_title ); ?></div>
73
+ <div class="item_id"><?php echo $value->item_id; ?></div>
74
+ <div class="item_type"><?php echo $value->item_type; ?></div>
75
+ <div class="item_desc"><?php echo esc_html(stripslashes($value->item_desc)); ?></div>
76
+ <div class="item_options"><?php echo esc_html(stripslashes($value->item_options)); ?></div>
77
+ </div>
78
+ </td>
79
+ </tr>
80
+ <?php } ?>
81
+ </tbody>
82
+ </table>
83
+ <table style="display:none">
84
+ <tbody id="framework-settings-edit">
85
+ <tr id="inline-edit" class="inline-edit-option nodrop nodrag">
86
+ <td colspan="4">
87
+ <div class="option option-title">
88
+ <div class="section">
89
+ <div class="element">
90
+ <input type="text" name="item_title" class="item_title" value="" />
91
+ </div>
92
+ <div class="description">
93
+ <strong>Title:</strong> Displayed on the Theme Options page.
94
+ </div>
95
+ </div>
96
+ </div>
97
+ <div class="option option-id">
98
+ <div class="section">
99
+ <div class="element">
100
+ <input type="text" name="item_id" class="item_id" value="" />
101
+ </div>
102
+ <div class="description">
103
+ <strong>Option Key:</strong> Unique alphanumeric key, underscores are acceptable.
104
+ </div>
105
+ </div>
106
+ </div>
107
+ <div class="option option-type">
108
+ <div class="section">
109
+ <div class="element">
110
+ <div class="select_wrapper">
111
+ <select name="item_type" class="select item_type">
112
+ <?php
113
+ $types = array(
114
+ 'heading' => 'Heading',
115
+ 'textblock' => 'Textblock',
116
+ 'input' => 'Input',
117
+ 'checkbox' => 'Checkbox',
118
+ 'radio' => 'Radio',
119
+ 'select' => 'Select',
120
+ 'textarea' => 'Textarea',
121
+ 'upload' => 'Upload',
122
+ 'colorpicker' => 'Colorpicker',
123
+ 'post' => 'Post',
124
+ 'posts' => 'Posts',
125
+ 'page' => 'Page',
126
+ 'pages' => 'Pages',
127
+ 'category' => 'Category',
128
+ 'categories' => 'Categories',
129
+ 'tag' => 'Tag',
130
+ 'tags' => 'Tags',
131
+ 'custom_post' => 'Custom Post',
132
+ 'custom_posts' => 'Custom Posts'
133
+ );
134
+ foreach ( $types as $key => $value )
135
+ {
136
+ echo '<option value="'.$key.'">'.$value.'</option>';
137
+ }
138
+ ?>
139
+ </select>
140
+ </div>
141
+ </div>
142
+ <div class="description">
143
+ <strong>Option Type:</strong> Choose one of the supported option types.
144
+ </div>
145
+ </div>
146
+ </div>
147
+ <div class="option option-desc">
148
+ <div class="section">
149
+ <div class="element">
150
+ <textarea name="item_desc" class="item_desc" rows="8"></textarea>
151
+ </div>
152
+ <div class="description">
153
+ <strong>Description:</strong> Enter a detailed description of the option for end users to read. However, if the option type is a <strong>Textblock</strong>, enter the text you want to display (HTML is allowed).
154
+ </div>
155
+ </div>
156
+ </div>
157
+ <div class="option option-options">
158
+ <div class="section">
159
+ <div class="element">
160
+ <input type="text" name="item_options" class="item_options" value="" />
161
+ </div>
162
+ <div class="description">
163
+ <span class="regular"><strong>Options:</strong> Enter a comma separated list of options. For example, you could have "One,Two,Three" or just a single value like "Yes" for a checkbox.</span>
164
+ <span class="alternative" style="display:none;">&nbsp;</span>
165
+ </div>
166
+ </div>
167
+ </div>
168
+ <?php wp_nonce_field( 'inlineeditnonce', '_ajax_nonce', false ); ?>
169
+ <div class="inline-edit-save">
170
+ <a href="#" class="cancel button-framework reset">Cancel</a>
171
+ <a href="#" class="save button-framework">Save</a>
172
+ </div>
173
+ </td>
174
+ </tr>
175
+ <tr id="inline-add">
176
+ <td class="col-title"></td>
177
+ <td class="col-key"></td>
178
+ <td class="col-type"></td>
179
+ <td class="col-edit">
180
+ <a href="#" class="edit-inline">Edit</a>
181
+ <a href="#" class="delete-inline">Delete</a>
182
+ <div class="hidden item-data">
183
+ <div class="item_title"></div>
184
+ <div class="item_id"></div>
185
+ <div class="item_type"></div>
186
+ <div class="item_desc"></div>
187
+ <div class="item_options"></div>
188
+ </div>
189
+ </td>
190
+ </tr>
191
+ </tbody>
192
+ </table>
193
+ </form>
194
+ </div>
195
+
196
+ <div id="import_options" class="block">
197
+ <h2>Import</h2>
198
+
199
+ <form method="post" action="admin.php?page=option_tree_settings&action=upload" enctype="multipart/form-data" id="upload-xml">
200
+ <input type="hidden" name="action" value="upload" />
201
+ <div class="option option-upload">
202
+ <h3>Theme Options XML</h3>
203
+ <div class="section desc-text">
204
+ <p>If you were given a Theme Options XML file with a premium or free theme, locate it on your hard drive and upload that file here. It's also possible that you did all your development on a local server and just need to get your live site in working condition from your own exported settings file. Either way, once you have the proper file in the input field below, click the "Import XML" button.</p>
205
+ <p>However, if you're a theme developer activating the plugin for the first time, you can get started by clicking the Developers Settings link to the left.</p>
206
+ <input name="import" type="file" class="file" />
207
+ <input type="submit" value="<?php _e('Import XML') ?>" class="ob_button right" />
208
+ </div>
209
+ </div>
210
+ </form>
211
+
212
+ <form method="post" id="import-data">
213
+ <div class="option option-input">
214
+ <h3>Theme Options Data</h3>
215
+ <div class="section">
216
+ <div class="element">
217
+ <textarea name="import_options" rows="8" id="import_options" class="import_options"></textarea>
218
+ </div>
219
+ <div class="description">
220
+ <p>Only after you've imported the Theme Options XML file should you try and update your Theme Options Data.</p>
221
+ <p>To import the values of your theme options copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Data" button below.</p>
222
+ </div>
223
+ </div>
224
+ <input type="submit" value="<?php _e('Import Data') ?>" class="ob_button right import-data" />
225
+ </div>
226
+ <?php wp_nonce_field( '_import_data', '_ajax_nonce', false ); ?>
227
+ </form>
228
+
229
+ </div>
230
+
231
+ <div id="export_options" class="block">
232
+ <h2>Export</h2>
233
+ <form method="post" action="admin.php?page=option_tree_settings&action=export">
234
+ <div class="option option-input">
235
+ <h3>Theme Options XML</h3>
236
+ <div class="section desc-text">
237
+ <p>Click the Export XML button to export your Theme Options. A dialogue box will open and ask you what you want to do with the XML file, save it somewhere you can easily find it later.</p>
238
+ <input type="submit" value="Export XML" class="ob_button right" />
239
+ </div>
240
+ </div>
241
+ </form>
242
+ <div class="option option-input">
243
+ <h3>Theme Options Data</h3>
244
+ <div class="section">
245
+ <div class="element">
246
+ <textarea name="export_options" rows="8"><?php echo base64_encode(serialize($settings)); ?></textarea>
247
+ </div>
248
+ <div class="description">
249
+ Export your saved Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> on another web site.
250
+ </div>
251
+ </div>
252
+ </div>
253
+ </div>
254
+
255
+ <br class="clear" />
256
+ </div>
257
+ </div>
258
+ <div class="info bottom">
259
+ <input type="hidden" name="action" value="save" />
260
+ </div>
261
+ </div>
262
+
263
+ </div>
264
+ <!-- [END] framework_wrap -->
functions/admin/category.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Category Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_category( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <div class="select_wrapper">
22
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
23
+ <?php
24
+ $categories = &get_categories( array( 'hide_empty' => false ) );
25
+ if ( $categories )
26
+ {
27
+ echo '<option value="">-- Choose One --</option>';
28
+ foreach ($categories as $category)
29
+ {
30
+ $selected = '';
31
+ if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] == $category->term_id )
32
+ {
33
+ $selected = ' selected="selected"';
34
+ }
35
+ echo '<option value="'.$category->term_id.'"'.$selected.'>'.$category->name.'</option>';
36
+ }
37
+ }
38
+ else
39
+ {
40
+ echo '<option value="0">No Categories Available</option>';
41
+ }
42
+ ?>
43
+ </select>
44
+ </div>
45
+ </div>
46
+ <div class="description">
47
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <?php
52
+ }
53
+
54
+ /**
55
+ * Categories Option
56
+ *
57
+ * @access public
58
+ * @since 1.0.0
59
+ *
60
+ * @param array $value
61
+ * @param array $settings
62
+ * @param int $int
63
+ *
64
+ * @return string
65
+ */
66
+ function option_tree_categories( $value, $settings, $int )
67
+ {
68
+ ?>
69
+ <div class="option option-checbox">
70
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
71
+ <div class="section">
72
+ <div class="element">
73
+ <?php
74
+ // check for settings item value
75
+ if ( isset( $settings[$value->item_id] ) )
76
+ {
77
+ $ch_values = explode(',', $settings[$value->item_id] );
78
+ }
79
+ else
80
+ {
81
+ $ch_values = array();
82
+ }
83
+
84
+ // loop through tags
85
+ $categories = &get_categories( array( 'hide_empty' => false ) );
86
+ if ( $categories )
87
+ {
88
+ $count = 0;
89
+ foreach ( $categories as $category )
90
+ {
91
+ $checked = '';
92
+ if ( in_array( $category->term_id, $ch_values ) )
93
+ {
94
+ $checked = ' checked="checked"';
95
+ }
96
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$category->term_id.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$category->name.'</label></div>';
97
+ $count++;
98
+ }
99
+ }
100
+ else
101
+ {
102
+ echo '<p>No Tags Available</p>';
103
+ }
104
+ ?>
105
+ </div>
106
+ <div class="description">
107
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <?php
112
+ }
functions/admin/checkbox.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * ColorPicker Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_checkbox( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-checbox">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <?php
22
+ // check for settings item value
23
+ if ( isset( $settings[$value->item_id] ) )
24
+ {
25
+ $ch_values = explode(',', $settings[$value->item_id] );
26
+ }
27
+ else
28
+ {
29
+ $ch_values = array();
30
+ }
31
+
32
+ $count = 0;
33
+
34
+ // create options array
35
+ $options_array = explode( ',', $value->item_options );
36
+
37
+ // loop through options array
38
+ foreach ( $options_array as $option )
39
+ {
40
+ $checked = '';
41
+ if ( in_array( trim( $option ), $ch_values) )
42
+ {
43
+ $checked = ' checked="checked"';
44
+ }
45
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.trim( $option ).'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.trim( $option ).'</label></div>';
46
+ $count++;
47
+ }
48
+ ?>
49
+ </div>
50
+ <div class="description">
51
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <?php
56
+ }
functions/admin/colorpicker.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * ColorPicker Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_colorpicker( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-colorpicker">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <script type="text/javascript">
22
+ jQuery(document).ready(function($) {
23
+ $('#<?php echo $value->item_id; ?>').ColorPicker({
24
+ onSubmit: function(hsb, hex, rgb) {
25
+ $('#<?php echo $value->item_id; ?>').val('#'+hex);
26
+ },
27
+ onBeforeShow: function () {
28
+ $(this).ColorPickerSetColor(this.value);
29
+ return false;
30
+ },
31
+ onChange: function (hsb, hex, rgb) {
32
+ $('#cp_<?php echo $value->item_id; ?> div').css({'backgroundColor':'#'+hex, 'backgroundImage': 'none', 'borderColor':'#'+hex});
33
+ $('#cp_<?php echo $value->item_id; ?>').prev('input').attr('value', '#'+hex);
34
+ }
35
+ })
36
+ .bind('keyup', function(){
37
+ $(this).ColorPickerSetColor(this.value);
38
+ });
39
+ });
40
+ </script>
41
+ <input type="text" name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" value="<?php echo ( isset( $settings[$value->item_id] ) ) ? stripslashes( $settings[$value->item_id] ) : ''; ?>" class="cp_input" />
42
+ <div id="cp_<?php echo $value->item_id; ?>" class="cp_box">
43
+ <div style="background-color:<?php echo ( isset ($settings[$value->item_id] ) ) ? $settings[$value->item_id] : '#ffffff'; ?>;<?php if ( isset( $settings[$value->item_id] ) ) { echo 'background-image:none;border-color:' . $settings[$value->item_id] . ';'; } ?>">
44
+ </div>
45
+ </div>
46
+ <small>Click text box for color picker</small>
47
+ </div>
48
+ <div class="description">
49
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <?php
54
+ }
functions/admin/custom-post.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Custom Post Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_custom_post( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <div class="select_wrapper">
22
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
23
+ <?php
24
+ $posts = &get_posts( array( 'post_type' => trim($value->item_options) ) );
25
+ if ( $posts )
26
+ {
27
+ echo '<option value="">-- Choose One --</option>';
28
+ foreach ( $posts as $post )
29
+ {
30
+ $selected = '';
31
+ if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] == $post->ID )
32
+ {
33
+ $selected = ' selected="selected"';
34
+ }
35
+ echo '<option value="'.$post->ID.'"'.$selected.'>'.$post->post_title.'</option>';
36
+ }
37
+ }
38
+ else
39
+ {
40
+ echo '<option value="0">No Custom Posts Available</option>';
41
+ }
42
+ ?>
43
+ </select>
44
+ </div>
45
+ </div>
46
+ <div class="description">
47
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <?php
52
+ }
53
+
54
+ /**
55
+ * Custom Posts Option
56
+ *
57
+ * @access public
58
+ * @since 1.0.0
59
+ *
60
+ * @param array $value
61
+ * @param array $settings
62
+ * @param int $int
63
+ *
64
+ * @return string
65
+ */
66
+ function option_tree_custom_posts( $value, $settings, $int )
67
+ {
68
+ ?>
69
+ <div class="option option-checbox">
70
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
71
+ <div class="section">
72
+ <div class="element">
73
+ <?php
74
+ // check for settings item value
75
+ if ( isset( $settings[$value->item_id] ) )
76
+ {
77
+ $ch_values = explode(',', $settings[$value->item_id] );
78
+ }
79
+ else
80
+ {
81
+ $ch_values = array();
82
+ }
83
+
84
+ // loop through tags
85
+ $posts = &get_posts( array( 'post_type' => $value->item_options ) );
86
+ if ( $posts )
87
+ {
88
+ $count = 0;
89
+ foreach ( $posts as $post )
90
+ {
91
+ $checked = '';
92
+ if ( in_array( $post->ID, $ch_values ) )
93
+ {
94
+ $checked = ' checked="checked"';
95
+ }
96
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$post->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$post->post_title.'</label></div>';
97
+ $count++;
98
+ }
99
+ }
100
+ else
101
+ {
102
+ echo '<p>No Custom Posts Available</p>';
103
+ }
104
+ ?>
105
+ </div>
106
+ <div class="description">
107
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <?php
112
+ }
functions/admin/export.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Export Table Data
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $options
9
+ * @param string $table_name
10
+ *
11
+ * @return file
12
+ */
13
+ function option_tree_export_xml( $options, $table_name )
14
+ {
15
+ global $wpdb;
16
+
17
+ // create doctype
18
+ $dom = new DomDocument("1.0");
19
+ $dom->formatOutput = true;
20
+ header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
21
+ header("Pragma: no-cache ");
22
+ header("Content-Type: text/plain");
23
+ header('Content-Disposition: attachment; filename="theme-options-'.date("Y-m-d").'.xml"');
24
+ // create root element
25
+ $root = $dom->createElement($table_name);
26
+ $root = $dom->appendChild($root);
27
+ foreach ($options as $value) {
28
+ // create root element
29
+ $child = $dom->createElement('row');
30
+ $child = $root->appendChild($child);
31
+ // ID
32
+ $item = $dom->createElement('id');
33
+ $item = $child->appendChild($item);
34
+ $text = $dom->createTextNode($value->id);
35
+ $text = $item->appendChild($text);
36
+ // Item ID
37
+ $item = $dom->createElement('item_id');
38
+ $item = $child->appendChild($item);
39
+ $text = $dom->createTextNode($value->item_id);
40
+ $text = $item->appendChild($text);
41
+ // Item Title
42
+ $item = $dom->createElement('item_title');
43
+ $item = $child->appendChild($item);
44
+ $text = $dom->createTextNode($value->item_title);
45
+ $text = $item->appendChild($text);
46
+ // Item Description
47
+ $item = $dom->createElement('item_desc');
48
+ $item = $child->appendChild($item);
49
+ $text = $dom->createTextNode($value->item_desc);
50
+ $text = $item->appendChild($text);
51
+ // Item Type
52
+ $item = $dom->createElement('item_type');
53
+ $item = $child->appendChild($item);
54
+ $text = $dom->createTextNode($value->item_type);
55
+ $text = $item->appendChild($text);
56
+ // Item Options
57
+ $item = $dom->createElement('item_options');
58
+ $item = $child->appendChild($item);
59
+ $text = $dom->createTextNode($value->item_options);
60
+ $text = $item->appendChild($text);
61
+ // Item Sort
62
+ $item = $dom->createElement('item_sort');
63
+ $item = $child->appendChild($item);
64
+ $text = $dom->createTextNode($value->item_sort);
65
+ $text = $item->appendChild($text);
66
+ }
67
+ // save and display tree
68
+ echo $dom->saveXML();
69
+ die();
70
+ }
functions/admin/heading.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Heading Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_heading( $value, $settings, $int )
15
+ {
16
+ echo ( $int > 1 ) ? '</div>' : false;
17
+ echo '<div id="option_' . $value->item_id . '" class="block">';
18
+ echo '<h2>' . htmlspecialchars_decode( $value->item_title ) . '</h2>';
19
+ echo '<input type="hidden" name="' . $value->item_id . '" value="' . htmlspecialchars_decode( $value->item_title ) . '" />';
20
+ }
functions/admin/input.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Input Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_input( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-input">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <input type="text" name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" value="<?php if ( isset($settings[$value->item_id]) ) { echo htmlspecialchars( stripslashes( $settings[$value->item_id] ), ENT_QUOTES); } ?>" />
22
+ </div>
23
+ <div class="description">
24
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <?php
29
+ }
functions/admin/page.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Page Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_page( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <div class="select_wrapper">
22
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
23
+ <?php
24
+ $pages = &get_pages();
25
+ if ( $pages )
26
+ {
27
+ echo '<option value="">-- Choose One --</option>';
28
+ foreach ( $pages as $page )
29
+ {
30
+ $selected = '';
31
+ if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] == $page->ID )
32
+ {
33
+ $selected = ' selected="selected"';
34
+ }
35
+ echo '<option value="'.$page->ID.'"'.$selected.'>'.$page->post_title.'</option>';
36
+ }
37
+ }
38
+ else
39
+ {
40
+ echo '<option value="0">No Pages Available</option>';
41
+ }
42
+ ?>
43
+ </select>
44
+ </div>
45
+ </div>
46
+ <div class="description">
47
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <?php
52
+ }
53
+
54
+ /**
55
+ * Pages Option
56
+ *
57
+ * @access public
58
+ * @since 1.0.0
59
+ *
60
+ * @param array $value
61
+ * @param array $settings
62
+ * @param int $int
63
+ *
64
+ * @return string
65
+ */
66
+ function option_tree_pages( $value, $settings, $int )
67
+ {
68
+ ?>
69
+ <div class="option option-checbox">
70
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
71
+ <div class="section">
72
+ <div class="element">
73
+ <?php
74
+ // check for settings item value
75
+ if ( isset( $settings[$value->item_id] ) )
76
+ {
77
+ $ch_values = explode(',', $settings[$value->item_id] );
78
+ }
79
+ else
80
+ {
81
+ $ch_values = array();
82
+ }
83
+
84
+ // loop through tags
85
+ $pages = &get_pages();
86
+ if ( $pages )
87
+ {
88
+ $count = 0;
89
+ foreach ( $pages as $page )
90
+ {
91
+ $checked = '';
92
+ if ( in_array( $page->ID, $ch_values ) )
93
+ {
94
+ $checked = ' checked="checked"';
95
+ }
96
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$page->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$page->post_title.'</label></div>';
97
+ $count++;
98
+ }
99
+ }
100
+ else
101
+ {
102
+ echo '<p>No Pages Available</p>';
103
+ }
104
+ ?>
105
+ </div>
106
+ <div class="description">
107
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <?php
112
+ }
functions/admin/post.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Post Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_post( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <div class="select_wrapper">
22
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
23
+ <?php
24
+ $posts = &get_posts();
25
+ if ( $posts )
26
+ {
27
+ echo '<option value="">-- Choose One --</option>';
28
+ foreach ( $posts as $post )
29
+ {
30
+ $selected = '';
31
+ if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] == $post->ID )
32
+ {
33
+ $selected = ' selected="selected"';
34
+ }
35
+ echo '<option value="'.$post->ID.'"'.$selected.'>'.$post->post_title.'</option>';
36
+ }
37
+ }
38
+ else
39
+ {
40
+ echo '<option value="0">No Pages Available</option>';
41
+ }
42
+ ?>
43
+ </select>
44
+ </div>
45
+ </div>
46
+ <div class="description">
47
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <?php
52
+ }
53
+
54
+ /**
55
+ * Posts Option
56
+ *
57
+ * @access public
58
+ * @since 1.0.0
59
+ *
60
+ * @param array $value
61
+ * @param array $settings
62
+ * @param int $int
63
+ *
64
+ * @return string
65
+ */
66
+ function option_tree_posts( $value, $settings, $int )
67
+ {
68
+ ?>
69
+ <div class="option option-checbox">
70
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
71
+ <div class="section">
72
+ <div class="element">
73
+ <?php
74
+ // check for settings item value
75
+ if ( isset( $settings[$value->item_id] ) )
76
+ {
77
+ $ch_values = explode(',', $settings[$value->item_id] );
78
+ }
79
+ else
80
+ {
81
+ $ch_values = array();
82
+ }
83
+
84
+ // loop through tags
85
+ $posts = &get_posts();
86
+ if ( $posts )
87
+ {
88
+ $count = 0;
89
+ foreach ( $posts as $post )
90
+ {
91
+ $checked = '';
92
+ if ( in_array( $post->ID, $ch_values ) )
93
+ {
94
+ $checked = ' checked="checked"';
95
+ }
96
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$post->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$post->post_title.'</label></div>';
97
+ $count++;
98
+ }
99
+ }
100
+ else
101
+ {
102
+ echo '<p>No Pages Available</p>';
103
+ }
104
+ ?>
105
+ </div>
106
+ <div class="description">
107
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <?php
112
+ }
functions/admin/radio.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Radio Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_radio( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-radio">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <?php
22
+ // check for settings item value
23
+ if ( isset( $settings[$value->item_id] ) )
24
+ {
25
+ $ch_values = explode(',', $settings[$value->item_id] );
26
+ }
27
+ else
28
+ {
29
+ $ch_values = array();
30
+ }
31
+
32
+ $count = 0;
33
+
34
+ // create options array
35
+ $options_array = explode( ',', $value->item_options );
36
+
37
+ // loop through options array
38
+ foreach ( $options_array as $option )
39
+ {
40
+ $checked = '';
41
+ if ( in_array( trim( $option ), $ch_values ) )
42
+ {
43
+ $checked = ' checked="checked"';
44
+ }
45
+ echo '<div class="input_wrap"><input name="radios['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="radio" value="'.trim( $option ).'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.trim( $option ).'</label></div>';
46
+ $count++;
47
+ }
48
+ ?>
49
+ </div>
50
+ <div class="description">
51
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <?php
56
+ }
functions/admin/select.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Select Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_select( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <?php $options_array = explode( ',', $value->item_options ); ?>
22
+ <div class="select_wrapper">
23
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
24
+ <?php
25
+ echo '<option value="">-- Choose One --</option>';
26
+ foreach ( $options_array as $option )
27
+ {
28
+ $selected = '';
29
+ if ( $settings[$value->item_id] == trim( $option ) )
30
+ {
31
+ $selected = ' selected="selected"';
32
+ }
33
+ echo '<option'.$selected.'>'.trim( $option ).'</option>';
34
+ }
35
+ ?>
36
+ </select>
37
+ </div>
38
+ </div>
39
+ <div class="description">
40
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <?php
45
+ }
functions/admin/tag.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Tag Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_tag( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-select">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <div class="select_wrapper">
22
+ <select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
23
+ <?php
24
+ $tags = &get_tags( array( 'hide_empty' => false ) );
25
+ if ( $tags )
26
+ {
27
+ echo '<option value="">-- Choose One --</option>';
28
+ foreach ( $tags as $tag )
29
+ {
30
+ $selected = '';
31
+ if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] == $tag->term_id )
32
+ {
33
+ $selected = ' selected="selected"';
34
+ }
35
+ echo '<option value="'.$tag->term_id.'"'.$selected.'>'.$tag->name.'</option>';
36
+ }
37
+ }
38
+ else
39
+ {
40
+ echo '<option value="0">No Tags Available</option>';
41
+ }
42
+ ?>
43
+ </select>
44
+ </div>
45
+ </div>
46
+ <div class="description">
47
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <?php
52
+ }
53
+
54
+ /**
55
+ * Tags Option
56
+ *
57
+ * @access public
58
+ * @since 1.0.0
59
+ *
60
+ * @param array $value
61
+ * @param array $settings
62
+ * @param int $int
63
+ *
64
+ * @return string
65
+ */
66
+ function option_tree_tags( $value, $settings, $int )
67
+ {
68
+ ?>
69
+ <div class="option option-checbox">
70
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
71
+ <div class="section">
72
+ <div class="element">
73
+ <?php
74
+ // check for settings item value
75
+ if ( isset( $settings[$value->item_id] ) )
76
+ {
77
+ $ch_values = explode(',', $settings[$value->item_id] );
78
+ }
79
+ else
80
+ {
81
+ $ch_values = array();
82
+ }
83
+
84
+ // loop through tags
85
+ $tags = &get_tags( array( 'hide_empty' => false ) );
86
+ if ( $tags )
87
+ {
88
+ $count = 0;
89
+ foreach ( $tags as $tag )
90
+ {
91
+ $checked = '';
92
+ if ( in_array( $tag->term_id, $ch_values ) )
93
+ {
94
+ $checked = ' checked="checked"';
95
+ }
96
+ echo '<div class="input_wrap"><input name="checkboxes['.$value->item_id.'][]" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$tag->term_id.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$tag->name.'</label></div>';
97
+ $count++;
98
+ }
99
+ }
100
+ else
101
+ {
102
+ echo '<p>No Tags Available</p>';
103
+ }
104
+ ?>
105
+ </div>
106
+ <div class="description">
107
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <?php
112
+ }
functions/admin/textarea.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Textarea Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_textarea( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-textarea">
18
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
19
+ <div class="section">
20
+ <div class="element">
21
+ <textarea name="<?php echo $value->item_id; ?>" rows="<?php echo $int; ?>"><?php
22
+ if ( $text = $settings[$value->item_id] )
23
+ {
24
+ echo $text;
25
+ }
26
+ ?></textarea>
27
+ </div>
28
+ <div class="description">
29
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <?php
34
+ }
functions/admin/textblock.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Text Block Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_textblock( $value, $settings, $int )
15
+ {
16
+ ?>
17
+ <div class="option option-textblock">
18
+ <!-- <h3 class="text-title"><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3> -->
19
+ <div class="section">
20
+ <div class="text_block">
21
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <?php
26
+ }
functions/admin/upload.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Upload Option
4
+ *
5
+ * @access public
6
+ * @since 1.0.0
7
+ *
8
+ * @param array $value
9
+ * @param array $settings
10
+ * @param int $int
11
+ *
12
+ * @return string
13
+ */
14
+ function option_tree_upload( $value, $settings, $int ) { ?>
15
+ <div class="option option-upload">
16
+ <h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
17
+ <div class="section">
18
+ <div class="element">
19
+ <input type="text" name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" value="<?php if ( $settings[$value->item_id] ) { echo $settings[$value->item_id]; } ?>" class="upload<?php if ( $settings[$value->item_id] ) { echo ' has-file'; } ?>" />
20
+ <input id="upload_<?php echo $value->item_id; ?>" class="upload_button" type="button" value="Upload" rel="<?php echo $int; ?>" />
21
+ <div class="screenshot" id="<?php echo $value->item_id; ?>_image">
22
+ <?php
23
+ if ( $settings[$value->item_id] )
24
+ {
25
+ $remove = '<a href="javascript:(void);" class="remove">Remove</a>';
26
+ $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $settings[$value->item_id] );
27
+ if ( $image )
28
+ {
29
+ echo '<img src="'.$settings[$value->item_id].'" alt="" />'.$remove.'';
30
+ }
31
+ else
32
+ {
33
+ $parts = explode( "/", $settings[$value->item_id] );
34
+ for( $i = 0; $i < sizeof($parts); ++$i )
35
+ {
36
+ $title = $parts[$i];
37
+ }
38
+ echo '<div class="no_image"><a href="'.$settings[$value->item_id].'">'.$title.'</a>'.$remove.'</div>';
39
+ }
40
+ }
41
+ ?>
42
+ </div>
43
+ </div>
44
+ <div class="description">
45
+ <?php echo htmlspecialchars_decode( $value->item_desc ); ?>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <?php
50
+ }
functions/functions.load.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Functions Load
4
+ *
5
+ * @package WordPress
6
+ * @subpackage OptionTree
7
+ * @since 1.0.0
8
+ * @author Derek Herman
9
+ */
10
+ if ( is_admin() )
11
+ {
12
+ include( 'admin/export.php' );
13
+ include( 'admin/heading.php' );
14
+ include( 'admin/input.php' );
15
+ include( 'admin/checkbox.php' );
16
+ include( 'admin/radio.php' );
17
+ include( 'admin/select.php' );
18
+ include( 'admin/textarea.php' );
19
+ include( 'admin/upload.php' );
20
+ include( 'admin/colorpicker.php' );
21
+ include( 'admin/textblock.php' );
22
+ include( 'admin/post.php' );
23
+ include( 'admin/page.php' );
24
+ include( 'admin/category.php' );
25
+ include( 'admin/tag.php' );
26
+ include( 'admin/custom-post.php' );
27
+ }
28
+ else if ( !is_admin() )
29
+ {
30
+ include( 'get-option-tree.php' );
31
+ }
functions/get-option-tree.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
2
+ /**
3
+ * Displays or returns a value from the 'option_tree' array.
4
+ *
5
+ * @uses get_option()
6
+ *
7
+ * @access public
8
+ * @since 1.0.0
9
+ *
10
+ * @param string $item_id
11
+ * @param array $options
12
+ * @param bool $echo
13
+ * @param bool $is_array
14
+ * @param int $offset
15
+ *
16
+ * @return mixed
17
+ */
18
+ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1)
19
+ {
20
+ // load saved options
21
+ if ( !$options )
22
+ $options = get_option( 'option_tree' );
23
+
24
+ // set the item
25
+ if ( !isset( $options[$item_id] ) )
26
+ return;
27
+
28
+ // single item value
29
+ $content = $options[$item_id];
30
+
31
+ // create an array of values
32
+ if ( $is_array )
33
+ {
34
+ $content = explode( ',', $content );
35
+ if ( is_numeric( $offset ) && $offset >= 0)
36
+ {
37
+ $content = htmlspecialchars_decode( trim( $content[$offset] ) );
38
+ }
39
+ }
40
+
41
+ // echo content
42
+ if ($echo)
43
+ echo $content;
44
+
45
+ return $content;
46
+ }
includes/ot-functions-admin.php DELETED
@@ -1,4135 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * Functions used only while viewing the admin UI.
4
- *
5
- * Limit loading these function only when needed
6
- * and not in the front end.
7
- *
8
- * @package OptionTree
9
- * @author Derek Herman <derek@valendesigns.com>
10
- * @copyright Copyright (c) 2013, Derek Herman
11
- * @since 2.0
12
- */
13
-
14
- /**
15
- * Registers the Theme Option page
16
- *
17
- * @uses ot_register_settings()
18
- *
19
- * @return void
20
- *
21
- * @access public
22
- * @since 2.1
23
- */
24
- if ( ! function_exists( 'ot_register_theme_options_page' ) ) {
25
-
26
- function ot_register_theme_options_page() {
27
-
28
- /* get the settings array */
29
- $get_settings = get_option( 'option_tree_settings' );
30
-
31
- /* sections array */
32
- $sections = isset( $get_settings['sections'] ) ? $get_settings['sections'] : array();
33
-
34
- /* settings array */
35
- $settings = isset( $get_settings['settings'] ) ? $get_settings['settings'] : array();
36
-
37
- /* contexual_help array */
38
- $contextual_help = isset( $get_settings['contextual_help'] ) ? $get_settings['contextual_help'] : array();
39
-
40
- /* build the Theme Options */
41
- if ( function_exists( 'ot_register_settings' ) && OT_USE_THEME_OPTIONS ) {
42
-
43
- ot_register_settings( array(
44
- array(
45
- 'id' => 'option_tree',
46
- 'pages' => array(
47
- array(
48
- 'id' => 'ot_theme_options',
49
- 'parent_slug' => apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ),
50
- 'page_title' => apply_filters( 'ot_theme_options_page_title', __( 'Theme Options', 'option-tree' ) ),
51
- 'menu_title' => apply_filters( 'ot_theme_options_menu_title', __( 'Theme Options', 'option-tree' ) ),
52
- 'capability' => $caps = apply_filters( 'ot_theme_options_capability', 'edit_theme_options' ),
53
- 'menu_slug' => apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ),
54
- 'icon_url' => apply_filters( 'ot_theme_options_icon_url', null ),
55
- 'position' => apply_filters( 'ot_theme_options_position', null ),
56
- 'updated_message' => apply_filters( 'ot_theme_options_updated_message', __( 'Theme Options updated.', 'option-tree' ) ),
57
- 'reset_message' => apply_filters( 'ot_theme_options_reset_message', __( 'Theme Options reset.', 'option-tree' ) ),
58
- 'button_text' => apply_filters( 'ot_theme_options_button_text', __( 'Save Changes', 'option-tree' ) ),
59
- 'screen_icon' => 'themes',
60
- 'contextual_help' => $contextual_help,
61
- 'sections' => $sections,
62
- 'settings' => $settings
63
- )
64
- )
65
- )
66
- )
67
- );
68
-
69
- // Filters the options.php to add the minimum user capabilities.
70
- add_filter( 'option_page_capability_option_tree', create_function( '$caps', "return '$caps';" ), 999 );
71
-
72
- }
73
-
74
- }
75
-
76
- }
77
-
78
- /**
79
- * Registers the Settings page
80
- *
81
- * @uses ot_register_settings()
82
- *
83
- * @return void
84
- *
85
- * @access public
86
- * @since 2.1
87
- */
88
- if ( ! function_exists( 'ot_register_settings_page' ) ) {
89
-
90
- function ot_register_settings_page() {
91
-
92
- // Create the filterable pages array
93
- $ot_register_pages_array = array(
94
- array(
95
- 'id' => 'ot',
96
- 'page_title' => __( 'OptionTree', 'option-tree' ),
97
- 'menu_title' => __( 'OptionTree', 'option-tree' ),
98
- 'capability' => 'edit_theme_options',
99
- 'menu_slug' => 'ot-settings',
100
- 'icon_url' => OT_URL . '/assets/images/ot-logo-mini.png',
101
- 'position' => 61,
102
- 'hidden_page' => true
103
- ),
104
- array(
105
- 'id' => 'settings',
106
- 'parent_slug' => 'ot-settings',
107
- 'page_title' => __( 'Settings', 'option-tree' ),
108
- 'menu_title' => __( 'Settings', 'option-tree' ),
109
- 'capability' => 'edit_theme_options',
110
- 'menu_slug' => 'ot-settings',
111
- 'icon_url' => null,
112
- 'position' => null,
113
- 'updated_message' => __( 'Theme Options updated.', 'option-tree' ),
114
- 'reset_message' => __( 'Theme Options reset.', 'option-tree' ),
115
- 'button_text' => __( 'Save Settings', 'option-tree' ),
116
- 'show_buttons' => false,
117
- 'screen_icon' => 'themes',
118
- 'sections' => array(
119
- array(
120
- 'id' => 'create_setting',
121
- 'title' => __( 'Theme Options UI', 'option-tree' )
122
- ),
123
- array(
124
- 'id' => 'import',
125
- 'title' => __( 'Import', 'option-tree' )
126
- ),
127
- array(
128
- 'id' => 'export',
129
- 'title' => __( 'Export', 'option-tree' )
130
- ),
131
- array(
132
- 'id' => 'layouts',
133
- 'title' => __( 'Layouts', 'option-tree' )
134
- )
135
- ),
136
- 'settings' => array(
137
- array(
138
- 'id' => 'theme_options_ui_text',
139
- 'label' => __( 'Theme Options UI Builder', 'option-tree' ),
140
- 'type' => 'theme_options_ui',
141
- 'section' => 'create_setting'
142
- ),
143
- array(
144
- 'id' => 'import_xml_text',
145
- 'label' => __( 'Settings XML', 'option-tree' ),
146
- 'type' => 'import-xml',
147
- 'section' => 'import'
148
- ),
149
- array(
150
- 'id' => 'import_settings_text',
151
- 'label' => __( 'Settings', 'option-tree' ),
152
- 'type' => 'import-settings',
153
- 'section' => 'import'
154
- ),
155
- array(
156
- 'id' => 'import_data_text',
157
- 'label' => __( 'Theme Options', 'option-tree' ),
158
- 'type' => 'import-data',
159
- 'section' => 'import'
160
- ),
161
- array(
162
- 'id' => 'import_layouts_text',
163
- 'label' => __( 'Layouts', 'option-tree' ),
164
- 'type' => 'import-layouts',
165
- 'section' => 'import'
166
- ),
167
- array(
168
- 'id' => 'export_settings_file_text',
169
- 'label' => __( 'Settings PHP File', 'option-tree' ),
170
- 'type' => 'export-settings-file',
171
- 'section' => 'export'
172
- ),
173
- array(
174
- 'id' => 'export_settings_text',
175
- 'label' => __( 'Settings', 'option-tree' ),
176
- 'type' => 'export-settings',
177
- 'section' => 'export'
178
- ),
179
- array(
180
- 'id' => 'export_data_text',
181
- 'label' => __( 'Theme Options', 'option-tree' ),
182
- 'type' => 'export-data',
183
- 'section' => 'export'
184
- ),
185
- array(
186
- 'id' => 'export_layout_text',
187
- 'label' => __( 'Layouts', 'option-tree' ),
188
- 'type' => 'export-layouts',
189
- 'section' => 'export'
190
- ),
191
- array(
192
- 'id' => 'modify_layouts_text',
193
- 'label' => __( 'Layout Management', 'option-tree' ),
194
- 'type' => 'modify-layouts',
195
- 'section' => 'layouts'
196
- )
197
- )
198
- ),
199
- array(
200
- 'id' => 'documentation',
201
- 'parent_slug' => 'ot-settings',
202
- 'page_title' => __( 'Documentation', 'option-tree' ),
203
- 'menu_title' => __( 'Documentation', 'option-tree' ),
204
- 'capability' => 'edit_theme_options',
205
- 'menu_slug' => 'ot-documentation',
206
- 'icon_url' => null,
207
- 'position' => null,
208
- 'updated_message' => __( 'Theme Options updated.', 'option-tree' ),
209
- 'reset_message' => __( 'Theme Options reset.', 'option-tree' ),
210
- 'button_text' => __( 'Save Settings', 'option-tree' ),
211
- 'show_buttons' => false,
212
- 'screen_icon' => 'themes',
213
- 'sections' => array(
214
- array(
215
- 'id' => 'creating_options',
216
- 'title' => __( 'Creating Options', 'option-tree' )
217
- ),
218
- array(
219
- 'id' => 'option_types',
220
- 'title' => __( 'Option Types', 'option-tree' )
221
- ),
222
- array(
223
- 'id' => 'functions',
224
- 'title' => __( 'Function References', 'option-tree' )
225
- ),
226
- array(
227
- 'id' => 'theme_mode',
228
- 'title' => __( 'Theme Mode', 'option-tree' )
229
- ),
230
- array(
231
- 'id' => 'meta_boxes',
232
- 'title' => __( 'Meta Boxes', 'option-tree' )
233
- ),
234
- array(
235
- 'id' => 'examples',
236
- 'title' => __( 'Code Examples', 'option-tree' )
237
- ),
238
- array(
239
- 'id' => 'layouts_overview',
240
- 'title' => __( 'Layouts Overview', 'option-tree' )
241
- )
242
- ),
243
- 'settings' => array(
244
- array(
245
- 'id' => 'creating_options_text',
246
- 'label' => __( 'Overview of available Theme Option fields.', 'option-tree' ),
247
- 'type' => 'creating-options',
248
- 'section' => 'creating_options'
249
- ),
250
- array(
251
- 'id' => 'option_types_text',
252
- 'label' => __( 'Option types in alphabetical order & hooks to filter them.', 'option-tree' ),
253
- 'type' => 'option-types',
254
- 'section' => 'option_types'
255
- ),
256
- array(
257
- 'id' => 'functions_ot_get_option',
258
- 'label' => __( 'Function Reference:ot_get_option()', 'option-tree' ),
259
- 'type' => 'ot-get-option',
260
- 'section' => 'functions'
261
- ),
262
- array(
263
- 'id' => 'functions_get_option_tree',
264
- 'label' => __( 'Function Reference:get_option_tree()', 'option-tree' ),
265
- 'type' => 'get-option-tree',
266
- 'section' => 'functions'
267
- ),
268
- array(
269
- 'id' => 'theme_mode_text',
270
- 'label' => __( 'Theme Mode', 'option-tree' ),
271
- 'type' => 'theme-mode',
272
- 'section' => 'theme_mode'
273
- ),
274
- array(
275
- 'id' => 'meta_boxes_text',
276
- 'label' => __( 'Meta Boxes', 'option-tree' ),
277
- 'type' => 'meta-boxes',
278
- 'section' => 'meta_boxes'
279
- ),
280
- array(
281
- 'id' => 'example_text',
282
- 'label' => __( 'Code examples for front-end development.', 'option-tree' ),
283
- 'type' => 'examples',
284
- 'section' => 'examples'
285
- ),
286
- array(
287
- 'id' => 'layouts_overview_text',
288
- 'label' => __( 'What\'s a layout anyhow?', 'option-tree' ),
289
- 'type' => 'layouts-overview',
290
- 'section' => 'layouts_overview'
291
- )
292
- )
293
- )
294
- );
295
-
296
- // Loop over the settings and remove as needed.
297
- foreach( $ot_register_pages_array as $key => $page ) {
298
-
299
- // Remove various options from the Settings UI.
300
- if ( $page['id'] == 'settings' ) {
301
-
302
- // Remove the Theme Options UI
303
- if ( OT_SHOW_OPTIONS_UI == false ) {
304
-
305
- foreach( $page['sections'] as $section_key => $section ) {
306
- if ( $section['id'] == 'create_setting' ) {
307
- unset($ot_register_pages_array[$key]['sections'][$section_key]);
308
- }
309
- }
310
-
311
- foreach( $page['settings'] as $setting_key => $setting ) {
312
- if ( $setting['section'] == 'create_setting' ) {
313
- unset($ot_register_pages_array[$key]['settings'][$setting_key]);
314
- }
315
- }
316
-
317
- }
318
-
319
- // Remove parts of the Imports UI
320
- if ( OT_SHOW_SETTINGS_IMPORT == false ) {
321
-
322
- foreach( $page['settings'] as $setting_key => $setting ) {
323
- if ( $setting['section'] == 'import' && in_array( $setting['id'], array('import_xml_text', 'import_settings_text' ) ) ) {
324
- unset($ot_register_pages_array[$key]['settings'][$setting_key]);
325
- }
326
- }
327
-
328
- }
329
-
330
- // Remove parts of the Export UI
331
- if ( OT_SHOW_SETTINGS_EXPORT == false ) {
332
-
333
- foreach( $page['settings'] as $setting_key => $setting ) {
334
- if ( $setting['section'] == 'export' && in_array( $setting['id'], array('export_settings_file_text', 'export_settings_text' ) ) ) {
335
- unset($ot_register_pages_array[$key]['settings'][$setting_key]);
336
- }
337
- }
338
-
339
- }
340
-
341
- // Remove the Layouts UI
342
- if ( OT_SHOW_NEW_LAYOUT == false ) {
343
-
344
- foreach( $page['sections'] as $section_key => $section ) {
345
- if ( $section['id'] == 'layouts' ) {
346
- unset($ot_register_pages_array[$key]['sections'][$section_key]);
347
- }
348
- }
349
-
350
- foreach( $page['settings'] as $setting_key => $setting ) {
351
- if ( $setting['section'] == 'layouts' ) {
352
- unset($ot_register_pages_array[$key]['settings'][$setting_key]);
353
- }
354
- }
355
-
356
- }
357
-
358
- }
359
-
360
- // Remove the Documentation UI.
361
- if ( OT_SHOW_DOCS == false && $page['id'] == 'documentation' ) {
362
-
363
- unset( $ot_register_pages_array[$key] );
364
-
365
- }
366
-
367
- }
368
-
369
- $ot_register_pages_array = apply_filters( 'ot_register_pages_array', $ot_register_pages_array );
370
-
371
- // Register the pages.
372
- ot_register_settings( array(
373
- array(
374
- 'id' => 'option_tree_settings',
375
- 'pages' => $ot_register_pages_array
376
- )
377
- )
378
- );
379
-
380
- }
381
-
382
- }
383
-
384
- /**
385
- * Runs directly after the Theme Options are save.
386
- *
387
- * @return void
388
- *
389
- * @access public
390
- * @since 2.0
391
- */
392
- if ( ! function_exists( 'ot_after_theme_options_save' ) ) {
393
-
394
- function ot_after_theme_options_save() {
395
-
396
- $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
397
- $updated = isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ? true : false;
398
-
399
- /* only execute after the theme options are saved */
400
- if ( apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ) == $page && $updated ) {
401
-
402
- /* grab a copy of the theme options */
403
- $options = get_option( 'option_tree' );
404
-
405
- /* execute the action hook and pass the theme options to it */
406
- do_action( 'ot_after_theme_options_save', $options );
407
-
408
- }
409
-
410
- }
411
-
412
- }
413
-
414
- /**
415
- * Validate the options by type before saving.
416
- *
417
- * This function will run on only some of the option types
418
- * as all of them don't need to be validated, just the
419
- * ones users are going to input data into; because they
420
- * can't be trusted.
421
- *
422
- * @param mixed Setting value
423
- * @param string Setting type
424
- * @param string Setting field ID
425
- * @param string WPML field ID
426
- * @return mixed
427
- *
428
- * @access public
429
- * @since 2.0
430
- */
431
- if ( ! function_exists( 'ot_validate_setting' ) ) {
432
-
433
- function ot_validate_setting( $input, $type, $field_id, $wmpl_id = '' ) {
434
-
435
- /* exit early if missing data */
436
- if ( ! $input || ! $type || ! $field_id )
437
- return $input;
438
-
439
- $input = apply_filters( 'ot_validate_setting', $input, $type, $field_id );
440
-
441
- /* WPML Register and Unregister strings */
442
- if ( ! empty( $wmpl_id ) ) {
443
-
444
- /* Allow filtering on the WPML option types */
445
- $single_string_types = apply_filters( 'ot_wpml_option_types', array( 'text', 'textarea', 'textarea-simple' ) );
446
-
447
- if ( in_array( $type, $single_string_types ) ) {
448
-
449
- if ( ! empty( $input ) ) {
450
-
451
- ot_wpml_register_string( $wmpl_id, $input );
452
-
453
- } else {
454
-
455
- ot_wpml_unregister_string( $wmpl_id );
456
-
457
- }
458
-
459
- }
460
-
461
- }
462
-
463
- if ( 'background' == $type ) {
464
-
465
- $input['background-color'] = ot_validate_setting( $input['background-color'], 'colorpicker', $field_id );
466
-
467
- $input['background-image'] = ot_validate_setting( $input['background-image'], 'upload', $field_id );
468
-
469
- } else if ( 'colorpicker' == $type ) {
470
-
471
- /* return empty & set error */
472
- if ( 0 === preg_match( '/^#([a-f0-9]{6}|[a-f0-9]{3})$/i', $input ) ) {
473
-
474
- $input = '';
475
-
476
- add_settings_error( 'option-tree', 'invalid_hex', __( 'The Colorpicker only allows valid hexadecimal values.', 'option-tree' ), 'error' );
477
-
478
- }
479
-
480
- } else if ( in_array( $type, array( 'css', 'text', 'textarea', 'textarea-simple' ) ) ) {
481
-
482
- if ( ! current_user_can( 'unfiltered_html' ) && OT_ALLOW_UNFILTERED_HTML == false ) {
483
-
484
- $input = wp_kses_post( $input );
485
-
486
- }
487
-
488
- } else if ( 'measurement' == $type ) {
489
-
490
- $input[0] = sanitize_text_field( $input[0] );
491
-
492
- } else if ( 'typography' == $type && isset( $input['font-color'] ) ) {
493
-
494
- $input['font-color'] = ot_validate_setting( $input['font-color'], 'colorpicker', $field_id );
495
-
496
- } else if ( 'upload' == $type ) {
497
-
498
- $input = sanitize_text_field( $input );
499
-
500
- }
501
-
502
- $input = apply_filters( 'ot_after_validate_setting', $input, $type, $field_id );
503
-
504
- return $input;
505
-
506
- }
507
-
508
- }
509
-
510
- /**
511
- * Setup the default admin styles
512
- *
513
- * @return void
514
- *
515
- * @access public
516
- * @since 2.0
517
- */
518
- if ( ! function_exists( 'ot_admin_styles' ) ) {
519
-
520
- function ot_admin_styles() {
521
-
522
- wp_enqueue_style( 'ot-admin-css', OT_URL . 'assets/css/ot-admin.css', false, OT_VERSION );
523
-
524
- }
525
-
526
- }
527
-
528
- /**
529
- * Setup the default admin scripts
530
- *
531
- * @uses add_thickbox() Include Thickbox for file uploads
532
- * @uses wp_enqueue_script() Add OptionTree scripts
533
- * @uses wp_localize_script() Used to include arbitrary Javascript data
534
- *
535
- * @return void
536
- *
537
- * @access public
538
- * @since 2.0
539
- */
540
- if ( ! function_exists( 'ot_admin_scripts' ) ) {
541
-
542
- function ot_admin_scripts() {
543
-
544
- if ( function_exists( 'wp_enqueue_media' ) ) {
545
- /* WP 3.5 Media Uploader */
546
- wp_enqueue_media();
547
- } else {
548
- /* Legacy Thickbox */
549
- add_thickbox();
550
- }
551
-
552
- /* load the colorpicker */
553
- wp_enqueue_script( 'ot-colorpicker-js', OT_URL . 'assets/js/ot-colorpicker.js', array( 'jquery' ), OT_VERSION );
554
-
555
- /* load jQuery-ui slider */
556
- wp_enqueue_script( 'jquery-ui-slider' );
557
-
558
- /* load all the required scripts */
559
- wp_enqueue_script( 'ot-admin-js', OT_URL . 'assets/js/ot-admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-sortable', 'media-upload', 'thickbox' ), OT_VERSION );
560
-
561
- /* create localized JS array */
562
- $localized_array = array(
563
- 'ajax' => admin_url( 'admin-ajax.php' ),
564
- 'upload_text' => __( 'Send to OptionTree', 'option-tree' ),
565
- 'remove_media_text' => __( 'Remove Media', 'option-tree' ),
566
- 'reset_agree' => __( 'Are you sure you want to reset back to the defaults?', 'option-tree' ),
567
- 'remove_no' => __( 'You can\'t remove this! But you can edit the values.', 'option-tree' ),
568
- 'remove_agree' => __( 'Are you sure you want to remove this?', 'option-tree' ),
569
- 'activate_layout_agree' => __( 'Are you sure you want to activate this layout?', 'option-tree' ),
570
- 'setting_limit' => __( 'Sorry, you can\'t have settings three levels deep.', 'option-tree' )
571
- );
572
-
573
- /* localized script attached to 'option_tree' */
574
- wp_localize_script( 'ot-admin-js', 'option_tree', $localized_array );
575
-
576
- }
577
-
578
- }
579
-
580
- /**
581
- * Returns the ID of a custom post type by post_name.
582
- *
583
- * @uses get_results()
584
- *
585
- * @return int
586
- *
587
- * @access public
588
- * @since 2.0
589
- */
590
- if ( ! function_exists( 'ot_get_media_post_ID' ) ) {
591
-
592
- function ot_get_media_post_ID() {
593
- global $wpdb;
594
-
595
- return $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE `post_name` = 'media' AND `post_type` = 'option-tree' AND `post_status` = 'private'" );
596
-
597
- }
598
-
599
- }
600
-
601
- /**
602
- * Register custom post type & create the media post used to attach images.
603
- *
604
- * @uses get_results()
605
- *
606
- * @return void
607
- *
608
- * @access public
609
- * @since 2.0
610
- */
611
- if ( ! function_exists( 'ot_create_media_post' ) ) {
612
-
613
- function ot_create_media_post() {
614
-
615
- register_post_type( 'option-tree', array(
616
- 'labels' => array( 'name' => __( 'Option Tree', 'option-tree' ) ),
617
- 'public' => false,
618
- 'show_ui' => false,
619
- 'capability_type' => 'post',
620
- 'exclude_from_search' => true,
621
- 'hierarchical' => false,
622
- 'rewrite' => false,
623
- 'supports' => array( 'title', 'editor' ),
624
- 'can_export' => false,
625
- 'show_in_nav_menus' => false
626
- ) );
627
-
628
- /* look for custom page */
629
- $post_id = ot_get_media_post_ID();
630
-
631
- /* no post exists */
632
- if ( $post_id == 0 ) {
633
-
634
- /* create post object */
635
- $_p = array();
636
- $_p['post_title'] = 'Media';
637
- $_p['post_status'] = 'private';
638
- $_p['post_type'] = 'option-tree';
639
- $_p['comment_status'] = 'closed';
640
- $_p['ping_status'] = 'closed';
641
-
642
- /* insert the post into the database */
643
- wp_insert_post( $_p );
644
-
645
- }
646
-
647
- }
648
-
649
- }
650
-
651
- /**
652
- * Setup default settings array.
653
- *
654
- * @return void
655
- *
656
- * @access public
657
- * @since 2.0
658
- */
659
- if ( ! function_exists( 'ot_default_settings' ) ) {
660
-
661
- function ot_default_settings() {
662
- global $wpdb, $table_prefix;
663
-
664
- if ( ! get_option( 'option_tree_settings' ) ) {
665
-
666
- $section_count = 0;
667
- $settings_count = 0;
668
- $settings = array();
669
-
670
- if ( mysql_num_rows( mysql_query( "SHOW TABLES LIKE '{$table_prefix}option_tree'" ) ) == 1 && $old_settings = $wpdb->get_results( "SELECT * FROM {$table_prefix}option_tree ORDER BY item_sort ASC" ) ) {
671
-
672
- foreach ( $old_settings as $setting ) {
673
-
674
- /* heading is a section now */
675
- if ( $setting->item_type == 'heading' ) {
676
-
677
- /* add section to the sections array */
678
- $settings['sections'][$section_count]['id'] = $setting->item_id;
679
- $settings['sections'][$section_count]['title'] = $setting->item_title;
680
-
681
- /* save the last section id to use in creating settings */
682
- $section = $setting->item_id;
683
-
684
- /* increment the section count */
685
- $section_count++;
686
-
687
- } else {
688
-
689
- /* add setting to the settings array */
690
- $settings['settings'][$settings_count]['id'] = $setting->item_id;
691
- $settings['settings'][$settings_count]['label'] = $setting->item_title;
692
- $settings['settings'][$settings_count]['desc'] = $setting->item_desc;
693
- $settings['settings'][$settings_count]['section'] = $section;
694
- $settings['settings'][$settings_count]['type'] = ot_map_old_option_types( $setting->item_type );
695
- $settings['settings'][$settings_count]['std'] = '';
696
- $settings['settings'][$settings_count]['class'] = '';
697
-
698
- /* textarea rows */
699
- $rows = '';
700
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
701
- if ( (int) $setting->item_options > 0 ) {
702
- $rows = (int) $setting->item_options;
703
- } else {
704
- $rows = 15;
705
- }
706
- }
707
- $settings['settings'][$settings_count]['rows'] = $rows;
708
-
709
- /* post type */
710
- $post_type = '';
711
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
712
- if ( '' != $setting->item_options ) {
713
- $post_type = $setting->item_options;
714
- } else {
715
- $post_type = 'post';
716
- }
717
- }
718
- $settings['settings'][$settings_count]['post_type'] = $post_type;
719
-
720
- /* choices */
721
- $choices = array();
722
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
723
- if ( '' != $setting->item_options ) {
724
- $choices = ot_convert_string_to_array( $setting->item_options );
725
- }
726
- }
727
- $settings['settings'][$settings_count]['choices'] = $choices;
728
-
729
- $settings_count++;
730
- }
731
-
732
- }
733
-
734
- /* make sure each setting has a section just incase */
735
- if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
736
- foreach( $settings['settings'] as $k => $setting ) {
737
- if ( '' == $setting['section'] ) {
738
- $settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
739
- }
740
- }
741
- }
742
-
743
- }
744
-
745
- /* if array if not properly formed create fallback settings array */
746
- if ( ! isset( $settings['sections'] ) || ! isset( $settings['settings'] ) ) {
747
-
748
- $settings = array(
749
- 'sections' => array(
750
- array(
751
- 'id' => 'general',
752
- 'title' => __( 'General', 'option-tree' )
753
- )
754
- ),
755
- 'settings' => array(
756
- array(
757
- 'id' => 'sample_text',
758
- 'label' => __( 'Sample Text Field Label', 'option-tree' ),
759
- 'desc' => __( 'Description for the sample text field.', 'option-tree' ),
760
- 'section' => 'general',
761
- 'type' => 'text',
762
- 'std' => '',
763
- 'class' => '',
764
- 'rows' => '',
765
- 'post_type' => '',
766
- 'choices' => array()
767
- )
768
- )
769
- );
770
-
771
- }
772
-
773
- /* update the settings array */
774
- update_option( 'option_tree_settings', $settings );
775
-
776
- /* get option tree array */
777
- $options = get_option( 'option_tree' );
778
-
779
- /* validate options */
780
- if ( is_array( $options ) ) {
781
-
782
- foreach( $settings['settings'] as $setting ) {
783
-
784
- if ( isset( $options[$setting['id']] ) ) {
785
-
786
- $content = ot_stripslashes( $options[$setting['id']] );
787
-
788
- $options[$setting['id']] = ot_validate_setting( $content, $setting['type'], $setting['id'] );
789
-
790
- }
791
-
792
- }
793
-
794
- /* execute the action hook and pass the theme options to it */
795
- do_action( 'ot_before_theme_options_save', $options );
796
-
797
- /* update the option tree array */
798
- update_option( 'option_tree', $options );
799
-
800
- }
801
-
802
- }
803
-
804
- }
805
-
806
- }
807
-
808
- /**
809
- * Helper function to update the CSS option type after save.
810
- *
811
- * @return void
812
- *
813
- * @access public
814
- * @since 2.0
815
- */
816
- if ( ! function_exists( 'ot_save_css' ) ) {
817
-
818
- function ot_save_css( $options ) {
819
-
820
- /* grab a copy of the settings */
821
- $settings = get_option( 'option_tree_settings' );
822
-
823
- /* has settings */
824
- if ( isset( $settings['settings'] ) ) {
825
-
826
- /* loop through sections and insert CSS when needed */
827
- foreach( $settings['settings'] as $k => $setting ) {
828
-
829
- /* is the CSS option type */
830
- if ( isset( $setting['type'] ) && 'css' == $setting['type'] ) {
831
-
832
- /* insert CSS into dynamic.css */
833
- if ( isset( $options[$setting['id']] ) && '' !== $options[$setting['id']] ) {
834
-
835
- ot_insert_css_with_markers( $setting['id'], $options[$setting['id']] );
836
-
837
- /* remove old CSS from dynamic.css */
838
- } else {
839
-
840
- ot_remove_old_css( $setting['id'] );
841
-
842
- }
843
-
844
- }
845
-
846
- }
847
-
848
- }
849
-
850
- }
851
-
852
- }
853
-
854
- /**
855
- * Helper function to load filters for XML mime type.
856
- *
857
- * @return void
858
- *
859
- * @access public
860
- * @since 2.0
861
- */
862
- if ( ! function_exists( 'ot_add_xml_to_upload_filetypes' ) ) {
863
-
864
- function ot_add_xml_to_upload_filetypes() {
865
-
866
- add_filter( 'upload_mimes', 'ot_upload_mimes' );
867
- add_filter( 'wp_mime_type_icon', 'ot_xml_mime_type_icon', 10, 2 );
868
-
869
- }
870
-
871
- }
872
-
873
- /**
874
- * Filter 'upload_mimes' and add xml.
875
- *
876
- * @param array $mimes An array of valid upload mime types
877
- * @return array
878
- *
879
- * @access public
880
- * @since 2.0
881
- */
882
- if ( ! function_exists( 'ot_upload_mimes' ) ) {
883
-
884
- function ot_upload_mimes( $mimes ) {
885
-
886
- $mimes['xml'] = 'application/xml';
887
-
888
- return $mimes;
889
-
890
- }
891
-
892
- }
893
-
894
- /**
895
- * Filters 'wp_mime_type_icon' and have xml display as a document.
896
- *
897
- * @param string $icon The mime icon
898
- * @param string $mime The mime type
899
- * @return string
900
- *
901
- * @access public
902
- * @since 2.0
903
- */
904
- if ( ! function_exists( 'ot_xml_mime_type_icon' ) ) {
905
-
906
- function ot_xml_mime_type_icon( $icon, $mime ) {
907
-
908
- if ( $mime == 'application/xml' || $mime == 'text/xml' )
909
- return wp_mime_type_icon( 'document' );
910
-
911
- return $icon;
912
-
913
- }
914
-
915
- }
916
-
917
- /**
918
- * Import before the screen is displayed.
919
- *
920
- * @return void
921
- *
922
- * @access public
923
- * @since 2.0
924
- */
925
- if ( ! function_exists( 'ot_import' ) ) {
926
-
927
- function ot_import() {
928
-
929
- /* check and verify import xml nonce */
930
- if ( isset( $_POST['import_xml_nonce'] ) && wp_verify_nonce( $_POST['import_xml_nonce'], 'import_xml_form' ) ) {
931
-
932
- /* import input value */
933
- $file = isset( $_POST['import_xml'] ) ? esc_url( $_POST['import_xml'] ) : '';
934
-
935
- /* validate xml file */
936
- if ( preg_match( "/(.xml)$/i", $file ) && class_exists( 'SimpleXMLElement' ) ) {
937
-
938
- $settings = ot_import_xml( $file );
939
-
940
- }
941
-
942
- /* default message */
943
- $message = 'failed';
944
-
945
- /* cleanup, save, & show success message */
946
- if ( isset( $settings ) && ! empty( $settings ) ) {
947
-
948
- /* delete file */
949
- if ( $file ) {
950
- global $wpdb;
951
- $attachmentid = $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE guid='$file'" );
952
- wp_delete_attachment( $attachmentid, true );
953
- }
954
-
955
- /* update settings */
956
- update_option( 'option_tree_settings', $settings );
957
-
958
- /* set message */
959
- $message = 'success';
960
-
961
- }
962
-
963
- /* redirect */
964
- wp_redirect( add_query_arg( array( 'action' => 'import-xml', 'message' => $message ), $_POST['_wp_http_referer'] ) );
965
- exit;
966
-
967
- }
968
-
969
- /* check and verify import settings nonce */
970
- if ( isset( $_POST['import_settings_nonce'] ) && wp_verify_nonce( $_POST['import_settings_nonce'], 'import_settings_form' ) ) {
971
-
972
- /* textarea value */
973
- $textarea = isset( $_POST['import_settings'] ) ? unserialize( ot_decode( $_POST['import_settings'] ) ) : '';
974
-
975
- /* default message */
976
- $message = 'failed';
977
-
978
- /* is array: save & show success message */
979
- if ( is_array( $textarea ) ) {
980
- update_option( 'option_tree_settings', $textarea );
981
- $message = 'success';
982
- }
983
-
984
- /* redirect */
985
- wp_redirect( add_query_arg( array( 'action' => 'import-settings', 'message' => $message ), $_POST['_wp_http_referer'] ) );
986
- exit;
987
-
988
- }
989
-
990
- /* check and verify import theme options data nonce */
991
- if ( isset( $_POST['import_data_nonce'] ) && wp_verify_nonce( $_POST['import_data_nonce'], 'import_data_form' ) ) {
992
-
993
- /* default message */
994
- $message = 'failed';
995
-
996
- /* textarea value */
997
- $options = isset( $_POST['import_data'] ) ? unserialize( ot_decode( $_POST['import_data'] ) ) : '';
998
-
999
- /* get settings array */
1000
- $settings = get_option( 'option_tree_settings' );
1001
-
1002
- /* has options */
1003
- if ( is_array( $options ) ) {
1004
-
1005
- /* validate options */
1006
- if ( is_array( $settings ) ) {
1007
-
1008
- foreach( $settings['settings'] as $setting ) {
1009
-
1010
- if ( isset( $options[$setting['id']] ) ) {
1011
-
1012
- $content = ot_stripslashes( $options[$setting['id']] );
1013
-
1014
- $options[$setting['id']] = ot_validate_setting( $content, $setting['type'], $setting['id'] );
1015
-
1016
- }
1017
-
1018
- }
1019
-
1020
- }
1021
-
1022
- /* execute the action hook and pass the theme options to it */
1023
- do_action( 'ot_before_theme_options_save', $options );
1024
-
1025
- /* update the option tree array */
1026
- update_option( 'option_tree', $options );
1027
-
1028
- $message = 'success';
1029
-
1030
- }
1031
-
1032
- /* redirect accordingly */
1033
- wp_redirect( add_query_arg( array( 'action' => 'import-data', 'message' => $message ), $_POST['_wp_http_referer'] ) );
1034
- exit;
1035
-
1036
- }
1037
-
1038
- /* check and verify import layouts nonce */
1039
- if ( isset( $_POST['import_layouts_nonce'] ) && wp_verify_nonce( $_POST['import_layouts_nonce'], 'import_layouts_form' ) ) {
1040
-
1041
- /* default message */
1042
- $message = 'failed';
1043
-
1044
- /* textarea value */
1045
- $layouts = isset( $_POST['import_layouts'] ) ? unserialize( ot_decode( $_POST['import_layouts'] ) ) : '';
1046
-
1047
- /* get settings array */
1048
- $settings = get_option( 'option_tree_settings' );
1049
-
1050
- /* has layouts */
1051
- if ( is_array( $layouts ) ) {
1052
-
1053
- /* validate options */
1054
- if ( is_array( $settings ) ) {
1055
-
1056
- foreach( $layouts as $key => $value ) {
1057
-
1058
- if ( $key == 'active_layout' )
1059
- continue;
1060
-
1061
- $options = unserialize( ot_decode( $value ) );
1062
-
1063
- foreach( $settings['settings'] as $setting ) {
1064
-
1065
- if ( isset( $options[$setting['id']] ) ) {
1066
-
1067
- $content = ot_stripslashes( $options[$setting['id']] );
1068
-
1069
- $options[$setting['id']] = ot_validate_setting( $content, $setting['type'], $setting['id'] );
1070
-
1071
- }
1072
-
1073
- }
1074
-
1075
- $layouts[$key] = ot_encode( serialize( $options ) );
1076
-
1077
- }
1078
-
1079
- }
1080
-
1081
- /* update the option tree array */
1082
- if ( isset( $layouts['active_layout'] ) ) {
1083
-
1084
- $new_options = unserialize( ot_decode( $layouts[$layouts['active_layout']] ) );
1085
-
1086
- /* execute the action hook and pass the theme options to it */
1087
- do_action( 'ot_before_theme_options_save', $new_options );
1088
-
1089
- update_option( 'option_tree', $new_options );
1090
-
1091
- }
1092
-
1093
- /* update the option tree layouts array */
1094
- update_option( 'option_tree_layouts', $layouts );
1095
-
1096
- $message = 'success';
1097
-
1098
- }
1099
-
1100
- /* redirect accordingly */
1101
- wp_redirect( add_query_arg( array( 'action' => 'import-layouts', 'message' => $message ), $_POST['_wp_http_referer'] ) );
1102
- exit;
1103
-
1104
- }
1105
-
1106
- return false;
1107
-
1108
- }
1109
-
1110
- }
1111
-
1112
- /**
1113
- * Export before the screen is displayed.
1114
- *
1115
- * @return void
1116
- *
1117
- * @access public
1118
- * @since 2.0.8
1119
- */
1120
- if ( ! function_exists( 'ot_export' ) ) {
1121
-
1122
- function ot_export() {
1123
-
1124
- /* check and verify export settings file nonce */
1125
- if ( isset( $_POST['export_settings_file_nonce'] ) && wp_verify_nonce( $_POST['export_settings_file_nonce'], 'export_settings_file_form' ) ) {
1126
-
1127
- ot_export_php_settings_array();
1128
-
1129
- }
1130
-
1131
- }
1132
-
1133
- }
1134
-
1135
- /**
1136
- * Reusable XMl import helper function.
1137
- *
1138
- * @param string $file The path to the file.
1139
- * @return mixed False or an array of settings.
1140
- *
1141
- * @access public
1142
- * @since 2.0.8
1143
- */
1144
- if ( ! function_exists( 'ot_import_xml' ) ) {
1145
-
1146
- function ot_import_xml( $file ) {
1147
-
1148
- $get_data = wp_remote_get( $file );
1149
-
1150
- if ( is_wp_error( $get_data ) )
1151
- return false;
1152
-
1153
- $rawdata = isset( $get_data['body'] ) ? $get_data['body'] : false;
1154
-
1155
- if ( $rawdata ) {
1156
-
1157
- $section_count = 0;
1158
- $settings_count = 0;
1159
-
1160
- $section = '';
1161
-
1162
- $settings = array();
1163
- $xml = new SimpleXMLElement( $rawdata );
1164
-
1165
- foreach ( $xml->row as $value ) {
1166
-
1167
- /* heading is a section now */
1168
- if ( $value->item_type == 'heading' ) {
1169
-
1170
- /* add section to the sections array */
1171
- $settings['sections'][$section_count]['id'] = (string) $value->item_id;
1172
- $settings['sections'][$section_count]['title'] = (string) $value->item_title;
1173
-
1174
- /* save the last section id to use in creating settings */
1175
- $section = (string) $value->item_id;
1176
-
1177
- /* increment the section count */
1178
- $section_count++;
1179
-
1180
- } else {
1181
-
1182
- /* add setting to the settings array */
1183
- $settings['settings'][$settings_count]['id'] = (string) $value->item_id;
1184
- $settings['settings'][$settings_count]['label'] = (string) $value->item_title;
1185
- $settings['settings'][$settings_count]['desc'] = (string) $value->item_desc;
1186
- $settings['settings'][$settings_count]['section'] = $section;
1187
- $settings['settings'][$settings_count]['type'] = ot_map_old_option_types( (string) $value->item_type );
1188
- $settings['settings'][$settings_count]['std'] = '';
1189
- $settings['settings'][$settings_count]['class'] = '';
1190
-
1191
- /* textarea rows */
1192
- $rows = '';
1193
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
1194
- if ( (int) $value->item_options > 0 ) {
1195
- $rows = (int) $value->item_options;
1196
- } else {
1197
- $rows = 15;
1198
- }
1199
- }
1200
- $settings['settings'][$settings_count]['rows'] = $rows;
1201
-
1202
- /* post type */
1203
- $post_type = '';
1204
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
1205
- if ( '' != (string) $value->item_options ) {
1206
- $post_type = (string) $value->item_options;
1207
- } else {
1208
- $post_type = 'post';
1209
- }
1210
- }
1211
- $settings['settings'][$settings_count]['post_type'] = $post_type;
1212
-
1213
- /* choices */
1214
- $choices = array();
1215
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
1216
- if ( '' != (string) $value->item_options ) {
1217
- $choices = ot_convert_string_to_array( (string) $value->item_options );
1218
- }
1219
- }
1220
- $settings['settings'][$settings_count]['choices'] = $choices;
1221
-
1222
- $settings_count++;
1223
- }
1224
-
1225
- }
1226
-
1227
- /* make sure each setting has a section just incase */
1228
- if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
1229
- foreach( $settings['settings'] as $k => $setting ) {
1230
- if ( '' == $setting['section'] ) {
1231
- $settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
1232
- }
1233
- }
1234
- }
1235
-
1236
- return $settings;
1237
-
1238
- }
1239
-
1240
- return false;
1241
- }
1242
-
1243
- }
1244
-
1245
- /**
1246
- * Export the Theme Mode theme-options.php
1247
- *
1248
- * @return attachment
1249
- *
1250
- * @access public
1251
- * @since 2.0.8
1252
- */
1253
- if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1254
-
1255
- function ot_export_php_settings_array() {
1256
-
1257
- $content = '';
1258
- $build_settings = '';
1259
- $contextual_help = '';
1260
- $sections = '';
1261
- $settings = '';
1262
- $option_tree_settings = get_option( 'option_tree_settings', array() );
1263
-
1264
- header( "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
1265
- header( "Pragma: no-cache ");
1266
- header( "Content-Description: File Transfer" );
1267
- header( 'Content-Disposition: attachment; filename="theme-options.php"');
1268
- header( "Content-Type: application/octet-stream");
1269
- header( "Content-Transfer-Encoding: binary" );
1270
-
1271
- /* build contextual help content */
1272
- if ( isset( $option_tree_settings['contextual_help']['content'] ) ) {
1273
- $help = '';
1274
- foreach( $option_tree_settings['contextual_help']['content'] as $value ) {
1275
- $_id = isset( $value['id'] ) ? $value['id'] : '';
1276
- $_title = isset( $value['title'] ) ? str_replace( "'", "\'", $value['title'] ) : '';
1277
- $_content = isset( $value['content'] ) ? html_entity_decode( str_replace( "'", "\'", $value['content'] ) ) : '';
1278
- $help.= "
1279
- array(
1280
- 'id' => '$_id',
1281
- 'title' => '$_title',
1282
- 'content' => '$_content'
1283
- ),";
1284
- }
1285
- $help = substr_replace( $help, '' , -1 );
1286
- $contextual_help = "
1287
- 'content' => array( $help
1288
- ),";
1289
- }
1290
-
1291
- /* build contextual help sidebar */
1292
- if ( isset( $option_tree_settings['contextual_help']['sidebar'] ) ) {
1293
- $contextual_help.= "
1294
- 'sidebar' => '" . html_entity_decode( str_replace( "'", "\'", $option_tree_settings['contextual_help']['sidebar'] ) ) . "'";
1295
- }
1296
-
1297
- /* check that $contexual_help has a value and add to $build_settings */
1298
- if ( '' != $contextual_help ) {
1299
- $build_settings.= "
1300
- 'contextual_help' => array( $contextual_help
1301
- ),";
1302
- }
1303
-
1304
- /* build sections */
1305
- if ( isset( $option_tree_settings['sections'] ) ) {
1306
- foreach( $option_tree_settings['sections'] as $value ) {
1307
- $_id = isset( $value['id'] ) ? $value['id'] : '';
1308
- $_title = isset( $value['title'] ) ? str_replace( "'", "\'", $value['title'] ) : '';
1309
- $sections.= "
1310
- array(
1311
- 'id' => '$_id',
1312
- 'title' => '$_title'
1313
- ),";
1314
- }
1315
- $sections = substr_replace( $sections, '' , -1 );
1316
- }
1317
-
1318
- /* check that $sections has a value and add to $build_settings */
1319
- if ( '' != $sections ) {
1320
- $build_settings.= "
1321
- 'sections' => array( $sections
1322
- )";
1323
- }
1324
-
1325
- /* build settings */
1326
- if ( isset( $option_tree_settings['settings'] ) ) {
1327
- foreach( $option_tree_settings['settings'] as $value ) {
1328
- $_id = isset( $value['id'] ) ? $value['id'] : '';
1329
- $_label = isset( $value['label'] ) ? str_replace( "'", "\'", $value['label'] ) : '';
1330
- $_desc = isset( $value['desc'] ) ? str_replace( "'", "\'", $value['desc'] ) : '';
1331
- $_std = isset( $value['std'] ) ? $value['std'] : '';
1332
- $_type = isset( $value['type'] ) ? $value['type'] : '';
1333
- $_section = isset( $value['section'] ) ? $value['section'] : '';
1334
- $_rows = isset( $value['rows'] ) ? $value['rows'] : '';
1335
- $_post_type = isset( $value['post_type'] ) ? $value['post_type'] : '';
1336
- $_taxonomy = isset( $value['taxonomy'] ) ? $value['taxonomy'] : '';
1337
- $_min_max_step = isset( $value['min_max_step'] ) ? $value['min_max_step'] : '';
1338
- $_class = isset( $value['class'] ) ? $value['class'] : '';
1339
-
1340
- $choices = '';
1341
- if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
1342
- foreach( $value['choices'] as $choice ) {
1343
- $_choice_value = isset( $choice['value'] ) ? $choice['value'] : '';
1344
- $_choice_label = isset( $choice['label'] ) ? str_replace( "'", "\'", $choice['label'] ) : '';
1345
- $_choice_src = isset( $choice['src'] ) ? str_replace( "'", "\'", $choice['src'] ) : '';
1346
- $choices.= "
1347
- array(
1348
- 'value' => '$_choice_value',
1349
- 'label' => '$_choice_label',
1350
- 'src' => '$_choice_src'
1351
- ),";
1352
- }
1353
- $choices = substr_replace( $choices, '' , -1 );
1354
- $choices = ",
1355
- 'choices' => array( $choices
1356
- ),";
1357
- }
1358
-
1359
- $std = "'$_std'";
1360
- if ( is_array( $_std ) ) {
1361
- $std_array = array();
1362
- foreach( $_std as $_sk => $_sv ) {
1363
- $std_array[] = "'$_sk' => '$_sv'";
1364
- }
1365
- $std = 'array(
1366
- ' . implode( ",\n", $std_array ) . '
1367
- )';
1368
- }
1369
-
1370
- $setting_settings = '';
1371
- if ( isset( $value['settings'] ) && ! empty( $value['settings'] ) ) {
1372
- foreach( $value['settings'] as $setting ) {
1373
- $_setting_id = isset( $setting['id'] ) ? $setting['id'] : '';
1374
- $_setting_label = isset( $setting['label'] ) ? str_replace( "'", "\'", $setting['label'] ) : '';
1375
- $_setting_desc = isset( $setting['desc'] ) ? str_replace( "'", "\'", $setting['desc'] ) : '';
1376
- $_setting_std = isset( $setting['std'] ) ? $setting['std'] : '';
1377
- $_setting_type = isset( $setting['type'] ) ? $setting['type'] : '';
1378
- $_setting_rows = isset( $setting['rows'] ) ? $setting['rows'] : '';
1379
- $_setting_post_type = isset( $setting['post_type'] ) ? $setting['post_type'] : '';
1380
- $_setting_taxonomy = isset( $setting['taxonomy'] ) ? $setting['taxonomy'] : '';
1381
- $_setting_min_max_step = isset( $setting['min_max_step'] ) ? $setting['min_max_step'] : '';
1382
- $_setting_class = isset( $setting['class'] ) ? $setting['class'] : '';
1383
-
1384
- $setting_choices = '';
1385
- if ( isset( $setting['choices'] ) && ! empty( $setting['choices'] ) ) {
1386
- foreach( $setting['choices'] as $setting_choice ) {
1387
- $_setting_choice_value = isset( $setting_choice['value'] ) ? $setting_choice['value'] : '';
1388
- $_setting_choice_label = isset( $setting_choice['label'] ) ? str_replace( "'", "\'", $setting_choice['label'] ) : '';
1389
- $_setting_choice_src = isset( $setting_choice['src'] ) ? str_replace( "'", "\'", $setting_choice['src'] ) : '';
1390
- $setting_choices.= "
1391
- array(
1392
- 'value' => '$_setting_choice_value',
1393
- 'label' => '$_setting_choice_label',
1394
- 'src' => '$_setting_choice_src'
1395
- ),";
1396
- }
1397
- $setting_choices = substr_replace( $setting_choices, '' , -1 );
1398
- $setting_choices = ",
1399
- 'choices' => array( $setting_choices
1400
- ),";
1401
- }
1402
-
1403
- $setting_std = "'$_setting_std'";
1404
- if ( is_array( $_setting_std ) ) {
1405
- $setting_std_array = array();
1406
- foreach( $_setting_std as $_ssk => $_ssv ) {
1407
- $setting_std_array[] = "'$_ssk' => '$_ssv'";
1408
- }
1409
- $setting_std = 'array(
1410
- ' . implode( ",\n", $setting_std_array ) . '
1411
- )';
1412
- }
1413
-
1414
- $setting_settings.= "
1415
- array(
1416
- 'id' => '$_setting_id',
1417
- 'label' => '$_setting_label',
1418
- 'desc' => '$_setting_desc',
1419
- 'std' => $setting_std,
1420
- 'type' => '$_setting_type',
1421
- 'rows' => '$_setting_rows',
1422
- 'post_type' => '$_setting_post_type',
1423
- 'taxonomy' => '$_setting_taxonomy',
1424
- 'min_max_step'=> '$_setting_min_max_step',
1425
- 'class' => '$_setting_class'$setting_choices
1426
- ),";
1427
- }
1428
- $setting_settings = substr_replace( $setting_settings, '' , -1 );
1429
- $setting_settings = ",
1430
- 'settings' => array( $setting_settings
1431
- )";
1432
- }
1433
-
1434
- $settings.= "
1435
- array(
1436
- 'id' => '$_id',
1437
- 'label' => '$_label',
1438
- 'desc' => '$_desc',
1439
- 'std' => $std,
1440
- 'type' => '$_type',
1441
- 'section' => '$_section',
1442
- 'rows' => '$_rows',
1443
- 'post_type' => '$_post_type',
1444
- 'taxonomy' => '$_taxonomy',
1445
- 'min_max_step'=> '$_min_max_step',
1446
- 'class' => '$_class'$choices$setting_settings
1447
- ),";
1448
- }
1449
- $settings = substr_replace( $settings, '' , -1 );
1450
- }
1451
-
1452
- /* check that $sections has a value and add to $build_settings */
1453
- if ( '' != $settings ) {
1454
- $build_settings.= ",
1455
- 'settings' => array( $settings
1456
- )";
1457
- }
1458
-
1459
- $content.= "<?php
1460
- /**
1461
- * Initialize the custom theme options.
1462
- */
1463
- add_action( 'admin_init', 'custom_theme_options' );
1464
-
1465
- /**
1466
- * Build the custom settings & update OptionTree.
1467
- */
1468
- function custom_theme_options() {
1469
- /**
1470
- * Get a copy of the saved settings array.
1471
- */
1472
- \$saved_settings = get_option( 'option_tree_settings', array() );
1473
-
1474
- /**
1475
- * Custom settings array that will eventually be
1476
- * passes to the OptionTree Settings API Class.
1477
- */
1478
- \$custom_settings = array( $build_settings
1479
- );
1480
-
1481
- /* allow settings to be filtered before saving */
1482
- \$custom_settings = apply_filters( 'option_tree_settings_args', \$custom_settings );
1483
-
1484
- /* settings are not the same update the DB */
1485
- if ( \$saved_settings !== \$custom_settings ) {
1486
- update_option( 'option_tree_settings', \$custom_settings );
1487
- }
1488
-
1489
- }";
1490
-
1491
- echo $content;
1492
- die();
1493
- }
1494
-
1495
- }
1496
-
1497
- /**
1498
- * Save settings array before the screen is displayed.
1499
- *
1500
- * @return void
1501
- *
1502
- * @access public
1503
- * @since 2.0
1504
- */
1505
- if ( ! function_exists( 'ot_save_settings' ) ) {
1506
-
1507
- function ot_save_settings() {
1508
-
1509
- /* check and verify import settings nonce */
1510
- if ( isset( $_POST['option_tree_settings_nonce'] ) && wp_verify_nonce( $_POST['option_tree_settings_nonce'], 'option_tree_settings_form' ) ) {
1511
-
1512
- /* settings value */
1513
- $settings = isset( $_POST['option_tree_settings'] ) ? $_POST['option_tree_settings'] : '';
1514
-
1515
- /* validate sections */
1516
- if ( isset( $settings['sections'] ) ) {
1517
-
1518
- /* fix numeric keys since drag & drop will change them */
1519
- $settings['sections'] = array_values( $settings['sections'] );
1520
-
1521
- /* loop through sections */
1522
- foreach( $settings['sections'] as $k => $section ) {
1523
-
1524
- /* remove from array if missing values */
1525
- if ( ( ! isset( $section['title'] ) && ! isset( $section['id'] ) ) || ( '' == $section['title'] && '' == $section['id'] ) ) {
1526
-
1527
- unset( $settings['sections'][$k] );
1528
-
1529
- } else {
1530
-
1531
- /* validate label */
1532
- if ( '' != $section['title'] ) {
1533
-
1534
- $settings['sections'][$k]['title'] = wp_kses_post( $section['title'] );
1535
-
1536
- }
1537
-
1538
- /* missing title set to unfiltered ID */
1539
- if ( ! isset( $section['title'] ) || '' == $section['title'] ) {
1540
-
1541
- $settings['sections'][$k]['title'] = wp_kses_post( $section['id'] );
1542
-
1543
- /* missing ID set to title */
1544
- } else if ( ! isset( $section['id'] ) || '' == $section['id'] ) {
1545
-
1546
- $section['id'] = wp_kses_post( $section['title'] );
1547
-
1548
- }
1549
-
1550
- /* sanitize ID once everything has been checked first */
1551
- $settings['sections'][$k]['id'] = ot_sanitize_option_id( wp_kses_post( $section['id'] ) );
1552
-
1553
- }
1554
-
1555
- }
1556
-
1557
- $settings['sections'] = ot_stripslashes( $settings['sections'] );
1558
-
1559
- }
1560
-
1561
- /* validate settings by looping over array as many times as it takes */
1562
- if ( isset( $settings['settings'] ) ) {
1563
-
1564
- $settings['settings'] = ot_validate_settings_array( $settings['settings'] );
1565
-
1566
- }
1567
-
1568
- /* validate contextual_help */
1569
- if ( isset( $settings['contextual_help']['content'] ) ) {
1570
-
1571
- /* fix numeric keys since drag & drop will change them */
1572
- $settings['contextual_help']['content'] = array_values( $settings['contextual_help']['content'] );
1573
-
1574
- /* loop through content */
1575
- foreach( $settings['contextual_help']['content'] as $k => $content ) {
1576
-
1577
- /* remove from array if missing values */
1578
- if ( ( ! isset( $content['title'] ) && ! isset( $content['id'] ) ) || ( '' == $content['title'] && '' == $content['id'] ) ) {
1579
-
1580
- unset( $settings['contextual_help']['content'][$k] );
1581
-
1582
- } else {
1583
-
1584
- /* validate label */
1585
- if ( '' != $content['title'] ) {
1586
-
1587
- $settings['contextual_help']['content'][$k]['title'] = wp_kses_post( $content['title'] );
1588
-
1589
- }
1590
-
1591
- /* missing title set to unfiltered ID */
1592
- if ( ! isset( $content['title'] ) || '' == $content['title'] ) {
1593
-
1594
- $settings['contextual_help']['content'][$k]['title'] = wp_kses_post( $content['id'] );
1595
-
1596
- /* missing ID set to title */
1597
- } else if ( ! isset( $content['id'] ) || '' == $content['id'] ) {
1598
-
1599
- $content['id'] = wp_kses_post( $content['title'] );
1600
-
1601
- }
1602
-
1603
- /* sanitize ID once everything has been checked first */
1604
- $settings['contextual_help']['content'][$k]['id'] = ot_sanitize_option_id( wp_kses_post( $content['id'] ) );
1605
-
1606
- }
1607
-
1608
- /* validate textarea description */
1609
- if ( isset( $content['content'] ) ) {
1610
-
1611
- $settings['contextual_help']['content'][$k]['content'] = wp_kses_post( $content['content'] );
1612
-
1613
- }
1614
-
1615
- }
1616
-
1617
- }
1618
-
1619
- /* validate contextual_help sidebar */
1620
- if ( isset( $settings['contextual_help']['sidebar'] ) ) {
1621
-
1622
- $settings['contextual_help']['sidebar'] = wp_kses_post( $settings['contextual_help']['sidebar'] );
1623
-
1624
- }
1625
-
1626
- $settings['contextual_help'] = ot_stripslashes( $settings['contextual_help'] );
1627
-
1628
- /* default message */
1629
- $message = 'failed';
1630
-
1631
- /* is array: save & show success message */
1632
- if ( is_array( $settings ) ) {
1633
-
1634
- /* WPML unregister ID's that have been removed */
1635
- if ( function_exists( 'icl_unregister_string' ) ) {
1636
-
1637
- $current = get_option( 'option_tree_settings' );
1638
- $options = get_option( 'option_tree' );
1639
-
1640
- if ( isset( $current['settings'] ) ) {
1641
-
1642
- /* Empty ID array */
1643
- $new_ids = array();
1644
-
1645
- /* Build the WPML IDs array */
1646
- foreach( $settings['settings'] as $setting ) {
1647
-
1648
- if ( $setting['id'] ) {
1649
-
1650
- $new_ids[] = $setting['id'];
1651
-
1652
- }
1653
-
1654
- }
1655
-
1656
- /* Remove missing IDs from WPML */
1657
- foreach( $current['settings'] as $current_setting ) {
1658
-
1659
- if ( ! in_array( $current_setting['id'], $new_ids ) ) {
1660
-
1661
- if ( ! empty( $options[$current_setting['id']] ) && in_array( $current_setting['type'], array( 'list-item', 'slider' ) ) ) {
1662
-
1663
- foreach( $options[$current_setting['id']] as $key => $value ) {
1664
-
1665
- foreach( $value as $ckey => $cvalue ) {
1666
-
1667
- ot_wpml_unregister_string( $current_setting['id'] . '_' . $ckey . '_' . $key );
1668
-
1669
- }
1670
-
1671
- }
1672
-
1673
- } else {
1674
-
1675
- ot_wpml_unregister_string( $current_setting['id'] );
1676
-
1677
- }
1678
-
1679
- }
1680
-
1681
- }
1682
-
1683
- }
1684
-
1685
- }
1686
-
1687
- update_option( 'option_tree_settings', $settings );
1688
- $message = 'success';
1689
-
1690
- }
1691
-
1692
- /* redirect */
1693
- wp_redirect( add_query_arg( array( 'action' => 'save-settings', 'message' => $message ), $_POST['_wp_http_referer'] ) );
1694
- exit;
1695
-
1696
- }
1697
-
1698
- return false;
1699
-
1700
- }
1701
-
1702
- }
1703
-
1704
- /**
1705
- * Validate the settings array before save.
1706
- *
1707
- * This function will loop over the settings array as many
1708
- * times as it takes to validate every sub setting.
1709
- *
1710
- * @param array $settings The array of settings.
1711
- * @return array
1712
- *
1713
- * @access public
1714
- * @since 2.0
1715
- */
1716
- if ( ! function_exists( 'ot_validate_settings_array' ) ) {
1717
-
1718
- function ot_validate_settings_array( $settings = array() ) {
1719
-
1720
- /* validate settings */
1721
- if ( count( $settings ) > 0 ) {
1722
-
1723
- /* fix numeric keys since drag & drop will change them */
1724
- $settings = array_values( $settings );
1725
-
1726
- /* loop through settings */
1727
- foreach( $settings as $k => $setting ) {
1728
-
1729
-
1730
- /* remove from array if missing values */
1731
- if ( ( ! isset( $setting['label'] ) && ! isset( $setting['id'] ) ) || ( '' == $setting['label'] && '' == $setting['id'] ) ) {
1732
-
1733
- unset( $settings[$k] );
1734
-
1735
- } else {
1736
-
1737
- /* validate label */
1738
- if ( '' != $setting['label'] ) {
1739
-
1740
- $settings[$k]['label'] = wp_kses_post( $setting['label'] );
1741
-
1742
- }
1743
-
1744
- /* missing label set to unfiltered ID */
1745
- if ( ! isset( $setting['label'] ) || '' == $setting['label'] ) {
1746
-
1747
- $settings[$k]['label'] = $setting['id'];
1748
-
1749
- /* missing ID set to label */
1750
- } else if ( ! isset( $setting['id'] ) || '' == $setting['id'] ) {
1751
-
1752
- $setting['id'] = wp_kses_post( $setting['label'] );
1753
-
1754
- }
1755
-
1756
- /* sanitize ID once everything has been checked first */
1757
- $settings[$k]['id'] = ot_sanitize_option_id( wp_kses_post( $setting['id'] ) );
1758
-
1759
- }
1760
-
1761
- /* validate description */
1762
- if ( '' != $setting['desc'] ) {
1763
-
1764
- $settings[$k]['desc'] = wp_kses_post( $setting['desc'] );
1765
-
1766
- }
1767
-
1768
- /* validate choices */
1769
- if ( isset( $setting['choices'] ) ) {
1770
-
1771
- /* loop through choices */
1772
- foreach( $setting['choices'] as $ck => $choice ) {
1773
-
1774
- /* remove from array if missing values */
1775
- if ( ( ! isset( $choice['label'] ) && ! isset( $choice['value'] ) ) || ( '' == $choice['label'] && '' == $choice['value'] ) ) {
1776
-
1777
- unset( $setting['choices'][$ck] );
1778
-
1779
- } else {
1780
-
1781
- /* missing label set to unfiltered ID */
1782
- if ( ! isset( $choice['label'] ) || '' == $choice['label'] ) {
1783
-
1784
- $setting['choices'][$ck]['label'] = wp_kses_post( $choice['value'] );
1785
-
1786
- /* missing value set to label */
1787
- } else if ( ! isset( $choice['value'] ) || '' == $choice['value'] ) {
1788
-
1789
- $setting['choices'][$ck]['value'] = ot_sanitize_option_id( wp_kses_post( $choice['label'] ) );
1790
-
1791
- }
1792
-
1793
- }
1794
-
1795
- }
1796
-
1797
- /* update keys and push new array values */
1798
- $settings[$k]['choices'] = array_values( $setting['choices'] );
1799
-
1800
- }
1801
-
1802
- /* validate sub settings */
1803
- if ( isset( $setting['settings'] ) ) {
1804
-
1805
- $settings[$k]['settings'] = ot_validate_settings_array( $setting['settings'] );
1806
-
1807
- }
1808
-
1809
- }
1810
-
1811
- }
1812
-
1813
- /* return array but strip those damn slashes out first!!! */
1814
- return ot_stripslashes( $settings );
1815
-
1816
- }
1817
-
1818
- }
1819
-
1820
- /**
1821
- * Save layouts array before the screen is displayed.
1822
- *
1823
- * @return void
1824
- *
1825
- * @access public
1826
- * @since 2.0
1827
- */
1828
- if ( ! function_exists( 'ot_modify_layouts' ) ) {
1829
-
1830
- function ot_modify_layouts() {
1831
-
1832
- /* check and verify modify layouts nonce */
1833
- if ( isset( $_POST['option_tree_modify_layouts_nonce'] ) && wp_verify_nonce( $_POST['option_tree_modify_layouts_nonce'], 'option_tree_modify_layouts_form' ) ) {
1834
-
1835
- /* previous layouts value */
1836
- $option_tree_layouts = get_option( 'option_tree_layouts' );
1837
-
1838
- /* new layouts value */
1839
- $layouts = isset( $_POST['option_tree_layouts'] ) ? $_POST['option_tree_layouts'] : '';
1840
-
1841
- /* rebuild layout array */
1842
- $rebuild = array();
1843
-
1844
- /* validate layouts */
1845
- if ( is_array( $layouts ) && ! empty( $layouts ) ) {
1846
-
1847
- /* setup active layout */
1848
- if ( isset( $layouts['active_layout'] ) && ! empty( $layouts['active_layout'] ) ) {
1849
- $rebuild['active_layout'] = $layouts['active_layout'];
1850
- }
1851
-
1852
- /* add new and overwrite active layout */
1853
- if ( isset( $layouts['_add_new_layout_'] ) && ! empty( $layouts['_add_new_layout_'] ) ) {
1854
- $rebuild['active_layout'] = ot_sanitize_layout_id( $layouts['_add_new_layout_'] );
1855
- $rebuild[$rebuild['active_layout']] = ot_encode( serialize( get_option( 'option_tree' ) ) );
1856
- }
1857
-
1858
- $first_layout = '';
1859
-
1860
- /* loop through layouts */
1861
- foreach( $layouts as $key => $layout ) {
1862
-
1863
- /* skip over active layout key */
1864
- if ( $key == 'active_layout' )
1865
- continue;
1866
-
1867
- /* check if the key exists then set value */
1868
- if ( isset( $option_tree_layouts[$key] ) && ! empty( $option_tree_layouts[$key] ) ) {
1869
- $rebuild[$key] = $option_tree_layouts[$key];
1870
- if ( '' == $first_layout ) {
1871
- $first_layout = $key;
1872
- }
1873
- }
1874
-
1875
- }
1876
-
1877
- if ( isset( $rebuild['active_layout'] ) && ! isset( $rebuild[$rebuild['active_layout']] ) && ! empty( $first_layout ) ) {
1878
- $rebuild['active_layout'] = $first_layout;
1879
- }
1880
-
1881
- }
1882
-
1883
- /* default message */
1884
- $message = 'failed';
1885
-
1886
- /* is array: save & show success message */
1887
- if ( count( $rebuild ) > 1 ) {
1888
-
1889
- /* rebuild the theme options */
1890
- $rebuild_option_tree = unserialize( ot_decode( $rebuild[$rebuild['active_layout']] ) );
1891
- if ( is_array( $rebuild_option_tree ) ) {
1892
-
1893
- /* execute the action hook and pass the theme options to it */
1894
- do_action( 'ot_before_theme_options_save', $rebuild_option_tree );
1895
-
1896
- update_option( 'option_tree', $rebuild_option_tree );
1897
-
1898
- }
1899
-
1900
- /* rebuild the layouts */
1901
- update_option( 'option_tree_layouts', $rebuild );
1902
-
1903
- /* change message */
1904
- $message = 'success';
1905
-
1906
- } else if ( count( $rebuild ) <= 1 ) {
1907
-
1908
- /* delete layouts option */
1909
- delete_option( 'option_tree_layouts' );
1910
-
1911
- /* change message */
1912
- $message = 'deleted';
1913
-
1914
- }
1915
-
1916
- /* redirect */
1917
- if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ) ) {
1918
- $query_args = add_query_arg( array( 'settings-updated' => 'layout' ), remove_query_arg( array( 'action', 'message' ), $_POST['_wp_http_referer'] ) );
1919
- } else {
1920
- $query_args = add_query_arg( array( 'action' => 'save-layouts', 'message' => $message ), $_POST['_wp_http_referer'] );
1921
- }
1922
- wp_redirect( $query_args );
1923
- exit;
1924
-
1925
- }
1926
-
1927
- return false;
1928
-
1929
- }
1930
-
1931
- }
1932
-
1933
- /**
1934
- * Helper function to display alert messages.
1935
- *
1936
- * @param array Page array
1937
- * @return mixed
1938
- *
1939
- * @access public
1940
- * @since 2.0
1941
- */
1942
- if ( ! function_exists( 'ot_alert_message' ) ) {
1943
-
1944
- function ot_alert_message( $page = array() ) {
1945
-
1946
- if ( empty( $page ) )
1947
- return false;
1948
-
1949
- $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
1950
- $message = isset( $_REQUEST['message'] ) ? $_REQUEST['message'] : '';
1951
- $updated = isset( $_REQUEST['settings-updated'] ) ? $_REQUEST['settings-updated'] : '';
1952
-
1953
- if ( $action == 'save-settings' ) {
1954
-
1955
- if ( $message == 'success' ) {
1956
-
1957
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Settings updated.', 'option-tree' ) . '</p></div>';
1958
-
1959
- } else if ( $message == 'failed' ) {
1960
-
1961
- return '<div id="message" class="error fade below-h2"><p>' . __( 'Settings could not be saved.', 'option-tree' ) . '</p></div>';
1962
-
1963
- }
1964
-
1965
- } else if ( $action == 'import-xml' || $action == 'import-settings' ) {
1966
-
1967
- if ( $message == 'success' ) {
1968
-
1969
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Settings Imported.', 'option-tree' ) . '</p></div>';
1970
-
1971
- } else if ( $message == 'failed' ) {
1972
-
1973
- return '<div id="message" class="error fade below-h2"><p>' . __( 'Settings could not be imported.', 'option-tree' ) . '</p></div>';
1974
-
1975
- }
1976
- } else if ( $action == 'import-data' ) {
1977
-
1978
- if ( $message == 'success' ) {
1979
-
1980
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Data Imported.', 'option-tree' ) . '</p></div>';
1981
-
1982
- } else if ( $message == 'failed' ) {
1983
-
1984
- return '<div id="message" class="error fade below-h2"><p>' . __( 'Data could not be imported.', 'option-tree' ) . '</p></div>';
1985
-
1986
- }
1987
-
1988
- } else if ( $action == 'import-layouts' ) {
1989
-
1990
- if ( $message == 'success' ) {
1991
-
1992
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layouts Imported.', 'option-tree' ) . '</p></div>';
1993
-
1994
- } else if ( $message == 'failed' ) {
1995
-
1996
- return '<div id="message" class="error fade below-h2"><p>' . __( 'Layouts could not be imported.', 'option-tree' ) . '</p></div>';
1997
-
1998
- }
1999
-
2000
- } else if ( $action == 'save-layouts' ) {
2001
-
2002
- if ( $message == 'success' ) {
2003
-
2004
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layouts Updated.', 'option-tree' ) . '</p></div>';
2005
-
2006
- } else if ( $message == 'failed' ) {
2007
-
2008
- return '<div id="message" class="error fade below-h2"><p>' . __( 'Layouts could not be updated.', 'option-tree' ) . '</p></div>';
2009
-
2010
- } else if ( $message == 'deleted' ) {
2011
-
2012
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layouts have been deleted.', 'option-tree' ) . '</p></div>';
2013
-
2014
- }
2015
-
2016
- } else if ( $updated == 'layout' ) {
2017
-
2018
- return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layout activated.', 'option-tree' ) . '</p></div>';
2019
-
2020
- } else if ( $action == 'reset' ) {
2021
-
2022
- return '<div id="message" class="updated fade below-h2"><p>' . $page['reset_message'] . '</p></div>';
2023
-
2024
- }
2025
-
2026
- do_action( 'ot_custom_page_messages' );
2027
-
2028
- if ( $updated == 'true' ) {
2029
-
2030
- return '<div id="message" class="updated fade below-h2"><p>' . $page['updated_message'] . '</p></div>';
2031
-
2032
- }
2033
-
2034
- return false;
2035
-
2036
- }
2037
-
2038
- }
2039
-
2040
- /**
2041
- * Setup the default option types.
2042
- *
2043
- * The returned option types are filterable so you can add your own.
2044
- * This is not a task for a beginner as you'll need to add the function
2045
- * that displays the option to the user and validate the saved data.
2046
- *
2047
- * @return array
2048
- *
2049
- * @access public
2050
- * @since 2.0
2051
- */
2052
- if ( ! function_exists( 'ot_option_types_array' ) ) {
2053
-
2054
- function ot_option_types_array() {
2055
-
2056
- return apply_filters( 'ot_option_types_array', array(
2057
- 'background' => 'Background',
2058
- 'category-checkbox' => 'Category Checkbox',
2059
- 'category-select' => 'Category Select',
2060
- 'checkbox' => 'Checkbox',
2061
- 'colorpicker' => 'Colorpicker',
2062
- 'css' => 'CSS',
2063
- 'custom-post-type-checkbox' => 'Custom Post Type Checkbox',
2064
- 'custom-post-type-select' => 'Custom Post Type Select',
2065
- 'list-item' => 'List Item',
2066
- 'measurement' => 'Measurement',
2067
- 'numeric-slider' => 'Numeric Slider',
2068
- 'page-checkbox' => 'Page Checkbox',
2069
- 'page-select' => 'Page Select',
2070
- 'post-checkbox' => 'Post Checkbox',
2071
- 'post-select' => 'Post Select',
2072
- 'radio' => 'Radio',
2073
- 'radio-image' => 'Radio Image',
2074
- 'select' => 'Select',
2075
- 'sidebar-select' => 'Sidebar Select',
2076
- 'slider' => 'Slider',
2077
- 'tag-checkbox' => 'Tag Checkbox',
2078
- 'tag-select' => 'Tag Select',
2079
- 'taxonomy-checkbox' => 'Taxonomy Checkbox',
2080
- 'taxonomy-select' => 'Taxonomy Select',
2081
- 'text' => 'Text',
2082
- 'textarea' => 'Textarea',
2083
- 'textarea-simple' => 'Textarea Simple',
2084
- 'textblock' => 'Textblock',
2085
- 'textblock-titled' => 'Textblock Titled',
2086
- 'typography' => 'Typography',
2087
- 'upload' => 'Upload'
2088
- ) );
2089
-
2090
- }
2091
- }
2092
-
2093
- /**
2094
- * Map old option types for rebuilding XML and Table data.
2095
- *
2096
- * @param string $type The old option type
2097
- * @return string The new option type
2098
- *
2099
- * @access public
2100
- * @since 2.0
2101
- */
2102
- if ( ! function_exists( 'ot_map_old_option_types' ) ) {
2103
-
2104
- function ot_map_old_option_types( $type = '' ) {
2105
-
2106
- if ( ! $type )
2107
- return 'text';
2108
-
2109
- $types = array(
2110
- 'background' => 'background',
2111
- 'category' => 'category-select',
2112
- 'categories' => 'category-checkbox',
2113
- 'checkbox' => 'checkbox',
2114
- 'colorpicker' => 'colorpicker',
2115
- 'css' => 'css',
2116
- 'custom_post' => 'custom-post-type-select',
2117
- 'custom_posts' => 'custom-post-type-checkbox',
2118
- 'input' => 'text',
2119
- 'image' => 'upload',
2120
- 'measurement' => 'measurement',
2121
- 'page' => 'page-select',
2122
- 'pages' => 'page-checkbox',
2123
- 'post' => 'post-select',
2124
- 'posts' => 'post-checkbox',
2125
- 'radio' => 'radio',
2126
- 'select' => 'select',
2127
- 'slider' => 'slider',
2128
- 'tag' => 'tag-select',
2129
- 'tags' => 'tag-checkbox',
2130
- 'textarea' => 'textarea',
2131
- 'textblock' => 'textblock',
2132
- 'typography' => 'typography',
2133
- 'upload' => 'upload'
2134
- );
2135
-
2136
- if ( isset( $types[$type] ) )
2137
- return $types[$type];
2138
-
2139
- return false;
2140
-
2141
- }
2142
- }
2143
-
2144
- /**
2145
- * Recognized font families
2146
- *
2147
- * Returns an array of all recognized font families.
2148
- * Keys are intended to be stored in the database
2149
- * while values are ready for display in html.
2150
- * Renamed in version 2.0 to avoid name collisions.
2151
- *
2152
- * @uses apply_filters()
2153
- *
2154
- * @return array
2155
- *
2156
- * @access public
2157
- * @since 1.1.8
2158
- * @updated 2.0
2159
- */
2160
- if ( ! function_exists( 'ot_recognized_font_families' ) ) {
2161
-
2162
- function ot_recognized_font_families( $field_id = '' ) {
2163
-
2164
- return apply_filters( 'ot_recognized_font_families', array(
2165
- 'arial' => 'Arial',
2166
- 'georgia' => 'Georgia',
2167
- 'helvetica' => 'Helvetica',
2168
- 'palatino' => 'Palatino',
2169
- 'tahoma' => 'Tahoma',
2170
- 'times' => '"Times New Roman", sans-serif',
2171
- 'trebuchet' => 'Trebuchet',
2172
- 'verdana' => 'Verdana'
2173
- ), $field_id );
2174
-
2175
- }
2176
-
2177
- }
2178
-
2179
- /**
2180
- * Recognized font sizes
2181
- *
2182
- * Returns an array of all recognized font sizes.
2183
- *
2184
- * @uses apply_filters()
2185
- *
2186
- * @param string $field_id ID that's passed to the filters.
2187
- * @return array
2188
- *
2189
- * @access public
2190
- * @since 2.0.12
2191
- */
2192
- if ( ! function_exists( 'ot_recognized_font_sizes' ) ) {
2193
-
2194
- function ot_recognized_font_sizes( $field_id ) {
2195
-
2196
- $range = ot_range(
2197
- apply_filters( 'ot_font_size_low_range', 0, $field_id ),
2198
- apply_filters( 'ot_font_size_high_range', 150, $field_id ),
2199
- apply_filters( 'ot_font_size_range_interval', 1, $field_id )
2200
- );
2201
-
2202
- $unit = apply_filters( 'ot_font_size_unit_type', 'px', $field_id );
2203
-
2204
- foreach( $range as $k => $v ) {
2205
- $range[$k] = $v . $unit;
2206
- }
2207
-
2208
- return $range;
2209
- }
2210
-
2211
- }
2212
-
2213
- /**
2214
- * Recognized font styles
2215
- *
2216
- * Returns an array of all recognized font styles.
2217
- * Renamed in version 2.0 to avoid name collisions.
2218
- *
2219
- * @uses apply_filters()
2220
- *
2221
- * @return array
2222
- *
2223
- * @access public
2224
- * @since 1.1.8
2225
- * @updated 2.0
2226
- */
2227
- if ( ! function_exists( 'ot_recognized_font_styles' ) ) {
2228
-
2229
- function ot_recognized_font_styles( $field_id = '' ) {
2230
-
2231
- return apply_filters( 'ot_recognized_font_styles', array(
2232
- 'normal' => 'Normal',
2233
- 'italic' => 'Italic',
2234
- 'oblique' => 'Oblique',
2235
- 'inherit' => 'Inherit'
2236
- ), $field_id );
2237
-
2238
- }
2239
-
2240
- }
2241
-
2242
- /**
2243
- * Recognized font variants
2244
- *
2245
- * Returns an array of all recognized font variants.
2246
- * Renamed in version 2.0 to avoid name collisions.
2247
- *
2248
- * @uses apply_filters()
2249
- *
2250
- * @return array
2251
- *
2252
- * @access public
2253
- * @since 1.1.8
2254
- * @updated 2.0
2255
- */
2256
- if ( ! function_exists( 'ot_recognized_font_variants' ) ) {
2257
-
2258
- function ot_recognized_font_variants( $field_id = '' ) {
2259
-
2260
- return apply_filters( 'ot_recognized_font_variants', array(
2261
- 'normal' => 'Normal',
2262
- 'small-caps' => 'Small Caps',
2263
- 'inherit' => 'Inherit'
2264
- ), $field_id );
2265
-
2266
- }
2267
-
2268
- }
2269
-
2270
- /**
2271
- * Recognized font weights
2272
- *
2273
- * Returns an array of all recognized font weights.
2274
- * Renamed in version 2.0 to avoid name collisions.
2275
- *
2276
- * @uses apply_filters()
2277
- *
2278
- * @return array
2279
- *
2280
- * @access public
2281
- * @since 1.1.8
2282
- * @updated 2.0
2283
- */
2284
- if ( ! function_exists( 'ot_recognized_font_weights' ) ) {
2285
-
2286
- function ot_recognized_font_weights( $field_id = '' ) {
2287
-
2288
- return apply_filters( 'ot_recognized_font_weights', array(
2289
- 'normal' => 'Normal',
2290
- 'bold' => 'Bold',
2291
- 'bolder' => 'Bolder',
2292
- 'lighter' => 'Lighter',
2293
- '100' => '100',
2294
- '200' => '200',
2295
- '300' => '300',
2296
- '400' => '400',
2297
- '500' => '500',
2298
- '600' => '600',
2299
- '700' => '700',
2300
- '800' => '800',
2301
- '900' => '900',
2302
- 'inherit' => 'Inherit'
2303
- ), $field_id );
2304
-
2305
- }
2306
-
2307
- }
2308
-
2309
- /**
2310
- * Recognized letter spacing
2311
- *
2312
- * Returns an array of all recognized line heights.
2313
- *
2314
- * @uses apply_filters()
2315
- *
2316
- * @param string $field_id ID that's passed to the filters.
2317
- * @return array
2318
- *
2319
- * @access public
2320
- * @since 2.0.12
2321
- */
2322
- if ( ! function_exists( 'ot_recognized_letter_spacing' ) ) {
2323
-
2324
- function ot_recognized_letter_spacing( $field_id ) {
2325
-
2326
- $range = ot_range(
2327
- apply_filters( 'ot_letter_spacing_low_range', -0.1, $field_id ),
2328
- apply_filters( 'ot_letter_spacing_high_range', 0.1, $field_id ),
2329
- apply_filters( 'ot_letter_spacing_range_interval', 0.01, $field_id )
2330
- );
2331
-
2332
- $unit = apply_filters( 'ot_letter_spacing_unit_type', 'em', $field_id );
2333
-
2334
- foreach( $range as $k => $v ) {
2335
- $range[$k] = $v . $unit;
2336
- }
2337
-
2338
- return $range;
2339
- }
2340
-
2341
- }
2342
-
2343
- /**
2344
- * Recognized line heights
2345
- *
2346
- * Returns an array of all recognized line heights.
2347
- *
2348
- * @uses apply_filters()
2349
- *
2350
- * @param string $field_id ID that's passed to the filters.
2351
- * @return array
2352
- *
2353
- * @access public
2354
- * @since 2.0.12
2355
- */
2356
- if ( ! function_exists( 'ot_recognized_line_heights' ) ) {
2357
-
2358
- function ot_recognized_line_heights( $field_id ) {
2359
-
2360
- $range = ot_range(
2361
- apply_filters( 'ot_line_height_low_range', 0, $field_id ),
2362
- apply_filters( 'ot_line_height_high_range', 150, $field_id ),
2363
- apply_filters( 'ot_line_height_unit_type', 1, $field_id )
2364
- );
2365
-
2366
- $unit = apply_filters( 'ot_line_height_unit_type', 'px', $field_id );
2367
-
2368
- foreach( $range as $k => $v ) {
2369
- $range[$k] = $v . $unit;
2370
- }
2371
-
2372
- return $range;
2373
- }
2374
-
2375
- }
2376
-
2377
- /**
2378
- * Recognized text decorations
2379
- *
2380
- * Returns an array of all recognized text decorations.
2381
- * Keys are intended to be stored in the database
2382
- * while values are ready for display in html.
2383
- *
2384
- * @uses apply_filters()
2385
- *
2386
- * @return array
2387
- *
2388
- * @access public
2389
- * @since 2.0.10
2390
- */
2391
- if ( ! function_exists( 'ot_recognized_text_decorations' ) ) {
2392
-
2393
- function ot_recognized_text_decorations( $field_id = '' ) {
2394
-
2395
- return apply_filters( 'ot_recognized_text_decorations', array(
2396
- 'blink' => 'Blink',
2397
- 'inherit' => 'Inherit',
2398
- 'line-through' => 'Line Through',
2399
- 'none' => 'None',
2400
- 'overline' => 'Overline',
2401
- 'underline' => 'Underline'
2402
- ), $field_id );
2403
-
2404
- }
2405
-
2406
- }
2407
-
2408
- /**
2409
- * Recognized text transformations
2410
- *
2411
- * Returns an array of all recognized text transformations.
2412
- * Keys are intended to be stored in the database
2413
- * while values are ready for display in html.
2414
- *
2415
- * @uses apply_filters()
2416
- *
2417
- * @return array
2418
- *
2419
- * @access public
2420
- * @since 2.0.10
2421
- */
2422
- if ( ! function_exists( 'ot_recognized_text_transformations' ) ) {
2423
-
2424
- function ot_recognized_text_transformations( $field_id = '' ) {
2425
-
2426
- return apply_filters( 'ot_recognized_text_transformations', array(
2427
- 'capitalize' => 'Capitalize',
2428
- 'inherit' => 'Inherit',
2429
- 'lowercase' => 'Lowercase',
2430
- 'none' => 'None',
2431
- 'uppercase' => 'Uppercase'
2432
- ), $field_id );
2433
-
2434
- }
2435
-
2436
- }
2437
-
2438
- /**
2439
- * Recognized background repeat
2440
- *
2441
- * Returns an array of all recognized background repeat values.
2442
- * Renamed in version 2.0 to avoid name collisions.
2443
- *
2444
- * @uses apply_filters()
2445
- *
2446
- * @return array
2447
- *
2448
- * @access public
2449
- * @since 1.1.8
2450
- * @updated 2.0
2451
- */
2452
- if ( ! function_exists( 'ot_recognized_background_repeat' ) ) {
2453
-
2454
- function ot_recognized_background_repeat( $field_id = '' ) {
2455
-
2456
- return apply_filters( 'ot_recognized_background_repeat', array(
2457
- 'no-repeat' => 'No Repeat',
2458
- 'repeat' => 'Repeat All',
2459
- 'repeat-x' => 'Repeat Horizontally',
2460
- 'repeat-y' => 'Repeat Vertically',
2461
- 'inherit' => 'Inherit'
2462
- ), $field_id );
2463
-
2464
- }
2465
-
2466
- }
2467
-
2468
- /**
2469
- * Recognized background attachment
2470
- *
2471
- * Returns an array of all recognized background attachment values.
2472
- * Renamed in version 2.0 to avoid name collisions.
2473
- *
2474
- * @uses apply_filters()
2475
- *
2476
- * @return array
2477
- *
2478
- * @access public
2479
- * @since 1.1.8
2480
- * @updated 2.0
2481
- */
2482
- if ( ! function_exists( 'ot_recognized_background_attachment' ) ) {
2483
-
2484
- function ot_recognized_background_attachment( $field_id = '' ) {
2485
-
2486
- return apply_filters( 'ot_recognized_background_attachment', array(
2487
- "fixed" => "Fixed",
2488
- "scroll" => "Scroll",
2489
- "inherit" => "Inherit"
2490
- ), $field_id );
2491
-
2492
- }
2493
-
2494
- }
2495
-
2496
- /**
2497
- * Recognized background position
2498
- *
2499
- * Returns an array of all recognized background position values.
2500
- * Renamed in version 2.0 to avoid name collisions.
2501
- *
2502
- * @uses apply_filters()
2503
- *
2504
- * @return array
2505
- *
2506
- * @access public
2507
- * @since 1.1.8
2508
- * @updated 2.0
2509
- */
2510
- if ( ! function_exists( 'ot_recognized_background_position' ) ) {
2511
-
2512
- function ot_recognized_background_position( $field_id = '' ) {
2513
-
2514
- return apply_filters( 'ot_recognized_background_position', array(
2515
- "left top" => "Left Top",
2516
- "left center" => "Left Center",
2517
- "left bottom" => "Left Bottom",
2518
- "center top" => "Center Top",
2519
- "center center" => "Center Center",
2520
- "center bottom" => "Center Bottom",
2521
- "right top" => "Right Top",
2522
- "right center" => "Right Center",
2523
- "right bottom" => "Right Bottom"
2524
- ), $field_id );
2525
-
2526
- }
2527
-
2528
- }
2529
-
2530
- /**
2531
- * Measurement Units
2532
- *
2533
- * Returns an array of all available unit types.
2534
- * Renamed in version 2.0 to avoid name collisions.
2535
- *
2536
- * @uses apply_filters()
2537
- *
2538
- * @return array
2539
- *
2540
- * @access public
2541
- * @since 1.1.8
2542
- * @updated 2.0
2543
- */
2544
- if ( ! function_exists( 'ot_measurement_unit_types' ) ) {
2545
-
2546
- function ot_measurement_unit_types( $field_id = '' ) {
2547
-
2548
- return apply_filters( 'ot_measurement_unit_types', array(
2549
- 'px' => 'px',
2550
- '%' => '%',
2551
- 'em' => 'em',
2552
- 'pt' => 'pt'
2553
- ), $field_id );
2554
-
2555
- }
2556
-
2557
- }
2558
-
2559
- /**
2560
- * Radio Images default array.
2561
- *
2562
- * Returns an array of all available radio images.
2563
- * You can filter this function to change the images
2564
- * on a per option basis.
2565
- *
2566
- * @uses apply_filters()
2567
- *
2568
- * @return array
2569
- *
2570
- * @access public
2571
- * @since 2.0
2572
- */
2573
- if ( ! function_exists( 'ot_radio_images' ) ) {
2574
-
2575
- function ot_radio_images( $field_id = '' ) {
2576
-
2577
- return apply_filters( 'ot_radio_images', array(
2578
- array(
2579
- 'value' => 'left-sidebar',
2580
- 'label' => __( 'Left Sidebar', 'option-tree' ),
2581
- 'src' => OT_URL . 'assets/images/layout/left-sidebar.png'
2582
- ),
2583
- array(
2584
- 'value' => 'right-sidebar',
2585
- 'label' => __( 'Right Sidebar', 'option-tree' ),
2586
- 'src' => OT_URL . 'assets/images/layout/right-sidebar.png'
2587
- ),
2588
- array(
2589
- 'value' => 'full-width',
2590
- 'label' => __( 'Full Width (no sidebar)', 'option-tree' ),
2591
- 'src' => OT_URL . 'assets/images/layout/full-width.png'
2592
- ),
2593
- array(
2594
- 'value' => 'dual-sidebar',
2595
- 'label' => __( 'Dual Sidebar', 'option-tree' ),
2596
- 'src' => OT_URL . 'assets/images/layout/dual-sidebar.png'
2597
- ),
2598
- array(
2599
- 'value' => 'left-dual-sidebar',
2600
- 'label' => __( 'Left Dual Sidebar', 'option-tree' ),
2601
- 'src' => OT_URL . 'assets/images/layout/left-dual-sidebar.png'
2602
- ),
2603
- array(
2604
- 'value' => 'right-dual-sidebar',
2605
- 'label' => __( 'Right Dual Sidebar', 'option-tree' ),
2606
- 'src' => OT_URL . 'assets/images/layout/right-dual-sidebar.png'
2607
- )
2608
- ), $field_id );
2609
-
2610
- }
2611
-
2612
- }
2613
-
2614
- /**
2615
- * Default List Item Settings array.
2616
- *
2617
- * Returns an array of the default list item settings.
2618
- * You can filter this function to change the settings
2619
- * on a per option basis.
2620
- *
2621
- * @uses apply_filters()
2622
- *
2623
- * @return array
2624
- *
2625
- * @access public
2626
- * @since 2.0
2627
- */
2628
- if ( ! function_exists( 'ot_list_item_settings' ) ) {
2629
-
2630
- function ot_list_item_settings( $id ) {
2631
-
2632
- $settings = apply_filters( 'ot_list_item_settings', array(
2633
- array(
2634
- 'id' => 'image',
2635
- 'label' => __( 'Image', 'option-tree' ),
2636
- 'desc' => '',
2637
- 'std' => '',
2638
- 'type' => 'upload',
2639
- 'rows' => '',
2640
- 'class' => '',
2641
- 'post_type' => '',
2642
- 'choices' => array()
2643
- ),
2644
- array(
2645
- 'id' => 'link',
2646
- 'label' => __( 'Link', 'option-tree' ),
2647
- 'desc' => '',
2648
- 'std' => '',
2649
- 'type' => 'text',
2650
- 'rows' => '',
2651
- 'class' => '',
2652
- 'post_type' => '',
2653
- 'choices' => array()
2654
- ),
2655
- array(
2656
- 'id' => 'description',
2657
- 'label' => __( 'Description', 'option-tree' ),
2658
- 'desc' => '',
2659
- 'std' => '',
2660
- 'type' => 'textarea-simple',
2661
- 'rows' => 10,
2662
- 'class' => '',
2663
- 'post_type' => '',
2664
- 'choices' => array()
2665
- )
2666
- ), $id );
2667
-
2668
- return $settings;
2669
-
2670
- }
2671
-
2672
- }
2673
-
2674
- /**
2675
- * Default Slider Settings array.
2676
- *
2677
- * Returns an array of the default slider settings.
2678
- * You can filter this function to change the settings
2679
- * on a per option basis.
2680
- *
2681
- * @uses apply_filters()
2682
- *
2683
- * @return array
2684
- *
2685
- * @access public
2686
- * @since 2.0
2687
- */
2688
- if ( ! function_exists( 'ot_slider_settings' ) ) {
2689
-
2690
- function ot_slider_settings( $id ) {
2691
-
2692
- $settings = apply_filters( 'image_slider_fields', array(
2693
- array(
2694
- 'name' => 'image',
2695
- 'type' => 'image',
2696
- 'label' => __( 'Image', 'option-tree' ),
2697
- 'class' => ''
2698
- ),
2699
- array(
2700
- 'name' => 'link',
2701
- 'type' => 'text',
2702
- 'label' => __( 'Link', 'option-tree' ),
2703
- 'class' => ''
2704
- ),
2705
- array(
2706
- 'name' => 'description',
2707
- 'type' => 'textarea',
2708
- 'label' => __( 'Description', 'option-tree' ),
2709
- 'class' => ''
2710
- )
2711
- ), $id );
2712
-
2713
- /* fix the array keys, values, and just get it 2.0 ready */
2714
- foreach( $settings as $_k => $setting ) {
2715
-
2716
- foreach( $setting as $s_key => $s_value ) {
2717
-
2718
- if ( 'name' == $s_key ) {
2719
-
2720
- $settings[$_k]['id'] = $s_value;
2721
- unset($settings[$_k]['name']);
2722
-
2723
- } else if ( 'type' == $s_key ) {
2724
-
2725
- if ( 'input' == $s_value ) {
2726
-
2727
- $settings[$_k]['type'] = 'text';
2728
-
2729
- } else if ( 'textarea' == $s_value ) {
2730
-
2731
- $settings[$_k]['type'] = 'textarea-simple';
2732
-
2733
- } else if ( 'image' == $s_value ) {
2734
-
2735
- $settings[$_k]['type'] = 'upload';
2736
-
2737
- }
2738
-
2739
- }
2740
-
2741
- }
2742
-
2743
- }
2744
-
2745
- return $settings;
2746
-
2747
- }
2748
-
2749
- }
2750
-
2751
- /**
2752
- * Inserts CSS with field_id markers.
2753
- *
2754
- * Inserts CSS into a dynamic.css file, placing it between
2755
- * BEGIN and END field_id markers. Replaces existing marked info,
2756
- * but still retains surrounding data.
2757
- *
2758
- * @param string $field_id The CSS option field ID.
2759
- * @param array $options The current option_tree array.
2760
- * @return bool True on write success, false on failure.
2761
- *
2762
- * @access public
2763
- * @since 1.1.8
2764
- * @updated 2.0.12
2765
- */
2766
- if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
2767
-
2768
- function ot_insert_css_with_markers( $field_id = '', $insertion = '', $meta = false ) {
2769
-
2770
- /* missing $field_id or $insertion exit early */
2771
- if ( '' == $field_id || '' == $insertion )
2772
- return;
2773
-
2774
- /* path to the dynamic.css file */
2775
- $filepath = get_stylesheet_directory() . '/dynamic.css';
2776
-
2777
- /* allow filter on path */
2778
- $filepath = apply_filters( 'css_option_file_path', $filepath, $field_id );
2779
-
2780
- /* grab a copy of the paths array */
2781
- $ot_css_file_paths = get_option( 'ot_css_file_paths', array() );
2782
-
2783
- /* set the path for this field */
2784
- $ot_css_file_paths[$field_id] = $filepath;
2785
-
2786
- /* update the paths */
2787
- update_option( 'ot_css_file_paths', $ot_css_file_paths );
2788
-
2789
- /* insert CSS into file */
2790
- if ( file_exists( $filepath ) ) {
2791
-
2792
- $insertion = ot_normalize_css( $insertion );
2793
- $regex = "/{{([a-zA-Z0-9\_\-\#\|\=]+)}}/";
2794
- $marker = $field_id;
2795
-
2796
- /* Match custom CSS */
2797
- preg_match_all( $regex, $insertion, $matches );
2798
-
2799
- /* Loop through CSS */
2800
- foreach( $matches[0] as $option ) {
2801
-
2802
- $value = '';
2803
- $option_id = str_replace( array( '{{', '}}' ), '', $option );
2804
- $option_array = explode( '|', $option_id );
2805
-
2806
- /* get the array value */
2807
- if ( $meta ) {
2808
- global $post;
2809
-
2810
- $value = get_post_meta( $post->ID, $option_array[0], true );
2811
-
2812
- } else {
2813
-
2814
- $options = get_option( 'option_tree' );
2815
-
2816
- if ( isset( $options[$option_array[0]] ) ) {
2817
-
2818
- $value = $options[$option_array[0]];
2819
-
2820
- }
2821
-
2822
- }
2823
-
2824
- if ( is_array( $value ) ) {
2825
-
2826
- if ( ! isset( $option_array[1] ) ) {
2827
-
2828
- /* Measurement */
2829
- if ( isset( $value[0] ) && isset( $value[1] ) ) {
2830
-
2831
- /* set $value with measurement properties */
2832
- $value = $value[0].$value[1];
2833
-
2834
- /* typography */
2835
- } else if ( ot_array_keys_exists( $value, array( 'font-color', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-decoration', 'text-transform' ) ) ) {
2836
- $font = array();
2837
-
2838
- if ( ! empty( $value['font-color'] ) )
2839
- $font[] = "color: " . $value['font-color'] . ";";
2840
-
2841
- if ( ! empty( $value['font-family'] ) ) {
2842
- foreach ( ot_recognized_font_families( $marker ) as $key => $v ) {
2843
- if ( $key == $value['font-family'] ) {
2844
- $font[] = "font-family: " . $v . ";";
2845
- }
2846
- }
2847
- }
2848
-
2849
- if ( ! empty( $value['font-size'] ) )
2850
- $font[] = "font-size: " . $value['font-size'] . ";";
2851
-
2852
- if ( ! empty( $value['font-style'] ) )
2853
- $font[] = "font-style: " . $value['font-style'] . ";";
2854
-
2855
- if ( ! empty( $value['font-variant'] ) )
2856
- $font[] = "font-variant: " . $value['font-variant'] . ";";
2857
-
2858
- if ( ! empty( $value['font-weight'] ) )
2859
- $font[] = "font-weight: " . $value['font-weight'] . ";";
2860
-
2861
- if ( ! empty( $value['letter-spacing'] ) )
2862
- $font[] = "letter-spacing: " . $value['letter-spacing'] . ";";
2863
-
2864
- if ( ! empty( $value['line-height'] ) )
2865
- $font[] = "line-height: " . $value['line-height'] . ";";
2866
-
2867
- if ( ! empty( $value['text-decoration'] ) )
2868
- $font[] = "text-decoration: " . $value['text-decoration'] . ";";
2869
-
2870
- if ( ! empty( $value['text-transform'] ) )
2871
- $font[] = "text-transform: " . $value['text-transform'] . ";";
2872
-
2873
- /* set $value with font properties or empty string */
2874
- $value = ! empty( $font ) ? implode( "\n", $font ) : '';
2875
-
2876
- /* background */
2877
- } else if ( ot_array_keys_exists( $value, array( 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position' ) ) ) {
2878
- $bg = array();
2879
-
2880
- if ( ! empty( $value['background-color'] ) )
2881
- $bg[] = $value['background-color'];
2882
-
2883
- if ( ! empty( $value['background-image'] ) )
2884
- $bg[] = 'url("' . $value['background-image'] . '")';
2885
-
2886
- if ( ! empty( $value['background-repeat'] ) )
2887
- $bg[] = $value['background-repeat'];
2888
-
2889
- if ( ! empty( $value['background-attachment'] ) )
2890
- $bg[] = $value['background-attachment'];
2891
-
2892
- if ( ! empty( $value['background-position'] ) )
2893
- $bg[] = $value['background-position'];
2894
-
2895
- /* set $value with background properties or empty string */
2896
- $value = ! empty( $bg ) ? 'background: ' . implode( " ", $bg ) . ';' : '';
2897
- }
2898
-
2899
- } else {
2900
-
2901
- $value = $value[$option_array[1]];
2902
-
2903
- }
2904
-
2905
- }
2906
-
2907
- // Filter the CSS
2908
- $value = apply_filters( 'ot_insert_css_with_markers_value', $value, $option_id );
2909
-
2910
- /* insert CSS, even if the value is empty */
2911
- $insertion = stripslashes( str_replace( $option, $value, $insertion ) );
2912
-
2913
- }
2914
-
2915
- /* create array from the lines of code */
2916
- $markerdata = explode( "\n", implode( '', file( $filepath ) ) );
2917
-
2918
- /* can't write to the file return false */
2919
- if ( ! $f = ot_file_open( $filepath, 'w' ) )
2920
- return false;
2921
-
2922
- $searching = true;
2923
- $foundit = false;
2924
-
2925
- /* has array of lines */
2926
- if ( ! empty( $markerdata ) ) {
2927
-
2928
- /* foreach line of code */
2929
- foreach( $markerdata as $n => $markerline ) {
2930
-
2931
- /* found begining of marker, set $searching to false */
2932
- if ( $markerline == "/* BEGIN {$marker} */" )
2933
- $searching = false;
2934
-
2935
- /* keep rewrite each line of CSS */
2936
- if ( $searching == true ) {
2937
- if ( $n + 1 < count( $markerdata ) )
2938
- ot_file_write( $f, "{$markerline}\n" );
2939
- else
2940
- ot_file_write( $f, "{$markerline}" );
2941
- }
2942
-
2943
- /* found end marker write code */
2944
- if ( $markerline == "/* END {$marker} */" ) {
2945
- ot_file_write( $f, "/* BEGIN {$marker} */\n" );
2946
- ot_file_write( $f, "{$insertion}\n" );
2947
- ot_file_write( $f, "/* END {$marker} */\n" );
2948
- $searching = true;
2949
- $foundit = true;
2950
- }
2951
-
2952
- }
2953
-
2954
- }
2955
-
2956
- /* nothing inserted, write code. DO IT, DO IT! */
2957
- if ( ! $foundit ) {
2958
- ot_file_write( $f, "/* BEGIN {$marker} */\n" );
2959
- ot_file_write( $f, "{$insertion}\n" );
2960
- ot_file_write( $f, "/* END {$marker} */\n" );
2961
- }
2962
-
2963
- /* close file */
2964
- ot_file_close( $f );
2965
- return true;
2966
- }
2967
-
2968
- return false;
2969
-
2970
- }
2971
-
2972
- }
2973
-
2974
- /**
2975
- * Remove old CSS.
2976
- *
2977
- * Removes CSS when the textarea is empty, but still retains surrounding styles.
2978
- *
2979
- * @param string $field_id The CSS option field ID.
2980
- * @return bool True on write success, false on failure.
2981
- *
2982
- * @access public
2983
- * @since 2.0
2984
- */
2985
- if ( ! function_exists( 'ot_remove_old_css' ) ) {
2986
-
2987
- function ot_remove_old_css( $field_id = '' ) {
2988
-
2989
- /* missing $field_id string */
2990
- if ( '' == $field_id )
2991
- return false;
2992
-
2993
- /* path to the dynamic.css file */
2994
- $filepath = get_stylesheet_directory() . '/dynamic.css';
2995
-
2996
- /* allow filter on path */
2997
- $filepath = apply_filters( 'css_option_file_path', $filepath, $field_id );
2998
-
2999
- /* remove CSS from file */
3000
- if ( is_writeable( $filepath ) ) {
3001
-
3002
- /* get each line in the file */
3003
- $markerdata = explode( "\n", implode( '', file( $filepath ) ) );
3004
-
3005
- /* can't write to the file return false */
3006
- if ( ! $f = ot_file_open( $filepath, 'w' ) )
3007
- return false;
3008
-
3009
- $searching = true;
3010
-
3011
- /* has array of lines */
3012
- if ( ! empty( $markerdata ) ) {
3013
-
3014
- /* foreach line of code */
3015
- foreach ( $markerdata as $n => $markerline ) {
3016
-
3017
- /* found begining of marker, set $searching to false */
3018
- if ( $markerline == "/* BEGIN {$field_id} */" )
3019
- $searching = false;
3020
-
3021
- /* $searching is true, keep rewrite each line of CSS */
3022
- if ( $searching == true ) {
3023
- if ( $n + 1 < count( $markerdata ) )
3024
- ot_file_write( $f, "{$markerline}\n" );
3025
- else
3026
- ot_file_write( $f, "{$markerline}" );
3027
- }
3028
-
3029
- /* found end marker delete old CSS */
3030
- if ( $markerline == "/* END {$field_id} */" ) {
3031
- ot_file_write( $f, "" );
3032
- $searching = true;
3033
- }
3034
-
3035
- }
3036
-
3037
- }
3038
-
3039
- /* close file */
3040
- ot_file_close( $f );
3041
- return true;
3042
-
3043
- }
3044
-
3045
- return false;
3046
-
3047
- }
3048
-
3049
- }
3050
-
3051
- /**
3052
- * Normalize CSS
3053
- *
3054
- * Normalize & Convert all line-endings to UNIX format.
3055
- *
3056
- * @param string $css
3057
- * @return string
3058
- *
3059
- * @access public
3060
- * @since 1.1.8
3061
- * @updated 2.0
3062
- */
3063
- if ( ! function_exists( 'ot_normalize_css' ) ) {
3064
-
3065
- function ot_normalize_css( $css ) {
3066
-
3067
- /* Normalize & Convert */
3068
- $css = str_replace( "\r\n", "\n", $css );
3069
- $css = str_replace( "\r", "\n", $css );
3070
-
3071
- /* Don't allow out-of-control blank lines */
3072
- $css = preg_replace( "/\n{2,}/", "\n\n", $css );
3073
-
3074
- return $css;
3075
- }
3076
-
3077
- }
3078
-
3079
- /**
3080
- * Helper function to loop over the option types.
3081
- *
3082
- * @param array $type The current option type.
3083
- *
3084
- * @return string
3085
- *
3086
- * @access public
3087
- * @since 2.0
3088
- */
3089
- if ( ! function_exists( 'ot_loop_through_option_types' ) ) {
3090
-
3091
- function ot_loop_through_option_types( $type = '', $child = false ) {
3092
-
3093
- $content = '';
3094
- $types = ot_option_types_array();
3095
-
3096
- if ( $child )
3097
- unset($types['list-item']);
3098
-
3099
- foreach( $types as $key => $value )
3100
- $content.= '<option value="' . $key . '" ' . selected( $type, $key, false ) . '>' . $value . '</option>';
3101
-
3102
- return $content;
3103
-
3104
- }
3105
-
3106
- }
3107
-
3108
- /**
3109
- * Helper function to loop over choices.
3110
- *
3111
- * @param string $name The form element name.
3112
- * @param array $choices The array of choices.
3113
- *
3114
- * @return string
3115
- *
3116
- * @access public
3117
- * @since 2.0
3118
- */
3119
- if ( ! function_exists( 'ot_loop_through_choices' ) ) {
3120
-
3121
- function ot_loop_through_choices( $name, $choices = array() ) {
3122
-
3123
- $content = '';
3124
-
3125
- foreach( $choices as $key => $choice )
3126
- $content.= '<li class="ui-state-default list-choice">' . ot_choices_view( $name, $key, $choice ) . '</li>';
3127
-
3128
- return $content;
3129
- }
3130
-
3131
- }
3132
-
3133
- /**
3134
- * Helper function to loop over sub settings.
3135
- *
3136
- * @param string $name The form element name.
3137
- * @param array $settings The array of settings.
3138
- *
3139
- * @return string
3140
- *
3141
- * @access public
3142
- * @since 2.0
3143
- */
3144
- if ( ! function_exists( 'ot_loop_through_sub_settings' ) ) {
3145
-
3146
- function ot_loop_through_sub_settings( $name, $settings = array() ) {
3147
-
3148
- $content = '';
3149
-
3150
- foreach( $settings as $key => $setting )
3151
- $content.= '<li class="ui-state-default list-sub-setting">' . ot_settings_view( $name, $key, $setting ) . '</li>';
3152
-
3153
- return $content;
3154
- }
3155
-
3156
- }
3157
-
3158
- /**
3159
- * Helper function to display sections.
3160
- *
3161
- * This function is used in AJAX to add a new section
3162
- * and when section have already been added and saved.
3163
- *
3164
- * @param int $key The array key for the current element.
3165
- * @param array An array of values for the current section.
3166
- *
3167
- * @return void
3168
- *
3169
- * @access public
3170
- * @since 2.0
3171
- */
3172
- if ( ! function_exists( 'ot_sections_view' ) ) {
3173
-
3174
- function ot_sections_view( $name, $key, $section = array() ) {
3175
-
3176
- return '
3177
- <div class="option-tree-setting is-section">
3178
- <div class="open">' . ( isset( $section['title'] ) ? esc_attr( $section['title'] ) : 'Section ' . ( $key + 1 ) ) . '</div>
3179
- <div class="button-section">
3180
- <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'edit', 'option-tree' ) . '">
3181
- <span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
3182
- </a>
3183
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="' . __( 'Delete', 'option-tree' ) . '">
3184
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3185
- </a>
3186
- </div>
3187
- <div class="option-tree-setting-body">
3188
- <div class="format-settings">
3189
- <div class="format-setting type-text">
3190
- <div class="description">' . __( '<strong>Section Title</strong>: Displayed as a menu item on the Theme Options page.', 'option-tree' ) . '</div>
3191
- <div class="format-setting-inner">
3192
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][title]" value="' . ( isset( $section['title'] ) ? esc_attr( $section['title'] ) : '' ) . '" class="widefat option-tree-ui-input option-tree-setting-title section-title" autocomplete="off" />
3193
- </div>
3194
- </div>
3195
- </div>
3196
- <div class="format-settings">
3197
- <div class="format-setting type-text">
3198
- <div class="description">' . __( '<strong>Section ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
3199
- <div class="format-setting-inner">
3200
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][id]" value="' . ( isset( $section['id'] ) ? esc_attr( $section['id'] ) : '' ) . '" class="widefat option-tree-ui-input section-id" autocomplete="off" />
3201
- </div>
3202
- </div>
3203
- </div>
3204
- </div>
3205
- </div>';
3206
-
3207
- }
3208
-
3209
- }
3210
-
3211
- /**
3212
- * Helper function to display settings.
3213
- *
3214
- * This function is used in AJAX to add a new setting
3215
- * and when settings have already been added and saved.
3216
- *
3217
- * @param int $key The array key for the current element.
3218
- * @param array An array of values for the current section.
3219
- *
3220
- * @return void
3221
- *
3222
- * @access public
3223
- * @since 2.0
3224
- */
3225
- if ( ! function_exists( 'ot_settings_view' ) ) {
3226
-
3227
- function ot_settings_view( $name, $key, $setting = array() ) {
3228
-
3229
- $child = ( strpos( $name, '][settings]') !== false ) ? true : false;
3230
- $type = isset( $setting['type'] ) ? $setting['type'] : '';
3231
- $std = isset( $setting['std'] ) ? $setting['std'] : '';
3232
-
3233
- // Serialize the standard value just incase
3234
- if ( is_array( $std ) ) {
3235
- $std = maybe_serialize( $std );
3236
- }
3237
-
3238
- if ( in_array( $type, array( 'textarea', 'textarea-simple', 'css' ) ) ) {
3239
- $std_form_element = '<textarea class="textarea" rows="10" cols="40" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][std]">' . esc_html( $std ) . '</textarea>';
3240
- } else {
3241
- $std_form_element = '<input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][std]" value="' . esc_attr( $std ) . '" class="widefat option-tree-ui-input" autocomplete="off" />';
3242
- }
3243
-
3244
- return '
3245
- <div class="option-tree-setting">
3246
- <div class="open">' . ( isset( $setting['label'] ) ? esc_attr( $setting['label'] ) : 'Setting ' . ( $key + 1 ) ) . '</div>
3247
- <div class="button-section">
3248
- <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
3249
- <span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
3250
- </a>
3251
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="' . __( 'Delete', 'option-tree' ) . '">
3252
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3253
- </a>
3254
- </div>
3255
- <div class="option-tree-setting-body">
3256
- <div class="format-settings">
3257
- <div class="format-setting type-text wide-desc">
3258
- <div class="description">' . __( '<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree' ) . '</div>
3259
- <div class="format-setting-inner">
3260
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][label]" value="' . ( isset( $setting['label'] ) ? esc_attr( $setting['label'] ) : '' ) . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
3261
- </div>
3262
- </div>
3263
- </div>
3264
- <div class="format-settings">
3265
- <div class="format-setting type-text wide-desc">
3266
- <div class="description">' . __( '<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
3267
- <div class="format-setting-inner">
3268
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][id]" value="' . ( isset( $setting['id'] ) ? esc_attr( $setting['id'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3269
- </div>
3270
- </div>
3271
- </div>
3272
- <div class="format-settings">
3273
- <div class="format-setting type-select wide-desc">
3274
- <div class="description">' . __( '<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree' ) . '</div>
3275
- <div class="format-setting-inner">
3276
- <select name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][type]" value="' . esc_attr( $type ) . '" class="option-tree-ui-select">
3277
- ' . ot_loop_through_option_types( $type, $child ) . '
3278
-
3279
- </select>
3280
- </div>
3281
- </div>
3282
- </div>
3283
- <div class="format-settings">
3284
- <div class="format-setting type-textarea wide-desc">
3285
- <div class="description">' . __( '<strong>Description</strong>: Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree' ) . '</div>
3286
- <div class="format-setting-inner">
3287
- <textarea class="textarea" rows="10" cols="40" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][desc]">' . ( isset( $setting['desc'] ) ? esc_html( $setting['desc'] ) : '' ) . '</textarea>
3288
- </div>
3289
- </div>
3290
- </div>
3291
- <div class="format-settings">
3292
- <div class="format-setting type-textblock wide-desc">
3293
- <div class="description">' . __( '<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree' ) . '</div>
3294
- <div class="format-setting-inner">
3295
- <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . ']">
3296
- ' . ( isset( $setting['choices'] ) ? ot_loop_through_choices( $name . '[' . $key . ']', $setting['choices'] ) : '' ) . '
3297
- </ul>
3298
- <a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button hug-left">' . __( 'Add Choice', 'option-tree' ) . '</a>
3299
- </div>
3300
- </div>
3301
- </div>
3302
- <div class="format-settings">
3303
- <div class="format-setting type-textblock wide-desc">
3304
- <div class="description">' . __( '<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree' ) . '</div>
3305
- <div class="format-setting-inner">
3306
- <ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . ']">
3307
- ' . ( isset( $setting['settings'] ) ? ot_loop_through_sub_settings( $name . '[' . $key . '][settings]', $setting['settings'] ) : '' ) . '
3308
- </ul>
3309
- <a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button hug-left">' . __( 'Add Setting', 'option-tree' ) . '</a>
3310
- </div>
3311
- </div>
3312
- </div>
3313
- <div class="format-settings">
3314
- <div class="format-setting type-text wide-desc">
3315
- <div class="description">' . __( '<strong>Standard</strong>: Setting the standard value for your option only works for some option types. Read the <code>OptionTree->Documentation</code> for more information on which ones.', 'option-tree' ) . '</div>
3316
- <div class="format-setting-inner">
3317
- ' . $std_form_element . '
3318
- </div>
3319
- </div>
3320
- </div>
3321
- <div class="format-settings">
3322
- <div class="format-setting type-text wide-desc">
3323
- <div class="description">' . __( '<strong>Rows</strong>: Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree' ) . '</div>
3324
- <div class="format-setting-inner">
3325
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][rows]" value="' . ( isset( $setting['rows'] ) ? esc_attr( $setting['rows'] ) : '' ) . '" class="widefat option-tree-ui-input" />
3326
- </div>
3327
- </div>
3328
- </div>
3329
- <div class="format-settings">
3330
- <div class="format-setting type-text wide-desc">
3331
- <div class="description">' . __( '<strong>Post Type</strong>: Add a comma separated list of post type like \'post,page\'. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select.', 'option-tree' ) . '</div>
3332
- <div class="format-setting-inner">
3333
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][post_type]" value="' . ( isset( $setting['post_type'] ) ? esc_attr( $setting['post_type'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3334
- </div>
3335
- </div>
3336
- </div>
3337
- <div class="format-settings">
3338
- <div class="format-setting type-text wide-desc">
3339
- <div class="description">' . __( '<strong>Taxonomy</strong>: Add a comma separated list of any registered taxonomy like \'category,post_tag\'. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree' ) . '</div>
3340
- <div class="format-setting-inner">
3341
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][taxonomy]" value="' . ( isset( $setting['taxonomy'] ) ? esc_attr( $setting['taxonomy'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3342
- </div>
3343
- </div>
3344
- </div>
3345
- <div class="format-settings">
3346
- <div class="format-setting type-text wide-desc">
3347
- <div class="description">' . __( '<strong>Min, Max, & Step</strong>: Add a comma separated list of options in the following format <code>0,100,1</code> (slide from <code>0-100</code> in intervals of <code>1</code>). The three values represent the minimum, maximum, and step options and will only affect the Numeric Slider option type.', 'option-tree' ) . '</div>
3348
- <div class="format-setting-inner">
3349
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][min_max_step]" value="' . ( isset( $setting['min_max_step'] ) ? esc_attr( $setting['min_max_step'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3350
- </div>
3351
- </div>
3352
- </div>
3353
- <div class="format-settings">
3354
- <div class="format-setting type-text wide-desc">
3355
- <div class="description">' . __( '<strong>CSS Class</strong>: Add and optional class to this option type.', 'option-tree' ) . '</div>
3356
- <div class="format-setting-inner">
3357
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][class]" value="' . ( isset( $setting['class'] ) ? esc_attr( $setting['class'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3358
- </div>
3359
- </div>
3360
- </div>
3361
- </div>
3362
- </div>
3363
- ' . ( ! $child ? '<input type="hidden" class="hidden-section" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][section]" value="' . ( isset( $setting['section'] ) ? esc_attr( $setting['section'] ) : '' ) . '" />' : '' );
3364
-
3365
- }
3366
-
3367
- }
3368
-
3369
- /**
3370
- * Helper function to display setting choices.
3371
- *
3372
- * This function is used in AJAX to add a new choice
3373
- * and when choices have already been added and saved.
3374
- *
3375
- * @param string $name The form element name.
3376
- * @param array $key The array key for the current element.
3377
- * @param array An array of values for the current choice.
3378
- *
3379
- * @return void
3380
- *
3381
- * @access public
3382
- * @since 2.0
3383
- */
3384
- if ( ! function_exists( 'ot_choices_view' ) ) {
3385
-
3386
- function ot_choices_view( $name, $key, $choice = array() ) {
3387
-
3388
- return '
3389
- <div class="option-tree-setting">
3390
- <div class="open">' . ( isset( $choice['label'] ) ? esc_attr( $choice['label'] ) : 'Choice ' . ( $key + 1 ) ) . '</div>
3391
- <div class="button-section">
3392
- <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
3393
- <span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
3394
- </a>
3395
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="' . __( 'Delete', 'option-tree' ) . '">
3396
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3397
- </a>
3398
- </div>
3399
- <div class="option-tree-setting-body">
3400
- <div class="format-settings">
3401
- <div class="format-setting-label">
3402
- <h5>' . __( 'Label', 'option-tree' ) . '</h5>
3403
- </div>
3404
- <div class="format-setting type-text wide-desc">
3405
- <div class="format-setting-inner">
3406
- <input type="text" name="' . esc_attr( $name ) . '[choices][' . esc_attr( $key ) . '][label]" value="' . ( isset( $choice['label'] ) ? esc_attr( $choice['label'] ) : '' ) . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
3407
- </div>
3408
- </div>
3409
- </div>
3410
- <div class="format-settings">
3411
- <div class="format-setting-label">
3412
- <h5>' . __( 'Value', 'option-tree' ) . '</h5>
3413
- </div>
3414
- <div class="format-setting type-text wide-desc">
3415
- <div class="format-setting-inner">
3416
- <input type="text" name="' . esc_attr( $name ) . '[choices][' . esc_attr( $key ) . '][value]" value="' . ( isset( $choice['value'] ) ? esc_attr( $choice['value'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3417
- </div>
3418
- </div>
3419
- </div>
3420
- <div class="format-settings">
3421
- <div class="format-setting-label">
3422
- <h5>' . __( 'Image Source (Radio Image only)', 'option-tree' ) . '</h5>
3423
- </div>
3424
- <div class="format-setting type-text wide-desc">
3425
- <div class="format-setting-inner">
3426
- <input type="text" name="' . esc_attr( $name ) . '[choices][' . esc_attr( $key ) . '][src]" value="' . ( isset( $choice['src'] ) ? esc_attr( $choice['src'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3427
- </div>
3428
- </div>
3429
- </div>
3430
- </div>';
3431
-
3432
- }
3433
-
3434
- }
3435
-
3436
- /**
3437
- * Helper function to display sections.
3438
- *
3439
- * This function is used in AJAX to add a new section
3440
- * and when section have already been added and saved.
3441
- *
3442
- * @param int $key The array key for the current element.
3443
- * @param array An array of values for the current section.
3444
- *
3445
- * @return void
3446
- *
3447
- * @access public
3448
- * @since 2.0
3449
- */
3450
- if ( ! function_exists( 'ot_contextual_help_view' ) ) {
3451
-
3452
- function ot_contextual_help_view( $name, $key, $content = array() ) {
3453
-
3454
- return '
3455
- <div class="option-tree-setting">
3456
- <div class="open">' . ( isset( $content['title'] ) ? esc_attr( $content['title'] ) : 'Content ' . ( $key + 1 ) ) . '</div>
3457
- <div class="button-section">
3458
- <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
3459
- <span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
3460
- </a>
3461
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="' . __( 'Delete', 'option-tree' ) . '">
3462
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3463
- </a>
3464
- </div>
3465
- <div class="option-tree-setting-body">
3466
- <div class="format-settings">
3467
- <div class="format-setting type-text no-desc">
3468
- <div class="description">' . __( '<strong>Title</strong>: Displayed as a contextual help menu item on the Theme Options page.', 'option-tree' ) . '</div>
3469
- <div class="format-setting-inner">
3470
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][title]" value="' . ( isset( $content['title'] ) ? esc_attr( $content['title'] ) : '' ) . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
3471
- </div>
3472
- </div>
3473
- </div>
3474
- <div class="format-settings">
3475
- <div class="format-setting type-text no-desc">
3476
- <div class="description">' . __( '<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
3477
- <div class="format-setting-inner">
3478
- <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][id]" value="' . ( isset( $content['id'] ) ? esc_attr( $content['id'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3479
- </div>
3480
- </div>
3481
- </div>
3482
- <div class="format-settings">
3483
- <div class="format-setting type-textarea no-desc">
3484
- <div class="description">' . __( '<strong>Content</strong>: Enter the HTML content about this contextual help item displayed on the Theme Option page for end users to read.', 'option-tree' ) . '</div>
3485
- <div class="format-setting-inner">
3486
- <textarea class="textarea" rows="15" cols="40" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][content]">' . ( isset( $content['content'] ) ? esc_html( $content['content'] ) : '' ) . '</textarea>
3487
- </div>
3488
- </div>
3489
- </div>
3490
- </div>
3491
- </div>';
3492
-
3493
- }
3494
-
3495
- }
3496
-
3497
- /**
3498
- * Helper function to display sections.
3499
- *
3500
- * @param string $key
3501
- * @param string $data
3502
- * @param string $active_layout
3503
- *
3504
- * @return void
3505
- *
3506
- * @access public
3507
- * @since 2.0
3508
- */
3509
- if ( ! function_exists( 'ot_layouts_view' ) ) {
3510
-
3511
- function ot_layout_view( $key, $data = '', $active_layout = '' ) {
3512
-
3513
- return '
3514
- <div class="option-tree-setting">
3515
- <div class="open">' . ( isset( $key ) ? esc_attr( $key ) : __( 'Layout', 'option-tree' ) ) . '</div>
3516
- <div class="button-section">
3517
- <a href="javascript:void(0);" class="option-tree-layout-activate option-tree-ui-button left-item' . ( $active_layout == $key ? ' active' : '' ) . '" title="' . __( 'Activate', 'option-tree' ) . '">
3518
- <span class="icon check">' . __( 'Activate', 'option-tree' ) . '</span>
3519
- </a>
3520
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="'. __( 'Delete', 'option-tree' ) . '">
3521
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3522
- </a>
3523
- </div>
3524
- <input type="hidden" name="option_tree_layouts[' . esc_attr( $key ) . ']" value="' . $data . '" />
3525
- </div>';
3526
-
3527
- }
3528
-
3529
- }
3530
-
3531
- /**
3532
- * Helper function to display list items.
3533
- *
3534
- * This function is used in AJAX to add a new list items
3535
- * and when they have already been added and saved.
3536
- *
3537
- * @param string $name The form field name.
3538
- * @param int $key The array key for the current element.
3539
- * @param array An array of values for the current list item.
3540
- *
3541
- * @return void
3542
- *
3543
- * @access public
3544
- * @since 2.0
3545
- */
3546
- if ( ! function_exists( 'ot_list_item_view' ) ) {
3547
-
3548
- function ot_list_item_view( $name, $key, $list_item = array(), $post_id = 0, $get_option = '', $settings = array(), $type = '' ) {
3549
-
3550
- /* required title setting */
3551
- $required_setting = array(
3552
- array(
3553
- 'id' => 'title',
3554
- 'label' => __( 'Title', 'option-tree' ),
3555
- 'desc' => '',
3556
- 'std' => '',
3557
- 'type' => 'text',
3558
- 'rows' => '',
3559
- 'class' => 'option-tree-setting-title',
3560
- 'post_type' => '',
3561
- 'choices' => array()
3562
- )
3563
- );
3564
-
3565
- /* load the old filterable slider settings */
3566
- if ( 'slider' == $type ) {
3567
-
3568
- $settings = ot_slider_settings( $name );
3569
-
3570
- }
3571
-
3572
- /* if no settings array load the filterable list item settings */
3573
- if ( empty( $settings ) ) {
3574
-
3575
- $settings = ot_list_item_settings( $name );
3576
-
3577
- }
3578
-
3579
- /* merge the two settings array */
3580
- $settings = array_merge( $required_setting, $settings );
3581
-
3582
- echo '
3583
- <div class="option-tree-setting">
3584
- <div class="open">' . ( isset( $list_item['title'] ) ? esc_attr( $list_item['title'] ) : '' ) . '</div>
3585
- <div class="button-section">
3586
- <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
3587
- <span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
3588
- </a>
3589
- <a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button red light right-item" title="' . __( 'Delete', 'option-tree' ) . '">
3590
- <span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
3591
- </a>
3592
- </div>
3593
- <div class="option-tree-setting-body">';
3594
-
3595
- foreach( $settings as $field ) {
3596
-
3597
- // Set field value
3598
- $field_value = isset( $list_item[$field['id']] ) ? $list_item[$field['id']] : '';
3599
-
3600
- /* set default to standard value */
3601
- if ( isset( $field['std'] ) ) {
3602
- $field_value = ot_filter_std_value( $field_value, $field['std'] );
3603
- }
3604
-
3605
- /* make life easier */
3606
- $_field_name = $get_option ? $get_option . '[' . $name . ']' : $name;
3607
-
3608
- /* build the arguments array */
3609
- $_args = array(
3610
- 'type' => $field['type'],
3611
- 'field_id' => $name . '_' . $field['id'] . '_' . $key,
3612
- 'field_name' => $_field_name . '[' . $key . '][' . $field['id'] . ']',
3613
- 'field_value' => $field_value,
3614
- 'field_desc' => isset( $field['desc'] ) ? $field['desc'] : '',
3615
- 'field_std' => isset( $field['std'] ) ? $field['std'] : '',
3616
- 'field_rows' => isset( $field['rows'] ) ? $field['rows'] : 10,
3617
- 'field_post_type' => isset( $field['post_type'] ) && ! empty( $field['post_type'] ) ? $field['post_type'] : 'post',
3618
- 'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
3619
- 'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
3620
- 'field_class' => isset( $field['class'] ) ? $field['class'] : '',
3621
- 'field_choices' => isset( $field['choices'] ) && ! empty( $field['choices'] ) ? $field['choices'] : array(),
3622
- 'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
3623
- 'post_id' => $post_id,
3624
- 'get_option' => $get_option
3625
- );
3626
-
3627
- /* option label */
3628
- echo '<div class="format-settings">';
3629
-
3630
- /* don't show title with textblocks */
3631
- if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
3632
- echo '<div class="format-setting-label">';
3633
- echo '<h3 class="label">' . esc_attr( $field['label'] ) . '</h3>';
3634
- echo '</div>';
3635
- }
3636
-
3637
- /* only allow simple textarea inside a list-item due to known DOM issues with wp_editor() */
3638
- if ( $_args['type'] == 'textarea' )
3639
- $_args['type'] = 'textarea-simple';
3640
-
3641
- /* option body, list-item is not allowed inside another list-item */
3642
- if ( $_args['type'] !== 'list-item' && $_args['type'] !== 'slider' ) {
3643
- echo ot_display_by_type( $_args );
3644
- }
3645
-
3646
- echo '</div>';
3647
-
3648
- }
3649
-
3650
- echo
3651
- '</div>
3652
- </div>';
3653
-
3654
- }
3655
-
3656
- }
3657
-
3658
- /**
3659
- * Helper function to display Theme Options layouts form.
3660
- *
3661
- * @return string
3662
- *
3663
- * @access public
3664
- * @since 2.0
3665
- */
3666
- if ( ! function_exists( 'ot_theme_options_layouts_form' ) ) {
3667
-
3668
- function ot_theme_options_layouts_form( $active = false ) {
3669
-
3670
- echo '<form method="post" id="option-tree-options-layouts-form">';
3671
-
3672
- /* form nonce */
3673
- wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' );
3674
-
3675
- /* get the saved layouts */
3676
- $layouts = get_option( 'option_tree_layouts' );
3677
-
3678
- /* set active layout */
3679
- $active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : '';
3680
-
3681
- if ( is_array( $layouts ) && count( $layouts ) > 1 ) {
3682
-
3683
- $active_layout = esc_attr( $layouts['active_layout'] );
3684
-
3685
- echo '<input type="hidden" id="the_current_layout" value="' . $active_layout . '" />';
3686
-
3687
- echo '<div class="option-tree-active-layout">';
3688
-
3689
- echo '<select name="option_tree_layouts[active_layout]" class="option-tree-ui-select">';
3690
-
3691
- foreach( $layouts as $key => $data ) {
3692
-
3693
- if ( $key == 'active_layout' )
3694
- continue;
3695
-
3696
- echo '<option' . selected( $key, $active_layout, false ) . ' value="' . esc_attr( $key ) . '">' . esc_attr( $key ) . '</option>';
3697
- }
3698
-
3699
- echo '</select>';
3700
-
3701
- echo '</div>';
3702
-
3703
- foreach( $layouts as $key => $data ) {
3704
-
3705
- if ( $key == 'active_layout' )
3706
- continue;
3707
-
3708
- echo '<input type="hidden" name="option_tree_layouts[' . $key . ']" value="' . ( isset( $data ) ? $data : '' ) . '" />';
3709
-
3710
- }
3711
-
3712
- }
3713
-
3714
- /* new layout wrapper */
3715
- echo '<div class="option-tree-save-layout' . ( ! empty( $active_layout ) ? ' active-layout' : '' ) . '">';
3716
-
3717
- /* add new layout */
3718
- echo '<input type="text" name="option_tree_layouts[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
3719
-
3720
- echo '<button type="submit" class="option-tree-ui-button blue save-layout" title="' . __( 'New Layout', 'option-tree' ) . '">' . __( 'New Layout', 'option-tree' ) . '</button>';
3721
-
3722
- echo '</div>';
3723
-
3724
- echo '</form>';
3725
-
3726
- }
3727
-
3728
- }
3729
-
3730
- /**
3731
- * Helper function to validate option ID's
3732
- *
3733
- * @param string $input The string to sanitize.
3734
- * @return string
3735
- *
3736
- * @access public
3737
- * @since 2.0
3738
- */
3739
- if ( ! function_exists( 'ot_sanitize_option_id' ) ) {
3740
-
3741
- function ot_sanitize_option_id( $input ) {
3742
-
3743
- return preg_replace( '/[^a-z0-9]/', '_', trim( strtolower( $input ) ) );
3744
-
3745
- }
3746
-
3747
- }
3748
-
3749
- /**
3750
- * Helper function to validate layout ID's
3751
- *
3752
- * @param string $input The string to sanitize.
3753
- * @return string
3754
- *
3755
- * @access public
3756
- * @since 2.0
3757
- */
3758
- if ( ! function_exists( 'ot_sanitize_layout_id' ) ) {
3759
-
3760
- function ot_sanitize_layout_id( $input ) {
3761
-
3762
- return preg_replace( '/[^a-z0-9]/', '-', trim( strtolower( $input ) ) );
3763
-
3764
- }
3765
-
3766
- }
3767
-
3768
- /**
3769
- * Convert choices array to string
3770
- *
3771
- * @return string
3772
- *
3773
- * @access public
3774
- * @since 2.0
3775
- */
3776
- if ( ! function_exists( 'ot_convert_array_to_string' ) ) {
3777
-
3778
- function ot_convert_array_to_string( $input ) {
3779
-
3780
- if ( is_array( $input ) ) {
3781
-
3782
- foreach( $input as $k => $choice ) {
3783
- $choices[$k] = $choice['value'] . '|' . $choice['label'];
3784
-
3785
- if ( isset( $choice['src'] ) )
3786
- $choices[$k].= '|' . $choice['src'];
3787
-
3788
- }
3789
-
3790
- return implode( ',', $choices );
3791
- }
3792
-
3793
- return false;
3794
- }
3795
- }
3796
-
3797
- /**
3798
- * Convert choices string to array
3799
- *
3800
- * @return array
3801
- *
3802
- * @access public
3803
- * @since 2.0
3804
- */
3805
- if ( ! function_exists( 'ot_convert_string_to_array' ) ) {
3806
-
3807
- function ot_convert_string_to_array( $input ) {
3808
-
3809
- if ( '' !== $input ) {
3810
-
3811
- /* empty choices array */
3812
- $choices = array();
3813
-
3814
- /* exlode the string into an array */
3815
- foreach( explode( ',', $input ) as $k => $choice ) {
3816
-
3817
- /* if ":" is splitting the string go deeper */
3818
- if ( preg_match( '/\|/', $choice ) ) {
3819
- $split = explode( '|', $choice );
3820
- $choices[$k]['value'] = trim( $split[0] );
3821
- $choices[$k]['label'] = trim( $split[1] );
3822
-
3823
- /* if radio image there are three values */
3824
- if ( isset( $split[2] ) )
3825
- $choices[$k]['src'] = trim( $split[2] );
3826
-
3827
- } else {
3828
- $choices[$k]['value'] = trim( $choice );
3829
- $choices[$k]['label'] = trim( $choice );
3830
- }
3831
-
3832
- }
3833
-
3834
- /* return a formated choices array */
3835
- return $choices;
3836
-
3837
- }
3838
-
3839
- return false;
3840
-
3841
- }
3842
- }
3843
-
3844
- /**
3845
- * Helper function - strpos() with arrays.
3846
- *
3847
- * @param string $haystack
3848
- * @param array $needles
3849
- * @return bool
3850
- *
3851
- * @access public
3852
- * @since 2.0
3853
- */
3854
- if ( ! function_exists( 'ot_strpos_array' ) ) {
3855
-
3856
- function ot_strpos_array( $haystack, $needles = array() ) {
3857
-
3858
- foreach( $needles as $needle ) {
3859
- $pos = strpos( $haystack, $needle );
3860
- if ( $pos !== false ) {
3861
- return true;
3862
- }
3863
- }
3864
-
3865
- return false;
3866
- }
3867
-
3868
- }
3869
-
3870
- /**
3871
- * Helper function - strpos() with arrays.
3872
- *
3873
- * @param string $haystack
3874
- * @param array $needles
3875
- * @return bool
3876
- *
3877
- * @access public
3878
- * @since 2.0
3879
- */
3880
- if ( ! function_exists( 'ot_array_keys_exists' ) ) {
3881
-
3882
- function ot_array_keys_exists( $array, $keys ) {
3883
-
3884
- foreach($keys as $k) {
3885
- if ( isset($array[$k]) ) {
3886
- return true;
3887
- }
3888
- }
3889
-
3890
- return false;
3891
- }
3892
-
3893
- }
3894
-
3895
- /**
3896
- * Custom stripslashes from single value or array.
3897
- *
3898
- * @param mixed $input
3899
- * @return mixed
3900
- *
3901
- * @access public
3902
- * @since 2.0
3903
- */
3904
- if ( ! function_exists( 'ot_stripslashes' ) ) {
3905
-
3906
- function ot_stripslashes( $input ) {
3907
-
3908
- if ( is_array( $input ) ) {
3909
-
3910
- foreach( $input as &$val ) {
3911
-
3912
- if ( is_array( $val ) ) {
3913
-
3914
- $val = ot_stripslashes( $val );
3915
-
3916
- } else {
3917
-
3918
- $val = stripslashes( trim( $val ) );
3919
-
3920
- }
3921
-
3922
- }
3923
-
3924
- } else {
3925
-
3926
- $input = stripslashes( trim( $input ) );
3927
-
3928
- }
3929
-
3930
- return $input;
3931
-
3932
- }
3933
-
3934
- }
3935
-
3936
- /**
3937
- * Reverse wpautop.
3938
- *
3939
- * @param string $string The string to be filtered
3940
- * @return string
3941
- *
3942
- * @access public
3943
- * @since 2.0.9
3944
- */
3945
- if ( ! function_exists( 'ot_reverse_wpautop' ) ) {
3946
-
3947
- function ot_reverse_wpautop( $string = '' ) {
3948
-
3949
- /* return if string is empty */
3950
- if ( trim( $string ) === '' )
3951
- return '';
3952
-
3953
- /* remove all new lines & <p> tags */
3954
- $string = str_replace( array( "\n", "<p>" ), "", $string );
3955
-
3956
- /* replace <br /> with \r */
3957
- $string = str_replace( array( "<br />", "<br>", "<br/>" ), "\r", $string );
3958
-
3959
- /* replace </p> with \r\n */
3960
- $string = str_replace( "</p>", "\r\n", $string );
3961
-
3962
- /* return clean string */
3963
- return trim( $string );
3964
-
3965
- }
3966
-
3967
- }
3968
-
3969
- /**
3970
- * Returns an array of elements from start to limit, inclusive.
3971
- *
3972
- * Occasionally zero will be some impossibly large number to
3973
- * the "E" power when creating a range from negative to positive.
3974
- * This function attempts to fix that by setting that number back to "0".
3975
- *
3976
- * @param string $start First value of the sequence.
3977
- * @param string $limit The sequence is ended upon reaching the limit value.
3978
- * @param string $step If a step value is given, it will be used as the increment
3979
- * between elements in the sequence. step should be given as a
3980
- * positive number. If not specified, step will default to 1.
3981
- * @return array
3982
- *
3983
- * @access public
3984
- * @since 2.0.12
3985
- */
3986
- function ot_range( $start, $limit, $step = 1 ) {
3987
-
3988
- if ( $step < 0 )
3989
- $step = 1;
3990
-
3991
- $range = range( $start, $limit, $step );
3992
-
3993
- foreach( $range as $k => $v ) {
3994
- if ( strpos( $v, 'E' ) ) {
3995
- $range[$k] = 0;
3996
- }
3997
- }
3998
-
3999
- return $range;
4000
- }
4001
-
4002
- /**
4003
- * Helper function to return encoded strings
4004
- *
4005
- * @return string
4006
- *
4007
- * @access public
4008
- * @since 2.0.13
4009
- */
4010
- function ot_encode( $value ) {
4011
-
4012
- return base64_encode( $value );
4013
-
4014
- }
4015
-
4016
- /**
4017
- * Helper function to return decoded strings
4018
- *
4019
- * @return string
4020
- *
4021
- * @access public
4022
- * @since 2.0.13
4023
- */
4024
- function ot_decode( $value ) {
4025
-
4026
- return base64_decode( $value );
4027
-
4028
- }
4029
-
4030
- /**
4031
- * Helper function to open a file
4032
- *
4033
- * @access public
4034
- * @since 2.0.13
4035
- */
4036
- function ot_file_open( $handle, $mode ) {
4037
-
4038
- return @fopen( $handle, $mode );
4039
-
4040
- }
4041
-
4042
- /**
4043
- * Helper function to close a file
4044
- *
4045
- * @access public
4046
- * @since 2.0.13
4047
- */
4048
- function ot_file_close( $handle ) {
4049
-
4050
- return fclose( $handle );
4051
-
4052
- }
4053
-
4054
- /**
4055
- * Helper function to write to an open file
4056
- *
4057
- * @access public
4058
- * @since 2.0.13
4059
- */
4060
- function ot_file_write( $handle, $string ) {
4061
-
4062
- return fwrite( $handle, $string );
4063
-
4064
- }
4065
-
4066
- /**
4067
- * Helper function to filter standard option values.
4068
- *
4069
- * @param mixed $value Saved string or array value
4070
- * @param mixed $std Standard string or array value
4071
- * @return mixed String or array
4072
- *
4073
- * @access public
4074
- * @since 2.0.15
4075
- */
4076
- function ot_filter_std_value( $value = '', $std = '' ) {
4077
-
4078
- $std = maybe_unserialize( $std );
4079
-
4080
- if ( is_array( $value ) && is_array( $std ) ) {
4081
-
4082
- foreach( $value as $k => $v ) {
4083
-
4084
- if ( '' == $value[$k] && isset( $std[$k] ) ) {
4085
-
4086
- $value[$k] = $std[$k];
4087
-
4088
- }
4089
-
4090
- }
4091
-
4092
- } else if ( '' == $value && ! empty( $std ) ) {
4093
-
4094
- $value = $std;
4095
-
4096
- }
4097
-
4098
- return $value;
4099
-
4100
- }
4101
-
4102
- /**
4103
- * Helper function to register a WPML string
4104
- *
4105
- * @access public
4106
- * @since 2.1
4107
- */
4108
- function ot_wpml_register_string( $id, $value ) {
4109
-
4110
- if ( function_exists( 'icl_register_string' ) ) {
4111
-
4112
- icl_register_string( 'Theme Options', $id, $value );
4113
-
4114
- }
4115
-
4116
- }
4117
-
4118
- /**
4119
- * Helper function to unregister a WPML string
4120
- *
4121
- * @access public
4122
- * @since 2.1
4123
- */
4124
- function ot_wpml_unregister_string( $id ) {
4125
-
4126
- if ( function_exists( 'icl_unregister_string' ) ) {
4127
-
4128
- icl_unregister_string( 'Theme Options', $id );
4129
-
4130
- }
4131
-
4132
- }
4133
-
4134
- /* End of file ot-functions-admin.php */
4135
- /* Location: ./includes/ot-functions-admin.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-compat.php DELETED
@@ -1,364 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * Compatibility Functions.
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /* run the actions & filters */
12
- add_action( 'admin_init', 'compat_ot_import_from_files', 1 );
13
- add_filter( 'ot_option_types_array', 'compat_ot_option_types_array', 10, 1 );
14
- add_filter( 'ot_recognized_font_styles', 'compat_ot_recognized_font_styles', 10, 2 );
15
- add_filter( 'ot_recognized_font_weights', 'compat_ot_recognized_font_weights', 10, 2 );
16
- add_filter( 'ot_recognized_font_variants', 'compat_ot_recognized_font_variants', 10, 2 );
17
- add_filter( 'ot_recognized_font_families', 'compat_ot_recognized_font_families', 10, 2 );
18
- add_filter( 'ot_recognized_background_repeat', 'compat_ot_recognized_background_repeat', 10, 2 );
19
- add_filter( 'ot_recognized_background_position', 'compat_ot_recognized_background_position', 10, 2 );
20
- add_filter( 'ot_measurement_unit_types', 'compat_ot_measurement_unit_types', 10, 2 );
21
-
22
- /**
23
- * Import from the old 1.x files for backwards compatibility.
24
- *
25
- * @return void
26
- *
27
- * @access private
28
- * @since 2.0.8
29
- */
30
- if ( ! function_exists( 'compat_ot_import_from_files' ) ) {
31
-
32
- function compat_ot_import_from_files() {
33
-
34
- /* file path & name without extention */
35
- $ot_xml = '/option-tree/theme-options.xml';
36
- $ot_data = '/option-tree/theme-options.txt';
37
- $ot_layout = '/option-tree/layouts.txt';
38
-
39
- /* XML file path - child theme first then parent */
40
- if ( is_readable( get_stylesheet_directory() . $ot_xml ) ) {
41
-
42
- $xml_file = get_stylesheet_directory_uri() . $ot_xml;
43
-
44
- } else if ( is_readable( get_template_directory() . $ot_xml ) ) {
45
-
46
- $xml_file = get_template_directory_uri() . $ot_xml;
47
-
48
- }
49
-
50
- /* Data file path - child theme first then parent */
51
- if ( is_readable( get_stylesheet_directory() . $ot_data ) ) {
52
-
53
- $data_file = get_stylesheet_directory_uri() . $ot_data;
54
-
55
- } else if ( is_readable( get_template_directory() . $ot_data ) ) {
56
-
57
- $data_file = get_template_directory_uri() . $ot_data;
58
-
59
- }
60
-
61
- /* Layout file path - child theme first then parent */
62
- if ( is_readable( get_stylesheet_directory() . $ot_layout ) ) {
63
-
64
- $layout_file = get_stylesheet_directory_uri() . $ot_layout;
65
-
66
- } else if ( is_readable( get_template_directory() . $ot_layout ) ) {
67
-
68
- $layout_file = get_template_directory_uri() . $ot_layout;
69
-
70
- }
71
-
72
- /* check for files */
73
- $has_xml = isset( $xml_file ) ? true : false;
74
- $has_data = isset( $data_file ) ? true : false;
75
- $has_layout = isset( $layout_file ) ? true : false;
76
-
77
- /* auto import XML file */
78
- if ( $has_xml == true && ! get_option( 'option_tree_settings' ) && class_exists( 'SimpleXMLElement' ) ) {
79
-
80
- $settings = ot_import_xml( $xml_file );
81
-
82
- if ( isset( $settings ) && ! empty( $settings ) ) {
83
-
84
- update_option( 'option_tree_settings', $settings );
85
-
86
- }
87
-
88
- }
89
-
90
- /* auto import Data file */
91
- if ( $has_data == true && ! get_option( 'option_tree' ) ) {
92
-
93
- $get_data = wp_remote_get( $data_file );
94
-
95
- if ( is_wp_error( $get_data ) )
96
- return false;
97
-
98
- $rawdata = isset( $get_data['body'] ) ? $get_data['body'] : '';
99
- $options = unserialize( ot_decode( $rawdata ) );
100
-
101
- /* get settings array */
102
- $settings = get_option( 'option_tree_settings' );
103
-
104
- /* has options */
105
- if ( is_array( $options ) ) {
106
-
107
- /* validate options */
108
- if ( is_array( $settings ) ) {
109
-
110
- foreach( $settings['settings'] as $setting ) {
111
-
112
- if ( isset( $options[$setting['id']] ) ) {
113
-
114
- $content = ot_stripslashes( $options[$setting['id']] );
115
-
116
- $options[$setting['id']] = ot_validate_setting( $content, $setting['type'], $setting['id'] );
117
-
118
- }
119
-
120
- }
121
-
122
- }
123
-
124
- /* update the option tree array */
125
- update_option( 'option_tree', $options );
126
-
127
- }
128
-
129
- }
130
-
131
- /* auto import Layout file */
132
- if ( $has_layout == true && ! get_option( 'option_tree_layouts' ) ) {
133
-
134
- $get_data = wp_remote_get( $data_file );
135
-
136
- if ( is_wp_error( $get_data ) )
137
- return false;
138
-
139
- $rawdata = isset( $get_data['body'] ) ? $get_data['body'] : '';
140
- $layouts = unserialize( ot_decode( $rawdata ) );
141
-
142
- /* get settings array */
143
- $settings = get_option( 'option_tree_settings' );
144
-
145
- /* has layouts */
146
- if ( is_array( $layouts ) ) {
147
-
148
- /* validate options */
149
- if ( is_array( $settings ) ) {
150
-
151
- foreach( $layouts as $key => $value ) {
152
-
153
- if ( $key == 'active_layout' )
154
- continue;
155
-
156
- $options = unserialize( ot_decode( $value ) );
157
-
158
- foreach( $settings['settings'] as $setting ) {
159
-
160
- if ( isset( $options[$setting['id']] ) ) {
161
-
162
- $content = ot_stripslashes( $options[$setting['id']] );
163
-
164
- $options[$setting['id']] = ot_validate_setting( $content, $setting['type'], $setting['id'] );
165
-
166
- }
167
-
168
- }
169
-
170
- $layouts[$key] = ot_encode( serialize( $options ) );
171
-
172
- }
173
-
174
- }
175
-
176
- /* update the option tree array */
177
- if ( isset( $layouts['active_layout'] ) ) {
178
-
179
- update_option( 'option_tree', unserialize( ot_decode( $layouts[$layouts['active_layout']] ) ) );
180
-
181
- }
182
-
183
- /* update the option tree layouts array */
184
- update_option( 'option_tree_layouts', $layouts );
185
-
186
- }
187
-
188
- }
189
-
190
- }
191
-
192
- }
193
-
194
- /**
195
- * Filters the option types array.
196
- *
197
- * Allows the old 'option_tree_option_types' filter to
198
- * change the new 'ot_option_types_array' return value.
199
- *
200
- * @return array
201
- *
202
- * @access public
203
- * @since 2.0
204
- */
205
- if ( ! function_exists( 'compat_ot_option_types_array' ) ) {
206
-
207
- function compat_ot_option_types_array( $array ) {
208
-
209
- return apply_filters( 'option_tree_option_types', $array );
210
-
211
- }
212
-
213
- }
214
-
215
- /**
216
- * Filters the recognized font styles array.
217
- *
218
- * Allows the old 'recognized_font_styles' filter to
219
- * change the new 'ot_recognized_font_styles' return value.
220
- *
221
- * @return array
222
- *
223
- * @access public
224
- * @since 2.0
225
- */
226
- if ( ! function_exists( 'compat_ot_recognized_font_styles' ) ) {
227
-
228
- function compat_ot_recognized_font_styles( $array, $id ) {
229
-
230
- return apply_filters( 'recognized_font_styles', $array, $id );
231
-
232
- }
233
-
234
- }
235
-
236
- /**
237
- * Filters the recognized font weights array.
238
- *
239
- * Allows the old 'recognized_font_weights' filter to
240
- * change the new 'ot_recognized_font_weights' return value.
241
- *
242
- * @return array
243
- *
244
- * @access public
245
- * @since 2.0
246
- */
247
- if ( ! function_exists( 'compat_ot_recognized_font_weights' ) ) {
248
-
249
- function compat_ot_recognized_font_weights( $array, $id ) {
250
-
251
- return apply_filters( 'recognized_font_weights', $array, $id );
252
-
253
- }
254
-
255
- }
256
-
257
- /**
258
- * Filters the recognized font variants array.
259
- *
260
- * Allows the old 'recognized_font_variants' filter to
261
- * change the new 'ot_recognized_font_variants' return value.
262
- *
263
- * @return array
264
- *
265
- * @access public
266
- * @since 2.0
267
- */
268
- if ( ! function_exists( 'compat_ot_recognized_font_variants' ) ) {
269
-
270
- function compat_ot_recognized_font_variants( $array, $id ) {
271
-
272
- return apply_filters( 'recognized_font_variants', $array, $id );
273
-
274
- }
275
-
276
- }
277
-
278
- /**
279
- * Filters the recognized font families array.
280
- *
281
- * Allows the old 'recognized_font_families' filter to
282
- * change the new 'ot_recognized_font_families' return value.
283
- *
284
- * @return array
285
- *
286
- * @access public
287
- * @since 2.0
288
- */
289
- if ( ! function_exists( 'compat_ot_recognized_font_families' ) ) {
290
-
291
- function compat_ot_recognized_font_families( $array, $id ) {
292
-
293
- return apply_filters( 'recognized_font_families', $array, $id );
294
-
295
- }
296
-
297
- }
298
-
299
- /**
300
- * Filters the recognized background repeat array.
301
- *
302
- * Allows the old 'recognized_background_repeat' filter to
303
- * change the new 'ot_recognized_background_repeat' return value.
304
- *
305
- * @return array
306
- *
307
- * @access public
308
- * @since 2.0
309
- */
310
- if ( ! function_exists( 'compat_ot_recognized_background_repeat' ) ) {
311
-
312
- function compat_ot_recognized_background_repeat( $array, $id ) {
313
-
314
- return apply_filters( 'recognized_background_repeat', $array, $id );
315
-
316
- }
317
-
318
- }
319
-
320
- /**
321
- * Filters the recognized background position array.
322
- *
323
- * Allows the old 'recognized_background_position' filter to
324
- * change the new 'ot_recognized_background_position' return value.
325
- *
326
- * @return array
327
- *
328
- * @access public
329
- * @since 2.0
330
- */
331
- if ( ! function_exists( 'compat_ot_recognized_background_position' ) ) {
332
-
333
- function compat_ot_recognized_background_position( $array, $id ) {
334
-
335
- return apply_filters( 'recognized_background_position', $array, $id );
336
-
337
- }
338
-
339
- }
340
-
341
- /**
342
- * Filters the measurement unit types array.
343
- *
344
- * Allows the old 'measurement_unit_types' filter to
345
- * change the new 'ot_measurement_unit_types' return value.
346
- *
347
- * @return array
348
- *
349
- * @access public
350
- * @since 2.0
351
- */
352
- if ( ! function_exists( 'compat_ot_measurement_unit_types' ) ) {
353
-
354
- function compat_ot_measurement_unit_types( $array, $id ) {
355
-
356
- return apply_filters( 'measurement_unit_types', $array, $id );
357
-
358
- }
359
-
360
- }
361
-
362
-
363
- /* End of file ot-functions-compat.php */
364
- /* Location: ./includes/ot-functions-compat.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-deprecated.php DELETED
@@ -1,99 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree deprecated functions
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Displays or returns a value from the 'option_tree' array.
13
- *
14
- * @param string $item_id
15
- * @param array $options
16
- * @param bool $echo
17
- * @param bool $is_array
18
- * @param int $offset
19
- * @return mixed array or comma seperated lists of values
20
- *
21
- * @access public
22
- * @since 1.0.0
23
- * @updated 2.0
24
- * @deprecated 2.0
25
- */
26
- if ( ! function_exists( 'get_option_tree' ) ) {
27
-
28
- function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1 ) {
29
- /* load saved options */
30
- if ( ! $options )
31
- $options = get_option( 'option_tree' );
32
-
33
- /* no value return */
34
- if ( ! isset( $options[$item_id] ) || empty( $options[$item_id] ) )
35
- return;
36
-
37
- /* set content value & strip slashes */
38
- $content = option_tree_stripslashes( $options[$item_id] );
39
-
40
- /* is an array */
41
- if ( $is_array == true ) {
42
- /* saved as a comma seperated lists of values, explode into an array */
43
- if ( !is_array( $content ) )
44
- $content = explode( ',', $content );
45
-
46
- /* get an array value using an offset */
47
- if ( is_numeric( $offset ) && $offset >= 0 ) {
48
- $content = $content[$offset];
49
- } else if ( ! is_numeric( $offset ) && isset( $content[$offset] ) ) {
50
- $content = $content[$offset];
51
- }
52
-
53
- /* not an array */
54
- } else if ( $is_array == false ) {
55
- /* saved as array, implode and return a comma seperated lists of values */
56
- if ( is_array( $content ) )
57
- $content = implode( ',', $content ); /* This is fucked */
58
- }
59
-
60
- /* echo content */
61
- if ( $echo )
62
- echo $content;
63
-
64
- return $content;
65
- }
66
-
67
- }
68
-
69
- /**
70
- * Custom stripslashes from single value or array.
71
- *
72
- * @param mixed $input
73
- * @return mixed
74
- *
75
- * @access public
76
- * @since 1.1.3
77
- * @deprecated 2.0
78
- */
79
- if ( ! function_exists( 'option_tree_stripslashes' ) ) {
80
-
81
- function option_tree_stripslashes( $input ) {
82
- if ( is_array( $input ) ) {
83
- foreach( $input as &$val ) {
84
- if ( is_array( $val ) ) {
85
- $val = option_tree_stripslashes( $val );
86
- } else {
87
- $val = stripslashes( $val );
88
- }
89
- }
90
- } else {
91
- $input = stripslashes( $input );
92
- }
93
- return $input;
94
- }
95
-
96
- }
97
-
98
- /* End of file ot-functions-deprecated.php */
99
- /* Location: ./includes/ot-functions-deprecated.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-docs-page.php DELETED
@@ -1,976 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree documentation page functions.
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Creating Options option type.
13
- *
14
- * @return string
15
- *
16
- * @access public
17
- * @since 2.0
18
- */
19
- if ( ! function_exists( 'ot_type_creating_options' ) ) {
20
-
21
- function ot_type_creating_options() {
22
-
23
- /* format setting outer wrapper */
24
- echo '<div class="format-setting type-textblock wide-desc">';
25
-
26
- /* description */
27
- echo '<div class="description">';
28
-
29
- echo '<h4>'. __( 'Label', 'option-tree' ) . ':</h4>';
30
- echo '<p>' . __( 'The Label field should be a short but descriptive block of text 100 characters or less with no HTML.', 'option-tree' ) . '</p>';
31
-
32
- echo '<h4>'. __( 'ID', 'option-tree' ) . ':</h4>';
33
- echo '<p>' . __( 'The ID field is a unique alphanumeric key used to differentiate each theme option (underscores are acceptable). Also, the plugin will change all text you write in this field to lowercase and replace spaces and special characters with an underscore automatically.', 'option-tree' ) . '</p>';
34
-
35
- echo '<h4>'. __( 'Type', 'option-tree' ) . ':</h4>';
36
- echo '<p>' . __( 'You are required to choose one of the supported option types when creating a new option. Here is a list of the available option types. For more information about each type click the <code>Option Types</code> tab to the left.', 'option-tree' ) . '</p>';
37
-
38
- echo '<ul class="docs-ul">';
39
- foreach( ot_option_types_array() as $key => $value )
40
- echo '<li>' . $value . '</li>';
41
- echo '</ul>';
42
-
43
- echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
44
- echo '<p>' . __( 'Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree' ) . '</p>';
45
-
46
- echo '<h4>'. __( 'Choices', 'option-tree' ) . ':</h4>';
47
- echo '<p>' . __( 'Click the "Add Choice" button to add an item to the choices array. This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree' ) . '</p>';
48
-
49
- echo '<h4>'. __( 'Settings', 'option-tree' ) . ':</h4>';
50
- echo '<p>' . __( 'Click the "Add Setting" button found inside a newly created setting to add an item to the settings array. This will only affect the List Item type.', 'option-tree' ) . '</p>';
51
-
52
- echo '<h4>'. __( 'Standard', 'option-tree' ) . ':</h4>';
53
- echo '<p>' . __( 'Setting the standard value for your option only works for some option types. Those types are one that have a single string value saved to them and not an array of values.', 'option-tree' ) . '</p>';
54
-
55
- echo '<h4>'. __( 'Rows', 'option-tree' ) . ':</h4>';
56
- echo '<p>' . __( 'Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree' ) . '</p>';
57
-
58
- echo '<h4>'. __( 'Post Type', 'option-tree' ) . ':</h4>';
59
- echo '<p>' . __( 'Add a comma separated list of post type like <code>post,page</code>. This will only affect the following option types: Custom Post Type Checkbox, & Custom Post Type Select. Below are the default post types available with WordPress and that are also compatible with OptionTree. You can also add your own custom <code>post_type</code>. At this time <code>any</code> does not seem to return results properly and is something I plan on looking into.', 'option-tree' ) . '</p>';
60
-
61
- echo '<ul class="docs-ul">';
62
- echo '<li><code>post</code></li>';
63
- echo '<li><code>page</code></li>';
64
- echo '<li><code>attachment</code></li>';
65
- echo '</ul>';
66
-
67
- echo '<h4>'. __( 'Taxonomy', 'option-tree' ) . ':</h4>';
68
- echo '<p>' . __( 'Add a comma separated list of any registered taxonomy like <code>category,post_tag</code>. This will only affect the following option types: Taxonomy Checkbox, & Taxonomy Select.', 'option-tree' ) . '</p>';
69
-
70
- echo '<h4>'. __( 'Min, Max, & Step', 'option-tree' ) . ':</h4>';
71
- echo '<p>' . __( 'Add a comma separated list of options in the following format <code>0,100,1</code> (slide from <code>0-100</code> in intervals of <code>1</code>). The three values represent the minimum, maximum, and step options and will only affect the Numeric Slider option type.', 'option-tree' ) . '</p>';
72
-
73
- echo '<h4>'. __( 'CSS Class', 'option-tree' ) . ':</h4>';
74
- echo '<p>' . __( 'Add and optional class to any option type.', 'option-tree' ) . '</p>';
75
-
76
- echo '</div>';
77
-
78
- echo '</div>';
79
-
80
- }
81
-
82
- }
83
-
84
- /**
85
- * ot_get_option() option type.
86
- *
87
- * This is a callback function to display text about ot_get_option().
88
- *
89
- * @return string
90
- *
91
- * @access public
92
- * @since 2.0
93
- */
94
- if ( ! function_exists( 'ot_type_option_types' ) ) {
95
-
96
- function ot_type_option_types() {
97
-
98
- /* format setting outer wrapper */
99
- echo '<div class="format-setting type-textblock wide-desc">';
100
-
101
- /* description */
102
- echo '<div class="description">';
103
-
104
- echo '<h4>'. __( 'Background', 'option-tree' ) . ':</h4>';
105
- echo '<p>' . __( 'The Background option type is for adding background styles to your theme either dynamically via the CSS option type below or manually with <code>ot_get_option()</code>. Background has filters that allow you to change the defaults. For example, you can filter on <code>ot_recognized_background_repeat</code>, <code>ot_recognized_background_attachment</code>, and <code>ot_recognized_background_position</code>. These filters allow you to fine tune the select lists for your specific CSS needs.', 'option-tree' ) . '</p>';
106
-
107
- echo '<h4>'. __( 'Category Select', 'option-tree' ) . ':</h4>';
108
- echo '<p>' . __( 'The Category Select option type displays a list of category IDs. It allows the user to select only one category ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>';
109
-
110
- echo '<h4>'. __( 'Category Checkbox', 'option-tree' ) . ':</h4>';
111
- echo '<p>' . __( 'The Category Checkbox option type displays a list of category IDs. It allows the user to check multiple category IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>';
112
-
113
- echo '<h4>'. __( 'Checkbox', 'option-tree' ) . ':</h4>';
114
- echo '<p>' . __( 'The Checkbox option type is fairly self explanatory. Typically used to ask questions. For example, "Do you want to activate asynchronous Google analytics?" would be a single checkbox with a value of yes. You could have more complex usages but the idea is that you can easily grab the value of the checkbox and use it in you theme. In this situation you would test if the checkbox has a value and execute a block of code if it does and do nothing if it doesn\'t.', 'option-tree' ) . '</p>';
115
-
116
- echo '<h4>'. __( 'Colorpicker', 'option-tree' ) . ':</h4>';
117
- echo '<p>' . __( 'The Colorpicker option type saves a hexadecimal color code for use in CSS. Use it to modify the color of something in your theme.', 'option-tree' ) . '</p>';
118
-
119
- echo '<h4>'. __( 'CSS', 'option-tree' ) . ':</h4>';
120
- echo '<p>' . __( 'The CSS option type is a textarea that when used properly can add dynamic CSS to your theme from within OptionTree. Unfortunately, due server limitations you will need to create a file named <code>dynamic.css</code> at the root level of your theme and change permissions using chmod so the server can write to the file. I have had the most success setting this single file to 0777 but feel free to play around with permissions until everything is working. A good starting point is 0666. When the server can save to the file CSS will automatically be updated each time you save your theme options.', 'option-tree' ) . '</p>';
121
-
122
- echo '<p class="aside">' . __( 'An example of the CSS option type: This assumes you have an option with the ID of <code>custom_background_css</code> which will display the saved values for that option.', 'option-tree' ) . '</p>';
123
-
124
- echo '<p>'. __( 'Input', 'option-tree' ) . ':</p>';
125
- echo '<pre><code>body {
126
- {{custom_background_css}}
127
- background-color: {{custom_background_css|background-color}};
128
- }</code></pre>';
129
-
130
- echo '<p>'. __( 'Output', 'option-tree' ) . ':</p>';
131
- echo '<pre><code>/* BEGIN custom_background_css */
132
- body {
133
- background: color image repeat attachment position;
134
- background-color: color;
135
- }
136
- /* END custom_background_css */</code></pre>';
137
-
138
- echo '<h4>'. __( 'Custom Post Type Select', 'option-tree' ) . ':</h4>';
139
- echo '<p>' . __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It will return a single post ID for use in a custom function or loop. Requires at least one valid <code>post_type</code> when created in the settings. For some reason <code>any</code> does not work correctly and will looked into in future version.', 'option-tree' ) . '</p>';
140
-
141
- echo '<h4>'. __( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>';
142
- echo '<p>' . __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It allows the user to check multiple post IDs for use in a custom function or loop. Requires at least one valid <code>post_type</code> when created in the settings. For some reason <code>any</code> does not work correctly and will looked into in future version.', 'option-tree' ) . '</p>';
143
-
144
- echo '<h4>'. __( 'List Item', 'option-tree' ) . ':</h4>';
145
- echo '<p>' . __( 'The list Item replaced the old Slider option type. It allows for a great deal of customization. You can add settings to the List Item and those settings will be displayed to the user when they add a new List Item. Typical use is for creating sliding content or blocks of code for custom layouts.', 'option-tree' ) . '</p>';
146
-
147
- echo '<h4>'. __( 'Measurement', 'option-tree' ) . ':</h4>';
148
- echo '<p>' . __( 'The Measurement option type is a mix of input and select fields. The text input excepts a value and the select lets you choose the unit of measurement to add to that value. Currently the default units are <code>px</code>, <code>%</code>, <code>em</code>, <code>pt</code>. However, you can change them with the <code>ot_measurement_unit_types</code> filter.', 'option-tree' ) . '</p>';
149
-
150
- echo '<p>' . __( 'Example filter to add new units to the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
151
- echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
152
-
153
- /* only run the filter on measurement with a field ID of my_measurement */
154
- if ( $field_id == \'my_measurement\' ) {
155
- $array[\'in\'] = \'inches\';
156
- $array[\'ft\'] = \'feet\';
157
- }
158
-
159
- return $array;
160
- }
161
- add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 2 );</code></pre>';
162
-
163
- echo '<p>' . __( 'Example filter to completely change the units in the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
164
- echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
165
-
166
- /* only run the filter on measurement with a field ID of my_measurement */
167
- if ( $field_id == \'my_measurement\' ) {
168
- $array = array(
169
- \'in\' => \'inches\',
170
- \'ft\' => \'feet\'
171
- );
172
- }
173
-
174
- return $array;
175
- }
176
- add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 2 );</code></pre>';
177
-
178
- echo '<h4>'. __( 'Numeric Slider', 'option-tree' ) . ':</h4>';
179
- echo '<p>' . __( 'The Numeric Slider option type displays a jQuery UI slider. It will return a single numerical value for use in a custom function or loop.', 'option-tree' ) . '</p>';
180
-
181
- echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
182
- echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It will return a single page ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
183
-
184
- echo '<h4>'. __( 'Page Checkbox', 'option-tree' ) . ':</h4>';
185
- echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It allows the user to check multiple page IDs for use in a custom function or loop.', 'option-tree' ) . '</p>';
186
-
187
- echo '<h4>'. __( 'Post Select', 'option-tree' ) . ':</h4>';
188
- echo '<p>' . __( 'The Post Select option type displays a list of post IDs. It will return a single post ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
189
-
190
- echo '<h4>'. __( 'Post Checkbox', 'option-tree' ) . ':</h4>';
191
- echo '<p>' . __( 'The Post Select option type displays a list of post IDs. It allows the user to check multiple post IDs for use in a custom function or loop.', 'option-tree' ) . '</p>';
192
-
193
- echo '<h4>'. __( 'Radio', 'option-tree' ) . ':</h4>';
194
- echo '<p>' . __( 'The Radio option type could ask a question. For example, "Do you want to activate the custom navigation?" could require a yes or no answer with a radio option. In this situation you would test if the radio has a value of \'yes\' and execute a block of code, or if it\'s \'no\' execute a different block of code.', 'option-tree' ) . '</p>';
195
-
196
- echo '<h4>'. __( 'Radio Image', 'option-tree' ) . ':</h4>';
197
- echo '<p>' . __( 'the Radio Images option type is primarily used for layouts. However, you can filter the image list using <code>ot_radio_images</code>. As well, you can add your own custom images using the choices array.', 'option-tree' ) . '</p>';
198
-
199
- echo '<p>' . __( 'This example executes the <code>ot_radio_images</code> filter on layout images attached to the <code>my_radio_images</code> field. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
200
- echo '<pre><code>function filter_radio_images( $array, $field_id ) {
201
-
202
- /* only run the filter where the field ID is my_radio_images */
203
- if ( $field_id == \'my_radio_images\' ) {
204
- $array = array(
205
- array(
206
- \'value\' => \'left-sidebar\',
207
- \'label\' => __( \'Left Sidebar\', \'option-tree\' ),
208
- \'src\' => OT_URL . \'/assets/images/layout/left-sidebar.png\'
209
- ),
210
- array(
211
- \'value\' => \'right-sidebar\',
212
- \'label\' => __( \'Right Sidebar\', \'option-tree\' ),
213
- \'src\' => OT_URL . \'/assets/images/layout/right-sidebar.png\'
214
- )
215
- );
216
- }
217
-
218
- return $array;
219
-
220
- }
221
- add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 2 );</code></pre>';
222
-
223
- echo '<h4>'. __( 'Select', 'option-tree' ) . ':</h4>';
224
- echo '<p>' . __( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>';
225
-
226
- echo '<h4>'. __( 'Sidebar Select', 'option-tree' ) . ':</h4>';
227
- echo '<p>' . __( 'This option type makes it possible for users to select a WordPress registered sidebar to use on a specific area. By using the two provided filters, <code>ot_recognized_sidebars</code>, and <code>ot_recognized_sidebars_{$field_id}</code> we can be selective about which sidebars are available on a specific content area.', 'option-tree' ) . '</p>';
228
- echo '<p>' . __( 'For example, if we create a WordPress theme that provides the ability to change the Blog Sidebar and we don\'t want to have the footer sidebars available on this area, we can unset those sidebars either manually or by using a regular expression if we have a common name like <code>footer-sidebar-$i</code>.', 'option-tree' ) . '</p>';
229
-
230
- echo '<h4>'. __( 'Slider', 'option-tree' ) . ':</h4>';
231
- echo '<p>' . __( 'The Slider option type is technically deprecated. Use the List Item option type instead, as it\'s infinitely more customizable. Typical use is for creating sliding image content.', 'option-tree' ) . '</p>';
232
-
233
- echo '<h4>'. __( 'Tag Checkbox', 'option-tree' ) . ':</h4>';
234
- echo '<p>' . __( 'The Tag Checkbox option type displays a list of tag IDs. It allows the user to check multiple tag IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>';
235
-
236
- echo '<h4>'. __( 'Tag Select', 'option-tree' ) . ':</h4>';
237
- echo '<p>' . __( 'The Tag Select option type displays a list of tag IDs. It allows the user to select only one tag ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>';
238
-
239
- echo '<h4>'. __( 'Taxonomy Checkbox', 'option-tree' ) . ':</h4>';
240
- echo '<p>' . __( 'The Taxonomy Checkbox option type displays a list of taxonomy IDs. It allows the user to check multiple taxonomy IDs and will return that value as an array for use in a custom function or loop.', 'option-tree' ) . '</p>';
241
-
242
- echo '<h4>'. __( 'Taxonomy Select', 'option-tree' ) . ':</h4>';
243
- echo '<p>' . __( 'The Taxonomy Select option type displays a list of taxonomy IDs. It allows the user to select only one taxonomy ID and will return that value for use in a custom function or loop.', 'option-tree' ) . '</p>';
244
-
245
- echo '<h4>'. __( 'Text (Input)', 'option-tree' ) . ':</h4>';
246
- echo '<p>' . __( 'The Text option type would be used to save a string value. For example, a link to feedburner, your Twitter username, or Google Analytics ID are all good candidates. Any optional or required text that is of reasonably short character length.', 'option-tree' ) . '</p>';
247
-
248
- echo '<h4>'. __( 'Textarea', 'option-tree' ) . ':</h4>';
249
- echo '<p>' . __( 'The Textarea option type is a large string value used for custom code or text in the theme. The new Textarea has a WYSIWYG editor that can be filtered to change the buttons shown. For example, you can filter on <code>wpautop</code>, <code>media_buttons</code>, <code>tinymce</code>, and <code>quicktags</code>.', 'option-tree' ) . '</p>';
250
-
251
- echo '<p class="aside">' . __( 'Example filters to alter the Textarea option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
252
-
253
- echo '<p>' . __( 'This example keeps WordPress from executing the <code>wpautop</code> filter on the line breaks. The default is <code>true</code> which means it wraps line breaks with an HTML <code>p</code> tag.', 'option-tree' ) . '</p>';
254
- echo '<pre><code>function filter_textarea_wpautop( $content, $field_id ) {
255
-
256
- /* only run the filter on the textarea with a field ID of my_textarea */
257
- if ( $field_id == \'my_textarea\' ) {
258
- return false;
259
- }
260
-
261
- return $content;
262
-
263
- }
264
- add_filter( \'ot_wpautop\', \'filter_textarea_wpautop\', 10, 1 );</code></pre>';
265
-
266
- echo '<p>' . __( 'This example keeps WordPress from executing the <code>media_buttons</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the buttons.', 'option-tree' ) . '</p>';
267
- echo '<pre><code>function filter_textarea_media_buttons( $content, $field_id ) {
268
-
269
- /* only run the filter on the textarea with a field ID of my_textarea */
270
- if ( $field_id == \'my_textarea\' ) {
271
- return false;
272
- }
273
-
274
- return $content;
275
-
276
- }
277
- add_filter( \'ot_media_buttons\', \'filter_textarea_media_buttons\', 10, 2 );</code></pre>';
278
-
279
- echo '<p>' . __( 'This example keeps WordPress from executing the <code>tinymce</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the tinymce.', 'option-tree' ) . '</p>';
280
- echo '<pre><code>function filter_textarea_tinymce( $content, $field_id ) {
281
-
282
- /* only run the filter on the textarea with a field ID of my_textarea */
283
- if ( $field_id == \'my_textarea\' ) {
284
- return false;
285
- }
286
-
287
- return $content;
288
-
289
- }
290
- add_filter( \'ot_tinymce\', \'filter_textarea_tinymce\', 10, 2 );</code></pre>';
291
-
292
- echo '<p>' . __( 'This example alters the <code>quicktags</code> filter on the textarea WYSIWYG. The default is <code>array( \'buttons\' => \'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close\' )</code> which means show those quicktags. It also means you can filter in your own custom quicktags.', 'option-tree' ) . '</p>';
293
- echo '<pre><code>function filter_textarea_quicktags( $content, $field_id ) {
294
-
295
- /* only run the filter on the textarea with a field ID of my_textarea */
296
- if ( $field_id == \'my_textarea\' ) {
297
- return array( \'buttons\' => \'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close,fullscreen\' );
298
- } else if ( $field_id == \'my_other_textarea\' ) {
299
- return false; /* show no quicktags */
300
- }
301
-
302
- return $content;
303
-
304
- }
305
- add_filter( \'ot_quicktags\', \'filter_textarea_quicktags\', 10, 1 );</code></pre>';
306
-
307
- echo '<h4>'. __( 'Textarea Simple', 'option-tree' ) . ':</h4>';
308
- echo '<p>' . __( 'The Textarea Simple option type is a large string value used for custom code or text in the theme. The new Textarea Simple does not have a WYSIWYG editor. But you can still filter on <code>wpautop</code>.', 'option-tree' ) . '</p>';
309
-
310
- echo '<p class="aside">' . __( 'This example tells WordPress to execute the <code>wpautop</code> filter on the line breaks. The default is <code>false</code> which means it does not wraps line breaks with an HTML <code>p</code> tag. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
311
- echo '<pre><code>function filter_textarea_simple_wpautop( $content, $field_id ) {
312
-
313
- /* only run the filter on the textarea with a field ID of my_textarea */
314
- if ( $field_id == \'my_textarea\' ) {
315
- return true;
316
- }
317
-
318
- return $content;
319
-
320
- }
321
- add_filter( \'ot_wpautop\', \'filter_textarea_simple_wpautop\', 10, 2 );</code></pre>';
322
-
323
- echo '<h4>'. __( 'Textblock', 'option-tree' ) . ':</h4>';
324
- echo '<p>' . __( 'The Textblock option type is used only on the Theme Option page. It will allow you to create & display HTML on your Theme Options page but has no title above the text block. You can then use the Textblock to add a more detailed set of instruction on how the options are used in your theme. You would NEVER use this in your themes template files as it does not save a value.', 'option-tree' ) . '</p>';
325
-
326
- echo '<h4>'. __( 'Textblock Titled', 'option-tree' ) . ':</h4>';
327
- echo '<p>' . __( 'The Textblock Titled option type is used only on the Theme Option page. It will allow you to create & display HTML on your Theme Options page and has a title above the text block. You can then use the Textblock Titled to add a more detailed set of instruction on how the options are used in your theme. You would NEVER use this in your themes template files as it does not save a value.', 'option-tree' ) . '</p>';
328
-
329
- echo '<h4>'. __( 'Typography', 'option-tree' ) . ':</h4>';
330
- echo '<p>' . __( 'The Typography option type is for adding typographic styles to your theme either dynamically via the CSS option type below or manually with <code>ot_get_option()</code>. Typography has filters that allow you to change the defaults. For example, you can filter on <code>ot_recognized_font_styles</code>, <code>ot_recognized_font_weights</code>, <code>ot_recognized_font_variants</code>, and <code>ot_recognized_font_families</code>. These filters allow you to fine tune the select lists for your specific CSS needs. The most important one though is <code>ot_recognized_font_families</code> as you can add your Google Fonts to create custom font stacks.', 'option-tree' ) . '</p>';
331
-
332
- echo '<p class="aside">' . __( 'This example would filter <code>ot_recognized_font_families</code> to build your own font stack. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
333
- echo '<pre><code>function filter_ot_recognized_font_families( $array, $field_id ) {
334
-
335
- /* only run the filter when the field ID is my_google_fonts_headings */
336
- if ( $field_id == \'my_google_fonts_headings\' ) {
337
- $array = array(
338
- \'sans-serif\' => \'sans-serif\',
339
- \'open-sans\' => \'"Open Sans", sans-serif\',
340
- \'droid-sans\' => \'"Droid Sans", sans-serif\'
341
- );
342
- }
343
-
344
- return $array;
345
-
346
- }
347
- add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 2 );</code></pre>';
348
-
349
- echo '<h4>'. __( 'Upload', 'option-tree' ) . ':</h4>';
350
- echo '<p>' . __( 'The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "Send to OptionTree" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You\'ll have to re-upload or FTP any media to your new server and change the URIs if necessary.', 'option-tree' ) . '</p>';
351
-
352
- echo '</div>';
353
-
354
- echo '</div>';
355
-
356
- }
357
-
358
- }
359
-
360
- /**
361
- * ot_get_option() option type.
362
- *
363
- * This is a callback function to display text about ot_get_option().
364
- *
365
- * @return string
366
- *
367
- * @access public
368
- * @since 2.0
369
- */
370
- if ( ! function_exists( 'ot_type_ot_get_option' ) ) {
371
-
372
- function ot_type_ot_get_option() {
373
-
374
- /* format setting outer wrapper */
375
- echo '<div class="format-setting type-textblock wide-desc">';
376
-
377
- /* description */
378
- echo '<div class="description">';
379
-
380
- echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
381
-
382
- echo '<p>' . __( 'This function returns a value from the "option_tree" array of saved values or the default value supplied. The returned value would be mixed. Meaning it could be a string, integer, boolean, or array.', 'option-tree' ) . '</p>';
383
-
384
- echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
385
-
386
- echo '<p><code>&lt;?php ot_get_option( $option_id, $default ); ?&gt;</code></p>';
387
-
388
- echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>';
389
-
390
- echo '<code>$option_id</code>';
391
-
392
- echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'required', 'option-tree' ) . '</em>) ' . __( 'Enter the options unique identifier.', 'option-tree' ) . '<br />' . __( 'Default:', 'option-tree' ) . ' <em>' . __( 'None', 'option-tree' ) . '</em></p>';
393
-
394
- echo '<code>$default</code>';
395
-
396
- echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Enter a default return value. This is just incase the request returns null.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': <em>' . __( 'None', 'option-tree' ) . '</em></p>';
397
-
398
- echo '</div>';
399
-
400
- echo '</div>';
401
-
402
- }
403
-
404
- }
405
-
406
- /**
407
- * get_option_tree() option type.
408
- *
409
- * This is a callback function to display text about get_option_tree().
410
- *
411
- * @return string
412
- *
413
- * @access public
414
- * @since 2.0
415
- */
416
- if ( ! function_exists( 'ot_type_get_option_tree' ) ) {
417
-
418
- function ot_type_get_option_tree() {
419
-
420
- /* format setting outer wrapper */
421
- echo '<div class="format-setting type-textblock wide-desc">';
422
-
423
- /* description */
424
- echo '<div class="description">';
425
-
426
- echo '<p class="deprecated">' . __( 'This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement.', 'option-tree' ) . '</p>';
427
-
428
- echo '<p>' . __( 'Use', 'option-tree' ) . '<code>ot_get_option()</code>' . __( 'instead', 'option-tree' ) . '.</p>';
429
-
430
- echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
431
-
432
- echo '<p>' . __( 'This function returns, or echos if asked, a value from the "option_tree" array of saved values.', 'option-tree' ) . '</p>';
433
-
434
- echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
435
-
436
- echo '<p><code>&lt;?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?&gt;</code></p>';
437
-
438
- echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>';
439
-
440
- echo '<code>$item_id</code>';
441
-
442
- echo '<p>(<em>' . __( 'string', 'option-tree' ) . '</em>) (<em>' . __( 'required', 'option-tree' ) . '</em>) ' . __( 'Enter a unique Option Key to get a returned value or array.', 'option-tree' ) . '<br />' . __( 'Default:', 'option-tree' ) . ' <em>' . __( 'None', 'option-tree' ) . '</em></p>';
443
-
444
- echo '<code>$options</code>';
445
-
446
- echo '<p>(<em>' . __( 'array', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Used to cut down on database queries in template files.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': <em>' . __( 'None', 'option-tree' ) . '</em></p>';
447
-
448
- echo '<code>$echo</code>';
449
-
450
- echo '<p>(<em>' . __( 'boolean', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Echo the output.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': FALSE</p>';
451
-
452
- echo '<code>$is_array</code>';
453
-
454
- echo '<p>(<em>' . __( 'boolean', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Used to indicate the $item_id is an array of values.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': FALSE</p>';
455
-
456
- echo '<code>$offset</code>';
457
-
458
- echo '<p>(<em>' . __( 'integer', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Numeric offset key for the $item_id array, -1 will return all values (an array starts at 0).', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': -1</p>';
459
-
460
- echo '</div>';
461
-
462
- echo '</div>';
463
-
464
- }
465
-
466
- }
467
-
468
- /**
469
- * Examples option type.
470
- *
471
- * @return string
472
- *
473
- * @access public
474
- * @since 2.0
475
- */
476
- if ( ! function_exists( 'ot_type_examples' ) ) {
477
-
478
- function ot_type_examples() {
479
-
480
- /* format setting outer wrapper */
481
- echo '<div class="format-setting type-textblock wide-desc">';
482
-
483
- /* description */
484
- echo '<div class="description">';
485
-
486
- echo '<p class="aside">' . __( 'If you\'re using the plugin version of OptionTree it is highly recommended to include a <code>function_exists</code> check in your code, as described in the examples below. If you\'ve integrated OptionTree directly into your themes root directory, you will <strong>not</strong> need to wrap your code with <code>function_exists</code>, as you\'re guaranteed to have the <code>ot_get_option()</code> function available.', 'option-tree' ) . '</p>';
487
-
488
- echo '<h4>' . __( 'String Examples', 'option-tree' ) . ':</h4>';
489
-
490
- echo '<p>' . __( 'Returns the value of <code>test_input</code>.', 'option-tree' ) . '</p>';
491
-
492
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
493
- $test_input = ot_get_option( \'test_input\' );
494
- }</code></pre>';
495
-
496
- echo '<p>' . __( 'Returns the value of <code>test_input</code>, but also has a default value if it returns empty.', 'option-tree' ) . '</p>';
497
-
498
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
499
- $test_input = ot_get_option( \'test_input\', \'default input value goes here.\' );
500
- }</code></pre>';
501
-
502
- echo '<h4>' . __( 'Array Examples', 'option-tree' ) . ':</h4>';
503
-
504
- echo '<p>' . __( 'Assigns the value of <code>navigation_ids</code> to the variable <code>$ids</code>. It then echos an unordered list of links (navigation) using <code>wp_list_pages()</code>.', 'option-tree' ) . '</p>';
505
-
506
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
507
- /* get an array of page id\'s */
508
- $ids = ot_get_option( \'navigation_ids\', array() );
509
-
510
- /* echo custom navigation using wp_list_pages() */
511
- if ( ! empty( $ids ) )
512
- echo \'&lt;ul&gt;\';
513
- wp_list_pages(
514
- array(
515
- \'include\' => $ids,
516
- \'title_li\' => \'\'
517
- )
518
- );
519
- echo \'&lt;/ul&gt;\';
520
- }
521
-
522
- }</code></pre>';
523
-
524
- echo '<p>' . __( 'The next two examples demonstrate how to use the <strong>Measurement</strong> option type. The Measurement option type is an array with two key/value pairs. The first is the value of measurement and the second is the unit of measurement.', 'option-tree' ) . '</p>';
525
-
526
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
527
- /* get the array */
528
- $measurement = ot_get_option( \'measurement_option_type_id\' );
529
-
530
- /* only echo values if they actually exist, else echo some default value */
531
- if ( isset( measurement[0] ) && $measurement[1] ) {
532
- echo $measurement[0].$measurement[1];
533
- } else {
534
- echo \'10px\';
535
- }
536
-
537
- }</code></pre>';
538
-
539
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
540
- /* get the array, and have a default just incase */
541
- $measurement = ot_get_option( \'measurement_option_type_id\', array( \'10\', \'px\' ) );
542
-
543
- /* implode array into a string value */
544
- if ( ! empty( measurement ) ) {
545
- echo implode( \'\', $measurement );
546
- }
547
-
548
- }</code></pre>';
549
-
550
- echo '<p>' . __( 'This example displays a very basic slider loop.', 'option-tree' ) . '</p>';
551
-
552
- echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
553
-
554
- /* get the slider array */
555
- $slides = ot_get_option( \'my_slider\', array() );
556
-
557
- if ( ! empty( $slides ) ) {
558
- foreach( $slides as $slide ) {
559
- echo \'
560
- &lt;li&gt;
561
- &lt;a href="\' . $slide[\'link\'] . \'"&gt;&lt;img src="\' . $slide[\'image\'] . \'" alt="\' . $slide[\'title\'] . \'" /&gt;&lt;/a&gt;
562
- &lt;div class="description">\' . $slide[\'description\'] . \'&lt;/div&gt;
563
- &lt;/li&gt;\';
564
- }
565
- }
566
-
567
- }</code></pre>';
568
-
569
- echo '</div>';
570
-
571
- echo '</div>';
572
-
573
- }
574
-
575
- }
576
-
577
- /**
578
- * Layouts Overview option type.
579
- *
580
- * @return string
581
- *
582
- * @access public
583
- * @since 2.0
584
- */
585
- if ( ! function_exists( 'ot_type_layouts_overview' ) ) {
586
-
587
- function ot_type_layouts_overview() {
588
-
589
- /* format setting outer wrapper */
590
- echo '<div class="format-setting type-textblock wide-desc">';
591
-
592
- /* description */
593
- echo '<div class="description">';
594
-
595
- echo '<h4>'. __( 'It\'s Super Simple', 'option-tree' ) . '</h4>';
596
-
597
- echo '<p>' . __( 'Layouts make your theme awesome! With theme options data that you can save/import/export you can package themes with different color variations, or make it easy to do A/B testing on text and so much more. Basically, you save a snapshot of your data as a layout.', 'option-tree' ) . '</p>';
598
-
599
- echo '<p>' . __( 'Once you have created all your different layouts, or theme variations, you can save them to a separate text file for repackaging with your theme. Alternatively, you could just make different variations for yourself and change your theme with the click of a button, all without deleting your previous options data.', 'option-tree' ) . '</p>';
600
-
601
- echo '<p class="aside">' . __( ' Adding a layout is ridiculously easy, follow these steps and you\'ll be on your way to having a WordPress super theme.', 'option-tree' ) . '</p>';
602
-
603
- echo '<h4>' . __( 'For Developers', 'option-tree' ) . ':</h4>';
604
- echo '<p>' . __( '', 'option-tree' ) . '</p>';
605
-
606
- echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>';
607
- echo '<ul class="docs-ul">';
608
- echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>';
609
- echo '<li>' . __( 'Enter a name for your layout in the text field and hit "Save Layouts", you\'ve created your first layout.', 'option-tree' ) . '</li>';
610
- echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>';
611
- echo '</ul>';
612
-
613
- echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>';
614
- echo '<ul class="docs-ul">';
615
- echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>';
616
- echo '<li>' . __( 'Click on the activate layout button in the actions list.', 'option-tree' ) . '</li>';
617
- echo '</ul>';
618
-
619
- echo '<h5>' . __( 'Deleting a Layout', 'option-tree' ) . ':</h5>';
620
- echo '<ul class="docs-ul">';
621
- echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>';
622
- echo '<li>' . __( 'Click on the delete layout button in the actions list.', 'option-tree' ) . '</li>';
623
- echo '</ul>';
624
-
625
- echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>';
626
- echo '<ul class="docs-ul">';
627
- echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
628
- echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>';
629
- echo '<li>' . __( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>';
630
- echo '<li>' . __( 'If you want to edit a new layout, first create it then save your theme options.', 'option-tree' ) . '</li>';
631
- echo '</ul>';
632
-
633
- echo '<h4>' . __( 'End-Users Mode', 'option-tree' ) . ':</h4>';
634
- echo '<p>' . __( '', 'option-tree' ) . '</p>';
635
-
636
- echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>';
637
- echo '<ul class="docs-ul">';
638
- echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
639
- echo '<li>' . __( 'Enter a name for your layout in the text field and hit "New Layout", you\'ve created your first layout.', 'option-tree' ) . '</li>';
640
- echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>';
641
- echo '</ul>';
642
-
643
- echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>';
644
- echo '<ul class="docs-ul">';
645
- echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
646
- echo '<li>' . __( 'Choose a layout from the select list and click the "Activate Layout" button.', 'option-tree' ) . '</li>';
647
- echo '</ul>';
648
-
649
- echo '<h5>' . __( 'Deleting a Layout', 'option-tree' ) . ':</h5>';
650
- echo '<ul class="docs-ul">';
651
- echo '<li>'. __( 'End-Users mode does not allow deleting layouts.', 'option-tree' ) . '</li>';
652
- echo '</ul>';
653
-
654
- echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>';
655
- echo '<ul class="docs-ul">';
656
- echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> tab.', 'option-tree' ) . '</li>';
657
- echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>';
658
- echo '<li>' . __( 'Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.', 'option-tree' ) . '</li>';
659
- echo '</ul>';
660
-
661
- echo '</div>';
662
-
663
- echo '</div>';
664
-
665
- }
666
-
667
- }
668
-
669
- /**
670
- * Meta Boxes option type.
671
- *
672
- * @return string
673
- *
674
- * @access public
675
- * @since 2.0
676
- */
677
- if ( ! function_exists( 'ot_type_meta_boxes' ) ) {
678
-
679
- function ot_type_meta_boxes() {
680
-
681
- /* format setting outer wrapper */
682
- echo '<div class="format-setting type-textblock wide-desc">';
683
-
684
- /* description */
685
- echo '<div class="description">';
686
-
687
- echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>';
688
-
689
- echo '<p>' . __( 'There are a few simple steps you need to take in order to use OptionTree\'s built in Meta Box API. In the code below I\'ll show you a basic demo of how to create your very own custom meta box using any number of the option types you have at your disposal. If you would like to see some demo code, there is a directory named <code>theme-mode</code> inside the <code>assets</code> directory that contains a file named <code>demo-meta-boxes.php</code> you can reference.', 'option-tree' ) . '</p>';
690
-
691
- echo '<p>' . __( 'It\'s important to note that Meta Boxes do not support WYSIWYG editors at this time and if you set one of your options to Textarea it will automatically revert to a Textarea Simple until a valid solution is found. WordPress released this statement regarding the wp_editor() function:', 'option-tree' ) . '</p>';
692
-
693
- echo '<blockquote>' . __( 'Once instantiated, the WYSIWYG editor cannot be moved around in the DOM. What this means in practical terms, is that you cannot put it in meta-boxes that can be dragged and placed elsewhere on the page.', 'option-tree' ) . '</blockquote>';
694
-
695
- echo '<h5>' . __( 'Create and include your custom meta boxes file.', 'option-tree' ) . '</h5>';
696
- echo '<ul class="docs-ul">';
697
- echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>meta-boxes.php</code>.', 'option-tree' ) . '</li>';
698
- echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>meta-boxes.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>';
699
- echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
700
- echo '</ul>';
701
-
702
- echo '<pre><code>/**
703
- * Meta Boxes
704
- */
705
- load_template( trailingslashit( get_template_directory() ) . \'includes/meta-boxes.php\' );
706
- </code></pre>';
707
-
708
- echo '<ul class="docs-ul">';
709
- echo '<li>' . __( 'Add a variation of the following code to your <code>meta-boxes.php</code>. You\'ll obviously need to fill it in with all your custom array values. It\'s important to note here that we use the <code>admin_init</code> filter because if you were to call the <code>ot_register_meta_box</code> function before OptionTree was loaded the sky would fall on your head.', 'option-tree' ) . '</li>';
710
- echo '</ul>';
711
-
712
- echo "<pre><code>/**
713
- * Initialize the meta boxes.
714
- */
715
- add_action( 'admin_init', 'custom_meta_boxes' );
716
-
717
- function custom_meta_boxes() {
718
-
719
- &#36;my_meta_box = array(
720
- 'id' => 'my_meta_box',
721
- 'title' => 'My Meta Box',
722
- 'desc' => '',
723
- 'pages' => array( 'post' ),
724
- 'context' => 'normal',
725
- 'priority' => 'high',
726
- 'fields' => array(
727
- array(
728
- 'id' => 'background',
729
- 'label' => 'Background',
730
- 'desc' => '',
731
- 'std' => '',
732
- 'type' => 'background',
733
- 'class' => '',
734
- 'choices' => array()
735
- )
736
- )
737
- );
738
-
739
- ot_register_meta_box( &#36;my_meta_box );
740
-
741
- }</code></pre>";
742
-
743
- echo '</div>';
744
-
745
- echo '</div>';
746
-
747
- }
748
-
749
- }
750
-
751
- /**
752
- * Theme Mode option type.
753
- *
754
- * @return string
755
- *
756
- * @access public
757
- * @since 2.0
758
- */
759
- if ( ! function_exists( 'ot_type_theme_mode' ) ) {
760
-
761
- function ot_type_theme_mode() {
762
-
763
- /* format setting outer wrapper */
764
- echo '<div class="format-setting type-textblock wide-desc">';
765
-
766
- /* description */
767
- echo '<div class="description">';
768
-
769
- echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>';
770
-
771
- echo '<p>' . __( 'There are a few simple steps you need to take in order to use OptionTree as a theme included module. In the code below I\'ll show you a basic demo of how to include the entire plugin as a module, which will allow you to have the most up-to-date version of OptionTree without ever needing to hack the core of the plugin. If you would like to see some demo code, there is a directory named <code>theme-mode</code> inside the <code>assets</code> directory that contains a file named <code>demo-theme-options.php</code> you can reference.', 'option-tree' ) . '</p>';
772
-
773
- echo '<h5>' . __( 'Step 1: Include the plugin & turn on theme mode.', 'option-tree' ) . '</h5>';
774
- echo '<ul class="docs-ul">';
775
- echo '<li>'. __( 'Download the latest version of <a href="http://wordpress.org/extend/plugins/option-tree/" rel="nofollow" target="_blank">OptionTree</a>.', 'option-tree' ) . '</li>';
776
- echo '<li>' . __( 'Unpack the ZIP archive.', 'option-tree' ) . '</li>';
777
- echo '<li>' . __( 'Put the <code>option-tree</code> directory in the root of your theme. For example, the server path would be <code>/wp-content/themes/theme-name/option-tree/</code>.', 'option-tree' ) . '</li>';
778
- echo '<li>' . __( 'Add the following code to the beginning of your <code>functions.php</code>.', 'option-tree' ) . '</li>';
779
- echo '</ul>';
780
-
781
- echo '<pre><code>/**
782
- * Optional: set \'ot_show_pages\' filter to false.
783
- * This will hide the settings & documentation pages.
784
- */
785
- add_filter( \'ot_show_pages\', \'__return_false\' );
786
-
787
- /**
788
- * Optional: set \'ot_show_new_layout\' filter to false.
789
- * This will hide the "New Layout" section on the Theme Options page.
790
- */
791
- add_filter( \'ot_show_new_layout\', \'__return_false\' );
792
-
793
- /**
794
- * Required: set \'ot_theme_mode\' filter to true.
795
- */
796
- add_filter( \'ot_theme_mode\', \'__return_true\' );
797
-
798
- /**
799
- * Required: include OptionTree.
800
- */
801
- load_template( trailingslashit( get_template_directory() ) . \'option-tree/ot-loader.php\' );
802
- </code></pre>';
803
-
804
- echo '<p class="aside">' . __( 'It\'s that simple! You now have OptionTree built into your theme and anytime there\'s an update to the plugin you just replace the old version and you\'re good to go..', 'option-tree' ) . '</p>';
805
-
806
- echo '<h5>' . __( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>';
807
- echo '<ul class="docs-ul">';
808
- echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>theme-options.php</code>, or use the built in file export to create it for you. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ) . '</li>';
809
- echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>theme-options.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>';
810
- echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
811
- echo '</ul>';
812
-
813
- echo '<pre><code>/**
814
- * Theme Options
815
- */
816
- load_template( trailingslashit( get_template_directory() ) . \'includes/theme-options.php\' );
817
- </code></pre>';
818
-
819
- echo '<ul class="docs-ul">';
820
- echo '<li>' . __( 'Add a variation of the following code to your <code>theme-options.php</code>. You\'ll obviously need to fill it in with all your custom array values for contextual help (optional), sections (required), and settings (required).', 'option-tree' ) . '</li>';
821
- echo '</ul>';
822
-
823
- echo '<p>' . __( 'The code below is a boilerplate to get your started. For a full list of the available option types click the "Option Types" tab above. Also a quick note, you don\'t need to put OptionTree in theme mode to manually create options but you will want to hide the docs and settings as each time you load the admin area the settings be written over with the code below if they\'ve changed in any way. However, this ensures your settings do not get tampered with by the end-user.', 'option-tree' ) . '</p>';
824
-
825
- echo "<pre><code>/**
826
- * Initialize the options before anything else.
827
- */
828
- add_action( 'admin_init', 'custom_theme_options', 1 );
829
-
830
- /**
831
- * Build the custom settings & update OptionTree.
832
- */
833
- function custom_theme_options() {
834
- /**
835
- * Get a copy of the saved settings array.
836
- */
837
- &#36;saved_settings = get_option( 'option_tree_settings', array() );
838
-
839
- /**
840
- * Custom settings array that will eventually be
841
- * passes to the OptionTree Settings API Class.
842
- */
843
- &#36;custom_settings = array(
844
- 'contextual_help' => array(
845
- 'content' => array(
846
- array(
847
- 'id' => 'general_help',
848
- 'title' => 'General',
849
- 'content' => '&lt;p&gt;Help content goes here!&lt;/p&gt;'
850
- )
851
- ),
852
- 'sidebar' => '&lt;p&gt;Sidebar content goes here!&lt;/p&gt;',
853
- ),
854
- 'sections' => array(
855
- array(
856
- 'id' => 'general',
857
- 'title' => 'General'
858
- )
859
- ),
860
- 'settings' => array(
861
- array(
862
- 'id' => 'my_checkbox',
863
- 'label' => 'Checkbox',
864
- 'desc' => '',
865
- 'std' => '',
866
- 'type' => 'checkbox',
867
- 'section' => 'general',
868
- 'class' => '',
869
- 'choices' => array(
870
- array(
871
- 'value' => 'yes',
872
- 'label' => 'Yes'
873
- )
874
- )
875
- ),
876
- array(
877
- 'id' => 'my_layout',
878
- 'label' => 'Layout',
879
- 'desc' => 'Choose a layout for your theme',
880
- 'std' => 'right-sidebar',
881
- 'type' => 'radio-image',
882
- 'section' => 'general',
883
- 'class' => '',
884
- 'choices' => array(
885
- array(
886
- 'value' => 'left-sidebar',
887
- 'label' => 'Left Sidebar',
888
- 'src' => OT_URL . '/assets/images/layout/left-sidebar.png'
889
- ),
890
- array(
891
- 'value' => 'right-sidebar',
892
- 'label' => 'Right Sidebar',
893
- 'src' => OT_URL . '/assets/images/layout/right-sidebar.png'
894
- ),
895
- array(
896
- 'value' => 'full-width',
897
- 'label' => 'Full Width (no sidebar)',
898
- 'src' => OT_URL . '/assets/images/layout/full-width.png'
899
- ),
900
- array(
901
- 'value' => 'dual-sidebar',
902
- 'label' => __( 'Dual Sidebar', 'option-tree' ),
903
- 'src' => OT_URL . '/assets/images/layout/dual-sidebar.png'
904
- ),
905
- array(
906
- 'value' => 'left-dual-sidebar',
907
- 'label' => __( 'Left Dual Sidebar', 'option-tree' ),
908
- 'src' => OT_URL . '/assets/images/layout/left-dual-sidebar.png'
909
- ),
910
- array(
911
- 'value' => 'right-dual-sidebar',
912
- 'label' => __( 'Right Dual Sidebar', 'option-tree' ),
913
- 'src' => OT_URL . '/assets/images/layout/right-dual-sidebar.png'
914
- )
915
- )
916
- ),
917
- array(
918
- 'id' => 'my_slider',
919
- 'label' => 'Images',
920
- 'desc' => '',
921
- 'std' => '',
922
- 'type' => 'list-item',
923
- 'section' => 'general',
924
- 'class' => '',
925
- 'choices' => array(),
926
- 'settings' => array(
927
- array(
928
- 'id' => 'slider_image',
929
- 'label' => 'Image',
930
- 'desc' => '',
931
- 'std' => '',
932
- 'type' => 'upload',
933
- 'class' => '',
934
- 'choices' => array()
935
- ),
936
- array(
937
- 'id' => 'slider_link',
938
- 'label' => 'Link to Post',
939
- 'desc' => 'Enter the posts url.',
940
- 'std' => '',
941
- 'type' => 'text',
942
- 'class' => '',
943
- 'choices' => array()
944
- ),
945
- array(
946
- 'id' => 'slider_description',
947
- 'label' => 'Description',
948
- 'desc' => 'This text is used to add fancy captions in the slider.',
949
- 'std' => '',
950
- 'type' => 'textarea',
951
- 'class' => '',
952
- 'choices' => array()
953
- )
954
- )
955
- )
956
- )
957
- );
958
-
959
- /* settings are not the same update the DB */
960
- if ( &#36;saved_settings !== &#36;custom_settings ) {
961
- update_option( 'option_tree_settings', &#36;custom_settings );
962
- }
963
-
964
- }
965
- </code></pre>";
966
-
967
- echo '</div>';
968
-
969
- echo '</div>';
970
-
971
- }
972
-
973
- }
974
-
975
- /* End of file ot-functions-docs-page.php */
976
- /* Location: ./includes/ot-functions-docs-page.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-option-types.php DELETED
@@ -1,1886 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * Functions used to build each option type.
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Builds the HTML for each of the available option types by calling those
13
- * function with call_user_func and passing the arguments to the second param.
14
- *
15
- * All fields are required!
16
- *
17
- * @param array $args The array of arguments are as follows:
18
- * @param string $type Type of option.
19
- * @param string $field_id The field ID.
20
- * @param string $field_name The field Name.
21
- * @param mixed $field_value The field value is a string or an array of values.
22
- * @param string $field_desc The field description.
23
- * @param string $field_std The standard value.
24
- * @param string $field_class Extra CSS classes.
25
- * @param array $field_choices The array of option choices.
26
- * @param array $field_settings The array of settings for a list item.
27
- * @return string
28
- *
29
- * @access public
30
- * @since 2.0
31
- */
32
- if ( ! function_exists( 'ot_display_by_type' ) ) {
33
-
34
- function ot_display_by_type( $args = array() ) {
35
-
36
- /* allow filters to be executed on the array */
37
- $args = apply_filters( 'ot_display_by_type', $args );
38
-
39
- /* build the function name */
40
- $function_name_by_type = str_replace( '-', '_', 'ot_type_' . $args['type'] );
41
-
42
- /* call the function & pass in arguments array */
43
- if ( function_exists( $function_name_by_type ) ) {
44
- call_user_func( $function_name_by_type, $args );
45
- } else {
46
- echo '<p>' . __( 'Sorry, this function does not exist', 'option-tree' ) . '</p>';
47
- }
48
-
49
- }
50
-
51
- }
52
-
53
- /**
54
- * Background option type.
55
- *
56
- * See @ot_display_by_type to see the full list of available arguments.
57
- *
58
- * @param array An array of arguments.
59
- * @return string
60
- *
61
- * @access public
62
- * @since 2.0
63
- */
64
- if ( ! function_exists( 'ot_type_background' ) ) {
65
-
66
- function ot_type_background( $args = array() ) {
67
-
68
- /* turns arguments array into variables */
69
- extract( $args );
70
-
71
- /* verify a description */
72
- $has_desc = $field_desc ? true : false;
73
-
74
- /* format setting outer wrapper */
75
- echo '<div class="format-setting type-background ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
76
-
77
- /* description */
78
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
79
-
80
- /* format setting inner wrapper */
81
- echo '<div class="format-setting-inner">';
82
-
83
- /* build background colorpicker */
84
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
85
-
86
- /* colorpicker JS */
87
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
88
-
89
- /* set background color */
90
- $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : '';
91
-
92
- /* set border color */
93
- $border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color;
94
-
95
- /* input */
96
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-color]" id="' . $field_id . '-picker" value="' . $background_color . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" />';
97
-
98
- echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>';
99
-
100
- echo '</div>';
101
-
102
- echo '<div class="select-group">';
103
-
104
- /* build background repeat */
105
- $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : '';
106
- echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
107
- echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>';
108
- foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) {
109
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>';
110
- }
111
- echo '</select>';
112
-
113
- /* build background attachment */
114
- $background_attachment = isset( $field_value['background-attachment'] ) ? esc_attr( $field_value['background-attachment'] ) : '';
115
- echo '<select name="' . esc_attr( $field_name ) . '[background-attachment]" id="' . esc_attr( $field_id ) . '-attachment" class="option-tree-ui-select ' . $field_class . '">';
116
- echo '<option value="">' . __( 'background-attachment', 'option-tree' ) . '</option>';
117
- foreach ( ot_recognized_background_attachment( $field_id ) as $key => $value ) {
118
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_attachment, $key, false ) . '>' . esc_attr( $value ) . '</option>';
119
- }
120
- echo '</select>';
121
-
122
- /* build background position */
123
- $background_position = isset( $field_value['background-position'] ) ? esc_attr( $field_value['background-position'] ) : '';
124
- echo '<select name="' . esc_attr( $field_name ) . '[background-position]" id="' . esc_attr( $field_id ) . '-position" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
125
- echo '<option value="">' . __( 'background-position', 'option-tree' ) . '</option>';
126
- foreach ( ot_recognized_background_position( $field_id ) as $key => $value ) {
127
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_position, $key, false ) . '>' . esc_attr( $value ) . '</option>';
128
- }
129
- echo '</select>';
130
-
131
- echo '</div>';
132
-
133
- /* build background image */
134
- echo '<div class="option-tree-ui-upload-parent">';
135
-
136
- /* input */
137
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-image]" id="' . esc_attr( $field_id ) . '" value="' . ( isset( $field_value['background-image'] ) ? esc_attr( $field_value['background-image'] ) : '' ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
138
-
139
- /* add media button */
140
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button blue light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon upload">' . __( 'Add Media', 'option-tree' ) . '</span></a>';
141
-
142
- echo '</div>';
143
-
144
- /* media */
145
- if ( isset( $field_value['background-image'] ) && $field_value['background-image'] !== '' ) {
146
-
147
- echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
148
-
149
- if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value['background-image'] ) )
150
- echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value['background-image'] ) . '" alt="" /></div>';
151
-
152
- echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon trash-can">' . __( 'Remove Media', 'option-tree' ) . '</span></a>';
153
-
154
- echo '</div>';
155
-
156
- }
157
-
158
- echo '</div>';
159
-
160
- echo '</div>';
161
-
162
- }
163
-
164
- }
165
-
166
- /**
167
- * Category Checkbox option type.
168
- *
169
- * See @ot_display_by_type to see the full list of available arguments.
170
- *
171
- * @param array An array of arguments.
172
- * @return string
173
- *
174
- * @access public
175
- * @since 2.0
176
- */
177
- if ( ! function_exists( 'ot_type_category_checkbox' ) ) {
178
-
179
- function ot_type_category_checkbox( $args = array() ) {
180
-
181
- /* turns arguments array into variables */
182
- extract( $args );
183
-
184
- /* verify a description */
185
- $has_desc = $field_desc ? true : false;
186
-
187
- /* format setting outer wrapper */
188
- echo '<div class="format-setting type-category-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
189
-
190
- /* description */
191
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
192
-
193
- /* format setting inner wrapper */
194
- echo '<div class="format-setting-inner">';
195
-
196
- /* get category array */
197
- $categories = get_categories( array( 'hide_empty' => false ) );
198
-
199
- /* build categories */
200
- if ( ! empty( $categories ) ) {
201
- foreach ( $categories as $category ) {
202
- echo '<p>';
203
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $category->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '" value="' . esc_attr( $category->term_id ) . '" ' . ( isset( $field_value[$category->term_id] ) ? checked( $field_value[$category->term_id], $category->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
204
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '">' . esc_attr( $category->name ) . '</label>';
205
- echo '</p>';
206
- }
207
- } else {
208
- echo '<p>' . __( 'No Categories Found', 'option-tree' ) . '</p>';
209
- }
210
-
211
- echo '</div>';
212
-
213
- echo '</div>';
214
-
215
- }
216
-
217
- }
218
-
219
- /**
220
- * Category Select option type.
221
- *
222
- * See @ot_display_by_type to see the full list of available arguments.
223
- *
224
- * @param array An array of arguments.
225
- * @return string
226
- *
227
- * @access public
228
- * @since 2.0
229
- */
230
- if ( ! function_exists( 'ot_type_category_select' ) ) {
231
-
232
- function ot_type_category_select( $args = array() ) {
233
-
234
- /* turns arguments array into variables */
235
- extract( $args );
236
-
237
- /* verify a description */
238
- $has_desc = $field_desc ? true : false;
239
-
240
- /* format setting outer wrapper */
241
- echo '<div class="format-setting type-category-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
242
-
243
- /* description */
244
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
245
-
246
- /* format setting inner wrapper */
247
- echo '<div class="format-setting-inner">';
248
-
249
- /* build category */
250
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
251
-
252
- /* get category array */
253
- $categories = get_categories( array( 'hide_empty' => false ) );
254
-
255
- /* has cats */
256
- if ( ! empty( $categories ) ) {
257
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
258
- foreach ( $categories as $category ) {
259
- echo '<option value="' . esc_attr( $category->term_id ) . '"' . selected( $field_value, $category->term_id, false ) . '>' . esc_attr( $category->name ) . '</option>';
260
- }
261
- } else {
262
- echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
263
- }
264
- echo '</select>';
265
-
266
- echo '</div>';
267
-
268
- echo '</div>';
269
-
270
- }
271
-
272
- }
273
-
274
- /**
275
- * Checkbox option type.
276
- *
277
- * See @ot_display_by_type to see the full list of available arguments.
278
- *
279
- * @param array An array of arguments.
280
- * @return string
281
- *
282
- * @access public
283
- * @since 2.0
284
- */
285
- if ( ! function_exists( 'ot_type_checkbox' ) ) {
286
-
287
- function ot_type_checkbox( $args = array() ) {
288
-
289
- /* turns arguments array into variables */
290
- extract( $args );
291
-
292
- /* verify a description */
293
- $has_desc = $field_desc ? true : false;
294
-
295
- /* format setting outer wrapper */
296
- echo '<div class="format-setting type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
297
-
298
- /* description */
299
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
300
-
301
- /* format setting inner wrapper */
302
- echo '<div class="format-setting-inner">';
303
-
304
- /* build checkbox */
305
- foreach ( (array) $field_choices as $key => $choice ) {
306
- if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
307
- echo '<p>';
308
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $key ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '" ' . ( isset( $field_value[$key] ) ? checked( $field_value[$key], $choice['value'], false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
309
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label>';
310
- echo '</p>';
311
- }
312
- }
313
-
314
- echo '</div>';
315
-
316
- echo '</div>';
317
-
318
- }
319
-
320
- }
321
-
322
- /**
323
- * Colorpicker option type.
324
- *
325
- * See @ot_display_by_type to see the full list of available arguments.
326
- *
327
- * @param array An array of arguments.
328
- * @return string
329
- *
330
- * @access public
331
- * @since 2.0
332
- */
333
- if ( ! function_exists( 'ot_type_colorpicker' ) ) {
334
-
335
- function ot_type_colorpicker( $args = array() ) {
336
-
337
- /* turns arguments array into variables */
338
- extract( $args );
339
-
340
- /* verify a description */
341
- $has_desc = $field_desc ? true : false;
342
-
343
- /* format setting outer wrapper */
344
- echo '<div class="format-setting type-colorpicker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
345
-
346
- /* description */
347
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
348
-
349
- /* format setting inner wrapper */
350
- echo '<div class="format-setting-inner">';
351
-
352
- /* build colorpicker */
353
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
354
-
355
- /* colorpicker JS */
356
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
357
-
358
- /* input */
359
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" />';
360
-
361
- /* set border color */
362
- $border_color = in_array( $field_value, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : esc_attr( $field_value );
363
-
364
- echo '<div id="cp_' . esc_attr( $field_id ) . '" class="cp_box"' . ( $field_value ? " style='background-color:" . esc_attr( $field_value ) . "; border-color:$border_color;'" : '' ) . '></div>';
365
-
366
- echo '</div>';
367
-
368
- echo '</div>';
369
-
370
- echo '</div>';
371
-
372
- }
373
-
374
- }
375
-
376
- /**
377
- * CSS option type.
378
- *
379
- * See @ot_display_by_type to see the full list of available arguments.
380
- *
381
- * @param array An array of arguments.
382
- * @return string
383
- *
384
- * @access public
385
- * @since 2.0
386
- */
387
- if ( ! function_exists( 'ot_type_css' ) ) {
388
-
389
- function ot_type_css( $args = array() ) {
390
-
391
- /* turns arguments array into variables */
392
- extract( $args );
393
-
394
- /* verify a description */
395
- $has_desc = $field_desc ? true : false;
396
-
397
- /* format setting outer wrapper */
398
- echo '<div class="format-setting type-css simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
399
-
400
- /* description */
401
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
402
-
403
- /* format setting inner wrapper */
404
- echo '<div class="format-setting-inner">';
405
-
406
- /* build textarea for CSS */
407
- echo '<textarea class="textarea ' . esc_attr( $field_class ) . '" rows="' . esc_attr( $field_rows ) . '" cols="40" name="' . esc_attr( $field_name ) .'" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</textarea>';
408
-
409
- echo '</div>';
410
-
411
- echo '</div>';
412
-
413
- }
414
-
415
- }
416
-
417
- /**
418
- * Custom Post Type Checkbox option type.
419
- *
420
- * See @ot_display_by_type to see the full list of available arguments.
421
- *
422
- * @param array An array of arguments.
423
- * @return string
424
- *
425
- * @access public
426
- * @since 2.0
427
- */
428
- if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
429
-
430
- function ot_type_custom_post_type_checkbox( $args = array() ) {
431
-
432
- /* turns arguments array into variables */
433
- extract( $args );
434
-
435
- /* verify a description */
436
- $has_desc = $field_desc ? true : false;
437
-
438
- /* format setting outer wrapper */
439
- echo '<div class="format-setting type-custom-post-type-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
440
-
441
- /* description */
442
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
443
-
444
- /* format setting inner wrapper */
445
- echo '<div class="format-setting-inner">';
446
-
447
- /* setup the post types */
448
- $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
449
-
450
- /* query posts array */
451
- $query = new WP_Query( apply_filters( 'ot_type_custom_post_type_checkbox_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
452
-
453
- /* has posts */
454
- if ( $query->have_posts() ) {
455
- while ( $query->have_posts() ) {
456
- $query->the_post();
457
- echo '<p>';
458
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
459
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . get_the_title() . '</label>';
460
- echo '</p>';
461
- }
462
- } else {
463
- echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
464
- }
465
-
466
- echo '</div>';
467
-
468
- echo '</div>';
469
-
470
- }
471
-
472
- }
473
-
474
- /**
475
- * Custom Post Type Select option type.
476
- *
477
- * See @ot_display_by_type to see the full list of available arguments.
478
- *
479
- * @param array An array of arguments.
480
- * @return string
481
- *
482
- * @access public
483
- * @since 2.0
484
- */
485
- if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
486
-
487
- function ot_type_custom_post_type_select( $args = array() ) {
488
-
489
- /* turns arguments array into variables */
490
- extract( $args );
491
-
492
- /* verify a description */
493
- $has_desc = $field_desc ? true : false;
494
-
495
- /* format setting outer wrapper */
496
- echo '<div class="format-setting type-custom-post-type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
497
-
498
- /* description */
499
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
500
-
501
- /* format setting inner wrapper */
502
- echo '<div class="format-setting-inner">';
503
-
504
- /* build category */
505
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
506
-
507
- /* setup the post types */
508
- $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
509
-
510
- /* query posts array */
511
- $query = new WP_Query( apply_filters( 'ot_type_custom_post_type_select_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
512
-
513
- /* has posts */
514
- if ( $query->have_posts() ) {
515
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
516
- while ( $query->have_posts() ) {
517
- $query->the_post();
518
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
519
- }
520
- } else {
521
- echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
522
- }
523
- echo '</select>';
524
-
525
- echo '</div>';
526
-
527
- echo '</div>';
528
-
529
- }
530
-
531
- }
532
-
533
- /**
534
- * List Item option type.
535
- *
536
- * See @ot_display_by_type to see the full list of available arguments.
537
- *
538
- * @param array An array of arguments.
539
- * @return string
540
- *
541
- * @access public
542
- * @since 2.0
543
- */
544
- if ( ! function_exists( 'ot_type_list_item' ) ) {
545
-
546
- function ot_type_list_item( $args = array() ) {
547
-
548
- /* turns arguments array into variables */
549
- extract( $args );
550
-
551
- /* verify a description */
552
- $has_desc = $field_desc ? true : false;
553
-
554
- /* format setting outer wrapper */
555
- echo '<div class="format-setting type-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
556
-
557
- /* description */
558
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
559
-
560
- /* format setting inner wrapper */
561
- echo '<div class="format-setting-inner">';
562
-
563
- /* pass the settings array arround */
564
- echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
565
-
566
- /**
567
- * settings pages have array wrappers like 'option_tree'.
568
- * So we need that value to create a proper array to save to.
569
- * This is only for NON metaboxes settings.
570
- */
571
- if ( ! isset( $get_option ) )
572
- $get_option = '';
573
-
574
- /* build list items */
575
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
576
-
577
- if ( is_array( $field_value ) && ! empty( $field_value ) ) {
578
-
579
- foreach( $field_value as $key => $list_item ) {
580
-
581
- echo '<li class="ui-state-default list-list-item">';
582
- ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
583
- echo '</li>';
584
-
585
- }
586
-
587
- }
588
-
589
- echo '</ul>';
590
-
591
- /* button */
592
- echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button blue right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
593
-
594
- /* description */
595
- echo '<div class="list-item-description">' . apply_filters( 'ot_list_item_description', __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ), $field_id ) . '</div>';
596
-
597
- echo '</div>';
598
-
599
- echo '</div>';
600
-
601
- }
602
-
603
- }
604
-
605
- /**
606
- * Measurement option type.
607
- *
608
- * See @ot_display_by_type to see the full list of available arguments.
609
- *
610
- * @param array An array of arguments.
611
- * @return string
612
- *
613
- * @access public
614
- * @since 2.0
615
- */
616
- if ( ! function_exists( 'ot_type_measurement' ) ) {
617
-
618
- function ot_type_measurement( $args = array() ) {
619
-
620
- /* turns arguments array into variables */
621
- extract( $args );
622
-
623
- /* verify a description */
624
- $has_desc = $field_desc ? true : false;
625
-
626
- /* format setting outer wrapper */
627
- echo '<div class="format-setting type-measurement ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
628
-
629
- /* description */
630
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
631
-
632
- /* format setting inner wrapper */
633
- echo '<div class="format-setting-inner">';
634
-
635
- echo '<div class="option-tree-ui-measurement-input-wrap">';
636
-
637
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[0]" id="' . esc_attr( $field_id ) . '-0" value="' . ( isset( $field_value[0] ) ? esc_attr( $field_value[0] ) : '' ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" />';
638
-
639
- echo '</div>';
640
-
641
- /* build measurement */
642
- echo '<select name="' . esc_attr( $field_name ) . '[1]" id="' . esc_attr( $field_id ) . '-1" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
643
-
644
- echo '<option value="">&nbsp;--&nbsp;</option>';
645
-
646
- foreach ( ot_measurement_unit_types( $field_id ) as $unit ) {
647
- echo '<option value="' . esc_attr( $unit ) . '"' . selected( $field_value[1], $unit, false ) . '>' . esc_attr( $unit ) . '</option>';
648
- }
649
-
650
- echo '</select>';
651
-
652
- echo '</div>';
653
-
654
- echo '</div>';
655
-
656
- }
657
-
658
- }
659
-
660
- /**
661
- * Numeric Slider option type.
662
- *
663
- * See @ot_display_by_type to see the full list of available arguments.
664
- *
665
- * @param array An array of arguments.
666
- * @return string
667
- *
668
- * @access public
669
- * @since 2.1
670
- */
671
- if( ! function_exists( 'ot_type_numeric_slider' ) ) {
672
-
673
- function ot_type_numeric_slider( $args = array() ) {
674
-
675
- /* turns arguments array into variables */
676
- extract( $args );
677
-
678
- /* verify a description */
679
- $has_desc = $field_desc ? true : false;
680
-
681
- $_options = explode( ',', $field_min_max_step );
682
- $min = isset( $_options[0] ) ? $_options[0] : 0;
683
- $max = isset( $_options[1] ) ? $_options[1] : 100;
684
- $step = isset( $_options[2] ) ? $_options[2] : 1;
685
-
686
- /* format setting outer wrapper */
687
- echo '<div class="format-setting type-numeric-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
688
-
689
- /* description */
690
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
691
-
692
- /* format setting inner wrapper */
693
- echo '<div class="format-setting-inner">';
694
-
695
- echo '<div class="ot-numeric-slider-wrap">';
696
-
697
- echo '<input type="hidden" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="ot-numeric-slider-hidden-input" value="' . esc_attr( $field_value ) . '" data-min="' . esc_attr( $min ) . '" data-max="' . esc_attr( $max ) . '" data-step="' . esc_attr( $step ) . '">';
698
-
699
- echo '<input type="text" class="ot-numeric-slider-helper-input widefat option-tree-ui-input" value="' . esc_attr( $field_value ) . '" readonly>';
700
-
701
- echo '<div id="ot_numeric_slider_' . esc_attr( $field_id ) . '" class="ot-numeric-slider"></div>';
702
-
703
- echo '</div>';
704
-
705
- echo '</div>';
706
-
707
- echo '</div>';
708
- }
709
-
710
- }
711
-
712
- /**
713
- * Page Checkbox option type.
714
- *
715
- * See @ot_display_by_type to see the full list of available arguments.
716
- *
717
- * @param array An array of arguments.
718
- * @return string
719
- *
720
- * @access public
721
- * @since 2.0
722
- */
723
- if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
724
-
725
- function ot_type_page_checkbox( $args = array() ) {
726
-
727
- /* turns arguments array into variables */
728
- extract( $args );
729
-
730
- /* verify a description */
731
- $has_desc = $field_desc ? true : false;
732
-
733
- /* format setting outer wrapper */
734
- echo '<div class="format-setting type-page-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
735
-
736
- /* description */
737
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
738
-
739
- /* format setting inner wrapper */
740
- echo '<div class="format-setting-inner">';
741
-
742
- /* query pages array */
743
- $query = new WP_Query( apply_filters( 'ot_type_page_checkbox_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
744
-
745
- /* has pages */
746
- if ( $query->have_posts() ) {
747
- while ( $query->have_posts() ) {
748
- $query->the_post();
749
- echo '<p>';
750
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
751
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . get_the_title() . '</label>';
752
- echo '</p>';
753
- }
754
- } else {
755
- echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
756
- }
757
-
758
- echo '</div>';
759
-
760
- echo '</div>';
761
-
762
- }
763
-
764
- }
765
-
766
- /**
767
- * Page Select option type.
768
- *
769
- * See @ot_display_by_type to see the full list of available arguments.
770
- *
771
- * @param array An array of arguments.
772
- * @return string
773
- *
774
- * @access public
775
- * @since 2.0
776
- */
777
- if ( ! function_exists( 'ot_type_page_select' ) ) {
778
-
779
- function ot_type_page_select( $args = array() ) {
780
-
781
- /* turns arguments array into variables */
782
- extract( $args );
783
-
784
- /* verify a description */
785
- $has_desc = $field_desc ? true : false;
786
-
787
- /* format setting outer wrapper */
788
- echo '<div class="format-setting type-page-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
789
-
790
- /* description */
791
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
792
-
793
- /* format setting inner wrapper */
794
- echo '<div class="format-setting-inner">';
795
-
796
- /* build page select */
797
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
798
-
799
- /* query pages array */
800
- $query = new WP_Query( apply_filters( 'ot_type_page_select_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
801
-
802
- /* has pages */
803
- if ( $query->have_posts() ) {
804
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
805
- while ( $query->have_posts() ) {
806
- $query->the_post();
807
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
808
- }
809
- } else {
810
- echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
811
- }
812
- echo '</select>';
813
-
814
- echo '</div>';
815
-
816
- echo '</div>';
817
-
818
- }
819
-
820
- }
821
-
822
- /**
823
- * List Item option type.
824
- *
825
- * See @ot_display_by_type to see the full list of available arguments.
826
- *
827
- * @param array An array of arguments.
828
- * @return string
829
- *
830
- * @access public
831
- * @since 2.0
832
- */
833
- if ( ! function_exists( 'ot_type_slider' ) ) {
834
-
835
- function ot_type_slider( $args = array() ) {
836
-
837
- /* turns arguments array into variables */
838
- extract( $args );
839
-
840
- /* verify a description */
841
- $has_desc = $field_desc ? true : false;
842
-
843
- /* format setting outer wrapper */
844
- echo '<div class="format-setting type-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
845
-
846
- /* description */
847
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
848
-
849
- /* format setting inner wrapper */
850
- echo '<div class="format-setting-inner">';
851
-
852
- /* pass the settings array arround */
853
- echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
854
-
855
- /**
856
- * settings pages have array wrappers like 'option_tree'.
857
- * So we need that value to create a proper array to save to.
858
- * This is only for NON metaboxes settings.
859
- */
860
- if ( ! isset( $get_option ) )
861
- $get_option = '';
862
-
863
- /* build list items */
864
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
865
-
866
- if ( is_array( $field_value ) && ! empty( $field_value ) ) {
867
-
868
- foreach( $field_value as $key => $list_item ) {
869
-
870
- echo '<li class="ui-state-default list-list-item">';
871
- ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
872
- echo '</li>';
873
-
874
- }
875
-
876
- }
877
-
878
- echo '</ul>';
879
-
880
- /* button */
881
- echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button blue right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
882
-
883
- /* description */
884
- echo '<div class="list-item-description">' . __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) . '</div>';
885
-
886
- echo '</div>';
887
-
888
- echo '</div>';
889
-
890
- }
891
-
892
- }
893
-
894
- /**
895
- * Post Checkbox option type.
896
- *
897
- * See @ot_display_by_type to see the full list of available arguments.
898
- *
899
- * @param array An array of arguments.
900
- * @return string
901
- *
902
- * @access public
903
- * @since 2.0
904
- */
905
- if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
906
-
907
- function ot_type_post_checkbox( $args = array() ) {
908
-
909
- /* turns arguments array into variables */
910
- extract( $args );
911
-
912
- /* verify a description */
913
- $has_desc = $field_desc ? true : false;
914
-
915
- /* format setting outer wrapper */
916
- echo '<div class="format-setting type-post-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
917
-
918
- /* description */
919
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
920
-
921
- /* format setting inner wrapper */
922
- echo '<div class="format-setting-inner">';
923
-
924
- /* query posts array */
925
- $query = new WP_Query( apply_filters( 'ot_type_post_checkbox_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
926
-
927
- /* has posts */
928
- if ( $query->have_posts() ) {
929
- while ( $query->have_posts() ) {
930
- $query->the_post();
931
- echo '<p>';
932
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
933
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . esc_attr( get_the_title() ) . '</label>';
934
- echo '</p>';
935
- }
936
- } else {
937
- echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
938
- }
939
-
940
- echo '</div>';
941
-
942
- echo '</div>';
943
-
944
- }
945
-
946
- }
947
-
948
- /**
949
- * Post Select option type.
950
- *
951
- * See @ot_display_by_type to see the full list of available arguments.
952
- *
953
- * @param array An array of arguments.
954
- * @return string
955
- *
956
- * @access public
957
- * @since 2.0
958
- */
959
- if ( ! function_exists( 'ot_type_post_select' ) ) {
960
-
961
- function ot_type_post_select( $args = array() ) {
962
-
963
- /* turns arguments array into variables */
964
- extract( $args );
965
-
966
- /* verify a description */
967
- $has_desc = $field_desc ? true : false;
968
-
969
- /* format setting outer wrapper */
970
- echo '<div class="format-setting type-post-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
971
-
972
- /* description */
973
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
974
-
975
- /* format setting inner wrapper */
976
- echo '<div class="format-setting-inner">';
977
-
978
- /* build page select */
979
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
980
-
981
- /* query posts array */
982
- $query = new WP_Query( apply_filters( 'ot_type_post_select_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
983
-
984
- /* has posts */
985
- if ( $query->have_posts() ) {
986
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
987
- while ( $query->have_posts() ) {
988
- $query->the_post();
989
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
990
- }
991
- } else {
992
- echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
993
- }
994
- echo '</select>';
995
-
996
- echo '</div>';
997
-
998
- echo '</div>';
999
-
1000
- }
1001
-
1002
- }
1003
-
1004
- /**
1005
- * Radio option type.
1006
- *
1007
- * See @ot_display_by_type to see the full list of available arguments.
1008
- *
1009
- * @param array An array of arguments.
1010
- * @return string
1011
- *
1012
- * @access public
1013
- * @since 2.0
1014
- */
1015
- if ( ! function_exists( 'ot_type_radio' ) ) {
1016
-
1017
- function ot_type_radio( $args = array() ) {
1018
-
1019
- /* turns arguments array into variables */
1020
- extract( $args );
1021
-
1022
- /* verify a description */
1023
- $has_desc = $field_desc ? true : false;
1024
-
1025
- /* format setting outer wrapper */
1026
- echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1027
-
1028
- /* description */
1029
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1030
-
1031
- /* format setting inner wrapper */
1032
- echo '<div class="format-setting-inner">';
1033
-
1034
- /* build radio */
1035
- foreach ( (array) $field_choices as $key => $choice ) {
1036
- echo '<p><input type="radio" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '"' . checked( $field_value, $choice['value'], false ) . ' class="radio option-tree-ui-radio ' . esc_attr( $field_class ) . '" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
1037
- }
1038
-
1039
- echo '</div>';
1040
-
1041
- echo '</div>';
1042
-
1043
- }
1044
-
1045
- }
1046
-
1047
- /**
1048
- * Radio Images option type.
1049
- *
1050
- * See @ot_display_by_type to see the full list of available arguments.
1051
- *
1052
- * @param array An array of arguments.
1053
- * @return string
1054
- *
1055
- * @access public
1056
- * @since 2.0
1057
- */
1058
- if ( ! function_exists( 'ot_type_radio_image' ) ) {
1059
-
1060
- function ot_type_radio_image( $args = array() ) {
1061
-
1062
- /* turns arguments array into variables */
1063
- extract( $args );
1064
-
1065
- /* verify a description */
1066
- $has_desc = $field_desc ? true : false;
1067
-
1068
- /* format setting outer wrapper */
1069
- echo '<div class="format-setting type-radio-image ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1070
-
1071
- /* description */
1072
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1073
-
1074
- /* format setting inner wrapper */
1075
- echo '<div class="format-setting-inner">';
1076
-
1077
- /**
1078
- * load the default filterable images if nothing
1079
- * has been set in the choices array.
1080
- */
1081
- if ( empty( $field_choices ) )
1082
- $field_choices = ot_radio_images( $field_id );
1083
-
1084
- /* build radio image */
1085
- foreach ( (array) $field_choices as $key => $choice ) {
1086
-
1087
- $src = str_replace( 'OT_URL', OT_URL, $choice['src'] );
1088
- $src = str_replace( 'OT_THEME_URL', OT_THEME_URL, $src );
1089
-
1090
- echo '<div class="option-tree-ui-radio-images">';
1091
- echo '<p style="display:none"><input type="radio" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '"' . checked( $field_value, $choice['value'], false ) . ' class="option-tree-ui-radio option-tree-ui-images" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
1092
- echo '<img src="' . esc_url( $src ) . '" alt="' . esc_attr( $choice['label'] ) .'" title="' . esc_attr( $choice['label'] ) .'" class="option-tree-ui-radio-image ' . esc_attr( $field_class ) . ( $field_value == $choice['value'] ? ' option-tree-ui-radio-image-selected' : '' ) . '" />';
1093
- echo '</div>';
1094
- }
1095
-
1096
- echo '</div>';
1097
-
1098
- echo '</div>';
1099
-
1100
- }
1101
-
1102
- }
1103
-
1104
- /**
1105
- * Select option type.
1106
- *
1107
- * See @ot_display_by_type to see the full list of available arguments.
1108
- *
1109
- * @param array An array of arguments.
1110
- * @return string
1111
- *
1112
- * @access public
1113
- * @since 2.0
1114
- */
1115
- if ( ! function_exists( 'ot_type_select' ) ) {
1116
-
1117
- function ot_type_select( $args = array() ) {
1118
-
1119
- /* turns arguments array into variables */
1120
- extract( $args );
1121
-
1122
- /* verify a description */
1123
- $has_desc = $field_desc ? true : false;
1124
-
1125
- /* format setting outer wrapper */
1126
- echo '<div class="format-setting type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1127
-
1128
- /* description */
1129
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1130
-
1131
- /* format setting inner wrapper */
1132
- echo '<div class="format-setting-inner">';
1133
-
1134
- /* build select */
1135
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1136
- foreach ( (array) $field_choices as $choice ) {
1137
- if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
1138
- echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
1139
- }
1140
- }
1141
- echo '</select>';
1142
-
1143
- echo '</div>';
1144
-
1145
- echo '</div>';
1146
-
1147
- }
1148
-
1149
- }
1150
-
1151
- /**
1152
- * Sidebar Select option type.
1153
- *
1154
- * This option type makes it possible for users to select a WordPress registered sidebar
1155
- * to use on a specific area. By using the two provided filters, 'ot_recognized_sidebars',
1156
- * and 'ot_recognized_sidebars_{$field_id}' we can be selective about which sidebars are
1157
- * available on a specific content area.
1158
- *
1159
- * For example, if we create a WordPress theme that provides the ability to change the
1160
- * Blog Sidebar and we don't want to have the footer sidebars available on this area,
1161
- * we can unset those sidebars either manually or by using a regular expression if we
1162
- * have a common name like footer-sidebar-$i.
1163
- *
1164
- * @param array An array of arguments.
1165
- * @return string
1166
- *
1167
- * @access public
1168
- * @since 2.1
1169
- */
1170
- if ( ! function_exists( 'ot_type_sidebar_select' ) ) {
1171
-
1172
- function ot_type_sidebar_select( $args = array() ) {
1173
-
1174
- /* turns arguments array into variables */
1175
- extract( $args );
1176
-
1177
- /* verify a description */
1178
- $has_desc = $field_desc ? true : false;
1179
-
1180
- /* format setting outer wrapper */
1181
- echo '<div class="format-setting type-sidebar-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1182
-
1183
- /* description */
1184
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1185
-
1186
- /* format setting inner wrapper */
1187
- echo '<div class="format-setting-inner">';
1188
-
1189
- /* build page select */
1190
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1191
-
1192
- /* get the registered sidebars */
1193
- global $wp_registered_sidebars;
1194
-
1195
- $sidebars = array();
1196
- foreach( $wp_registered_sidebars as $id=>$sidebar ) {
1197
- $sidebars[ $id ] = $sidebar[ 'name' ];
1198
- }
1199
-
1200
- /* filters to restrict which sidebars are allowed to be selected, for example we can restrict footer sidebars to be selectable on a blog page */
1201
- $sidebars = apply_filters( 'ot_recognized_sidebars', $sidebars );
1202
- $sidebars = apply_filters( 'ot_recognized_sidebars_' . $field_id, $sidebars );
1203
-
1204
- /* has sidebars */
1205
- if ( count( $sidebars ) ) {
1206
- echo '<option value="">-- ' . __( 'Choose Sidebar', 'option-tree' ) . ' --</option>';
1207
- foreach ( $sidebars as $id => $sidebar ) {
1208
- echo '<option value="' . esc_attr( $id ) . '"' . selected( $field_value, $id, false ) . '>' . esc_attr( $sidebar ) . '</option>';
1209
- }
1210
- } else {
1211
- echo '<option value="">' . __( 'No Sidebars', 'option-tree' ) . '</option>';
1212
- }
1213
-
1214
- echo '</select>';
1215
-
1216
- echo '</div>';
1217
-
1218
- echo '</div>';
1219
-
1220
- }
1221
-
1222
- }
1223
-
1224
- /**
1225
- * Tag Checkbox option type.
1226
- *
1227
- * See @ot_display_by_type to see the full list of available arguments.
1228
- *
1229
- * @param array An array of arguments.
1230
- * @return string
1231
- *
1232
- * @access public
1233
- * @since 2.0
1234
- */
1235
- if ( ! function_exists( 'ot_type_tag_checkbox' ) ) {
1236
-
1237
- function ot_type_tag_checkbox( $args = array() ) {
1238
-
1239
- /* turns arguments array into variables */
1240
- extract( $args );
1241
-
1242
- /* verify a description */
1243
- $has_desc = $field_desc ? true : false;
1244
-
1245
- /* format setting outer wrapper */
1246
- echo '<div class="format-setting type-tag-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1247
-
1248
- /* description */
1249
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1250
-
1251
- /* format setting inner wrapper */
1252
- echo '<div class="format-setting-inner">';
1253
-
1254
- /* get tags */
1255
- $tags = get_tags( array( 'hide_empty' => false ) );
1256
-
1257
- /* has tags */
1258
- if ( $tags ) {
1259
- foreach( $tags as $tag ) {
1260
- echo '<p>';
1261
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $tag->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '" value="' . esc_attr( $tag->term_id ) . '" ' . ( isset( $field_value[$tag->term_id] ) ? checked( $field_value[$tag->term_id], $tag->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1262
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '">' . esc_attr( $tag->name ) . '</label>';
1263
- echo '</p>';
1264
- }
1265
- } else {
1266
- echo '<p>' . __( 'No Tags Found', 'option-tree' ) . '</p>';
1267
- }
1268
-
1269
- echo '</div>';
1270
-
1271
- echo '</div>';
1272
-
1273
- }
1274
-
1275
- }
1276
-
1277
- /**
1278
- * Tag Select option type.
1279
- *
1280
- * See @ot_display_by_type to see the full list of available arguments.
1281
- *
1282
- * @param array An array of arguments.
1283
- * @return string
1284
- *
1285
- * @access public
1286
- * @since 2.0
1287
- */
1288
- if ( ! function_exists( 'ot_type_tag_select' ) ) {
1289
-
1290
- function ot_type_tag_select( $args = array() ) {
1291
-
1292
- /* turns arguments array into variables */
1293
- extract( $args );
1294
-
1295
- /* verify a description */
1296
- $has_desc = $field_desc ? true : false;
1297
-
1298
- /* format setting outer wrapper */
1299
- echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1300
-
1301
- /* description */
1302
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1303
-
1304
- /* format setting inner wrapper */
1305
- echo '<div class="format-setting-inner">';
1306
-
1307
- /* build tag select */
1308
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1309
-
1310
- /* get tags */
1311
- $tags = get_tags( array( 'hide_empty' => false ) );
1312
-
1313
- /* has tags */
1314
- if ( $tags ) {
1315
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1316
- foreach( $tags as $tag ) {
1317
- echo '<option value="' . esc_attr( $tag->term_id ) . '"' . selected( $field_value, $tag->term_id, false ) . '>' . esc_attr( $tag->name ) . '</option>';
1318
- }
1319
- } else {
1320
- echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
1321
- }
1322
- echo '</select>';
1323
-
1324
- echo '</div>';
1325
-
1326
- echo '</div>';
1327
-
1328
- }
1329
-
1330
- }
1331
-
1332
- /**
1333
- * Taxonomy Checkbox option type.
1334
- *
1335
- * See @ot_display_by_type to see the full list of available arguments.
1336
- *
1337
- * @param array An array of arguments.
1338
- * @return string
1339
- *
1340
- * @access public
1341
- * @since 2.0
1342
- */
1343
- if ( ! function_exists( 'ot_type_taxonomy_checkbox' ) ) {
1344
-
1345
- function ot_type_taxonomy_checkbox( $args = array() ) {
1346
-
1347
- /* turns arguments array into variables */
1348
- extract( $args );
1349
-
1350
- /* verify a description */
1351
- $has_desc = $field_desc ? true : false;
1352
-
1353
- /* format setting outer wrapper */
1354
- echo '<div class="format-setting type-taxonomy-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1355
-
1356
- /* description */
1357
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1358
-
1359
- /* format setting inner wrapper */
1360
- echo '<div class="format-setting-inner">';
1361
-
1362
- /* setup the taxonomy */
1363
- $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1364
-
1365
- /* get taxonomies */
1366
- $taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
1367
-
1368
- /* has tags */
1369
- if ( $taxonomies ) {
1370
- foreach( $taxonomies as $taxonomy ) {
1371
- echo '<p>';
1372
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $taxonomy->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '" value="' . esc_attr( $taxonomy->term_id ) . '" ' . ( isset( $field_value[$taxonomy->term_id] ) ? checked( $field_value[$taxonomy->term_id], $taxonomy->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1373
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '">' . esc_attr( $taxonomy->name ) . '</label>';
1374
- echo '</p>';
1375
- }
1376
- } else {
1377
- echo '<p>' . __( 'No Taxonomies Found', 'option-tree' ) . '</p>';
1378
- }
1379
-
1380
- echo '</div>';
1381
-
1382
- echo '</div>';
1383
-
1384
- }
1385
-
1386
- }
1387
-
1388
- /**
1389
- * Taxonomy Select option type.
1390
- *
1391
- * See @ot_display_by_type to see the full list of available arguments.
1392
- *
1393
- * @param array An array of arguments.
1394
- * @return string
1395
- *
1396
- * @access public
1397
- * @since 2.0
1398
- */
1399
- if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
1400
-
1401
- function ot_type_taxonomy_select( $args = array() ) {
1402
-
1403
- /* turns arguments array into variables */
1404
- extract( $args );
1405
-
1406
- /* verify a description */
1407
- $has_desc = $field_desc ? true : false;
1408
-
1409
- /* format setting outer wrapper */
1410
- echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1411
-
1412
- /* description */
1413
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1414
-
1415
- /* format setting inner wrapper */
1416
- echo '<div class="format-setting-inner">';
1417
-
1418
- /* build tag select */
1419
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1420
-
1421
- /* setup the taxonomy */
1422
- $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1423
-
1424
- /* get taxonomies */
1425
- $taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
1426
-
1427
- /* has tags */
1428
- if ( $taxonomies ) {
1429
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1430
- foreach( $taxonomies as $taxonomy ) {
1431
- echo '<option value="' . esc_attr( $taxonomy->term_id ) . '"' . selected( $field_value, $taxonomy->term_id, false ) . '>' . esc_attr( $taxonomy->name ) . '</option>';
1432
- }
1433
- } else {
1434
- echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
1435
- }
1436
- echo '</select>';
1437
-
1438
- echo '</div>';
1439
-
1440
- echo '</div>';
1441
-
1442
- }
1443
-
1444
- }
1445
-
1446
- /**
1447
- * Text option type.
1448
- *
1449
- * See @ot_display_by_type to see the full list of available arguments.
1450
- *
1451
- * @param array An array of arguments.
1452
- * @return string
1453
- *
1454
- * @access public
1455
- * @since 2.0
1456
- */
1457
- if ( ! function_exists( 'ot_type_text' ) ) {
1458
-
1459
- function ot_type_text( $args = array() ) {
1460
-
1461
- /* turns arguments array into variables */
1462
- extract( $args );
1463
-
1464
- /* verify a description */
1465
- $has_desc = $field_desc ? true : false;
1466
-
1467
- /* format setting outer wrapper */
1468
- echo '<div class="format-setting type-text ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1469
-
1470
- /* description */
1471
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1472
-
1473
- /* format setting inner wrapper */
1474
- echo '<div class="format-setting-inner">';
1475
-
1476
- /* build text input */
1477
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" />';
1478
-
1479
- echo '</div>';
1480
-
1481
- echo '</div>';
1482
-
1483
- }
1484
-
1485
- }
1486
-
1487
- /**
1488
- * Textarea option type.
1489
- *
1490
- * See @ot_display_by_type to see the full list of available arguments.
1491
- *
1492
- * @param array An array of arguments.
1493
- * @return string
1494
- *
1495
- * @access public
1496
- * @since 2.0
1497
- */
1498
- if ( ! function_exists( 'ot_type_textarea' ) ) {
1499
-
1500
- function ot_type_textarea( $args = array() ) {
1501
-
1502
- /* turns arguments array into variables */
1503
- extract( $args );
1504
-
1505
- /* verify a description */
1506
- $has_desc = $field_desc ? true : false;
1507
-
1508
- /* format setting outer wrapper */
1509
- echo '<div class="format-setting type-textarea ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . ' fill-area">';
1510
-
1511
- /* description */
1512
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1513
-
1514
- /* format setting inner wrapper */
1515
- echo '<div class="format-setting-inner">';
1516
-
1517
- /* build textarea */
1518
- wp_editor(
1519
- $field_value,
1520
- esc_attr( $field_id ),
1521
- array(
1522
- 'editor_class' => esc_attr( $field_class ),
1523
- 'wpautop' => apply_filters( 'ot_wpautop', false, $field_id ),
1524
- 'media_buttons' => apply_filters( 'ot_media_buttons', true, $field_id ),
1525
- 'textarea_name' => esc_attr( $field_name ),
1526
- 'textarea_rows' => esc_attr( $field_rows ),
1527
- 'tinymce' => apply_filters( 'ot_tinymce', true, $field_id ),
1528
- 'quicktags' => apply_filters( 'ot_quicktags', array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ), $field_id )
1529
- )
1530
- );
1531
-
1532
- echo '</div>';
1533
-
1534
- echo '</div>';
1535
-
1536
- }
1537
-
1538
- }
1539
-
1540
- /**
1541
- * Textarea Simple option type.
1542
- *
1543
- * See @ot_display_by_type to see the full list of available arguments.
1544
- *
1545
- * @param array An array of arguments.
1546
- * @return string
1547
- *
1548
- * @access public
1549
- * @since 2.0
1550
- */
1551
- if ( ! function_exists( 'ot_type_textarea_simple' ) ) {
1552
-
1553
- function ot_type_textarea_simple( $args = array() ) {
1554
-
1555
- /* turns arguments array into variables */
1556
- extract( $args );
1557
-
1558
- /* verify a description */
1559
- $has_desc = $field_desc ? true : false;
1560
-
1561
- /* format setting outer wrapper */
1562
- echo '<div class="format-setting type-textarea simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1563
-
1564
- /* description */
1565
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1566
-
1567
- /* format setting inner wrapper */
1568
- echo '<div class="format-setting-inner">';
1569
-
1570
- /* filter to allow wpautop */
1571
- $wpautop = apply_filters( 'ot_wpautop', false, $field_id );
1572
-
1573
- /* wpautop $field_value */
1574
- if ( $wpautop == true )
1575
- $field_value = wpautop( $field_value );
1576
-
1577
- /* build textarea simple */
1578
- echo '<textarea class="textarea ' . esc_attr( $field_class ) . '" rows="' . esc_attr( $field_rows ) . '" cols="40" name="' . esc_attr( $field_name ) .'" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</textarea>';
1579
-
1580
- echo '</div>';
1581
-
1582
- echo '</div>';
1583
-
1584
- }
1585
-
1586
- }
1587
-
1588
- /**
1589
- * Textblock option type.
1590
- *
1591
- * See @ot_display_by_type to see the full list of available arguments.
1592
- *
1593
- * @param array An array of arguments.
1594
- * @return string
1595
- *
1596
- * @access public
1597
- * @since 2.0
1598
- */
1599
- if ( ! function_exists( 'ot_type_textblock' ) ) {
1600
-
1601
- function ot_type_textblock( $args = array() ) {
1602
-
1603
- /* turns arguments array into variables */
1604
- extract( $args );
1605
-
1606
- /* format setting outer wrapper */
1607
- echo '<div class="format-setting type-textblock wide-desc">';
1608
-
1609
- /* description */
1610
- echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
1611
-
1612
- echo '</div>';
1613
-
1614
- }
1615
-
1616
- }
1617
-
1618
- /**
1619
- * Textblock Titled option type.
1620
- *
1621
- * See @ot_display_by_type to see the full list of available arguments.
1622
- *
1623
- * @param array An array of arguments.
1624
- * @return string
1625
- *
1626
- * @access public
1627
- * @since 2.0
1628
- */
1629
- if ( ! function_exists( 'ot_type_textblock_titled' ) ) {
1630
-
1631
- function ot_type_textblock_titled( $args = array() ) {
1632
-
1633
- /* turns arguments array into variables */
1634
- extract( $args );
1635
-
1636
- /* format setting outer wrapper */
1637
- echo '<div class="format-setting type-textblock titled wide-desc">';
1638
-
1639
- /* description */
1640
- echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
1641
-
1642
- echo '</div>';
1643
-
1644
- }
1645
-
1646
- }
1647
-
1648
- /**
1649
- * Typography option type.
1650
- *
1651
- * See @ot_display_by_type to see the full list of available arguments.
1652
- *
1653
- * @param array An array of arguments.
1654
- * @return string
1655
- *
1656
- * @access public
1657
- * @since 2.0
1658
- */
1659
- if ( ! function_exists( 'ot_type_typography' ) ) {
1660
-
1661
- function ot_type_typography( $args = array() ) {
1662
-
1663
- /* turns arguments array into variables */
1664
- extract( $args );
1665
-
1666
- /* verify a description */
1667
- $has_desc = $field_desc ? true : false;
1668
-
1669
- /* format setting outer wrapper */
1670
- echo '<div class="format-setting type-typography ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1671
-
1672
- /* description */
1673
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1674
-
1675
- /* format setting inner wrapper */
1676
- echo '<div class="format-setting-inner">';
1677
-
1678
- /* allow fields to be filtered */
1679
- $ot_recognized_typography_fields = apply_filters( 'ot_recognized_typography_fields', array(
1680
- 'font-color',
1681
- 'font-family',
1682
- 'font-size',
1683
- 'font-style',
1684
- 'font-variant',
1685
- 'font-weight',
1686
- 'letter-spacing',
1687
- 'line-height',
1688
- 'text-decoration',
1689
- 'text-transform'
1690
- ), $field_id );
1691
-
1692
- /* build background colorpicker */
1693
- if ( in_array( 'font-color', $ot_recognized_typography_fields ) ) {
1694
-
1695
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
1696
-
1697
- /* colorpicker JS */
1698
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
1699
-
1700
- /* set background color */
1701
- $background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
1702
-
1703
- /* set border color */
1704
- $border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color;
1705
-
1706
- /* input */
1707
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[font-color]" id="' . esc_attr( $field_id ) . '-picker" value="' . esc_attr( $background_color ) . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" placeholder="font-color" />';
1708
-
1709
- echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>';
1710
-
1711
- echo '</div>';
1712
-
1713
- }
1714
-
1715
- /* build font family */
1716
- if ( in_array( 'font-family', $ot_recognized_typography_fields ) ) {
1717
- $font_family = isset( $field_value['font-family'] ) ? $field_value['font-family'] : '';
1718
- echo '<select name="' . esc_attr( $field_name ) . '[font-family]" id="' . esc_attr( $field_id ) . '-font-family" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1719
- echo '<option value="">font-family</option>';
1720
- foreach ( ot_recognized_font_families( $field_id ) as $key => $value ) {
1721
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_family, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1722
- }
1723
- echo '</select>';
1724
- }
1725
-
1726
- /* build font size */
1727
- if ( in_array( 'font-size', $ot_recognized_typography_fields ) ) {
1728
- $font_size = isset( $field_value['font-size'] ) ? esc_attr( $field_value['font-size'] ) : '';
1729
- echo '<select name="' . esc_attr( $field_name ) . '[font-size]" id="' . esc_attr( $field_id ) . '-font-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1730
- echo '<option value="">font-size</option>';
1731
- foreach( ot_recognized_font_sizes( $field_id ) as $option ) {
1732
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $font_size, $option, false ) . '>' . esc_attr( $option ) . '</option>';
1733
- }
1734
- echo '</select>';
1735
- }
1736
-
1737
- /* build font style */
1738
- if ( in_array( 'font-style', $ot_recognized_typography_fields ) ) {
1739
- $font_style = isset( $field_value['font-style'] ) ? esc_attr( $field_value['font-style'] ) : '';
1740
- echo '<select name="' . esc_attr( $field_name ) . '[font-style]" id="' . esc_attr( $field_id ) . '-font-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1741
- echo '<option value="">font-style</option>';
1742
- foreach ( ot_recognized_font_styles( $field_id ) as $key => $value ) {
1743
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_style, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1744
- }
1745
- echo '</select>';
1746
- }
1747
-
1748
- /* build font variant */
1749
- if ( in_array( 'font-variant', $ot_recognized_typography_fields ) ) {
1750
- $font_variant = isset( $field_value['font-variant'] ) ? esc_attr( $field_value['font-variant'] ) : '';
1751
- echo '<select name="' . esc_attr( $field_name ) . '[font-variant]" id="' . esc_attr( $field_id ) . '-font-variant" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1752
- echo '<option value="">font-variant</option>';
1753
- foreach ( ot_recognized_font_variants( $field_id ) as $key => $value ) {
1754
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_variant, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1755
- }
1756
- echo '</select>';
1757
- }
1758
-
1759
- /* build font weight */
1760
- if ( in_array( 'font-weight', $ot_recognized_typography_fields ) ) {
1761
- $font_weight = isset( $field_value['font-weight'] ) ? esc_attr( $field_value['font-weight'] ) : '';
1762
- echo '<select name="' . esc_attr( $field_name ) . '[font-weight]" id="' . esc_attr( $field_id ) . '-font-weight" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1763
- echo '<option value="">font-weight</option>';
1764
- foreach ( ot_recognized_font_weights( $field_id ) as $key => $value ) {
1765
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_weight, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1766
- }
1767
- echo '</select>';
1768
- }
1769
-
1770
- /* build letter spacing */
1771
- if ( in_array( 'letter-spacing', $ot_recognized_typography_fields ) ) {
1772
- $letter_spacing = isset( $field_value['letter-spacing'] ) ? esc_attr( $field_value['letter-spacing'] ) : '';
1773
- echo '<select name="' . esc_attr( $field_name ) . '[letter-spacing]" id="' . esc_attr( $field_id ) . '-letter-spacing" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1774
- echo '<option value="">letter-spacing</option>';
1775
- foreach( ot_recognized_letter_spacing( $field_id ) as $option ) {
1776
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $letter_spacing, $option, false ) . '>' . esc_attr( $option ) . '</option>';
1777
- }
1778
- echo '</select>';
1779
- }
1780
-
1781
- /* build line height */
1782
- if ( in_array( 'line-height', $ot_recognized_typography_fields ) ) {
1783
- $line_height = isset( $field_value['line-height'] ) ? esc_attr( $field_value['line-height'] ) : '';
1784
- echo '<select name="' . esc_attr( $field_name ) . '[line-height]" id="' . esc_attr( $field_id ) . '-line-height" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1785
- echo '<option value="">line-height</option>';
1786
- foreach( ot_recognized_line_heights( $field_id ) as $option ) {
1787
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $line_height, $option, false ) . '>' . esc_attr( $option ) . '</option>';
1788
- }
1789
- echo '</select>';
1790
- }
1791
-
1792
- /* build text decoration */
1793
- if ( in_array( 'text-decoration', $ot_recognized_typography_fields ) ) {
1794
- $text_decoration = isset( $field_value['text-decoration'] ) ? esc_attr( $field_value['text-decoration'] ) : '';
1795
- echo '<select name="' . esc_attr( $field_name ) . '[text-decoration]" id="' . esc_attr( $field_id ) . '-text-decoration" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1796
- echo '<option value="">text-decoration</option>';
1797
- foreach ( ot_recognized_text_decorations( $field_id ) as $key => $value ) {
1798
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_decoration, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1799
- }
1800
- echo '</select>';
1801
- }
1802
-
1803
- /* build text transform */
1804
- if ( in_array( 'text-transform', $ot_recognized_typography_fields ) ) {
1805
- $text_transform = isset( $field_value['text-transform'] ) ? esc_attr( $field_value['text-transform'] ) : '';
1806
- echo '<select name="' . esc_attr( $field_name ) . '[text-transform]" id="' . esc_attr( $field_id ) . '-text-transform" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1807
- echo '<option value="">text-transform</option>';
1808
- foreach ( ot_recognized_text_transformations( $field_id ) as $key => $value ) {
1809
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_transform, $key, false ) . '>' . esc_attr( $value ) . '</option>';
1810
- }
1811
- echo '</select>';
1812
- }
1813
-
1814
- echo '</div>';
1815
-
1816
- echo '</div>';
1817
-
1818
- }
1819
-
1820
- }
1821
-
1822
- /**
1823
- * Upload option type.
1824
- *
1825
- * See @ot_display_by_type to see the full list of available arguments.
1826
- *
1827
- * @param array An array of arguments.
1828
- * @return string
1829
- *
1830
- * @access public
1831
- * @since 2.0
1832
- */
1833
- if ( ! function_exists( 'ot_type_upload' ) ) {
1834
-
1835
- function ot_type_upload( $args = array() ) {
1836
-
1837
- /* turns arguments array into variables */
1838
- extract( $args );
1839
-
1840
- /* verify a description */
1841
- $has_desc = $field_desc ? true : false;
1842
-
1843
- /* format setting outer wrapper */
1844
- echo '<div class="format-setting type-upload ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1845
-
1846
- /* description */
1847
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1848
-
1849
- /* format setting inner wrapper */
1850
- echo '<div class="format-setting-inner">';
1851
-
1852
- /* build upload */
1853
- echo '<div class="option-tree-ui-upload-parent">';
1854
-
1855
- /* input */
1856
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
1857
-
1858
- /* add media button */
1859
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button blue light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon upload">' . __( 'Add Media', 'option-tree' ) . '</span></a>';
1860
-
1861
- echo '</div>';
1862
-
1863
- /* media */
1864
- if ( $field_value ) {
1865
-
1866
- echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
1867
-
1868
- if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value ) )
1869
- echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value ) . '" alt="" /></div>';
1870
-
1871
- echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon trash-can">' . __( 'Remove Media', 'option-tree' ) . '</span></a>';
1872
-
1873
- echo '</div>';
1874
-
1875
- }
1876
-
1877
- echo '</div>';
1878
-
1879
- echo '</div>';
1880
-
1881
- }
1882
-
1883
- }
1884
-
1885
- /* End of file ot-functions-option-types.php */
1886
- /* Location: ./includes/ot-functions-option-types.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-settings-page.php DELETED
@@ -1,570 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree settings page functions.
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Create option type.
13
- *
14
- * @return string
15
- *
16
- * @access public
17
- * @since 2.0
18
- */
19
- if ( ! function_exists( 'ot_type_theme_options_ui' ) ) {
20
-
21
- function ot_type_theme_options_ui() {
22
- global $blog_id;
23
-
24
- echo '<form method="post" id="option-tree-settings-form">';
25
-
26
- /* form nonce */
27
- wp_nonce_field( 'option_tree_settings_form', 'option_tree_settings_nonce' );
28
-
29
- /* format setting outer wrapper */
30
- echo '<div class="format-setting type-textblock has-desc">';
31
-
32
- /* description */
33
- echo '<div class="description">';
34
-
35
- echo '<h4>'. __( 'Warning!', 'option-tree' ) . '</h4>';
36
- echo '<p class="warning">' . sprintf( __( 'Go to the %s page if you want to save data, this page is for adding settings.', 'option-tree' ), '<a href="' . get_admin_url( $blog_id, 'themes.php?page=ot-theme-options' ) . '"><code>Appearance->Theme Options</code></a>' ) . '</p>';
37
- echo '<p class="warning">' . sprintf( __( 'If you\'re unsure or not completely positive that you should be editing these settings, you should read the %s first.', 'option-tree' ), '<a href="' . get_admin_url( $blog_id, 'admin.php?page=ot-documentation' ) . '"><code>OptionTree->Documentation</code></a>' ) . '</p>';
38
- echo '<h4>'. __( 'Things could break or be improperly displayed to the end-user if you do one of the following:', 'option-tree' ) . '</h4>';
39
- echo '<p class="warning">' . __( 'Give two sections the same ID, give two settings the same ID, give two contextual help content areas the same ID, don\'t create any settings, or have a section at the end of the settings list.', 'option-tree' ) . '</p>';
40
- echo '<p>' . __( 'You can create as many settings as your project requires and use them how you see fit. When you add a setting here, it will be available on the Theme Options page for use in your theme. To separate your settings into sections, click the "Add Section" button, fill in the input fields, and a new navigation menu item will be created.', 'option-tree' ) . '</p>';
41
- echo '<p>' . __( 'All of the settings can be sorted and rearranged to your liking with Drag & Drop. Don\'t worry about the order in which you create your settings, you can always reorder them.', 'option-tree' ) . '</p>';
42
-
43
- echo '</div>';
44
-
45
- /* get the saved settings */
46
- $settings = get_option( 'option_tree_settings' );
47
-
48
- /* wrap settings array */
49
- echo '<div class="format-setting-inner">';
50
-
51
- /* set count to zero */
52
- $count = 0;
53
-
54
- /* loop through each section and its settings */
55
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_settings_list" data-name="option_tree_settings[settings]">';
56
-
57
- if ( isset( $settings['sections'] ) ) {
58
-
59
- foreach( $settings['sections'] as $section ) {
60
-
61
- /* section */
62
- echo '<li class="' . ( $count == 0 ? 'ui-state-disabled' : 'ui-state-default' ) . ' list-section">' . ot_sections_view( 'option_tree_settings[sections]', $count, $section ) . '</li>';
63
-
64
- /* increment item count */
65
- $count++;
66
-
67
- /* settings in this section */
68
- if ( isset( $settings['settings'] ) ) {
69
-
70
- foreach( $settings['settings'] as $setting ) {
71
-
72
- if ( isset( $setting['section'] ) && $setting['section'] == $section['id'] ) {
73
-
74
- echo '<li class="ui-state-default list-setting">' . ot_settings_view( 'option_tree_settings[settings]', $count, $setting ) . '</li>';
75
-
76
- /* increment item count */
77
- $count++;
78
-
79
- }
80
-
81
- }
82
-
83
- }
84
-
85
- }
86
-
87
- }
88
-
89
- echo '</ul>';
90
-
91
- /* buttons */
92
- echo '<a href="javascript:void(0);" class="option-tree-section-add option-tree-ui-button hug-left">' . __( 'Add Section', 'option-tree' ) . '</a>';
93
- echo '<a href="javascript:void(0);" class="option-tree-setting-add option-tree-ui-button">' . __( 'Add Setting', 'option-tree' ) . '</a>';
94
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Save Changes', 'option-tree' ) . '</button>';
95
-
96
- /* sidebar textarea */
97
- echo '
98
- <div class="format-setting-label" id="contextual-help-label">
99
- <h3 class="label">' . __( 'Contextual Help', 'option-tree' ) . '</h3>
100
- </div>
101
- <div class="format-settings" id="contextual-help-setting">
102
- <div class="format-setting type-textarea no-desc">
103
- <div class="description"><strong>' . __( 'Contextual Help Sidebar', 'option-tree' ) . '</strong>: ' . __( 'If you decide to add contextual help to the Theme Option page, enter the optional "Sidebar" HTML here. This would be an extremely useful place to add links to your themes documentation or support forum. Only after you\'ve added some content below will this display to the user.', 'option-tree' ) . '</div>
104
- <div class="format-setting-inner">
105
- <textarea class="textarea" rows="10" cols="40" name="option_tree_settings[contextual_help][sidebar]">' . ( isset( $settings['contextual_help']['sidebar'] ) ? esc_html( $settings['contextual_help']['sidebar'] ) : '' ) . '</textarea>
106
- </div>
107
- </div>
108
- </div>';
109
-
110
- /* set count to zero */
111
- $count = 0;
112
-
113
- /* loop through each contextual_help content section */
114
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_settings_help" data-name="option_tree_settings[contextual_help][content]">';
115
-
116
- if ( isset( $settings['contextual_help']['content'] ) ) {
117
-
118
- foreach( $settings['contextual_help']['content'] as $content ) {
119
-
120
- /* content */
121
- echo '<li class="ui-state-default list-contextual-help">' . ot_contextual_help_view( 'option_tree_settings[contextual_help][content]', $count, $content ) . '</li>';
122
-
123
- /* increment content count */
124
- $count++;
125
-
126
- }
127
-
128
- }
129
-
130
- echo '</ul>';
131
-
132
- echo '<a href="javascript:void(0);" class="option-tree-help-add option-tree-ui-button hug-left">' . __( 'Add Contextual Help Content', 'option-tree' ) . '</a>';
133
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Save Changes', 'option-tree' ) . '</button>';
134
-
135
- echo '</div>';
136
-
137
- echo '</div>';
138
-
139
- echo '</form>';
140
-
141
- }
142
-
143
- }
144
-
145
- /**
146
- * Import XML option type.
147
- *
148
- * @return string
149
- *
150
- * @access public
151
- * @since 2.0
152
- */
153
- if ( ! function_exists( 'ot_type_import_xml' ) ) {
154
-
155
- function ot_type_import_xml() {
156
-
157
- echo '<form method="post" id="import-xml-form">';
158
-
159
- /* form nonce */
160
- wp_nonce_field( 'import_xml_form', 'import_xml_nonce' );
161
-
162
- /* format setting outer wrapper */
163
- echo '<div class="format-setting type-textblock has-desc">';
164
-
165
- /* description */
166
- echo '<div class="description">';
167
-
168
- echo '<p class="deprecated">' . __( 'This import method has been deprecated. That means it has been replaced by a new method and is no longer supported, and may be removed from future versions. All themes that use this import method should be converted to use its replacement below.', 'option-tree' ) . '</p>';
169
-
170
- echo '<p>' . __( 'If you were given a Theme Options XML file with a premium or free theme, locate it on your hard drive and upload that file by clicking the blue upload button. A popup window will appear, upload the XML file and click "Send to OptionTree". The file URL should be in the upload input, if it is click "Import XML".', 'option-tree' ) . '</p>';
171
-
172
- /* button */
173
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Import XML', 'option-tree' ) . '</button>';
174
-
175
- echo '</div>';
176
-
177
- echo '<div class="format-setting-inner">';
178
-
179
- /* build upload */
180
- echo '<div class="option-tree-ui-upload-parent">';
181
-
182
- /* input */
183
- echo '<input type="text" name="import_xml" id="import_xml" value="" class="widefat option-tree-ui-upload-input" />';
184
-
185
- /* get media post_id */
186
- $post_id = ( $id = ot_get_media_post_ID() ) ? (int) $id : 0;
187
-
188
- /* add xml button */
189
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button blue light" rel="' . $post_id . '" title="' . __( 'Add XML', 'option-tree' ) . '"><span class="icon upload">' . __( 'Add XML', 'option-tree' ) . '</span></a>';
190
-
191
- echo '</div>';
192
-
193
- echo '</div>';
194
-
195
- echo '</div>';
196
-
197
- echo '</form>';
198
-
199
- }
200
-
201
- }
202
-
203
- /**
204
- * Import Settings option type.
205
- *
206
- * @return string
207
- *
208
- * @access public
209
- * @since 2.0
210
- */
211
- if ( ! function_exists( 'ot_type_import_settings' ) ) {
212
-
213
- function ot_type_import_settings() {
214
-
215
- echo '<form method="post" id="import-settings-form">';
216
-
217
- /* form nonce */
218
- wp_nonce_field( 'import_settings_form', 'import_settings_nonce' );
219
-
220
- /* format setting outer wrapper */
221
- echo '<div class="format-setting type-textarea has-desc">';
222
-
223
- /* description */
224
- echo '<div class="description">';
225
-
226
- echo '<p>' . __( 'To import your Settings copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Settings" button.', 'option-tree' ) . '</p>';
227
-
228
- /* button */
229
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Import Settings', 'option-tree' ) . '</button>';
230
-
231
- echo '</div>';
232
-
233
- /* textarea */
234
- echo '<div class="format-setting-inner">';
235
-
236
- echo '<textarea rows="10" cols="40" name="import_settings" id="import_settings" class="textarea"></textarea>';
237
-
238
- echo '</div>';
239
-
240
- echo '</div>';
241
-
242
- echo '</form>';
243
-
244
- }
245
-
246
- }
247
-
248
- /**
249
- * Import Data option type.
250
- *
251
- * @return string
252
- *
253
- * @access public
254
- * @since 2.0
255
- */
256
- if ( ! function_exists( 'ot_type_import_data' ) ) {
257
-
258
- function ot_type_import_data() {
259
-
260
- echo '<form method="post" id="import-data-form">';
261
-
262
- /* form nonce */
263
- wp_nonce_field( 'import_data_form', 'import_data_nonce' );
264
-
265
- /* format setting outer wrapper */
266
- echo '<div class="format-setting type-textarea has-desc">';
267
-
268
- /* description */
269
- echo '<div class="description">';
270
-
271
- if ( OT_SHOW_SETTINGS_IMPORT ) echo '<p>' . __( 'Only after you\'ve imported the Settings should you try and update your Theme Options.', 'option-tree' ) . '</p>';
272
-
273
- echo '<p>' . __( 'To import your Theme Options copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Theme Options" button.', 'option-tree' ) . '</p>';
274
-
275
- /* button */
276
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Import Theme Options', 'option-tree' ) . '</button>';
277
-
278
- echo '</div>';
279
-
280
- /* textarea */
281
- echo '<div class="format-setting-inner">';
282
-
283
- echo '<textarea rows="10" cols="40" name="import_data" id="import_data" class="textarea"></textarea>';
284
-
285
- echo '</div>';
286
-
287
- echo '</div>';
288
-
289
- echo '</form>';
290
-
291
- }
292
-
293
- }
294
-
295
- /**
296
- * Import Layouts option type.
297
- *
298
- * @return string
299
- *
300
- * @access public
301
- * @since 2.0
302
- */
303
- if ( ! function_exists( 'ot_type_import_layouts' ) ) {
304
-
305
- function ot_type_import_layouts() {
306
-
307
- echo '<form method="post" id="import-layouts-form">';
308
-
309
- /* form nonce */
310
- wp_nonce_field( 'import_layouts_form', 'import_layouts_nonce' );
311
-
312
- /* format setting outer wrapper */
313
- echo '<div class="format-setting type-textarea has-desc">';
314
-
315
- /* description */
316
- echo '<div class="description">';
317
-
318
- if ( OT_SHOW_SETTINGS_IMPORT ) echo '<p>' . __( 'Only after you\'ve imported the Settings should you try and update your Layouts.', 'option-tree' ) . '</p>';
319
-
320
- echo '<p>' . __( 'To import your Layouts copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Layouts" button. Keep in mind that when you import your layouts, the active layout\'s saved data will write over the current data set for your Theme Options.', 'option-tree' ) . '</p>';
321
-
322
- /* button */
323
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Import Layouts', 'option-tree' ) . '</button>';
324
-
325
- echo '</div>';
326
-
327
- /* textarea */
328
- echo '<div class="format-setting-inner">';
329
-
330
- echo '<textarea rows="10" cols="40" name="import_layouts" id="import_layouts" class="textarea"></textarea>';
331
-
332
- echo '</div>';
333
-
334
- echo '</div>';
335
-
336
- echo '</form>';
337
-
338
- }
339
-
340
- }
341
-
342
- /**
343
- * Export Settings File option type.
344
- *
345
- * @return string
346
- *
347
- * @access public
348
- * @since 2.0.8
349
- */
350
- if ( ! function_exists( 'ot_type_export_settings_file' ) ) {
351
-
352
- function ot_type_export_settings_file() {
353
- global $blog_id;
354
-
355
- echo '<form method="post" id="export-settings-file-form">';
356
-
357
- /* form nonce */
358
- wp_nonce_field( 'export_settings_file_form', 'export_settings_file_nonce' );
359
-
360
- /* format setting outer wrapper */
361
- echo '<div class="format-setting type-textarea simple has-desc">';
362
-
363
- /* description */
364
- echo '<div class="description">';
365
-
366
- echo '<p>' . sprintf( __( 'Export your Settings into a fully functional <code>theme-options.php</code> file by clicking this button. For more information on how to use this file read the theme mode %s. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ), '<a href="' . get_admin_url( $blog_id, 'admin.php?page=ot-documentation#section_theme_mode' ) . '"><code>OptionTree->Documentation</code></a>' ) . '</p>';
367
-
368
- echo '</div>';
369
-
370
- echo '<div class="format-setting-inner">';
371
-
372
- /* button */
373
- echo '<button class="option-tree-ui-button blue hug-left">' . __( 'Export Settings File', 'option-tree' ) . '</button>';
374
-
375
- echo '</div>';
376
-
377
- echo '</div>';
378
-
379
- echo '</form>';
380
-
381
- }
382
-
383
- }
384
-
385
- /**
386
- * Export Settings option type.
387
- *
388
- * @return string
389
- *
390
- * @access public
391
- * @since 2.0
392
- */
393
- if ( ! function_exists( 'ot_type_export_settings' ) ) {
394
-
395
- function ot_type_export_settings() {
396
-
397
- /* format setting outer wrapper */
398
- echo '<div class="format-setting type-textarea simple has-desc">';
399
-
400
- /* description */
401
- echo '<div class="description">';
402
-
403
- echo '<p>' . __( 'Export your Settings by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> <strong>Settings</strong> textarea on another web site.', 'option-tree' ) . '</p>';
404
-
405
- echo '</div>';
406
-
407
- /* get theme options data */
408
- $settings = get_option( 'option_tree_settings' );
409
- $settings = ! empty( $settings ) ? ot_encode( serialize( $settings ) ) : '';
410
-
411
- echo '<div class="format-setting-inner">';
412
- echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>';
413
- echo '</div>';
414
-
415
- echo '</div>';
416
-
417
- }
418
-
419
- }
420
-
421
- /**
422
- * Export Data option type.
423
- *
424
- * @return string
425
- *
426
- * @access public
427
- * @since 2.0
428
- */
429
- if ( ! function_exists( 'ot_type_export_data' ) ) {
430
-
431
- function ot_type_export_data() {
432
-
433
- /* format setting outer wrapper */
434
- echo '<div class="format-setting type-textarea simple has-desc">';
435
-
436
- /* description */
437
- echo '<div class="description">';
438
-
439
- echo '<p>' . __( 'Export your Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> <strong>Theme Options</strong> textarea on another web site.', 'option-tree' ) . '</p>';
440
-
441
- echo '</div>';
442
-
443
- /* get theme options data */
444
- $data = get_option( 'option_tree' );
445
- $data = ! empty( $data ) ? ot_encode( serialize( $data ) ) : '';
446
-
447
- echo '<div class="format-setting-inner">';
448
- echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>';
449
- echo '</div>';
450
-
451
- echo '</div>';
452
-
453
- }
454
-
455
- }
456
-
457
- /**
458
- * Export Layouts option type.
459
- *
460
- * @return string
461
- *
462
- * @access public
463
- * @since 2.0
464
- */
465
- if ( ! function_exists( 'ot_type_export_layouts' ) ) {
466
-
467
- function ot_type_export_layouts() {
468
-
469
- /* format setting outer wrapper */
470
- echo '<div class="format-setting type-textarea simple has-desc">';
471
-
472
- /* description */
473
- echo '<div class="description">';
474
-
475
- echo '<p>' . __( 'Export your Layouts by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> <strong>Layouts</strong> textarea on another web site.', 'option-tree' ) . '</p>';
476
-
477
-
478
- echo '</div>';
479
-
480
- /* get layout data */
481
- $layouts = get_option( 'option_tree_layouts' );
482
- $layouts = ! empty( $layouts ) ? ot_encode( serialize( $layouts ) ) : '';
483
-
484
- echo '<div class="format-setting-inner">';
485
- echo '<textarea rows="10" cols="40" name="export_layouts" id="export_layouts" class="textarea">' . $layouts . '</textarea>';
486
- echo '</div>';
487
-
488
- echo '</div>';
489
-
490
- }
491
-
492
- }
493
-
494
- /**
495
- * Modify Layouts option type.
496
- *
497
- * @return string
498
- *
499
- * @access public
500
- * @since 2.0
501
- */
502
- if ( ! function_exists( 'ot_type_modify_layouts' ) ) {
503
-
504
- function ot_type_modify_layouts() {
505
-
506
- echo '<form method="post" id="option-tree-settings-form">';
507
-
508
- /* form nonce */
509
- wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' );
510
-
511
- /* format setting outer wrapper */
512
- echo '<div class="format-setting type-textarea has-desc">';
513
-
514
- /* description */
515
- echo '<div class="description">';
516
-
517
- echo '<p>' . __( 'To add a new layout enter a unique lower case alphanumeric string (dashes allowed) in the text field and click "Save Layouts".', 'option-tree' ) . '</p>';
518
- echo '<p>' . __( 'As well, you can activate, remove, and drag & drop the order; all situations require you to click "Save Layouts" for the changes to be applied.', 'option-tree' ) . '</p>';
519
- echo '<p>' . __( 'When you create a new layout it will become active and any changes made to the Theme Options will be applied to it. If you switch back to a different layout immediately after creating a new layout that new layout will have a snapshot of the current Theme Options data attached to it.', 'option-tree' ) . '</p>';
520
- if ( OT_SHOW_DOCS ) echo '<p>' . __( 'Visit <code>OptionTree->Documentation->Layouts Overview</code> to see a more in-depth description of what layouts are and how to use them.', 'option-tree' ) . '</p>';
521
-
522
- echo '</div>';
523
-
524
- echo '<div class="format-setting-inner">';
525
-
526
- /* get the saved layouts */
527
- $layouts = get_option( 'option_tree_layouts' );
528
-
529
- /* set active layout */
530
- $active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : '';
531
-
532
- echo '<input type="hidden" name="option_tree_layouts[active_layout]" value="' . esc_attr( $active_layout ) . '" class="active-layout-input" />';
533
-
534
- /* add new layout */
535
- echo '<input type="text" name="option_tree_layouts[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
536
-
537
- /* loop through each layout */
538
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_layouts">';
539
-
540
- if ( is_array( $layouts ) && ! empty( $layouts ) ) {
541
-
542
- foreach( $layouts as $key => $data ) {
543
-
544
- /* skip active layout array */
545
- if ( $key == 'active_layout' )
546
- continue;
547
-
548
- /* content */
549
- echo '<li class="ui-state-default list-layouts">' . ot_layout_view( $key, $data, $active_layout ) . '</li>';
550
-
551
- }
552
-
553
- }
554
-
555
- echo '</ul>';
556
-
557
- echo '<button class="option-tree-ui-button blue right hug-right">' . __( 'Save Layouts', 'option-tree' ) . '</button>';
558
-
559
- echo '</div>';
560
-
561
- echo '</div>';
562
-
563
- echo '</form>';
564
-
565
- }
566
-
567
- }
568
-
569
- /* End of file ot-functions-settings-page.php */
570
- /* Location: ./includes/ot-functions-settings-page.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions.php DELETED
@@ -1,196 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree functions
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Get Option.
13
- *
14
- * Helper function to return the option value.
15
- * If no value has been saved, it returns $default.
16
- *
17
- * @param string The option ID.
18
- * @param string The default option value.
19
- * @return mixed
20
- *
21
- * @access public
22
- * @since 2.0
23
- */
24
- if ( ! function_exists( 'ot_get_option' ) ) {
25
-
26
- function ot_get_option( $option_id, $default = '' ) {
27
-
28
- /* get the saved options */
29
- $options = get_option( 'option_tree' );
30
-
31
- /* look for the saved value */
32
- if ( isset( $options[$option_id] ) && '' != $options[$option_id] ) {
33
-
34
- return ot_wpml_filter( $options, $option_id );
35
-
36
- }
37
-
38
- return $default;
39
-
40
- }
41
-
42
- }
43
-
44
- /**
45
- * Filter the return values through WPML
46
- *
47
- * @param array $options The current options
48
- * @param string $option_id The option ID
49
- * @return mixed
50
- *
51
- * @access public
52
- * @since 2.1
53
- */
54
- if ( ! function_exists( 'ot_wpml_filter' ) ) {
55
-
56
- function ot_wpml_filter( $options, $option_id ) {
57
-
58
- // Return translated strings using WMPL
59
- if ( function_exists('icl_t') ) {
60
-
61
- $settings = get_option( 'option_tree_settings' );
62
-
63
- if ( isset( $settings['settings'] ) ) {
64
-
65
- foreach( $settings['settings'] as $setting ) {
66
-
67
- // List Item & Slider
68
- if ( $option_id == $setting['id'] && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
69
-
70
- foreach( $options[$option_id] as $key => $value ) {
71
-
72
- foreach( $value as $ckey => $cvalue ) {
73
-
74
- $id = $option_id . '_' . $ckey . '_' . $key;
75
- $_string = icl_t( 'Theme Options', $id, $cvalue );
76
-
77
- if ( ! empty( $_string ) ) {
78
-
79
- $options[$option_id][$key][$ckey] = $_string;
80
-
81
- }
82
-
83
- }
84
-
85
- }
86
-
87
- // All other acceptable option types
88
- } else if ( $option_id == $setting['id'] && in_array( $setting['type'], apply_filters( 'ot_wpml_option_types', array( 'text', 'textarea', 'textarea-simple' ) ) ) ) {
89
-
90
- $_string = icl_t( 'Theme Options', $option_id, $options[$option_id] );
91
-
92
- if ( ! empty( $_string ) ) {
93
-
94
- $options[$option_id] = $_string;
95
-
96
- }
97
-
98
- }
99
-
100
- }
101
-
102
- }
103
-
104
- }
105
-
106
- return $options[$option_id];
107
-
108
- }
109
-
110
- }
111
-
112
- /**
113
- * Enqueue the dynamic CSS.
114
- *
115
- * @return void
116
- *
117
- * @access public
118
- * @since 2.0
119
- */
120
- if ( ! function_exists( 'ot_load_dynamic_css' ) ) {
121
-
122
- function ot_load_dynamic_css() {
123
-
124
- /* don't load in the admin */
125
- if ( is_admin() )
126
- return;
127
-
128
- /* grab a copy of the paths */
129
- $ot_css_file_paths = get_option( 'ot_css_file_paths', array() );
130
-
131
- if ( ! empty( $ot_css_file_paths ) ) {
132
-
133
- $last_css = '';
134
-
135
- /* loop through paths */
136
- foreach( $ot_css_file_paths as $key => $path ) {
137
-
138
- if ( '' != $path && file_exists( $path ) ) {
139
-
140
- $parts = explode( '/wp-content', $path );
141
-
142
- if ( isset( $parts[1] ) ) {
143
-
144
- $css = home_url( '/wp-content' . $parts[1] );
145
-
146
- if ( $last_css !== $css ) {
147
-
148
- /* enqueue filtered file */
149
- wp_enqueue_style( 'ot-dynamic-' . $key, $css, false, OT_VERSION );
150
-
151
- $last_css = $css;
152
-
153
- }
154
-
155
- }
156
-
157
- }
158
-
159
- }
160
-
161
- }
162
-
163
- }
164
-
165
- }
166
-
167
- /**
168
- * Registers the Theme Option page link for the admin bar.
169
- *
170
- * @uses ot_register_settings()
171
- *
172
- * @return void
173
- *
174
- * @access public
175
- * @since 2.1
176
- */
177
- if ( ! function_exists( 'ot_register_theme_options_admin_bar_menu' ) ) {
178
-
179
- function ot_register_theme_options_admin_bar_menu( $wp_admin_bar ) {
180
-
181
- if ( ! current_user_can( apply_filters( 'ot_theme_options_capability', 'edit_theme_options' ) ) || ! is_admin_bar_showing() )
182
- return;
183
-
184
- $wp_admin_bar->add_node( array(
185
- 'parent' => 'appearance',
186
- 'id' => apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ),
187
- 'title' => apply_filters( 'ot_theme_options_page_title', __( 'Theme Options', 'option-tree' ) ),
188
- 'href' => admin_url( apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ) . '?page=' . apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ) )
189
- ) );
190
-
191
- }
192
-
193
- }
194
-
195
- /* End of file ot-functions.php */
196
- /* Location: ./includes/ot-functions.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-meta-box-api.php DELETED
@@ -1,286 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree Meta Box API
4
- *
5
- * This class loads all the methods and helpers specific to build a meta box.
6
- *
7
- * @package OptionTree
8
- * @author Derek Herman <derek@valendesigns.com>
9
- * @copyright Copyright (c) 2013, Derek Herman
10
- */
11
- if ( ! class_exists( 'OT_Meta_Box' ) ) {
12
-
13
- class OT_Meta_Box {
14
-
15
- /* variable to store the meta box array */
16
- private $meta_box;
17
-
18
- /**
19
- * PHP5 constructor method.
20
- *
21
- * This method adds other methods of the class to specific hooks within WordPress.
22
- *
23
- * @uses add_action()
24
- *
25
- * @return void
26
- *
27
- * @access public
28
- * @since 1.0
29
- */
30
- function __construct( $meta_box ) {
31
- if ( ! is_admin() )
32
- return;
33
-
34
- $this->meta_box = $meta_box;
35
-
36
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
37
-
38
- add_action( 'save_post', array( $this, 'save_meta_box' ), 1, 2 );
39
-
40
- }
41
-
42
- /**
43
- * Adds meta box to any post type
44
- *
45
- * @uses add_meta_box()
46
- *
47
- * @return void
48
- *
49
- * @access public
50
- * @since 1.0
51
- */
52
- function add_meta_boxes() {
53
- foreach ( (array) $this->meta_box['pages'] as $page ) {
54
- add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'build_meta_box' ), $page, $this->meta_box['context'], $this->meta_box['priority'], $this->meta_box['fields'] );
55
- }
56
- }
57
-
58
- /**
59
- * Meta box view
60
- *
61
- * @return string
62
- *
63
- * @access public
64
- * @since 1.0
65
- */
66
- function build_meta_box( $post, $metabox ) {
67
-
68
- echo '<div class="ot-metabox-wrapper">';
69
-
70
- /* Use nonce for verification */
71
- echo '<input type="hidden" name="' . $this->meta_box['id'] . '_nonce" value="' . wp_create_nonce( $this->meta_box['id'] ) . '" />';
72
-
73
- /* meta box description */
74
- echo isset( $this->meta_box['desc'] ) && ! empty( $this->meta_box['desc'] ) ? '<div class="description" style="padding-top:10px;">' . htmlspecialchars_decode( $this->meta_box['desc'] ) . '</div>' : '';
75
-
76
- /* loop through meta box fields */
77
- foreach ( $this->meta_box['fields'] as $field ) {
78
-
79
- /* get current post meta data */
80
- $field_value = get_post_meta( $post->ID, $field['id'], true );
81
-
82
- /* set standard value */
83
- if ( isset( $field['std'] ) ) {
84
- $field_value = ot_filter_std_value( $field_value, $field['std'] );
85
- }
86
-
87
- /* build the arguments array */
88
- $_args = array(
89
- 'type' => $field['type'],
90
- 'field_id' => $field['id'],
91
- 'field_name' => $field['id'],
92
- 'field_value' => $field_value,
93
- 'field_desc' => isset( $field['desc'] ) ? $field['desc'] : '',
94
- 'field_std' => isset( $field['std'] ) ? $field['std'] : '',
95
- 'field_rows' => isset( $field['rows'] ) && ! empty( $field['rows'] ) ? $field['rows'] : 10,
96
- 'field_post_type' => isset( $field['post_type'] ) && ! empty( $field['post_type'] ) ? $field['post_type'] : 'post',
97
- 'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
98
- 'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
99
- 'field_class' => isset( $field['class'] ) ? $field['class'] : '',
100
- 'field_choices' => isset( $field['choices'] ) ? $field['choices'] : array(),
101
- 'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
102
- 'post_id' => $post->ID,
103
- 'meta' => true
104
- );
105
-
106
- /* only allow simple textarea due to DOM issues with wp_editor() */
107
- if ( $_args['type'] == 'textarea' )
108
- $_args['type'] = 'textarea-simple';
109
-
110
- /* option label */
111
- echo '<div class="format-settings">';
112
-
113
- /* don't show title with textblocks */
114
- if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
115
- echo '<div class="format-setting-label">';
116
- echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>';
117
- echo '</div>';
118
- }
119
-
120
- /* get the option HTML */
121
- echo ot_display_by_type( $_args );
122
-
123
- echo '</div>';
124
-
125
- }
126
-
127
- echo '</div>';
128
-
129
- }
130
-
131
- /**
132
- * Saves the meta box values
133
- *
134
- * @return void
135
- *
136
- * @access public
137
- * @since 1.0
138
- */
139
- function save_meta_box( $post_id, $post_object ) {
140
- global $pagenow;
141
-
142
- /* don't save during quick edit */
143
- if ( $pagenow == 'admin-ajax.php' )
144
- return $post_id;
145
-
146
- /* don't save during autosave */
147
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
148
- return $post_id;
149
-
150
- /* don't save if viewing a revision */
151
- if ( $post_object->post_type == 'revision' )
152
- return $post_id;
153
-
154
- /* verify nonce */
155
- if ( isset( $_POST[ $this->meta_box['id'] . '_nonce'] ) && ! wp_verify_nonce( $_POST[ $this->meta_box['id'] . '_nonce'], $this->meta_box['id'] ) )
156
- return $post_id;
157
-
158
- /* check permissions */
159
- if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
160
- if ( ! current_user_can( 'edit_page', $post_id ) )
161
- return $post_id;
162
- } else {
163
- if ( ! current_user_can( 'edit_post', $post_id ) )
164
- return $post_id;
165
- }
166
-
167
- foreach ( $this->meta_box['fields'] as $field ) {
168
-
169
- $old = get_post_meta( $post_id, $field['id'], true );
170
- $new = '';
171
-
172
- /* there is data to validate */
173
- if ( isset( $_POST[$field['id']] ) ) {
174
-
175
- /* slider and list item */
176
- if ( in_array( $field['type'], array( 'list-item', 'slider' ) ) ) {
177
-
178
- /* required title setting */
179
- $required_setting = array(
180
- array(
181
- 'id' => 'title',
182
- 'label' => __( 'Title', 'option-tree' ),
183
- 'desc' => '',
184
- 'std' => '',
185
- 'type' => 'text',
186
- 'rows' => '',
187
- 'class' => 'option-tree-setting-title',
188
- 'post_type' => '',
189
- 'choices' => array()
190
- )
191
- );
192
-
193
- /* get the settings array */
194
- $settings = isset( $_POST[$field['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$field['id'] . '_settings_array'] ) ) : array();
195
-
196
- /* settings are empty for some odd ass reason get the defaults */
197
- if ( empty( $settings ) ) {
198
- $settings = 'slider' == $field['type'] ?
199
- ot_slider_settings( $field['id'] ) :
200
- ot_list_item_settings( $field['id'] );
201
- }
202
-
203
- /* merge the two settings array */
204
- $settings = array_merge( $required_setting, $settings );
205
-
206
- foreach( $_POST[$field['id']] as $k => $setting_array ) {
207
-
208
- foreach( $settings as $sub_setting ) {
209
-
210
- /* verify sub setting has a type & value */
211
- if ( isset( $sub_setting['type'] ) && isset( $_POST[$field['id']][$k][$sub_setting['id']] ) ) {
212
-
213
- $_POST[$field['id']][$k][$sub_setting['id']] = ot_validate_setting( $_POST[$field['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'] );
214
-
215
- }
216
-
217
- }
218
-
219
- }
220
-
221
- /* set up new data with validated data */
222
- $new = $_POST[$field['id']];
223
-
224
- } else {
225
-
226
- /* run through validattion */
227
- $new = ot_validate_setting( $_POST[$field['id']], $field['type'], $field['id'] );
228
-
229
- }
230
-
231
- /* insert CSS */
232
- if ( $field['type'] == 'css' ) {
233
-
234
- /* insert CSS into dynamic.css */
235
- if ( '' !== $new ) {
236
-
237
- ot_insert_css_with_markers( $field['id'], $new, true );
238
-
239
- /* remove old CSS from dynamic.css */
240
- } else {
241
-
242
- ot_remove_old_css( $field['id'] );
243
-
244
- }
245
-
246
- }
247
-
248
- }
249
-
250
- if ( $new && $new !== $old ) {
251
- update_post_meta( $post_id, $field['id'], $new );
252
- } else if ( '' == $new && $old ) {
253
- delete_post_meta( $post_id, $field['id'], $old );
254
- }
255
- }
256
-
257
- }
258
-
259
- }
260
-
261
- }
262
-
263
- /**
264
- * This method instantiates the meta box class & builds the UI.
265
- *
266
- * @uses OT_Meta_Box()
267
- *
268
- * @param array Array of arguments to create a meta box
269
- * @return void
270
- *
271
- * @access public
272
- * @since 2.0
273
- */
274
- if ( ! function_exists( 'ot_register_meta_box' ) ) {
275
-
276
- function ot_register_meta_box( $args ) {
277
- if ( ! $args )
278
- return;
279
-
280
- $ot_meta_box = new OT_Meta_Box( $args );
281
- }
282
-
283
- }
284
-
285
- /* End of file ot-meta-box-api.php */
286
- /* Location: ./includes/ot-meta-box-api.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-settings-api.php DELETED
@@ -1,912 +0,0 @@
1
- <?php if ( ! defined( 'OT_VERSION') ) exit( 'No direct script access allowed' );
2
- /**
3
- * OptionTree Settings API
4
- *
5
- * This class loads all the methods and helpers specific to a Settings page.
6
- *
7
- * @package OptionTree
8
- * @author Derek Herman <derek@valendesigns.com>
9
- * @copyright Copyright (c) 2013, Derek Herman
10
- */
11
- if ( ! class_exists( 'OT_Settings' ) ) {
12
-
13
- class OT_Settings {
14
-
15
- /* the options array */
16
- private $options;
17
-
18
- /* hooks for targeting admin pages */
19
- private $page_hook;
20
-
21
- /**
22
- * Constructor
23
- *
24
- * @param array An array of options
25
- * @return void
26
- *
27
- * @access public
28
- * @since 2.0
29
- */
30
- public function __construct( $args ) {
31
-
32
- $this->options = $args;
33
-
34
- /* return early if not viewing an admin page or no options */
35
- if ( ! is_admin() || ! is_array( $this->options ) )
36
- return false;
37
-
38
- /* load everything */
39
- $this->hooks();
40
-
41
- }
42
-
43
- /**
44
- * Execute the WordPress Hooks
45
- *
46
- * @return void
47
- *
48
- * @access public
49
- * @since 2.0
50
- */
51
- public function hooks() {
52
-
53
- /* add pages & menu items */
54
- add_action( 'admin_menu', array( $this, 'add_page' ) );
55
-
56
- /* register sections */
57
- add_action( 'admin_init', array( $this, 'add_sections' ) );
58
-
59
- /* register settings */
60
- add_action( 'admin_init', array( $this, 'add_settings' ) );
61
-
62
- /* reset options */
63
- add_action( 'admin_init', array( $this, 'reset_options' ), 10 );
64
-
65
- /* initialize settings */
66
- add_action( 'admin_init', array( $this, 'initialize_settings' ), 11 );
67
-
68
- }
69
-
70
- /**
71
- * Loads each admin page
72
- *
73
- * @return void
74
- *
75
- * @access public
76
- * @since 2.0
77
- */
78
- public function add_page() {
79
-
80
- /* loop through options */
81
- foreach( (array) $this->options as $option ) {
82
-
83
- /* loop through pages */
84
- foreach( (array) $this->get_pages( $option ) as $page ) {
85
-
86
- /**
87
- * Theme Check... stop nagging me about this kind of stuff.
88
- * The damn admin pages are required for OT to function, duh!
89
- */
90
- $theme_check_bs = 'add_menu_page';
91
- $theme_check_bs2 = 'add_submenu_page';
92
-
93
- /* load page in WP top level menu */
94
- if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
95
- $page_hook = $theme_check_bs(
96
- $page['page_title'],
97
- $page['menu_title'],
98
- $page['capability'],
99
- $page['menu_slug'],
100
- array( $this, 'display_page' ),
101
- $page['icon_url'],
102
- $page['position']
103
- );
104
- /* load page in WP sub menu */
105
- } else {
106
- $page_hook = $theme_check_bs2(
107
- $page['parent_slug'],
108
- $page['page_title'],
109
- $page['menu_title'],
110
- $page['capability'],
111
- $page['menu_slug'],
112
- array( $this, 'display_page' )
113
- );
114
- }
115
-
116
- /* only load if not a hidden page */
117
- if ( ! isset( $page['hidden_page'] ) ) {
118
-
119
- /* associate $page_hook with page id */
120
- $this->page_hook[$page['id']] = $page_hook;
121
-
122
- /* add scripts */
123
- add_action( 'admin_print_scripts-' . $page_hook, array( $this, 'scripts' ) );
124
-
125
- /* add styles */
126
- add_action( 'admin_print_styles-' . $page_hook, array( $this, 'styles' ) );
127
-
128
- /* add contextual help */
129
- add_action( 'load-' . $page_hook, array( $this, 'help' ) );
130
-
131
- }
132
-
133
- }
134
-
135
- }
136
-
137
- return false;
138
- }
139
-
140
- /**
141
- * Loads the scripts
142
- *
143
- * @return void
144
- *
145
- * @access public
146
- * @since 2.0
147
- */
148
- public function scripts() {
149
- ot_admin_scripts();
150
- }
151
-
152
- /**
153
- * Loads the styles
154
- *
155
- * @return void
156
- *
157
- * @access public
158
- * @since 2.0
159
- */
160
- public function styles() {
161
- ot_admin_styles();
162
- }
163
-
164
- /**
165
- * Loads the contextual help for each page
166
- *
167
- * @return void
168
- *
169
- * @access public
170
- * @since 2.0
171
- */
172
- public function help() {
173
- $screen = get_current_screen();
174
-
175
- /* loop through options */
176
- foreach( (array) $this->options as $option ) {
177
-
178
- /* loop through pages */
179
- foreach( (array) $this->get_pages( $option ) as $page ) {
180
-
181
- /* verify page */
182
- if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
183
-
184
- /* set up the help tabs */
185
- if ( ! empty( $page['contextual_help']['content'] ) ) {
186
- foreach( $page['contextual_help']['content'] as $contextual_help ) {
187
- $screen->add_help_tab(
188
- array(
189
- 'id' => esc_attr( $contextual_help['id'] ),
190
- 'title' => esc_attr( $contextual_help['title'] ),
191
- 'content' => htmlspecialchars_decode( $contextual_help['content'] ),
192
- )
193
- );
194
- }
195
- }
196
-
197
- /* set up the help sidebar */
198
- if ( ! empty( $page['contextual_help']['sidebar'] ) ) {
199
- $screen->set_help_sidebar( htmlspecialchars_decode( $page['contextual_help']['sidebar'] ) );
200
- }
201
-
202
- }
203
-
204
- }
205
-
206
- }
207
-
208
- return false;
209
- }
210
-
211
- /**
212
- * Loads the content for each page
213
- *
214
- * @return string
215
- *
216
- * @access public
217
- * @since 2.0
218
- */
219
- public function display_page() {
220
- $screen = get_current_screen();
221
-
222
- /* loop through settings */
223
- foreach( (array) $this->options as $option ) {
224
-
225
- /* loop through pages */
226
- foreach( (array) $this->get_pages( $option ) as $page ) {
227
-
228
- /* verify page */
229
- if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
230
-
231
- $show_buttons = isset( $page['show_buttons'] ) && $page['show_buttons'] == false ? false : true;
232
-
233
- /* update active layout content */
234
- if ( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) {
235
-
236
- $layouts = get_option( 'option_tree_layouts' );
237
-
238
- /* has active layout */
239
- if ( isset( $layouts['active_layout'] ) ) {
240
- $option_tree = get_option( $option['id'] );
241
- $layouts[$layouts['active_layout']] = ot_encode( serialize( $option_tree ) );
242
- update_option( 'option_tree_layouts', $layouts );
243
- }
244
-
245
- }
246
-
247
- echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
248
-
249
- screen_icon( ( isset( $page['screen_icon'] ) ? $page['screen_icon'] : 'options-general' ) );
250
- echo '<h2>' . $page['page_title'] . '</h2>';
251
-
252
- echo ot_alert_message( $page );
253
-
254
- settings_errors( 'option-tree' );
255
-
256
- /* Header */
257
- echo '<div id="option-tree-header-wrap">';
258
-
259
- echo '<ul id="option-tree-header">';
260
-
261
- echo '<li id="option-tree-logo"><a href="http://wordpress.org/extend/plugins/option-tree/" target="_blank">OptionTree</a></li>';
262
-
263
- echo '<li id="option-tree-version"><span>Version ' . OT_VERSION . '</span></li>';
264
-
265
- echo '</ul>';
266
-
267
- /* layouts form */
268
- if ( $page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true )
269
- ot_theme_options_layouts_form();
270
-
271
- echo '</div>';
272
-
273
- /* remove forms on the custom settings pages */
274
- if ( $show_buttons ) {
275
-
276
- echo '<form action="options.php" method="post" id="option-tree-settings-api">';
277
-
278
- settings_fields( $option['id'] );
279
-
280
- } else {
281
-
282
- echo '<div id="option-tree-settings-api">';
283
-
284
- }
285
-
286
- /* Sub Header */
287
- echo '<div id="option-tree-sub-header">';
288
-
289
- if ( $show_buttons )
290
- echo '<button class="option-tree-ui-button blue right">' . $page['button_text'] . '</button>';
291
-
292
- echo '</div>';
293
-
294
- /* Navigation */
295
- echo '<div class="ui-tabs">';
296
-
297
- /* check for sections */
298
- if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
299
-
300
- echo '<ul class="ui-tabs-nav">';
301
-
302
- /* loop through page sections */
303
- foreach( (array) $page['sections'] as $section ) {
304
- echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
305
- }
306
-
307
- echo '</ul>';
308
-
309
- }
310
-
311
- /* sections */
312
- echo '<div id="poststuff" class="metabox-holder">';
313
-
314
- echo '<div id="post-body">';
315
-
316
- echo '<div id="post-body-content">';
317
-
318
- $this->do_settings_sections( $_GET['page'] );
319
-
320
- echo '</div>';
321
-
322
- echo '</div>';
323
-
324
- echo '</div>';
325
-
326
- echo '<div class="clear"></div>';
327
-
328
- echo '</div>';
329
-
330
- /* buttons */
331
- if ( $show_buttons ) {
332
-
333
- echo '<div class="option-tree-ui-buttons">';
334
-
335
- echo '<button class="option-tree-ui-button blue right">' . $page['button_text'] . '</button>';
336
-
337
- echo '</div>';
338
-
339
- }
340
-
341
- echo $show_buttons ? '</form>' : '</div>';
342
-
343
- /* reset button */
344
- if ( $show_buttons ) {
345
-
346
- echo '<form method="post" action="' . str_replace( '&settings-updated=true', '', $_SERVER["REQUEST_URI"] ) . '">';
347
-
348
- /* form nonce */
349
- wp_nonce_field( 'option_tree_reset_form', 'option_tree_reset_nonce' );
350
-
351
- echo '<input type="hidden" name="action" value="reset" />';
352
-
353
- echo '<button type="submit" class="option-tree-ui-button red left reset-settings" title="' . __( 'Reset Options', 'option-tree' ) . '">' . __( 'Reset Options', 'option-tree' ) . '</button>';
354
-
355
- echo '</form>';
356
-
357
- }
358
-
359
- echo '</div>';
360
-
361
- }
362
-
363
- }
364
-
365
- }
366
-
367
- return false;
368
- }
369
-
370
- /**
371
- * Adds sections to the page
372
- *
373
- * @return void
374
- *
375
- * @access public
376
- * @since 2.0
377
- */
378
- public function add_sections() {
379
-
380
- /* loop through options */
381
- foreach( (array) $this->options as $option ) {
382
-
383
- /* loop through pages */
384
- foreach( (array) $this->get_pages( $option ) as $page ) {
385
-
386
- /* loop through page sections */
387
- foreach( (array) $this->get_sections( $page ) as $section ) {
388
-
389
- /* add each section */
390
- add_settings_section(
391
- $section['id'],
392
- $section['title'],
393
- array( $this, 'display_section' ),
394
- $page['menu_slug']
395
- );
396
-
397
- }
398
-
399
- }
400
-
401
- }
402
-
403
- return false;
404
- }
405
-
406
- /**
407
- * Callback for add_settings_section()
408
- *
409
- * @return string
410
- *
411
- * @access public
412
- * @since 2.0
413
- */
414
- public function display_section() {
415
- /* currently pointless */
416
- }
417
-
418
- /**
419
- * Add settings the the page
420
- *
421
- * @return void
422
- *
423
- * @access public
424
- * @since 2.0
425
- */
426
- public function add_settings() {
427
-
428
- /* loop through options */
429
- foreach( (array) $this->options as $option ) {
430
-
431
- register_setting( $option['id'], $option['id'], array ( $this, 'sanitize_callback' ) );
432
-
433
- /* loop through pages */
434
- foreach( (array) $this->get_pages( $option ) as $page ) {
435
-
436
- /* loop through page settings */
437
- foreach( (array) $this->get_the_settings( $page ) as $setting ) {
438
-
439
- /* skip if no setting ID */
440
- if ( ! isset( $setting['id'] ) )
441
- continue;
442
-
443
- /* add get_option param to the array */
444
- $setting['get_option'] = $option['id'];
445
-
446
- /* add each setting */
447
- add_settings_field(
448
- $setting['id'],
449
- $setting['label'],
450
- array( $this, 'display_setting' ),
451
- $page['menu_slug'],
452
- $setting['section'],
453
- $setting
454
- );
455
-
456
- }
457
-
458
- }
459
-
460
- }
461
-
462
- return false;
463
- }
464
-
465
- /**
466
- * Callback for add_settings_field() to build each setting by type
467
- *
468
- * @param array Setting object array
469
- * @return string
470
- *
471
- * @access public
472
- * @since 2.0
473
- */
474
- public function display_setting( $args = array() ) {
475
- extract( $args );
476
-
477
- /* get current saved data */
478
- $options = get_option( $get_option, false );
479
-
480
- // Set field value
481
- $field_value = isset( $options[$id] ) ? $options[$id] : '';
482
-
483
- /* set standard value */
484
- if ( isset( $std ) ) {
485
- $field_value = ot_filter_std_value( $field_value, $std );
486
- }
487
-
488
- /* build the arguments array */
489
- $_args = array(
490
- 'type' => $type,
491
- 'field_id' => $id,
492
- 'field_name' => $get_option . '[' . $id . ']',
493
- 'field_value' => $field_value,
494
- 'field_desc' => isset( $desc ) ? $desc : '',
495
- 'field_std' => isset( $std ) ? $std : '',
496
- 'field_rows' => isset( $rows ) && ! empty( $rows ) ? $rows : 15,
497
- 'field_post_type' => isset( $post_type ) && ! empty( $post_type ) ? $post_type : 'post',
498
- 'field_taxonomy' => isset( $taxonomy ) && ! empty( $taxonomy ) ? $taxonomy : 'category',
499
- 'field_min_max_step'=> isset( $min_max_step ) && ! empty( $min_max_step ) ? $min_max_step : '0,100,1',
500
- 'field_class' => isset( $class ) ? $class : '',
501
- 'field_choices' => isset( $choices ) && ! empty( $choices ) ? $choices : array(),
502
- 'field_settings' => isset( $settings ) && ! empty( $settings ) ? $settings : array(),
503
- 'post_id' => ot_get_media_post_ID(),
504
- 'get_option' => $get_option,
505
- );
506
-
507
- /* get the option HTML */
508
- echo ot_display_by_type( $_args );
509
- }
510
-
511
- /**
512
- * Sets the option standards if nothing yet exists.
513
- *
514
- * @return void
515
- *
516
- * @access public
517
- * @since 2.0
518
- */
519
- public function initialize_settings() {
520
-
521
- /* loop through options */
522
- foreach( (array) $this->options as $option ) {
523
-
524
- /* skip if option is already set */
525
- if ( isset( $option['id'] ) && get_option( $option['id'], false ) ) {
526
- return false;
527
- }
528
-
529
- $defaults = array();
530
-
531
- /* loop through pages */
532
- foreach( (array) $this->get_pages( $option ) as $page ) {
533
-
534
- /* loop through page settings */
535
- foreach( (array) $this->get_the_settings( $page ) as $setting ) {
536
-
537
- if ( isset( $setting['std'] ) ) {
538
-
539
- $defaults[$setting['id']] = ot_validate_setting( $setting['std'], $setting['type'], $setting['id'] );
540
-
541
- }
542
-
543
- }
544
-
545
- }
546
-
547
- update_option( $option['id'], $defaults );
548
-
549
- }
550
-
551
- return false;
552
- }
553
-
554
- /**
555
- * Sanitize callback for register_setting()
556
- *
557
- * @return string
558
- *
559
- * @access public
560
- * @since 2.0
561
- */
562
- public function sanitize_callback( $input ) {
563
-
564
- /* loop through options */
565
- foreach( (array) $this->options as $option ) {
566
-
567
- /* loop through pages */
568
- foreach( (array) $this->get_pages( $option ) as $page ) {
569
-
570
- /* loop through page settings */
571
- foreach( (array) $this->get_the_settings( $page ) as $setting ) {
572
-
573
- /* verify setting has a type & value */
574
- if ( isset( $setting['type'] ) && isset( $input[$setting['id']] ) ) {
575
-
576
- /* get the defaults */
577
- $current_settings = get_option( 'option_tree_settings' );
578
- $current_options = get_option( $option['id'] );
579
-
580
- /* validate setting */
581
- if ( is_array( $input[$setting['id']] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
582
-
583
- /* required title setting */
584
- $required_setting = array(
585
- array(
586
- 'id' => 'title',
587
- 'label' => __( 'Title', 'option-tree' ),
588
- 'desc' => '',
589
- 'std' => '',
590
- 'type' => 'text',
591
- 'rows' => '',
592
- 'class' => 'option-tree-setting-title',
593
- 'post_type' => '',
594
- 'choices' => array()
595
- )
596
- );
597
-
598
- /* get the settings array */
599
- $settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
600
-
601
- /* settings are empty for some odd ass reason get the defaults */
602
- if ( empty( $settings ) ) {
603
- $settings = 'slider' == $setting['type'] ?
604
- ot_slider_settings( $setting['id'] ) :
605
- ot_list_item_settings( $setting['id'] );
606
- }
607
-
608
- /* merge the two settings array */
609
- $settings = array_merge( $required_setting, $settings );
610
-
611
- /* create an empty WPML id array */
612
- $wpml_ids = array();
613
-
614
- foreach( $input[$setting['id']] as $k => $setting_array ) {
615
-
616
- foreach( $settings as $sub_setting ) {
617
-
618
- /* setup the WPML ID */
619
- $wpml_id = $setting['id'] . '_' . $sub_setting['id'] . '_' . $k;
620
-
621
- /* add id to array */
622
- $wpml_ids[] = $wpml_id;
623
-
624
- /* verify sub setting has a type & value */
625
- if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
626
-
627
- /* validate setting */
628
- $input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'], $wpml_id );
629
-
630
- }
631
-
632
- }
633
-
634
- }
635
-
636
- } else {
637
-
638
- $input[$setting['id']] = ot_validate_setting( $input[$setting['id']], $setting['type'], $setting['id'], $setting['id'] );
639
-
640
- }
641
-
642
- }
643
-
644
- /* unregister WPML strings that were deleted from lists and sliders */
645
- if ( isset( $current_settings['settings'] ) && isset( $setting['type'] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
646
-
647
- if ( ! isset( $wpml_ids ) )
648
- $wpml_ids = array();
649
-
650
- foreach( $current_settings['settings'] as $check_setting ) {
651
-
652
- if ( $setting['id'] == $check_setting['id'] && ! empty( $current_options[$setting['id']] ) ) {
653
-
654
- foreach( $current_options[$setting['id']] as $key => $value ) {
655
-
656
- foreach( $value as $ckey => $cvalue ) {
657
-
658
- $id = $setting['id'] . '_' . $ckey . '_' . $key;
659
-
660
- if ( ! in_array( $id, $wpml_ids ) ) {
661
-
662
- ot_wpml_unregister_string( $id );
663
-
664
- }
665
-
666
- }
667
-
668
- }
669
-
670
- }
671
-
672
- }
673
-
674
- }
675
-
676
- }
677
-
678
- }
679
-
680
- }
681
-
682
- return $input;
683
-
684
- }
685
-
686
- /**
687
- * Helper function to get the pages array for an option
688
- *
689
- * @param array Option array
690
- * @return mixed
691
- *
692
- * @access public
693
- * @since 2.0
694
- */
695
- public function get_pages( $option = array() ) {
696
-
697
- if ( empty( $option ) )
698
- return false;
699
-
700
- /* check for pages */
701
- if ( isset( $option['pages'] ) && ! empty( $option['pages'] ) ) {
702
-
703
- /* return pages array */
704
- return $option['pages'];
705
-
706
- }
707
-
708
- return false;
709
- }
710
-
711
- /**
712
- * Helper function to get the sections array for a page
713
- *
714
- * @param array Page array
715
- * @return mixed
716
- *
717
- * @access public
718
- * @since 2.0
719
- */
720
- public function get_sections( $page = array() ) {
721
-
722
- if ( empty( $page ) )
723
- return false;
724
-
725
- /* check for sections */
726
- if ( isset( $page['sections'] ) && ! empty( $page['sections'] ) ) {
727
-
728
- /* return sections array */
729
- return $page['sections'];
730
-
731
- }
732
-
733
- return false;
734
- }
735
-
736
- /**
737
- * Helper function to get the settings array for a page
738
- *
739
- * @param array Page array
740
- * @return mixed
741
- *
742
- * @access public
743
- * @since 2.0
744
- */
745
- public function get_the_settings( $page = array() ) {
746
-
747
- if ( empty( $page ) )
748
- return false;
749
-
750
- /* check for settings */
751
- if ( isset( $page['settings'] ) && ! empty( $page['settings'] ) ) {
752
-
753
- /* return settings array */
754
- return $page['settings'];
755
-
756
- }
757
-
758
- return false;
759
- }
760
-
761
- /**
762
- * Prints out all settings sections added to a particular settings page
763
- *
764
- * @global $wp_settings_sections Storage array of all settings sections added to admin pages
765
- * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
766
- *
767
- * @param string The slug name of the page whos settings sections you want to output
768
- * @return string
769
- *
770
- * @access public
771
- * @since 2.0
772
- */
773
- public function do_settings_sections( $page ) {
774
- global $wp_settings_sections, $wp_settings_fields;
775
-
776
- if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[$page] ) ) {
777
- return false;
778
- }
779
-
780
- foreach ( (array) $wp_settings_sections[$page] as $section ) {
781
-
782
- if ( ! isset( $section['id'] ) )
783
- continue;
784
-
785
- echo '<div id="section_' . $section['id'] . '" class="postbox ui-tabs-panel">';
786
-
787
- call_user_func( $section['callback'], $section );
788
-
789
- if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[$page] ) || ! isset( $wp_settings_fields[$page][$section['id']] ) )
790
- continue;
791
-
792
- echo '<div class="inside">';
793
-
794
- $this->do_settings_fields( $page, $section['id'] );
795
-
796
- echo '</div>';
797
-
798
- echo '</div>';
799
-
800
- }
801
-
802
- }
803
-
804
- /**
805
- * Print out the settings fields for a particular settings section
806
- *
807
- * @global $wp_settings_fields Storage array of settings fields and their pages/sections
808
- *
809
- * @param string $page Slug title of the admin page who's settings fields you want to show.
810
- * @param string $section Slug title of the settings section who's fields you want to show.
811
- * @return string
812
- *
813
- * @access public
814
- * @since 2.0
815
- */
816
- public function do_settings_fields( $page, $section ) {
817
- global $wp_settings_fields;
818
-
819
- if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
820
- return;
821
-
822
- foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
823
-
824
- echo '<div id="setting_' . $field['id'] . '" class="format-settings">';
825
-
826
- echo '<div class="format-setting-wrap">';
827
-
828
- if ( $field['args']['type'] != 'textblock' && ! empty( $field['title'] ) ) {
829
-
830
- echo '<div class="format-setting-label">';
831
-
832
- echo '<h3 class="label">' . $field['title'] . '</h3>';
833
-
834
- echo '</div>';
835
-
836
- }
837
-
838
- call_user_func( $field['callback'], $field['args'] );
839
-
840
- echo '</div>';
841
-
842
- echo '</div>';
843
-
844
- }
845
-
846
- }
847
-
848
- /**
849
- * Resets page options before the screen is displayed
850
- *
851
- * @return void
852
- *
853
- * @access public
854
- * @since 2.0
855
- */
856
- public function reset_options() {
857
-
858
- /* check for reset action */
859
- if ( isset( $_POST['option_tree_reset_nonce'] ) && wp_verify_nonce( $_POST['option_tree_reset_nonce'], 'option_tree_reset_form' ) ) {
860
-
861
- /* loop through options */
862
- foreach( (array) $this->options as $option ) {
863
-
864
- /* loop through pages */
865
- foreach( (array) $this->get_pages( $option ) as $page ) {
866
-
867
- /* verify page */
868
- if ( isset( $_GET['page'] ) && $_GET['page'] == $page['menu_slug'] ) {
869
-
870
- /* reset options */
871
- delete_option( $option['id'] );
872
-
873
- }
874
-
875
- }
876
-
877
- }
878
-
879
- }
880
-
881
- return false;
882
-
883
- }
884
-
885
- }
886
-
887
- }
888
-
889
- /**
890
- * This method instantiates the settings class & builds the UI.
891
- *
892
- * @uses OT_Settings()
893
- *
894
- * @param array Array of arguments to create settings
895
- * @return void
896
- *
897
- * @access public
898
- * @since 2.0
899
- */
900
- if ( ! function_exists( 'ot_register_settings' ) ) {
901
-
902
- function ot_register_settings( $args ) {
903
- if ( ! $args )
904
- return;
905
-
906
- $ot_settings = new OT_Settings( $args );
907
- }
908
-
909
- }
910
-
911
- /* End of file ot-settings-api.php */
912
- /* Location: ./includes/ot-settings-api.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: OptionTree
4
+ Plugin URI: http://wp.envato.com
5
+ Description: Customizable WordPress Theme Options Framework
6
+ Version: 1.0.0
7
+ Author: Derek Herman
8
+ Author URI: http://valendesigns.com
9
+ */
10
+
11
+ /**
12
+ * Definitions
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ define( 'OT_VERSION', '1.0.0' );
17
+ define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
18
+ define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
19
+
20
+ /**
21
+ * Required Files
22
+ *
23
+ * @since 1.0.0
24
+ */
25
+ require_once('functions/functions.load.php');
26
+ require_once('classes/class.admin.php');
27
+
28
+ /**
29
+ * Instantiate Classe
30
+ *
31
+ * @since 1.0.0
32
+ */
33
+ $ot_admin = new OT_Admin();
34
+
35
+ /**
36
+ * Wordpress Activate/Deactivate
37
+ *
38
+ * @uses register_activation_hook()
39
+ * @uses register_deactivation_hook()
40
+ *
41
+ * @since 1.0
42
+ */
43
+ register_activation_hook( __FILE__, array( $ot_admin, 'option_tree_activate' ) );
44
+ register_deactivation_hook( __FILE__, array( $ot_admin, 'option_tree_deactivate' ) );
45
+
46
+ /**
47
+ * Required action filters
48
+ *
49
+ * @uses add_action()
50
+ *
51
+ * @since 1.0
52
+ */
53
+ add_action( 'init', array( $ot_admin, 'create_option_post' ), 5 );
54
+ add_action( 'admin_init', array( $ot_admin, 'option_tree_init' ) );
55
+ add_action( 'admin_menu', array( $ot_admin, 'option_tree_admin' ) );
56
+ add_action( 'wp_ajax_option_tree_array_save', array( $ot_admin, 'option_tree_array_save' ) );
57
+ add_action( 'wp_ajax_option_tree_array_reset', array( $ot_admin, 'option_tree_array_reset' ) );
58
+ add_action( 'wp_ajax_option_tree_add', array( $ot_admin, 'option_tree_add' ) );
59
+ add_action( 'wp_ajax_option_tree_edit', array( $ot_admin, 'option_tree_edit' ) );
60
+ add_action( 'wp_ajax_option_tree_delete', array( $ot_admin, 'option_tree_delete' ) );
61
+ add_action( 'wp_ajax_option_tree_next_id', array( $ot_admin, 'option_tree_next_id' ) );
62
+ add_action( 'wp_ajax_option_tree_sort', array( $ot_admin, 'option_tree_sort' ) );
63
+ add_action( 'wp_ajax_option_tree_import_data', array( $ot_admin, 'option_tree_import_data' ) );
languages/option-tree.pot DELETED
@@ -1,1753 +0,0 @@
1
- # Copyright (C) 2013
2
- # This file is distributed under the same license as the package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: \n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
- "POT-Creation-Date: 2013-08-11 08:44:35+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #: includes/ot-functions-admin.php:50 includes/ot-functions-admin.php:51
16
- #: includes/ot-functions-admin.php:157 includes/ot-functions-admin.php:181
17
- #: includes/ot-functions.php:187
18
- msgid "Theme Options"
19
- msgstr ""
20
-
21
- #: includes/ot-functions-admin.php:56 includes/ot-functions-admin.php:113
22
- #: includes/ot-functions-admin.php:208
23
- msgid "Theme Options updated."
24
- msgstr ""
25
-
26
- #: includes/ot-functions-admin.php:57 includes/ot-functions-admin.php:114
27
- #: includes/ot-functions-admin.php:209
28
- msgid "Theme Options reset."
29
- msgstr ""
30
-
31
- #: includes/ot-functions-admin.php:58
32
- #: includes/ot-functions-settings-page.php:94
33
- #: includes/ot-functions-settings-page.php:133
34
- msgid "Save Changes"
35
- msgstr ""
36
-
37
- #: includes/ot-functions-admin.php:96 includes/ot-functions-admin.php:97
38
- msgid "OptionTree"
39
- msgstr ""
40
-
41
- #: includes/ot-functions-admin.php:107 includes/ot-functions-admin.php:108
42
- #: includes/ot-functions-admin.php:151 includes/ot-functions-admin.php:175
43
- #: includes/ot-functions-docs-page.php:49
44
- msgid "Settings"
45
- msgstr ""
46
-
47
- #: includes/ot-functions-admin.php:115 includes/ot-functions-admin.php:210
48
- msgid "Save Settings"
49
- msgstr ""
50
-
51
- #: includes/ot-functions-admin.php:121
52
- msgid "Theme Options UI"
53
- msgstr ""
54
-
55
- #: includes/ot-functions-admin.php:125
56
- msgid "Import"
57
- msgstr ""
58
-
59
- #: includes/ot-functions-admin.php:129
60
- msgid "Export"
61
- msgstr ""
62
-
63
- #: includes/ot-functions-admin.php:133 includes/ot-functions-admin.php:163
64
- #: includes/ot-functions-admin.php:187
65
- msgid "Layouts"
66
- msgstr ""
67
-
68
- #: includes/ot-functions-admin.php:139
69
- msgid "Theme Options UI Builder"
70
- msgstr ""
71
-
72
- #: includes/ot-functions-admin.php:145
73
- msgid "Settings XML"
74
- msgstr ""
75
-
76
- #: includes/ot-functions-admin.php:169
77
- msgid "Settings PHP File"
78
- msgstr ""
79
-
80
- #: includes/ot-functions-admin.php:193
81
- msgid "Layout Management"
82
- msgstr ""
83
-
84
- #: includes/ot-functions-admin.php:202 includes/ot-functions-admin.php:203
85
- msgid "Documentation"
86
- msgstr ""
87
-
88
- #: includes/ot-functions-admin.php:216
89
- msgid "Creating Options"
90
- msgstr ""
91
-
92
- #: includes/ot-functions-admin.php:220
93
- msgid "Option Types"
94
- msgstr ""
95
-
96
- #: includes/ot-functions-admin.php:224
97
- msgid "Function References"
98
- msgstr ""
99
-
100
- #: includes/ot-functions-admin.php:228 includes/ot-functions-admin.php:270
101
- msgid "Theme Mode"
102
- msgstr ""
103
-
104
- #: includes/ot-functions-admin.php:232 includes/ot-functions-admin.php:276
105
- msgid "Meta Boxes"
106
- msgstr ""
107
-
108
- #: includes/ot-functions-admin.php:236
109
- msgid "Code Examples"
110
- msgstr ""
111
-
112
- #: includes/ot-functions-admin.php:240
113
- msgid "Layouts Overview"
114
- msgstr ""
115
-
116
- #: includes/ot-functions-admin.php:246
117
- msgid "Overview of available Theme Option fields."
118
- msgstr ""
119
-
120
- #: includes/ot-functions-admin.php:252
121
- msgid "Option types in alphabetical order & hooks to filter them."
122
- msgstr ""
123
-
124
- #: includes/ot-functions-admin.php:258
125
- msgid "Function Reference:ot_get_option()"
126
- msgstr ""
127
-
128
- #: includes/ot-functions-admin.php:264
129
- msgid "Function Reference:get_option_tree()"
130
- msgstr ""
131
-
132
- #: includes/ot-functions-admin.php:282
133
- msgid "Code examples for front-end development."
134
- msgstr ""
135
-
136
- #: includes/ot-functions-admin.php:288
137
- msgid "What's a layout anyhow?"
138
- msgstr ""
139
-
140
- #: includes/ot-functions-admin.php:476
141
- msgid "The Colorpicker only allows valid hexadecimal values."
142
- msgstr ""
143
-
144
- #: includes/ot-functions-admin.php:564
145
- msgid "Send to OptionTree"
146
- msgstr ""
147
-
148
- #: includes/ot-functions-admin.php:565
149
- #: includes/ot-functions-option-types.php:152
150
- #: includes/ot-functions-option-types.php:1871
151
- msgid "Remove Media"
152
- msgstr ""
153
-
154
- #: includes/ot-functions-admin.php:566
155
- msgid "Are you sure you want to reset back to the defaults?"
156
- msgstr ""
157
-
158
- #: includes/ot-functions-admin.php:567
159
- msgid "You can't remove this! But you can edit the values."
160
- msgstr ""
161
-
162
- #: includes/ot-functions-admin.php:568
163
- msgid "Are you sure you want to remove this?"
164
- msgstr ""
165
-
166
- #: includes/ot-functions-admin.php:569
167
- msgid "Are you sure you want to activate this layout?"
168
- msgstr ""
169
-
170
- #: includes/ot-functions-admin.php:570
171
- msgid "Sorry, you can't have settings three levels deep."
172
- msgstr ""
173
-
174
- #: includes/ot-functions-admin.php:616
175
- msgid "Option Tree"
176
- msgstr ""
177
-
178
- #: includes/ot-functions-admin.php:752
179
- msgid "General"
180
- msgstr ""
181
-
182
- #: includes/ot-functions-admin.php:758
183
- msgid "Sample Text Field Label"
184
- msgstr ""
185
-
186
- #: includes/ot-functions-admin.php:759
187
- msgid "Description for the sample text field."
188
- msgstr ""
189
-
190
- #: includes/ot-functions-admin.php:1957
191
- msgid "Settings updated."
192
- msgstr ""
193
-
194
- #: includes/ot-functions-admin.php:1961
195
- msgid "Settings could not be saved."
196
- msgstr ""
197
-
198
- #: includes/ot-functions-admin.php:1969
199
- msgid "Settings Imported."
200
- msgstr ""
201
-
202
- #: includes/ot-functions-admin.php:1973
203
- msgid "Settings could not be imported."
204
- msgstr ""
205
-
206
- #: includes/ot-functions-admin.php:1980
207
- msgid "Data Imported."
208
- msgstr ""
209
-
210
- #: includes/ot-functions-admin.php:1984
211
- msgid "Data could not be imported."
212
- msgstr ""
213
-
214
- #: includes/ot-functions-admin.php:1992
215
- msgid "Layouts Imported."
216
- msgstr ""
217
-
218
- #: includes/ot-functions-admin.php:1996
219
- msgid "Layouts could not be imported."
220
- msgstr ""
221
-
222
- #: includes/ot-functions-admin.php:2004
223
- msgid "Layouts Updated."
224
- msgstr ""
225
-
226
- #: includes/ot-functions-admin.php:2008
227
- msgid "Layouts could not be updated."
228
- msgstr ""
229
-
230
- #: includes/ot-functions-admin.php:2012
231
- msgid "Layouts have been deleted."
232
- msgstr ""
233
-
234
- #: includes/ot-functions-admin.php:2018
235
- msgid "Layout activated."
236
- msgstr ""
237
-
238
- #: includes/ot-functions-admin.php:2580
239
- msgid "Left Sidebar"
240
- msgstr ""
241
-
242
- #: includes/ot-functions-admin.php:2585
243
- msgid "Right Sidebar"
244
- msgstr ""
245
-
246
- #: includes/ot-functions-admin.php:2590
247
- msgid "Full Width (no sidebar)"
248
- msgstr ""
249
-
250
- #: includes/ot-functions-admin.php:2595
251
- msgid "Dual Sidebar"
252
- msgstr ""
253
-
254
- #: includes/ot-functions-admin.php:2600
255
- msgid "Left Dual Sidebar"
256
- msgstr ""
257
-
258
- #: includes/ot-functions-admin.php:2605
259
- msgid "Right Dual Sidebar"
260
- msgstr ""
261
-
262
- #: includes/ot-functions-admin.php:2635 includes/ot-functions-admin.php:2696
263
- msgid "Image"
264
- msgstr ""
265
-
266
- #: includes/ot-functions-admin.php:2646 includes/ot-functions-admin.php:2702
267
- msgid "Link"
268
- msgstr ""
269
-
270
- #: includes/ot-functions-admin.php:2657 includes/ot-functions-admin.php:2708
271
- #: includes/ot-functions-docs-page.php:43
272
- #: includes/ot-functions-docs-page.php:380
273
- #: includes/ot-functions-docs-page.php:430
274
- msgid "Description"
275
- msgstr ""
276
-
277
- #: includes/ot-functions-admin.php:3180
278
- msgid "edit"
279
- msgstr ""
280
-
281
- #: includes/ot-functions-admin.php:3181 includes/ot-functions-admin.php:3248
282
- #: includes/ot-functions-admin.php:3249 includes/ot-functions-admin.php:3392
283
- #: includes/ot-functions-admin.php:3393 includes/ot-functions-admin.php:3458
284
- #: includes/ot-functions-admin.php:3459 includes/ot-functions-admin.php:3586
285
- #: includes/ot-functions-admin.php:3587
286
- msgid "Edit"
287
- msgstr ""
288
-
289
- #: includes/ot-functions-admin.php:3183 includes/ot-functions-admin.php:3184
290
- #: includes/ot-functions-admin.php:3251 includes/ot-functions-admin.php:3252
291
- #: includes/ot-functions-admin.php:3395 includes/ot-functions-admin.php:3396
292
- #: includes/ot-functions-admin.php:3461 includes/ot-functions-admin.php:3462
293
- #: includes/ot-functions-admin.php:3520 includes/ot-functions-admin.php:3521
294
- #: includes/ot-functions-admin.php:3589 includes/ot-functions-admin.php:3590
295
- msgid "Delete"
296
- msgstr ""
297
-
298
- #: includes/ot-functions-admin.php:3190
299
- msgid ""
300
- "<strong>Section Title</strong>: Displayed as a menu item on the Theme "
301
- "Options page."
302
- msgstr ""
303
-
304
- #: includes/ot-functions-admin.php:3198
305
- msgid ""
306
- "<strong>Section ID</strong>: A unique lower case alphanumeric string, "
307
- "underscores allowed."
308
- msgstr ""
309
-
310
- #: includes/ot-functions-admin.php:3258
311
- msgid ""
312
- "<strong>Label</strong>: Displayed as the label of a form element on the "
313
- "Theme Options page."
314
- msgstr ""
315
-
316
- #: includes/ot-functions-admin.php:3266 includes/ot-functions-admin.php:3476
317
- msgid ""
318
- "<strong>ID</strong>: A unique lower case alphanumeric string, underscores "
319
- "allowed."
320
- msgstr ""
321
-
322
- #: includes/ot-functions-admin.php:3274
323
- msgid ""
324
- "<strong>Type</strong>: Choose one of the available option types from the "
325
- "dropdown."
326
- msgstr ""
327
-
328
- #: includes/ot-functions-admin.php:3285
329
- msgid ""
330
- "<strong>Description</strong>: Enter a detailed description for the users to "
331
- "read on the Theme Options page, HTML is allowed. This is also where you "
332
- "enter content for both the Textblock & Textblock Titled option types."
333
- msgstr ""
334
-
335
- #: includes/ot-functions-admin.php:3293
336
- msgid ""
337
- "<strong>Choices</strong>: This will only affect the following option types: "
338
- "Checkbox, Radio, Select & Select Image."
339
- msgstr ""
340
-
341
- #: includes/ot-functions-admin.php:3298
342
- msgid "Add Choice"
343
- msgstr ""
344
-
345
- #: includes/ot-functions-admin.php:3304
346
- msgid ""
347
- "<strong>Settings</strong>: This will only affect the List Item option type."
348
- msgstr ""
349
-
350
- #: includes/ot-functions-admin.php:3309
351
- #: includes/ot-functions-settings-page.php:93
352
- msgid "Add Setting"
353
- msgstr ""
354
-
355
- #: includes/ot-functions-admin.php:3315
356
- msgid ""
357
- "<strong>Standard</strong>: Setting the standard value for your option only "
358
- "works for some option types. Read the <code>OptionTree->Documentation</code> "
359
- "for more information on which ones."
360
- msgstr ""
361
-
362
- #: includes/ot-functions-admin.php:3323
363
- msgid ""
364
- "<strong>Rows</strong>: Enter a numeric value for the number of rows in your "
365
- "textarea. This will only affect the following option types: CSS, Textarea, & "
366
- "Textarea Simple."
367
- msgstr ""
368
-
369
- #: includes/ot-functions-admin.php:3331
370
- msgid ""
371
- "<strong>Post Type</strong>: Add a comma separated list of post type like "
372
- "'post,page'. This will only affect the following option types: Custom Post "
373
- "Type Checkbox, & Custom Post Type Select."
374
- msgstr ""
375
-
376
- #: includes/ot-functions-admin.php:3339
377
- msgid ""
378
- "<strong>Taxonomy</strong>: Add a comma separated list of any registered "
379
- "taxonomy like 'category,post_tag'. This will only affect the following "
380
- "option types: Taxonomy Checkbox, & Taxonomy Select."
381
- msgstr ""
382
-
383
- #: includes/ot-functions-admin.php:3347
384
- msgid ""
385
- "<strong>Min, Max, & Step</strong>: Add a comma separated list of options in "
386
- "the following format <code>0,100,1</code> (slide from <code>0-100</code> in "
387
- "intervals of <code>1</code>). The three values represent the minimum, "
388
- "maximum, and step options and will only affect the Numeric Slider option "
389
- "type."
390
- msgstr ""
391
-
392
- #: includes/ot-functions-admin.php:3355
393
- msgid "<strong>CSS Class</strong>: Add and optional class to this option type."
394
- msgstr ""
395
-
396
- #: includes/ot-functions-admin.php:3402 includes/ot-functions-docs-page.php:29
397
- msgid "Label"
398
- msgstr ""
399
-
400
- #: includes/ot-functions-admin.php:3412
401
- msgid "Value"
402
- msgstr ""
403
-
404
- #: includes/ot-functions-admin.php:3422
405
- msgid "Image Source (Radio Image only)"
406
- msgstr ""
407
-
408
- #: includes/ot-functions-admin.php:3468
409
- msgid ""
410
- "<strong>Title</strong>: Displayed as a contextual help menu item on the "
411
- "Theme Options page."
412
- msgstr ""
413
-
414
- #: includes/ot-functions-admin.php:3484
415
- msgid ""
416
- "<strong>Content</strong>: Enter the HTML content about this contextual help "
417
- "item displayed on the Theme Option page for end users to read."
418
- msgstr ""
419
-
420
- #: includes/ot-functions-admin.php:3515
421
- msgid "Layout"
422
- msgstr ""
423
-
424
- #: includes/ot-functions-admin.php:3517 includes/ot-functions-admin.php:3518
425
- msgid "Activate"
426
- msgstr ""
427
-
428
- #: includes/ot-functions-admin.php:3554 includes/ot-meta-box-api.php:182
429
- #: includes/ot-settings-api.php:587
430
- msgid "Title"
431
- msgstr ""
432
-
433
- #: includes/ot-functions-admin.php:3720
434
- msgid "New Layout"
435
- msgstr ""
436
-
437
- #: includes/ot-functions-docs-page.php:30
438
- msgid ""
439
- "The Label field should be a short but descriptive block of text 100 "
440
- "characters or less with no HTML."
441
- msgstr ""
442
-
443
- #: includes/ot-functions-docs-page.php:32
444
- msgid "ID"
445
- msgstr ""
446
-
447
- #: includes/ot-functions-docs-page.php:33
448
- msgid ""
449
- "The ID field is a unique alphanumeric key used to differentiate each theme "
450
- "option (underscores are acceptable). Also, the plugin will change all text "
451
- "you write in this field to lowercase and replace spaces and special "
452
- "characters with an underscore automatically."
453
- msgstr ""
454
-
455
- #: includes/ot-functions-docs-page.php:35
456
- msgid "Type"
457
- msgstr ""
458
-
459
- #: includes/ot-functions-docs-page.php:36
460
- msgid ""
461
- "You are required to choose one of the supported option types when creating a "
462
- "new option. Here is a list of the available option types. For more "
463
- "information about each type click the <code>Option Types</code> tab to the "
464
- "left."
465
- msgstr ""
466
-
467
- #: includes/ot-functions-docs-page.php:44
468
- msgid ""
469
- "Enter a detailed description for the users to read on the Theme Options "
470
- "page, HTML is allowed. This is also where you enter content for both the "
471
- "Textblock & Textblock Titled option types."
472
- msgstr ""
473
-
474
- #: includes/ot-functions-docs-page.php:46
475
- msgid "Choices"
476
- msgstr ""
477
-
478
- #: includes/ot-functions-docs-page.php:47
479
- msgid ""
480
- "Click the \"Add Choice\" button to add an item to the choices array. This "
481
- "will only affect the following option types: Checkbox, Radio, Select & "
482
- "Select Image."
483
- msgstr ""
484
-
485
- #: includes/ot-functions-docs-page.php:50
486
- msgid ""
487
- "Click the \"Add Setting\" button found inside a newly created setting to add "
488
- "an item to the settings array. This will only affect the List Item type."
489
- msgstr ""
490
-
491
- #: includes/ot-functions-docs-page.php:52
492
- msgid "Standard"
493
- msgstr ""
494
-
495
- #: includes/ot-functions-docs-page.php:53
496
- msgid ""
497
- "Setting the standard value for your option only works for some option types. "
498
- "Those types are one that have a single string value saved to them and not an "
499
- "array of values."
500
- msgstr ""
501
-
502
- #: includes/ot-functions-docs-page.php:55
503
- msgid "Rows"
504
- msgstr ""
505
-
506
- #: includes/ot-functions-docs-page.php:56
507
- msgid ""
508
- "Enter a numeric value for the number of rows in your textarea. This will "
509
- "only affect the following option types: CSS, Textarea, & Textarea Simple."
510
- msgstr ""
511
-
512
- #: includes/ot-functions-docs-page.php:58
513
- msgid "Post Type"
514
- msgstr ""
515
-
516
- #: includes/ot-functions-docs-page.php:59
517
- msgid ""
518
- "Add a comma separated list of post type like <code>post,page</code>. This "
519
- "will only affect the following option types: Custom Post Type Checkbox, & "
520
- "Custom Post Type Select. Below are the default post types available with "
521
- "WordPress and that are also compatible with OptionTree. You can also add "
522
- "your own custom <code>post_type</code>. At this time <code>any</code> does "
523
- "not seem to return results properly and is something I plan on looking into."
524
- msgstr ""
525
-
526
- #: includes/ot-functions-docs-page.php:67
527
- msgid "Taxonomy"
528
- msgstr ""
529
-
530
- #: includes/ot-functions-docs-page.php:68
531
- msgid ""
532
- "Add a comma separated list of any registered taxonomy like <code>category,"
533
- "post_tag</code>. This will only affect the following option types: Taxonomy "
534
- "Checkbox, & Taxonomy Select."
535
- msgstr ""
536
-
537
- #: includes/ot-functions-docs-page.php:70
538
- msgid "Min, Max, & Step"
539
- msgstr ""
540
-
541
- #: includes/ot-functions-docs-page.php:71
542
- msgid ""
543
- "Add a comma separated list of options in the following format <code>0,100,1</"
544
- "code> (slide from <code>0-100</code> in intervals of <code>1</code>). The "
545
- "three values represent the minimum, maximum, and step options and will only "
546
- "affect the Numeric Slider option type."
547
- msgstr ""
548
-
549
- #: includes/ot-functions-docs-page.php:73
550
- msgid "CSS Class"
551
- msgstr ""
552
-
553
- #: includes/ot-functions-docs-page.php:74
554
- msgid "Add and optional class to any option type."
555
- msgstr ""
556
-
557
- #: includes/ot-functions-docs-page.php:104
558
- msgid "Background"
559
- msgstr ""
560
-
561
- #: includes/ot-functions-docs-page.php:105
562
- msgid ""
563
- "The Background option type is for adding background styles to your theme "
564
- "either dynamically via the CSS option type below or manually with "
565
- "<code>ot_get_option()</code>. Background has filters that allow you to "
566
- "change the defaults. For example, you can filter on "
567
- "<code>ot_recognized_background_repeat</code>, "
568
- "<code>ot_recognized_background_attachment</code>, and "
569
- "<code>ot_recognized_background_position</code>. These filters allow you to "
570
- "fine tune the select lists for your specific CSS needs."
571
- msgstr ""
572
-
573
- #: includes/ot-functions-docs-page.php:107
574
- msgid "Category Select"
575
- msgstr ""
576
-
577
- #: includes/ot-functions-docs-page.php:108
578
- msgid ""
579
- "The Category Select option type displays a list of category IDs. It allows "
580
- "the user to select only one category ID and will return that value for use "
581
- "in a custom function or loop."
582
- msgstr ""
583
-
584
- #: includes/ot-functions-docs-page.php:110
585
- msgid "Category Checkbox"
586
- msgstr ""
587
-
588
- #: includes/ot-functions-docs-page.php:111
589
- msgid ""
590
- "The Category Checkbox option type displays a list of category IDs. It allows "
591
- "the user to check multiple category IDs and will return that value as an "
592
- "array for use in a custom function or loop."
593
- msgstr ""
594
-
595
- #: includes/ot-functions-docs-page.php:113
596
- msgid "Checkbox"
597
- msgstr ""
598
-
599
- #: includes/ot-functions-docs-page.php:114
600
- msgid ""
601
- "The Checkbox option type is fairly self explanatory. Typically used to ask "
602
- "questions. For example, \"Do you want to activate asynchronous Google "
603
- "analytics?\" would be a single checkbox with a value of yes. You could have "
604
- "more complex usages but the idea is that you can easily grab the value of "
605
- "the checkbox and use it in you theme. In this situation you would test if "
606
- "the checkbox has a value and execute a block of code if it does and do "
607
- "nothing if it doesn't."
608
- msgstr ""
609
-
610
- #: includes/ot-functions-docs-page.php:116
611
- msgid "Colorpicker"
612
- msgstr ""
613
-
614
- #: includes/ot-functions-docs-page.php:117
615
- msgid ""
616
- "The Colorpicker option type saves a hexadecimal color code for use in CSS. "
617
- "Use it to modify the color of something in your theme."
618
- msgstr ""
619
-
620
- #: includes/ot-functions-docs-page.php:119
621
- msgid "CSS"
622
- msgstr ""
623
-
624
- #: includes/ot-functions-docs-page.php:120
625
- msgid ""
626
- "The CSS option type is a textarea that when used properly can add dynamic "
627
- "CSS to your theme from within OptionTree. Unfortunately, due server "
628
- "limitations you will need to create a file named <code>dynamic.css</code> at "
629
- "the root level of your theme and change permissions using chmod so the "
630
- "server can write to the file. I have had the most success setting this "
631
- "single file to 0777 but feel free to play around with permissions until "
632
- "everything is working. A good starting point is 0666. When the server can "
633
- "save to the file CSS will automatically be updated each time you save your "
634
- "theme options."
635
- msgstr ""
636
-
637
- #: includes/ot-functions-docs-page.php:122
638
- msgid ""
639
- "An example of the CSS option type: This assumes you have an option with the "
640
- "ID of <code>custom_background_css</code> which will display the saved values "
641
- "for that option."
642
- msgstr ""
643
-
644
- #: includes/ot-functions-docs-page.php:124
645
- msgid "Input"
646
- msgstr ""
647
-
648
- #: includes/ot-functions-docs-page.php:130
649
- msgid "Output"
650
- msgstr ""
651
-
652
- #: includes/ot-functions-docs-page.php:138
653
- msgid "Custom Post Type Select"
654
- msgstr ""
655
-
656
- #: includes/ot-functions-docs-page.php:139
657
- msgid ""
658
- "The Custom Post Type Select option type displays a list of IDs from any "
659
- "available WordPress post type or custom post type. It will return a single "
660
- "post ID for use in a custom function or loop. Requires at least one valid "
661
- "<code>post_type</code> when created in the settings. For some reason "
662
- "<code>any</code> does not work correctly and will looked into in future "
663
- "version."
664
- msgstr ""
665
-
666
- #: includes/ot-functions-docs-page.php:141
667
- msgid "Custom Post Type Checkbox"
668
- msgstr ""
669
-
670
- #: includes/ot-functions-docs-page.php:142
671
- msgid ""
672
- "The Custom Post Type Select option type displays a list of IDs from any "
673
- "available WordPress post type or custom post type. It allows the user to "
674
- "check multiple post IDs for use in a custom function or loop. Requires at "
675
- "least one valid <code>post_type</code> when created in the settings. For "
676
- "some reason <code>any</code> does not work correctly and will looked into in "
677
- "future version."
678
- msgstr ""
679
-
680
- #: includes/ot-functions-docs-page.php:144
681
- msgid "List Item"
682
- msgstr ""
683
-
684
- #: includes/ot-functions-docs-page.php:145
685
- msgid ""
686
- "The list Item replaced the old Slider option type. It allows for a great "
687
- "deal of customization. You can add settings to the List Item and those "
688
- "settings will be displayed to the user when they add a new List Item. "
689
- "Typical use is for creating sliding content or blocks of code for custom "
690
- "layouts."
691
- msgstr ""
692
-
693
- #: includes/ot-functions-docs-page.php:147
694
- msgid "Measurement"
695
- msgstr ""
696
-
697
- #: includes/ot-functions-docs-page.php:148
698
- msgid ""
699
- "The Measurement option type is a mix of input and select fields. The text "
700
- "input excepts a value and the select lets you choose the unit of measurement "
701
- "to add to that value. Currently the default units are <code>px</code>, <code>"
702
- "%</code>, <code>em</code>, <code>pt</code>. However, you can change them "
703
- "with the <code>ot_measurement_unit_types</code> filter."
704
- msgstr ""
705
-
706
- #: includes/ot-functions-docs-page.php:150
707
- msgid ""
708
- "Example filter to add new units to the Measurement option type. Added to "
709
- "<code>functions.php</code>."
710
- msgstr ""
711
-
712
- #: includes/ot-functions-docs-page.php:163
713
- msgid ""
714
- "Example filter to completely change the units in the Measurement option "
715
- "type. Added to <code>functions.php</code>."
716
- msgstr ""
717
-
718
- #: includes/ot-functions-docs-page.php:178
719
- msgid "Numeric Slider"
720
- msgstr ""
721
-
722
- #: includes/ot-functions-docs-page.php:179
723
- msgid ""
724
- "The Numeric Slider option type displays a jQuery UI slider. It will return a "
725
- "single numerical value for use in a custom function or loop."
726
- msgstr ""
727
-
728
- #: includes/ot-functions-docs-page.php:181
729
- msgid "Page Select"
730
- msgstr ""
731
-
732
- #: includes/ot-functions-docs-page.php:182
733
- msgid ""
734
- "The Page Select option type displays a list of page IDs. It will return a "
735
- "single page ID for use in a custom function or loop."
736
- msgstr ""
737
-
738
- #: includes/ot-functions-docs-page.php:184
739
- msgid "Page Checkbox"
740
- msgstr ""
741
-
742
- #: includes/ot-functions-docs-page.php:185
743
- msgid ""
744
- "The Page Select option type displays a list of page IDs. It allows the user "
745
- "to check multiple page IDs for use in a custom function or loop."
746
- msgstr ""
747
-
748
- #: includes/ot-functions-docs-page.php:187
749
- msgid "Post Select"
750
- msgstr ""
751
-
752
- #: includes/ot-functions-docs-page.php:188
753
- msgid ""
754
- "The Post Select option type displays a list of post IDs. It will return a "
755
- "single post ID for use in a custom function or loop."
756
- msgstr ""
757
-
758
- #: includes/ot-functions-docs-page.php:190
759
- msgid "Post Checkbox"
760
- msgstr ""
761
-
762
- #: includes/ot-functions-docs-page.php:191
763
- msgid ""
764
- "The Post Select option type displays a list of post IDs. It allows the user "
765
- "to check multiple post IDs for use in a custom function or loop."
766
- msgstr ""
767
-
768
- #: includes/ot-functions-docs-page.php:193
769
- msgid "Radio"
770
- msgstr ""
771
-
772
- #: includes/ot-functions-docs-page.php:194
773
- msgid ""
774
- "The Radio option type could ask a question. For example, \"Do you want to "
775
- "activate the custom navigation?\" could require a yes or no answer with a "
776
- "radio option. In this situation you would test if the radio has a value of "
777
- "'yes' and execute a block of code, or if it's 'no' execute a different block "
778
- "of code."
779
- msgstr ""
780
-
781
- #: includes/ot-functions-docs-page.php:196
782
- msgid "Radio Image"
783
- msgstr ""
784
-
785
- #: includes/ot-functions-docs-page.php:197
786
- msgid ""
787
- "the Radio Images option type is primarily used for layouts. However, you can "
788
- "filter the image list using <code>ot_radio_images</code>. As well, you can "
789
- "add your own custom images using the choices array."
790
- msgstr ""
791
-
792
- #: includes/ot-functions-docs-page.php:199
793
- msgid ""
794
- "This example executes the <code>ot_radio_images</code> filter on layout "
795
- "images attached to the <code>my_radio_images</code> field. Added to "
796
- "<code>functions.php</code>."
797
- msgstr ""
798
-
799
- #: includes/ot-functions-docs-page.php:223
800
- msgid "Select"
801
- msgstr ""
802
-
803
- #: includes/ot-functions-docs-page.php:224
804
- msgid ""
805
- "The Select option type is used to list anything you want that would be "
806
- "chosen from a select list."
807
- msgstr ""
808
-
809
- #: includes/ot-functions-docs-page.php:226
810
- msgid "Sidebar Select"
811
- msgstr ""
812
-
813
- #: includes/ot-functions-docs-page.php:227
814
- msgid ""
815
- "This option type makes it possible for users to select a WordPress "
816
- "registered sidebar to use on a specific area. By using the two provided "
817
- "filters, <code>ot_recognized_sidebars</code>, and "
818
- "<code>ot_recognized_sidebars_{$field_id}</code> we can be selective about "
819
- "which sidebars are available on a specific content area."
820
- msgstr ""
821
-
822
- #: includes/ot-functions-docs-page.php:228
823
- msgid ""
824
- "For example, if we create a WordPress theme that provides the ability to "
825
- "change the Blog Sidebar and we don't want to have the footer sidebars "
826
- "available on this area, we can unset those sidebars either manually or by "
827
- "using a regular expression if we have a common name like <code>footer-"
828
- "sidebar-$i</code>."
829
- msgstr ""
830
-
831
- #: includes/ot-functions-docs-page.php:230
832
- msgid "Slider"
833
- msgstr ""
834
-
835
- #: includes/ot-functions-docs-page.php:231
836
- msgid ""
837
- "The Slider option type is technically deprecated. Use the List Item option "
838
- "type instead, as it's infinitely more customizable. Typical use is for "
839
- "creating sliding image content."
840
- msgstr ""
841
-
842
- #: includes/ot-functions-docs-page.php:233
843
- msgid "Tag Checkbox"
844
- msgstr ""
845
-
846
- #: includes/ot-functions-docs-page.php:234
847
- msgid ""
848
- "The Tag Checkbox option type displays a list of tag IDs. It allows the user "
849
- "to check multiple tag IDs and will return that value as an array for use in "
850
- "a custom function or loop."
851
- msgstr ""
852
-
853
- #: includes/ot-functions-docs-page.php:236
854
- msgid "Tag Select"
855
- msgstr ""
856
-
857
- #: includes/ot-functions-docs-page.php:237
858
- msgid ""
859
- "The Tag Select option type displays a list of tag IDs. It allows the user to "
860
- "select only one tag ID and will return that value for use in a custom "
861
- "function or loop."
862
- msgstr ""
863
-
864
- #: includes/ot-functions-docs-page.php:239
865
- msgid "Taxonomy Checkbox"
866
- msgstr ""
867
-
868
- #: includes/ot-functions-docs-page.php:240
869
- msgid ""
870
- "The Taxonomy Checkbox option type displays a list of taxonomy IDs. It allows "
871
- "the user to check multiple taxonomy IDs and will return that value as an "
872
- "array for use in a custom function or loop."
873
- msgstr ""
874
-
875
- #: includes/ot-functions-docs-page.php:242
876
- msgid "Taxonomy Select"
877
- msgstr ""
878
-
879
- #: includes/ot-functions-docs-page.php:243
880
- msgid ""
881
- "The Taxonomy Select option type displays a list of taxonomy IDs. It allows "
882
- "the user to select only one taxonomy ID and will return that value for use "
883
- "in a custom function or loop."
884
- msgstr ""
885
-
886
- #: includes/ot-functions-docs-page.php:245
887
- msgid "Text (Input)"
888
- msgstr ""
889
-
890
- #: includes/ot-functions-docs-page.php:246
891
- msgid ""
892
- "The Text option type would be used to save a string value. For example, a "
893
- "link to feedburner, your Twitter username, or Google Analytics ID are all "
894
- "good candidates. Any optional or required text that is of reasonably short "
895
- "character length."
896
- msgstr ""
897
-
898
- #: includes/ot-functions-docs-page.php:248
899
- msgid "Textarea"
900
- msgstr ""
901
-
902
- #: includes/ot-functions-docs-page.php:249
903
- msgid ""
904
- "The Textarea option type is a large string value used for custom code or "
905
- "text in the theme. The new Textarea has a WYSIWYG editor that can be "
906
- "filtered to change the buttons shown. For example, you can filter on "
907
- "<code>wpautop</code>, <code>media_buttons</code>, <code>tinymce</code>, and "
908
- "<code>quicktags</code>."
909
- msgstr ""
910
-
911
- #: includes/ot-functions-docs-page.php:251
912
- msgid ""
913
- "Example filters to alter the Textarea option type. Added to <code>functions."
914
- "php</code>."
915
- msgstr ""
916
-
917
- #: includes/ot-functions-docs-page.php:253
918
- msgid ""
919
- "This example keeps WordPress from executing the <code>wpautop</code> filter "
920
- "on the line breaks. The default is <code>true</code> which means it wraps "
921
- "line breaks with an HTML <code>p</code> tag."
922
- msgstr ""
923
-
924
- #: includes/ot-functions-docs-page.php:266
925
- msgid ""
926
- "This example keeps WordPress from executing the <code>media_buttons</code> "
927
- "filter on the textarea WYSIWYG. The default is <code>true</code> which means "
928
- "show the buttons."
929
- msgstr ""
930
-
931
- #: includes/ot-functions-docs-page.php:279
932
- msgid ""
933
- "This example keeps WordPress from executing the <code>tinymce</code> filter "
934
- "on the textarea WYSIWYG. The default is <code>true</code> which means show "
935
- "the tinymce."
936
- msgstr ""
937
-
938
- #: includes/ot-functions-docs-page.php:292
939
- msgid ""
940
- "This example alters the <code>quicktags</code> filter on the textarea "
941
- "WYSIWYG. The default is <code>array( 'buttons' => 'strong,em,link,block,del,"
942
- "ins,img,ul,ol,li,code,spell,close' )</code> which means show those "
943
- "quicktags. It also means you can filter in your own custom quicktags."
944
- msgstr ""
945
-
946
- #: includes/ot-functions-docs-page.php:307
947
- msgid "Textarea Simple"
948
- msgstr ""
949
-
950
- #: includes/ot-functions-docs-page.php:308
951
- msgid ""
952
- "The Textarea Simple option type is a large string value used for custom code "
953
- "or text in the theme. The new Textarea Simple does not have a WYSIWYG "
954
- "editor. But you can still filter on <code>wpautop</code>."
955
- msgstr ""
956
-
957
- #: includes/ot-functions-docs-page.php:310
958
- msgid ""
959
- "This example tells WordPress to execute the <code>wpautop</code> filter on "
960
- "the line breaks. The default is <code>false</code> which means it does not "
961
- "wraps line breaks with an HTML <code>p</code> tag. Added to <code>functions."
962
- "php</code>."
963
- msgstr ""
964
-
965
- #: includes/ot-functions-docs-page.php:323
966
- msgid "Textblock"
967
- msgstr ""
968
-
969
- #: includes/ot-functions-docs-page.php:324
970
- msgid ""
971
- "The Textblock option type is used only on the Theme Option page. It will "
972
- "allow you to create & display HTML on your Theme Options page but has no "
973
- "title above the text block. You can then use the Textblock to add a more "
974
- "detailed set of instruction on how the options are used in your theme. You "
975
- "would NEVER use this in your themes template files as it does not save a "
976
- "value."
977
- msgstr ""
978
-
979
- #: includes/ot-functions-docs-page.php:326
980
- msgid "Textblock Titled"
981
- msgstr ""
982
-
983
- #: includes/ot-functions-docs-page.php:327
984
- msgid ""
985
- "The Textblock Titled option type is used only on the Theme Option page. It "
986
- "will allow you to create & display HTML on your Theme Options page and has a "
987
- "title above the text block. You can then use the Textblock Titled to add a "
988
- "more detailed set of instruction on how the options are used in your theme. "
989
- "You would NEVER use this in your themes template files as it does not save a "
990
- "value."
991
- msgstr ""
992
-
993
- #: includes/ot-functions-docs-page.php:329
994
- msgid "Typography"
995
- msgstr ""
996
-
997
- #: includes/ot-functions-docs-page.php:330
998
- msgid ""
999
- "The Typography option type is for adding typographic styles to your theme "
1000
- "either dynamically via the CSS option type below or manually with "
1001
- "<code>ot_get_option()</code>. Typography has filters that allow you to "
1002
- "change the defaults. For example, you can filter on "
1003
- "<code>ot_recognized_font_styles</code>, <code>ot_recognized_font_weights</"
1004
- "code>, <code>ot_recognized_font_variants</code>, and "
1005
- "<code>ot_recognized_font_families</code>. These filters allow you to fine "
1006
- "tune the select lists for your specific CSS needs. The most important one "
1007
- "though is <code>ot_recognized_font_families</code> as you can add your "
1008
- "Google Fonts to create custom font stacks."
1009
- msgstr ""
1010
-
1011
- #: includes/ot-functions-docs-page.php:332
1012
- msgid ""
1013
- "This example would filter <code>ot_recognized_font_families</code> to build "
1014
- "your own font stack. Added to <code>functions.php</code>."
1015
- msgstr ""
1016
-
1017
- #: includes/ot-functions-docs-page.php:349
1018
- msgid "Upload"
1019
- msgstr ""
1020
-
1021
- #: includes/ot-functions-docs-page.php:350
1022
- msgid ""
1023
- "The Upload option type is used to upload any WordPress supported media. "
1024
- "After uploading, users are required to press the \"Send to OptionTree\" "
1025
- "button in order to populate the input with the URI of that media. There is "
1026
- "one caveat of this feature. If you import the theme options and have "
1027
- "uploaded media on one site the old URI will not reflect the URI of your new "
1028
- "site. You'll have to re-upload or FTP any media to your new server and "
1029
- "change the URIs if necessary."
1030
- msgstr ""
1031
-
1032
- #: includes/ot-functions-docs-page.php:382
1033
- msgid ""
1034
- "This function returns a value from the \"option_tree\" array of saved values "
1035
- "or the default value supplied. The returned value would be mixed. Meaning it "
1036
- "could be a string, integer, boolean, or array."
1037
- msgstr ""
1038
-
1039
- #: includes/ot-functions-docs-page.php:384
1040
- #: includes/ot-functions-docs-page.php:434
1041
- msgid "Usage"
1042
- msgstr ""
1043
-
1044
- #: includes/ot-functions-docs-page.php:388
1045
- #: includes/ot-functions-docs-page.php:438
1046
- msgid "Parameters"
1047
- msgstr ""
1048
-
1049
- #: includes/ot-functions-docs-page.php:392
1050
- #: includes/ot-functions-docs-page.php:396
1051
- #: includes/ot-functions-docs-page.php:442
1052
- msgid "string"
1053
- msgstr ""
1054
-
1055
- #: includes/ot-functions-docs-page.php:392
1056
- #: includes/ot-functions-docs-page.php:442
1057
- msgid "required"
1058
- msgstr ""
1059
-
1060
- #: includes/ot-functions-docs-page.php:392
1061
- msgid "Enter the options unique identifier."
1062
- msgstr ""
1063
-
1064
- #: includes/ot-functions-docs-page.php:392
1065
- #: includes/ot-functions-docs-page.php:442
1066
- msgid "Default:"
1067
- msgstr ""
1068
-
1069
- #: includes/ot-functions-docs-page.php:392
1070
- #: includes/ot-functions-docs-page.php:396
1071
- #: includes/ot-functions-docs-page.php:442
1072
- #: includes/ot-functions-docs-page.php:446
1073
- msgid "None"
1074
- msgstr ""
1075
-
1076
- #: includes/ot-functions-docs-page.php:396
1077
- #: includes/ot-functions-docs-page.php:446
1078
- #: includes/ot-functions-docs-page.php:450
1079
- #: includes/ot-functions-docs-page.php:454
1080
- #: includes/ot-functions-docs-page.php:458
1081
- msgid "optional"
1082
- msgstr ""
1083
-
1084
- #: includes/ot-functions-docs-page.php:396
1085
- msgid ""
1086
- "Enter a default return value. This is just incase the request returns null."
1087
- msgstr ""
1088
-
1089
- #: includes/ot-functions-docs-page.php:396
1090
- #: includes/ot-functions-docs-page.php:446
1091
- #: includes/ot-functions-docs-page.php:450
1092
- #: includes/ot-functions-docs-page.php:454
1093
- #: includes/ot-functions-docs-page.php:458
1094
- msgid "Default"
1095
- msgstr ""
1096
-
1097
- #: includes/ot-functions-docs-page.php:426
1098
- msgid ""
1099
- "This function has been deprecated. That means it has been replaced by a new "
1100
- "function or is no longer supported, and may be removed from future versions. "
1101
- "All code that uses this function should be converted to use its replacement."
1102
- msgstr ""
1103
-
1104
- #: includes/ot-functions-docs-page.php:428
1105
- msgid "Use"
1106
- msgstr ""
1107
-
1108
- #: includes/ot-functions-docs-page.php:428
1109
- msgid "instead"
1110
- msgstr ""
1111
-
1112
- #: includes/ot-functions-docs-page.php:432
1113
- msgid ""
1114
- "This function returns, or echos if asked, a value from the \"option_tree\" "
1115
- "array of saved values."
1116
- msgstr ""
1117
-
1118
- #: includes/ot-functions-docs-page.php:442
1119
- msgid "Enter a unique Option Key to get a returned value or array."
1120
- msgstr ""
1121
-
1122
- #: includes/ot-functions-docs-page.php:446
1123
- msgid "array"
1124
- msgstr ""
1125
-
1126
- #: includes/ot-functions-docs-page.php:446
1127
- msgid "Used to cut down on database queries in template files."
1128
- msgstr ""
1129
-
1130
- #: includes/ot-functions-docs-page.php:450
1131
- #: includes/ot-functions-docs-page.php:454
1132
- msgid "boolean"
1133
- msgstr ""
1134
-
1135
- #: includes/ot-functions-docs-page.php:450
1136
- msgid "Echo the output."
1137
- msgstr ""
1138
-
1139
- #: includes/ot-functions-docs-page.php:454
1140
- msgid "Used to indicate the $item_id is an array of values."
1141
- msgstr ""
1142
-
1143
- #: includes/ot-functions-docs-page.php:458
1144
- msgid "integer"
1145
- msgstr ""
1146
-
1147
- #: includes/ot-functions-docs-page.php:458
1148
- msgid ""
1149
- "Numeric offset key for the $item_id array, -1 will return all values (an "
1150
- "array starts at 0)."
1151
- msgstr ""
1152
-
1153
- #: includes/ot-functions-docs-page.php:486
1154
- msgid ""
1155
- "If you're using the plugin version of OptionTree it is highly recommended to "
1156
- "include a <code>function_exists</code> check in your code, as described in "
1157
- "the examples below. If you've integrated OptionTree directly into your "
1158
- "themes root directory, you will <strong>not</strong> need to wrap your code "
1159
- "with <code>function_exists</code>, as you're guaranteed to have the "
1160
- "<code>ot_get_option()</code> function available."
1161
- msgstr ""
1162
-
1163
- #: includes/ot-functions-docs-page.php:488
1164
- msgid "String Examples"
1165
- msgstr ""
1166
-
1167
- #: includes/ot-functions-docs-page.php:490
1168
- msgid "Returns the value of <code>test_input</code>."
1169
- msgstr ""
1170
-
1171
- #: includes/ot-functions-docs-page.php:496
1172
- msgid ""
1173
- "Returns the value of <code>test_input</code>, but also has a default value "
1174
- "if it returns empty."
1175
- msgstr ""
1176
-
1177
- #: includes/ot-functions-docs-page.php:502
1178
- msgid "Array Examples"
1179
- msgstr ""
1180
-
1181
- #: includes/ot-functions-docs-page.php:504
1182
- msgid ""
1183
- "Assigns the value of <code>navigation_ids</code> to the variable <code>$ids</"
1184
- "code>. It then echos an unordered list of links (navigation) using "
1185
- "<code>wp_list_pages()</code>."
1186
- msgstr ""
1187
-
1188
- #: includes/ot-functions-docs-page.php:524
1189
- msgid ""
1190
- "The next two examples demonstrate how to use the <strong>Measurement</"
1191
- "strong> option type. The Measurement option type is an array with two key/"
1192
- "value pairs. The first is the value of measurement and the second is the "
1193
- "unit of measurement."
1194
- msgstr ""
1195
-
1196
- #: includes/ot-functions-docs-page.php:550
1197
- msgid "This example displays a very basic slider loop."
1198
- msgstr ""
1199
-
1200
- #: includes/ot-functions-docs-page.php:595
1201
- msgid "It's Super Simple"
1202
- msgstr ""
1203
-
1204
- #: includes/ot-functions-docs-page.php:597
1205
- msgid ""
1206
- "Layouts make your theme awesome! With theme options data that you can save/"
1207
- "import/export you can package themes with different color variations, or "
1208
- "make it easy to do A/B testing on text and so much more. Basically, you save "
1209
- "a snapshot of your data as a layout."
1210
- msgstr ""
1211
-
1212
- #: includes/ot-functions-docs-page.php:599
1213
- msgid ""
1214
- "Once you have created all your different layouts, or theme variations, you "
1215
- "can save them to a separate text file for repackaging with your theme. "
1216
- "Alternatively, you could just make different variations for yourself and "
1217
- "change your theme with the click of a button, all without deleting your "
1218
- "previous options data."
1219
- msgstr ""
1220
-
1221
- #: includes/ot-functions-docs-page.php:601
1222
- msgid ""
1223
- " Adding a layout is ridiculously easy, follow these steps and you'll be on "
1224
- "your way to having a WordPress super theme."
1225
- msgstr ""
1226
-
1227
- #: includes/ot-functions-docs-page.php:603
1228
- msgid "For Developers"
1229
- msgstr ""
1230
-
1231
- #: includes/ot-functions-docs-page.php:606
1232
- #: includes/ot-functions-docs-page.php:636
1233
- msgid "Creating a Layout"
1234
- msgstr ""
1235
-
1236
- #: includes/ot-functions-docs-page.php:608
1237
- #: includes/ot-functions-docs-page.php:615
1238
- #: includes/ot-functions-docs-page.php:621
1239
- msgid "Go to the <code>OptionTre->Settings->Layouts</code> tab."
1240
- msgstr ""
1241
-
1242
- #: includes/ot-functions-docs-page.php:609
1243
- msgid ""
1244
- "Enter a name for your layout in the text field and hit \"Save Layouts\", "
1245
- "you've created your first layout."
1246
- msgstr ""
1247
-
1248
- #: includes/ot-functions-docs-page.php:610
1249
- #: includes/ot-functions-docs-page.php:640
1250
- msgid "Adding a new layout is as easy as repeating the steps above."
1251
- msgstr ""
1252
-
1253
- #: includes/ot-functions-docs-page.php:613
1254
- #: includes/ot-functions-docs-page.php:643
1255
- msgid "Activating a Layout"
1256
- msgstr ""
1257
-
1258
- #: includes/ot-functions-docs-page.php:616
1259
- msgid "Click on the activate layout button in the actions list."
1260
- msgstr ""
1261
-
1262
- #: includes/ot-functions-docs-page.php:619
1263
- #: includes/ot-functions-docs-page.php:649
1264
- msgid "Deleting a Layout"
1265
- msgstr ""
1266
-
1267
- #: includes/ot-functions-docs-page.php:622
1268
- msgid "Click on the delete layout button in the actions list."
1269
- msgstr ""
1270
-
1271
- #: includes/ot-functions-docs-page.php:625
1272
- #: includes/ot-functions-docs-page.php:654
1273
- msgid "Edit Layout Data"
1274
- msgstr ""
1275
-
1276
- #: includes/ot-functions-docs-page.php:627
1277
- #: includes/ot-functions-docs-page.php:638
1278
- #: includes/ot-functions-docs-page.php:645
1279
- msgid "Go to the <code>Appearance->Theme Options</code> page."
1280
- msgstr ""
1281
-
1282
- #: includes/ot-functions-docs-page.php:628
1283
- #: includes/ot-functions-docs-page.php:657
1284
- msgid ""
1285
- "Modify and save your theme options and the layout will be updated "
1286
- "automatically."
1287
- msgstr ""
1288
-
1289
- #: includes/ot-functions-docs-page.php:629
1290
- #: includes/ot-functions-docs-page.php:658
1291
- msgid ""
1292
- "Saving theme options data will update the currently active layout, so before "
1293
- "you start saving make sure you want to modify the current layout."
1294
- msgstr ""
1295
-
1296
- #: includes/ot-functions-docs-page.php:630
1297
- msgid ""
1298
- "If you want to edit a new layout, first create it then save your theme "
1299
- "options."
1300
- msgstr ""
1301
-
1302
- #: includes/ot-functions-docs-page.php:633
1303
- msgid "End-Users Mode"
1304
- msgstr ""
1305
-
1306
- #: includes/ot-functions-docs-page.php:639
1307
- msgid ""
1308
- "Enter a name for your layout in the text field and hit \"New Layout\", "
1309
- "you've created your first layout."
1310
- msgstr ""
1311
-
1312
- #: includes/ot-functions-docs-page.php:646
1313
- msgid ""
1314
- "Choose a layout from the select list and click the \"Activate Layout\" "
1315
- "button."
1316
- msgstr ""
1317
-
1318
- #: includes/ot-functions-docs-page.php:651
1319
- msgid "End-Users mode does not allow deleting layouts."
1320
- msgstr ""
1321
-
1322
- #: includes/ot-functions-docs-page.php:656
1323
- msgid "Go to the <code>Appearance->Theme Options</code> tab."
1324
- msgstr ""
1325
-
1326
- #: includes/ot-functions-docs-page.php:687
1327
- #: includes/ot-functions-docs-page.php:769
1328
- msgid "How-to-guide"
1329
- msgstr ""
1330
-
1331
- #: includes/ot-functions-docs-page.php:689
1332
- msgid ""
1333
- "There are a few simple steps you need to take in order to use OptionTree's "
1334
- "built in Meta Box API. In the code below I'll show you a basic demo of how "
1335
- "to create your very own custom meta box using any number of the option types "
1336
- "you have at your disposal. If you would like to see some demo code, there is "
1337
- "a directory named <code>theme-mode</code> inside the <code>assets</code> "
1338
- "directory that contains a file named <code>demo-meta-boxes.php</code> you "
1339
- "can reference."
1340
- msgstr ""
1341
-
1342
- #: includes/ot-functions-docs-page.php:691
1343
- msgid ""
1344
- "It's important to note that Meta Boxes do not support WYSIWYG editors at "
1345
- "this time and if you set one of your options to Textarea it will "
1346
- "automatically revert to a Textarea Simple until a valid solution is found. "
1347
- "WordPress released this statement regarding the wp_editor() function:"
1348
- msgstr ""
1349
-
1350
- #: includes/ot-functions-docs-page.php:693
1351
- msgid ""
1352
- "Once instantiated, the WYSIWYG editor cannot be moved around in the DOM. "
1353
- "What this means in practical terms, is that you cannot put it in meta-boxes "
1354
- "that can be dragged and placed elsewhere on the page."
1355
- msgstr ""
1356
-
1357
- #: includes/ot-functions-docs-page.php:695
1358
- msgid "Create and include your custom meta boxes file."
1359
- msgstr ""
1360
-
1361
- #: includes/ot-functions-docs-page.php:697
1362
- msgid ""
1363
- "Create a file and name it anything you want, maybe <code>meta-boxes.php</"
1364
- "code>."
1365
- msgstr ""
1366
-
1367
- #: includes/ot-functions-docs-page.php:698
1368
- msgid ""
1369
- "As well, you'll probably want to create a directory named <code>includes</"
1370
- "code> to put your <code>meta-boxes.php</code> into which will help keep you "
1371
- "file structure nice and tidy."
1372
- msgstr ""
1373
-
1374
- #: includes/ot-functions-docs-page.php:699
1375
- #: includes/ot-functions-docs-page.php:810
1376
- msgid "Add the following code to your <code>functions.php</code>."
1377
- msgstr ""
1378
-
1379
- #: includes/ot-functions-docs-page.php:709
1380
- msgid ""
1381
- "Add a variation of the following code to your <code>meta-boxes.php</code>. "
1382
- "You'll obviously need to fill it in with all your custom array values. It's "
1383
- "important to note here that we use the <code>admin_init</code> filter "
1384
- "because if you were to call the <code>ot_register_meta_box</code> function "
1385
- "before OptionTree was loaded the sky would fall on your head."
1386
- msgstr ""
1387
-
1388
- #: includes/ot-functions-docs-page.php:771
1389
- msgid ""
1390
- "There are a few simple steps you need to take in order to use OptionTree as "
1391
- "a theme included module. In the code below I'll show you a basic demo of how "
1392
- "to include the entire plugin as a module, which will allow you to have the "
1393
- "most up-to-date version of OptionTree without ever needing to hack the core "
1394
- "of the plugin. If you would like to see some demo code, there is a directory "
1395
- "named <code>theme-mode</code> inside the <code>assets</code> directory that "
1396
- "contains a file named <code>demo-theme-options.php</code> you can reference."
1397
- msgstr ""
1398
-
1399
- #: includes/ot-functions-docs-page.php:773
1400
- msgid "Step 1: Include the plugin & turn on theme mode."
1401
- msgstr ""
1402
-
1403
- #: includes/ot-functions-docs-page.php:775
1404
- msgid ""
1405
- "Download the latest version of <a href=\"http://wordpress.org/extend/plugins/"
1406
- "option-tree/\" rel=\"nofollow\" target=\"_blank\">OptionTree</a>."
1407
- msgstr ""
1408
-
1409
- #: includes/ot-functions-docs-page.php:776
1410
- msgid "Unpack the ZIP archive."
1411
- msgstr ""
1412
-
1413
- #: includes/ot-functions-docs-page.php:777
1414
- msgid ""
1415
- "Put the <code>option-tree</code> directory in the root of your theme. For "
1416
- "example, the server path would be <code>/wp-content/themes/theme-name/option-"
1417
- "tree/</code>."
1418
- msgstr ""
1419
-
1420
- #: includes/ot-functions-docs-page.php:778
1421
- msgid ""
1422
- "Add the following code to the beginning of your <code>functions.php</code>."
1423
- msgstr ""
1424
-
1425
- #: includes/ot-functions-docs-page.php:804
1426
- msgid ""
1427
- "It's that simple! You now have OptionTree built into your theme and anytime "
1428
- "there's an update to the plugin you just replace the old version and you're "
1429
- "good to go.."
1430
- msgstr ""
1431
-
1432
- #: includes/ot-functions-docs-page.php:806
1433
- msgid "Step 2: Create Theme Options without using the UI Builder."
1434
- msgstr ""
1435
-
1436
- #: includes/ot-functions-docs-page.php:808
1437
- msgid ""
1438
- "Create a file and name it anything you want, maybe <code>theme-options.php</"
1439
- "code>, or use the built in file export to create it for you. Remember, you "
1440
- "should always check the file for errors before including it in your theme."
1441
- msgstr ""
1442
-
1443
- #: includes/ot-functions-docs-page.php:809
1444
- msgid ""
1445
- "As well, you'll probably want to create a directory named <code>includes</"
1446
- "code> to put your <code>theme-options.php</code> into which will help keep "
1447
- "you file structure nice and tidy."
1448
- msgstr ""
1449
-
1450
- #: includes/ot-functions-docs-page.php:820
1451
- msgid ""
1452
- "Add a variation of the following code to your <code>theme-options.php</"
1453
- "code>. You'll obviously need to fill it in with all your custom array values "
1454
- "for contextual help (optional), sections (required), and settings (required)."
1455
- msgstr ""
1456
-
1457
- #: includes/ot-functions-docs-page.php:823
1458
- msgid ""
1459
- "The code below is a boilerplate to get your started. For a full list of the "
1460
- "available option types click the \"Option Types\" tab above. Also a quick "
1461
- "note, you don't need to put OptionTree in theme mode to manually create "
1462
- "options but you will want to hide the docs and settings as each time you "
1463
- "load the admin area the settings be written over with the code below if "
1464
- "they've changed in any way. However, this ensures your settings do not get "
1465
- "tampered with by the end-user."
1466
- msgstr ""
1467
-
1468
- #: includes/ot-functions-option-types.php:46
1469
- msgid "Sorry, this function does not exist"
1470
- msgstr ""
1471
-
1472
- #: includes/ot-functions-option-types.php:107
1473
- msgid "background-repeat"
1474
- msgstr ""
1475
-
1476
- #: includes/ot-functions-option-types.php:116
1477
- msgid "background-attachment"
1478
- msgstr ""
1479
-
1480
- #: includes/ot-functions-option-types.php:125
1481
- msgid "background-position"
1482
- msgstr ""
1483
-
1484
- #: includes/ot-functions-option-types.php:140
1485
- #: includes/ot-functions-option-types.php:1859
1486
- msgid "Add Media"
1487
- msgstr ""
1488
-
1489
- #: includes/ot-functions-option-types.php:208
1490
- #: includes/ot-functions-option-types.php:262
1491
- msgid "No Categories Found"
1492
- msgstr ""
1493
-
1494
- #: includes/ot-functions-option-types.php:257
1495
- #: includes/ot-functions-option-types.php:515
1496
- #: includes/ot-functions-option-types.php:804
1497
- #: includes/ot-functions-option-types.php:986
1498
- #: includes/ot-functions-option-types.php:1315
1499
- #: includes/ot-functions-option-types.php:1429
1500
- msgid "Choose One"
1501
- msgstr ""
1502
-
1503
- #: includes/ot-functions-option-types.php:463
1504
- #: includes/ot-functions-option-types.php:521
1505
- #: includes/ot-functions-option-types.php:937
1506
- #: includes/ot-functions-option-types.php:992
1507
- msgid "No Posts Found"
1508
- msgstr ""
1509
-
1510
- #: includes/ot-functions-option-types.php:592
1511
- #: includes/ot-functions-option-types.php:881
1512
- msgid "Add New"
1513
- msgstr ""
1514
-
1515
- #: includes/ot-functions-option-types.php:595
1516
- #: includes/ot-functions-option-types.php:884
1517
- msgid "You can re-order with drag & drop, the order will update after saving."
1518
- msgstr ""
1519
-
1520
- #: includes/ot-functions-option-types.php:755
1521
- #: includes/ot-functions-option-types.php:810
1522
- msgid "No Pages Found"
1523
- msgstr ""
1524
-
1525
- #: includes/ot-functions-option-types.php:1206
1526
- msgid "Choose Sidebar"
1527
- msgstr ""
1528
-
1529
- #: includes/ot-functions-option-types.php:1211
1530
- msgid "No Sidebars"
1531
- msgstr ""
1532
-
1533
- #: includes/ot-functions-option-types.php:1266
1534
- #: includes/ot-functions-option-types.php:1320
1535
- msgid "No Tags Found"
1536
- msgstr ""
1537
-
1538
- #: includes/ot-functions-option-types.php:1377
1539
- #: includes/ot-functions-option-types.php:1434
1540
- msgid "No Taxonomies Found"
1541
- msgstr ""
1542
-
1543
- #: includes/ot-functions-settings-page.php:35
1544
- msgid "Warning!"
1545
- msgstr ""
1546
-
1547
- #: includes/ot-functions-settings-page.php:36
1548
- msgid ""
1549
- "Go to the %s page if you want to save data, this page is for adding settings."
1550
- msgstr ""
1551
-
1552
- #: includes/ot-functions-settings-page.php:37
1553
- msgid ""
1554
- "If you're unsure or not completely positive that you should be editing these "
1555
- "settings, you should read the %s first."
1556
- msgstr ""
1557
-
1558
- #: includes/ot-functions-settings-page.php:38
1559
- msgid ""
1560
- "Things could break or be improperly displayed to the end-user if you do one "
1561
- "of the following:"
1562
- msgstr ""
1563
-
1564
- #: includes/ot-functions-settings-page.php:39
1565
- msgid ""
1566
- "Give two sections the same ID, give two settings the same ID, give two "
1567
- "contextual help content areas the same ID, don't create any settings, or "
1568
- "have a section at the end of the settings list."
1569
- msgstr ""
1570
-
1571
- #: includes/ot-functions-settings-page.php:40
1572
- msgid ""
1573
- "You can create as many settings as your project requires and use them how "
1574
- "you see fit. When you add a setting here, it will be available on the Theme "
1575
- "Options page for use in your theme. To separate your settings into sections, "
1576
- "click the \"Add Section\" button, fill in the input fields, and a new "
1577
- "navigation menu item will be created."
1578
- msgstr ""
1579
-
1580
- #: includes/ot-functions-settings-page.php:41
1581
- msgid ""
1582
- "All of the settings can be sorted and rearranged to your liking with Drag & "
1583
- "Drop. Don't worry about the order in which you create your settings, you can "
1584
- "always reorder them."
1585
- msgstr ""
1586
-
1587
- #: includes/ot-functions-settings-page.php:92
1588
- msgid "Add Section"
1589
- msgstr ""
1590
-
1591
- #: includes/ot-functions-settings-page.php:99
1592
- msgid "Contextual Help"
1593
- msgstr ""
1594
-
1595
- #: includes/ot-functions-settings-page.php:103
1596
- msgid "Contextual Help Sidebar"
1597
- msgstr ""
1598
-
1599
- #: includes/ot-functions-settings-page.php:103
1600
- msgid ""
1601
- "If you decide to add contextual help to the Theme Option page, enter the "
1602
- "optional \"Sidebar\" HTML here. This would be an extremely useful place to "
1603
- "add links to your themes documentation or support forum. Only after you've "
1604
- "added some content below will this display to the user."
1605
- msgstr ""
1606
-
1607
- #: includes/ot-functions-settings-page.php:132
1608
- msgid "Add Contextual Help Content"
1609
- msgstr ""
1610
-
1611
- #: includes/ot-functions-settings-page.php:168
1612
- msgid ""
1613
- "This import method has been deprecated. That means it has been replaced by a "
1614
- "new method and is no longer supported, and may be removed from future "
1615
- "versions. All themes that use this import method should be converted to use "
1616
- "its replacement below."
1617
- msgstr ""
1618
-
1619
- #: includes/ot-functions-settings-page.php:170
1620
- msgid ""
1621
- "If you were given a Theme Options XML file with a premium or free theme, "
1622
- "locate it on your hard drive and upload that file by clicking the blue "
1623
- "upload button. A popup window will appear, upload the XML file and click "
1624
- "\"Send to OptionTree\". The file URL should be in the upload input, if it is "
1625
- "click \"Import XML\"."
1626
- msgstr ""
1627
-
1628
- #: includes/ot-functions-settings-page.php:173
1629
- msgid "Import XML"
1630
- msgstr ""
1631
-
1632
- #: includes/ot-functions-settings-page.php:189
1633
- msgid "Add XML"
1634
- msgstr ""
1635
-
1636
- #: includes/ot-functions-settings-page.php:226
1637
- msgid ""
1638
- "To import your Settings copy and paste what appears to be a random string of "
1639
- "alpha numeric characters into this textarea and press the \"Import Settings"
1640
- "\" button."
1641
- msgstr ""
1642
-
1643
- #: includes/ot-functions-settings-page.php:229
1644
- msgid "Import Settings"
1645
- msgstr ""
1646
-
1647
- #: includes/ot-functions-settings-page.php:271
1648
- msgid ""
1649
- "Only after you've imported the Settings should you try and update your Theme "
1650
- "Options."
1651
- msgstr ""
1652
-
1653
- #: includes/ot-functions-settings-page.php:273
1654
- msgid ""
1655
- "To import your Theme Options copy and paste what appears to be a random "
1656
- "string of alpha numeric characters into this textarea and press the \"Import "
1657
- "Theme Options\" button."
1658
- msgstr ""
1659
-
1660
- #: includes/ot-functions-settings-page.php:276
1661
- msgid "Import Theme Options"
1662
- msgstr ""
1663
-
1664
- #: includes/ot-functions-settings-page.php:318
1665
- msgid ""
1666
- "Only after you've imported the Settings should you try and update your "
1667
- "Layouts."
1668
- msgstr ""
1669
-
1670
- #: includes/ot-functions-settings-page.php:320
1671
- msgid ""
1672
- "To import your Layouts copy and paste what appears to be a random string of "
1673
- "alpha numeric characters into this textarea and press the \"Import Layouts\" "
1674
- "button. Keep in mind that when you import your layouts, the active layout's "
1675
- "saved data will write over the current data set for your Theme Options."
1676
- msgstr ""
1677
-
1678
- #: includes/ot-functions-settings-page.php:323
1679
- msgid "Import Layouts"
1680
- msgstr ""
1681
-
1682
- #: includes/ot-functions-settings-page.php:366
1683
- msgid ""
1684
- "Export your Settings into a fully functional <code>theme-options.php</code> "
1685
- "file by clicking this button. For more information on how to use this file "
1686
- "read the theme mode %s. Remember, you should always check the file for "
1687
- "errors before including it in your theme."
1688
- msgstr ""
1689
-
1690
- #: includes/ot-functions-settings-page.php:373
1691
- msgid "Export Settings File"
1692
- msgstr ""
1693
-
1694
- #: includes/ot-functions-settings-page.php:403
1695
- msgid ""
1696
- "Export your Settings by highlighting this text and doing a copy/paste into a "
1697
- "blank .txt file. Then save the file for importing into another install of "
1698
- "WordPress later. Alternatively, you could just paste it into the "
1699
- "<code>OptionTree->Settings->Import</code> <strong>Settings</strong> textarea "
1700
- "on another web site."
1701
- msgstr ""
1702
-
1703
- #: includes/ot-functions-settings-page.php:439
1704
- msgid ""
1705
- "Export your Theme Options data by highlighting this text and doing a copy/"
1706
- "paste into a blank .txt file. Then save the file for importing into another "
1707
- "install of WordPress later. Alternatively, you could just paste it into the "
1708
- "<code>OptionTree->Settings->Import</code> <strong>Theme Options</strong> "
1709
- "textarea on another web site."
1710
- msgstr ""
1711
-
1712
- #: includes/ot-functions-settings-page.php:475
1713
- msgid ""
1714
- "Export your Layouts by highlighting this text and doing a copy/paste into a "
1715
- "blank .txt file. Then save the file for importing into another install of "
1716
- "WordPress later. Alternatively, you could just paste it into the "
1717
- "<code>OptionTree->Settings->Import</code> <strong>Layouts</strong> textarea "
1718
- "on another web site."
1719
- msgstr ""
1720
-
1721
- #: includes/ot-functions-settings-page.php:517
1722
- msgid ""
1723
- "To add a new layout enter a unique lower case alphanumeric string (dashes "
1724
- "allowed) in the text field and click \"Save Layouts\"."
1725
- msgstr ""
1726
-
1727
- #: includes/ot-functions-settings-page.php:518
1728
- msgid ""
1729
- "As well, you can activate, remove, and drag & drop the order; all situations "
1730
- "require you to click \"Save Layouts\" for the changes to be applied."
1731
- msgstr ""
1732
-
1733
- #: includes/ot-functions-settings-page.php:519
1734
- msgid ""
1735
- "When you create a new layout it will become active and any changes made to "
1736
- "the Theme Options will be applied to it. If you switch back to a different "
1737
- "layout immediately after creating a new layout that new layout will have a "
1738
- "snapshot of the current Theme Options data attached to it."
1739
- msgstr ""
1740
-
1741
- #: includes/ot-functions-settings-page.php:520
1742
- msgid ""
1743
- "Visit <code>OptionTree->Documentation->Layouts Overview</code> to see a more "
1744
- "in-depth description of what layouts are and how to use them."
1745
- msgstr ""
1746
-
1747
- #: includes/ot-functions-settings-page.php:557
1748
- msgid "Save Layouts"
1749
- msgstr ""
1750
-
1751
- #: includes/ot-settings-api.php:353
1752
- msgid "Reset Options"
1753
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
license.txt DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ot-loader.php DELETED
@@ -1,520 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: OptionTree
4
- * Plugin URI: http://wp.envato.com
5
- * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
- * Version: 2.1.1
7
- * Author: Derek Herman
8
- * Author URI: http://valendesigns.com
9
- * License: GPLv3
10
- */
11
-
12
- /**
13
- * This is the OptionTree loader class.
14
- *
15
- * @package OptionTree
16
- * @author Derek Herman <derek@valendesigns.com>
17
- * @copyright Copyright (c) 2013, Derek Herman
18
- */
19
- if ( ! class_exists( 'OT_Loader' ) ) {
20
-
21
- class OT_Loader {
22
-
23
- /**
24
- * PHP5 constructor method.
25
- *
26
- * This method loads other methods of the class.
27
- *
28
- * @return void
29
- *
30
- * @access public
31
- * @since 2.0
32
- */
33
- public function __construct() {
34
- /* setup the constants */
35
- $this->constants();
36
-
37
- /* include the required admin files */
38
- $this->admin_includes();
39
-
40
- /* include the required files */
41
- $this->includes();
42
-
43
- /* hook into WordPress */
44
- $this->hooks();
45
- }
46
-
47
- /**
48
- * Constants
49
- *
50
- * Defines the constants for use within OptionTree. Constants
51
- * are prefixed with 'OT_' to avoid any naming collisions.
52
- *
53
- * @return void
54
- *
55
- * @access private
56
- * @since 2.0
57
- */
58
- private function constants() {
59
-
60
- /**
61
- * Current Version number.
62
- */
63
- define( 'OT_VERSION', '2.1.1' );
64
-
65
- /**
66
- * For developers: Allow Unfiltered HTML in all the textareas.
67
- *
68
- * Run a filter and set to true if you want all the
69
- * users to be able to post anything in the textareas.
70
- * WARNING: This opens a security hole for low level users
71
- * to be able to post malicious scripts, you've been warned.
72
- *
73
- * @since 2.0
74
- */
75
- define( 'OT_ALLOW_UNFILTERED_HTML', apply_filters( 'ot_allow_unfiltered_html', false ) );
76
-
77
- /**
78
- * For developers: Theme mode.
79
- *
80
- * Run a filter and set to true to enable OptionTree theme mode.
81
- * You must have this files parent directory inside of
82
- * your themes root directory. As well, you must include
83
- * a reference to this file in your themes functions.php.
84
- *
85
- * @since 2.0
86
- */
87
- define( 'OT_THEME_MODE', apply_filters( 'ot_theme_mode', false ) );
88
-
89
- /**
90
- * For developers: Child Theme mode. TODO document
91
- *
92
- * Run a filter and set to true to enable OptionTree child theme mode.
93
- * You must have this files parent directory inside of
94
- * your themes root directory. As well, you must include
95
- * a reference to this file in your themes functions.php.
96
- *
97
- * @since 2.0.15
98
- */
99
- define( 'OT_CHILD_THEME_MODE', apply_filters( 'ot_child_theme_mode', false ) );
100
-
101
- /**
102
- * For developers: Show Pages.
103
- *
104
- * Run a filter and set to false if you don't want to load the
105
- * settings & documentation pages in the admin area of WordPress.
106
- *
107
- * @since 2.0
108
- */
109
- define( 'OT_SHOW_PAGES', apply_filters( 'ot_show_pages', true ) );
110
-
111
- /**
112
- * For developers: Show Theme Options UI Builder
113
- *
114
- * Run a filter and set to false if you want to hide the
115
- * Theme Options UI page in the admin area of WordPress.
116
- *
117
- * @since 2.1
118
- */
119
- define( 'OT_SHOW_OPTIONS_UI', apply_filters( 'ot_show_options_ui', true ) );
120
-
121
- /**
122
- * For developers: Hide Settings Import
123
- *
124
- * Run a filter and set to false if you want to hide the
125
- * Settings Import options on the Import page.
126
- *
127
- * @since 2.1
128
- */
129
- define( 'OT_SHOW_SETTINGS_IMPORT', apply_filters( 'ot_show_settings_import', true ) );
130
-
131
- /**
132
- * For developers: Hide Settings Export
133
- *
134
- * Run a filter and set to false if you want to hide the
135
- * Settings Import options on the Import page.
136
- *
137
- * @since 2.1
138
- */
139
- define( 'OT_SHOW_SETTINGS_EXPORT', apply_filters( 'ot_show_settings_export', true ) );
140
-
141
- /**
142
- * For developers: Show New Layout.
143
- *
144
- * Run a filter and set to false if you don't want to show the
145
- * "New Layout" section at the top of the theme options page.
146
- *
147
- * @since 2.0.10
148
- */
149
- define( 'OT_SHOW_NEW_LAYOUT', apply_filters( 'ot_show_new_layout', true ) );
150
-
151
- /**
152
- * For developers: Show Documentation
153
- *
154
- * Run a filter and set to false if you want to hide the Documentation.
155
- *
156
- * @since 2.1
157
- */
158
- define( 'OT_SHOW_DOCS', apply_filters( 'ot_show_docs', true ) );
159
-
160
- /**
161
- * For developers: Custom Theme Option page
162
- *
163
- * Run a filter and set to false if you want to hide the OptionTree
164
- * Theme Option page and build your own.
165
- *
166
- * @since 2.1
167
- */
168
- define( 'OT_USE_THEME_OPTIONS', apply_filters( 'ot_use_theme_options', true ) );
169
-
170
- /**
171
- * For developers: Meta Boxes.
172
- *
173
- * Run a filter and set to false to keep OptionTree from
174
- * loading the meta box resources.
175
- *
176
- * @since 2.0
177
- */
178
- define( 'OT_META_BOXES', apply_filters( 'ot_meta_boxes', true ) );
179
-
180
- /**
181
- * Check if in theme mode.
182
- *
183
- * If OT_THEME_MODE and OT_CHILD_THEME_MODE is false, set the
184
- * directory path & URL like any other plugin. Otherwise, use
185
- * the parent or child themes root directory.
186
- *
187
- * @since 2.0
188
- */
189
- if ( false == OT_THEME_MODE && false == OT_CHILD_THEME_MODE ) {
190
- define( 'OT_DIR', plugin_dir_path( __FILE__ ) );
191
- define( 'OT_URL', plugin_dir_url( __FILE__ ) );
192
- } else {
193
- if ( true == OT_CHILD_THEME_MODE ) {
194
- define( 'OT_DIR', trailingslashit( get_stylesheet_directory() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
195
- define( 'OT_URL', trailingslashit( get_stylesheet_directory_uri() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
196
- } else {
197
- define( 'OT_DIR', trailingslashit( get_template_directory() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
198
- define( 'OT_URL', trailingslashit( get_template_directory_uri() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
199
- }
200
- }
201
-
202
- /**
203
- * Template directory URI for the current theme.
204
- *
205
- * @since 2.1
206
- */
207
- if ( true == OT_CHILD_THEME_MODE ) {
208
- define( 'OT_THEME_URL', get_stylesheet_directory_uri() );
209
- } else {
210
- define( 'OT_THEME_URL', get_template_directory_uri() );
211
- }
212
-
213
- /**
214
- * Relative path to the languages directory.
215
- *
216
- * @since 2.0.10
217
- */
218
- define( 'OT_LANG_DIR', dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
219
- }
220
-
221
- /**
222
- * Include admin files
223
- *
224
- * These functions are included on admin pages only.
225
- *
226
- * @return void
227
- *
228
- * @access private
229
- * @since 2.0
230
- */
231
- private function admin_includes() {
232
-
233
- /* exit early if we're not on an admin page */
234
- if ( ! is_admin() )
235
- return false;
236
-
237
- /* global include files */
238
- $files = array(
239
- 'ot-functions-admin',
240
- 'ot-functions-option-types',
241
- 'ot-functions-compat',
242
- 'ot-settings-api'
243
- );
244
-
245
- /* include the meta box api */
246
- if ( OT_META_BOXES == true ) {
247
- $files[] = 'ot-meta-box-api';
248
- }
249
-
250
- /* include the settings & docs pages */
251
- if ( OT_SHOW_PAGES == true ) {
252
- $files[] = 'ot-functions-settings-page';
253
- $files[] = 'ot-functions-docs-page';
254
- }
255
-
256
- /* require the files */
257
- foreach ( $files as $file ) {
258
- $this->load_file( OT_DIR . "includes/{$file}.php" );
259
- }
260
-
261
- /* Registers the Theme Option page */
262
- add_action( 'init', 'ot_register_theme_options_page' );
263
-
264
- /* Registers the Settings page */
265
- if ( OT_SHOW_PAGES == true ) {
266
- add_action( 'init', 'ot_register_settings_page' );
267
- }
268
-
269
- }
270
-
271
- /**
272
- * Include front-end files
273
- *
274
- * These functions are included on every page load
275
- * incase other plugins need to access them.
276
- *
277
- * @return void
278
- *
279
- * @access private
280
- * @since 2.0
281
- */
282
- private function includes() {
283
-
284
- $files = array(
285
- 'ot-functions',
286
- 'ot-functions-deprecated'
287
- );
288
-
289
- /* require the files */
290
- foreach ( $files as $file ) {
291
- $this->load_file( OT_DIR . "includes/{$file}.php" );
292
- }
293
-
294
- }
295
-
296
- /**
297
- * Execute the WordPress Hooks
298
- *
299
- * @return void
300
- *
301
- * @access public
302
- * @since 2.0
303
- */
304
- private function hooks() {
305
-
306
- /* load the text domain */
307
- if ( false == OT_THEME_MODE && false == OT_CHILD_THEME_MODE ) {
308
- add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
309
- } else {
310
- add_action( 'after_setup_theme', array( $this, 'load_textdomain' ) );
311
- }
312
-
313
- /* load the Meta Box assets */
314
- if ( OT_META_BOXES == true ) {
315
-
316
- /* add scripts for metaboxes to post-new.php & post.php */
317
- add_action( 'admin_print_scripts-post-new.php', 'ot_admin_scripts', 11 );
318
- add_action( 'admin_print_scripts-post.php', 'ot_admin_scripts', 11 );
319
-
320
- /* add styles for metaboxes to post-new.php & post.php */
321
- add_action( 'admin_print_styles-post-new.php', 'ot_admin_styles', 11 );
322
- add_action( 'admin_print_styles-post.php', 'ot_admin_styles', 11 );
323
-
324
- }
325
-
326
- /* Adds the Theme Option page to the admin bar */
327
- add_action( 'admin_bar_menu', 'ot_register_theme_options_admin_bar_menu', 999 );
328
-
329
- /* prepares the after save do_action */
330
- add_action( 'admin_init', 'ot_after_theme_options_save', 1 );
331
-
332
- /* default settings */
333
- add_action( 'admin_init', 'ot_default_settings', 2 );
334
-
335
- /* add xml to upload filetypes array */
336
- add_action( 'admin_init', 'ot_add_xml_to_upload_filetypes', 3 );
337
-
338
- /* import */
339
- add_action( 'admin_init', 'ot_import', 4 );
340
-
341
- /* export */
342
- add_action( 'admin_init', 'ot_export', 5 );
343
-
344
- /* save settings */
345
- add_action( 'admin_init', 'ot_save_settings', 6 );
346
-
347
- /* save layouts */
348
- add_action( 'admin_init', 'ot_modify_layouts', 7 );
349
-
350
- /* create media post */
351
- add_action( 'admin_init', 'ot_create_media_post', 8 );
352
-
353
- /* global CSS */
354
- add_action( 'admin_head', array( $this, 'global_admin_css' ) );
355
-
356
- /* dynamic front-end CSS */
357
- add_action( 'wp_enqueue_scripts', 'ot_load_dynamic_css', 999 );
358
-
359
- /* insert theme CSS dynamically */
360
- add_action( 'ot_after_theme_options_save', 'ot_save_css' );
361
-
362
- /* AJAX call to create a new section */
363
- add_action( 'wp_ajax_add_section', array( $this, 'add_section' ) );
364
-
365
- /* AJAX call to create a new setting */
366
- add_action( 'wp_ajax_add_setting', array( $this, 'add_setting' ) );
367
-
368
- /* AJAX call to create a new contextual help */
369
- add_action( 'wp_ajax_add_the_contextual_help', array( $this, 'add_the_contextual_help' ) );
370
-
371
- /* AJAX call to create a new choice */
372
- add_action( 'wp_ajax_add_choice', array( $this, 'add_choice' ) );
373
-
374
- /* AJAX call to create a new list item setting */
375
- add_action( 'wp_ajax_add_list_item_setting', array( $this, 'add_list_item_setting' ) );
376
-
377
- /* AJAX call to create a new layout */
378
- add_action( 'wp_ajax_add_layout', array( $this, 'add_layout' ) );
379
-
380
- /* AJAX call to create a new list item */
381
- add_action( 'wp_ajax_add_list_item', array( $this, 'add_list_item' ) );
382
-
383
- /* Modify the media uploader button */
384
- add_filter( 'gettext', array( $this, 'change_image_button' ), 10, 3 );
385
-
386
- }
387
-
388
- /**
389
- * Load a file
390
- *
391
- * @return void
392
- *
393
- * @access private
394
- * @since 2.0.15
395
- */
396
- private function load_file( $file ){
397
-
398
- include_once( $file );
399
-
400
- }
401
-
402
- /**
403
- * Load the text domain.
404
- *
405
- * @return void
406
- *
407
- * @access private
408
- * @since 2.0
409
- */
410
- public function load_textdomain() {
411
- if ( false == OT_THEME_MODE && false == OT_CHILD_THEME_MODE ) {
412
- load_plugin_textdomain( 'option-tree', false, OT_LANG_DIR . 'plugin' );
413
- } else {
414
- load_theme_textdomain( 'option-tree', OT_LANG_DIR . 'theme-mode' );
415
- }
416
- }
417
-
418
- /**
419
- * Adds the global CSS to fix the menu icon.
420
- */
421
- public function global_admin_css() {
422
- echo '
423
- <style>
424
- #adminmenu #toplevel_page_ot-settings .wp-menu-image img { padding: 5px 0px 1px 6px !important; }
425
- </style>
426
- ';
427
- }
428
-
429
- /**
430
- * AJAX utility function for adding a new section.
431
- */
432
- public function add_section() {
433
- echo ot_sections_view( 'option_tree_settings[sections]', $_REQUEST['count'] );
434
- die();
435
- }
436
-
437
- /**
438
- * AJAX utility function for adding a new setting.
439
- */
440
- public function add_setting() {
441
- echo ot_settings_view( $_REQUEST['name'], $_REQUEST['count'] );
442
- die();
443
- }
444
-
445
- /**
446
- * AJAX utility function for adding a new list item setting.
447
- */
448
- public function add_list_item_setting() {
449
- echo ot_settings_view( $_REQUEST['name'] . '[settings]', $_REQUEST['count'] );
450
- die();
451
- }
452
-
453
- /**
454
- * AJAX utility function for adding new contextual help content.
455
- */
456
- public function add_the_contextual_help() {
457
- echo ot_contextual_help_view( $_REQUEST['name'], $_REQUEST['count'] );
458
- die();
459
- }
460
-
461
- /**
462
- * AJAX utility function for adding a new choice.
463
- */
464
- public function add_choice() {
465
- echo ot_choices_view( $_REQUEST['name'], $_REQUEST['count'] );
466
- die();
467
- }
468
-
469
- /**
470
- * AJAX utility function for adding a new layout.
471
- */
472
- public function add_layout() {
473
- echo ot_layout_view( $_REQUEST['count'] );
474
- die();
475
- }
476
-
477
- /**
478
- * AJAX utility function for adding a new list item.
479
- */
480
- public function add_list_item() {
481
- ot_list_item_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] );
482
- die();
483
- }
484
-
485
- /**
486
- * Filters the media uploader button.
487
- *
488
- * @return string
489
- *
490
- * @access public
491
- * @since 2.1
492
- */
493
- public function change_image_button( $translation, $text, $domain ) {
494
- global $pagenow;
495
-
496
- if ( $pagenow == 'themes.php' && 'default' == $domain && 'Insert into post' == $text ) {
497
-
498
- // Once is enough.
499
- remove_filter( 'gettext', array( $this, 'ot_change_image_button' ) );
500
- return 'Send to OptionTree';
501
-
502
- }
503
-
504
- return $translation;
505
-
506
- }
507
-
508
- }
509
-
510
- /**
511
- * Instantiate the OptionTree loader class.
512
- *
513
- * @since 2.0
514
- */
515
- $ot_loader = new OT_Loader();
516
-
517
- }
518
-
519
- /* End of file ot-loader.php */
520
- /* Location: ./ot-loader.php */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,299 +1,41 @@
1
  === OptionTree ===
2
  Contributors: valendesigns
3
- Donate link: http://bit.ly/NuXI3T
4
- Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
- Requires at least: 3.5
6
- Tested up to: 3.6
7
- Stable tag: 2.1.1
8
- License: GPLv3
9
 
10
- Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
11
 
12
  == Description ==
13
 
14
- Theme Options are what make a WordPress Theme truly custom. OptionTree attempts to bridge the gap between developers, designers and end-users by solving the admin User Interface issues that arise when creating a custom theme. Designers shouldn't have to be limited to what they can create visually because their programming skills aren't as developed as they would like. Also, programmers shouldn't have to recreate the wheel for every new project, so in walks OptionTree.
15
 
16
- With OptionTree you can create as many Theme Options as your project requires and use them how you see fit. When you add a option to the Settings page, it will be available on the Theme Options page for use in your theme.
17
 
18
- Included is the ability to Import/Export all the theme options and data for packaging with custom themes or local development. With the Import/Export feature you can get a theme set up on a live server in minutes. Theme authors can now create different version of their themes and include them with the download. It makes setting up different theme styles & options easier than ever because a theme user installs the plugin and theme and either adds their own settings or imports your defaults.
19
-
20
- A new feature in OptionTree 2.0 is the ability to include the plugin directly in your themes root directory. Not only does that mean your theme is guaranteed to have the plugin installed you also get the ability to interact directly with OptionTree through settings and meta box arrays. You can now tell OptionTree what settings you want and know that nobody will break your theme by changing settings through the UI Builder. It's just a better plugin now!
21
-
22
- OptionTree is a project sponsored by <a href="http://themeforest.net/?ref=valendesigns">ThemeForest</a>, the largest WordPress theme marketplace on the web, and was originally conceived to help ThemeForest authors quickly power up their themes. But it's here for the benefit of one and all, so option up folks!
23
 
24
  == Installation ==
25
 
26
  1. Upload `option-tree` to the `/wp-content/plugins/` directory
27
  1. Activate the plugin through the 'Plugins' menu in WordPress
 
28
  1. Click the `OptionTree->Documentation` link in the WordPress admin sidebar menu for further setup assistance.
29
 
30
  == Frequently Asked Questions ==
31
 
32
  = Is this plugin PHP5 only? =
33
 
34
- Yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
35
 
36
  == Screenshots ==
37
 
38
- 1. Theme Options
39
- 2. Settings
40
  3. Documentation
41
 
42
  == Changelog ==
43
 
44
- = 2.1.1 =
45
- * Hotfix - The OT_SHOW_SETTINGS_EXPORT constant was incorrectly set to false as the default.
46
-
47
- = 2.1 =
48
- * Added support for WordPress 3.6.
49
- * UI got a small but needed update, and is now more inline with WordPress.
50
- * Added WPML support for the Text, Textarea, and Textarea Simple option types, and within list items; even after drag & drop.
51
- * Upload now uses the media uploader introduced in WordPress 3.5. Contributors via github @htvu, @maimairel, and @valendesigns.
52
- * Added a horizontal Numeric Slider option type. Contributors via github @maimairel and @valendesigns.
53
- * Added a Sidebar Select option type. Contributors via github @maimairel.
54
- * Removed additional deprecated assigning of return value in PHP.
55
- * Fix missing "Send to OptionTree" button in CPT. Contributors via github @jomaddim.
56
- * Fix option types that use $count instead of an array key to select the option value.
57
- * Created functions to register the Theme Options & Settings pages, and with better filtering.
58
- * Added relative path support for Radio Image choices.
59
- * Added dynamic replacement of 'OT_URL' & 'OT_THEME_URL' in the Radio Image source path.
60
- * Make '0' possible as a field value. Validate for empty strings instead of empty(). Contributors via github @maimairel.
61
- * The 'ot_theme_options_capability' filter is now working for different capabilities like editor.
62
- * The 'ot_display_by_type' filter is now being assigned to a value.
63
- * Added filter 'ot_show_options_ui' which allows you to hide the Theme Options UI Builder.
64
- * Added filter 'ot_show_settings_import' which allows you to hide the Settings Import options on the Import page.
65
- * Added filter 'ot_show_settings_export' which allows you to hide the Settings Export options on the Export page.
66
- * Added filter 'ot_show_docs' which allows you to hide the Documentation.
67
- * Added filter 'ot_use_theme_options' which allows you to hide the OptionTree Theme Option page (not recommended for beginners).
68
- * Added filter 'ot_list_item_description' which allows you to change the default list item description text.
69
- * Added filter 'ot_type_custom_post_type_checkbox_query' which allows you to filter the Custom Post Type Checkbox option type WP_Query array.
70
- * Added filter 'ot_type_custom_post_type_select_query' which allows you to filter the Custom Post Type Select option type WP_Query array.
71
- * Added filter 'ot_type_page_checkbox_query' which allows you to filter the Page Checkbox option type WP_Query array.
72
- * Added filter 'ot_type_page_select_query' which allows you to filter the Page Select option type WP_Query array.
73
- * Added filter 'ot_type_post_checkbox_query' which allows you to filter the Post Checkbox option type WP_Query array.
74
- * Added filter 'ot_type_post_select_query' which allows you to filter the Post Select option type WP_Query array.
75
-
76
- = 2.0.16 =
77
- * Fixed an urgent JS regression bug that caused the upload option type to break. Code contributed by @anonumus via github.
78
- * Added 'font-color' to the typography filter.
79
-
80
- = 2.0.15 =
81
- * Added support for Child Theme mode.
82
- * Improved handling of standard values when settings are written manually.
83
- * Add filter for CSS insertion value.
84
- * Added 'ot_before_theme_options_save' action hook.
85
- * Fix 'indexOf' JS error when upload is closed without uploading.
86
- * Add textarea std value when option type is 'textarea', 'textarea-simple', or 'css'.
87
- * Remove load_template and revert back to include_once.
88
- * Fixed dynamic.css regression from 2.0.13 that caused the file to not save.
89
-
90
- = 2.0.14 =
91
- * Removed deprecated assigning of return value in PHP.
92
- * Patch to fix PHP notice regression with the use of load_template in a plugin after Theme Check update.
93
- * Fixed missing required arguments in OT_Loader::add_layout.
94
- * Removed esc_attr() on font-family check.
95
- * Added a 'ot_theme_options_parent_slug' filter in ot-ui-theme-options.php
96
- * Fixed WP_Error from the use of wp_get_remote() instead of file_get_contents().
97
-
98
- = 2.0.13 =
99
- * Removed almost all of the Theme Check nag messages when in 'ot_theme_mode'.
100
- * Fix an issue where Media Upload stopped working on some servers.
101
-
102
- = 2.0.12 =
103
- * Added additional filters to the array that builds the Theme Option UI.
104
- * Made option-tree post type private.
105
- * Revert capabilities back to manage_options in ot-ui-admin.php.
106
- * Upload now sends the URL of the selected image size to OptionTree.
107
- * Added new range interval filter to font-size, letter-spacing, & line-height.
108
- * Allow Typography fields to be filtered out of the UI.
109
-
110
- = 2.0.11 =
111
- * Added filters to the array that builds the Theme Option UI.
112
- * Added .format-setting-wrap div to allow for complex CSS layouts.
113
- * Added better namespacing for the Colorpicker option type.
114
- * Fixed theme-options.php export where it was adding an extra comma.
115
-
116
- = 2.0.10 =
117
- * Fixed a bug where the Textarea row count wasn't working for List Items.
118
- * Added an apply_filter to the exported theme-options.php file.
119
- * Added CSS id's to tabs and settings.
120
- * Allow "New Layout" section to be hidden on the theme options page via a filter.
121
- * Fixed a bug where the Colorpicker was not closing in List Items.
122
- * Change capabilities from manage_options to edit_theme_options.
123
- * Remove Textblock title in List Items & Metaboxes.
124
- * Fixed a List Item bug that incorrectly added ID's based on counting objects - submitted by Spark
125
- * Fixed incorrect text domain paths for both plugin and theme mode.
126
- * Fixed a bug with UI Sortable not properly calculating the container height.
127
- * Fixed Select dropdown selector bug - submitted by Manfred Haltner
128
- * Fixed Radio Image remove class bug - submitted by designst
129
- * Added new typography fields - submitted by darknailblue
130
- * Added dynamic CSS support for new typography fields.
131
- * Added new filters to typography fields, including low/high range & unit types.
132
-
133
- = 2.0.9 =
134
- * Fixed the issue where the Textarea Simple and CSS option types were mysteriously being ran through wpautop.
135
- * Added missing class setting to Textarea, Textarea Simple, & CSS option types.
136
- * Fixed theme-options.php exported array where label values were not correct.
137
- * Change GET to POST for all AJAX calls to fix a bug where some servers would not allow long strings to be passed in GET variables.
138
- * Added the 'ot_after_validate_setting' filter to the validation function.
139
- * Added $field_id to the ot_validate_setting() for more precise filtering.
140
- * Added the ot_reverse_wpautop() function that you can run input through just incase you need it.
141
- * Updated the docs to include information on why WYSIWYG editors are not allowed in meta boxes and that they revert to a Textarea Simple.
142
- * Update option-tree.pot file.
143
-
144
- = 2.0.8 =
145
- * Add auto import for backwards compatibility of old 1.x files.
146
- * Added the ability to export settings into a fully functional theme-options.php.
147
- * Fix typo in docs regarding the filter demo code.
148
- * Removed slashes in the section and contextual help titles.
149
- * Made colorpicker input field alignment more cross browser compatible.
150
-
151
- = 2.0.7 =
152
- * Fixed the load order to be compatible with 1.x version themes that think the get_option_tree() function doesn't exist yet.
153
- * Tested and compatible with Cudazi themes, but the nag message is still visible.
154
-
155
- = 2.0.6 =
156
- * Run the 'option_tree' array through validation when importing data and layouts.
157
- * Fix a bug where list items and sliders were not allowing the user to select the input field.
158
- * Add a filter that allows you to not load resources for meta boxes if you're not going to use them.
159
- * Update option-tree.pot file.
160
-
161
- = 2.0.5 =
162
- * Change the way the 'option_tree_settings' array validates. Strip out those damn slashes!
163
-
164
- = 2.0.4 =
165
- * Run the 'option_tree' array through validation when upgrading from the 1.0 branch to the 2.0 branch for the first time.
166
- * Fix a typo in the slider array where textarea's were not saving the first time due to an incorrect array key.
167
-
168
- = 2.0.3 =
169
- * Had an incorrect conditional statement causing an issue where the plugin was attempting to create the 'option-tree' image attachment page, even though it was already created.
170
- * The above also fixed a conflict with 'The Events Calendar' plugin.
171
-
172
- = 2.0.2 =
173
- * Added I18n support, let the translations begin. The option-tree.pot file is inside the languages directory.
174
- * Trim whitespace on imported choices array.
175
- * Fixed the CSS insert function not having a value to save.
176
-
177
- = 2.0.1 =
178
- * Import from table was not mapping settings correctly. It is now.
179
-
180
- = 2.0 =
181
- * Complete rewrite form the ground up.
182
- * Better Theme Options UI Builder.
183
- * New in-plugin documentation.
184
- * Brand new responsive UI.
185
- * Add new option types, most notable the List Item which should eventually replace the Slider.
186
- * Added the simpler ot_get_option() function to eventually replace get_option_tree().
187
- * Added support for Meta Boxes.
188
- * Added Theme Mode where you can now include the plugin directly in your theme.
189
- * Better validation on saved data.
190
- * Simplified the import process.
191
- * Added support for contextual help.
192
- * Permanently move the Theme Option to the Appearance tab.
193
- * Added a ton of filters.
194
- * Made huge improvements to the code base and tested rigorously.
195
-
196
- = 1.1.8.1 =
197
- * Removed get_option_tree() in the WordPress admin area due to theme conflicts.
198
- * Removed demo files in the assets folder at the request of WordPress
199
-
200
- = 1.1.8 =
201
- * Fixed scrolling issue on extra tall pages
202
- * Added ability to show/hide settings & documentation via the User Profile page.
203
- * Added Background option type.
204
- * Added Typography option type.
205
- * Added CSS option type.
206
- * Better looking selects with 1=Yes,2=No where '1' is the value and 'Yes' is the text in the select.
207
- * Made the AJAX message CSS more prominent.
208
- * functions.load.php will now only load option type functions if viewing an OT admin page.
209
- * Deregistered the custom jQuery UI in the 'Cispm Mail Contact' plugin when viewing an OptionTree page.
210
- * Can now save layouts from the Theme Options page.
211
- * You can now change the slider fields by targeting a specific "Option Key"
212
- * Modified upload for situations where you manually enter a relative path
213
- * Allow get_option_tree() function to be used in WP admin
214
- * Changed permissions to edit_theme_options
215
-
216
- = 1.1.7.1 =
217
- * Revert functions.load.php, will fix and update in next version
218
-
219
- = 1.1.7 =
220
- * Added layout (theme variation) support with save/delete/activate/import/export capabilities. Contributions form Brian of flauntbooks.com
221
- * Allow layout change on Theme Options page.
222
- * Full Multisite compatibility by manually adding xml mime type for import options.
223
- * Replaced eregi() with preg_match() for 5.3+ compatibility.
224
- * Changed test data in the assets directory for new layout option.
225
- * Made it so when the slider & upload image changes it's reflected on blur.
226
- * Gave the slider image an upload button.
227
- * Added do_action('option_tree_import_data') to option_tree_import_data() function before exit.
228
- * Added do_action('option_tree_array_save') to option_tree_array_save() function before exit.
229
- * Added do_action('option_tree_save_layout') to option_tree_save_layout() function before exit.
230
- * Added do_action('option_tree_delete_layout') to option_tree_delete_layout() function before exit.
231
- * Added do_action('option_tree_activate_layout') to option_tree_activate_layout() function before exit.
232
- * Added do_action('option_tree_import_layout') to option_tree_import_layout() function before redirect.
233
- * Added do_action('option_tree_admin_header') hook before all admin pages.
234
- * Fixed bug where users could add a color without a hash.
235
- * Only load option type function on Theme Options page
236
- * Loading resources with absolute paths, no longer relative.
237
- * Fixed a bug with uploader creating extra option-tree draft pages.
238
- * Fixed slider toggle bug, now the sliders close when you open another or create new slide.
239
-
240
- = 1.1.6 =
241
- * Theme Integration added.
242
- * Made the upload XML file openbase_dir compliant.
243
-
244
- = 1.1.5 =
245
- * Fixed multiple sliders issue
246
-
247
- = 1.1.4 =
248
- * Patch for get_option_tree() $is_array being false and still returning an array
249
-
250
- = 1.1.3 =
251
- * Added Slider option type with filter for changing the optional fields
252
- * Fixed the text displayed for Measurement option type after options are reset
253
- * Added filter to measurement units
254
- * Code cleanup in the option_tree_array_save() function
255
- * Fixed double quotes on front-end display
256
-
257
- = 1.1.2 =
258
- * Fixed double quotes in Textarea option type
259
- * Added Measurement option type for CSS values
260
- * Fixed Post option type only returning 5 items
261
- * Added a scrolling window for checkboxes > 10
262
-
263
- = 1.1.1 =
264
- * Fixed the 'remove' icon from showing when nothing's uploaded
265
-
266
- = 1.1 =
267
- * Fixed the Undefined index: notices when WP_DEBUG is set to true
268
-
269
  = 1.0.0 =
270
- * Initial version
271
-
272
- == Upgrade Notice ==
273
-
274
- = 2.1.1 =
275
- If you're not the developer of this theme, please ask them to test compatibility with version 2.1 before upgrading. If you are the developer, I urge you to do the same in a controlled environment.
276
-
277
- = 2.0.16 =
278
- There was an issue with the upload option type's JavaScript not allowing anything other than images to be sent to the editor. This urgent issue is now fixed and why this version is light on changes.
279
-
280
- = 2.0.12 =
281
- The plugin has undertaken a complete rebuild! If you are not the theme developer, I urge you to contact that person before you upgrade and ask them to test the themes compatibility.
282
-
283
- = 1.1.8.1 =
284
- Removed get_option_tree() in the WordPress admin area due to theme conflicts.
285
-
286
- = 1.1.8 =
287
- Added Typography, Background, & CSS option types. Lots of way to extend them, as well.
288
-
289
- = 1.1.7 =
290
- Lots of additions, none critical just fun. Added layouts & upload to slider. As well, started including action hooks for extending and integrating with other plugins.
291
-
292
- = 1.1.6 =
293
- Added theme integration for developers. It's now possible to have a default XML file included in your theme to populate the theme options and hide the settings and docs pages. Read more about this in the plugins built in documentation.
294
-
295
- = 1.1.5 =
296
- Having multiple sliders caused a naming collision in the JavaScript and is now fixed. Upgrade ASAP to have multiple sliders available in the UI.
297
-
298
- = 1.1.4 =
299
- Fixed the returned value of the get_option_tree() function when $is_array is set to false. If you have created any slider or measurement option types please read the updated documentation for examples on how to use them in your theme.
1
  === OptionTree ===
2
  Contributors: valendesigns
3
+ Donate link:
4
+ Tags: admin, theme options, options, admin interface, ajax
5
+ Requires at least: 3.0
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.0.0
 
8
 
9
+ Customizable WordPress Theme Options Framework.
10
 
11
  == Description ==
12
 
13
+ Theme Options are what make a Theme truly custom. OptionTree attempts to bridge the gap between developers, designers and end-users by solving the admin User Interface issues that arise when creating a custom theme. Designers shouldn't have to be limited to what they can create visually because their programming skills aren't as developed. Also, programers shouldn't have to recreate the wheel for every project. In walks OptionTree.
14
 
15
+ With OptionTree you can create as many Theme Options as your project requires and use them how you see fit. When you add a option to the Settings page, it will be available on the Theme Options page for use in your theme. Included is the ability to Import/Export all your theme options and data. You can create a theme locally and get it set up on a live server in minutes.
16
 
17
+ Because of the ability to import and export, theme authors can now create different version of their themes and include them with the download. It makes setting up different theme style easier than ever.
 
 
 
 
18
 
19
  == Installation ==
20
 
21
  1. Upload `option-tree` to the `/wp-content/plugins/` directory
22
  1. Activate the plugin through the 'Plugins' menu in WordPress
23
+ 1. If included in your theme, import the XML file & data by going to `OptionTree->Settings->Import`
24
  1. Click the `OptionTree->Documentation` link in the WordPress admin sidebar menu for further setup assistance.
25
 
26
  == Frequently Asked Questions ==
27
 
28
  = Is this plugin PHP5 only? =
29
 
30
+ Yes OptionTree requires your host be running PHP5 to work correctly.
31
 
32
  == Screenshots ==
33
 
34
+ 1. Settings
35
+ 2. Theme Options
36
  3. Documentation
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  = 1.0.0 =
41
+ * Initial version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file