Version Description
- Complete rewrite form the ground up.
- Better Theme Options UI Builder.
- New in-plugin documentation.
- Brand new responsive UI.
- Add new option types, most notable the List Item which should eventually replace the Slider.
- Added the simpler ot_get_option() function to eventually replace get_option_tree().
- Added support for Meta Boxes.
- Added Theme Mode where you can now include the plugin directly in your theme.
- Better validation on saved data.
- Simplified the import process.
- Added support for contextual help.
- Permanently move the Theme Option to the Appearance tab.
- Added a ton of filters.
- Made huge improvements to the code base and tested rigorously.
Download this release
Release Info
Developer | valendesigns |
Plugin | OptionTree |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.8.1 to 2.0
- assets/css/ot-admin.css +350 -0
- assets/css/style-classic.css +0 -61
- assets/css/style.css +0 -1130
- assets/images/black_px.png +0 -0
- assets/images/btn.png +0 -0
- assets/images/colorpicker/color_bg.png +0 -0
- assets/images/empty.gif +0 -0
- assets/images/header.png +0 -0
- assets/images/header_classic.png +0 -0
- assets/images/icon_add.png +0 -0
- assets/images/icon_arrow.png +0 -0
- assets/images/icon_classic.png +0 -0
- assets/images/icon_dark.png +0 -0
- assets/images/icon_delete.png +0 -0
- assets/images/icon_edit.png +0 -0
- assets/images/icon_error.png +0 -0
- assets/images/icon_header.png +0 -0
- assets/images/icon_off.png +0 -0
- assets/images/icon_on.png +0 -0
- assets/images/icon_option.png +0 -0
- assets/images/icon_option_classic.png +0 -0
- assets/images/icon_up.png +0 -0
- assets/images/icon_up_down.png +0 -0
- assets/images/layout/dual-sidebar.png +0 -0
- assets/images/layout/full-width.png +0 -0
- assets/images/layout/left-dual-sidebar.png +0 -0
- assets/images/layout/left-sidebar.png +0 -0
- assets/images/layout/right-dual-sidebar.png +0 -0
- assets/images/layout/right-sidebar.png +0 -0
- assets/images/logo_classic.png +0 -0
- assets/images/logo_dark.png +0 -0
- assets/images/ot-dots.png +0 -0
- assets/images/ot-logo-mini.png +0 -0
- assets/images/ot-logo.png +0 -0
- assets/images/ot-menu-bg.png +0 -0
- assets/images/ot-menu-top-bg.png +0 -0
- assets/images/{pre_bg.gif → ot-pre-bg.gif} +0 -0
- assets/images/ot-select-hover.png +0 -0
- assets/images/ot-select.png +0 -0
- assets/images/ot-sub-header-bg.png +0 -0
- assets/images/ot-ui-light-sprite.png +0 -0
- assets/images/ot-ui-sprite.png +0 -0
- assets/images/pre_classic_bg.gif +0 -0
- assets/images/select.png +0 -0
- assets/images/tabs_bg.png +0 -0
- assets/images/tabs_bg_classic.png +0 -0
- assets/images/toggle_tabs.png +0 -0
- assets/images/white_px.png +0 -0
- assets/js/jquery.option.tree.js +0 -1140
- assets/js/jquery.table.dnd.js +0 -382
- assets/js/ot-admin.js +459 -0
- assets/js/{jquery.color.picker.js → ot-colorpicker.js} +1 -3
- assets/theme-mode/demo-meta-boxes.php +63 -0
- assets/theme-mode/demo-theme-options.php +473 -0
- classes/class.admin.php +0 -1714
- front-end/docs.php +0 -627
- front-end/options.php +0 -124
- front-end/settings.php +0 -364
- functions/admin/background.php +0 -96
- functions/admin/category.php +0 -108
- functions/admin/checkbox.php +0 -48
- functions/admin/colorpicker.php +0 -54
- functions/admin/css.php +0 -31
- functions/admin/custom-post.php +0 -108
- functions/admin/export.php +0 -70
- functions/admin/heading.php +0 -20
- functions/admin/input.php +0 -29
- functions/admin/measurement.php +0 -42
- functions/admin/page.php +0 -108
- functions/admin/post.php +0 -108
- functions/admin/radio.php +0 -48
- functions/admin/select.php +0 -45
- functions/admin/slider.php +0 -150
- functions/admin/tag.php +0 -108
- functions/admin/textarea.php +0 -32
- functions/admin/textblock.php +0 -26
- functions/admin/typography.php +0 -102
- functions/admin/upload.php +0 -47
- functions/functions.load.php +0 -35
- functions/functions.php +0 -384
- functions/get-option-tree.php +0 -79
- includes/ot-functions-admin.php +2782 -0
- includes/ot-functions-compat.php +191 -0
- includes/ot-functions-deprecated.php +99 -0
- includes/ot-functions-docs-page.php +950 -0
- includes/ot-functions-option-types.php +1712 -0
- includes/ot-functions-settings-page.php +529 -0
- includes/ot-functions.php +98 -0
- includes/ot-meta-box-api.php +281 -0
- includes/ot-settings-api.php +849 -0
- includes/ot-ui-admin.php +219 -0
- includes/ot-ui-theme-options.php +56 -0
- index.php +0 -83
- license.txt +0 -281
- ot-loader.php +334 -0
- readme.txt +29 -17
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
assets/css/ot-admin.css
ADDED
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* --------------------------------------------------
|
2 |
+
:: Screen Meta & Menu Icon
|
3 |
+
---------------------------------------------------*/
|
4 |
+
.appearance_page_ot-theme-options #screen-meta { margin-right: 20px; margin-left: 2px; min-width: 533px; }
|
5 |
+
|
6 |
+
/* --------------------------------------------------
|
7 |
+
:: Messages
|
8 |
+
---------------------------------------------------*/
|
9 |
+
.wrap.settings-wrap div.error,
|
10 |
+
.wrap.settings-wrap div.updated { margin: 9px 5px 0px 2px !important; }
|
11 |
+
|
12 |
+
/* --------------------------------------------------
|
13 |
+
:: OptionTree Wrappers
|
14 |
+
---------------------------------------------------*/
|
15 |
+
/* .settings-wrap { max-width: 1020px; } */
|
16 |
+
#option-tree-settings-api .metabox-holder { overflow: hidden; }
|
17 |
+
#option-tree-settings-api .postbox { background: #fff; border: none; margin: 0 20px; }
|
18 |
+
#option-tree-settings-api .inside { margin: 0px !important; padding: 0px !important; }
|
19 |
+
#option-tree-settings-api .ui-tabs { background: #fff url(../images/ot-menu-bg.png) repeat-y 0 0; border: 1px solid #ccc; border-top: none; margin: 0px 5px 0 2px; min-width: 533px; padding-bottom: 5px; position: relative; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); -webkit-border-bottom-right-radius: 3px; -webkit-border-bottom-left-radius: 3px; -moz-border-radius-bottomright: 3px; -moz-border-radius-bottomleft: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; }
|
20 |
+
|
21 |
+
/* --------------------------------------------------
|
22 |
+
:: Header
|
23 |
+
---------------------------------------------------*/
|
24 |
+
#option-tree-header-wrap { position: relative; }
|
25 |
+
#option-tree-header { background: #464646; color: #ccc; display: block; margin: 11px 5px 0 2px; min-width: 535px; overflow: hidden; position: relative; background-image:-webkit-linear-gradient(bottom, #373737, #464646 5px); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; }
|
26 |
+
#option-tree-header li { display: block; float: left; margin: 0px; padding: 0px; }
|
27 |
+
#option-tree-header li a { color: #ccc; text-decoration: none; }
|
28 |
+
#option-tree-header li a:hover { color: #fafafa; }
|
29 |
+
#option-tree-header #option-tree-logo a { background: transparent url(../images/ot-logo.png) no-repeat 13px center; border-right: 1px solid #333; display: block; float: left; height: 24px; line-height: 24px; padding: 3px 12px 3px 13px; text-indent: -9999px; width: 24px; }
|
30 |
+
#option-tree-header li#option-tree-logo:hover { color: #fafafa; background-color: #3a3a3a; background-image: -ms-linear-gradient(bottom,#3a3a3a,#222); background-image: -moz-linear-gradient(bottom,#3a3a3a,#222); background-image: -o-linear-gradient(bottom,#3a3a3a,#222); background-image: -webkit-gradient(linear,left bottom,left top,from(#3a3a3a),to(#222)); background-image: -webkit-linear-gradient(bottom,#3a3a3a,#222); background-image: linear-gradient(bottom,#3a3a3a,#222);-webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; }
|
31 |
+
|
32 |
+
#option-tree-header #option-tree-version { }
|
33 |
+
#option-tree-header #option-tree-version span { border-left: 1px solid #555; display: block; float: left; height: 24px; line-height: 24px; padding: 3px 12px 3px 12px; }
|
34 |
+
|
35 |
+
/* --------------------------------------------------
|
36 |
+
:: Sub Header
|
37 |
+
---------------------------------------------------*/
|
38 |
+
#option-tree-sub-header { background: #fafafa url(../images/ot-sub-header-bg.png) repeat-x 0 0; border: 1px solid #ccc; border-top: none; display: block; margin: 0 5px 0 2px; min-width: 523px; overflow: hidden; padding: 5px; position: relative; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); }
|
39 |
+
|
40 |
+
/* --------------------------------------------------
|
41 |
+
:: Tabs
|
42 |
+
---------------------------------------------------*/
|
43 |
+
.wrap.settings-wrap .ui-tabs-nav { background: url(../images/ot-menu-top-bg.png) no-repeat right top; float: left; list-style: none; margin: 0 0 0 -4px; padding: 1em 0; width: 151px; }
|
44 |
+
.wrap.settings-wrap .ui-tabs-nav li { border: 1px solid transparent; border-right-width: 0px; display: block; margin: 0; }
|
45 |
+
.wrap.settings-wrap .ui-tabs-nav li.ui-state-active { background: #fff; border-color: #ccc; color: #000; }
|
46 |
+
.wrap.settings-wrap .ui-tabs-nav li a { color: #21759b; display: block; line-height: 18px; padding: 5px 5px 5px 12px; text-decoration: none; }
|
47 |
+
.wrap.settings-wrap .ui-tabs-nav li a:hover,
|
48 |
+
.wrap.settings-wrap .ui-tabs-nav li.ui-state-active a { color: #000; }
|
49 |
+
.wrap.settings-wrap .ui-tabs-panel { clear: both; }
|
50 |
+
|
51 |
+
/* --------------------------------------------------
|
52 |
+
:: Format Settings
|
53 |
+
---------------------------------------------------*/
|
54 |
+
.format-settings { padding: 10px 0 20px 0; position: relative; width: 100%; }
|
55 |
+
|
56 |
+
/* --------------------------------------------------
|
57 |
+
:: Format Setting Label
|
58 |
+
---------------------------------------------------*/
|
59 |
+
.format-setting-label { border-bottom: 1px dashed #ddd; margin: 0 0 14px 0; padding: 5px 0px 1px 0px; width: 100%; }
|
60 |
+
|
61 |
+
#option-tree-settings-api .description h3,
|
62 |
+
#option-tree-settings-api .format-setting-label .label,
|
63 |
+
.metabox-holder .format-setting-label .label { background: none; border: none; color: #333; cursor: text; display: block; font-family: sans-serif !important; font-size: 1.2em !important; font-weight: bold !important; letter-spacing: 0; padding: 0 0 9px 0 !important; -webkit-user-select: text; text-shadow: none; }
|
64 |
+
|
65 |
+
/* --------------------------------------------------
|
66 |
+
:: Format Setting
|
67 |
+
---------------------------------------------------*/
|
68 |
+
.format-setting { overflow: hidden; position: relative; width: 100%; }
|
69 |
+
.format-setting .format-setting-inner { float: left; position: relative; width: 63%; }
|
70 |
+
|
71 |
+
.format-setting.no-desc .format-setting-inner,
|
72 |
+
.format-setting.wide-desc .format-setting-inner,
|
73 |
+
.option-tree-list-item .format-setting-inner { width: 100%; }
|
74 |
+
.format-setting .description { float: right; padding: 5px 0; width: 35%; }
|
75 |
+
|
76 |
+
.format-setting.no-desc .description,
|
77 |
+
.format-setting.wide-desc .description,
|
78 |
+
.option-tree-list-item .description { float: none; width: 100%; }
|
79 |
+
|
80 |
+
.list-item-description { padding-top: 10px; }
|
81 |
+
#option-tree-settings-api h4 { color: #333; font-size: 1.12em; font-weight: bold; margin: 1em 0 0.5em 0; padding: 0; }
|
82 |
+
#option-tree-settings-api h5 { color: #444; font-size: 1em; font-weight: bold; margin: 1em 0 0.5em 0; padding: 0; }
|
83 |
+
#option-tree-settings-api p { margin: 0 0 1.5em 0 !important; }
|
84 |
+
#post .format-setting-inner p { float: left; width: 100%; margin: 0 0 1.05em 0 !important; }
|
85 |
+
.aside { border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 15px; }
|
86 |
+
.deprecated { border-bottom: 1px solid #eee; color: #b94029; padding-bottom: 15px; margin-bottom: 15px; }
|
87 |
+
.warning { color: #b94029; }
|
88 |
+
.docs-ul { line-height: 1.3em; margin: 0; padding: 0 0 1em 0; }
|
89 |
+
.docs-ul li { list-style-type: square; margin-left: 20px; }
|
90 |
+
#contextual-help-setting { float: left; padding: 10px 0 5px 0; width: 100%; }
|
91 |
+
#contextual-help-label { float: left; padding-top: 20px; width: 100%; }
|
92 |
+
#option_tree_settings_help { float: left; width: 100%; }
|
93 |
+
|
94 |
+
@media only screen and (max-width: 900px) {
|
95 |
+
.format-setting .description,
|
96 |
+
.format-setting .format-setting-inner { width: 100%; }
|
97 |
+
.format-setting .description { padding-top: 0px; }
|
98 |
+
}
|
99 |
+
|
100 |
+
/* --------------------------------------------------
|
101 |
+
:: Code formatting
|
102 |
+
---------------------------------------------------*/
|
103 |
+
#option-tree-settings-api code { background-color: #f1f1f1; color: #000; }
|
104 |
+
#option-tree-settings-api pre { font-size: 13px; padding: 0; margin: 1.5em 0; line-height: 18px; overflow: auto; overflow-Y: hidden; padding-top: 18px; background: #f1f1f1; border-bottom: 1px solid #f1f1f1; margin-bottom: 20px; color: #000; white-space:pre-wrap; word-wrap:break-word; }
|
105 |
+
#option-tree-settings-api pre code { padding: 0 18px 18px 18px; display: block; background: url(../images/ot-pre-bg.gif) repeat left top; }
|
106 |
+
|
107 |
+
/* --------------------------------------------------
|
108 |
+
:: Input & Upload
|
109 |
+
---------------------------------------------------*/
|
110 |
+
input.option-tree-ui-upload-input,
|
111 |
+
input.option-tree-ui-input { background: #fff; border: 1px solid #ccc !important; line-height: 17px; font-size: 12px; margin-bottom: 5px; padding: 7px 6px; position: relative; width: 100%; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); }
|
112 |
+
|
113 |
+
input:focus.option-tree-ui-upload-input,
|
114 |
+
input:focus.option-tree-ui-input { border-color: #bbb !important; }
|
115 |
+
|
116 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
117 |
+
.option-tree-ui-input,
|
118 |
+
.option-tree-ui-upload-input { padding: 5px 6px !important; }
|
119 |
+
}
|
120 |
+
|
121 |
+
/* --------------------------------------------------
|
122 |
+
:: Upload
|
123 |
+
---------------------------------------------------*/
|
124 |
+
div.option-tree-ui-media-wrap { margin: 5px 63px 0 0; min-height: 35px; position: relative; }
|
125 |
+
.option-tree-ui-media-wrap img { background: #fafafa; border: 1px solid #ccc; padding: 4px; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; display: block; float: left; max-width: 100%; height: auto; -ms-interpolation-mode: bicubic; }
|
126 |
+
.option-tree-ui-upload-parent { width: auto !important; margin-right: 53px; padding: 0px; position: relative; }
|
127 |
+
.format-setting .ot_upload_media { top: 0px; margin: 0px !important; position: absolute; right: -53px; }
|
128 |
+
.option-tree-ui-media-wrap a.option-tree-ui-remove-media { float: none !important; margin: 0px !important; position: absolute !important; right: -63px; top: 1px; }
|
129 |
+
|
130 |
+
/* --------------------------------------------------
|
131 |
+
:: Textarea
|
132 |
+
---------------------------------------------------*/
|
133 |
+
.fill-area .description,
|
134 |
+
.fill-area .format-setting-inner { width: 100% !important; }
|
135 |
+
|
136 |
+
.wp-editor-area { display: block;}
|
137 |
+
.textarea,
|
138 |
+
.ot-metabox-wrapper textarea { width: 99.9%; border: 1px solid #ccc; font-family: Consolas, Monaco, monospace; line-height: 150%; outline: 0; padding: 10px; resize: vertical; }
|
139 |
+
.ot-metabox-wrapper .wp-editor-container { border: none; }
|
140 |
+
.ot-metabox-wrapper textarea:focus { border-color: #bbb !important; }
|
141 |
+
|
142 |
+
@media only screen and (max-width: 1105px) { .type-textarea .description, .type-textarea .format-setting-inner { width: 100%; } }
|
143 |
+
|
144 |
+
/* --------------------------------------------------
|
145 |
+
:: Setting Item with Drag & Drop
|
146 |
+
---------------------------------------------------*/
|
147 |
+
.option-tree-setting-wrap { margin-top: 0px; }
|
148 |
+
.option-tree-setting-wrap li { margin: 4px 0px; }
|
149 |
+
.option-tree-setting { border: 1px solid #ccc; cursor: move; overflow: hidden; position: relative; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; }
|
150 |
+
.ui-state-disabled .option-tree-setting { cursor: default; }
|
151 |
+
.option-tree-setting a { text-decoration: none; }
|
152 |
+
.option-tree-setting .open { background: #fafafa; line-height: 21px; height: 21px; padding: 10px 100px 10px 10px; display: block; }
|
153 |
+
.option-tree-setting .open:hover { background: #fafafa url(../images/ot-dots.png) no-repeat 4px 15px; }
|
154 |
+
|
155 |
+
.button-section { position: absolute; right: 0px; top: 1px; }
|
156 |
+
|
157 |
+
.option-tree-setting.is-section .open { background: #e9f2fb; }
|
158 |
+
.option-tree-setting.is-section .open:hover { background: #e9f2fb url(../images/ot-dots.png) no-repeat 4px 15px; }
|
159 |
+
|
160 |
+
.format-setting .ui-sortable-helper
|
161 |
+
.option-tree-setting .open { background: #fff url(../images/ot-dots.png) no-repeat 4px 15px; }
|
162 |
+
|
163 |
+
.ui-state-highlight { border: 1px dashed #ccc; line-height: 21px; height: 21px; padding: 10px 0px; display: block; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
|
164 |
+
|
165 |
+
.option-tree-setting-body { background: #fff; border-top: 1px solid #ccc; display: none; padding: 10px; -webkit-border-bottom-right-radius: 3px; -webkit-border-bottom-left-radius: 3px; -moz-border-radius-bottomright: 3px; -moz-border-radius-bottomleft: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; }
|
166 |
+
|
167 |
+
li ul .format-settings { padding: 0 0 10px 0; }
|
168 |
+
li ul .format-setting-label { border: none; padding: 0px; margin: 0px; }
|
169 |
+
|
170 |
+
/* --------------------------------------------------
|
171 |
+
:: Layouts
|
172 |
+
---------------------------------------------------*/
|
173 |
+
#option_tree_layouts { display: none; padding-top: 12px; }
|
174 |
+
#option-tree-options-layouts-form { left: 13px; position: absolute; top: 40px; z-index: 100; }
|
175 |
+
.option-tree-save-layout { width: 250px; overflow: hidden; }
|
176 |
+
.option-tree-save-layout .widefat { float: left; width: 128px !important; }
|
177 |
+
.option-tree-save-layout button { margin: 0 0 0 10px; }
|
178 |
+
.option-tree-active-layout { }
|
179 |
+
|
180 |
+
/* --------------------------------------------------
|
181 |
+
:: Select
|
182 |
+
---------------------------------------------------*/
|
183 |
+
.select-group { margin-right: 53px; overflow: hidden; width: auto; }
|
184 |
+
.select-wrapper { background: #fff url(../images/ot-select.png) no-repeat right center; border: 1px solid #ccc; display: block; float: left; font-size: 12px; height: 27px; margin: 0 5px 5px 0; width: auto; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05); }
|
185 |
+
.select-wrapper:hover { background-image: url(../images/ot-select-hover.png); border-color: #bbb; }
|
186 |
+
select.option-tree-ui-select { cursor: pointer; filter: alpha(opacity: 0); font-size: 14px; height: 29px; margin: 0; -moz-opacity: 0; opacity: 0; padding: 0 !important; position: relative; width: inherit; z-index: 4; min-width: 118px; }
|
187 |
+
select.option-tree-ui-select option { padding: 3px 15px !important; }
|
188 |
+
.select-wrapper span { height: 27px; line-height: 27px; padding-left: 7px; position: absolute; z-index: 2; }
|
189 |
+
|
190 |
+
#option-tree-options-layouts-form .select-wrapper { left: 244px; position: absolute; top: 0; float: none; }
|
191 |
+
|
192 |
+
.type-measurement select.option-tree-ui-select { min-width: 68px !important; }
|
193 |
+
.type-measurement .select-wrapper { position: absolute; right: 0px; top: 0px; }
|
194 |
+
|
195 |
+
/* FireFox */
|
196 |
+
@-moz-document url-prefix() {
|
197 |
+
#option-tree-options-layouts-form .select-wrapper { left: 250px; }
|
198 |
+
}
|
199 |
+
|
200 |
+
/* Webkit */
|
201 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
202 |
+
.select-wrapper span {
|
203 |
+
height: 26px;
|
204 |
+
line-height: 26px;
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
/* Opera 11 */
|
209 |
+
@media not screen and (1) {
|
210 |
+
.select-wrapper {
|
211 |
+
height: 26px;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/* --------------------------------------------------
|
216 |
+
:: Measurement
|
217 |
+
---------------------------------------------------*/
|
218 |
+
.option-tree-ui-measurement-input-wrap { margin-right: 80px; }
|
219 |
+
|
220 |
+
/* --------------------------------------------------
|
221 |
+
:: Checkbox & Radio
|
222 |
+
---------------------------------------------------*/
|
223 |
+
.format-setting.type-checkbox input,
|
224 |
+
.format-setting.type-radio input { float: left; margin: 2px 5px 0 1px; }
|
225 |
+
.format-setting.type-checkbox label,
|
226 |
+
.format-setting.type-radio label { float: left; max-width: 90%; padding: 0px; }
|
227 |
+
#option-tree-settings-api .format-setting.type-checkbox p,
|
228 |
+
#option-tree-settings-api .format-setting.type-radio p { float: left; margin: 0.5em 0 !important; width: 100%; }
|
229 |
+
|
230 |
+
/* --------------------------------------------------
|
231 |
+
:: Radio Images
|
232 |
+
---------------------------------------------------*/
|
233 |
+
.type-radio-image .option-tree-ui-radio-images { float: left; margin: 0 10px 10px 0px; }
|
234 |
+
.type-radio-image .option-tree-ui-radio-images img { background: #fff; border: 1px solid #ccc; cursor: pointer; padding: 5px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; }
|
235 |
+
.type-radio-image .option-tree-ui-radio-images img.option-tree-ui-radio-image-selected,
|
236 |
+
.type-radio-image .option-tree-ui-radio-images img:hover { border-color: #464646; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); }
|
237 |
+
|
238 |
+
/* --------------------------------------------------
|
239 |
+
:: Colorpicker
|
240 |
+
---------------------------------------------------*/
|
241 |
+
.option-tree-ui-colorpicker-input-wrap{ margin-right: 53px; position: relative; width: auto; }
|
242 |
+
.format-settings .cp_box { background: #f1f1f1; border: 1px solid #ccc; bottom: 5px; height: 27px; position: absolute; right: -53px; width: 46px; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; }
|
243 |
+
.colorpicker { width: 342px; height: 170px; overflow: hidden; position: absolute; background: #fafafa url(../images/colorpicker/color_bg.png); font-family: Arial, Helvetica, sans-serif; display: none; border: 1px solid #bbb; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); z-index: 100; }
|
244 |
+
.colorpicker_color { width: 150px; height: 150px; left: 10px; top: 10px; position: absolute; background: #f00; overflow: hidden; cursor: crosshair; }
|
245 |
+
.colorpicker_color div { position: absolute; top: 0; left: 0; width: 150px; height: 150px; background: url(../images/colorpicker/color_overlay.png); }
|
246 |
+
.colorpicker_color div div { position: absolute; top: 0; left: 0; width: 11px; height: 11px; overflow: hidden; background: url(../images/colorpicker/color_select.gif); margin: -5px 0 0 -5px; }
|
247 |
+
.colorpicker_hue { position: absolute; top: 10px; left: 164px; width: 35px; height: 150px; cursor: n-resize; }
|
248 |
+
.colorpicker_hue div { position: absolute; width: 35px; height: 9px; overflow: hidden; background: url(../images/colorpicker/color_indicator.png) left top; margin: -5px 0 0 0; }
|
249 |
+
.colorpicker_new_color { position: absolute; width: 60px; height: 30px; right: 80px; top: 10px; background: #f00; }
|
250 |
+
.colorpicker_current_color { position: absolute; width: 60px; height: 30px; right: 10px; top: 10px; background: #f00; }
|
251 |
+
.colorpicker input { background-color: transparent !important; border: 1px solid transparent !important; position: absolute !important; font-size: 10px !important; font-family: Arial, Helvetica, sans-serif !important; color: #666 !important; top: 6px !important; right: 11px !important; text-align: right !important; margin: 0 !important; padding: 0 !important; height: 11px !important;line-height: 11px !important; }
|
252 |
+
.colorpicker_hex { position: absolute; width: 72px; height: 22px; background: url(../images/colorpicker/color_hex.png) top; left: 201px; bottom: 9px; }
|
253 |
+
.colorpicker_hex input { right: 6px; }
|
254 |
+
.colorpicker_field { height: 22px; width: 62px; background-position: top; position: absolute; }
|
255 |
+
.colorpicker_field span { position: absolute; width: 12px; height: 22px; overflow: hidden; top: 0; right: 0; cursor: n-resize; }
|
256 |
+
.colorpicker_rgb_r { background-image: url(../images/colorpicker/color_rgb_r.png); top: 49px; left: 201px; }
|
257 |
+
.colorpicker_rgb_g { background-image: url(../images/colorpicker/color_rgb_g.png); top: 79px; left: 201px; }
|
258 |
+
.colorpicker_rgb_b { background-image: url(../images/colorpicker/color_rgb_b.png); top: 109px; left: 201px; }
|
259 |
+
.colorpicker_hsb_h { background-image: url(../images/colorpicker/color_hsb_h.png); top: 49px; right: 9px; }
|
260 |
+
.colorpicker_hsb_s { background-image: url(../images/colorpicker/color_hsb_s.png); top: 79px; right: 9px }
|
261 |
+
.colorpicker_hsb_b { background-image: url(../images/colorpicker/color_hsb_b.png); top: 109px; right: 9px; }
|
262 |
+
.colorpicker_submit { position: absolute; width: 16px; height: 16px; background: url(../images/colorpicker/color_wheel.png) top; right: 10px; bottom: 10px; overflow: hidden; }
|
263 |
+
.colorpicker_focus { background-position: center; }
|
264 |
+
.colorpicker_hex.colorpicker_focus { background-position: bottom; }
|
265 |
+
.colorpicker_submit.colorpicker_focus { background-position: bottom; }
|
266 |
+
.colorpicker_slider { background-position: bottom; }
|
267 |
+
|
268 |
+
@media not screen and (1) {
|
269 |
+
.format-settings .cp_box { height: 26px; }
|
270 |
+
}
|
271 |
+
|
272 |
+
/* --------------------------------------------------
|
273 |
+
:: OptionTree UI Buttons
|
274 |
+
---------------------------------------------------*/
|
275 |
+
.option-tree-ui-buttons { background: #fff; border: 1px solid #ccc; margin: 11px 5px 0 2px; min-width: 523px; overflow: hidden; padding: 5px; position: relative; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05); box-shadow:0 1px 3px rgba(0,0,0,0.05); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
|
276 |
+
.option-tree-ui-buttons.alt { background: #f5f5f5; border-color: #dfdfdf;}
|
277 |
+
.option-tree-ui-buttons:before,
|
278 |
+
.option-tree-ui-buttons:after { content: "\0020"; display: block; height: 0; visibility: hidden; }
|
279 |
+
.option-tree-ui-buttons:after { clear: both; }
|
280 |
+
.option-tree-ui-buttons { zoom: 1; }
|
281 |
+
.option-tree-ui-button { background: #f5f5f5; border: 1px solid #ccc; color: #444; cursor: pointer; display: inline-block; float: left; font-size: 11px; font-weight: bold; height: 27px; line-height: 27px; margin: 5px; padding: 0px 14px; position: relative; text-align: center; text-decoration: none; text-shadow: 0 1px 0 rgba(255,255,255,0.7); background: -moz-linear-gradient(top, #f5f5f5 0%, #f1f1f1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#f1f1f1)); background: -webkit-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: -o-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: -ms-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#f1f1f1',GradientType=0 ); -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; -webkit-transition: border-color .20s; -moz-transition: border-color .20s; -o-transition: border-color .20s; transition: border-color .20s; -webkit-user-select: none; z-index: 1; }
|
282 |
+
button.option-tree-ui-button { height: 29px; line-height: 11px; padding: 7px 14px 9px 14px; }
|
283 |
+
.option-tree-ui-button.right { float: right; }
|
284 |
+
.option-tree-ui-button.hug-left { margin-left: 0px; }
|
285 |
+
.option-tree-ui-button.hug-right { margin-right: 0px; }
|
286 |
+
.option-tree-ui-button.pad { padding: 0px 21px; }
|
287 |
+
.option-tree-ui-button.left-item { margin: 5px 0 5px 5px; -webkit-border-top-right-radius: 0px; -webkit-border-bottom-right-radius: 0px; -moz-border-radius-topright: 0px; -moz-border-radius-bottomright: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; }
|
288 |
+
.option-tree-ui-button.center-item { margin: 5px 0 5px -1px; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px; }
|
289 |
+
.option-tree-ui-button.right-item { margin: 5px 5px 5px -1px; -webkit-border-top-left-radius: 0px; -webkit-border-bottom-left-radius: 0px; -moz-border-radius-topleft: 0px; -moz-border-radius-bottomleft: 0px; border-top-left-radius: 0px; border-bottom-left-radius: 0px; }
|
290 |
+
.option-tree-ui-button:hover,
|
291 |
+
.option-tree-ui-button:focus { background: #f8f8f8; border-color: #c6c6c6; color: #333; background: -moz-linear-gradient(top, #f8f8f8 0%, #f1f1f1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#f1f1f1)); background: -webkit-linear-gradient(top, #f8f8f8 0%,#f1f1f1 100%); background: -o-linear-gradient(top, #f8f8f8 0%,#f1f1f1 100%); background: -ms-linear-gradient(top, #f8f8f8 0%,#f1f1f1 100%); background: linear-gradient(top, #f8f8f8 0%,#f1f1f1 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#f1f1f1',GradientType=0 ); box-shadow: 0px 1px 1px rgba(0,0,0, 0.1); -moz-box-shadow: 0px 1px 1px rgba(0,0,0, 0.1); -webkit-box-shadow: 0px 1px 1px rgba(0,0,0, 0.1); z-index: 2; }
|
292 |
+
.option-tree-ui-button:active { box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); -moz-box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); -webkit-box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); z-index: 3; }
|
293 |
+
.option-tree-ui-button.active,
|
294 |
+
.option-tree-ui-button.active:hover,
|
295 |
+
.option-tree-ui-button.active:active { background: #eee; border-color: #c6c6c6; cursor: default; background: -moz-linear-gradient(top, #eee 0%, #e5e5e5 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eee), color-stop(100%,#e5e5e5)); background: -webkit-linear-gradient(top, #eee 0%,#e5e5e5 100%); background: -o-linear-gradient(top, #eee 0%,#e5e5e5 100%); background: -ms-linear-gradient(top, #eee 0%,#e5e5e5 100%); background: linear-gradient(top, #eee 0%,#e5e5e5 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eee', endColorstr='#e5e5e5',GradientType=0 ); box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); -moz-box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); -webkit-box-shadow: inset 0px 0px 5px rgba(0,0,0, 0.1); z-index: 3; }
|
296 |
+
.option-tree-ui-button.disabled,
|
297 |
+
.option-tree-ui-button.disabled:hover,
|
298 |
+
.option-tree-ui-button.disabled:active{ background: #f5f5f5; border: 1px solid #dadada; color: #bbb; cursor: default; background: -moz-linear-gradient(top, #f5f5f5 0%, #f1f1f1 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#f1f1f1)); background: -webkit-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: -o-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: -ms-linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); background: linear-gradient(top, #f5f5f5 0%,#f1f1f1 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#f1f1f1',GradientType=0 ); box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; }
|
299 |
+
.option-tree-ui-button:focus { outline: none; }
|
300 |
+
button.reset-settings { position: relative; top: -45px; left: 8px; }
|
301 |
+
|
302 |
+
|
303 |
+
@media not screen and (1) {
|
304 |
+
.option-tree-ui-button { height: 26px; }
|
305 |
+
button.option-tree-ui-button { height: 28px !important; }
|
306 |
+
}
|
307 |
+
/* --------------------------------------------------
|
308 |
+
:: OptionTree UI Button Colors
|
309 |
+
---------------------------------------------------*/
|
310 |
+
|
311 |
+
/* Blue */
|
312 |
+
.option-tree-ui-button.blue { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.3); border-color: #0080f0; background: #2c95ff; background: -moz-linear-gradient(top, #2c95ff 0%, #288cef 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2c95ff), color-stop(100%,#288cef)); background: -webkit-linear-gradient(top, #2c95ff 0%,#288cef 100%); background: -o-linear-gradient(top, #2c95ff 0%,#288cef 100%); background: -ms-linear-gradient(top, #2c95ff 0%,#288cef 100%); background: linear-gradient(top, #2c95ff 0%,#288cef 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2c95ff', endColorstr='#288cef',GradientType=0 ); }
|
313 |
+
.option-tree-ui-button.blue:hover { border-color: #1260b9; background: #2d95ff; background: -moz-linear-gradient(top, #2d95ff 0%, #0081eb 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2d95ff), color-stop(100%,#0081eb)); background: -webkit-linear-gradient(top, #2d95ff 0%,#0081eb 100%); background: -o-linear-gradient(top, #2d95ff 0%,#0081eb 100%); background: -ms-linear-gradient(top, #2d95ff 0%,#0081eb 100%); background: linear-gradient(top, #2d95ff 0%,#0081eb 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2d95ff', endColorstr='#0081eb',GradientType=0 ); }
|
314 |
+
.option-tree-ui-button.blue:active { border-color: #0083dd; }
|
315 |
+
|
316 |
+
/* Red */
|
317 |
+
.option-tree-ui-button.red { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.3); border-color: #d94d30; background: #e55033; background: -moz-linear-gradient(top, #e55033 0%, #d94d30 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e55033), color-stop(100%,#d94d30)); background: -webkit-linear-gradient(top, #e55033 0%,#d94d30 100%); background: -o-linear-gradient(top, #e55033 0%,#d94d30 100%); background: -ms-linear-gradient(top, #e55033 0%,#d94d30 100%); background: linear-gradient(top, #e55033 0%,#d94d30 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e55033', endColorstr='#d94d30',GradientType=0 ); }
|
318 |
+
.option-tree-ui-button.red:hover { border-color: #b72f11; background: #e65033; background: -moz-linear-gradient(top, #e65033 0%, #cc3d1f 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e65033), color-stop(100%,#cc3d1f)); background: -webkit-linear-gradient(top, #e65033 0%,#cc3d1f 100%); background: -o-linear-gradient(top, #e65033 0%,#cc3d1f 100%); background: -ms-linear-gradient(top, #e65033 0%,#cc3d1f 100%); background: linear-gradient(top, #e65033 0%,#cc3d1f 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e65033', endColorstr='#cc3d1f',GradientType=0 ); }
|
319 |
+
.option-tree-ui-button.red:active { border-color: #ce4925; }
|
320 |
+
|
321 |
+
/* Green */
|
322 |
+
.option-tree-ui-button.green { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.3); border-color: #29691d; background: #3c9300; background: -moz-linear-gradient(top, #3c9300 0%, #398a00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3c9300), color-stop(100%,#398a00)); background: -webkit-linear-gradient(top, #3c9300 0%,#398a00 100%); background: -o-linear-gradient(top, #3c9300 0%,#398a00 100%); background: -ms-linear-gradient(top, #3c9300 0%,#398a00 100%); background: linear-gradient(top, #3c9300 0%,#398a00 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3c9300', endColorstr='#398a00',GradientType=0 ); }
|
323 |
+
.option-tree-ui-button.green:hover { border-color: #275400; background: #3c9300; background: -moz-linear-gradient(top, #3c9300 0%, #347d00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3c9300), color-stop(100%,#347d00)); background: -webkit-linear-gradient(top, #3c9300 0%,#347d00 100%); background: -o-linear-gradient(top, #3c9300 0%,#347d00 100%); background: -ms-linear-gradient(top, #3c9300 0%,#347d00 100%); background: linear-gradient(top, #3c9300 0%,#347d00 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3c9300', endColorstr='#347d00',GradientType=0 ); }
|
324 |
+
.option-tree-ui-button.green:active { border-color: #2b7800; }
|
325 |
+
|
326 |
+
/* Grey */
|
327 |
+
.option-tree-ui-button.grey { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,1); border-color: #333; background: #555; background: -moz-linear-gradient(top, #555 0%, #444 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#555), color-stop(100%,#444)); background: -webkit-linear-gradient(top, #555 0%,#444 100%); background: -o-linear-gradient(top, #555 0%,#444 100%); background: -ms-linear-gradient(top, #555 0%,#444 100%); background: linear-gradient(top, #555 0%,#444 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#555', endColorstr='#444',GradientType=0 ); }
|
328 |
+
.option-tree-ui-button.grey:hover { border-color: #222; background: #444; background: -moz-linear-gradient(top, #444 0%, #333 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#444), color-stop(100%,#333)); background: -webkit-linear-gradient(top, #444 0%,#333 100%); background: -o-linear-gradient(top, #444 0%,#333 100%); background: -ms-linear-gradient(top, #444 0%,#333 100%); background: linear-gradient(top, #444 0%,#333 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444', endColorstr='#333',GradientType=0 ); }
|
329 |
+
.option-tree-ui-button.grey:active { border-color: #111; }
|
330 |
+
|
331 |
+
/* All Active */
|
332 |
+
.option-tree-ui-button.blue:active,
|
333 |
+
.option-tree-ui-button.red:active,
|
334 |
+
.option-tree-ui-button.green:active,
|
335 |
+
.option-tree-ui-button.grey:active { box-shadow: inset 1px 1px 3px rgba(0,0,0, 0.2); -moz-box-shadow: inset 1px 1px 3px rgba(0,0,0, 0.2); -webkit-box-shadow: inset 1px 1px 3px rgba(0,0,0, 0.2); }
|
336 |
+
|
337 |
+
/* --------------------------------------------------
|
338 |
+
:: OptionTree UI Button Icons
|
339 |
+
---------------------------------------------------*/
|
340 |
+
.option-tree-ui-button .icon { background: url(../images/ot-ui-sprite.png) no-repeat; display: inline-block; float: left; height: 18px; margin-top: 4px; opacity: 0.65; overflow: hidden; text-indent: -9999px; width: 18px; }
|
341 |
+
button.option-tree-ui-button .icon { margin-top: -3px; }
|
342 |
+
.option-tree-ui-button.light .icon { background-image: url(../images/ot-ui-light-sprite.png); opacity: 0.9; }
|
343 |
+
.option-tree-ui-button.active .icon,
|
344 |
+
.option-tree-ui-button:hover .icon { opacity: 1; }
|
345 |
+
.option-tree-ui-button .icon.right-label { margin-right: 10px; }
|
346 |
+
.option-tree-ui-button .icon.left-label { margin-left: 10px; float: right; }
|
347 |
+
.option-tree-ui-button .upload { background-position: -0px -0px; }
|
348 |
+
.option-tree-ui-button .trash-can { background-position: -18px -0px; }
|
349 |
+
.option-tree-ui-button .pencil { background-position: -36px -0px; }
|
350 |
+
.option-tree-ui-button .check { background-position: -54px -0px; }
|
assets/css/style-classic.css
DELETED
@@ -1,61 +0,0 @@
|
|
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 tr.active-layout {
|
40 |
-
background: #F7F6F1;
|
41 |
-
}
|
42 |
-
#framework_wrap code {
|
43 |
-
background-color: #eaf3fa;
|
44 |
-
}
|
45 |
-
#framework_wrap pre {
|
46 |
-
background: #eaf3fa;
|
47 |
-
border-bottom: 1px solid #eaf3fa;
|
48 |
-
}
|
49 |
-
#framework_wrap pre code {
|
50 |
-
background-image: url(../images/pre_classic_bg.gif);
|
51 |
-
}
|
52 |
-
.ui-tabs {
|
53 |
-
background-image: url(../images/tabs_bg_classic.png);
|
54 |
-
}
|
55 |
-
.ui-tabs .ui-tabs-nav li a {
|
56 |
-
border-bottom: 1px solid #dfdfdf;
|
57 |
-
}
|
58 |
-
.ui-tabs .ui-tabs-nav li.ui-state-hover a {
|
59 |
-
background-color: #f1f8fd;
|
60 |
-
color: #555;
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/style.css
DELETED
@@ -1,1130 +0,0 @@
|
|
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 .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 |
-
#framework_wrap #content_wrap .info.is-option-page {
|
101 |
-
height: 71px;
|
102 |
-
}
|
103 |
-
.top-layout-bar {
|
104 |
-
background: #eaf2fa;
|
105 |
-
float: left;
|
106 |
-
width: 100%;
|
107 |
-
border-top: 1px solid #e3e3e3;
|
108 |
-
margin-top: 7px;
|
109 |
-
}
|
110 |
-
#save_theme_layout {
|
111 |
-
margin: 5px 10px 0 0;
|
112 |
-
padding: 5px 3px 4px 3px;
|
113 |
-
width: 140px;
|
114 |
-
float: left;
|
115 |
-
}
|
116 |
-
#active_theme_layout {
|
117 |
-
float: right;
|
118 |
-
}
|
119 |
-
a.toggle_tabs {
|
120 |
-
cursor: pointer;
|
121 |
-
background: url(../images/toggle_tabs.png) no-repeat -2px -1px;
|
122 |
-
display: block;
|
123 |
-
height: 22px;
|
124 |
-
width: 21px;
|
125 |
-
float: left;
|
126 |
-
text-indent: -9999px;
|
127 |
-
margin: 5px 5px 0 19px;
|
128 |
-
border: 1px solid #bbb;
|
129 |
-
-webkit-border-radius: 4px;
|
130 |
-
-moz-border-radius: 4px;
|
131 |
-
border-radius: 4px;
|
132 |
-
}
|
133 |
-
.no-tabs a.toggle_tabs {
|
134 |
-
display: none;
|
135 |
-
}
|
136 |
-
a:hover.toggle_tabs {
|
137 |
-
border-color: #666;
|
138 |
-
}
|
139 |
-
a.off {
|
140 |
-
background-position: -2px -26px;
|
141 |
-
}
|
142 |
-
#framework_wrap #content_wrap .bottom {
|
143 |
-
border-top: 1px solid #fff !important;
|
144 |
-
border-bottom: none !important;
|
145 |
-
|
146 |
-
background: #f1f1f1;
|
147 |
-
}
|
148 |
-
#framework_wrap #content_wrap .info input.button-framework {
|
149 |
-
float: right;
|
150 |
-
margin: 5px 20px 0 0;
|
151 |
-
padding: 4px 10px;
|
152 |
-
font-size: 11px;
|
153 |
-
height: 24px;
|
154 |
-
}
|
155 |
-
#framework_wrap #content_wrap .info input.add-item {
|
156 |
-
float: left;
|
157 |
-
margin-left: 20px;
|
158 |
-
}
|
159 |
-
#framework_wrap #content_wrap .info input.reset {
|
160 |
-
margin-left: 20px;
|
161 |
-
color: #d54e45;
|
162 |
-
float: left;
|
163 |
-
}
|
164 |
-
#framework_wrap #content_wrap .info input.reload-options {
|
165 |
-
color: #d54e45
|
166 |
-
}
|
167 |
-
#framework_wrap #content_wrap a.reset {
|
168 |
-
margin-right: 10px;
|
169 |
-
color: #d54e45;
|
170 |
-
}
|
171 |
-
.ajax-message {
|
172 |
-
position: absolute;
|
173 |
-
left: 275px;
|
174 |
-
top: 200px;
|
175 |
-
width: 250px;
|
176 |
-
z-index: 100;
|
177 |
-
display: none;
|
178 |
-
overflow: visible;
|
179 |
-
}
|
180 |
-
#framework_wrap #content_wrap .message {
|
181 |
-
text-align: center;
|
182 |
-
color: #fff;
|
183 |
-
text-shadow: 0 1px 0 #000;
|
184 |
-
font-size: 14px;
|
185 |
-
line-height: 18px;
|
186 |
-
padding: 40px 10px;
|
187 |
-
background: #444;
|
188 |
-
border: 1px solid #333;
|
189 |
-
-webkit-border-radius: 5px;
|
190 |
-
-moz-border-radius: 5px;
|
191 |
-
border-radius: 5px;
|
192 |
-
-moz-box-shadow: 0px 2px 5px rgba(0,0,0,0.25);
|
193 |
-
-webkit-box-shadow: 0px 2px 5px rgba(0,0,0,0.25);
|
194 |
-
box-shadow: 0px 2px 5px rgba(0,0,0,0.25);
|
195 |
-
}
|
196 |
-
#framework_wrap #content_wrap .message span {
|
197 |
-
display: block;
|
198 |
-
height: 16px;
|
199 |
-
width: 16px;
|
200 |
-
position: absolute;
|
201 |
-
left: -8px;
|
202 |
-
top: -8px;
|
203 |
-
background: url(../images/icon_add.png) no-repeat 0 0;
|
204 |
-
}
|
205 |
-
#framework_wrap #content_wrap .message.warning span {
|
206 |
-
background-image: url(../images/icon_error.png);
|
207 |
-
}
|
208 |
-
/* Primary Form Button */
|
209 |
-
#framework_wrap input.button-framework {
|
210 |
-
cursor: pointer;
|
211 |
-
font-size: 12px;
|
212 |
-
color: #444;
|
213 |
-
text-shadow: 0 1px 0 #fff;
|
214 |
-
background: #f3f3f3 url(../images/btn.png) repeat-x 0 0;
|
215 |
-
border: 1px solid #bbb;
|
216 |
-
padding: 5px 10px;
|
217 |
-
}
|
218 |
-
#framework_wrap input:hover.button-framework {
|
219 |
-
color: #000;
|
220 |
-
border-color: #666;
|
221 |
-
}
|
222 |
-
#framework_wrap a.button-framework {
|
223 |
-
cursor: pointer;
|
224 |
-
font-size: 12px;
|
225 |
-
color: #444;
|
226 |
-
text-shadow: 0 1px 0 #fff;
|
227 |
-
background: #f3f3f3 url(../images/btn.png) repeat-x 0 0;
|
228 |
-
border: 1px solid #bbb;
|
229 |
-
padding: 3px 10px 3px 10px;
|
230 |
-
-webkit-border-radius: 4px;
|
231 |
-
-moz-border-radius: 4px;
|
232 |
-
border-radius: 4px;
|
233 |
-
text-decoration: none;
|
234 |
-
float: left;
|
235 |
-
position: relative;
|
236 |
-
left: 1px;
|
237 |
-
}
|
238 |
-
#framework_wrap div.inline-edit-save a.button-framework {
|
239 |
-
padding: 2px 10px 2px 10px;
|
240 |
-
font-size: 11px;
|
241 |
-
}
|
242 |
-
#framework_wrap a:hover.button-framework {
|
243 |
-
color: #000;
|
244 |
-
border-color: #666;
|
245 |
-
}
|
246 |
-
|
247 |
-
#framework_wrap a.button-framework.light {
|
248 |
-
border: 1px solid #dfdfdf;
|
249 |
-
color: #464646;
|
250 |
-
}
|
251 |
-
#framework_wrap a:hover.button-framework.light {
|
252 |
-
color: #000;
|
253 |
-
border-color: #adaca7;
|
254 |
-
}
|
255 |
-
/* Content Inner */
|
256 |
-
#framework_wrap #content {
|
257 |
-
padding: 0;
|
258 |
-
width: 785px;
|
259 |
-
border-bottom: 1px solid #e3e3e3;
|
260 |
-
position: relative;
|
261 |
-
}
|
262 |
-
.screenshot {
|
263 |
-
float: right;
|
264 |
-
margin-left: 1px;
|
265 |
-
position: relative;
|
266 |
-
width: 344px;
|
267 |
-
}
|
268 |
-
.screenshot img {
|
269 |
-
max-width: 334px;
|
270 |
-
padding: 4px;
|
271 |
-
border: 1px solid #ccc;
|
272 |
-
background: #fafafa;
|
273 |
-
border-color: #ccc #eee #eee #ccc;
|
274 |
-
-webkit-border-radius: 4px;
|
275 |
-
-moz-border-radius: 4px;
|
276 |
-
border-radius: 4px;
|
277 |
-
float: right;
|
278 |
-
}
|
279 |
-
.screenshot a {
|
280 |
-
text-decoration: none;
|
281 |
-
padding-left: 20px;
|
282 |
-
}
|
283 |
-
.screenshot a.remove {
|
284 |
-
background: url(../images/icon_delete.png) no-repeat 0 0;
|
285 |
-
display: block;
|
286 |
-
height: 16px;
|
287 |
-
width: 16px;
|
288 |
-
position: absolute;
|
289 |
-
bottom: -4px;
|
290 |
-
right: -4px;
|
291 |
-
text-indent: -9999px;
|
292 |
-
float: left;
|
293 |
-
padding: 0;
|
294 |
-
border: none;
|
295 |
-
}
|
296 |
-
.screenshot .no_image a.remove {
|
297 |
-
left: 0;
|
298 |
-
top: 2px;
|
299 |
-
}
|
300 |
-
.option-upload .element {
|
301 |
-
padding-bottom: 5px;
|
302 |
-
}
|
303 |
-
#framework_wrap #content h2 {
|
304 |
-
margin-bottom: 10px;
|
305 |
-
border-bottom: 1px solid #e5e5e5;
|
306 |
-
}
|
307 |
-
#framework_wrap #content h3 {
|
308 |
-
border-bottom: 1px solid #eee;
|
309 |
-
margin: 0 0 15px 0;
|
310 |
-
padding-bottom: 10px;
|
311 |
-
clear: both;
|
312 |
-
font-size: 14px;
|
313 |
-
}
|
314 |
-
h3.text-title {
|
315 |
-
font: italic 20px/30px Georgia,"Times New Roman","Bitstream Charter",Times,serif !important;
|
316 |
-
}
|
317 |
-
#framework_wrap #content tbody tr.inline-edit-option td h3 {
|
318 |
-
border-bottom-color: #ddd;
|
319 |
-
}
|
320 |
-
#framework_wrap #content .block {
|
321 |
-
display: block;
|
322 |
-
overflow: hidden;
|
323 |
-
padding: 20px;
|
324 |
-
}
|
325 |
-
#framework_wrap #content p {
|
326 |
-
font-size: 11px;
|
327 |
-
color: #555;
|
328 |
-
padding-bottom: 20px;
|
329 |
-
margin: 0;
|
330 |
-
}
|
331 |
-
#framework_wrap #content table {
|
332 |
-
border: 1px solid #dfdfdf;
|
333 |
-
width: 100%;
|
334 |
-
text-align: left;
|
335 |
-
border-spacing: 0;
|
336 |
-
border-style: solid;
|
337 |
-
border-width: 1px;
|
338 |
-
font-size: 11px !important;
|
339 |
-
text-shadow: 0 1px 0 #fff;
|
340 |
-
-webkit-border-radius: 4px;
|
341 |
-
-moz-border-radius: 4px;
|
342 |
-
border-radius: 4px;
|
343 |
-
}
|
344 |
-
#framework_wrap #content .has-table table th {
|
345 |
-
background: #f1f1f1;
|
346 |
-
background-image: -moz-linear-gradient(top, #f9f9f9, #f1f1f1);
|
347 |
-
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f1f1f1));
|
348 |
-
}
|
349 |
-
tbody tr:hover {
|
350 |
-
cursor: pointer;
|
351 |
-
}
|
352 |
-
tbody tr.inline-edit-option {
|
353 |
-
}
|
354 |
-
tbody tr.inline-edit-option td {
|
355 |
-
background: #f1f1f1;
|
356 |
-
border-top: 1px solid #fff;
|
357 |
-
border-left: 1px solid #fff;
|
358 |
-
border-right: 1px solid #fff;
|
359 |
-
}
|
360 |
-
tbody tr:hover.inline-edit-option {
|
361 |
-
cursor: default;
|
362 |
-
}
|
363 |
-
#framework_wrap #content .has-table table #framework-settings .dragging {
|
364 |
-
background: #666 url(../images/black_px.png) repeat-x 0 0;
|
365 |
-
color: #fff;
|
366 |
-
text-shadow: 0 1px 0 #000;
|
367 |
-
}
|
368 |
-
#framework_wrap #content .has-table table #framework-settings .dragging td {
|
369 |
-
border-color: #000;
|
370 |
-
}
|
371 |
-
#framework_wrap #content .has-table table #framework-settings .dragging .col-edit {
|
372 |
-
background: url(../images/icon_up_down.png) no-repeat 63px center;
|
373 |
-
}
|
374 |
-
#framework_wrap #content .has-table table #framework-settings .dragging a.edit-inline,
|
375 |
-
#framework_wrap #content .has-table table #framework-settings .dragging a.delete-inline {
|
376 |
-
display: none;
|
377 |
-
}
|
378 |
-
.col-title {
|
379 |
-
padding-left: 10px !important;
|
380 |
-
width: 200px;
|
381 |
-
}
|
382 |
-
.col-type {
|
383 |
-
width: 60px;
|
384 |
-
}
|
385 |
-
.col-edit {
|
386 |
-
width: 45px;
|
387 |
-
padding-left: 40px !important;
|
388 |
-
padding-right: 0px !important;
|
389 |
-
}
|
390 |
-
.has-table table tr:first-child {
|
391 |
-
cursor: default;
|
392 |
-
}
|
393 |
-
.has-table table .col-heading {
|
394 |
-
background: #eaf3fa;
|
395 |
-
}
|
396 |
-
.has-table table .col-heading td:first-child {
|
397 |
-
font-weight: bold;
|
398 |
-
background: transparent url(../images/icon_header.png) no-repeat 10px 11px;
|
399 |
-
padding-left: 30px !important;
|
400 |
-
}
|
401 |
-
.has-table table thead th,
|
402 |
-
.has-table table td {
|
403 |
-
border-bottom: 1px solid #dfdfdf;
|
404 |
-
}
|
405 |
-
.has-table table tr,
|
406 |
-
.has-table table td,
|
407 |
-
.has-table table th {
|
408 |
-
padding: 10px 10px;
|
409 |
-
font-size: 11px !important;
|
410 |
-
}
|
411 |
-
.has-table table th {
|
412 |
-
padding: 6px 10px;
|
413 |
-
font-size: 11px !important;
|
414 |
-
}
|
415 |
-
#framework_wrap tr.active-layout {
|
416 |
-
background: #eaf3fa;
|
417 |
-
}
|
418 |
-
.has-table table a {
|
419 |
-
text-decoration: none;
|
420 |
-
}
|
421 |
-
/* Inline Edit */
|
422 |
-
.inline-edit-option {
|
423 |
-
display: none;
|
424 |
-
}
|
425 |
-
a.edit-inline,
|
426 |
-
a.delete-inline,
|
427 |
-
a.add-option,
|
428 |
-
a.activate-saved,
|
429 |
-
a.delete-saved {
|
430 |
-
background: url(../images/icon_edit.png) no-repeat 0 0;
|
431 |
-
display: block;
|
432 |
-
height: 16px;
|
433 |
-
width: 16px;
|
434 |
-
text-indent: -9999px;
|
435 |
-
float: left;
|
436 |
-
margin-right: 5px;
|
437 |
-
display: block;
|
438 |
-
}
|
439 |
-
a.delete-inline,
|
440 |
-
a.delete-saved {
|
441 |
-
background-image: url(../images/icon_delete.png);
|
442 |
-
}
|
443 |
-
a.add-option {
|
444 |
-
background-image: url(../images/icon_add.png);
|
445 |
-
margin-left: 21px;
|
446 |
-
}
|
447 |
-
a.activate-saved {
|
448 |
-
background-image: url(../images/icon_off.png);
|
449 |
-
}
|
450 |
-
.active-layout a.activate-saved {
|
451 |
-
background-image: url(../images/icon_on.png);
|
452 |
-
}
|
453 |
-
a:hover.edit-inline {
|
454 |
-
border-color: #666;
|
455 |
-
}
|
456 |
-
a:hover.delete-inline {
|
457 |
-
border-color: #d54e45;
|
458 |
-
}
|
459 |
-
#framework_wrap #content .option {
|
460 |
-
padding-bottom: 15px;
|
461 |
-
}
|
462 |
-
#framework_wrap #content .option .section {
|
463 |
-
overflow: hidden;
|
464 |
-
font-size: 11px;
|
465 |
-
}
|
466 |
-
#framework_wrap #content .option .section .element {
|
467 |
-
float: left;
|
468 |
-
margin: 0 15px 0 0;
|
469 |
-
width: 345px;
|
470 |
-
}
|
471 |
-
#framework_wrap #content .option-checkbox .section .element {
|
472 |
-
width: 25px;
|
473 |
-
}
|
474 |
-
#framework_wrap #content .option .section .description {
|
475 |
-
color: #555;
|
476 |
-
float: left;
|
477 |
-
font-size: 11px;
|
478 |
-
padding: 2px 10px 0 0;
|
479 |
-
width: 370px;
|
480 |
-
}
|
481 |
-
div.desc-text p {
|
482 |
-
color: #555;
|
483 |
-
font-size: 11px !important;
|
484 |
-
}
|
485 |
-
#framework_wrap #content .inline-edit-option .option .section .description {
|
486 |
-
width: 325px;
|
487 |
-
padding-top: 0px;
|
488 |
-
}
|
489 |
-
#framework_wrap #content .option-checkbox .section .description {
|
490 |
-
width: 540px;
|
491 |
-
}
|
492 |
-
#framework_wrap #content label {
|
493 |
-
|
494 |
-
}
|
495 |
-
.input_wrap {
|
496 |
-
padding: 4px 10px 12px 0;
|
497 |
-
float: left;
|
498 |
-
width: 350px;
|
499 |
-
}
|
500 |
-
.option-checbox .input_wrap,
|
501 |
-
.option-radio .input_wrap {
|
502 |
-
padding: 4px 10px 4px 0;
|
503 |
-
width: 325px;
|
504 |
-
}
|
505 |
-
.option-checbox .element {
|
506 |
-
border: none;
|
507 |
-
max-height: 260px;
|
508 |
-
height: auto !important;
|
509 |
-
height: expression( document.body.clientHeight > 260 ? "260px" : "auto" );
|
510 |
-
overflow-y: auto;
|
511 |
-
overflow-x: hidden;
|
512 |
-
}
|
513 |
-
.input_wrap input[type="checkbox"],
|
514 |
-
.input_wrap input[type="radio"] {
|
515 |
-
float: left;
|
516 |
-
width: 20px;
|
517 |
-
margin-top: 3px;
|
518 |
-
vertical-align: bottom;
|
519 |
-
}
|
520 |
-
.input_wrap input[type="radio"] {
|
521 |
-
margin-top: 4px;
|
522 |
-
}
|
523 |
-
.input_wrap label {
|
524 |
-
float: left;
|
525 |
-
width: 325px;
|
526 |
-
}
|
527 |
-
.option-checbox .input_wrap label,
|
528 |
-
.option-radio .input_wrap label {
|
529 |
-
width: 300px;
|
530 |
-
}
|
531 |
-
#framework_wrap #content label input {
|
532 |
-
margin-right: 5px;
|
533 |
-
display: block;
|
534 |
-
float: left;
|
535 |
-
}
|
536 |
-
#framework_wrap #content input[type="text"],
|
537 |
-
#framework_wrap #content select,
|
538 |
-
#framework_wrap #content textarea,
|
539 |
-
#framework_wrap #content input.input_layout {
|
540 |
-
background: #fafafa;
|
541 |
-
border-color: #ccc #eee #eee #ccc;
|
542 |
-
border-style: solid;
|
543 |
-
border-width: 1px;
|
544 |
-
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
|
545 |
-
font-size: 12px;
|
546 |
-
margin-bottom: 9px !important;
|
547 |
-
padding: 5px;
|
548 |
-
width: 344px;
|
549 |
-
display: block;
|
550 |
-
color: #888;
|
551 |
-
resize: none;
|
552 |
-
}
|
553 |
-
#framework_wrap #content div.css_block textarea {
|
554 |
-
width: 594px;
|
555 |
-
}
|
556 |
-
#framework_wrap #content input.input_layout {
|
557 |
-
-webkit-border-radius: 4px;
|
558 |
-
-moz-border-radius: 4px;
|
559 |
-
border-radius: 4px;
|
560 |
-
width: 250px;
|
561 |
-
float: left;
|
562 |
-
}
|
563 |
-
#framework_wrap #content tbody tr.inline-edit-option td input[type="text"],
|
564 |
-
#framework_wrap #content tbody tr.inline-edit-option td select,
|
565 |
-
#framework_wrap #content tbody tr.inline-edit-option td textarea {
|
566 |
-
background: #fff;
|
567 |
-
}
|
568 |
-
#framework_wrap #content input[type="text"].upload {
|
569 |
-
width: 281px;
|
570 |
-
float: left;
|
571 |
-
}
|
572 |
-
#framework_wrap #content input[type="text"].cp_input {
|
573 |
-
width: 312px !important;
|
574 |
-
float: left;
|
575 |
-
}
|
576 |
-
.cp_box {
|
577 |
-
float: right;
|
578 |
-
width: 25px;
|
579 |
-
height: 25px;
|
580 |
-
position: relative;
|
581 |
-
top: 1px;
|
582 |
-
border: 1px solid #ccc;
|
583 |
-
border-color: #ccc #eee #eee #ccc;
|
584 |
-
background: #fafafa;
|
585 |
-
-webkit-border-radius: 4px;
|
586 |
-
-moz-border-radius: 4px;
|
587 |
-
border-radius: 4px;
|
588 |
-
}
|
589 |
-
.cp_box div {
|
590 |
-
width: 13px;
|
591 |
-
height: 13px;
|
592 |
-
border: 1px solid #bbb;
|
593 |
-
border-color: #eee #ccc #ccc #eee;
|
594 |
-
background: #fafafa url(../images/empty.gif);
|
595 |
-
position: absolute;
|
596 |
-
left: 5px;
|
597 |
-
top: 5px;
|
598 |
-
box-shadow: 1px 1px 0px #ccc;
|
599 |
-
-webkit-box-shadow: 1px 1px 0px #ccc;
|
600 |
-
-moz-box-shadow: 1px 1px 0px #ccc;
|
601 |
-
}
|
602 |
-
#framework_wrap #content .element small {
|
603 |
-
float: left;
|
604 |
-
font-size: 9px;
|
605 |
-
line-height: 9px;
|
606 |
-
color: #999;
|
607 |
-
position: relative;
|
608 |
-
top: -5px;
|
609 |
-
left: 2px;
|
610 |
-
}
|
611 |
-
.upload_button,
|
612 |
-
.upload_file_button,
|
613 |
-
.ob_button {
|
614 |
-
float: right;
|
615 |
-
padding: 5px;
|
616 |
-
cursor: pointer;
|
617 |
-
color: #444;
|
618 |
-
text-shadow: 0 1px 0 #fff;
|
619 |
-
background: #f3f3f3 url(../images/btn.png) repeat-x 0 0 !important;
|
620 |
-
border: 1px solid #bbb;
|
621 |
-
position: relative;
|
622 |
-
right: -1px;
|
623 |
-
height: 27px;
|
624 |
-
}
|
625 |
-
#framework_wrap #content select {
|
626 |
-
height: 28px;
|
627 |
-
padding: 4px 5px;
|
628 |
-
}
|
629 |
-
#framework_wrap #content input[type="text"]:focus,
|
630 |
-
#framework_wrap #content select:focus,
|
631 |
-
#framework_wrap #content textarea:focus,
|
632 |
-
#framework_wrap #content input[type="text"]:hover,
|
633 |
-
#framework_wrap #content select:hover,
|
634 |
-
#framework_wrap #content textarea:hover,
|
635 |
-
#framework_wrap #content input:hover.input_layout,
|
636 |
-
#framework_wrap #content input:focus.input_layout {
|
637 |
-
background: #fff;
|
638 |
-
border-color: #bbb #eee #eee #bbb;
|
639 |
-
color: #333;
|
640 |
-
}
|
641 |
-
#framework_wrap *:focus {
|
642 |
-
outline: none;
|
643 |
-
}
|
644 |
-
#framework_wrap *::-moz-focus-inner {
|
645 |
-
border: none;
|
646 |
-
}
|
647 |
-
.bottom_btn {
|
648 |
-
float: left;
|
649 |
-
width: 100%;
|
650 |
-
padding-top: 15px;
|
651 |
-
}
|
652 |
-
#framework_wrap .select-layout,
|
653 |
-
#framework_wrap .save-layout-wrap {
|
654 |
-
height: 34px;
|
655 |
-
float: right;
|
656 |
-
}
|
657 |
-
#framework_wrap .select-layout {
|
658 |
-
padding-left: 10px;
|
659 |
-
border-left: 1px solid #e3e3e3;
|
660 |
-
}
|
661 |
-
#framework_wrap .select-layout select {
|
662 |
-
margin: 5px 10px 0 0;
|
663 |
-
height: 25px;
|
664 |
-
padding: 4px 5px;
|
665 |
-
}
|
666 |
-
#framework_wrap #content .select_wrapper {
|
667 |
-
-moz-border-radius: 4px;
|
668 |
-
-webkit-border-radius: 4px;
|
669 |
-
border-radius: 4px;
|
670 |
-
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
|
671 |
-
font-size: 12px;
|
672 |
-
background: #fafafa url(../images/select.png) no-repeat right center;
|
673 |
-
border-color: #ccc #eee #eee #ccc;
|
674 |
-
border-style: solid;
|
675 |
-
border-width: 1px;
|
676 |
-
float: left;
|
677 |
-
height: 26px;
|
678 |
-
width: 343px;
|
679 |
-
margin: 0;
|
680 |
-
margin-bottom: 9px !important;
|
681 |
-
display: block;
|
682 |
-
color: #888;
|
683 |
-
}
|
684 |
-
#framework_wrap #content .option-type .select_wrapper {
|
685 |
-
background-color: #fff;
|
686 |
-
}
|
687 |
-
#framework_wrap #content .select_wrapper.measurement {
|
688 |
-
width: 65px;
|
689 |
-
float: right;
|
690 |
-
margin-top: 1px;
|
691 |
-
}
|
692 |
-
#framework_wrap #content input.measurement {
|
693 |
-
width: 269px;
|
694 |
-
float: left;
|
695 |
-
padding-top: 6px;
|
696 |
-
}
|
697 |
-
#framework_wrap #content .select_wrapper:hover {
|
698 |
-
background-color: #fff;
|
699 |
-
border-color: #bbb #eee #eee #bbb;
|
700 |
-
color: #333;
|
701 |
-
}
|
702 |
-
#framework_wrap #content select.select {
|
703 |
-
cursor: pointer;
|
704 |
-
height: 28px;
|
705 |
-
margin: 0;
|
706 |
-
-moz-opacity: 0;
|
707 |
-
filter: alpha(opacity: 0);
|
708 |
-
opacity: 0;
|
709 |
-
padding: 0;
|
710 |
-
position: relative;
|
711 |
-
width: inherit;
|
712 |
-
z-index: 4;
|
713 |
-
}
|
714 |
-
#framework_wrap #content .select_wrapper span {
|
715 |
-
height: 26px;
|
716 |
-
line-height: 26px;
|
717 |
-
position: absolute;
|
718 |
-
z-index: 2;
|
719 |
-
padding-left: 6px;
|
720 |
-
}
|
721 |
-
/* Image Slider */
|
722 |
-
.option-tree-slider {
|
723 |
-
background: #eaf3fa;
|
724 |
-
padding: 0px 10px;
|
725 |
-
margin-bottom: 8px;
|
726 |
-
text-shadow: 0 1px 0 #fff;
|
727 |
-
position: relative;
|
728 |
-
/* CSS3 */
|
729 |
-
-webkit-border-radius: 4px;
|
730 |
-
-moz-border-radius: 4px;
|
731 |
-
border-radius: 4px;
|
732 |
-
-moz-box-shadow: 1px 1px 0px #ccc;
|
733 |
-
-webkit-box-shadow: 1px 1px 0px #ccc;
|
734 |
-
box-shadow: 1px 1px 0px #ccc;
|
735 |
-
}
|
736 |
-
.option-tree-slider p {
|
737 |
-
padding-bottom: 5px !important;
|
738 |
-
margin-bottom: 0px !important;
|
739 |
-
}
|
740 |
-
#framework_wrap #content .option-option-tree-slider .section .element input[type="text"],
|
741 |
-
#framework_wrap #content .option-option-tree-slider .section .element textarea {
|
742 |
-
background: #fff;
|
743 |
-
width: 323px;
|
744 |
-
}
|
745 |
-
#framework_wrap #content .option-option-tree-slider .section .element input[type="text"].upload {
|
746 |
-
width: 261px;
|
747 |
-
float: left;
|
748 |
-
}
|
749 |
-
.option-tree-slider-wrap .edit {
|
750 |
-
position: absolute;
|
751 |
-
height: 16px;
|
752 |
-
width: 16px;
|
753 |
-
display: block;
|
754 |
-
text-indent: -9999px;
|
755 |
-
background: url(../images/icon_edit.png);
|
756 |
-
top: 6px;
|
757 |
-
right: 27px;
|
758 |
-
z-index: 10;
|
759 |
-
}
|
760 |
-
.option-tree-slider-wrap .edit.down {
|
761 |
-
background: url(../images/icon_up.png) !important;
|
762 |
-
}
|
763 |
-
.option-tree-slider-wrap .trash {
|
764 |
-
position: absolute;
|
765 |
-
height: 16px;
|
766 |
-
width: 16px;
|
767 |
-
display: block;
|
768 |
-
text-indent: -9999px;
|
769 |
-
background: url(../images/icon_delete.png);
|
770 |
-
top: 6px;
|
771 |
-
right: 6px;
|
772 |
-
z-index: 10;
|
773 |
-
}
|
774 |
-
.option-tree-slider-wrap .open {
|
775 |
-
padding: 5px 0px;
|
776 |
-
padding-right: 40px;
|
777 |
-
display: block;
|
778 |
-
font-size: 11px;
|
779 |
-
}
|
780 |
-
.option-tree-slider-wrap .option-tree-slider-body {
|
781 |
-
|
782 |
-
}
|
783 |
-
.option-tree-slider p {
|
784 |
-
clear: both;
|
785 |
-
}
|
786 |
-
.option-tree-slider-wrap .option-tree-slider-body div label {
|
787 |
-
color: #555;
|
788 |
-
font-size: 11px;
|
789 |
-
display: block;
|
790 |
-
}
|
791 |
-
.option-tree-slider-wrap .option-tree-slider-body .screenshot {
|
792 |
-
display: block;
|
793 |
-
width: 320px;
|
794 |
-
}
|
795 |
-
.option-tree-slider-wrap .option-tree-slider-body .screenshot img {
|
796 |
-
max-width: 314px;
|
797 |
-
margin: 10px 0;
|
798 |
-
}
|
799 |
-
.option-tree-slider-wrap .option-tree-slider-body .screenshot .remove {
|
800 |
-
bottom: 6px;
|
801 |
-
}
|
802 |
-
/* Docs */
|
803 |
-
#framework_wrap #options_tabs.docs {
|
804 |
-
font-size: 11px !important;
|
805 |
-
color: #555;
|
806 |
-
}
|
807 |
-
#framework_wrap code {
|
808 |
-
font-size: 10px;
|
809 |
-
}
|
810 |
-
#framework_wrap ul.doc_list {
|
811 |
-
font-size: 11px !important;
|
812 |
-
padding-bottom: 20px;
|
813 |
-
}
|
814 |
-
#framework_wrap .doc_list li {
|
815 |
-
padding-bottom: 0px;
|
816 |
-
line-height: 12px;
|
817 |
-
list-style: disc;
|
818 |
-
margin-left: 16px;
|
819 |
-
}
|
820 |
-
#framework_wrap code {
|
821 |
-
background-color: #f1f1f1;
|
822 |
-
color: #000;
|
823 |
-
}
|
824 |
-
#framework_wrap pre {
|
825 |
-
font-size: 13px;
|
826 |
-
padding: 0;
|
827 |
-
margin: 0;
|
828 |
-
line-height: 18px;
|
829 |
-
overflow: auto;
|
830 |
-
overflow-Y: hidden;
|
831 |
-
padding-top: 18px;
|
832 |
-
background: #f1f1f1;
|
833 |
-
border-bottom: 1px solid #f1f1f1;
|
834 |
-
margin-bottom: 20px;
|
835 |
-
color: #000;
|
836 |
-
white-space:pre-wrap;
|
837 |
-
word-wrap:break-word;
|
838 |
-
}
|
839 |
-
#framework_wrap pre code {
|
840 |
-
padding: 0 18px 18px 18px;
|
841 |
-
display: block;
|
842 |
-
background: url(../images/pre_bg.gif) repeat left top; /*--Background of lined paper--*/
|
843 |
-
}
|
844 |
-
/* Tabs */
|
845 |
-
#framework_wrap .options_tabs {
|
846 |
-
display: none;
|
847 |
-
}
|
848 |
-
#framework_wrap .ui-tabs {
|
849 |
-
zoom: 1;
|
850 |
-
background: url(../images/tabs_bg.png) repeat-y 0 0;
|
851 |
-
}
|
852 |
-
#framework_wrap .ui-tabs .options_tabs {
|
853 |
-
display: block;
|
854 |
-
}
|
855 |
-
#framework_wrap .ui-tabs-panel .description {
|
856 |
-
width: 225px !important;
|
857 |
-
}
|
858 |
-
#framework_wrap .ui-tabs-panel .inline-edit-option .description {
|
859 |
-
width: 200px !important;
|
860 |
-
}
|
861 |
-
#framework_wrap .ui-tabs-panel h2 {
|
862 |
-
display: none;
|
863 |
-
}
|
864 |
-
#framework_wrap .ui-tabs .ui-tabs-nav {
|
865 |
-
list-style: none;
|
866 |
-
position: relative;
|
867 |
-
float: left;
|
868 |
-
width: 148px;
|
869 |
-
word-wrap: break-word;
|
870 |
-
}
|
871 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li {
|
872 |
-
position: relative;
|
873 |
-
float: left;
|
874 |
-
display: block;
|
875 |
-
margin: 0;
|
876 |
-
padding: 0;
|
877 |
-
overflow: visible;
|
878 |
-
}
|
879 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li a {
|
880 |
-
float: left;
|
881 |
-
text-decoration: none;
|
882 |
-
display: block;
|
883 |
-
width: 127px;
|
884 |
-
padding: 8px 10px;
|
885 |
-
border-bottom: 1px solid #e3e3e3;
|
886 |
-
color: #21759B;
|
887 |
-
text-shadow: 0 1px 0 #fff;
|
888 |
-
background-image: url(../images/white_px.png);
|
889 |
-
background-repeat: repeat-x;
|
890 |
-
background-position: 0 0;
|
891 |
-
font-size: 11px;
|
892 |
-
}
|
893 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
|
894 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li.ui-tabs-selected a:hover {
|
895 |
-
background: #fff;
|
896 |
-
color: #d54e45;
|
897 |
-
width: 128px;
|
898 |
-
}
|
899 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
|
900 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-processing a {
|
901 |
-
cursor: text;
|
902 |
-
}
|
903 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li a,
|
904 |
-
#framework_wrap .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
|
905 |
-
cursor: pointer;
|
906 |
-
}
|
907 |
-
#framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-hover a {
|
908 |
-
background-color: #eaf2fa;
|
909 |
-
color: #555;
|
910 |
-
}
|
911 |
-
#framework_wrap .ui-tabs .ui-tabs-panel {
|
912 |
-
display: block;
|
913 |
-
float: right;
|
914 |
-
width: 595px;
|
915 |
-
min-height: 400px;
|
916 |
-
}
|
917 |
-
#framework_wrap .ui-tabs .ui-tabs-hide {
|
918 |
-
display: none !important;
|
919 |
-
}
|
920 |
-
#framework_wrap .options_tabs li.ui-tabs-selected span {
|
921 |
-
position: absolute;
|
922 |
-
left: -1px;
|
923 |
-
top: 12px;
|
924 |
-
height: 9px;
|
925 |
-
width: 8px;
|
926 |
-
background: url(../images/icon_arrow.png) no-repeat 0 0;
|
927 |
-
}
|
928 |
-
|
929 |
-
/* ColorPicker */
|
930 |
-
.colorpicker {
|
931 |
-
width: 342px;
|
932 |
-
height: 170px;
|
933 |
-
overflow: hidden;
|
934 |
-
position: absolute;
|
935 |
-
background: #fafafa url(../images/colorpicker/color_bg.png);
|
936 |
-
font-family: Arial, Helvetica, sans-serif;
|
937 |
-
display: none;
|
938 |
-
border: 1px solid #ccc;
|
939 |
-
border-color: #ddd #bbb #bbb #ddd;
|
940 |
-
-moz-border-radius: 4px;
|
941 |
-
-webkit-border-radius: 4px;
|
942 |
-
border-radius: 4px;
|
943 |
-
z-index: 100;
|
944 |
-
}
|
945 |
-
.colorpicker_color {
|
946 |
-
width: 150px;
|
947 |
-
height: 150px;
|
948 |
-
left: 10px;
|
949 |
-
top: 10px;
|
950 |
-
position: absolute;
|
951 |
-
background: #f00;
|
952 |
-
overflow: hidden;
|
953 |
-
cursor: crosshair;
|
954 |
-
}
|
955 |
-
.colorpicker_color div {
|
956 |
-
position: absolute;
|
957 |
-
top: 0;
|
958 |
-
left: 0;
|
959 |
-
width: 150px;
|
960 |
-
height: 150px;
|
961 |
-
background: url(../images/colorpicker/color_overlay.png);
|
962 |
-
}
|
963 |
-
.colorpicker_color div div {
|
964 |
-
position: absolute;
|
965 |
-
top: 0;
|
966 |
-
left: 0;
|
967 |
-
width: 11px;
|
968 |
-
height: 11px;
|
969 |
-
overflow: hidden;
|
970 |
-
background: url(../images/colorpicker/color_select.gif);
|
971 |
-
margin: -5px 0 0 -5px;
|
972 |
-
}
|
973 |
-
.colorpicker_hue {
|
974 |
-
position: absolute;
|
975 |
-
top: 10px;
|
976 |
-
left: 164px;
|
977 |
-
width: 35px;
|
978 |
-
height: 150px;
|
979 |
-
cursor: n-resize;
|
980 |
-
}
|
981 |
-
.colorpicker_hue div {
|
982 |
-
position: absolute;
|
983 |
-
width: 35px;
|
984 |
-
height: 9px;
|
985 |
-
overflow: hidden;
|
986 |
-
background: url(../images/colorpicker/color_indicator.png) left top;
|
987 |
-
margin: -5px 0 0 0;
|
988 |
-
}
|
989 |
-
.colorpicker_new_color {
|
990 |
-
position: absolute;
|
991 |
-
width: 60px;
|
992 |
-
height: 30px;
|
993 |
-
right: 80px;
|
994 |
-
top: 10px;
|
995 |
-
background: #f00;
|
996 |
-
}
|
997 |
-
.colorpicker_current_color {
|
998 |
-
position: absolute;
|
999 |
-
width: 60px;
|
1000 |
-
height: 30px;
|
1001 |
-
right: 10px;
|
1002 |
-
top: 10px;
|
1003 |
-
background: #f00;
|
1004 |
-
}
|
1005 |
-
.colorpicker input {
|
1006 |
-
background-color: transparent;
|
1007 |
-
border: 1px solid transparent;
|
1008 |
-
position: absolute;
|
1009 |
-
font-size: 10px;
|
1010 |
-
font-family: Arial, Helvetica, sans-serif;
|
1011 |
-
color: #666;
|
1012 |
-
top: 6px;
|
1013 |
-
right: 11px;
|
1014 |
-
text-align: right;
|
1015 |
-
margin: 0;
|
1016 |
-
padding: 0;
|
1017 |
-
height: 11px;
|
1018 |
-
}
|
1019 |
-
.colorpicker_hex {
|
1020 |
-
position: absolute;
|
1021 |
-
width: 72px;
|
1022 |
-
height: 22px;
|
1023 |
-
background: url(../images/colorpicker/color_hex.png) top;
|
1024 |
-
left: 201px;
|
1025 |
-
bottom: 9px;
|
1026 |
-
}
|
1027 |
-
.colorpicker_hex input {
|
1028 |
-
right: 6px;
|
1029 |
-
}
|
1030 |
-
.colorpicker_field {
|
1031 |
-
height: 22px;
|
1032 |
-
width: 62px;
|
1033 |
-
background-position: top;
|
1034 |
-
position: absolute;
|
1035 |
-
}
|
1036 |
-
.colorpicker_field span {
|
1037 |
-
position: absolute;
|
1038 |
-
width: 12px;
|
1039 |
-
height: 22px;
|
1040 |
-
overflow: hidden;
|
1041 |
-
top: 0;
|
1042 |
-
right: 0;
|
1043 |
-
cursor: n-resize;
|
1044 |
-
}
|
1045 |
-
.colorpicker_rgb_r {
|
1046 |
-
background-image: url(../images/colorpicker/color_rgb_r.png);
|
1047 |
-
top: 49px;
|
1048 |
-
left: 201px;
|
1049 |
-
}
|
1050 |
-
.colorpicker_rgb_g {
|
1051 |
-
background-image: url(../images/colorpicker/color_rgb_g.png);
|
1052 |
-
top: 79px;
|
1053 |
-
left: 201px;
|
1054 |
-
}
|
1055 |
-
.colorpicker_rgb_b {
|
1056 |
-
background-image: url(../images/colorpicker/color_rgb_b.png);
|
1057 |
-
top: 109px;
|
1058 |
-
left: 201px;
|
1059 |
-
}
|
1060 |
-
.colorpicker_hsb_h {
|
1061 |
-
background-image: url(../images/colorpicker/color_hsb_h.png);
|
1062 |
-
top: 49px;
|
1063 |
-
right: 9px;
|
1064 |
-
}
|
1065 |
-
.colorpicker_hsb_s {
|
1066 |
-
background-image: url(../images/colorpicker/color_hsb_s.png);
|
1067 |
-
top: 79px;
|
1068 |
-
right: 9px;
|
1069 |
-
}
|
1070 |
-
.colorpicker_hsb_b {
|
1071 |
-
background-image: url(../images/colorpicker/color_hsb_b.png);
|
1072 |
-
top: 109px;
|
1073 |
-
right: 9px;
|
1074 |
-
}
|
1075 |
-
.colorpicker_submit {
|
1076 |
-
position: absolute;
|
1077 |
-
width: 16px;
|
1078 |
-
height: 16px;
|
1079 |
-
background: url(../images/colorpicker/color_wheel.png) top;
|
1080 |
-
right: 10px;
|
1081 |
-
bottom: 10px;
|
1082 |
-
overflow: hidden;
|
1083 |
-
}
|
1084 |
-
.colorpicker_focus {
|
1085 |
-
background-position: center;
|
1086 |
-
}
|
1087 |
-
.colorpicker_hex.colorpicker_focus {
|
1088 |
-
background-position: bottom;
|
1089 |
-
}
|
1090 |
-
.colorpicker_submit.colorpicker_focus {
|
1091 |
-
background-position: bottom;
|
1092 |
-
}
|
1093 |
-
.colorpicker_slider {
|
1094 |
-
background-position: bottom;
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
/* file input */
|
1098 |
-
div.file_wrap {
|
1099 |
-
position: relative;
|
1100 |
-
float: left;
|
1101 |
-
width: 345px;
|
1102 |
-
}
|
1103 |
-
div.fake_file {
|
1104 |
-
position: absolute;
|
1105 |
-
top: 0px;
|
1106 |
-
left: 0px;
|
1107 |
-
z-index: 1;
|
1108 |
-
}
|
1109 |
-
div.fake_file input.upload {
|
1110 |
-
margin-right: 3px;
|
1111 |
-
width: 279px !important;
|
1112 |
-
}
|
1113 |
-
input.file {
|
1114 |
-
background: none;
|
1115 |
-
position: relative;
|
1116 |
-
text-align: right;
|
1117 |
-
float: right;
|
1118 |
-
height: 28px;
|
1119 |
-
-moz-opacity: 0;
|
1120 |
-
filter: alpha(opacity: 0);
|
1121 |
-
opacity: 0;
|
1122 |
-
z-index: 2;
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
.option-background-upload .screenshot img {
|
1126 |
-
margin-bottom: 10px;
|
1127 |
-
}
|
1128 |
-
.option-background-upload .screenshot .remove {
|
1129 |
-
bottom: 6px;
|
1130 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/images/black_px.png
DELETED
Binary file
|
assets/images/btn.png
DELETED
Binary file
|
assets/images/colorpicker/color_bg.png
CHANGED
Binary file
|
assets/images/empty.gif
DELETED
Binary file
|
assets/images/header.png
DELETED
Binary file
|
assets/images/header_classic.png
DELETED
Binary file
|
assets/images/icon_add.png
DELETED
Binary file
|
assets/images/icon_arrow.png
DELETED
Binary file
|
assets/images/icon_classic.png
DELETED
Binary file
|
assets/images/icon_dark.png
DELETED
Binary file
|
assets/images/icon_delete.png
DELETED
Binary file
|
assets/images/icon_edit.png
DELETED
Binary file
|
assets/images/icon_error.png
DELETED
Binary file
|
assets/images/icon_header.png
DELETED
Binary file
|
assets/images/icon_off.png
DELETED
Binary file
|
assets/images/icon_on.png
DELETED
Binary file
|
assets/images/icon_option.png
DELETED
Binary file
|
assets/images/icon_option_classic.png
DELETED
Binary file
|
assets/images/icon_up.png
DELETED
Binary file
|
assets/images/icon_up_down.png
DELETED
Binary file
|
assets/images/layout/dual-sidebar.png
ADDED
Binary file
|
assets/images/layout/full-width.png
ADDED
Binary file
|
assets/images/layout/left-dual-sidebar.png
ADDED
Binary file
|
assets/images/layout/left-sidebar.png
ADDED
Binary file
|
assets/images/layout/right-dual-sidebar.png
ADDED
Binary file
|
assets/images/layout/right-sidebar.png
ADDED
Binary file
|
assets/images/logo_classic.png
DELETED
Binary file
|
assets/images/logo_dark.png
DELETED
Binary file
|
assets/images/ot-dots.png
ADDED
Binary file
|
assets/images/ot-logo-mini.png
ADDED
Binary file
|
assets/images/ot-logo.png
ADDED
Binary file
|
assets/images/ot-menu-bg.png
ADDED
Binary file
|
assets/images/ot-menu-top-bg.png
ADDED
Binary file
|
assets/images/{pre_bg.gif → ot-pre-bg.gif}
RENAMED
File without changes
|
assets/images/ot-select-hover.png
ADDED
Binary file
|
assets/images/ot-select.png
ADDED
Binary file
|
assets/images/ot-sub-header-bg.png
ADDED
Binary file
|
assets/images/ot-ui-light-sprite.png
ADDED
Binary file
|
assets/images/ot-ui-sprite.png
ADDED
Binary file
|
assets/images/pre_classic_bg.gif
DELETED
Binary file
|
assets/images/select.png
DELETED
Binary file
|
assets/images/tabs_bg.png
DELETED
Binary file
|
assets/images/tabs_bg_classic.png
DELETED
Binary file
|
assets/images/toggle_tabs.png
DELETED
Binary file
|
assets/images/white_px.png
DELETED
Binary file
|
assets/js/jquery.option.tree.js
DELETED
@@ -1,1140 +0,0 @@
|
|
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').prepend('<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 = '',
|
145 |
-
tbframe_interval;
|
146 |
-
// On Click
|
147 |
-
$('.upload_button').live("click", function () {
|
148 |
-
formfield = $(this).prev('input').attr('id');
|
149 |
-
formID = $(this).attr('rel');
|
150 |
-
tb_show('', 'media-upload.php?post_id='+formID+'&type=image&TB_iframe=1');
|
151 |
-
tbframe_interval = setInterval(function() { jQuery('#TB_iframeContent').contents().find('.savesend .button').val('Add to OptionTree'); }, 2000);
|
152 |
-
return false;
|
153 |
-
});
|
154 |
-
window.original_send_to_editor = window.send_to_editor;
|
155 |
-
window.send_to_editor = function(html) {
|
156 |
-
if (formfield) {
|
157 |
-
clearInterval(tbframe_interval);
|
158 |
-
itemurl = $(html).attr('href');
|
159 |
-
var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi;
|
160 |
-
var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi;
|
161 |
-
var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi;
|
162 |
-
var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi;
|
163 |
-
if ( UrlExists(itemurl) ) {
|
164 |
-
if (itemurl.match(image)) {
|
165 |
-
btnContent = '<img src="'+itemurl+'" alt="" /><a href="" class="remove">Remove Image</a>';
|
166 |
-
} else {
|
167 |
-
btnContent = '<div class="no_image">'+html+'<a href="" class="remove">Remove</a></div>';
|
168 |
-
}
|
169 |
-
}
|
170 |
-
$('#' + formfield).val(itemurl);
|
171 |
-
$('#' + formfield + '_image').remove();
|
172 |
-
$('#' + formfield).parent('div').append('<div class="screenshot" id="'+formfield+'_image" />');
|
173 |
-
$('#' + formfield + '_image').append(btnContent).slideDown();
|
174 |
-
tb_remove();
|
175 |
-
} else {
|
176 |
-
window.original_send_to_editor(html);
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
180 |
-
};
|
181 |
-
$(document).ready(function () {
|
182 |
-
uploadOption.init()
|
183 |
-
})
|
184 |
-
})(jQuery);
|
185 |
-
|
186 |
-
function UrlExists(url) {
|
187 |
-
var http = new XMLHttpRequest();
|
188 |
-
http.open('HEAD', url, false);
|
189 |
-
http.send();
|
190 |
-
return http.status!=404;
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
*
|
195 |
-
* Inline Edit Options
|
196 |
-
*
|
197 |
-
* Creates & Updates Options via Ajax
|
198 |
-
* Dependencies: jQuery
|
199 |
-
*
|
200 |
-
*/
|
201 |
-
(function ($) {
|
202 |
-
inlineEditOption = {
|
203 |
-
init: function () {
|
204 |
-
var c = this,
|
205 |
-
d = $("tr.inline-edit-option");
|
206 |
-
$('.save-options', '#the-theme-options').live("click", function () {
|
207 |
-
inlineEditOption.save_options(this);
|
208 |
-
return false;
|
209 |
-
});
|
210 |
-
$('.reload-options', '#the-theme-options').live("click", function () {
|
211 |
-
var agree = confirm("Are you sure you want to reload your options from the theme-options.xml file?");
|
212 |
-
if (agree) {
|
213 |
-
inlineEditOption.reload_options(this);
|
214 |
-
return false;
|
215 |
-
} else {
|
216 |
-
return false;
|
217 |
-
}
|
218 |
-
});
|
219 |
-
$('.reset', '#the-theme-options').live("click", function () {
|
220 |
-
var agree = confirm("Are you absolutely sure you wish to delete all of your saved Theme Option?");
|
221 |
-
if (agree) {
|
222 |
-
inlineEditOption.reset_options(this);
|
223 |
-
return false;
|
224 |
-
} else {
|
225 |
-
return false;
|
226 |
-
}
|
227 |
-
});
|
228 |
-
$('.import-data', '#import-data').live("click", function () {
|
229 |
-
inlineEditOption.import_data(this);
|
230 |
-
return false;
|
231 |
-
});
|
232 |
-
$('.import-layout', '#import-layout').live("click", function () {
|
233 |
-
inlineEditOption.import_layout(this);
|
234 |
-
return false;
|
235 |
-
});
|
236 |
-
$('.save-layout', '#save-layout').live("click", function (e) {
|
237 |
-
inlineEditOption.save_layout(this);
|
238 |
-
e.preventDefault();
|
239 |
-
return false;
|
240 |
-
});
|
241 |
-
$('.user-save-layout', '#the-theme-options').live("click", function (e) {
|
242 |
-
var agree = confirm("Are you sure you want to save this layout?");
|
243 |
-
if (agree) {
|
244 |
-
inlineEditOption.save_layout_user_side(this);
|
245 |
-
return false;
|
246 |
-
}
|
247 |
-
return false;
|
248 |
-
});
|
249 |
-
$('a.delete-saved').live("click", function () {
|
250 |
-
if ($("a.delete-saved").hasClass('disable')) {
|
251 |
-
event.preventDefault();
|
252 |
-
return false;
|
253 |
-
} else {
|
254 |
-
var agree = confirm("Are you sure you want to delete this saved layout?");
|
255 |
-
if (agree) {
|
256 |
-
inlineEditOption.delete_layout(this);
|
257 |
-
return false;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
return false;
|
261 |
-
});
|
262 |
-
$("a.activate-saved").live("click", function(){
|
263 |
-
var agree = confirm("Are you sure you want to activate this layout?");
|
264 |
-
if (agree) {
|
265 |
-
inlineEditOption.activate_layout(this);
|
266 |
-
return false;
|
267 |
-
}
|
268 |
-
return false;
|
269 |
-
});
|
270 |
-
$('.user-activate-layout', '#the-theme-options').live("click", function () {
|
271 |
-
var agree = confirm("Are you sure you want to activate this layout?");
|
272 |
-
if (agree) {
|
273 |
-
inlineEditOption.activate_layout_user_side(this);
|
274 |
-
return false;
|
275 |
-
}
|
276 |
-
return false;
|
277 |
-
});
|
278 |
-
$("a.edit-inline").live("click", function (event) {
|
279 |
-
if ($("a.edit-inline").hasClass('disable')) {
|
280 |
-
event.preventDefault();
|
281 |
-
return false;
|
282 |
-
} else {
|
283 |
-
inlineEditOption.edit(this);
|
284 |
-
return false;
|
285 |
-
}
|
286 |
-
});
|
287 |
-
$("a.save").live("click", function () {
|
288 |
-
if ($("a.save").hasClass('add-save')) {
|
289 |
-
inlineEditOption.addSave(this);
|
290 |
-
return false;
|
291 |
-
} else {
|
292 |
-
inlineEditOption.editSave(this);
|
293 |
-
return false;
|
294 |
-
}
|
295 |
-
});
|
296 |
-
$("a.cancel").live("click", function () {
|
297 |
-
if ($("a.cancel").hasClass('undo-add')) {
|
298 |
-
inlineEditOption.undoAdd();
|
299 |
-
return false;
|
300 |
-
} else {
|
301 |
-
inlineEditOption.revert();
|
302 |
-
return false;
|
303 |
-
}
|
304 |
-
});
|
305 |
-
$("a.add-option").live("click", function (event) {
|
306 |
-
if ($(this).hasClass('disable')) {
|
307 |
-
event.preventDefault();
|
308 |
-
return false;
|
309 |
-
} else {
|
310 |
-
$.post(
|
311 |
-
ajaxurl,
|
312 |
-
{ action:'option_tree_next_id', _ajax_nonce: $("#_ajax_nonce").val() },
|
313 |
-
function (response) {
|
314 |
-
c = parseInt(response) + 1;
|
315 |
-
inlineEditOption.add(c);
|
316 |
-
}
|
317 |
-
);
|
318 |
-
return false;
|
319 |
-
}
|
320 |
-
});
|
321 |
-
$('#framework-settings').tableDnD({
|
322 |
-
onDragClass: "dragging",
|
323 |
-
onDrop: function(table, row) {
|
324 |
-
d = {
|
325 |
-
action: "option_tree_sort",
|
326 |
-
id: $.tableDnD.serialize(),
|
327 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
328 |
-
};
|
329 |
-
$.post(ajaxurl, d, function (response) {
|
330 |
-
|
331 |
-
}, "html");
|
332 |
-
}
|
333 |
-
});
|
334 |
-
$('#upload-xml').submit(function() {
|
335 |
-
var agree = confirm("Are you sure you want to import these new settings?");
|
336 |
-
if (agree) {
|
337 |
-
return true;
|
338 |
-
}
|
339 |
-
return false;
|
340 |
-
});
|
341 |
-
$('.delete-inline').live("click", function (event) {
|
342 |
-
if ($("a.delete-inline").hasClass('disable')) {
|
343 |
-
event.preventDefault();
|
344 |
-
return false;
|
345 |
-
} else {
|
346 |
-
var agree = confirm("Are you sure you want to delete this option?");
|
347 |
-
if (agree) {
|
348 |
-
inlineEditOption.remove(this);
|
349 |
-
return false;
|
350 |
-
} else {
|
351 |
-
return false;
|
352 |
-
}
|
353 |
-
}
|
354 |
-
});
|
355 |
-
// Fade out message div
|
356 |
-
if ($('.ajax-message').hasClass('show')) {
|
357 |
-
$('.ajax-message').ajaxMessage();
|
358 |
-
}
|
359 |
-
// Remove Uploaded Image
|
360 |
-
$('.remove').live('click', function(event) {
|
361 |
-
$(this).hide();
|
362 |
-
$(this).parents().prev().prev('.upload').attr('value', '');
|
363 |
-
//$(this).parents('.screenshot').slideUp();
|
364 |
-
$(this).parents('.screenshot').find('img').remove();
|
365 |
-
$(this).parents('.screenshot').find('.remove').remove();
|
366 |
-
event.preventDefault();
|
367 |
-
});
|
368 |
-
// Hide the delete button on the first row
|
369 |
-
$('a.delete-inline', "#option-1").hide();
|
370 |
-
// change upload input
|
371 |
-
$('.upload').live('blur', function() {
|
372 |
-
var id = $(this).attr('id'),
|
373 |
-
val = $(this).val(),
|
374 |
-
img = $(this).parent().find('img'),
|
375 |
-
btn = $(this).parent().find('.remove'),
|
376 |
-
src = img.attr('src');
|
377 |
-
|
378 |
-
// don't match update
|
379 |
-
if ( val != src ) {
|
380 |
-
img.attr('src', val);
|
381 |
-
}
|
382 |
-
// no image to change add it
|
383 |
-
if ( val !== '' && ( typeof src == 'undefined' || src == false ) && UrlExists(val) ) {
|
384 |
-
btnContent = '<img src="'+val+'" alt="" /><a href="" class="remove">Remove Image</a>';
|
385 |
-
$(this).parent('div').append('<div class="screenshot" id="'+id+'_image" />');
|
386 |
-
$('#' + id + '_image').append(btnContent).slideDown();
|
387 |
-
} else if ( val == '' || ! UrlExists(val) ) {
|
388 |
-
img.remove();
|
389 |
-
btn.remove();
|
390 |
-
}
|
391 |
-
});
|
392 |
-
// add # to hex if missing
|
393 |
-
$('.cp_input').live('blur', function() {
|
394 |
-
$('.cp_input').each( function(index, domEle) {
|
395 |
-
var val = $(domEle).val();
|
396 |
-
var reg = /^[A-Fa-f0-9]{6}$/;
|
397 |
-
if( reg.test(val) && val != '' ) {
|
398 |
-
$(domEle).attr('value', '#'+val )
|
399 |
-
}
|
400 |
-
});
|
401 |
-
});
|
402 |
-
},
|
403 |
-
save_options: function (e) {
|
404 |
-
var d = {
|
405 |
-
action: "option_tree_array_save"
|
406 |
-
};
|
407 |
-
b = $(':input', '#the-theme-options').serialize();
|
408 |
-
d = b + "&" + $.param(d);
|
409 |
-
$.post(ajaxurl, d, function (r) {
|
410 |
-
if (r != -1) {
|
411 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Theme Options were saved</div>');
|
412 |
-
$(".option-tree-slider-body").hide();
|
413 |
-
$('.option-tree-slider .edit').removeClass('down');
|
414 |
-
} else {
|
415 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Theme Options could not be saved</div>');
|
416 |
-
}
|
417 |
-
});
|
418 |
-
return false;
|
419 |
-
},
|
420 |
-
reload_options: function (e) {
|
421 |
-
var d = {
|
422 |
-
action: "option_tree_array_reload",
|
423 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
424 |
-
};
|
425 |
-
$.post(ajaxurl, d, function (r) {
|
426 |
-
if (r != -1) {
|
427 |
-
window.location.href = r;
|
428 |
-
} else {
|
429 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Theme Options could not be updated.</div>');
|
430 |
-
}
|
431 |
-
});
|
432 |
-
return false;
|
433 |
-
},
|
434 |
-
reset_options: function () {
|
435 |
-
var d = {
|
436 |
-
action: "option_tree_array_reset",
|
437 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
438 |
-
};
|
439 |
-
$.post(ajaxurl, d, function (r) {
|
440 |
-
if (r != -1) {
|
441 |
-
$('.screenshot').hide();
|
442 |
-
$(':input','#the-theme-options')
|
443 |
-
.not(':button, :submit, :reset, :hidden, #active_theme_layout')
|
444 |
-
.val('')
|
445 |
-
.removeAttr('checked')
|
446 |
-
.removeAttr('selected');
|
447 |
-
$('.select').each(function () {
|
448 |
-
var parent = $(this).parents('div');
|
449 |
-
var new_text = '-- Choose One --';
|
450 |
-
if ( parent.hasClass('measurement') )
|
451 |
-
new_text = ' --';
|
452 |
-
if ( parent.hasClass('background-repeat') )
|
453 |
-
new_text = 'background-repeat';
|
454 |
-
if ( parent.hasClass('background-attachment') )
|
455 |
-
new_text = 'background-attachment';
|
456 |
-
if ( parent.hasClass('background-position') )
|
457 |
-
new_text = 'background-position';
|
458 |
-
if ( parent.hasClass('typography-family') )
|
459 |
-
new_text = 'font-family';
|
460 |
-
if ( parent.hasClass('typography-style') )
|
461 |
-
new_text = 'font-style';
|
462 |
-
if ( parent.hasClass('typography-variant') )
|
463 |
-
new_text = 'font-variant';
|
464 |
-
if ( parent.hasClass('typography-weight') )
|
465 |
-
new_text = 'font-weight';
|
466 |
-
if ( parent.hasClass('typography-size') )
|
467 |
-
new_text = 'font-size';
|
468 |
-
$(this).prev('span').html(new_text);
|
469 |
-
});
|
470 |
-
$('ul.option-tree-slider-wrap li').each(function () {
|
471 |
-
$(this).remove();
|
472 |
-
});
|
473 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Theme Options were deleted</div>');
|
474 |
-
} else {
|
475 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Theme Options could not be deleted</div>');
|
476 |
-
}
|
477 |
-
});
|
478 |
-
return false;
|
479 |
-
},
|
480 |
-
save_layout: function(e){
|
481 |
-
var d = {
|
482 |
-
action: "option_tree_save_layout"
|
483 |
-
};
|
484 |
-
var aa = $(':input', '#save-layout').val();
|
485 |
-
if ( !aa ) {
|
486 |
-
aa = 'default';
|
487 |
-
}
|
488 |
-
var ab = aa.replace(' ', '-');
|
489 |
-
ab = ab.toLowerCase();
|
490 |
-
|
491 |
-
b = $(':input', '#save-layout').serialize();
|
492 |
-
d = b + "&" + $.param(d);
|
493 |
-
$.post(ajaxurl, d, function (r) {
|
494 |
-
if (r != -1) {
|
495 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Layout Saved Successfully.</div>');
|
496 |
-
$("#saved-options > tbody").prepend("<tr id='saved-"+ab+"'><td class='col-title'>"+aa+"</td><td class='col-key>'><textarea>"+r+"</textarea></td><td class='col-edit' style='padding-left:10px !important; width: 55px;'><a href='#' class='activate-saved' alt='Activate'>Activate</a><a href='#' class='delete-saved' alt='Delete'>Delete</a></td></tr>");
|
497 |
-
inlineEditOption.update_export_layout();
|
498 |
-
$('tr').removeClass('active-layout');
|
499 |
-
$('#layout-settings tr:first').addClass('active-layout');
|
500 |
-
$('.empty-layouts').remove();
|
501 |
-
} else {
|
502 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Your Layout could not be saved.</div>');
|
503 |
-
}
|
504 |
-
});
|
505 |
-
return false;
|
506 |
-
},
|
507 |
-
save_layout_user_side: function(b) {
|
508 |
-
d = {
|
509 |
-
action: "option_tree_save_layout",
|
510 |
-
options_name: $("#save_theme_layout").val(),
|
511 |
-
_ajax_nonce: $("#_ajax_nonce").val(),
|
512 |
-
themes: true
|
513 |
-
};
|
514 |
-
if ( $("#save_theme_layout").val() == '' ) {
|
515 |
-
return false;
|
516 |
-
}
|
517 |
-
$.post(ajaxurl, d, function (r) {
|
518 |
-
if (r != -1) {
|
519 |
-
window.location.href = r;
|
520 |
-
} else {
|
521 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Your Layout could not be saved.</div>');
|
522 |
-
}
|
523 |
-
});
|
524 |
-
},
|
525 |
-
activate_layout: function (b) {
|
526 |
-
var c = true;
|
527 |
-
|
528 |
-
// Set ID
|
529 |
-
c = $(b).parents("tr:first").attr('id');
|
530 |
-
c = c.replace("saved-", "");
|
531 |
-
|
532 |
-
d = {
|
533 |
-
action: "option_tree_activate_layout",
|
534 |
-
id: c,
|
535 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
536 |
-
};
|
537 |
-
$.post(ajaxurl, d, function (r) {
|
538 |
-
if (r != -1) {
|
539 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Your Layout has been activated.</div>');
|
540 |
-
inlineEditOption.update_export_data();
|
541 |
-
inlineEditOption.update_export_layout();
|
542 |
-
$('tr').removeClass('active-layout');
|
543 |
-
$('#'+$(b).parents("tr:first").attr('id')).addClass('active-layout');
|
544 |
-
} else {
|
545 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
546 |
-
}
|
547 |
-
});
|
548 |
-
return false;
|
549 |
-
},
|
550 |
-
activate_layout_user_side: function(b) {
|
551 |
-
d = {
|
552 |
-
action: "option_tree_activate_layout",
|
553 |
-
id: $("#active_theme_layout").val(),
|
554 |
-
_ajax_nonce: $("#_ajax_nonce").val(),
|
555 |
-
themes: true
|
556 |
-
};
|
557 |
-
$.post(ajaxurl, d, function (r) {
|
558 |
-
if (r != -1) {
|
559 |
-
window.location.href = r;
|
560 |
-
} else {
|
561 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Theme Options could not be saved</div>');
|
562 |
-
}
|
563 |
-
});
|
564 |
-
},
|
565 |
-
delete_layout: function (b) {
|
566 |
-
var c = true;
|
567 |
-
|
568 |
-
// Set ID
|
569 |
-
c = $(b).parents("tr:first").attr('id');
|
570 |
-
c = c.replace("saved-", "");
|
571 |
-
|
572 |
-
d = {
|
573 |
-
action: "option_tree_delete_layout",
|
574 |
-
id: c,
|
575 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
576 |
-
};
|
577 |
-
$.post(ajaxurl, d, function (r) {
|
578 |
-
if (r != -1) {
|
579 |
-
$("#saved-" + c).remove();
|
580 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Your Layout has been deleted.</div>');
|
581 |
-
inlineEditOption.update_export_layout();
|
582 |
-
} else {
|
583 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
584 |
-
}
|
585 |
-
});
|
586 |
-
return false;
|
587 |
-
},
|
588 |
-
import_layout: function (e) {
|
589 |
-
var d = {
|
590 |
-
action: "option_tree_import_layout"
|
591 |
-
};
|
592 |
-
b = $(':input', '#import-layout').serialize();
|
593 |
-
d = b + "&" + $.param(d);
|
594 |
-
$.post(ajaxurl, d, function (r) {
|
595 |
-
if (r != -1) {
|
596 |
-
window.location.href = r;
|
597 |
-
} else {
|
598 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Your Layouts could not be imported.</div>');
|
599 |
-
}
|
600 |
-
});
|
601 |
-
return false;
|
602 |
-
},
|
603 |
-
update_export_layout: function () {
|
604 |
-
var d = {
|
605 |
-
action: "option_tree_update_export_layout",
|
606 |
-
saved: $("textarea#export_layouts").val(),
|
607 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
608 |
-
};
|
609 |
-
$.post(ajaxurl, d, function (r) {
|
610 |
-
if (r != -1) {
|
611 |
-
$("textarea#export_layouts").val(r);
|
612 |
-
}
|
613 |
-
});
|
614 |
-
return false;
|
615 |
-
},
|
616 |
-
import_data: function (e) {
|
617 |
-
var d = {
|
618 |
-
action: "option_tree_import_data"
|
619 |
-
};
|
620 |
-
b = $(':input', '#import-data').serialize();
|
621 |
-
d = b + "&" + $.param(d);
|
622 |
-
$.post(ajaxurl, d, function (r) {
|
623 |
-
if (r != -1) {
|
624 |
-
$("textarea#import_options_data").val('');
|
625 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Your Theme Options data was successfully imported.</div>');
|
626 |
-
inlineEditOption.update_export_data();
|
627 |
-
} else {
|
628 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>Your Theme Options data could not be imported.</div>');
|
629 |
-
}
|
630 |
-
});
|
631 |
-
return false;
|
632 |
-
},
|
633 |
-
update_export_data: function () {
|
634 |
-
var d = {
|
635 |
-
action: "option_tree_update_export_data",
|
636 |
-
saved: $("textarea#export_data").val(),
|
637 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
638 |
-
};
|
639 |
-
$.post(ajaxurl, d, function (r) {
|
640 |
-
if (r != -1) {
|
641 |
-
$("textarea#export_data").val(r);
|
642 |
-
$('.active-layout textarea').val(r);
|
643 |
-
}
|
644 |
-
});
|
645 |
-
return false;
|
646 |
-
},
|
647 |
-
remove: function (b) {
|
648 |
-
var c = true;
|
649 |
-
|
650 |
-
// Set ID
|
651 |
-
c = $(b).parents("tr:first").attr('id');
|
652 |
-
c = c.substr(c.lastIndexOf("-") + 1);
|
653 |
-
|
654 |
-
d = {
|
655 |
-
action: "option_tree_delete",
|
656 |
-
id: c,
|
657 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
658 |
-
};
|
659 |
-
$.post(ajaxurl, d, function (r) {
|
660 |
-
if (r) {
|
661 |
-
if (r == 'removed') {
|
662 |
-
$("#option-" + c).remove();
|
663 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Option Deleted.</div>');
|
664 |
-
} else {
|
665 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
666 |
-
}
|
667 |
-
} else {
|
668 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
669 |
-
}
|
670 |
-
});
|
671 |
-
return false;
|
672 |
-
},
|
673 |
-
add: function (c) {
|
674 |
-
var e = this,
|
675 |
-
addRow, editRow = true, temp_select;
|
676 |
-
e.revert();
|
677 |
-
|
678 |
-
// Clone the blank main row
|
679 |
-
addRow = $('#inline-add').clone(true);
|
680 |
-
addRow = $(addRow).attr('id', 'option-'+c);
|
681 |
-
|
682 |
-
// Clone the blank edit row
|
683 |
-
editRow = $('#inline-edit').clone(true);
|
684 |
-
|
685 |
-
$('a.cancel', editRow).addClass('undo-add');
|
686 |
-
$('a.save', editRow).addClass('add-save');
|
687 |
-
$('a.edit-inline').addClass('disable');
|
688 |
-
$('a.delete-inline').addClass('disable');
|
689 |
-
$('a.add-option').addClass('disable');
|
690 |
-
|
691 |
-
// Set Colspan to 4
|
692 |
-
$('td', editRow).attr('colspan', 4);
|
693 |
-
|
694 |
-
// Add Row
|
695 |
-
$("#framework-settings tr:last").after(addRow);
|
696 |
-
|
697 |
-
// Add Row and hide
|
698 |
-
$(addRow).hide().after(editRow);
|
699 |
-
|
700 |
-
$('.item-data', addRow).attr('id', 'inline_'+c);
|
701 |
-
|
702 |
-
// Show The Editor
|
703 |
-
$(editRow).attr('id', 'edit-'+c).addClass('inline-editor').show();
|
704 |
-
|
705 |
-
$('.item_title', '#edit-'+c).focus();
|
706 |
-
|
707 |
-
$('.select').each(function () {
|
708 |
-
temp_select = $(this).prev('span').text();
|
709 |
-
if (temp_select == 'Heading') {
|
710 |
-
$('.option-desc', '#edit-'+c).hide();
|
711 |
-
$('.option-options', '#edit-'+c).hide();
|
712 |
-
}
|
713 |
-
});
|
714 |
-
|
715 |
-
$('.select').live('change', function () {
|
716 |
-
temp_select = $(this).prev('span').text();
|
717 |
-
if (temp_select == 'Heading') {
|
718 |
-
$('.option-desc', '#edit-'+c).hide();
|
719 |
-
$('.option-options', '#edit-'+c).hide();
|
720 |
-
} else if (
|
721 |
-
temp_select == 'Checkbox' ||
|
722 |
-
temp_select == 'Radio' ||
|
723 |
-
temp_select == 'Select'
|
724 |
-
) {
|
725 |
-
$('.alternative').hide();
|
726 |
-
$('.regular').show();
|
727 |
-
$('.option-desc', '#edit-'+c).show();
|
728 |
-
$('.option-options', '#edit-'+c).show();
|
729 |
-
} else {
|
730 |
-
if (temp_select == 'Textarea' || temp_select == 'CSS') {
|
731 |
-
$('.regular').hide();
|
732 |
-
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
733 |
-
$('.option-desc', '#edit-'+c).show();
|
734 |
-
$('.option-options', '#edit-'+c).show();
|
735 |
-
} else if (
|
736 |
-
temp_select == 'Custom Post' ||
|
737 |
-
temp_select == 'Custom Posts'
|
738 |
-
) {
|
739 |
-
$('.regular').hide();
|
740 |
-
$('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
|
741 |
-
$('.option-desc', '#edit-'+c).show();
|
742 |
-
$('.option-options', '#edit-'+c).show();
|
743 |
-
} else {
|
744 |
-
$('.option-desc', '#edit-'+c).show();
|
745 |
-
$('.option-options', '#edit-'+c).hide();
|
746 |
-
}
|
747 |
-
}
|
748 |
-
});
|
749 |
-
|
750 |
-
// Scroll
|
751 |
-
var $elem = $('#framework_wrap');
|
752 |
-
$('html, body').animate({ scrollTop: $elem.height() }, 500);
|
753 |
-
|
754 |
-
return false;
|
755 |
-
},
|
756 |
-
undoAdd: function (b) {
|
757 |
-
var e = this,
|
758 |
-
c = true;
|
759 |
-
e.revert();
|
760 |
-
c = $("#framework-settings tr:last").attr('id');
|
761 |
-
c = c.substr(c.lastIndexOf("-") + 1);
|
762 |
-
|
763 |
-
$("a.edit-inline").removeClass('disable');
|
764 |
-
$("a.delete-inline").removeClass('disable');
|
765 |
-
$("a.add-option").removeClass('disable');
|
766 |
-
$("#option-" + c).remove();
|
767 |
-
|
768 |
-
return false;
|
769 |
-
},
|
770 |
-
addSave: function (e) {
|
771 |
-
var d, b, c, f, g, itemId;
|
772 |
-
e = $("tr.inline-editor").attr("id");
|
773 |
-
e = e.substr(e.lastIndexOf("-") + 1);
|
774 |
-
f = $("#edit-" + e);
|
775 |
-
g = $("#inline_" + e);
|
776 |
-
itemId = $.trim($("input.item_id", f).val().toLowerCase()).replace(/(\s+)/g,'_');
|
777 |
-
if (!itemId) {
|
778 |
-
itemId = $.trim($("input.item_title", f).val().toLowerCase()).replace(/(\s+)/g,'_');
|
779 |
-
}
|
780 |
-
d = {
|
781 |
-
action: "option_tree_add",
|
782 |
-
id: e,
|
783 |
-
item_id: itemId,
|
784 |
-
item_title: $("input.item_title", f).val(),
|
785 |
-
item_desc: $("textarea.item_desc", f).val(),
|
786 |
-
item_type: $("select.item_type", f).val(),
|
787 |
-
item_options: $("input.item_options", f).val()
|
788 |
-
};
|
789 |
-
b = $("#edit-" + e + " :input").serialize();
|
790 |
-
d = b + "&" + $.param(d);
|
791 |
-
$.post(ajaxurl, d, function (r) {
|
792 |
-
if (r) {
|
793 |
-
if (r == 'updated') {
|
794 |
-
inlineEditOption.afterSave(e);
|
795 |
-
$("#edit-" + e).remove();
|
796 |
-
$("#option-" + e).show();
|
797 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Option Added.</div>');
|
798 |
-
$('#framework-settings').tableDnD({
|
799 |
-
onDragClass: "dragging",
|
800 |
-
onDrop: function(table, row) {
|
801 |
-
d = {
|
802 |
-
action: "option_tree_sort",
|
803 |
-
id: $.tableDnD.serialize(),
|
804 |
-
_ajax_nonce: $("#_ajax_nonce").val()
|
805 |
-
};
|
806 |
-
$.post(ajaxurl, d, function (response) {
|
807 |
-
|
808 |
-
}, "html");
|
809 |
-
}
|
810 |
-
});
|
811 |
-
} else {
|
812 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
813 |
-
}
|
814 |
-
} else {
|
815 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
816 |
-
}
|
817 |
-
});
|
818 |
-
return false;
|
819 |
-
},
|
820 |
-
edit: function (b) {
|
821 |
-
var e = this,
|
822 |
-
c, editRow, rowData, item_title, item_id, item_type, item_desc, item_options = true, temp_select;
|
823 |
-
e.revert();
|
824 |
-
|
825 |
-
c = $(b).parents("tr:first").attr('id');
|
826 |
-
c = c.substr(c.lastIndexOf("-") + 1);
|
827 |
-
|
828 |
-
// Clone the blank row
|
829 |
-
editRow = $('#inline-edit').clone(true);
|
830 |
-
$('td', editRow).attr('colspan', 4);
|
831 |
-
$("#option-" + c).hide().after(editRow);
|
832 |
-
|
833 |
-
// First Option Settings
|
834 |
-
if ("#option-" + c == '#option-1') {
|
835 |
-
$('.option').hide();
|
836 |
-
$('.option-title').show().css({"paddingBottom":"1px"});
|
837 |
-
$('.description', editRow).html('First item must be a heading.');
|
838 |
-
}
|
839 |
-
|
840 |
-
// Populate the option data
|
841 |
-
rowData = $('#inline_' + c);
|
842 |
-
|
843 |
-
// Item Title
|
844 |
-
item_title = $('.item_title', rowData).text();
|
845 |
-
$('.item_title', editRow).attr('value', item_title);
|
846 |
-
|
847 |
-
// Item ID
|
848 |
-
item_id = $('.item_id', rowData).text();
|
849 |
-
$('.item_id', editRow).attr('value', item_id);
|
850 |
-
|
851 |
-
// Item Type
|
852 |
-
item_type = $('.item_type', rowData).text();
|
853 |
-
$('select[name=item_type] option[value='+item_type+']', editRow).attr('selected', true);
|
854 |
-
var temp_item_type = $('select[name=item_type] option[value='+item_type+']', editRow).text();
|
855 |
-
$('.select_wrapper span', editRow).text(temp_item_type);
|
856 |
-
|
857 |
-
// Item Description
|
858 |
-
item_desc = $('.item_desc', rowData).text();
|
859 |
-
$('.item_desc', editRow).attr('value', item_desc);
|
860 |
-
|
861 |
-
// Item Options
|
862 |
-
item_options = $('.item_options', rowData).text();
|
863 |
-
$('.item_options', editRow).attr('value', item_options);
|
864 |
-
|
865 |
-
|
866 |
-
$('.select', editRow).each(function () {
|
867 |
-
temp_select = $(this).prev('span').text();
|
868 |
-
if (temp_select == 'Heading') {
|
869 |
-
$('.option-desc', editRow).hide();
|
870 |
-
$('.option-options', editRow).hide();
|
871 |
-
} else if (
|
872 |
-
temp_select == 'Checkbox' ||
|
873 |
-
temp_select == 'Radio' ||
|
874 |
-
temp_select == 'Select'
|
875 |
-
) {
|
876 |
-
$('.option-desc', editRow).show();
|
877 |
-
$('.option-options', editRow).show();
|
878 |
-
} else {
|
879 |
-
if (temp_select == 'Textarea' || temp_select == 'CSS') {
|
880 |
-
$('.regular').hide();
|
881 |
-
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
882 |
-
$('.option-desc', editRow).show();
|
883 |
-
$('.option-options', editRow).show();
|
884 |
-
} else if (
|
885 |
-
temp_select == 'Custom Post' ||
|
886 |
-
temp_select == 'Custom Posts'
|
887 |
-
) {
|
888 |
-
$('.regular').hide();
|
889 |
-
$('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
|
890 |
-
$('.option-desc', editRow).show();
|
891 |
-
$('.option-options', editRow).show();
|
892 |
-
} else {
|
893 |
-
$('.option-desc', editRow).show();
|
894 |
-
$('.option-options', editRow).hide();
|
895 |
-
}
|
896 |
-
}
|
897 |
-
});
|
898 |
-
|
899 |
-
$('.select').live('change', function () {
|
900 |
-
temp_select = $(this).prev('span').text();
|
901 |
-
if (temp_select == 'Heading') {
|
902 |
-
$('.option-desc', editRow).hide();
|
903 |
-
$('.option-options', editRow).hide();
|
904 |
-
} else if (
|
905 |
-
temp_select == 'Checkbox' ||
|
906 |
-
temp_select == 'Radio' ||
|
907 |
-
temp_select == 'Select'
|
908 |
-
) {
|
909 |
-
$('.alternative').hide();
|
910 |
-
$('.regular').show();
|
911 |
-
$('.option-desc', editRow).show();
|
912 |
-
$('.option-options', editRow).show();
|
913 |
-
} else {
|
914 |
-
if (temp_select == 'Textarea' || temp_select == 'CSS') {
|
915 |
-
$('.regular').hide();
|
916 |
-
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
917 |
-
$('.option-desc', editRow).show();
|
918 |
-
$('.option-options', editRow).show();
|
919 |
-
} else if (
|
920 |
-
temp_select == 'Custom Post' ||
|
921 |
-
temp_select == 'Custom Posts'
|
922 |
-
) {
|
923 |
-
$('.regular').hide();
|
924 |
-
$('.alternative').show().html('<strong>Post Type:</strong> Enter your custom post_type.');
|
925 |
-
$('.option-desc', editRow).show();
|
926 |
-
$('.option-options', editRow).show();
|
927 |
-
} else {
|
928 |
-
$('.option-desc', editRow).show();
|
929 |
-
$('.option-options', editRow).hide();
|
930 |
-
}
|
931 |
-
}
|
932 |
-
});
|
933 |
-
|
934 |
-
// Show The Editor
|
935 |
-
$(editRow).attr('id', 'edit-'+c).addClass('inline-editor').show();
|
936 |
-
|
937 |
-
// Scroll
|
938 |
-
var target = $('#edit-'+c);
|
939 |
-
if (c > 1) {
|
940 |
-
var top = target.offset().top;
|
941 |
-
$('html,body').animate({scrollTop: top}, 500);
|
942 |
-
return false;
|
943 |
-
}
|
944 |
-
|
945 |
-
return false;
|
946 |
-
},
|
947 |
-
editSave: function (e) {
|
948 |
-
var d, b, c, f, g, itemId;
|
949 |
-
e = $("tr.inline-editor").attr("id");
|
950 |
-
e = e.substr(e.lastIndexOf("-") + 1);
|
951 |
-
f = $("#edit-" + e);
|
952 |
-
g = $("#inline_" + e);
|
953 |
-
itemId = $.trim($("input.item_id", f).val().toLowerCase()).replace(/(\s+)/g,'_');
|
954 |
-
if (!itemId) {
|
955 |
-
itemId = $.trim($("input.item_title", f).val().toLowerCase()).replace(/(\s+)/g,'_');
|
956 |
-
}
|
957 |
-
d = {
|
958 |
-
action: "option_tree_edit",
|
959 |
-
id: e,
|
960 |
-
item_id: itemId,
|
961 |
-
item_title: $("input.item_title", f).val(),
|
962 |
-
item_desc: $("textarea.item_desc", f).val(),
|
963 |
-
item_type: $("select.item_type", f).val(),
|
964 |
-
item_options: $("input.item_options", f).val()
|
965 |
-
};
|
966 |
-
b = $("#edit-" + e + " :input").serialize();
|
967 |
-
d = b + "&" + $.param(d);
|
968 |
-
$.post(ajaxurl, d, function (r) {
|
969 |
-
if (r) {
|
970 |
-
if (r == 'updated') {
|
971 |
-
inlineEditOption.afterSave(e);
|
972 |
-
$("#edit-" + e).remove();
|
973 |
-
$("#option-" + e).show();
|
974 |
-
$('.ajax-message').ajaxMessage('<div class="message"><span> </span>Option Saved.</div>');
|
975 |
-
} else {
|
976 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
977 |
-
}
|
978 |
-
} else {
|
979 |
-
$('.ajax-message').ajaxMessage('<div class="message warning"><span> </span>'+r+'</div>');
|
980 |
-
}
|
981 |
-
});
|
982 |
-
return false;
|
983 |
-
},
|
984 |
-
afterSave: function (e) {
|
985 |
-
var x, y, z,
|
986 |
-
n, m, o, p, q, r = true;
|
987 |
-
x = $("#edit-" + e);
|
988 |
-
y = $("#option-" + e);
|
989 |
-
z = $("#inline_" + e);
|
990 |
-
$('.option').show();
|
991 |
-
$('a.cancel', x).removeClass('undo-add');
|
992 |
-
$('a.save', x).removeClass('add-save');
|
993 |
-
$("a.add-option").removeClass('disable');
|
994 |
-
$('a.edit-inline').removeClass('disable');
|
995 |
-
$('a.delete-inline').removeClass('disable');
|
996 |
-
if (n = $("input.item_title", x).val()) {
|
997 |
-
if ($("select.item_type", x).val() != 'heading') {
|
998 |
-
$(y).removeClass('col-heading');
|
999 |
-
$('.col-title', y).attr('colspan', 1);
|
1000 |
-
$(".col-key", y).show();
|
1001 |
-
$(".col-type", y).show();
|
1002 |
-
$(".col-title", y).text('- ' + n);
|
1003 |
-
} else {
|
1004 |
-
$(y).addClass('col-heading');
|
1005 |
-
$('.col-title', y).attr('colspan', 3);
|
1006 |
-
$(".col-key", y).hide();
|
1007 |
-
$(".col-type", y).hide();
|
1008 |
-
$(".col-title", y).text(n);
|
1009 |
-
}
|
1010 |
-
$(".item_title", z).text(n);
|
1011 |
-
}
|
1012 |
-
if (m = $.trim($("input.item_id", x).val().toLowerCase()).replace(/(\s+)/g,'_')) {
|
1013 |
-
$(".col-key", y).text(m);
|
1014 |
-
$(".item_id", z).text(m);
|
1015 |
-
} else {
|
1016 |
-
m = $.trim($("input.item_title", x).val().toLowerCase()).replace(/(\s+)/g,'_');
|
1017 |
-
$(".col-key", y).text(m);
|
1018 |
-
$(".item_id", z).text(m);
|
1019 |
-
}
|
1020 |
-
if (o = $("select.item_type option:selected", x).val()) {
|
1021 |
-
$(".col-type", y).text(o);
|
1022 |
-
$(".item_type", z).text(o);
|
1023 |
-
}
|
1024 |
-
if (p = $("textarea.item_desc", x).val()) {
|
1025 |
-
$(".item_desc", z).text(p);
|
1026 |
-
}
|
1027 |
-
if (r = $("input.item_options", x).val()) {
|
1028 |
-
$(".item_options", z).text(r);
|
1029 |
-
}
|
1030 |
-
},
|
1031 |
-
revert: function () {
|
1032 |
-
var b,
|
1033 |
-
n, m, o, p, q, r = true;
|
1034 |
-
if (b = $(".inline-editor").attr("id")) {
|
1035 |
-
$('#'+ b).remove();
|
1036 |
-
b = b.substr(b.lastIndexOf("-") + 1);
|
1037 |
-
$('.option').show();
|
1038 |
-
$("#option-" + b).show();
|
1039 |
-
}
|
1040 |
-
return false;
|
1041 |
-
}
|
1042 |
-
};
|
1043 |
-
$(document).ready(function () {
|
1044 |
-
inlineEditOption.init();
|
1045 |
-
})
|
1046 |
-
})(jQuery);
|
1047 |
-
|
1048 |
-
/**
|
1049 |
-
*
|
1050 |
-
* Image Slider
|
1051 |
-
*
|
1052 |
-
* Creates & Updates Image Slider
|
1053 |
-
* Dependencies: jQuery, jQuery UI
|
1054 |
-
*
|
1055 |
-
*/
|
1056 |
-
(function ($) {
|
1057 |
-
ImageSlider = {
|
1058 |
-
processing: false,
|
1059 |
-
init: function () {
|
1060 |
-
$(".option-tree-slider-body").hide();
|
1061 |
-
$('.option-tree-slider .edit').live('click', function(event){
|
1062 |
-
event.preventDefault();
|
1063 |
-
$('.option-tree-slider .edit').not($(this)).removeClass('down');
|
1064 |
-
$('.option-tree-slider-body').not($(this).parent().find('.option-tree-slider-body')).hide();
|
1065 |
-
$(this).toggleClass('down');
|
1066 |
-
$(this).parent().find('.option-tree-slider-body').toggle();
|
1067 |
-
});
|
1068 |
-
$('.option-tree-slider-title').live('keyup', function(){
|
1069 |
-
ImageSlider.update_slider_title(this);
|
1070 |
-
});
|
1071 |
-
$('.remove-slide').live('click', function(event){
|
1072 |
-
event.preventDefault();
|
1073 |
-
var agree = confirm("Are you sure you wish to delete this slide?");
|
1074 |
-
if (agree) {
|
1075 |
-
ImageSlider.delete_slider_image(this);
|
1076 |
-
return false;
|
1077 |
-
} else {
|
1078 |
-
return false;
|
1079 |
-
}
|
1080 |
-
});
|
1081 |
-
$('.add-slide').live('click', function(event){
|
1082 |
-
event.preventDefault();
|
1083 |
-
ImageSlider.add_slider($(this).attr('id'));
|
1084 |
-
});
|
1085 |
-
$('.option-tree-slider-wrap').each( function() {
|
1086 |
-
var id = $(this).attr('id');
|
1087 |
-
if ( $('#'+id).length ) {
|
1088 |
-
$('#'+id).sortable({
|
1089 |
-
update: function(event,ui){
|
1090 |
-
$('#'+id).find('li:not(.ui-sortable-helper)').each(function(inc){
|
1091 |
-
var target = $(this).find('a.open').attr('href').split("#")[1];
|
1092 |
-
$('#' + target).find('input.option-tree-slider-order').val(inc + 1);
|
1093 |
-
});
|
1094 |
-
}
|
1095 |
-
});
|
1096 |
-
}
|
1097 |
-
});
|
1098 |
-
},
|
1099 |
-
update_slider_title: function(e) {
|
1100 |
-
var element = e;
|
1101 |
-
if ( this.timer ) {
|
1102 |
-
clearTimeout( element.timer );
|
1103 |
-
}
|
1104 |
-
this.timer = setTimeout( function() {
|
1105 |
-
$(element).parents('.option-tree-slider').find('.open').text( element.value );
|
1106 |
-
}, 100);
|
1107 |
-
return true;
|
1108 |
-
},
|
1109 |
-
add_slider: function(id) {
|
1110 |
-
var self = this;
|
1111 |
-
if ( this.processing === false ) {
|
1112 |
-
this.processing = true;
|
1113 |
-
var image_count = parseInt($( '#'+id+'_list li' ).length) - 1;
|
1114 |
-
$.ajax({
|
1115 |
-
url: ajaxurl,
|
1116 |
-
type: 'get',
|
1117 |
-
data: {
|
1118 |
-
action: 'option_tree_add_slider',
|
1119 |
-
slide_id: id,
|
1120 |
-
count: image_count,
|
1121 |
-
page: 'option_tree'
|
1122 |
-
},
|
1123 |
-
complete: function( data ) {
|
1124 |
-
$('.option-tree-slider .edit').removeClass('down');
|
1125 |
-
$('.option-tree-slider-body').hide();
|
1126 |
-
$('#'+id+'_list').append( '<li>' + data.responseText + '</li>' );
|
1127 |
-
$('#'+id+'_list li:last .option-tree-slider .edit').toggleClass('down');
|
1128 |
-
self.processing = false;
|
1129 |
-
}
|
1130 |
-
});
|
1131 |
-
}
|
1132 |
-
},
|
1133 |
-
delete_slider_image: function(e) {
|
1134 |
-
$(e).parents('li').remove();
|
1135 |
-
}
|
1136 |
-
};
|
1137 |
-
$(document).ready(function () {
|
1138 |
-
ImageSlider.init();
|
1139 |
-
})
|
1140 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/jquery.table.dnd.js
DELETED
@@ -1,382 +0,0 @@
|
|
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 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_tabs();
|
23 |
+
this.init_radio_image_select();
|
24 |
+
this.init_select_wrapper();
|
25 |
+
this.fix_upload_parent();
|
26 |
+
this.fix_colorpicker();
|
27 |
+
this.fix_textarea();
|
28 |
+
this.replicate_ajax();
|
29 |
+
this.reset_settings();
|
30 |
+
},
|
31 |
+
init_hide_body: function(elm,type) {
|
32 |
+
var css = '.option-tree-setting-body';
|
33 |
+
if ( type == 'parent' ) {
|
34 |
+
$(css).not( elm.parent().parent().children(css) ).hide();
|
35 |
+
} else if ( type == 'child' ) {
|
36 |
+
elm.closest('ul').find(css).not( elm.parent().parent().children(css) ).hide();
|
37 |
+
} else if ( type == 'child-add' ) {
|
38 |
+
elm.children().find(css).hide();
|
39 |
+
} else if ( type == 'toggle' ) {
|
40 |
+
elm.parent().parent().children(css).toggle();
|
41 |
+
} else {
|
42 |
+
$(css).hide();
|
43 |
+
}
|
44 |
+
},
|
45 |
+
init_remove_active: function(elm,type) {
|
46 |
+
var css = '.option-tree-setting-edit';
|
47 |
+
if ( type == 'parent' ) {
|
48 |
+
$(css).not(elm).removeClass('active');
|
49 |
+
} else if ( type == 'child' ) {
|
50 |
+
elm.closest('ul').find(css).not(elm).removeClass('active');
|
51 |
+
} else if ( type == 'child-add' ) {
|
52 |
+
elm.children().find(css).removeClass('active');
|
53 |
+
} else {
|
54 |
+
$(css).removeClass('active');
|
55 |
+
}
|
56 |
+
},
|
57 |
+
init_sortable: function() {
|
58 |
+
$('.option-tree-sortable').each( function() {
|
59 |
+
if ( $(this).children('li').length ) {
|
60 |
+
var elm = $(this);
|
61 |
+
elm.show();
|
62 |
+
$(this).sortable({
|
63 |
+
items: 'li:not(.ui-state-disabled)',
|
64 |
+
placeholder: 'ui-state-highlight',
|
65 |
+
stop: function(evt, ui) {
|
66 |
+
setTimeout(
|
67 |
+
function(){
|
68 |
+
OT_UI.update_ids(elm);
|
69 |
+
},
|
70 |
+
200
|
71 |
+
)
|
72 |
+
}
|
73 |
+
});
|
74 |
+
$(this).children('li').disableSelection();
|
75 |
+
}
|
76 |
+
});
|
77 |
+
},
|
78 |
+
init_add: function() {
|
79 |
+
$('.option-tree-section-add').live('click', function(e) {
|
80 |
+
e.preventDefault();
|
81 |
+
OT_UI.add(this,'section');
|
82 |
+
});
|
83 |
+
$('.option-tree-setting-add').live('click', function(e) {
|
84 |
+
e.preventDefault();
|
85 |
+
OT_UI.add(this,'setting');
|
86 |
+
});
|
87 |
+
$('.option-tree-help-add').live('click', function(e) {
|
88 |
+
e.preventDefault();
|
89 |
+
OT_UI.add(this,'contextual_help');
|
90 |
+
});
|
91 |
+
$('.option-tree-choice-add').live('click', function(e) {
|
92 |
+
e.preventDefault();
|
93 |
+
OT_UI.add(this,'choice');
|
94 |
+
});
|
95 |
+
$('.option-tree-list-item-add').live('click', function(e) {
|
96 |
+
e.preventDefault();
|
97 |
+
OT_UI.add(this,'list_item');
|
98 |
+
});
|
99 |
+
$('.option-tree-list-item-setting-add').live('click', function(e) {
|
100 |
+
e.preventDefault();
|
101 |
+
if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
|
102 |
+
alert(option_tree.setting_limit);
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
OT_UI.add(this,'list_item_setting');
|
106 |
+
});
|
107 |
+
},
|
108 |
+
init_edit: function() {
|
109 |
+
$('.option-tree-setting-edit').live('click', function(e) {
|
110 |
+
e.preventDefault();
|
111 |
+
if ( $(this).parents().hasClass('option-tree-setting-body') ) {
|
112 |
+
OT_UI.init_remove_active($(this),'child');
|
113 |
+
OT_UI.init_hide_body($(this),'child');
|
114 |
+
} else {
|
115 |
+
OT_UI.init_remove_active($(this),'parent');
|
116 |
+
OT_UI.init_hide_body($(this), 'parent');
|
117 |
+
}
|
118 |
+
$(this).toggleClass('active');
|
119 |
+
OT_UI.init_hide_body($(this), 'toggle');
|
120 |
+
});
|
121 |
+
},
|
122 |
+
init_remove: function() {
|
123 |
+
$('.option-tree-setting-remove').live('click', function(event) {
|
124 |
+
event.preventDefault();
|
125 |
+
if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
|
126 |
+
alert(option_tree.remove_no);
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
var agree = confirm(option_tree.remove_agree);
|
130 |
+
if (agree) {
|
131 |
+
var list = $(this).parents('ul');
|
132 |
+
OT_UI.remove(this);
|
133 |
+
setTimeout( function() {
|
134 |
+
OT_UI.update_ids(list);
|
135 |
+
}, 200 );
|
136 |
+
}
|
137 |
+
return false;
|
138 |
+
});
|
139 |
+
},
|
140 |
+
init_edit_title: function() {
|
141 |
+
$('.option-tree-setting-title').live('keyup', function() {
|
142 |
+
OT_UI.edit_title(this);
|
143 |
+
});
|
144 |
+
},
|
145 |
+
init_edit_id: function() {
|
146 |
+
$('.section-id').live('keyup', function(){
|
147 |
+
OT_UI.update_id(this);
|
148 |
+
});
|
149 |
+
},
|
150 |
+
init_activate_layout: function() {
|
151 |
+
$('.option-tree-layout-activate').live('click', function() {
|
152 |
+
var active = $(this).parents('.option-tree-setting').find('.open').text();
|
153 |
+
$('.option-tree-layout-activate').removeClass('active');
|
154 |
+
$(this).toggleClass('active');
|
155 |
+
$('.active-layout-input').attr({'value':active});
|
156 |
+
});
|
157 |
+
$('#option-tree-options-layouts-form select').live('change', function() {
|
158 |
+
var agree = confirm(option_tree.activate_layout_agree);
|
159 |
+
if (agree) {
|
160 |
+
$('#option-tree-options-layouts-form').submit();
|
161 |
+
} else {
|
162 |
+
var active = $('#the_current_layout').attr('value');
|
163 |
+
$('#option-tree-options-layouts-form select option[value="' + active + '"]').attr({'selected':'selected'});
|
164 |
+
$('#option-tree-options-layouts-form select').prev('span').replaceWith('<span>' + active + '</span>');
|
165 |
+
}
|
166 |
+
});
|
167 |
+
},
|
168 |
+
add: function(elm,type) {
|
169 |
+
var self = this,
|
170 |
+
list = '',
|
171 |
+
list_class = '',
|
172 |
+
name = '',
|
173 |
+
post_id = 0,
|
174 |
+
get_option = '',
|
175 |
+
settings = '';
|
176 |
+
if ( type == 'contextual_help' ) {
|
177 |
+
list = $(elm).parent().find('ul:last');
|
178 |
+
list_class = 'list-contextual-help';
|
179 |
+
} else if ( type == 'choice' ) {
|
180 |
+
list = $(elm).parent().children('ul');
|
181 |
+
list_class = 'list-choice';
|
182 |
+
} else if ( type == 'list_item' ) {
|
183 |
+
list = $(elm).parent().children('ul');
|
184 |
+
list_class = 'list-sub-setting';
|
185 |
+
} else if ( type == 'list_item_setting' ) {
|
186 |
+
list = $(elm).parent().children('ul');
|
187 |
+
list_class = 'list-sub-setting';
|
188 |
+
} else {
|
189 |
+
list = $(elm).parent().find('ul:first');
|
190 |
+
list_class = ( type == 'section' ) ? 'list-section' : 'list-setting';
|
191 |
+
}
|
192 |
+
name = list.data('name');
|
193 |
+
post_id = list.data('id');
|
194 |
+
get_option = list.data('getOption');
|
195 |
+
settings = $('#'+name+'_settings_array').val();
|
196 |
+
if ( this.processing === false ) {
|
197 |
+
this.processing = true;
|
198 |
+
var count = parseInt(list.children('li').length);
|
199 |
+
$.ajax({
|
200 |
+
url: option_tree.ajax,
|
201 |
+
type: 'get',
|
202 |
+
data: {
|
203 |
+
action: 'add_' + type,
|
204 |
+
count: count,
|
205 |
+
name: name,
|
206 |
+
post_id: post_id,
|
207 |
+
get_option: get_option,
|
208 |
+
settings: settings,
|
209 |
+
type: type
|
210 |
+
},
|
211 |
+
complete: function( data ) {
|
212 |
+
if ( type == 'choice' || type == 'list_item_setting' ) {
|
213 |
+
OT_UI.init_remove_active(list,'child-add');
|
214 |
+
OT_UI.init_hide_body(list,'child-add');
|
215 |
+
} else {
|
216 |
+
OT_UI.init_remove_active();
|
217 |
+
OT_UI.init_hide_body();
|
218 |
+
}
|
219 |
+
list.append('<li class="ui-state-default ' + list_class + '">' + data.responseText + '</li>');
|
220 |
+
list.children().last().find('.option-tree-setting-edit').toggleClass('active');
|
221 |
+
list.children().last().find('.option-tree-setting-body').toggle();
|
222 |
+
list.children().last().find('.option-tree-setting-title').focus();
|
223 |
+
if ( type != 'contextual_help' ) {
|
224 |
+
OT_UI.update_ids(list);
|
225 |
+
}
|
226 |
+
setTimeout( function() {
|
227 |
+
OT_UI.init_sortable();
|
228 |
+
OT_UI.init_select_wrapper();
|
229 |
+
}, 500);
|
230 |
+
self.processing = false;
|
231 |
+
}
|
232 |
+
});
|
233 |
+
}
|
234 |
+
},
|
235 |
+
remove: function(e) {
|
236 |
+
$(e).parent().parent().parent('li').remove();
|
237 |
+
},
|
238 |
+
edit_title: function(e) {
|
239 |
+
if ( this.timer ) {
|
240 |
+
clearTimeout(e.timer);
|
241 |
+
}
|
242 |
+
this.timer = setTimeout( function() {
|
243 |
+
$(e).parent().parent().parent().parent().parent().children('.open').text(e.value);
|
244 |
+
}, 100);
|
245 |
+
return true;
|
246 |
+
},
|
247 |
+
update_id: function(e) {
|
248 |
+
if ( this.timer ) {
|
249 |
+
clearTimeout(e.timer);
|
250 |
+
}
|
251 |
+
this.timer = setTimeout( function() {
|
252 |
+
OT_UI.update_ids($(e).parents('ul'));
|
253 |
+
}, 100);
|
254 |
+
return true;
|
255 |
+
},
|
256 |
+
update_ids: function(list) {
|
257 |
+
var last_section, section, list_items = list.children('li');
|
258 |
+
list_items.each(function(index) {
|
259 |
+
if ( $(this).hasClass('list-section') ) {
|
260 |
+
section = $(this).find('.section-id').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
|
261 |
+
if (!section) {
|
262 |
+
section = $(this).find('.section-title').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
|
263 |
+
}
|
264 |
+
if (!section) {
|
265 |
+
section = last_section;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
if ($(this).hasClass('list-setting') ) {
|
269 |
+
$(this).find('.hidden-section').attr({'value':section});
|
270 |
+
}
|
271 |
+
last_section = section;
|
272 |
+
});
|
273 |
+
},
|
274 |
+
init_upload: function() {
|
275 |
+
$('.ot_upload_media').live('click', function() {
|
276 |
+
var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
|
277 |
+
post_id = $(this).attr('rel'),
|
278 |
+
backup = window.send_to_editor,
|
279 |
+
btnContent = '',
|
280 |
+
intval = window.setInterval(function() {
|
281 |
+
if ( $('#TB_iframeContent').attr('src').indexOf( "&field_id=" ) !== -1 ) {
|
282 |
+
$('#TB_iframeContent').contents().find('#tab-type_url').hide();
|
283 |
+
}
|
284 |
+
$('#TB_iframeContent').contents().find('.savesend .button').val(option_tree.upload_text);
|
285 |
+
}, 50);
|
286 |
+
tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
|
287 |
+
window.send_to_editor = function(html) {
|
288 |
+
var href = $(html).attr('href');
|
289 |
+
var image = /\.(?:jpe?g|png|gif|ico)$/i;
|
290 |
+
if (OT_UI.url_exists(href)) {
|
291 |
+
if (href.match(image)) {
|
292 |
+
btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
|
293 |
+
}
|
294 |
+
btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button" title="'+option_tree.remove_media_text+'"><span class="icon trash-can">'+option_tree.remove_media_text+'</span></a>';
|
295 |
+
}
|
296 |
+
$('#'+field_id).val(href);
|
297 |
+
$('#'+field_id+'_media').remove();
|
298 |
+
$('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
|
299 |
+
$('#'+field_id+'_media').append(btnContent).slideDown();
|
300 |
+
OT_UI.fix_upload_parent();
|
301 |
+
tb_remove();
|
302 |
+
window.clearInterval(intval);
|
303 |
+
window.send_to_editor = backup;
|
304 |
+
};
|
305 |
+
return false;
|
306 |
+
});
|
307 |
+
},
|
308 |
+
init_upload_remove: function() {
|
309 |
+
$('.option-tree-ui-remove-media').live('click', function(event) {
|
310 |
+
event.preventDefault();
|
311 |
+
var agree = confirm(option_tree.remove_agree);
|
312 |
+
if (agree) {
|
313 |
+
OT_UI.remove_image(this);
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
return false;
|
317 |
+
});
|
318 |
+
},
|
319 |
+
init_upload_fix: function(elm) {
|
320 |
+
var id = $(elm).attr('id'),
|
321 |
+
val = $(elm).val(),
|
322 |
+
img = $(elm).parent().next('option-tree-ui-media-wrap').find('img'),
|
323 |
+
src = img.attr('src'),
|
324 |
+
btnContent = '';
|
325 |
+
if ( val != src ) {
|
326 |
+
img.attr('src', val);
|
327 |
+
}
|
328 |
+
if ( val !== '' && ( typeof src == 'undefined' || src == false ) && OT_UI.url_exists(val) ) {
|
329 |
+
var image = /\.(?:jpe?g|png|gif|ico)$/i;
|
330 |
+
if (val.match(image)) {
|
331 |
+
btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+val+'" alt="" /></div>';
|
332 |
+
}
|
333 |
+
btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button" title="'+option_tree.remove_media_text+'"><span class="icon trash-can">'+option_tree.remove_media_text+'</span></a>';
|
334 |
+
$('#'+id).val(val);
|
335 |
+
$('#'+id+'_media').remove();
|
336 |
+
$('#'+id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+id+'_media" />');
|
337 |
+
$('#'+id+'_media').append(btnContent).slideDown();
|
338 |
+
} else if ( val == '' || ! OT_UI.url_exists(val) ) {
|
339 |
+
$(elm).parent().next('.option-tree-ui-media-wrap').remove();
|
340 |
+
}
|
341 |
+
},
|
342 |
+
init_tabs: function() {
|
343 |
+
$(".wrap.settings-wrap .ui-tabs").tabs({
|
344 |
+
fx: {
|
345 |
+
opacity: "toggle",
|
346 |
+
duration: "fast"
|
347 |
+
}
|
348 |
+
}).bind("tabsselect", function(event, ui) {
|
349 |
+
$("input[name=\'_wp_http_referer\']").val(ui.tab);
|
350 |
+
});
|
351 |
+
},
|
352 |
+
init_radio_image_select: function() {
|
353 |
+
$('.option-tree-ui-radio-image').live('click', function() {
|
354 |
+
$('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
|
355 |
+
$(this).toggleClass('option-tree-ui-radio-image-selected');
|
356 |
+
$(this).parent().find('.option-tree-ui-radio').attr('checked', true);
|
357 |
+
});
|
358 |
+
},
|
359 |
+
init_select_wrapper: function() {
|
360 |
+
$('.option-tree-ui-select').each(function () {
|
361 |
+
if ( ! $(this).parent().hasClass('select-wrapper') ) {
|
362 |
+
$(this).wrap('<div class="select-wrapper" />');
|
363 |
+
$(this).parent('.select-wrapper.').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
|
364 |
+
}
|
365 |
+
});
|
366 |
+
$('.option-tree-ui-select').live('change', function () {
|
367 |
+
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
368 |
+
});
|
369 |
+
$('.option-tree-ui-select').bind($.browser.msie ? 'click' : 'change', function(event) {
|
370 |
+
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
371 |
+
});
|
372 |
+
},
|
373 |
+
bind_colorpicker: function(field_id) {
|
374 |
+
$('#'+field_id).ColorPicker({
|
375 |
+
onSubmit: function(hsb, hex, rgb) {
|
376 |
+
$('#'+field_id).val('#'+hex);
|
377 |
+
},
|
378 |
+
onBeforeShow: function () {
|
379 |
+
$(this).ColorPickerSetColor(this.value);
|
380 |
+
return false;
|
381 |
+
},
|
382 |
+
onChange: function (hsb, hex, rgb) {
|
383 |
+
var bc = $.inArray(hex, [ 'FFFFFF', 'FFF', 'ffffff', 'fff' ]) != -1 ? 'ccc' : hex;
|
384 |
+
$('#cp_'+field_id).css({'backgroundColor':'#'+hex,'borderColor':'#'+bc});
|
385 |
+
$('#cp_'+field_id).prev('input').attr('value', '#'+hex);
|
386 |
+
}
|
387 |
+
})
|
388 |
+
.bind('keyup', function(){
|
389 |
+
$(this).ColorPickerSetColor(this.value);
|
390 |
+
});
|
391 |
+
},
|
392 |
+
fix_upload_parent: function() {
|
393 |
+
$('.option-tree-ui-upload-input').live('focus blur', function(){
|
394 |
+
$(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
|
395 |
+
OT_UI.init_upload_fix(this);
|
396 |
+
});
|
397 |
+
},
|
398 |
+
remove_image: function(e) {
|
399 |
+
$(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
|
400 |
+
$(e).parent('.option-tree-ui-media-wrap').remove();
|
401 |
+
},
|
402 |
+
fix_colorpicker: function() {
|
403 |
+
$('.cp_input').live('blur', function() {
|
404 |
+
$('.cp_input').each( function(index, el) {
|
405 |
+
var val = $(el).val();
|
406 |
+
var reg = /^[A-Fa-f0-9]{6}$/;
|
407 |
+
if( reg.test(val) && val != '' ) {
|
408 |
+
$(el).attr('value', '#'+val)
|
409 |
+
} else if ( val == '' ) {
|
410 |
+
$(this).next('.cp_box').css({'background':'#f1f1f1','border-color':'#ccc'});
|
411 |
+
}
|
412 |
+
});
|
413 |
+
});
|
414 |
+
},
|
415 |
+
fix_textarea: function() {
|
416 |
+
$('.wp-editor-area').focus( function(){
|
417 |
+
$(this).parent('div').css({borderColor:'#bbb'});
|
418 |
+
}).blur( function(){
|
419 |
+
$(this).parent('div').css({borderColor:'#ccc'});
|
420 |
+
});
|
421 |
+
},
|
422 |
+
replicate_ajax: function() {
|
423 |
+
if (location.href.indexOf("#") != -1) {
|
424 |
+
var url = $("input[name=\'_wp_http_referer\']").val(),
|
425 |
+
hash = location.href.substr(location.href.indexOf("#"));
|
426 |
+
$("input[name=\'_wp_http_referer\']").val( url + hash );
|
427 |
+
this.scroll_to_top();
|
428 |
+
}
|
429 |
+
setTimeout( function() {
|
430 |
+
$(".wrap.settings-wrap .fade").fadeOut("fast");
|
431 |
+
}, 3000 );
|
432 |
+
},
|
433 |
+
reset_settings: function() {
|
434 |
+
$(".reset-settings").live("click", function(event){
|
435 |
+
var agree = confirm(option_tree.reset_agree);
|
436 |
+
if (agree) {
|
437 |
+
return true;
|
438 |
+
} else {
|
439 |
+
return false;
|
440 |
+
}
|
441 |
+
event.preventDefault();
|
442 |
+
});
|
443 |
+
},
|
444 |
+
url_exists: function(url) {
|
445 |
+
var http = new XMLHttpRequest();
|
446 |
+
http.open('HEAD', url, false);
|
447 |
+
http.send();
|
448 |
+
return http.status!=404;
|
449 |
+
},
|
450 |
+
scroll_to_top: function() {
|
451 |
+
setTimeout( function() {
|
452 |
+
$(this).scrollTop(0);
|
453 |
+
}, 50 );
|
454 |
+
}
|
455 |
+
};
|
456 |
+
$(document).ready( function() {
|
457 |
+
OT_UI.init();
|
458 |
+
});
|
459 |
+
})(jQuery);
|
assets/js/{jquery.color.picker.js → ot-colorpicker.js}
RENAMED
@@ -1,10 +1,8 @@
|
|
1 |
/**
|
2 |
-
*
|
3 |
* Color picker
|
4 |
* Author: Stefan Petre www.eyecon.ro
|
5 |
*
|
6 |
* Dependencies: jQuery
|
7 |
-
*
|
8 |
*/
|
9 |
(function ($) {
|
10 |
var ColorPicker = function () {
|
@@ -452,4 +450,4 @@
|
|
452 |
ColorPickerShow: ColorPicker.show,
|
453 |
ColorPickerSetColor: ColorPicker.setColor
|
454 |
});
|
455 |
-
})(jQuery)
|
1 |
/**
|
|
|
2 |
* Color picker
|
3 |
* Author: Stefan Petre www.eyecon.ro
|
4 |
*
|
5 |
* Dependencies: jQuery
|
|
|
6 |
*/
|
7 |
(function ($) {
|
8 |
var ColorPicker = function () {
|
450 |
ColorPickerShow: ColorPicker.show,
|
451 |
ColorPickerSetColor: ColorPicker.setColor
|
452 |
});
|
453 |
+
})(jQuery);
|
assets/theme-mode/demo-meta-boxes.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/* settings are not the same update the DB */
|
469 |
+
if ( $saved_settings !== $custom_settings ) {
|
470 |
+
update_option( 'option_tree_settings', $custom_settings );
|
471 |
+
}
|
472 |
+
|
473 |
+
}
|
classes/class.admin.php
DELETED
@@ -1,1714 +0,0 @@
|
|
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;
|
13 |
-
private $version;
|
14 |
-
private $option_array;
|
15 |
-
private $ot_file;
|
16 |
-
private $ot_data;
|
17 |
-
private $ot_layout;
|
18 |
-
private $theme_options_xml;
|
19 |
-
private $theme_options_data;
|
20 |
-
private $theme_options_layout;
|
21 |
-
private $has_xml;
|
22 |
-
private $has_data;
|
23 |
-
private $has_layout;
|
24 |
-
private $show_docs;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* PHP4 contructor
|
28 |
-
*
|
29 |
-
* @since 1.1.6
|
30 |
-
*/
|
31 |
-
function OT_Admin()
|
32 |
-
{
|
33 |
-
$this->__construct();
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* PHP5 contructor
|
38 |
-
*
|
39 |
-
* @since 1.0.0
|
40 |
-
*/
|
41 |
-
function __construct()
|
42 |
-
{
|
43 |
-
global $table_prefix;
|
44 |
-
|
45 |
-
$this->version = OT_VERSION;
|
46 |
-
$this->table_name = $table_prefix . 'option_tree';
|
47 |
-
define( 'OT_TABLE_NAME', $this->table_name );
|
48 |
-
$this->option_array = $this->option_tree_data();
|
49 |
-
|
50 |
-
// file path & name without extention
|
51 |
-
$this->ot_file = '/option-tree/theme-options.xml';
|
52 |
-
$this->ot_data = '/option-tree/theme-options.txt';
|
53 |
-
$this->ot_layout = '/option-tree/layouts.txt';
|
54 |
-
|
55 |
-
// XML file path
|
56 |
-
$this->theme_options_xml = get_stylesheet_directory() . $this->ot_file;
|
57 |
-
if ( !is_readable( $this->theme_options_xml ) ) // no file try parent theme
|
58 |
-
$this->theme_options_xml = get_template_directory() . $this->ot_file;
|
59 |
-
|
60 |
-
// Data file path
|
61 |
-
$this->theme_options_data = get_stylesheet_directory() . $this->ot_data;
|
62 |
-
if ( !is_readable( $this->theme_options_data ) ) // no file try parent theme
|
63 |
-
$this->theme_options_data = get_template_directory() . $this->ot_data;
|
64 |
-
|
65 |
-
// Layout file path
|
66 |
-
$this->theme_options_layout = get_stylesheet_directory() . $this->ot_layout;
|
67 |
-
if ( !is_readable( $this->theme_options_layout ) ) // no file try parent theme
|
68 |
-
$this->theme_options_layout = get_template_directory() . $this->ot_layout;
|
69 |
-
|
70 |
-
// check for files
|
71 |
-
$this->has_xml = ( is_readable( $this->theme_options_xml ) ) ? true : false;
|
72 |
-
$this->has_data = ( is_readable( $this->theme_options_data ) ) ? true : false;
|
73 |
-
$this->has_layout = ( is_readable( $this->theme_options_layout ) ) ? true : false;
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Initiate Plugin & setup main options
|
79 |
-
*
|
80 |
-
* @uses get_option()
|
81 |
-
* @uses add_option()
|
82 |
-
* @uses option_tree_activate()
|
83 |
-
* @uses wp_redirect()
|
84 |
-
* @uses admin_url()
|
85 |
-
*
|
86 |
-
* @access public
|
87 |
-
* @since 1.0.0
|
88 |
-
*
|
89 |
-
* @return bool
|
90 |
-
*/
|
91 |
-
function option_tree_init()
|
92 |
-
{
|
93 |
-
// check for activation
|
94 |
-
$check = get_option( 'option_tree_activation' );
|
95 |
-
|
96 |
-
if ( $check != "set" )
|
97 |
-
{
|
98 |
-
add_option( 'option_tree_activation', 'set');
|
99 |
-
|
100 |
-
// load DB activation function if updating plugin
|
101 |
-
$this->option_tree_activate();
|
102 |
-
|
103 |
-
if ( $this->has_xml == true && $this->show_docs == false )
|
104 |
-
{
|
105 |
-
// Redirect
|
106 |
-
wp_redirect( admin_url().'themes.php?page=option_tree' );
|
107 |
-
}
|
108 |
-
else
|
109 |
-
{
|
110 |
-
// Redirect
|
111 |
-
wp_redirect( admin_url().'admin.php?page=option_tree_settings#import_options' );
|
112 |
-
}
|
113 |
-
}
|
114 |
-
return false;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Plugin Table Structure
|
119 |
-
*
|
120 |
-
* @access public
|
121 |
-
* @since 1.0.0
|
122 |
-
*
|
123 |
-
* @param string $type
|
124 |
-
*
|
125 |
-
* @return string
|
126 |
-
*/
|
127 |
-
function option_tree_table( $type = '')
|
128 |
-
{
|
129 |
-
if ( $type == 'create' )
|
130 |
-
{
|
131 |
-
$sql = "CREATE TABLE {$this->table_name} (
|
132 |
-
id mediumint(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
133 |
-
item_id VARCHAR(50) NOT NULL,
|
134 |
-
item_title VARCHAR(100) NOT NULL,
|
135 |
-
item_desc LONGTEXT,
|
136 |
-
item_type VARCHAR(30) NOT NULL,
|
137 |
-
item_options VARCHAR(250) DEFAULT NULL,
|
138 |
-
item_sort mediumint(9) DEFAULT '0' NOT NULL,
|
139 |
-
UNIQUE KEY (item_id)
|
140 |
-
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
|
141 |
-
}
|
142 |
-
return $sql;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Plugin Activation
|
147 |
-
*
|
148 |
-
* @uses get_var()
|
149 |
-
* @uses get_option()
|
150 |
-
* @uses dbDelta()
|
151 |
-
* @uses option_tree_table()
|
152 |
-
* @uses option_tree_default_data()
|
153 |
-
* @uses update_option()
|
154 |
-
* @uses add_option()
|
155 |
-
*
|
156 |
-
* @access public
|
157 |
-
* @since 1.0.0
|
158 |
-
*
|
159 |
-
* @return void
|
160 |
-
*/
|
161 |
-
function option_tree_activate()
|
162 |
-
{
|
163 |
-
global $wpdb;
|
164 |
-
|
165 |
-
// check for table
|
166 |
-
$new_installation = $wpdb->get_var( "show tables like '$this->table_name'" ) != $this->table_name;
|
167 |
-
|
168 |
-
// check for installed version
|
169 |
-
$installed_ver = get_option( 'option_tree_version' );
|
170 |
-
|
171 |
-
// add/update table
|
172 |
-
if ( $installed_ver != $this->version )
|
173 |
-
{
|
174 |
-
// run query
|
175 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
|
176 |
-
dbDelta( $this->option_tree_table( 'create' ) );
|
177 |
-
|
178 |
-
// has xml file load defaults
|
179 |
-
if ( $this->has_xml == true )
|
180 |
-
$this->option_tree_load_theme_files();
|
181 |
-
}
|
182 |
-
|
183 |
-
// new install
|
184 |
-
if ( $new_installation )
|
185 |
-
$this->option_tree_default_data();
|
186 |
-
|
187 |
-
// New Version Update
|
188 |
-
if ( $installed_ver != $this->version )
|
189 |
-
{
|
190 |
-
update_option( 'option_tree_version', $this->version );
|
191 |
-
}
|
192 |
-
else if ( !$installed_ver )
|
193 |
-
{
|
194 |
-
add_option( 'option_tree_version', $this->version );
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Plugin Deactivation delete options
|
200 |
-
*
|
201 |
-
* @uses delete_option()
|
202 |
-
*
|
203 |
-
* @access public
|
204 |
-
* @since 1.0.0
|
205 |
-
*
|
206 |
-
* @return void
|
207 |
-
*/
|
208 |
-
function option_tree_deactivate()
|
209 |
-
{
|
210 |
-
// remove activation check & version
|
211 |
-
delete_option( 'option_tree_activation' );
|
212 |
-
delete_option( 'option_tree_version' );
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Load Default Data from theme included files
|
217 |
-
*
|
218 |
-
* @access public
|
219 |
-
* @since 1.1.7
|
220 |
-
*
|
221 |
-
* @return void
|
222 |
-
*/
|
223 |
-
function option_tree_load_theme_files()
|
224 |
-
{
|
225 |
-
global $wpdb;
|
226 |
-
|
227 |
-
$rawdata = file_get_contents( $this->theme_options_xml );
|
228 |
-
|
229 |
-
if ( $rawdata )
|
230 |
-
{
|
231 |
-
$new_options = new SimpleXMLElement( $rawdata );
|
232 |
-
|
233 |
-
// drop table
|
234 |
-
$wpdb->query( "DROP TABLE $this->table_name" );
|
235 |
-
|
236 |
-
// create table
|
237 |
-
$wpdb->query( $this->option_tree_table( 'create' ) );
|
238 |
-
|
239 |
-
foreach ( $new_options->row as $value )
|
240 |
-
{
|
241 |
-
$wpdb->insert( $this->table_name,
|
242 |
-
array(
|
243 |
-
'item_id' => $value->item_id,
|
244 |
-
'item_title' => $value->item_title,
|
245 |
-
'item_desc' => $value->item_desc,
|
246 |
-
'item_type' => $value->item_type,
|
247 |
-
'item_options' => $value->item_options
|
248 |
-
)
|
249 |
-
);
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
// check for Data file and data not saved
|
254 |
-
if ( $this->has_data == true && !get_option( 'option_tree' ) )
|
255 |
-
{
|
256 |
-
$rawdata = file_get_contents( $this->theme_options_data );
|
257 |
-
$new_options = unserialize( base64_decode( $rawdata ) );
|
258 |
-
|
259 |
-
// check if array()
|
260 |
-
if ( is_array( $new_options ) )
|
261 |
-
{
|
262 |
-
// create new options
|
263 |
-
add_option('option_tree', $new_options);
|
264 |
-
}
|
265 |
-
}
|
266 |
-
|
267 |
-
// check for Layout file and layouts not saved
|
268 |
-
if ( $this->has_layout == true && !get_option( 'option_tree_layouts' ) )
|
269 |
-
{
|
270 |
-
$rawdata = file_get_contents( $this->theme_options_layout );
|
271 |
-
$new_layouts = unserialize( base64_decode( $rawdata ) );
|
272 |
-
|
273 |
-
// check if array()
|
274 |
-
if ( is_array( $new_layouts ) )
|
275 |
-
{
|
276 |
-
// create new layouts
|
277 |
-
add_option('option_tree_layouts', $new_layouts);
|
278 |
-
}
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Plugin Activation Default Data
|
284 |
-
*
|
285 |
-
* @uses query()
|
286 |
-
* @uses prepare()
|
287 |
-
*
|
288 |
-
* @access public
|
289 |
-
* @since 1.0.0
|
290 |
-
*
|
291 |
-
* @return void
|
292 |
-
*/
|
293 |
-
function option_tree_default_data()
|
294 |
-
{
|
295 |
-
// load from files if they exist
|
296 |
-
if ( $this->has_xml == true )
|
297 |
-
{
|
298 |
-
$this->option_tree_load_theme_files();
|
299 |
-
}
|
300 |
-
else
|
301 |
-
{
|
302 |
-
global $wpdb;
|
303 |
-
|
304 |
-
// only run these queries if no xml file exist
|
305 |
-
$wpdb->query( $wpdb->prepare( "
|
306 |
-
INSERT INTO {$this->table_name}
|
307 |
-
( item_id, item_title, item_type )
|
308 |
-
VALUES ( %s, %s, %s ) ",
|
309 |
-
array('general_default','General','heading') ) );
|
310 |
-
|
311 |
-
$wpdb->query( $wpdb->prepare( "
|
312 |
-
INSERT INTO {$this->table_name}
|
313 |
-
( item_id, item_title, item_type )
|
314 |
-
VALUES ( %s, %s, %s ) ",
|
315 |
-
array('test_input','Test Input','input') ) );
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Restore Table Data if empty
|
321 |
-
*
|
322 |
-
* @uses delete_option()
|
323 |
-
* @uses option_tree_activate()
|
324 |
-
* @uses wp_redirect()
|
325 |
-
* @uses admin_url()
|
326 |
-
*
|
327 |
-
* @access public
|
328 |
-
* @since 1.0.0
|
329 |
-
*
|
330 |
-
* @return void
|
331 |
-
*/
|
332 |
-
function option_tree_restore_default_data()
|
333 |
-
{
|
334 |
-
global $wpdb;
|
335 |
-
|
336 |
-
// drop table
|
337 |
-
$wpdb->query( "DROP TABLE $this->table_name" );
|
338 |
-
|
339 |
-
// remove activation check
|
340 |
-
delete_option( 'option_tree_version' );
|
341 |
-
|
342 |
-
// load DB activation function
|
343 |
-
$this->option_tree_activate();
|
344 |
-
|
345 |
-
// Redirect
|
346 |
-
if ( $this->has_xml == true && $this->show_docs == false )
|
347 |
-
{
|
348 |
-
wp_redirect( admin_url().'themes.php?page=option_tree' );
|
349 |
-
}
|
350 |
-
else
|
351 |
-
{
|
352 |
-
wp_redirect( admin_url().'admin.php?page=option_tree_settings' );
|
353 |
-
}
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Add Admin Menu Items & Test Actions
|
358 |
-
*
|
359 |
-
* @uses option_tree_export_xml()
|
360 |
-
* @uses option_tree_data()
|
361 |
-
* @uses get_results()
|
362 |
-
* @uses option_tree_restore_default_data()
|
363 |
-
* @uses option_tree_activate()
|
364 |
-
* @uses get_option()
|
365 |
-
* @uses option_tree_import_xml()
|
366 |
-
* @uses get_user_option()
|
367 |
-
* @uses add_object_page()
|
368 |
-
* @uses add_submenu_page()
|
369 |
-
* @uses add_action()
|
370 |
-
*
|
371 |
-
* @access public
|
372 |
-
* @since 1.0.0
|
373 |
-
*
|
374 |
-
* @param int $param
|
375 |
-
*
|
376 |
-
* @return void
|
377 |
-
*/
|
378 |
-
function option_tree_admin()
|
379 |
-
{
|
380 |
-
global $wpdb;
|
381 |
-
|
382 |
-
// export XML - run before anything else
|
383 |
-
if ( isset($_GET['action']) && $_GET['action'] == 'ot-export-xml' )
|
384 |
-
option_tree_export_xml( $this->option_tree_data(), $this->table_name );
|
385 |
-
|
386 |
-
// grab saved table option
|
387 |
-
$test_options = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
|
388 |
-
|
389 |
-
// restore table if needed
|
390 |
-
if ( empty( $test_options ) )
|
391 |
-
$this->option_tree_restore_default_data();
|
392 |
-
|
393 |
-
// upgrade DB automatically
|
394 |
-
$this->option_tree_activate();
|
395 |
-
|
396 |
-
// load options array
|
397 |
-
$settings = get_option( 'option_tree' );
|
398 |
-
|
399 |
-
// upload xml data
|
400 |
-
$this->option_tree_import_xml();
|
401 |
-
|
402 |
-
// if XML file came with the theme don't build the whole UI
|
403 |
-
if ( $this->has_xml == true && $this->show_docs == false )
|
404 |
-
{
|
405 |
-
// create menu item
|
406 |
-
$option_tree_options = add_submenu_page( 'themes.php', 'OptionTree Theme Options','Theme Options', 'edit_theme_options', 'option_tree', array( $this, 'option_tree_options_page' ) );
|
407 |
-
|
408 |
-
// add menu item
|
409 |
-
add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
|
410 |
-
}
|
411 |
-
else
|
412 |
-
{
|
413 |
-
// set admin color for icon
|
414 |
-
$icon = ( get_user_option( 'admin_color' ) == 'classic' ) ? OT_PLUGIN_URL.'/assets/images/icon_classic.png' : OT_PLUGIN_URL.'/assets/images/icon_dark.png';
|
415 |
-
|
416 |
-
// create menu items
|
417 |
-
add_object_page( 'OptionTree', 'OptionTree', 'edit_theme_options', 'option_tree', array( $this, 'option_tree_options_page' ), $icon);
|
418 |
-
$option_tree_options = add_submenu_page( 'option_tree', 'OptionTree', 'Theme Options', 'edit_theme_options', 'option_tree', array( $this, 'option_tree_options_page' ) );
|
419 |
-
$option_tree_docs = add_submenu_page( 'option_tree', 'OptionTree', 'Documentation', 'edit_theme_options', 'option_tree_docs', array( $this, 'option_tree_docs_page' ) );
|
420 |
-
$option_tree_settings = add_submenu_page( 'option_tree', 'OptionTree', 'Settings', 'edit_theme_options', 'option_tree_settings', array( $this, 'option_tree_settings_page' ) );
|
421 |
-
|
422 |
-
// add menu items
|
423 |
-
add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
|
424 |
-
add_action( "admin_print_styles-$option_tree_docs", array( $this, 'option_tree_load' ) );
|
425 |
-
add_action( "admin_print_styles-$option_tree_settings", array( $this, 'option_tree_load' ) );
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Load Scripts & Styles
|
431 |
-
*
|
432 |
-
* @uses wp_enqueue_style()
|
433 |
-
* @uses get_user_option()
|
434 |
-
* @uses add_thickbox()
|
435 |
-
* @uses wp_enqueue_script()
|
436 |
-
* @uses wp_deregister_style()
|
437 |
-
*
|
438 |
-
* @access public
|
439 |
-
* @since 1.0.0
|
440 |
-
*
|
441 |
-
* @return void
|
442 |
-
*/
|
443 |
-
function option_tree_load()
|
444 |
-
{
|
445 |
-
// enqueue styles
|
446 |
-
wp_enqueue_style( 'option-tree-style', OT_PLUGIN_URL.'/assets/css/style.css', false, $this->version, 'screen');
|
447 |
-
|
448 |
-
// classic admin theme styles
|
449 |
-
if ( get_user_option( 'admin_color') == 'classic' )
|
450 |
-
wp_enqueue_style( 'option-tree-style-classic', OT_PLUGIN_URL.'/assets/css/style-classic.css', array( 'option-tree-style' ), $this->version, 'screen');
|
451 |
-
|
452 |
-
// enqueue scripts
|
453 |
-
add_thickbox();
|
454 |
-
wp_enqueue_script( 'jquery-table-dnd', OT_PLUGIN_URL.'/assets/js/jquery.table.dnd.js', array('jquery'), $this->version );
|
455 |
-
wp_enqueue_script( 'jquery-color-picker', OT_PLUGIN_URL.'/assets/js/jquery.color.picker.js', array('jquery'), $this->version );
|
456 |
-
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', 'jquery-ui-sortable'), $this->version );
|
457 |
-
|
458 |
-
// remove GD star rating conflicts
|
459 |
-
wp_deregister_style( 'gdsr-jquery-ui-core' );
|
460 |
-
wp_deregister_style( 'gdsr-jquery-ui-theme' );
|
461 |
-
|
462 |
-
// remove Cispm Mail Contact jQuery UI
|
463 |
-
wp_deregister_script('jquery-ui-1.7.2.custom.min');
|
464 |
-
}
|
465 |
-
|
466 |
-
/**
|
467 |
-
* Grab the wp_option_tree table options array
|
468 |
-
*
|
469 |
-
* @uses get_results()
|
470 |
-
*
|
471 |
-
* @access public
|
472 |
-
* @since 1.0.0
|
473 |
-
*
|
474 |
-
* @return array
|
475 |
-
*/
|
476 |
-
function option_tree_data()
|
477 |
-
{
|
478 |
-
global $wpdb;
|
479 |
-
|
480 |
-
// create an array of options
|
481 |
-
$db_options = $wpdb->get_results( "SELECT * FROM {$this->table_name} ORDER BY item_sort ASC" );
|
482 |
-
return $db_options;
|
483 |
-
}
|
484 |
-
|
485 |
-
/**
|
486 |
-
* Theme Options Page
|
487 |
-
*
|
488 |
-
* @uses get_option()
|
489 |
-
* @uses get_option_page_ID()
|
490 |
-
* @uses option_tree_check_post_lock()
|
491 |
-
* @uses option_tree_check_post_lock()
|
492 |
-
* @uses option_tree_notice_post_locked()
|
493 |
-
*
|
494 |
-
* @access public
|
495 |
-
* @since 1.0.0
|
496 |
-
*
|
497 |
-
* @return string
|
498 |
-
*/
|
499 |
-
function option_tree_options_page()
|
500 |
-
{
|
501 |
-
// hook before page loads
|
502 |
-
do_action( 'option_tree_admin_header' );
|
503 |
-
|
504 |
-
// set
|
505 |
-
$ot_array = $this->option_array;
|
506 |
-
|
507 |
-
// load saved option_tree
|
508 |
-
$settings = get_option( 'option_tree' );
|
509 |
-
|
510 |
-
// Load Saved Layouts
|
511 |
-
$layouts = get_option('option_tree_layouts');
|
512 |
-
|
513 |
-
// private page ID
|
514 |
-
$post_id = $this->get_option_page_ID( 'media' );
|
515 |
-
|
516 |
-
// set post lock
|
517 |
-
if ( $last = $this->option_tree_check_post_lock( $post_id ) )
|
518 |
-
{
|
519 |
-
$message = $this->option_tree_notice_post_locked( $post_id );
|
520 |
-
}
|
521 |
-
else
|
522 |
-
{
|
523 |
-
$this->option_tree_set_post_lock( $post_id );
|
524 |
-
}
|
525 |
-
|
526 |
-
// Grab Options Page
|
527 |
-
include( OT_PLUGIN_DIR. '/front-end/options.php' );
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Settings Page
|
532 |
-
*
|
533 |
-
* @uses get_option()
|
534 |
-
* @uses get_option_page_ID()
|
535 |
-
* @uses option_tree_check_post_lock()
|
536 |
-
* @uses option_tree_check_post_lock()
|
537 |
-
* @uses option_tree_notice_post_locked()
|
538 |
-
*
|
539 |
-
* @access public
|
540 |
-
* @since 1.0.0
|
541 |
-
*
|
542 |
-
* @return string
|
543 |
-
*/
|
544 |
-
function option_tree_settings_page()
|
545 |
-
{
|
546 |
-
// hook before page loads
|
547 |
-
do_action( 'option_tree_admin_header' );
|
548 |
-
|
549 |
-
// set
|
550 |
-
$ot_array = $this->option_array;
|
551 |
-
|
552 |
-
// Load Saved Options
|
553 |
-
$settings = get_option('option_tree');
|
554 |
-
|
555 |
-
// Load Saved Layouts
|
556 |
-
$layouts = get_option('option_tree_layouts');
|
557 |
-
|
558 |
-
// private page ID
|
559 |
-
$post_id = $this->get_option_page_ID( 'options' );
|
560 |
-
|
561 |
-
// set post lock
|
562 |
-
if ( $last = $this->option_tree_check_post_lock( $post_id ) )
|
563 |
-
{
|
564 |
-
$message = $this->option_tree_notice_post_locked( $post_id );
|
565 |
-
}
|
566 |
-
else
|
567 |
-
{
|
568 |
-
$this->option_tree_set_post_lock( $post_id );
|
569 |
-
}
|
570 |
-
|
571 |
-
// Get Settings Page
|
572 |
-
include( OT_PLUGIN_DIR . '/front-end/settings.php' );
|
573 |
-
}
|
574 |
-
|
575 |
-
/**
|
576 |
-
* Documentation Page
|
577 |
-
*
|
578 |
-
* @access public
|
579 |
-
* @since 1.0.0
|
580 |
-
*
|
581 |
-
* @return string
|
582 |
-
*/
|
583 |
-
function option_tree_docs_page()
|
584 |
-
{
|
585 |
-
// hook before page loads
|
586 |
-
do_action( 'option_tree_admin_header' );
|
587 |
-
|
588 |
-
// Get Settings Page
|
589 |
-
include( OT_PLUGIN_DIR . '/front-end/docs.php' );
|
590 |
-
}
|
591 |
-
|
592 |
-
/**
|
593 |
-
* Save Theme Option via AJAX
|
594 |
-
*
|
595 |
-
* @uses check_ajax_referer()
|
596 |
-
* @uses update_option()
|
597 |
-
* @uses option_tree_set_post_lock()
|
598 |
-
* @uses get_option_page_ID()
|
599 |
-
*
|
600 |
-
* @access public
|
601 |
-
* @since 1.0.0
|
602 |
-
*
|
603 |
-
* @return void
|
604 |
-
*/
|
605 |
-
function option_tree_array_save()
|
606 |
-
{
|
607 |
-
// Check AJAX Referer
|
608 |
-
check_ajax_referer( '_theme_options', '_ajax_nonce' );
|
609 |
-
|
610 |
-
// set option values
|
611 |
-
foreach ( $this->option_array as $value )
|
612 |
-
{
|
613 |
-
$key = trim( $value->item_id );
|
614 |
-
if ( isset( $_REQUEST[$key] ) )
|
615 |
-
{
|
616 |
-
$val = $_REQUEST[$key];
|
617 |
-
$new_settings[$key] = $val;
|
618 |
-
}
|
619 |
-
}
|
620 |
-
|
621 |
-
// Update Theme Options
|
622 |
-
update_option( 'option_tree', $new_settings );
|
623 |
-
|
624 |
-
// update active layout content
|
625 |
-
$options_layouts = get_option( 'option_tree_layouts' );
|
626 |
-
if ( isset( $options_layouts['active_layout'] ) ) {
|
627 |
-
$options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_settings ) );
|
628 |
-
update_option( 'option_tree_layouts', $options_layouts );
|
629 |
-
}
|
630 |
-
|
631 |
-
// lock post editing
|
632 |
-
$this->option_tree_set_post_lock( $this->get_option_page_ID( 'media' ) );
|
633 |
-
|
634 |
-
// hook before AJAX is returned
|
635 |
-
do_action( 'option_tree_array_save' );
|
636 |
-
|
637 |
-
die();
|
638 |
-
}
|
639 |
-
|
640 |
-
/**
|
641 |
-
* Update XML Theme Option via AJAX
|
642 |
-
*
|
643 |
-
* @uses check_ajax_referer()
|
644 |
-
* @uses update_option()
|
645 |
-
* @uses option_tree_set_post_lock()
|
646 |
-
* @uses get_option_page_ID()
|
647 |
-
*
|
648 |
-
* @access public
|
649 |
-
* @since 1.0.0
|
650 |
-
*
|
651 |
-
* @return void
|
652 |
-
*/
|
653 |
-
function option_tree_array_reload()
|
654 |
-
{
|
655 |
-
// Check AJAX Referer
|
656 |
-
check_ajax_referer( '_theme_options', '_ajax_nonce' );
|
657 |
-
|
658 |
-
global $wpdb;
|
659 |
-
|
660 |
-
$rawdata = file_get_contents( $this->theme_options_xml );
|
661 |
-
|
662 |
-
if ( $rawdata )
|
663 |
-
{
|
664 |
-
$new_options = new SimpleXMLElement( $rawdata );
|
665 |
-
|
666 |
-
// drop table
|
667 |
-
$wpdb->query( "DROP TABLE $this->table_name" );
|
668 |
-
|
669 |
-
// create table
|
670 |
-
$wpdb->query( $this->option_tree_table( 'create' ) );
|
671 |
-
|
672 |
-
foreach ( $new_options->row as $value )
|
673 |
-
{
|
674 |
-
$wpdb->insert( $this->table_name,
|
675 |
-
array(
|
676 |
-
'item_id' => $value->item_id,
|
677 |
-
'item_title' => $value->item_title,
|
678 |
-
'item_desc' => $value->item_desc,
|
679 |
-
'item_type' => $value->item_type,
|
680 |
-
'item_options' => $value->item_options
|
681 |
-
)
|
682 |
-
);
|
683 |
-
}
|
684 |
-
die('themes.php?page=option_tree&updated=true&cache=buster_'.mt_rand(5, 100));
|
685 |
-
}
|
686 |
-
else
|
687 |
-
{
|
688 |
-
die('-1');
|
689 |
-
}
|
690 |
-
}
|
691 |
-
|
692 |
-
/**
|
693 |
-
* Reset Theme Option via AJAX
|
694 |
-
*
|
695 |
-
* @uses check_ajax_referer()
|
696 |
-
* @uses update_option()
|
697 |
-
*
|
698 |
-
* @access public
|
699 |
-
* @since 1.0.0
|
700 |
-
*
|
701 |
-
* @return void
|
702 |
-
*/
|
703 |
-
function option_tree_array_reset()
|
704 |
-
{
|
705 |
-
// Check AJAX Referer
|
706 |
-
check_ajax_referer( '_theme_options', '_ajax_nonce' );
|
707 |
-
|
708 |
-
// clear option values
|
709 |
-
foreach ( $this->option_array as $value )
|
710 |
-
{
|
711 |
-
$key = $value->item_id;
|
712 |
-
$new_options[$key] = '';
|
713 |
-
}
|
714 |
-
|
715 |
-
// update theme Options
|
716 |
-
update_option( 'option_tree', $new_options );
|
717 |
-
|
718 |
-
// update active layout content
|
719 |
-
$options_layouts = get_option( 'option_tree_layouts' );
|
720 |
-
if ( isset( $options_layouts['active_layout'] ) ) {
|
721 |
-
$options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_options ) );
|
722 |
-
update_option( 'option_tree_layouts', $options_layouts );
|
723 |
-
}
|
724 |
-
|
725 |
-
die();
|
726 |
-
}
|
727 |
-
|
728 |
-
/**
|
729 |
-
* Insert Row into Option Setting Table via AJAX
|
730 |
-
*
|
731 |
-
* @uses check_ajax_referer()
|
732 |
-
* @uses get_results()
|
733 |
-
* @uses insert()
|
734 |
-
* @uses get_var()
|
735 |
-
*
|
736 |
-
* @access public
|
737 |
-
* @since 1.0.0
|
738 |
-
*
|
739 |
-
* @return void
|
740 |
-
*/
|
741 |
-
function option_tree_add()
|
742 |
-
{
|
743 |
-
global $wpdb;
|
744 |
-
|
745 |
-
// check AJAX referer
|
746 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
747 |
-
|
748 |
-
// grab fresh options array
|
749 |
-
$ot_array = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
|
750 |
-
|
751 |
-
// get form data
|
752 |
-
$id = $_POST['id'];
|
753 |
-
$item_id = htmlspecialchars(stripslashes(trim($_POST['item_id'])), ENT_QUOTES,'UTF-8',true);
|
754 |
-
$item_title = htmlspecialchars(stripslashes(trim($_POST['item_title'])), ENT_QUOTES,'UTF-8',true);
|
755 |
-
$item_desc = htmlspecialchars(stripslashes(trim($_POST['item_desc'])), ENT_QUOTES,'UTF-8',true);
|
756 |
-
$item_type = htmlspecialchars(stripslashes(trim($_POST['item_type'])), ENT_QUOTES,'UTF-8',true);
|
757 |
-
$item_options = htmlspecialchars(stripslashes(trim($_POST['item_options'])), ENT_QUOTES,'UTF-8',true);
|
758 |
-
|
759 |
-
// validate item key
|
760 |
-
foreach( $ot_array as $value )
|
761 |
-
{
|
762 |
-
if ( $item_id == $value->item_id )
|
763 |
-
{
|
764 |
-
die( "That option key is already in use." );
|
765 |
-
}
|
766 |
-
}
|
767 |
-
|
768 |
-
// verify key is alphanumeric
|
769 |
-
if ( preg_match( '/[^a-z0-9_]/', $item_id ) )
|
770 |
-
die("You must enter a valid option key.");
|
771 |
-
|
772 |
-
// verify title
|
773 |
-
if (strlen($item_title) < 1 )
|
774 |
-
die("You must give your option a title.");
|
775 |
-
|
776 |
-
if ( $item_type == 'textarea' && !is_numeric( $item_options ) )
|
777 |
-
die("The row value must be numeric.");
|
778 |
-
|
779 |
-
// update row
|
780 |
-
$wpdb->insert( $this->table_name,
|
781 |
-
array(
|
782 |
-
'item_id' => $item_id,
|
783 |
-
'item_title' => $item_title,
|
784 |
-
'item_desc' => $item_desc,
|
785 |
-
'item_type' => $item_type,
|
786 |
-
'item_options' => $item_options,
|
787 |
-
'item_sort' => $id
|
788 |
-
)
|
789 |
-
);
|
790 |
-
|
791 |
-
// verify values in the DB are updated
|
792 |
-
$updated = $wpdb->get_var("
|
793 |
-
SELECT id
|
794 |
-
FROM {$this->table_name}
|
795 |
-
WHERE item_id = '$item_id'
|
796 |
-
AND item_title = '$item_title'
|
797 |
-
AND item_type = '$item_type'
|
798 |
-
AND item_options = '$item_options'
|
799 |
-
");
|
800 |
-
|
801 |
-
// if updated
|
802 |
-
if ( $updated )
|
803 |
-
{
|
804 |
-
die('updated');
|
805 |
-
}
|
806 |
-
else
|
807 |
-
{
|
808 |
-
die("There was an error, please try again.");
|
809 |
-
}
|
810 |
-
}
|
811 |
-
|
812 |
-
/**
|
813 |
-
* Update Option Setting Table via AJAX
|
814 |
-
*
|
815 |
-
* @uses check_ajax_referer()
|
816 |
-
* @uses get_results()
|
817 |
-
* @uses update()
|
818 |
-
* @uses get_var()
|
819 |
-
*
|
820 |
-
* @access public
|
821 |
-
* @since 1.0.0
|
822 |
-
*
|
823 |
-
* @return void
|
824 |
-
*/
|
825 |
-
function option_tree_edit()
|
826 |
-
{
|
827 |
-
global $wpdb;
|
828 |
-
|
829 |
-
// Check AJAX Referer
|
830 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
831 |
-
|
832 |
-
// grab fresh options array
|
833 |
-
$ot_array = $wpdb->get_results( "SELECT * FROM {$this->table_name}" );
|
834 |
-
|
835 |
-
// get form data
|
836 |
-
$id = $_POST['id'];
|
837 |
-
$item_id = htmlspecialchars(stripslashes(trim($_POST['item_id'])), ENT_QUOTES,'UTF-8',true);
|
838 |
-
$item_title = htmlspecialchars(stripslashes(trim($_POST['item_title'])), ENT_QUOTES,'UTF-8',true);
|
839 |
-
$item_desc = htmlspecialchars(stripslashes(trim($_POST['item_desc'])), ENT_QUOTES,'UTF-8',true);
|
840 |
-
$item_type = htmlspecialchars(stripslashes(trim($_POST['item_type'])), ENT_QUOTES,'UTF-8',true);
|
841 |
-
$item_options = htmlspecialchars(stripslashes(trim($_POST['item_options'])), ENT_QUOTES,'UTF-8',true);
|
842 |
-
|
843 |
-
// validate item key
|
844 |
-
foreach($ot_array as $value)
|
845 |
-
{
|
846 |
-
if ( $value->item_sort == $id )
|
847 |
-
{
|
848 |
-
if ($item_id == $value->item_id && $value->item_sort != $id)
|
849 |
-
{
|
850 |
-
die("That option key is already in use.");
|
851 |
-
}
|
852 |
-
}
|
853 |
-
else if ($item_id == $value->item_id && $value->id != $id)
|
854 |
-
{
|
855 |
-
die("That option key is already in use.");
|
856 |
-
}
|
857 |
-
}
|
858 |
-
|
859 |
-
// verify key is alphanumeric
|
860 |
-
if ( preg_match( '/[^a-z0-9_]/', $item_id ) )
|
861 |
-
die("You must enter a valid option key.");
|
862 |
-
|
863 |
-
// verify title
|
864 |
-
if ( strlen( $item_title ) < 1 )
|
865 |
-
die("You must give your option a title.");
|
866 |
-
|
867 |
-
if ( $item_type == 'textarea' && !is_numeric( $item_options ) )
|
868 |
-
die("The row value must be numeric.");
|
869 |
-
|
870 |
-
// update row
|
871 |
-
$wpdb->update( $this->table_name,
|
872 |
-
array(
|
873 |
-
'item_id' => $item_id,
|
874 |
-
'item_title' => $item_title,
|
875 |
-
'item_desc' => $item_desc,
|
876 |
-
'item_type' => $item_type,
|
877 |
-
'item_options' => $item_options
|
878 |
-
),
|
879 |
-
array(
|
880 |
-
'id' => $id
|
881 |
-
)
|
882 |
-
);
|
883 |
-
|
884 |
-
// verify values in the DB are updated
|
885 |
-
$updated = $wpdb->get_var("
|
886 |
-
SELECT id
|
887 |
-
FROM {$this->table_name}
|
888 |
-
WHERE item_id = '$item_id'
|
889 |
-
AND item_title = '$item_title'
|
890 |
-
AND item_type = '$item_type'
|
891 |
-
AND item_options = '$item_options'
|
892 |
-
");
|
893 |
-
|
894 |
-
// if updated
|
895 |
-
if ( $updated )
|
896 |
-
{
|
897 |
-
die('updated');
|
898 |
-
}
|
899 |
-
else
|
900 |
-
{
|
901 |
-
die("There was an error, please try again.");
|
902 |
-
}
|
903 |
-
}
|
904 |
-
|
905 |
-
/**
|
906 |
-
* Remove Option via AJAX
|
907 |
-
*
|
908 |
-
* @uses check_ajax_referer()
|
909 |
-
* @uses query()
|
910 |
-
*
|
911 |
-
* @access public
|
912 |
-
* @since 1.0.0
|
913 |
-
*
|
914 |
-
* @return void
|
915 |
-
*/
|
916 |
-
function option_tree_delete()
|
917 |
-
{
|
918 |
-
global $wpdb;
|
919 |
-
|
920 |
-
// check AJAX referer
|
921 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
922 |
-
|
923 |
-
// grab ID
|
924 |
-
$id = $_REQUEST['id'];
|
925 |
-
|
926 |
-
// delete item
|
927 |
-
$wpdb->query("
|
928 |
-
DELETE FROM $this->table_name
|
929 |
-
WHERE id = '$id'
|
930 |
-
");
|
931 |
-
|
932 |
-
die('removed');
|
933 |
-
}
|
934 |
-
|
935 |
-
/**
|
936 |
-
* Get Option ID via AJAX
|
937 |
-
*
|
938 |
-
* @uses check_ajax_referer()
|
939 |
-
* @uses delete_post_meta()
|
940 |
-
*
|
941 |
-
* @access public
|
942 |
-
* @since 1.0.0
|
943 |
-
*
|
944 |
-
* @return void
|
945 |
-
*/
|
946 |
-
function option_tree_next_id()
|
947 |
-
{
|
948 |
-
global $wpdb;
|
949 |
-
|
950 |
-
// check AJAX referer
|
951 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
952 |
-
|
953 |
-
// get ID
|
954 |
-
$id = $wpdb->get_var( "SELECT id FROM {$this->table_name} ORDER BY id DESC LIMIT 1" );
|
955 |
-
|
956 |
-
// return ID
|
957 |
-
die($id);
|
958 |
-
}
|
959 |
-
|
960 |
-
/**
|
961 |
-
* Update Sort Order via AJAX
|
962 |
-
*
|
963 |
-
* @uses check_ajax_referer()
|
964 |
-
* @uses update()
|
965 |
-
*
|
966 |
-
* @access public
|
967 |
-
* @since 1.0.0
|
968 |
-
*
|
969 |
-
* @return void
|
970 |
-
*/
|
971 |
-
function option_tree_sort()
|
972 |
-
{
|
973 |
-
global $wpdb;
|
974 |
-
|
975 |
-
// check AJAX referer
|
976 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
977 |
-
|
978 |
-
// create an array of IDs
|
979 |
-
$fields = explode('&', $_REQUEST['id']);
|
980 |
-
|
981 |
-
// set order
|
982 |
-
$order = 0;
|
983 |
-
|
984 |
-
// update the sort order
|
985 |
-
foreach( $fields as $field ) {
|
986 |
-
$order++;
|
987 |
-
$key = explode('=', $field);
|
988 |
-
$id = urldecode($key[1]);
|
989 |
-
$wpdb->update( $this->table_name,
|
990 |
-
array(
|
991 |
-
'item_sort' => $order
|
992 |
-
),
|
993 |
-
array(
|
994 |
-
'id' => $id
|
995 |
-
)
|
996 |
-
);
|
997 |
-
}
|
998 |
-
die();
|
999 |
-
}
|
1000 |
-
|
1001 |
-
/**
|
1002 |
-
* Upload XML Option Data
|
1003 |
-
*
|
1004 |
-
* @access public
|
1005 |
-
* @since 1.0.0
|
1006 |
-
*
|
1007 |
-
* @return void
|
1008 |
-
*/
|
1009 |
-
function option_tree_import_xml()
|
1010 |
-
{
|
1011 |
-
global $wpdb;
|
1012 |
-
|
1013 |
-
// Check for multisite and add xml mime type if needed
|
1014 |
-
if ( is_multisite() )
|
1015 |
-
{
|
1016 |
-
$xml_ext = false;
|
1017 |
-
|
1018 |
-
// build ext array
|
1019 |
-
$site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );
|
1020 |
-
|
1021 |
-
// check for xml ext
|
1022 |
-
foreach ( $site_exts as $ext )
|
1023 |
-
{
|
1024 |
-
if ( $ext == 'xml' )
|
1025 |
-
$xml_ext = true;
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
// add xml to mime types
|
1029 |
-
if ( $xml_ext == false )
|
1030 |
-
{
|
1031 |
-
$new_site_exts = implode( ' ', $site_exts );
|
1032 |
-
update_site_option( 'upload_filetypes', $new_site_exts.' xml' );
|
1033 |
-
}
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
// action == upload
|
1037 |
-
if ( isset($_GET['action']) && $_GET['action'] == 'ot-upload-xml' )
|
1038 |
-
{
|
1039 |
-
// fail no file
|
1040 |
-
if ( $_FILES["import"]['name'] == null )
|
1041 |
-
{
|
1042 |
-
header("Location: admin.php?page=option_tree_settings&nofile=true#import_options");
|
1043 |
-
die();
|
1044 |
-
}
|
1045 |
-
// fail errors
|
1046 |
-
else if ( $_FILES["import"]["error"] > 0 )
|
1047 |
-
{
|
1048 |
-
header("Location: admin.php?page=option_tree_settings&error=true#import_options");
|
1049 |
-
die();
|
1050 |
-
}
|
1051 |
-
else
|
1052 |
-
{
|
1053 |
-
// success - it's XML
|
1054 |
-
if ( preg_match( "/(.xml)$/i", $_FILES["import"]['name'] ) )
|
1055 |
-
{
|
1056 |
-
|
1057 |
-
$mimes = apply_filters( 'upload_mimes', array(
|
1058 |
-
'xml' => 'text/xml'
|
1059 |
-
));
|
1060 |
-
|
1061 |
-
$overrides = array('test_form' => false, 'mimes' => $mimes);
|
1062 |
-
$import = wp_handle_upload($_FILES['import'], $overrides);
|
1063 |
-
|
1064 |
-
if (!empty($import['error']))
|
1065 |
-
{
|
1066 |
-
header("Location: admin.php?page=option_tree_settings&error=true#import_options");
|
1067 |
-
die();
|
1068 |
-
}
|
1069 |
-
|
1070 |
-
$rawdata = file_get_contents( $import['file'] );
|
1071 |
-
$new_options = new SimpleXMLElement( $rawdata );
|
1072 |
-
|
1073 |
-
// drop table
|
1074 |
-
$wpdb->query( "DROP TABLE $this->table_name" );
|
1075 |
-
|
1076 |
-
// create table
|
1077 |
-
$wpdb->query( $this->option_tree_table( 'create' ) );
|
1078 |
-
|
1079 |
-
// insert data
|
1080 |
-
foreach ( $new_options->row as $value )
|
1081 |
-
{
|
1082 |
-
$wpdb->insert( $this->table_name,
|
1083 |
-
array(
|
1084 |
-
'item_id' => $value->item_id,
|
1085 |
-
'item_title' => $value->item_title,
|
1086 |
-
'item_desc' => $value->item_desc,
|
1087 |
-
'item_type' => $value->item_type,
|
1088 |
-
'item_options' => $value->item_options
|
1089 |
-
)
|
1090 |
-
);
|
1091 |
-
}
|
1092 |
-
// success redirect
|
1093 |
-
header("Location: admin.php?page=option_tree_settings&xml=true#import_options");
|
1094 |
-
die();
|
1095 |
-
}
|
1096 |
-
// fail
|
1097 |
-
else
|
1098 |
-
{
|
1099 |
-
// redirect
|
1100 |
-
header("Location: admin.php?page=option_tree_settings&error=true#import_options");
|
1101 |
-
die();
|
1102 |
-
}
|
1103 |
-
}
|
1104 |
-
}
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
/**
|
1108 |
-
* Import Option Data via AJAX
|
1109 |
-
*
|
1110 |
-
* @uses check_ajax_referer()
|
1111 |
-
* @uses update()
|
1112 |
-
*
|
1113 |
-
* @access public
|
1114 |
-
* @since 1.0.0
|
1115 |
-
*
|
1116 |
-
* @return void
|
1117 |
-
*/
|
1118 |
-
function option_tree_import_data()
|
1119 |
-
{
|
1120 |
-
global $wpdb;
|
1121 |
-
|
1122 |
-
// check AJAX referer
|
1123 |
-
check_ajax_referer( '_import_data', '_ajax_nonce' );
|
1124 |
-
|
1125 |
-
// Get Data
|
1126 |
-
$string = $_REQUEST['import_options_data'];
|
1127 |
-
|
1128 |
-
// Unserialize The Array
|
1129 |
-
$new_options = unserialize( base64_decode( $string ) );
|
1130 |
-
|
1131 |
-
// check if array()
|
1132 |
-
if ( is_array( $new_options ) )
|
1133 |
-
{
|
1134 |
-
// delete old options
|
1135 |
-
delete_option( 'option_tree' );
|
1136 |
-
|
1137 |
-
// create new options
|
1138 |
-
add_option('option_tree', $new_options);
|
1139 |
-
|
1140 |
-
// update active layout content
|
1141 |
-
$options_layouts = get_option( 'option_tree_layouts' );
|
1142 |
-
if ( isset( $options_layouts['active_layout'] ) ) {
|
1143 |
-
$options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_options ) );
|
1144 |
-
update_option( 'option_tree_layouts', $options_layouts );
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
// hook after import, before AJAX is returned
|
1148 |
-
do_action( 'option_tree_import_data' );
|
1149 |
-
|
1150 |
-
// redirect
|
1151 |
-
die();
|
1152 |
-
}
|
1153 |
-
// failed
|
1154 |
-
die('-1');
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
/**
|
1158 |
-
* Update Layouts data via AJAX
|
1159 |
-
*
|
1160 |
-
* @uses check_ajax_referer()
|
1161 |
-
* @uses get_option()
|
1162 |
-
*
|
1163 |
-
* @access public
|
1164 |
-
* @since 1.1.7
|
1165 |
-
*
|
1166 |
-
* @return void
|
1167 |
-
*/
|
1168 |
-
function option_tree_update_export_data()
|
1169 |
-
{
|
1170 |
-
global $wpdb;
|
1171 |
-
|
1172 |
-
// check AJAX referer
|
1173 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
1174 |
-
|
1175 |
-
$saved = $_REQUEST['saved'];
|
1176 |
-
$updated = base64_encode( serialize( get_option( 'option_tree' ) ) );
|
1177 |
-
|
1178 |
-
// check if array()
|
1179 |
-
if ( $saved != $updated )
|
1180 |
-
{
|
1181 |
-
die($updated);
|
1182 |
-
}
|
1183 |
-
// failed
|
1184 |
-
die('-1');
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
/**
|
1188 |
-
* Save Layout via AJAX
|
1189 |
-
*
|
1190 |
-
* @uses check_ajax_referer()
|
1191 |
-
* @uses get_option()
|
1192 |
-
* @uses update_option()
|
1193 |
-
* @uses add_option()
|
1194 |
-
*
|
1195 |
-
* @access public
|
1196 |
-
* @since 1.1.7
|
1197 |
-
*
|
1198 |
-
* @return void
|
1199 |
-
*/
|
1200 |
-
function option_tree_save_layout()
|
1201 |
-
{
|
1202 |
-
global $wpdb;
|
1203 |
-
|
1204 |
-
// check AJAX referer
|
1205 |
-
if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
|
1206 |
-
{
|
1207 |
-
// Check AJAX Referer
|
1208 |
-
check_ajax_referer( '_theme_options', '_ajax_nonce' );
|
1209 |
-
}
|
1210 |
-
else
|
1211 |
-
{
|
1212 |
-
// check AJAX referer
|
1213 |
-
check_ajax_referer( '_save_layout', '_ajax_nonce' );
|
1214 |
-
}
|
1215 |
-
|
1216 |
-
// Get Data
|
1217 |
-
$string = $_REQUEST['options_name'];
|
1218 |
-
|
1219 |
-
// set default layout name
|
1220 |
-
if ( !$string )
|
1221 |
-
$string = 'default';
|
1222 |
-
|
1223 |
-
// replace whitespace and set to lower case
|
1224 |
-
$string = str_replace(' ', '-', strtolower( $string ) );
|
1225 |
-
|
1226 |
-
// get options and encode
|
1227 |
-
$options = get_option( 'option_tree' );
|
1228 |
-
$options = base64_encode( serialize( $options ) );
|
1229 |
-
|
1230 |
-
// get saved layouts
|
1231 |
-
$options_layouts = get_option( 'option_tree_layouts' );
|
1232 |
-
|
1233 |
-
if ( is_array( $options_layouts ) )
|
1234 |
-
{
|
1235 |
-
$options_layouts['active_layout'] = $string;
|
1236 |
-
$options_layouts[$string] = $options;
|
1237 |
-
update_option( 'option_tree_layouts', $options_layouts );
|
1238 |
-
}
|
1239 |
-
else
|
1240 |
-
{
|
1241 |
-
delete_option( 'option_tree_layouts' );
|
1242 |
-
add_option( 'option_tree_layouts', array( 'active_layout' => $string, $string => $options ) );
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
// hook after save, before AJAX is returned
|
1246 |
-
do_action( 'option_tree_save_layout' );
|
1247 |
-
|
1248 |
-
// redirect
|
1249 |
-
if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
|
1250 |
-
{
|
1251 |
-
die('admin.php?page=option_tree&layout_saved=true');
|
1252 |
-
}
|
1253 |
-
else
|
1254 |
-
{
|
1255 |
-
die( $options );
|
1256 |
-
}
|
1257 |
-
}
|
1258 |
-
|
1259 |
-
/**
|
1260 |
-
* Delete Layout via AJAX
|
1261 |
-
*
|
1262 |
-
* @uses check_ajax_referer()
|
1263 |
-
* @uses get_option()
|
1264 |
-
* @uses update_option()
|
1265 |
-
* @uses add_option()
|
1266 |
-
*
|
1267 |
-
* @access public
|
1268 |
-
* @since 1.1.7
|
1269 |
-
*
|
1270 |
-
* @return void
|
1271 |
-
*/
|
1272 |
-
function option_tree_delete_layout()
|
1273 |
-
{
|
1274 |
-
global $wpdb;
|
1275 |
-
|
1276 |
-
// check AJAX referer
|
1277 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
1278 |
-
|
1279 |
-
// grab ID
|
1280 |
-
$id = $_REQUEST['id'];
|
1281 |
-
|
1282 |
-
$options_layouts = get_option( 'option_tree_layouts' );
|
1283 |
-
|
1284 |
-
// remove the item
|
1285 |
-
unset( $options_layouts[$id] );
|
1286 |
-
|
1287 |
-
// check active layout and unset if deleted
|
1288 |
-
if ( $options_layouts['active_layout'] == $id )
|
1289 |
-
{
|
1290 |
-
unset( $options_layouts['active_layout'] );
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
update_option( 'option_tree_layouts', $options_layouts );
|
1294 |
-
|
1295 |
-
// hook after delete, before AJAX is returned
|
1296 |
-
do_action( 'option_tree_delete_layout' );
|
1297 |
-
|
1298 |
-
die( 'removed' );
|
1299 |
-
}
|
1300 |
-
|
1301 |
-
/**
|
1302 |
-
* Activate Layout via AJAX
|
1303 |
-
*
|
1304 |
-
* @uses check_ajax_referer()
|
1305 |
-
* @uses get_option()
|
1306 |
-
* @uses update_option()
|
1307 |
-
* @uses add_option()
|
1308 |
-
*
|
1309 |
-
* @access public
|
1310 |
-
* @since 1.1.7
|
1311 |
-
*
|
1312 |
-
* @return void
|
1313 |
-
*/
|
1314 |
-
function option_tree_activate_layout()
|
1315 |
-
{
|
1316 |
-
global $wpdb;
|
1317 |
-
|
1318 |
-
if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
|
1319 |
-
{
|
1320 |
-
// Check AJAX Referer
|
1321 |
-
check_ajax_referer( '_theme_options', '_ajax_nonce' );
|
1322 |
-
}
|
1323 |
-
else
|
1324 |
-
{
|
1325 |
-
// check AJAX referer
|
1326 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
1327 |
-
}
|
1328 |
-
|
1329 |
-
// grab ID
|
1330 |
-
$id = $_REQUEST['id'];
|
1331 |
-
|
1332 |
-
// Get Saved Options
|
1333 |
-
$options_layouts = get_option('option_tree_layouts');
|
1334 |
-
|
1335 |
-
// Unserialize The Array
|
1336 |
-
$new_options = unserialize( base64_decode( $options_layouts[$id] ) );
|
1337 |
-
|
1338 |
-
// check if array()
|
1339 |
-
if ( is_array( $new_options ) )
|
1340 |
-
{
|
1341 |
-
// delete old options
|
1342 |
-
delete_option( 'option_tree' );
|
1343 |
-
|
1344 |
-
// set active layout
|
1345 |
-
$options_layouts['active_layout'] = $id;
|
1346 |
-
update_option('option_tree_layouts', $options_layouts);
|
1347 |
-
|
1348 |
-
// create new options
|
1349 |
-
add_option( 'option_tree', $new_options );
|
1350 |
-
|
1351 |
-
// hook after activate, before AJAX is returned
|
1352 |
-
do_action( 'option_tree_activate_layout' );
|
1353 |
-
|
1354 |
-
// redirect
|
1355 |
-
if ( $this->has_xml == true && $this->show_docs == false )
|
1356 |
-
{
|
1357 |
-
die('themes.php?page=option_tree&layout=true');
|
1358 |
-
}
|
1359 |
-
else if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
|
1360 |
-
{
|
1361 |
-
die('admin.php?page=option_tree&layout=true');
|
1362 |
-
}
|
1363 |
-
else
|
1364 |
-
{
|
1365 |
-
die('activated');
|
1366 |
-
}
|
1367 |
-
|
1368 |
-
}
|
1369 |
-
|
1370 |
-
// failed
|
1371 |
-
die('-1');
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
/**
|
1375 |
-
* Import Layouts via AJAX
|
1376 |
-
*
|
1377 |
-
* @uses check_ajax_referer()
|
1378 |
-
* @uses delete_option()
|
1379 |
-
* @uses add_option()
|
1380 |
-
*
|
1381 |
-
* @access public
|
1382 |
-
* @since 1.1.7
|
1383 |
-
*
|
1384 |
-
* @return void
|
1385 |
-
*/
|
1386 |
-
function option_tree_import_layout()
|
1387 |
-
{
|
1388 |
-
global $wpdb;
|
1389 |
-
|
1390 |
-
// check AJAX referer
|
1391 |
-
check_ajax_referer( '_import_layout', '_ajax_nonce' );
|
1392 |
-
|
1393 |
-
// Get Data
|
1394 |
-
$string = $_REQUEST['import_option_layouts'];
|
1395 |
-
|
1396 |
-
// Unserialize The Array
|
1397 |
-
$new_options = unserialize( base64_decode( $string ) );
|
1398 |
-
|
1399 |
-
// check if array()
|
1400 |
-
if ( is_array( $new_options ) )
|
1401 |
-
{
|
1402 |
-
// delete old layouts
|
1403 |
-
delete_option( 'option_tree_layouts' );
|
1404 |
-
|
1405 |
-
// create new layouts
|
1406 |
-
add_option('option_tree_layouts', $new_options);
|
1407 |
-
|
1408 |
-
// hook after import, before redirect
|
1409 |
-
do_action( 'option_tree_import_layout' );
|
1410 |
-
|
1411 |
-
// redirect
|
1412 |
-
die('admin.php?page=option_tree_settings&layout=true&cache=buster_'.mt_rand(5, 100).'#layout_options');
|
1413 |
-
}
|
1414 |
-
// failed
|
1415 |
-
die('-1');
|
1416 |
-
}
|
1417 |
-
|
1418 |
-
/**
|
1419 |
-
* Update Layouts data via AJAX
|
1420 |
-
*
|
1421 |
-
* @uses check_ajax_referer()
|
1422 |
-
* @uses get_option()
|
1423 |
-
*
|
1424 |
-
* @access public
|
1425 |
-
* @since 1.1.7
|
1426 |
-
*
|
1427 |
-
* @return void
|
1428 |
-
*/
|
1429 |
-
function option_tree_update_export_layout()
|
1430 |
-
{
|
1431 |
-
global $wpdb;
|
1432 |
-
|
1433 |
-
// check AJAX referer
|
1434 |
-
check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
|
1435 |
-
|
1436 |
-
$saved = $_REQUEST['saved'];
|
1437 |
-
$updated = base64_encode( serialize( get_option( 'option_tree_layouts' ) ) );
|
1438 |
-
|
1439 |
-
// check if array()
|
1440 |
-
if ( $saved != $updated )
|
1441 |
-
{
|
1442 |
-
die($updated);
|
1443 |
-
}
|
1444 |
-
// failed
|
1445 |
-
die('-1');
|
1446 |
-
}
|
1447 |
-
|
1448 |
-
function option_tree_add_slider()
|
1449 |
-
{
|
1450 |
-
$count = $_GET['count'] + 1;
|
1451 |
-
$id = $_GET['slide_id'];
|
1452 |
-
$image = array(
|
1453 |
-
'order' => $count,
|
1454 |
-
'title' => '',
|
1455 |
-
'image' => '',
|
1456 |
-
'link' => '',
|
1457 |
-
'description' => ''
|
1458 |
-
);
|
1459 |
-
option_tree_slider_view( $id, $image, $this->get_option_page_ID('media'), $count );
|
1460 |
-
die();
|
1461 |
-
}
|
1462 |
-
|
1463 |
-
/**
|
1464 |
-
* Returns the ID of a cutom post tpye
|
1465 |
-
*
|
1466 |
-
* @uses get_results()
|
1467 |
-
*
|
1468 |
-
* @access public
|
1469 |
-
* @since 1.0.0
|
1470 |
-
*
|
1471 |
-
* @param string $page_title
|
1472 |
-
*
|
1473 |
-
* @return int
|
1474 |
-
*/
|
1475 |
-
function get_option_page_ID( $page_title = '' )
|
1476 |
-
{
|
1477 |
-
global $wpdb;
|
1478 |
-
|
1479 |
-
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE `post_name` = '{$page_title}' AND `post_type` = 'option-tree' AND `post_status` = 'private'");
|
1480 |
-
}
|
1481 |
-
|
1482 |
-
/**
|
1483 |
-
* Register custom post type & create two posts
|
1484 |
-
*
|
1485 |
-
* @uses get_results()
|
1486 |
-
*
|
1487 |
-
* @access public
|
1488 |
-
* @since 1.0.0
|
1489 |
-
*
|
1490 |
-
* @return void
|
1491 |
-
*/
|
1492 |
-
function create_option_post()
|
1493 |
-
{
|
1494 |
-
global $current_user;
|
1495 |
-
|
1496 |
-
// profile show docs & settings checkbox
|
1497 |
-
$this->show_docs = ( get_the_author_meta( 'show_docs', $current_user->ID ) == "Yes" ) ? true : false;
|
1498 |
-
|
1499 |
-
register_post_type( 'option-tree', array(
|
1500 |
-
'labels' => array(
|
1501 |
-
'name' => __( 'Options' ),
|
1502 |
-
),
|
1503 |
-
'public' => true,
|
1504 |
-
'show_ui' => false,
|
1505 |
-
'capability_type' => 'post',
|
1506 |
-
'exclude_from_search' => true,
|
1507 |
-
'hierarchical' => false,
|
1508 |
-
'rewrite' => false,
|
1509 |
-
'supports' => array( 'title', 'editor' ),
|
1510 |
-
'can_export' => true,
|
1511 |
-
'show_in_nav_menus' => false,
|
1512 |
-
) );
|
1513 |
-
|
1514 |
-
// create a private page to attach media to
|
1515 |
-
if ( isset($_GET['page']) && $_GET['page'] == 'option_tree' )
|
1516 |
-
{
|
1517 |
-
// look for custom page
|
1518 |
-
$page_id = $this->get_option_page_ID( 'media' );
|
1519 |
-
|
1520 |
-
// no page create it
|
1521 |
-
if ( ! $page_id )
|
1522 |
-
{
|
1523 |
-
// create post object
|
1524 |
-
$_p = array();
|
1525 |
-
$_p['post_title'] = 'Media';
|
1526 |
-
$_p['post_status'] = 'private';
|
1527 |
-
$_p['post_type'] = 'option-tree';
|
1528 |
-
$_p['comment_status'] = 'closed';
|
1529 |
-
$_p['ping_status'] = 'closed';
|
1530 |
-
|
1531 |
-
// insert the post into the database
|
1532 |
-
$page_id = wp_insert_post( $_p );
|
1533 |
-
}
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
// create a private page for settings page
|
1537 |
-
if ( isset($_GET['page']) && $_GET['page'] == 'option_tree_settings' )
|
1538 |
-
{
|
1539 |
-
// look for custom page
|
1540 |
-
$page_id = $this->get_option_page_ID( 'options' );
|
1541 |
-
|
1542 |
-
// no page create it
|
1543 |
-
if ( ! $page_id )
|
1544 |
-
{
|
1545 |
-
// create post object
|
1546 |
-
$_p = array();
|
1547 |
-
$_p['post_title'] = 'Options';
|
1548 |
-
$_p['post_status'] = 'private';
|
1549 |
-
$_p['post_type'] = 'option-tree';
|
1550 |
-
$_p['comment_status'] = 'closed';
|
1551 |
-
$_p['ping_status'] = 'closed';
|
1552 |
-
|
1553 |
-
// insert the post into the database
|
1554 |
-
$page_id = wp_insert_post( $_p );
|
1555 |
-
}
|
1556 |
-
}
|
1557 |
-
}
|
1558 |
-
|
1559 |
-
/**
|
1560 |
-
* Outputs the notice message to say that someone else is editing this post at the moment.
|
1561 |
-
*
|
1562 |
-
* @uses get_userdata()
|
1563 |
-
* @uses get_post_meta()
|
1564 |
-
* @uses esc_html()
|
1565 |
-
*
|
1566 |
-
* @access public
|
1567 |
-
* @since 1.0.0
|
1568 |
-
*
|
1569 |
-
* @param int $post_id
|
1570 |
-
*
|
1571 |
-
* @return string
|
1572 |
-
*/
|
1573 |
-
function option_tree_notice_post_locked( $post_id )
|
1574 |
-
{
|
1575 |
-
if ( !$post_id )
|
1576 |
-
return false;
|
1577 |
-
|
1578 |
-
$last_user = get_userdata( get_post_meta( $post_id, '_edit_last', true ) );
|
1579 |
-
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
1580 |
-
$the_page = ( $_GET['page'] == 'option_tree' ) ? __('Theme Options') : __('Settings');
|
1581 |
-
|
1582 |
-
$message = sprintf( __( 'Warning: %s is currently editing the %s.' ), esc_html( $last_user_name ), $the_page );
|
1583 |
-
return '<div class="message warning"><span> </span>'.$message.'</div>';
|
1584 |
-
}
|
1585 |
-
|
1586 |
-
/**
|
1587 |
-
* Check to see if the post is currently being edited by another user.
|
1588 |
-
*
|
1589 |
-
* @uses get_post_meta()
|
1590 |
-
* @uses apply_filters()
|
1591 |
-
* @uses get_current_user_id()
|
1592 |
-
*
|
1593 |
-
* @access public
|
1594 |
-
* @since 1.0.0
|
1595 |
-
*
|
1596 |
-
* @param int $post_id
|
1597 |
-
*
|
1598 |
-
* @return bool
|
1599 |
-
*/
|
1600 |
-
function option_tree_check_post_lock( $post_id )
|
1601 |
-
{
|
1602 |
-
if ( !$post_id )
|
1603 |
-
return false;
|
1604 |
-
|
1605 |
-
$lock = get_post_meta( $post_id, '_edit_lock', true );
|
1606 |
-
$last = get_post_meta( $post_id, '_edit_last', true );
|
1607 |
-
|
1608 |
-
$time_window = apply_filters( 'wp_check_post_lock_window', 30 );
|
1609 |
-
|
1610 |
-
if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
|
1611 |
-
return $last;
|
1612 |
-
|
1613 |
-
return false;
|
1614 |
-
}
|
1615 |
-
|
1616 |
-
/**
|
1617 |
-
* Mark the post as currently being edited by the current user
|
1618 |
-
*
|
1619 |
-
* @uses update_post_meta()
|
1620 |
-
* @uses get_current_user_id()
|
1621 |
-
*
|
1622 |
-
* @access public
|
1623 |
-
* @since 1.0.0
|
1624 |
-
*
|
1625 |
-
* @param int $post_id
|
1626 |
-
*
|
1627 |
-
* @return bool
|
1628 |
-
*/
|
1629 |
-
function option_tree_set_post_lock( $post_id )
|
1630 |
-
{
|
1631 |
-
if ( !$post_id )
|
1632 |
-
return false;
|
1633 |
-
|
1634 |
-
if ( 0 == get_current_user_id() )
|
1635 |
-
return false;
|
1636 |
-
|
1637 |
-
$now = time();
|
1638 |
-
|
1639 |
-
update_post_meta( $post_id, '_edit_lock', $now );
|
1640 |
-
update_post_meta( $post_id, '_edit_last', get_current_user_id() );
|
1641 |
-
}
|
1642 |
-
|
1643 |
-
/**
|
1644 |
-
* Remove the post lock
|
1645 |
-
*
|
1646 |
-
* @uses delete_post_meta()
|
1647 |
-
*
|
1648 |
-
* @access public
|
1649 |
-
* @since 1.0.0
|
1650 |
-
*
|
1651 |
-
* @param int $post_id
|
1652 |
-
*
|
1653 |
-
* @return bool
|
1654 |
-
*/
|
1655 |
-
function option_tree_remove_post_lock( $post_id )
|
1656 |
-
{
|
1657 |
-
if ( !$post_id )
|
1658 |
-
return false;
|
1659 |
-
|
1660 |
-
delete_post_meta( $post_id, '_edit_lock' );
|
1661 |
-
delete_post_meta( $post_id, '_edit_last' );
|
1662 |
-
}
|
1663 |
-
|
1664 |
-
/**
|
1665 |
-
* Extra Profile Fields
|
1666 |
-
*
|
1667 |
-
* @uses get_the_author_meta()
|
1668 |
-
*
|
1669 |
-
* @access public
|
1670 |
-
* @since 1.8
|
1671 |
-
*
|
1672 |
-
* @param option_tree
|
1673 |
-
*
|
1674 |
-
* @return void
|
1675 |
-
*/
|
1676 |
-
function option_tree_extra_profile_fields( $user )
|
1677 |
-
{
|
1678 |
-
?>
|
1679 |
-
<h3>Option Tree</h3>
|
1680 |
-
<table class="form-table">
|
1681 |
-
<tr>
|
1682 |
-
<th scope="row"><?php _e( 'Show Settings & Docs', 'option-tree' ); ?></th>
|
1683 |
-
<td>
|
1684 |
-
<input type="checkbox" name="show_docs" value="<?php echo esc_attr( get_the_author_meta( 'show_docs', $user->ID ) ); ?>"<?php if(esc_attr( get_the_author_meta( 'show_docs', $user->ID ) ) == "Yes"){ echo ' checked="checked"'; } ?> />
|
1685 |
-
<label for="show_docs"><?php _e( 'Yes', 'option-tree' ); ?></label>
|
1686 |
-
</td>
|
1687 |
-
</tr>
|
1688 |
-
</table>
|
1689 |
-
<?php
|
1690 |
-
}
|
1691 |
-
|
1692 |
-
|
1693 |
-
/**
|
1694 |
-
* Extra Profile Fields Save
|
1695 |
-
*
|
1696 |
-
* @uses current_user_can()
|
1697 |
-
*
|
1698 |
-
* @access public
|
1699 |
-
* @since 1.8
|
1700 |
-
*
|
1701 |
-
* @param option_tree
|
1702 |
-
*
|
1703 |
-
* @return void
|
1704 |
-
*/
|
1705 |
-
function option_tree_save_extra_profile_fields( $user_id )
|
1706 |
-
{
|
1707 |
-
if ( !current_user_can( 'edit_user', $user_id ) )
|
1708 |
-
return false;
|
1709 |
-
|
1710 |
-
$ot_view = isset( $_POST['show_docs'] ) ? 'Yes' : 'No';
|
1711 |
-
update_user_meta( $user_id, 'show_docs', $ot_view );
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
}
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
front-end/docs.php
DELETED
@@ -1,627 +0,0 @@
|
|
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"> </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 & 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 |
-
<li><a href="#layouts">Adding Layouts</a><span></span></li>
|
25 |
-
<li><a href="#integration">Theme Integration</a><span></span></li>
|
26 |
-
</ul>
|
27 |
-
|
28 |
-
<div id="general" class="block">
|
29 |
-
<h2>Usage & Examples</h2>
|
30 |
-
<h3>Function Reference/get_option_tree</h3>
|
31 |
-
|
32 |
-
<h3>Description</h3>
|
33 |
-
<p>Displays or returns a value from the 'option_tree' array.</p>
|
34 |
-
|
35 |
-
<h3>Usage</h3>
|
36 |
-
<p><code><?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?></code></p>
|
37 |
-
|
38 |
-
<h3>Default Usage</h3>
|
39 |
-
<pre><code>get_option_tree(
|
40 |
-
'item_id' => '',
|
41 |
-
'options' => '',
|
42 |
-
'echo' => 'false',
|
43 |
-
'is_array' => 'false',
|
44 |
-
'offset' => -1,
|
45 |
-
);</code></pre>
|
46 |
-
|
47 |
-
<h3>Parameters</h3>
|
48 |
-
<p>
|
49 |
-
<code><strong>$item_id</strong></code>
|
50 |
-
<br /> (<em>string</em>) (<em>required</em>) Enter a unique Option Key to get a returned value or array.
|
51 |
-
<br /> Default: <em>None</em>
|
52 |
-
</p>
|
53 |
-
<p>
|
54 |
-
<code><strong>$options</strong></code>
|
55 |
-
<br /> (<em>array</em>) (<em>optional</em>) Used to cut down on database queries in template files.
|
56 |
-
<br /> Default: <em>None</em>
|
57 |
-
</p>
|
58 |
-
<p>
|
59 |
-
<code><strong>$echo</strong></code>
|
60 |
-
<br /> (<em>boolean</em>) (<em>optional</em>) Echo the output.
|
61 |
-
<br /> Default: FALSE
|
62 |
-
</p>
|
63 |
-
<p>
|
64 |
-
<code><strong>$is_array</strong></code>
|
65 |
-
<br /> (<em>boolean</em>) (<em>optional</em>) Used to indicate the $item_id is an array of values.
|
66 |
-
<br /> Default: FALSE
|
67 |
-
</p>
|
68 |
-
<p>
|
69 |
-
<code><strong>$offset</strong></code>
|
70 |
-
<br /> (<em>integer</em>) (<em>optional</em>) Numeric offset key for the $item_id array, -1 will return all values (an array starts at 0).
|
71 |
-
<br /> Default: -1
|
72 |
-
</p>
|
73 |
-
|
74 |
-
|
75 |
-
<h3>Examples</h3>
|
76 |
-
<p>
|
77 |
-
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.
|
78 |
-
<pre><code><?php $theme_options = get_option('option_tree'); ?></code></pre>
|
79 |
-
</p>
|
80 |
-
|
81 |
-
<p>
|
82 |
-
This example returns the $item_id value.
|
83 |
-
<pre><code><?php
|
84 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
85 |
-
get_option_tree( 'test_option' );
|
86 |
-
}
|
87 |
-
?></code></pre>
|
88 |
-
</p>
|
89 |
-
|
90 |
-
<p>
|
91 |
-
These examples will echo the $item_id value.
|
92 |
-
<pre><code><?php
|
93 |
-
if ( function_exists( 'get_option_tree') ) {
|
94 |
-
get_option_tree( 'test_option', '', true );
|
95 |
-
}
|
96 |
-
?>
|
97 |
-
|
98 |
-
<?php
|
99 |
-
if ( function_exists( 'get_option_tree') ) {
|
100 |
-
echo get_option_tree( 'test_option' );
|
101 |
-
}
|
102 |
-
?></code></pre>
|
103 |
-
</p>
|
104 |
-
|
105 |
-
<p>
|
106 |
-
This example will echo the value of $item_id by grabbing the first offset key in the array.
|
107 |
-
<pre><code><?php
|
108 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
109 |
-
get_option_tree( 'test_option', '', true, true, 0 );
|
110 |
-
}
|
111 |
-
?></code></pre>
|
112 |
-
</p>
|
113 |
-
|
114 |
-
<p>
|
115 |
-
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).
|
116 |
-
<pre><code><?php
|
117 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
118 |
-
// set an array of page id's
|
119 |
-
$ids = get_option_tree( 'list_of_page_ids', $theme_options, false, true, -1 );
|
120 |
-
|
121 |
-
// loop through id's & echo custom navigation
|
122 |
-
echo '<ul>';
|
123 |
-
foreach( $ids as $id ) {
|
124 |
-
echo '<li><a href="'.get_permalink($id).'">'.get_the_title($id).'</a></li>';
|
125 |
-
}
|
126 |
-
echo '</ul>';
|
127 |
-
}
|
128 |
-
?></code></pre>
|
129 |
-
OR a more WordPress version would be:<br /><br />
|
130 |
-
<pre><code><?php
|
131 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
132 |
-
// set an array of page id's
|
133 |
-
$ids = get_option_tree( 'list_of_page_ids', $theme_options, false, true, -1 );
|
134 |
-
|
135 |
-
// echo custom navigation using wp_list_pages()
|
136 |
-
echo '<ul>';
|
137 |
-
wp_list_pages(
|
138 |
-
array(
|
139 |
-
'include' => $ids,
|
140 |
-
'title_li' => ''
|
141 |
-
)
|
142 |
-
);
|
143 |
-
echo '</ul>';
|
144 |
-
}
|
145 |
-
?></code></pre>
|
146 |
-
</p>
|
147 |
-
|
148 |
-
<p>
|
149 |
-
This example explains how to use the Measurement post type in your PHP files. The Measurement post type is an array of key/value pairs where the first key's value is the value of the measurement and the second key's value is the unit of measurement.
|
150 |
-
</p>
|
151 |
-
<pre><code><?php
|
152 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
153 |
-
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true );
|
154 |
-
echo $measurement[0].$measurement[1];
|
155 |
-
}
|
156 |
-
?></code></pre>
|
157 |
-
|
158 |
-
<p>
|
159 |
-
<strong>OR:</strong>
|
160 |
-
</p>
|
161 |
-
<pre><code><?php
|
162 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
163 |
-
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true, 0 );
|
164 |
-
$unit = get_option_tree( 'measurement_type_id', $theme_options, false, true, 1 );
|
165 |
-
echo $measurement.$unit;
|
166 |
-
}
|
167 |
-
?></code></pre>
|
168 |
-
|
169 |
-
<p>
|
170 |
-
<strong>OR:</strong>
|
171 |
-
</p>
|
172 |
-
<pre><code><?php
|
173 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
174 |
-
$measurement = get_option_tree( 'measurement_type_id', $theme_options, false, true, -1 );
|
175 |
-
echo implode( '', $measurement );
|
176 |
-
}
|
177 |
-
?></code></pre>
|
178 |
-
|
179 |
-
|
180 |
-
<p>
|
181 |
-
This example displays a very basic slider loop.
|
182 |
-
<pre><code><?php
|
183 |
-
if ( function_exists( 'get_option_tree' ) ) {
|
184 |
-
$slides = get_option_tree( 'my_slider', $option_tree, false, true, -1 );
|
185 |
-
foreach( $slides as $slide ) {
|
186 |
-
echo '
|
187 |
-
<li>
|
188 |
-
<a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'" /></a>
|
189 |
-
<div class="description">'.$slide['description'].'</div>
|
190 |
-
</li>';
|
191 |
-
}
|
192 |
-
}
|
193 |
-
?></code></pre>
|
194 |
-
</p>
|
195 |
-
|
196 |
-
</div>
|
197 |
-
|
198 |
-
<div id="option_types" class="block">
|
199 |
-
<h2>Option Types</h2>
|
200 |
-
<h3>Overview of available Option Types.</h3>
|
201 |
-
|
202 |
-
<p>
|
203 |
-
<strong>Heading</strong>:<br />
|
204 |
-
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.
|
205 |
-
</p>
|
206 |
-
|
207 |
-
<p>
|
208 |
-
<strong>Textblock</strong>:<br />
|
209 |
-
Used only in the WordPress Admin area. A Textblock will allow you to create & 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.
|
210 |
-
</p>
|
211 |
-
|
212 |
-
<p>
|
213 |
-
<strong>Input</strong>:<br />
|
214 |
-
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.
|
215 |
-
</p>
|
216 |
-
|
217 |
-
<p>
|
218 |
-
<strong>Checkbox</strong>:<br />
|
219 |
-
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.
|
220 |
-
</p>
|
221 |
-
|
222 |
-
<p>
|
223 |
-
<strong>Radio</strong>:<br />
|
224 |
-
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.
|
225 |
-
</p>
|
226 |
-
|
227 |
-
<p>
|
228 |
-
<strong>Select</strong>:<br />
|
229 |
-
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.
|
230 |
-
</p>
|
231 |
-
|
232 |
-
<p>
|
233 |
-
<strong>Textarea</strong>:<br />
|
234 |
-
With the Textarea option type users can add custom code or text for use in the theme.
|
235 |
-
</p>
|
236 |
-
|
237 |
-
<p>
|
238 |
-
<strong>Upload</strong>:<br />
|
239 |
-
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>" or "<strong style="color:red;">Add to OptionTree</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.
|
240 |
-
</p>
|
241 |
-
|
242 |
-
<p>
|
243 |
-
<strong>Colorpicker</strong>:<br />
|
244 |
-
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.
|
245 |
-
</p>
|
246 |
-
|
247 |
-
<p>
|
248 |
-
<strong>Post</strong>:<br />
|
249 |
-
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.
|
250 |
-
</p>
|
251 |
-
|
252 |
-
<p>
|
253 |
-
<strong>Posts</strong>:<br />
|
254 |
-
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.
|
255 |
-
</p>
|
256 |
-
|
257 |
-
<p>
|
258 |
-
<strong>Page</strong>:<br />
|
259 |
-
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.
|
260 |
-
</p>
|
261 |
-
|
262 |
-
<p>
|
263 |
-
<strong>Pages</strong>:<br />
|
264 |
-
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.
|
265 |
-
</p>
|
266 |
-
|
267 |
-
<p>
|
268 |
-
<strong>Category</strong>:<br />
|
269 |
-
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.
|
270 |
-
</p>
|
271 |
-
|
272 |
-
<p>
|
273 |
-
<strong>Categories</strong>:<br />
|
274 |
-
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.
|
275 |
-
</p>
|
276 |
-
|
277 |
-
<p>
|
278 |
-
<strong>Tag</strong>:<br />
|
279 |
-
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.
|
280 |
-
</p>
|
281 |
-
|
282 |
-
<p>
|
283 |
-
<strong>Tags</strong>:<br />
|
284 |
-
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.
|
285 |
-
</p>
|
286 |
-
|
287 |
-
<p>
|
288 |
-
<strong>Custom Post</strong>:<br />
|
289 |
-
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.
|
290 |
-
</p>
|
291 |
-
|
292 |
-
<p>
|
293 |
-
<strong>Custom Posts</strong>:<br />
|
294 |
-
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.
|
295 |
-
</p>
|
296 |
-
|
297 |
-
<p>
|
298 |
-
<strong>Measurement</strong>:<br />
|
299 |
-
The Measurement option type is a mix of input and select fields. The text input excepts a value and the select list lets you choose the unit of measurement to add to that value. Currently the default units are px, %, em, pt. However, you can change them with the<code>measurement_unit_types</code> filter.
|
300 |
-
</p>
|
301 |
-
|
302 |
-
<p>
|
303 |
-
<strong>Filter to completely change the units in the Measurement option type</strong><br />
|
304 |
-
Added to functions.php
|
305 |
-
</p>
|
306 |
-
|
307 |
-
<pre><code>add_filter( 'measurement_unit_types', 'custom_unit_types' );
|
308 |
-
|
309 |
-
function custom_unit_types() {
|
310 |
-
$array = array(
|
311 |
-
'in' => 'inches',
|
312 |
-
'ft' => 'feet'
|
313 |
-
);
|
314 |
-
return $array;
|
315 |
-
}</code></pre>
|
316 |
-
|
317 |
-
<p>
|
318 |
-
<strong>Filter to add new units in the Measurement option type</strong><br />
|
319 |
-
Added to functions.php
|
320 |
-
</p>
|
321 |
-
|
322 |
-
<pre><code>add_filter( 'measurement_unit_types', 'custom_unit_types' );
|
323 |
-
|
324 |
-
function custom_unit_types($array) {
|
325 |
-
$array['in'] = 'inches';
|
326 |
-
$array['ft'] = 'feet';
|
327 |
-
return $array;
|
328 |
-
}</code></pre>
|
329 |
-
|
330 |
-
<p>
|
331 |
-
<strong>Slider</strong>:<br />
|
332 |
-
The Slider option type is a mix of elements that you can change with the<code>image_slider_fields</code> filter. The currently supported element types are text, textarea, & hidden. In the future there will be more input types. As well, the current inputs are order, title, image, link, & description. Order & title are required fields. However, the other three can be altered using the filter above.<br />
|
333 |
-
|
334 |
-
<p>
|
335 |
-
<strong>Filter to completely change the input fields in the Slider option type</strong><br />
|
336 |
-
Added to functions.php
|
337 |
-
</p>
|
338 |
-
<pre><code>add_filter( 'image_slider_fields', 'new_slider_fields', 10, 2 );
|
339 |
-
|
340 |
-
function new_slider_fields( $image_slider_fields, $id ) {
|
341 |
-
if ( $id == 'my_slider_id' ) {
|
342 |
-
$image_slider_fields = array(
|
343 |
-
array(
|
344 |
-
'name' => 'image',
|
345 |
-
'type' => 'text',
|
346 |
-
'label' => 'Post Image URL',
|
347 |
-
'class' => ''
|
348 |
-
),
|
349 |
-
array(
|
350 |
-
'name' => 'link',
|
351 |
-
'type' => 'text',
|
352 |
-
'label' => 'Post URL',
|
353 |
-
'class' => ''
|
354 |
-
),
|
355 |
-
array(
|
356 |
-
'name' => 'description',
|
357 |
-
'type' => 'textarea',
|
358 |
-
'label' => 'Post Description',
|
359 |
-
'class' => ''
|
360 |
-
)
|
361 |
-
);
|
362 |
-
}
|
363 |
-
return $image_slider_fields;
|
364 |
-
}</code></pre>
|
365 |
-
|
366 |
-
<p>
|
367 |
-
<strong>Filter to add a new field to the Slider option type</strong><br />
|
368 |
-
Added to functions.php
|
369 |
-
</p>
|
370 |
-
<pre><code>add_filter( 'image_slider_fields', 'new_slider_fields', 10, 2 );
|
371 |
-
|
372 |
-
function new_slider_fields( $image_slider_fields, $id ) {
|
373 |
-
if ( $id == 'my_slider_id' ) {
|
374 |
-
$image_slider_fields[] =
|
375 |
-
array(
|
376 |
-
'name' => 'awesome_field',
|
377 |
-
'type' => 'text',
|
378 |
-
'label' => 'Write Something Awesome',
|
379 |
-
'class' => ''
|
380 |
-
);
|
381 |
-
}
|
382 |
-
return $image_slider_fields;
|
383 |
-
}</code></pre>
|
384 |
-
|
385 |
-
<p>
|
386 |
-
<strong>CSS</strong>:<br />
|
387 |
-
The CSS option type is a simple easy way to add dynamic CSS to your theme from within OptionTree. It will create a file named <code>dynamic.css</code> at the root level of your theme (if it doesn't exist) and update the CSS in that file every time you save your theme options.
|
388 |
-
</p>
|
389 |
-
|
390 |
-
<p>
|
391 |
-
<strong>An few examples of the CSS option type</strong><br />
|
392 |
-
This assumes you have an option with the ID of <code>custom_background_css</code> which will display the saved values for that option.
|
393 |
-
</p>
|
394 |
-
|
395 |
-
<p><strong>Input:</strong></p>
|
396 |
-
<pre><code>body {
|
397 |
-
{{custom_background_css}}
|
398 |
-
background-color: {{custom_background_css|background-color}};
|
399 |
-
}
|
400 |
-
</code></pre>
|
401 |
-
|
402 |
-
<p>
|
403 |
-
<strong>Output:</strong><br />
|
404 |
-
The values saved in the database will replace the text placeholders below.
|
405 |
-
</p>
|
406 |
-
<pre><code>body {
|
407 |
-
background: color image repeat attachment position;
|
408 |
-
background-color: color;
|
409 |
-
}
|
410 |
-
</code></pre>
|
411 |
-
|
412 |
-
<p>
|
413 |
-
<strong>Background</strong>:<br />
|
414 |
-
The Background option type is for adding background styles to your theme dynamically via the CSS option type above or manually with <code>get_option_tree()</code>.
|
415 |
-
</p>
|
416 |
-
|
417 |
-
<p>
|
418 |
-
<strong>Typography</strong>:<br />
|
419 |
-
The Typography option type is for adding typography styles to your theme dynamically via the CSS option type above or manually with <code>get_option_tree()</code>.
|
420 |
-
</p>
|
421 |
-
|
422 |
-
</div>
|
423 |
-
|
424 |
-
<div id="settings" class="block">
|
425 |
-
<h2>Creating Options</h2>
|
426 |
-
<h3>Overview of available Theme Option fields.</h3>
|
427 |
-
|
428 |
-
<p>
|
429 |
-
<strong>Title</strong>:<br />
|
430 |
-
The Title field should be a short but descriptive block of text 100 characters or less with no HTML.
|
431 |
-
</p>
|
432 |
-
|
433 |
-
<p>
|
434 |
-
<strong>Option Key</strong>:<br />
|
435 |
-
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.
|
436 |
-
</p>
|
437 |
-
|
438 |
-
<p style="padding-bottom:5px">
|
439 |
-
<strong>Option Type</strong>:<br />
|
440 |
-
You are required to choose one of the supported option types. They are:
|
441 |
-
</p>
|
442 |
-
<ul class="doc_list">
|
443 |
-
<?php
|
444 |
-
$types = apply_filters( 'option_tree_option_types', array(
|
445 |
-
'heading' => 'Heading',
|
446 |
-
'background' => 'Background',
|
447 |
-
'category' => 'Category',
|
448 |
-
'categories' => 'Categories',
|
449 |
-
'checkbox' => 'Checkbox',
|
450 |
-
'colorpicker' => 'Colorpicker',
|
451 |
-
'css' => 'CSS',
|
452 |
-
'custom_post' => 'Custom Post',
|
453 |
-
'custom_posts' => 'Custom Posts',
|
454 |
-
'input' => 'Input',
|
455 |
-
'measurement' => 'Measurement',
|
456 |
-
'page' => 'Page',
|
457 |
-
'pages' => 'Pages',
|
458 |
-
'post' => 'Post',
|
459 |
-
'posts' => 'Posts',
|
460 |
-
'radio' => 'Radio',
|
461 |
-
'select' => 'Select',
|
462 |
-
'slider' => 'Slider',
|
463 |
-
'tag' => 'Tag',
|
464 |
-
'tags' => 'Tags',
|
465 |
-
'textarea' => 'Textarea',
|
466 |
-
'textblock' => 'Textblock',
|
467 |
-
'typography' => 'Typography',
|
468 |
-
'upload' => 'Upload'
|
469 |
-
) );
|
470 |
-
foreach ( $types as $key => $value ) {
|
471 |
-
echo '<li>'.$value.'</li>';
|
472 |
-
}
|
473 |
-
?>
|
474 |
-
</ul>
|
475 |
-
|
476 |
-
<p>
|
477 |
-
<strong>Description</strong>:<br />
|
478 |
-
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).
|
479 |
-
</p>
|
480 |
-
|
481 |
-
<p>
|
482 |
-
<strong>Options</strong>:<br />
|
483 |
-
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.
|
484 |
-
</p>
|
485 |
-
|
486 |
-
<p>
|
487 |
-
<strong>Row Count</strong>:<br />
|
488 |
-
Enter a numeric value for the number of rows in your textarea.
|
489 |
-
</p>
|
490 |
-
|
491 |
-
<p style="padding-bottom:5px">
|
492 |
-
<strong>Post Type</strong>:<br />
|
493 |
-
Enter your custom post_type. These are the default post types available with WordPress. You can also add your own custom post_type.
|
494 |
-
</p>
|
495 |
-
<ul class="doc_list">
|
496 |
-
<li>post</li>
|
497 |
-
<li>page</li>
|
498 |
-
<li>attachment</li>
|
499 |
-
<li>any</li>
|
500 |
-
</ul>
|
501 |
-
|
502 |
-
</div>
|
503 |
-
|
504 |
-
<div id="layouts" class="block">
|
505 |
-
<h2>Adding Layouts</h2>
|
506 |
-
<h3>Overview on how Layouts work.</h3>
|
507 |
-
|
508 |
-
<p>
|
509 |
-
<strong>It's Super Simple</strong>:<br />
|
510 |
-
Layouts make your theme awesome! Package them with different theme variations, with very little effort. I made adding a layout ridiculously easy, just follow these steps and youl'll be on your way to having a WordPress super theme.
|
511 |
-
</p>
|
512 |
-
|
513 |
-
<h3>For Developers</h3>
|
514 |
-
|
515 |
-
<p style="padding-bottom:5px">
|
516 |
-
<strong>Creating a Layout</strong>:<br />
|
517 |
-
</p>
|
518 |
-
<ul class="doc_list">
|
519 |
-
<li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
|
520 |
-
<li>Enter a name for your layout in the text field and hit "Save Layout", you've created your first layout.</li>
|
521 |
-
<li>Adding new layout is as easy as repeating the steps above.</li>
|
522 |
-
</ul>
|
523 |
-
|
524 |
-
<p style="padding-bottom:5px">
|
525 |
-
<strong>Activating a Layout</strong>:<br />
|
526 |
-
</p>
|
527 |
-
<ul class="doc_list">
|
528 |
-
<li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
|
529 |
-
<li>Click on the activate layout button in the actions list.</li>
|
530 |
-
</ul>
|
531 |
-
|
532 |
-
<p style="padding-bottom:5px">
|
533 |
-
<strong>Deleting a Layout</strong>:<br />
|
534 |
-
</p>
|
535 |
-
<ul class="doc_list">
|
536 |
-
<li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
|
537 |
-
<li>Click on the delete layout button in the actions list.</li>
|
538 |
-
</ul>
|
539 |
-
|
540 |
-
<p style="padding-bottom:5px">
|
541 |
-
<strong>Editing the data of a Layout</strong>:<br />
|
542 |
-
</p>
|
543 |
-
<ul class="doc_list">
|
544 |
-
<li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
|
545 |
-
<li>Modify and save your theme options and the layout will be updated automatically.</li>
|
546 |
-
<li><span style="color:red;">NOTE:</span> Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.</li>
|
547 |
-
<li>If you want to edit a new layout, first create it then save your theme options.</li>
|
548 |
-
</ul>
|
549 |
-
|
550 |
-
<h3>End-Users Mode</h3>
|
551 |
-
|
552 |
-
<p style="padding-bottom:5px">
|
553 |
-
<strong>Creating a Layout</strong>:<br />
|
554 |
-
</p>
|
555 |
-
<ul class="doc_list">
|
556 |
-
<li>End-Users mode does not allow creating new layouts.</li>
|
557 |
-
</ul>
|
558 |
-
|
559 |
-
<p style="padding-bottom:5px">
|
560 |
-
<strong>Activating a Layout</strong>:<br />
|
561 |
-
</p>
|
562 |
-
<ul class="doc_list">
|
563 |
-
<li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
|
564 |
-
<li>Choose a layout from the select list and click the "Activate Layout" button.</li>
|
565 |
-
</ul>
|
566 |
-
|
567 |
-
<p style="padding-bottom:5px">
|
568 |
-
<strong>Deleting a Layout</strong>:<br />
|
569 |
-
</p>
|
570 |
-
<ul class="doc_list">
|
571 |
-
<li>End-Users mode does not allow deleting layouts.</li>
|
572 |
-
</ul>
|
573 |
-
|
574 |
-
<p style="padding-bottom:5px">
|
575 |
-
<strong>Editing the data of a Layout</strong>:<br />
|
576 |
-
</p>
|
577 |
-
<ul class="doc_list">
|
578 |
-
<li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
|
579 |
-
<li>Modify and save your theme options and the layout will be updated automatically.</li>
|
580 |
-
<li><span style="color:red;">NOTE:</span> Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.</li>
|
581 |
-
</ul>
|
582 |
-
|
583 |
-
|
584 |
-
</div>
|
585 |
-
|
586 |
-
<div id="integration" class="block">
|
587 |
-
<h2>Theme Integration</h2>
|
588 |
-
<h3>Overview on how Theme Integration works.</h3>
|
589 |
-
|
590 |
-
<p>
|
591 |
-
<strong>For Developers</strong>:<br />
|
592 |
-
If you have a theme that you want to be OptionTree aware, keep reading.
|
593 |
-
</p>
|
594 |
-
|
595 |
-
<p>
|
596 |
-
After you've built your theme and created all your options on the 'Settings' page and populated your options with default data on the 'Theme Options' page, you can now seamlessly integrate with OptionTree by including two files with your theme (only one is required). It's that simple!
|
597 |
-
</p>
|
598 |
-
|
599 |
-
<p style="padding-bottom:5px">
|
600 |
-
<strong>Getting OtionTree aware</strong>:<br />
|
601 |
-
<span style="color:red;">Follow these instructions.</span>
|
602 |
-
</p>
|
603 |
-
<ul class="doc_list">
|
604 |
-
<li>Export your <a href="admin.php?page=option_tree_settings#export_options">Theme Options XML</a> file and save it somewhere you can get to it and once it's saved, rename it to '<strong>theme-options.xml</strong>'.</li>
|
605 |
-
<li>Copy the <a href="admin.php?page=option_tree_settings#export_options">Theme Options Data</a> string to a new .txt file and name it '<strong>theme-options.txt</strong>' and save it where you can get to it.</li>
|
606 |
-
<li>Copy the <a href="admin.php?page=option_tree_settings#export_options">Layouts</a> string to a new .txt file and name it '<strong>layouts.txt</strong>' and save it where you can get to it.</li>
|
607 |
-
<li>Create a new directory in the root of your themes directory and name it '<strong>option-tree</strong>'.</li>
|
608 |
-
<li>Move your '<strong>layouts.txt</strong>', '<strong>theme-options.txt</strong>', and '<strong>theme-options.xml</strong>' into the '<strong>option-tree</strong>' directory and when the plugin is activated it will populate the defaults from those files.</li>
|
609 |
-
</ul>
|
610 |
-
|
611 |
-
<p>
|
612 |
-
<span style="color:red;">NOTE</span>: the .txt filee are optional and will only be used to populate the data on activation.<br />
|
613 |
-
<span style="color:red;">NOTE</span>: The file names are important, so be sure you have named them correctly.<br />
|
614 |
-
<span style="color:red;">NOTE</span>: If the theme options are not created properly or you can still see the OptionTree menu the .xml file is not readable to the server or you have the files in the wrong place.<br />
|
615 |
-
<span style="color:red;">NOTE</span>: The plugin looks for the '<strong>option-tree</strong>' directory in the child themes root directory first, then the parent if you use a child/parent theme relationship.
|
616 |
-
</p>
|
617 |
-
|
618 |
-
</div>
|
619 |
-
|
620 |
-
<br class="clear" />
|
621 |
-
</div>
|
622 |
-
</div>
|
623 |
-
<div class="info bottom"></div>
|
624 |
-
</div>
|
625 |
-
|
626 |
-
</div>
|
627 |
-
<!-- [END] framework_wrap -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
front-end/options.php
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed'); ?>
|
2 |
-
<div id="framework_wrap" class="wrap">
|
3 |
-
|
4 |
-
<div id="header">
|
5 |
-
<h1>OptionTree</h1>
|
6 |
-
<span class="icon"> </span>
|
7 |
-
<div class="version">
|
8 |
-
<?php echo OT_VERSION; ?>
|
9 |
-
</div>
|
10 |
-
</div>
|
11 |
-
|
12 |
-
<div id="content_wrap">
|
13 |
-
|
14 |
-
<form method="post" id="the-theme-options">
|
15 |
-
|
16 |
-
<div class="info top-info is-option-page">
|
17 |
-
|
18 |
-
<input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit" />
|
19 |
-
|
20 |
-
<div class="top-layout-bar">
|
21 |
-
|
22 |
-
<div class="save-layout-wrap">
|
23 |
-
<input type="text" name="options_name" value="" id="save_theme_layout" />
|
24 |
-
<input type="submit" value="<?php _e('New Layout') ?>" class="button-framework user-save-layout" name="user-save-layout" />
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<?php
|
28 |
-
if ( is_array( $layouts ) && !empty($layouts) )
|
29 |
-
{
|
30 |
-
?>
|
31 |
-
<input type="submit" value="<?php _e('Activate Layout') ?>" class="button-framework user-activate-layout" name="user-activate-layout" style="margin-right:10px;" />
|
32 |
-
<?php
|
33 |
-
echo '<div class="select-layout">';
|
34 |
-
echo '<select name="active_theme_layout" id="active_theme_layout">';
|
35 |
-
echo '<option value="">-- Choose One --</option>';
|
36 |
-
|
37 |
-
$active_layout = $layouts['active_layout'];
|
38 |
-
foreach( $layouts as $key => $v )
|
39 |
-
{
|
40 |
-
if ( $key == 'active_layout')
|
41 |
-
continue;
|
42 |
-
|
43 |
-
$selected = '';
|
44 |
-
if ( $active_layout == trim( $key ) )
|
45 |
-
$selected = ' selected="selected"';
|
46 |
-
|
47 |
-
echo '<option'.$selected.'>'.trim( $key ).'</option>';
|
48 |
-
}
|
49 |
-
echo '</select>';
|
50 |
-
echo '</div>';
|
51 |
-
}
|
52 |
-
?>
|
53 |
-
|
54 |
-
<?php if ( $this->has_xml ) { ?>
|
55 |
-
<input type="submit" value="<?php _e('Reload XML') ?>" class="button-framework reload-options right" name="reload" style="margin:5px 10px 0 20px;" />
|
56 |
-
<?php } ?>
|
57 |
-
|
58 |
-
</div>
|
59 |
-
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<div class="ajax-message<?php if ( isset( $message ) || isset($_GET['updated']) || isset($_GET['layout']) || isset($_GET['layout_saved']) ) { echo ' show'; } ?>">
|
63 |
-
<?php if (isset($_GET['updated'])) { echo '<div class="message"><span> </span>Theme Options were updated.</div>'; } ?>
|
64 |
-
<?php if (isset($_GET['layout'])) { echo '<div class="message"><span> </span>Your Layout has been activated.</div>'; } ?>
|
65 |
-
<?php if (isset($_GET['layout_saved'])) { echo '<div class="message"><span> </span>Layout Saved Successfully.</div>'; } ?>
|
66 |
-
<?php if ( isset( $message ) ) { echo $message; } ?>
|
67 |
-
</div>
|
68 |
-
|
69 |
-
<div id="content">
|
70 |
-
|
71 |
-
<div id="options_tabs">
|
72 |
-
|
73 |
-
<ul class="options_tabs">
|
74 |
-
<?php
|
75 |
-
foreach ( $ot_array as $value )
|
76 |
-
{
|
77 |
-
if ( $value->item_type == 'heading' )
|
78 |
-
{
|
79 |
-
echo '<li><a href="#option_'.$value->item_id.'">' . htmlspecialchars_decode( $value->item_title ).'</a><span></span></li>';
|
80 |
-
}
|
81 |
-
}
|
82 |
-
?>
|
83 |
-
</ul>
|
84 |
-
|
85 |
-
<?php
|
86 |
-
// set count
|
87 |
-
$count = 0;
|
88 |
-
// loop options & load corresponding function
|
89 |
-
foreach ( $ot_array as $value ) {
|
90 |
-
$count++;
|
91 |
-
if ( $value->item_type == 'upload' || $value->item_type == 'background' || $value->item_type == 'slider' ) {
|
92 |
-
$int = $post_id;
|
93 |
-
} else if ( $value->item_type == 'textarea' || $value->item_type == 'css' ) {
|
94 |
-
$int = ( is_numeric( trim( $value->item_options ) ) ) ? trim( $value->item_options ) : ( $value->item_type == 'css' ? 24 : 8);
|
95 |
-
} else {
|
96 |
-
$int = $count;
|
97 |
-
}
|
98 |
-
call_user_func_array( 'option_tree_' . $value->item_type, array( $value, $settings, $int ) );
|
99 |
-
}
|
100 |
-
// close heading
|
101 |
-
echo '</div>';
|
102 |
-
?>
|
103 |
-
|
104 |
-
<br class="clear" />
|
105 |
-
|
106 |
-
</div>
|
107 |
-
|
108 |
-
</div>
|
109 |
-
|
110 |
-
<div class="info bottom">
|
111 |
-
|
112 |
-
<input type="submit" value="<?php _e('Reset Options') ?>" class="button-framework reset" name="reset"/>
|
113 |
-
<input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit"/>
|
114 |
-
|
115 |
-
</div>
|
116 |
-
|
117 |
-
<?php wp_nonce_field( '_theme_options', '_ajax_nonce', false ); ?>
|
118 |
-
|
119 |
-
</form>
|
120 |
-
|
121 |
-
</div>
|
122 |
-
|
123 |
-
</div>
|
124 |
-
<!-- [END] framework_wrap -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
front-end/settings.php
DELETED
@@ -1,364 +0,0 @@
|
|
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"> </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($_GET['layout']) || isset( $message ) ) { echo ' show'; } ?>">
|
19 |
-
<?php if(isset($_GET['xml'])) { echo '<div class="message"><span> </span>Theme Options Created</div>'; } ?>
|
20 |
-
<?php if(isset($_GET['error'])) { echo '<div class="message warning"><span> </span>Wrong File Type!</div>'; } ?>
|
21 |
-
<?php if(isset($_GET['nofile'])) { echo '<div class="message warning"><span> </span>Please add a file.</div>'; } ?>
|
22 |
-
<?php if(isset($_GET['empty'])) { echo '<div class="message warning"><span> </span>An error occurred while importing your data.</div>'; } ?>
|
23 |
-
<?php if(isset($_GET['layout'])) { echo '<div class="message"><span> </span>Your Layouts were successfully imported.</div>'; } ?>
|
24 |
-
<?php if ( isset( $message ) ) { echo $message; } ?>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<div id="content">
|
28 |
-
<div id="options_tabs">
|
29 |
-
<ul class="options_tabs">
|
30 |
-
<li><a href="#tree_settings">Create</a><span></span></li>
|
31 |
-
<li><a href="#import_options">Import</a><span></span></li>
|
32 |
-
<li><a href="#export_options">Export</a><span></span></li>
|
33 |
-
<li><a href="#layout_options">Layouts</a><span></span></li>
|
34 |
-
</ul>
|
35 |
-
|
36 |
-
<div id="tree_settings" class="block has-table">
|
37 |
-
<form method="post" id="theme-options" class="option-tree-settings">
|
38 |
-
<h2>Create</h2>
|
39 |
-
<h3>Create the Theme Options</h3>
|
40 |
-
<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>
|
41 |
-
<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>
|
42 |
-
<p>All of the Theme Options can be sorted and rearranged to your liking with <strong>Drag & Drop</strong>. Don't worry about the order in which you create your options, you can always reorder them.</p>
|
43 |
-
<table cellspacing="0">
|
44 |
-
<thead>
|
45 |
-
<tr>
|
46 |
-
<th class="col-title">Title</th>
|
47 |
-
<th class="col-key">Key</th>
|
48 |
-
<th class="col-type">Type</th>
|
49 |
-
<th class="col-edit"><a href="javascript:;" class="add-option">Add Option</a></th>
|
50 |
-
</tr>
|
51 |
-
</thead>
|
52 |
-
<tfoot>
|
53 |
-
<tr>
|
54 |
-
<th class="col-title">Title</th>
|
55 |
-
<th class="col-key">Key</th>
|
56 |
-
<th class="col-type">Type</th>
|
57 |
-
<th class="col-edit"><a href="javascript:;" class="add-option">Add Option</a></th>
|
58 |
-
</tr>
|
59 |
-
</tfoot>
|
60 |
-
<tbody id="framework-settings" class="dragable">
|
61 |
-
<?php
|
62 |
-
$count = 0;
|
63 |
-
foreach ( $ot_array as $value ) {
|
64 |
-
$count++;
|
65 |
-
$heading = ($value->item_type == 'heading') ? true : false; ?>
|
66 |
-
<tr id="option-<?php echo $value->id; ?>" class="<?php echo ($heading) ? 'col-heading ' : ''; ?><?php echo ($count==1) ? 'nodrag nodrop' : ''; ?>">
|
67 |
-
<td class="col-title"<?php echo ($heading) ? ' colspan="3"' : ''; ?>><?php echo (!$heading) ? '– ' : ''; ?><?php echo htmlspecialchars_decode( $value->item_title ); ?></td>
|
68 |
-
<td class="col-key<?php echo ($heading) ? ' hide' : ''; ?>"><?php echo htmlspecialchars(stripslashes($value->item_id)); ?></td>
|
69 |
-
<td class="col-type<?php echo ($heading) ? ' hide' : ''; ?>"><?php echo $value->item_type; ?></td>
|
70 |
-
<td class="col-edit">
|
71 |
-
<a href="javascript:;" class="edit-inline">Edit</a>
|
72 |
-
<a href="javascript:;" class="delete-inline">Delete</a>
|
73 |
-
<div class="hidden item-data" id="inline_<?php echo $value->id; ?>">
|
74 |
-
<div class="item_title"><?php echo htmlspecialchars_decode( $value->item_title ); ?></div>
|
75 |
-
<div class="item_id"><?php echo $value->item_id; ?></div>
|
76 |
-
<div class="item_type"><?php echo $value->item_type; ?></div>
|
77 |
-
<div class="item_desc"><?php echo esc_html(stripslashes($value->item_desc)); ?></div>
|
78 |
-
<div class="item_options"><?php echo esc_html(stripslashes($value->item_options)); ?></div>
|
79 |
-
</div>
|
80 |
-
</td>
|
81 |
-
</tr>
|
82 |
-
<?php } ?>
|
83 |
-
</tbody>
|
84 |
-
</table>
|
85 |
-
<table style="display:none">
|
86 |
-
<tbody id="framework-settings-edit">
|
87 |
-
<tr id="inline-edit" class="inline-edit-option nodrop nodrag">
|
88 |
-
<td colspan="4">
|
89 |
-
<div class="option option-title">
|
90 |
-
<div class="section">
|
91 |
-
<div class="element">
|
92 |
-
<input type="text" name="item_title" class="item_title" value="" />
|
93 |
-
</div>
|
94 |
-
<div class="description">
|
95 |
-
<strong>Title:</strong> Displayed on the Theme Options page.
|
96 |
-
</div>
|
97 |
-
</div>
|
98 |
-
</div>
|
99 |
-
<div class="option option-id">
|
100 |
-
<div class="section">
|
101 |
-
<div class="element">
|
102 |
-
<input type="text" name="item_id" class="item_id" value="" />
|
103 |
-
</div>
|
104 |
-
<div class="description">
|
105 |
-
<strong>Option Key:</strong> Unique alphanumeric key, underscores are acceptable.
|
106 |
-
</div>
|
107 |
-
</div>
|
108 |
-
</div>
|
109 |
-
<div class="option option-type">
|
110 |
-
<div class="section">
|
111 |
-
<div class="element">
|
112 |
-
<div class="select_wrapper">
|
113 |
-
<select name="item_type" class="select item_type">
|
114 |
-
<?php
|
115 |
-
$types = apply_filters( 'option_tree_option_types', array(
|
116 |
-
'heading' => 'Heading',
|
117 |
-
'background' => 'Background',
|
118 |
-
'category' => 'Category',
|
119 |
-
'categories' => 'Categories',
|
120 |
-
'checkbox' => 'Checkbox',
|
121 |
-
'colorpicker' => 'Colorpicker',
|
122 |
-
'css' => 'CSS',
|
123 |
-
'custom_post' => 'Custom Post',
|
124 |
-
'custom_posts' => 'Custom Posts',
|
125 |
-
'input' => 'Input',
|
126 |
-
'measurement' => 'Measurement',
|
127 |
-
'page' => 'Page',
|
128 |
-
'pages' => 'Pages',
|
129 |
-
'post' => 'Post',
|
130 |
-
'posts' => 'Posts',
|
131 |
-
'radio' => 'Radio',
|
132 |
-
'select' => 'Select',
|
133 |
-
'slider' => 'Slider',
|
134 |
-
'tag' => 'Tag',
|
135 |
-
'tags' => 'Tags',
|
136 |
-
'textarea' => 'Textarea',
|
137 |
-
'textblock' => 'Textblock',
|
138 |
-
'typography' => 'Typography',
|
139 |
-
'upload' => 'Upload'
|
140 |
-
) );
|
141 |
-
foreach ( $types as $key => $value ) {
|
142 |
-
echo '<option value="'.$key.'">'.$value.'</option>';
|
143 |
-
}
|
144 |
-
?>
|
145 |
-
</select>
|
146 |
-
</div>
|
147 |
-
</div>
|
148 |
-
<div class="description">
|
149 |
-
<strong>Option Type:</strong> Choose one of the supported option types.
|
150 |
-
</div>
|
151 |
-
</div>
|
152 |
-
</div>
|
153 |
-
<div class="option option-desc">
|
154 |
-
<div class="section">
|
155 |
-
<div class="element">
|
156 |
-
<textarea name="item_desc" class="item_desc" rows="8"></textarea>
|
157 |
-
</div>
|
158 |
-
<div class="description">
|
159 |
-
<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).
|
160 |
-
</div>
|
161 |
-
</div>
|
162 |
-
</div>
|
163 |
-
<div class="option option-options">
|
164 |
-
<div class="section">
|
165 |
-
<div class="element">
|
166 |
-
<input type="text" name="item_options" class="item_options" value="" />
|
167 |
-
</div>
|
168 |
-
<div class="description">
|
169 |
-
<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>
|
170 |
-
<span class="alternative" style="display:none;"> </span>
|
171 |
-
</div>
|
172 |
-
</div>
|
173 |
-
</div>
|
174 |
-
<?php wp_nonce_field( 'inlineeditnonce', '_ajax_nonce', false ); ?>
|
175 |
-
<div class="inline-edit-save">
|
176 |
-
<a href="#" class="cancel button-framework reset">Cancel</a>
|
177 |
-
<a href="#" class="save button-framework">Save</a>
|
178 |
-
</div>
|
179 |
-
</td>
|
180 |
-
</tr>
|
181 |
-
<tr id="inline-add">
|
182 |
-
<td class="col-title"></td>
|
183 |
-
<td class="col-key"></td>
|
184 |
-
<td class="col-type"></td>
|
185 |
-
<td class="col-edit">
|
186 |
-
<a href="#" class="edit-inline">Edit</a>
|
187 |
-
<a href="#" class="delete-inline">Delete</a>
|
188 |
-
<div class="hidden item-data">
|
189 |
-
<div class="item_title"></div>
|
190 |
-
<div class="item_id"></div>
|
191 |
-
<div class="item_type"></div>
|
192 |
-
<div class="item_desc"></div>
|
193 |
-
<div class="item_options"></div>
|
194 |
-
</div>
|
195 |
-
</td>
|
196 |
-
</tr>
|
197 |
-
</tbody>
|
198 |
-
</table>
|
199 |
-
</form>
|
200 |
-
</div>
|
201 |
-
|
202 |
-
<div id="import_options" class="block">
|
203 |
-
<h2>Import</h2>
|
204 |
-
|
205 |
-
<form method="post" action="admin.php?page=option_tree_settings&action=ot-upload-xml" enctype="multipart/form-data" id="upload-xml">
|
206 |
-
<input type="hidden" name="action" value="upload" />
|
207 |
-
<div class="option option-upload">
|
208 |
-
<h3>Theme Options XML</h3>
|
209 |
-
<div class="section desc-text">
|
210 |
-
<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>
|
211 |
-
<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>
|
212 |
-
<input name="import" type="file" class="file" />
|
213 |
-
<input type="submit" value="<?php _e('Import XML') ?>" class="ob_button right" />
|
214 |
-
</div>
|
215 |
-
</div>
|
216 |
-
</form>
|
217 |
-
|
218 |
-
<form method="post" id="import-data">
|
219 |
-
<div class="option option-input">
|
220 |
-
<h3>Theme Options Data</h3>
|
221 |
-
<div class="section">
|
222 |
-
<div class="element">
|
223 |
-
<textarea name="import_options_data" rows="8" id="import_options_data" class="import_options_data"></textarea>
|
224 |
-
</div>
|
225 |
-
<div class="description">
|
226 |
-
<p>Only after you've imported the Theme Options XML file should you try and update your Theme Options Data.</p>
|
227 |
-
<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>
|
228 |
-
</div>
|
229 |
-
</div>
|
230 |
-
<input type="submit" value="<?php _e('Import Data') ?>" class="ob_button right import-data" />
|
231 |
-
</div>
|
232 |
-
<?php wp_nonce_field( '_import_data', '_ajax_nonce', false ); ?>
|
233 |
-
</form>
|
234 |
-
|
235 |
-
<form method="post" id="import-layout">
|
236 |
-
<div class="option option-input">
|
237 |
-
<h3>Layouts</h3>
|
238 |
-
<div class="section">
|
239 |
-
<div class="element">
|
240 |
-
<textarea name="import_option_layouts" rows="8" id="import_option_layouts" class="import_option_layouts"></textarea>
|
241 |
-
</div>
|
242 |
-
<div class="description">
|
243 |
-
<p>Only after you've imported the Theme Options XML file should you try and update your Layouts.</p>
|
244 |
-
<p>To import the values of 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 below.</p>
|
245 |
-
</div>
|
246 |
-
</div>
|
247 |
-
<input type="submit" value="<?php _e('Import Layouts') ?>" class="ob_button right import-layout" />
|
248 |
-
</div>
|
249 |
-
<?php wp_nonce_field( '_import_layout', '_ajax_nonce', false ); ?>
|
250 |
-
</form>
|
251 |
-
|
252 |
-
</div>
|
253 |
-
|
254 |
-
<div id="export_options" class="block">
|
255 |
-
<h2>Export</h2>
|
256 |
-
<form method="post" action="admin.php?page=option_tree_settings&action=ot-export-xml">
|
257 |
-
<div class="option option-input">
|
258 |
-
<h3>Theme Options XML</h3>
|
259 |
-
<div class="section desc-text">
|
260 |
-
<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>
|
261 |
-
<input type="submit" value="Export XML" class="ob_button right" />
|
262 |
-
</div>
|
263 |
-
</div>
|
264 |
-
</form>
|
265 |
-
<div class="option option-input">
|
266 |
-
<h3>Theme Options Data</h3>
|
267 |
-
<div class="section">
|
268 |
-
<div class="element">
|
269 |
-
<textarea name="export_data" id="export_data" rows="8"><?php echo base64_encode(serialize($settings)); ?></textarea>
|
270 |
-
</div>
|
271 |
-
<div class="description">
|
272 |
-
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.
|
273 |
-
</div>
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
<div class="option option-input">
|
277 |
-
<h3>Layouts</h3>
|
278 |
-
<div class="section">
|
279 |
-
<div class="element">
|
280 |
-
<textarea name="export_layouts" id="export_layouts" rows="8"><?php echo base64_encode(serialize($layouts)); ?></textarea>
|
281 |
-
</div>
|
282 |
-
<div class="description">
|
283 |
-
Export your saved 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> on another web site.
|
284 |
-
</div>
|
285 |
-
</div>
|
286 |
-
</div>
|
287 |
-
</div>
|
288 |
-
|
289 |
-
<div id="layout_options" class="block">
|
290 |
-
<h2>Layouts</h2>
|
291 |
-
<div class="option option-input">
|
292 |
-
<h3>What's a layout?</h3>
|
293 |
-
<p>It's a variation of your theme options data that you can save and import/export. Basically, you save your data as layouts you can activate later, or save them as a text file for use in a clients theme. Simply enter a name and hit "Save Layout", then you can edit your theme options so everything is setup correctly for your new layout. It's important you save layouts before you save the options because you're editing the active layout.</p>
|
294 |
-
<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.</p>
|
295 |
-
<h3>Save your Layouts</h3>
|
296 |
-
<div class="section">
|
297 |
-
<div class="element">
|
298 |
-
<form method="post" id="save-layout">
|
299 |
-
<input type="text" name="options_name" value="" class="input_layout" />
|
300 |
-
<?php wp_nonce_field( '_save_layout', '_ajax_nonce', false ); ?>
|
301 |
-
<input type="submit" value="Save Layout" class="ob_button right save-layout" />
|
302 |
-
</form>
|
303 |
-
</div>
|
304 |
-
<div class="description">
|
305 |
-
Use a simple naming structure for new layouts (no special characters).
|
306 |
-
</div>
|
307 |
-
<div style="clear:both; padding-top:20px;" class="has-table">
|
308 |
-
<table cellspacing="0" id="saved-options">
|
309 |
-
<thead>
|
310 |
-
<tr>
|
311 |
-
<th class="col-title">Name</th>
|
312 |
-
<th class="col-key">Theme Options Data (Copy & Save)</th>
|
313 |
-
<th class="col-edit" style="padding-left:10px !important; width: 55px;">Action</th>
|
314 |
-
</tr>
|
315 |
-
</thead>
|
316 |
-
<tfoot>
|
317 |
-
<tr>
|
318 |
-
<th class="col-title">Name</th>
|
319 |
-
<th class="col-key">Theme Options Data (Copy & Save)</th>
|
320 |
-
<th class="col-edit" style="padding-left:10px !important; width: 55px;">Action</th>
|
321 |
-
</tr>
|
322 |
-
</tfoot>
|
323 |
-
<tbody id="layout-settings">
|
324 |
-
<?php
|
325 |
-
if ( is_array( $layouts ) && !empty($layouts) ) {
|
326 |
-
arsort( $layouts );
|
327 |
-
$active_layout = isset($layouts['active_layout']) ? $layouts['active_layout'] : '';
|
328 |
-
foreach( $layouts as $key => $values ) {
|
329 |
-
if ( $key == 'active_layout')
|
330 |
-
continue;
|
331 |
-
?>
|
332 |
-
<tr id="saved-<?php echo $key; ?>"<?php echo ( $key == $active_layout ) ? ' class="active-layout"' : ''; ?>>
|
333 |
-
<td class="col-title"><?php echo $key; ?></td>
|
334 |
-
<td class="col-key>"><?php echo '<textarea>'. $values.'</textarea>'; ?></td>
|
335 |
-
<td class="col-edit" style="padding-left:10px !important; width: 55px;">
|
336 |
-
<a href="#" class="activate-saved" title="Activate">Activate</a>
|
337 |
-
<a href="#" class="delete-saved" title="Delete">Delete</a>
|
338 |
-
</td>
|
339 |
-
</tr>
|
340 |
-
<?php
|
341 |
-
}
|
342 |
-
}
|
343 |
-
else
|
344 |
-
{
|
345 |
-
echo '<tr class="empty-layouts"><td colspan="3">No Saved Layouts.</td></tr>';
|
346 |
-
}
|
347 |
-
?>
|
348 |
-
</tbody>
|
349 |
-
</table>
|
350 |
-
</div>
|
351 |
-
</div>
|
352 |
-
</div>
|
353 |
-
</div>
|
354 |
-
|
355 |
-
<br class="clear" />
|
356 |
-
</div>
|
357 |
-
</div>
|
358 |
-
<div class="info bottom">
|
359 |
-
<input type="hidden" name="action" value="save" />
|
360 |
-
</div>
|
361 |
-
</div>
|
362 |
-
|
363 |
-
</div>
|
364 |
-
<!-- [END] framework_wrap -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* Background Option
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @since 1.1.8
|
7 |
-
*
|
8 |
-
* @param array $value
|
9 |
-
* @param array $settings
|
10 |
-
* @param int $int
|
11 |
-
*
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
function option_tree_background( $value, $settings, $int ) { ?>
|
15 |
-
<div class="option option-background-upload">
|
16 |
-
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
17 |
-
<div class="section">
|
18 |
-
<div class="element">
|
19 |
-
<script type="text/javascript">
|
20 |
-
jQuery(document).ready(function($) {
|
21 |
-
$('#<?php echo $value->item_id; ?>-picker').ColorPicker({
|
22 |
-
onSubmit: function(hsb, hex, rgb) {
|
23 |
-
$('#<?php echo $value->item_id; ?>-picker').val('#'+hex);
|
24 |
-
},
|
25 |
-
onBeforeShow: function () {
|
26 |
-
$(this).ColorPickerSetColor(this.value);
|
27 |
-
return false;
|
28 |
-
},
|
29 |
-
onChange: function (hsb, hex, rgb) {
|
30 |
-
$('#cp_<?php echo $value->item_id; ?> div').css({'backgroundColor':'#'+hex, 'backgroundImage': 'none', 'borderColor':'#'+hex});
|
31 |
-
$('#cp_<?php echo $value->item_id; ?>').prev('input').attr('value', '#'+hex);
|
32 |
-
}
|
33 |
-
})
|
34 |
-
.bind('keyup', function(){
|
35 |
-
$(this).ColorPickerSetColor(this.value);
|
36 |
-
});
|
37 |
-
});
|
38 |
-
</script>
|
39 |
-
<input type="text" name="<?php echo $value->item_id; ?>[background-color]" id="<?php echo $value->item_id; ?>-picker" value="<?php echo ( isset( $settings[$value->item_id]['background-color'] ) ) ? stripslashes( $settings[$value->item_id]['background-color'] ) : ''; ?>" class="cp_input" />
|
40 |
-
<div id="cp_<?php echo $value->item_id; ?>" class="cp_box">
|
41 |
-
<div style="background-color:<?php echo ( isset ( $settings[$value->item_id]['background-color'] ) ) ? $settings[$value->item_id]['background-color'] : '#ffffff'; ?>;<?php if ( isset( $settings[$value->item_id]['background-color'] ) ) { echo 'background-image:none;border-color:' . $settings[$value->item_id]['background-color'] . ';'; } ?>">
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
<div class="select_wrapper background-repeat" style="width:152px;">
|
45 |
-
<select name="<?php echo $value->item_id; ?>[background-repeat]" class="select">
|
46 |
-
<?php
|
47 |
-
echo '<option value="">background-repeat</option>';
|
48 |
-
foreach ( recognized_background_repeat() as $key => $repeat ) {
|
49 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['background-repeat'], $key, false ) . '>' . esc_html( $repeat ) . '</option>';
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
</select>
|
53 |
-
</div>
|
54 |
-
<div class="select_wrapper background-attachment" style="width:179px;margin:0 0 0 10px;">
|
55 |
-
<select name="<?php echo $value->item_id; ?>[background-attachment]" class="select">
|
56 |
-
<?php
|
57 |
-
echo '<option value="">background-attachment</option>';
|
58 |
-
foreach ( recognized_background_attachment() as $key => $attachment ) {
|
59 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['background-attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
|
60 |
-
}
|
61 |
-
?>
|
62 |
-
</select>
|
63 |
-
</div>
|
64 |
-
<div class="select_wrapper background-position">
|
65 |
-
<select name="<?php echo $value->item_id; ?>[background-position]" class="select">
|
66 |
-
<?php
|
67 |
-
echo '<option value="">background-position</option>';
|
68 |
-
foreach ( recognized_background_position() as $key => $position ) {
|
69 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['background-position'], $key, false ) . '>' . esc_html( $position ) . '</option>';
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
</select>
|
73 |
-
</div>
|
74 |
-
<input type="text" name="<?php echo $value->item_id; ?>[background-image]" id="<?php echo $value->item_id; ?>" value="<?php if ( isset( $settings[$value->item_id]['background-image'] ) ) { echo $settings[$value->item_id]['background-image']; } ?>" class="upload<?php if ( isset( $settings[$value->item_id]['background-image'] ) ) { echo ' has-file'; } ?>" />
|
75 |
-
<input id="upload_<?php echo $value->item_id; ?>" class="upload_button" type="button" value="Upload" rel="<?php echo $int; ?>" />
|
76 |
-
<?php if ( is_array( @getimagesize( $settings[$value->item_id]['background-image'] ) ) ) { ?>
|
77 |
-
<div class="screenshot" id="<?php echo $value->item_id; ?>_image">
|
78 |
-
<?php
|
79 |
-
if ( isset( $settings[$value->item_id]['background-image'] ) && $settings[$value->item_id]['background-image'] != '' ) {
|
80 |
-
$remove = '<a href="javascript:(void);" class="remove">Remove</a>';
|
81 |
-
$image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $settings[$value->item_id]['background-image'] );
|
82 |
-
if ( $image ) {
|
83 |
-
echo '<img src="'.$settings[$value->item_id]['background-image'].'" alt="" />'.$remove.'';
|
84 |
-
}
|
85 |
-
}
|
86 |
-
?>
|
87 |
-
</div>
|
88 |
-
<?php } ?>
|
89 |
-
</div>
|
90 |
-
<div class="description">
|
91 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
92 |
-
</div>
|
93 |
-
</div>
|
94 |
-
</div>
|
95 |
-
<?php
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/category.php
DELETED
@@ -1,108 +0,0 @@
|
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
77 |
-
} else {
|
78 |
-
$ch_values = array();
|
79 |
-
}
|
80 |
-
// loop through tags
|
81 |
-
$categories = &get_categories( array( 'hide_empty' => false ) );
|
82 |
-
if ( $categories )
|
83 |
-
{
|
84 |
-
$count = 0;
|
85 |
-
foreach ( $categories as $category )
|
86 |
-
{
|
87 |
-
$checked = '';
|
88 |
-
if ( in_array( $category->term_id, $ch_values ) )
|
89 |
-
{
|
90 |
-
$checked = ' checked="checked"';
|
91 |
-
}
|
92 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$category->term_id.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$category->name.'</label></div>';
|
93 |
-
$count++;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
echo '<p>No Tags Available</p>';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
</div>
|
102 |
-
<div class="description">
|
103 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<?php
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/checkbox.php
DELETED
@@ -1,48 +0,0 @@
|
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
25 |
-
} else {
|
26 |
-
$ch_values = array();
|
27 |
-
}
|
28 |
-
$count = 0;
|
29 |
-
// loop through options array
|
30 |
-
foreach ( explode( ',', $value->item_options ) as $option )
|
31 |
-
{
|
32 |
-
$checked = '';
|
33 |
-
if ( in_array( trim( $option ), $ch_values ) )
|
34 |
-
{
|
35 |
-
$checked = ' checked="checked"';
|
36 |
-
}
|
37 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.trim( $option ).'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.trim( $option ).'</label></div>';
|
38 |
-
$count++;
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
</div>
|
42 |
-
<div class="description">
|
43 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
44 |
-
</div>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<?php
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/colorpicker.php
DELETED
@@ -1,54 +0,0 @@
|
|
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/css.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* CSS Option
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @since 1.1.8
|
7 |
-
*
|
8 |
-
* @param array $value
|
9 |
-
* @param array $settings
|
10 |
-
* @param int $int
|
11 |
-
*
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
function option_tree_css( $value, $settings, $int ) {
|
15 |
-
?>
|
16 |
-
<div class="option option-css">
|
17 |
-
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
18 |
-
<div class="section">
|
19 |
-
<div class="css_block">
|
20 |
-
<textarea name="<?php echo $value->item_id; ?>" rows="<?php echo $int; ?>"><?php
|
21 |
-
if ( isset( $settings[$value->item_id] ) )
|
22 |
-
echo stripslashes($settings[$value->item_id]);
|
23 |
-
?></textarea>
|
24 |
-
</div>
|
25 |
-
<div class="text_block">
|
26 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
</div>
|
30 |
-
<?php
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/custom-post.php
DELETED
@@ -1,108 +0,0 @@
|
|
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), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
77 |
-
} else {
|
78 |
-
$ch_values = array();
|
79 |
-
}
|
80 |
-
// loop through tags
|
81 |
-
$posts = &get_posts( array( 'post_type' => $value->item_options, 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
|
82 |
-
if ( $posts )
|
83 |
-
{
|
84 |
-
$count = 0;
|
85 |
-
foreach ( $posts as $post )
|
86 |
-
{
|
87 |
-
$checked = '';
|
88 |
-
if ( in_array( $post->ID, $ch_values ) )
|
89 |
-
{
|
90 |
-
$checked = ' checked="checked"';
|
91 |
-
}
|
92 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$post->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$post->post_title.'</label></div>';
|
93 |
-
$count++;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
echo '<p>No Custom Posts Available</p>';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
</div>
|
102 |
-
<div class="description">
|
103 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<?php
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/export.php
DELETED
@@ -1,70 +0,0 @@
|
|
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
DELETED
@@ -1,20 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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/measurement.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* Measurement Option
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @since 1.1.2
|
7 |
-
* @contributors valendesigns & youngmicroserf
|
8 |
-
*
|
9 |
-
* @param array $value
|
10 |
-
* @param array $settings
|
11 |
-
* @param int $int
|
12 |
-
*
|
13 |
-
* @return string
|
14 |
-
*/
|
15 |
-
function option_tree_measurement( $value, $settings, $int ) { ?>
|
16 |
-
<div class="option option-measurement">
|
17 |
-
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
18 |
-
<div class="section">
|
19 |
-
<div class="element">
|
20 |
-
<?php
|
21 |
-
if ( isset( $settings[$value->item_id] ) )
|
22 |
-
$measurement = $settings[$value->item_id]; ?>
|
23 |
-
<input type="text" name="<?php echo $value->item_id; ?>[0]" value="<?php if ( isset( $measurement[0] ) ) { echo htmlspecialchars( stripslashes( $measurement[0] ), ENT_QUOTES); } ?>" class="measurement" />
|
24 |
-
|
25 |
-
<div class="select_wrapper measurement">
|
26 |
-
<select name="<?php echo $value->item_id; ?>[1]" class="select">
|
27 |
-
<?php
|
28 |
-
echo '<option value=""> -- </option>';
|
29 |
-
foreach ( measurement_unit_types() as $unit ) {
|
30 |
-
echo '<option value="' . esc_attr( trim( $unit ) ) . '" ' . selected( $measurement[1], trim( $unit ), false ) . '>' . esc_html( $unit ) . '</option>';
|
31 |
-
}
|
32 |
-
?>
|
33 |
-
</select>
|
34 |
-
</div>
|
35 |
-
</div>
|
36 |
-
<div class="description">
|
37 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
38 |
-
</div>
|
39 |
-
</div>
|
40 |
-
</div>
|
41 |
-
<?php
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/page.php
DELETED
@@ -1,108 +0,0 @@
|
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
77 |
-
} else {
|
78 |
-
$ch_values = array();
|
79 |
-
}
|
80 |
-
// loop through tags
|
81 |
-
$pages = &get_pages();
|
82 |
-
if ( $pages )
|
83 |
-
{
|
84 |
-
$count = 0;
|
85 |
-
foreach ( $pages as $page )
|
86 |
-
{
|
87 |
-
$checked = '';
|
88 |
-
if ( in_array( $page->ID, $ch_values ) )
|
89 |
-
{
|
90 |
-
$checked = ' checked="checked"';
|
91 |
-
}
|
92 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$page->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$page->post_title.'</label></div>';
|
93 |
-
$count++;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
echo '<p>No Pages Available</p>';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
</div>
|
102 |
-
<div class="description">
|
103 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<?php
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/post.php
DELETED
@@ -1,108 +0,0 @@
|
|
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( array( 'numberposts' => -1, 'orderby' => 'date' ) );
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
77 |
-
} else {
|
78 |
-
$ch_values = array();
|
79 |
-
}
|
80 |
-
// loop through posts
|
81 |
-
$posts = &get_posts( array( 'numberposts' => -1, 'orderby' => 'date' ) );
|
82 |
-
if ( $posts )
|
83 |
-
{
|
84 |
-
$count = 0;
|
85 |
-
foreach ( $posts as $post )
|
86 |
-
{
|
87 |
-
$checked = '';
|
88 |
-
if ( in_array( $post->ID, $ch_values ) )
|
89 |
-
{
|
90 |
-
$checked = ' checked="checked"';
|
91 |
-
}
|
92 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$post->ID.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$post->post_title.'</label></div>';
|
93 |
-
$count++;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
echo '<p>No Pages Available</p>';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
</div>
|
102 |
-
<div class="description">
|
103 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<?php
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/radio.php
DELETED
@@ -1,48 +0,0 @@
|
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
25 |
-
} else {
|
26 |
-
$ch_values = array();
|
27 |
-
}
|
28 |
-
$count = 0;
|
29 |
-
// loop through options array
|
30 |
-
foreach ( explode( ',', $value->item_options ) as $option )
|
31 |
-
{
|
32 |
-
$checked = '';
|
33 |
-
if ( in_array( trim( $option ), $ch_values ) )
|
34 |
-
{
|
35 |
-
$checked = ' checked="checked"';
|
36 |
-
}
|
37 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'" id="'.$value->item_id.'_'.$count.'" type="radio" value="'.trim( $option ).'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.trim( $option ).'</label></div>';
|
38 |
-
$count++;
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
</div>
|
42 |
-
<div class="description">
|
43 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
44 |
-
</div>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<?php
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/select.php
DELETED
@@ -1,45 +0,0 @@
|
|
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 |
-
$selected = '';
|
28 |
-
$value_pair = explode( '=', trim( $option ) );
|
29 |
-
if ( isset( $value_pair[0] ) && isset( $value_pair[1] ) ) {
|
30 |
-
echo '<option value="' . esc_attr( $value_pair[0] ) . '" ' . selected( $settings[$value->item_id], $value_pair[0], false ) . '>' . esc_html( $option ) . '</option>';
|
31 |
-
} else {
|
32 |
-
echo '<option value="' . esc_attr( trim( $option ) ) . '" ' . selected( $settings[$value->item_id], trim( $option ), false ) . '>' . esc_html( $option ) . '</option>';
|
33 |
-
}
|
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/slider.php
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* Image Slider Option
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @since 1.1.3
|
7 |
-
*
|
8 |
-
* @param array $value
|
9 |
-
* @param array $settings
|
10 |
-
* @param int $int
|
11 |
-
*
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
function option_tree_slider( $value, $settings, $int )
|
15 |
-
{
|
16 |
-
?>
|
17 |
-
<div class="option option-option-tree-slider">
|
18 |
-
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
19 |
-
<div class="section">
|
20 |
-
<div class="element">
|
21 |
-
<?php $count = 0; ?>
|
22 |
-
<ul class="ui-sortable option-tree-slider-wrap" id="<?php echo $value->item_id; ?>_list">
|
23 |
-
<?php
|
24 |
-
if ( !empty( $settings[$value->item_id] ) ) {
|
25 |
-
foreach( $settings[$value->item_id] as $image ) { ?>
|
26 |
-
<li><?php option_tree_slider_view( $value->item_id, $image, $int, $count ); ?></li><?php
|
27 |
-
$count++;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
?>
|
31 |
-
</ul>
|
32 |
-
<a href="#" id="<?php echo $value->item_id; ?>" class="button-framework light add-slide right">Add Slide</a>
|
33 |
-
</div>
|
34 |
-
<div class="description">
|
35 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
</div>
|
39 |
-
<?php
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Image Slider HTML
|
44 |
-
*
|
45 |
-
* @access public
|
46 |
-
* @since 1.1.3
|
47 |
-
*
|
48 |
-
* @param string $id
|
49 |
-
* @param array $image
|
50 |
-
* @param int $count
|
51 |
-
*
|
52 |
-
* @return string
|
53 |
-
*/
|
54 |
-
function option_tree_slider_view( $id, $image, $int, $count ) {
|
55 |
-
// required fileds
|
56 |
-
$requred_fields = array(
|
57 |
-
array(
|
58 |
-
'name' => 'order',
|
59 |
-
'type' => 'hidden',
|
60 |
-
'label' => '',
|
61 |
-
'class' => 'option-tree-slider-order'
|
62 |
-
),
|
63 |
-
array(
|
64 |
-
'name' => 'title',
|
65 |
-
'type' => 'text',
|
66 |
-
'label' => 'Title',
|
67 |
-
'class' => 'option-tree-slider-title'
|
68 |
-
)
|
69 |
-
);
|
70 |
-
|
71 |
-
// optional fields
|
72 |
-
$image_slider_fields = array(
|
73 |
-
array(
|
74 |
-
'name' => 'image',
|
75 |
-
'type' => 'image',
|
76 |
-
'label' => 'Image URL',
|
77 |
-
'class' => ''
|
78 |
-
),
|
79 |
-
array(
|
80 |
-
'name' => 'link',
|
81 |
-
'type' => 'text',
|
82 |
-
'label' => 'Link URL',
|
83 |
-
'class' => ''
|
84 |
-
),
|
85 |
-
array(
|
86 |
-
'name' => 'description',
|
87 |
-
'type' => 'textarea',
|
88 |
-
'label' => 'Caption',
|
89 |
-
'class' => ''
|
90 |
-
)
|
91 |
-
);
|
92 |
-
|
93 |
-
// filter the optional fields
|
94 |
-
$image_slider_fields = apply_filters( 'image_slider_fields', $image_slider_fields, $id );
|
95 |
-
|
96 |
-
// merge required & optional arrays
|
97 |
-
$image_slider_fields = array_merge( $requred_fields, $image_slider_fields );
|
98 |
-
?>
|
99 |
-
<div id="option-tree-slider-editor_<?php echo $count; ?>" class="option-tree-slider">
|
100 |
-
<div class="open">
|
101 |
-
<?php echo empty( $image['title'] ) ? "Slide " . ($count + 1) : stripslashes($image['title']); ?>
|
102 |
-
</div>
|
103 |
-
<a href="#" class="edit">Edit</a>
|
104 |
-
<a href="#" class="trash remove-slide">Delete</a>
|
105 |
-
<div class="option-tree-slider-body">
|
106 |
-
<?php
|
107 |
-
foreach( $image_slider_fields as $field ) {
|
108 |
-
|
109 |
-
if ( $field['type'] == 'image' || $field['name'] == 'image' ){ ?>
|
110 |
-
<div>
|
111 |
-
<label><?php echo $field['label']; ?></label>
|
112 |
-
<input type="text" name="<?php echo $id; ?>[<?php echo $count; ?>][<?php echo $field['name']; ?>]" id="<?php echo $id; ?>-<?php echo $count; ?>-<?php echo $field['name']; ?>" value="<?php echo ( isset( $image[$field['name']] ) ? stripslashes($image[$field['name']]) : '' ); ?>" class="upload<?php if ( isset( $image[$field['name']] ) ) { echo ' has-file'; } ?>"/>
|
113 |
-
<input id="upload_<?php echo $id ?>-<?php echo $count ?>-<?php echo $field['name'] ?>" class="upload_button" type="button" value="Upload" rel="<?php echo $int; ?>" />
|
114 |
-
<div class="screenshot" id="<?php echo $id ?>-<?php echo $count ?>-<?php echo $field['name'] ?>_image">
|
115 |
-
<?php
|
116 |
-
if ( isset( $image[$field['name']] ) && $image[$field['name']] != '' )
|
117 |
-
{
|
118 |
-
$remove = '<a href="javascript:(void);" class="remove">Remove</a>';
|
119 |
-
$screenshot_image = $image[$field['name']];
|
120 |
-
$new_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $image[$field['name']] );
|
121 |
-
if ( $new_image )
|
122 |
-
{
|
123 |
-
echo '<img src="'.$screenshot_image.'" alt="" />'.$remove.'';
|
124 |
-
}
|
125 |
-
}
|
126 |
-
?>
|
127 |
-
</div>
|
128 |
-
</div>
|
129 |
-
<?php
|
130 |
-
} else if ( $field['type'] == 'text' ) {
|
131 |
-
echo '
|
132 |
-
<p>
|
133 |
-
<label>'.$field['label'].'</label>
|
134 |
-
<input type="text" name="'.$id.'['.$count.']['.$field['name'].']" value="'.( isset( $image[$field['name']] ) ? stripslashes($image[$field['name']]) : '' ).'" class="'.$field['class'].'" />
|
135 |
-
</p>';
|
136 |
-
} else if ( $field['type'] == 'textarea' ) {
|
137 |
-
echo '
|
138 |
-
<p>
|
139 |
-
<label>'.$field['label'].'</label>
|
140 |
-
<textarea name="'.$id.'['.$count.']['.$field['name'].']" rows="6" class="'.$field['class'].'">'.( isset( $image[$field['name']] ) ? stripslashes($image[$field['name']]) : '' ).'</textarea>
|
141 |
-
</p>';
|
142 |
-
} else if ( $field['type'] == 'hidden' ) {
|
143 |
-
echo '<input type="hidden" name="'.$id.'['.$count.']['.$field['name'].']" value="'.( isset( $image[$field['name']] ) ? stripslashes($image[$field['name']]) : '' ).'" class="'.$field['class'].'" />';
|
144 |
-
}
|
145 |
-
}
|
146 |
-
?>
|
147 |
-
</div>
|
148 |
-
</div>
|
149 |
-
<?php
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/tag.php
DELETED
@@ -1,108 +0,0 @@
|
|
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 |
-
$ch_values = (array) $settings[$value->item_id];
|
77 |
-
} else {
|
78 |
-
$ch_values = array();
|
79 |
-
}
|
80 |
-
// loop through tags
|
81 |
-
$tags = &get_tags( array( 'hide_empty' => false ) );
|
82 |
-
if ( $tags )
|
83 |
-
{
|
84 |
-
$count = 0;
|
85 |
-
foreach ( $tags as $tag )
|
86 |
-
{
|
87 |
-
$checked = '';
|
88 |
-
if ( in_array( $tag->term_id, $ch_values ) )
|
89 |
-
{
|
90 |
-
$checked = ' checked="checked"';
|
91 |
-
}
|
92 |
-
echo '<div class="input_wrap"><input name="'.$value->item_id.'['.$count.']" id="'.$value->item_id.'_'.$count.'" type="checkbox" value="'.$tag->term_id.'"'.$checked.' /><label for="'.$value->item_id.'_'.$count.'">'.$tag->name.'</label></div>';
|
93 |
-
$count++;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else
|
97 |
-
{
|
98 |
-
echo '<p>No Tags Available</p>';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
</div>
|
102 |
-
<div class="description">
|
103 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<?php
|
108 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/textarea.php
DELETED
@@ -1,32 +0,0 @@
|
|
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 ( isset( $settings[$value->item_id] ) )
|
23 |
-
echo stripslashes($settings[$value->item_id]);
|
24 |
-
?></textarea>
|
25 |
-
</div>
|
26 |
-
<div class="description">
|
27 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
28 |
-
</div>
|
29 |
-
</div>
|
30 |
-
</div>
|
31 |
-
<?php
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/textblock.php
DELETED
@@ -1,26 +0,0 @@
|
|
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/typography.php
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* Typography Option
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @since 1.1.8
|
7 |
-
*
|
8 |
-
* @param array $value
|
9 |
-
* @param array $settings
|
10 |
-
* @param int $int
|
11 |
-
*
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
function option_tree_typography( $value, $settings, $int ) { ?>
|
15 |
-
<div class="option option-font">
|
16 |
-
<h3><?php echo htmlspecialchars_decode( $value->item_title ); ?></h3>
|
17 |
-
<div class="section">
|
18 |
-
<div class="element">
|
19 |
-
<script type="text/javascript">
|
20 |
-
jQuery(document).ready(function($) {
|
21 |
-
$('#<?php echo $value->item_id; ?>-picker').ColorPicker({
|
22 |
-
onSubmit: function(hsb, hex, rgb) {
|
23 |
-
$('#<?php echo $value->item_id; ?>-picker').val('#'+hex);
|
24 |
-
},
|
25 |
-
onBeforeShow: function () {
|
26 |
-
$(this).ColorPickerSetColor(this.value);
|
27 |
-
return false;
|
28 |
-
},
|
29 |
-
onChange: function (hsb, hex, rgb) {
|
30 |
-
$('#cp_<?php echo $value->item_id; ?> div').css({'backgroundColor':'#'+hex, 'backgroundImage': 'none', 'borderColor':'#'+hex});
|
31 |
-
$('#cp_<?php echo $value->item_id; ?>').prev('input').attr('value', '#'+hex);
|
32 |
-
}
|
33 |
-
})
|
34 |
-
.bind('keyup', function(){
|
35 |
-
$(this).ColorPickerSetColor(this.value);
|
36 |
-
});
|
37 |
-
});
|
38 |
-
</script>
|
39 |
-
<input type="text" name="<?php echo $value->item_id; ?>[font-color]" id="<?php echo $value->item_id; ?>-picker" value="<?php echo ( isset( $settings[$value->item_id]['font-color'] ) ) ? stripslashes( $settings[$value->item_id]['font-color'] ) : ''; ?>" class="cp_input" />
|
40 |
-
<div id="cp_<?php echo $value->item_id; ?>" class="cp_box">
|
41 |
-
<div style="background-color:<?php echo ( isset ( $settings[$value->item_id]['font-color'] ) ) ? $settings[$value->item_id]['font-color'] : '#ffffff'; ?>;<?php if ( isset( $settings[$value->item_id]['font-color'] ) ) { echo 'background-image:none;border-color:' . $settings[$value->item_id]['font-color'] . ';'; } ?>">
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
<div class="select_wrapper typography-family">
|
45 |
-
<select name="<?php echo $value->item_id; ?>[font-family]" class="select">
|
46 |
-
<?php
|
47 |
-
echo '<option value="">font-family</option>';
|
48 |
-
foreach ( recognized_font_families() as $key => $family ) {
|
49 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['font-family'], $key, false ) . '>' . esc_html( $family ) . '</option>';
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
</select>
|
53 |
-
</div>
|
54 |
-
<div class="select_wrapper typography-style" style="width:165px;">
|
55 |
-
<select name="<?php echo $value->item_id; ?>[font-style]" class="select">
|
56 |
-
<?php
|
57 |
-
echo '<option value="">font-style</option>';
|
58 |
-
foreach ( recognized_font_styles() as $key => $style ) {
|
59 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['font-style'], $key, false ) . '>' . esc_html( $style ) . '</option>';
|
60 |
-
}
|
61 |
-
?>
|
62 |
-
</select>
|
63 |
-
</div>
|
64 |
-
<div class="select_wrapper typography-variant" style="width:166px;margin-left:10px;">
|
65 |
-
<select name="<?php echo $value->item_id; ?>[font-variant]" class="select">
|
66 |
-
<?php
|
67 |
-
echo '<option value="">font-variant</option>';
|
68 |
-
foreach ( recognized_font_variants() as $key => $variant ) {
|
69 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['font-variant'], $key, false ) . '>' . esc_html( $variant ) . '</option>';
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
</select>
|
73 |
-
</div>
|
74 |
-
<div class="select_wrapper typography-weight" style="width:165px;">
|
75 |
-
<select name="<?php echo $value->item_id; ?>[font-weight]" class="select">
|
76 |
-
<?php
|
77 |
-
echo '<option value="">font-weight</option>';
|
78 |
-
foreach ( recognized_font_weights() as $key => $weight ) {
|
79 |
-
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $settings[$value->item_id]['font-weight'], $key, false ) . '>' . esc_html( $weight ) . '</option>';
|
80 |
-
}
|
81 |
-
?>
|
82 |
-
</select>
|
83 |
-
</div>
|
84 |
-
<div class="select_wrapper typography-size" style="width:166px;margin-left:10px;">
|
85 |
-
<select name="<?php echo $value->item_id; ?>[font-size]" class="select">
|
86 |
-
<?php
|
87 |
-
echo '<option value="">font-size</option>';
|
88 |
-
for ($i = 8; $i <= 72; $i++) {
|
89 |
-
$size = $i . 'px';
|
90 |
-
echo '<option value="' . esc_attr( $size ) . '" ' . selected( $settings[$value->item_id]['font-size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
|
91 |
-
}
|
92 |
-
?>
|
93 |
-
</select>
|
94 |
-
</div>
|
95 |
-
</div>
|
96 |
-
<div class="description">
|
97 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
98 |
-
</div>
|
99 |
-
</div>
|
100 |
-
</div>
|
101 |
-
<?php
|
102 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/admin/upload.php
DELETED
@@ -1,47 +0,0 @@
|
|
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 ( isset( $settings[$value->item_id] ) ) { echo $settings[$value->item_id]; } ?>" class="upload<?php if ( isset( $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 |
-
<?php if ( is_array( @getimagesize( $settings[$value->item_id] ) ) ) { ?>
|
22 |
-
<div class="screenshot" id="<?php echo $value->item_id; ?>_image">
|
23 |
-
<?php
|
24 |
-
if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] != '' ) {
|
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 |
-
echo '<img src="'.$settings[$value->item_id].'" alt="" />'.$remove.'';
|
29 |
-
} else {
|
30 |
-
$parts = explode( "/", $settings[$value->item_id] );
|
31 |
-
for( $i = 0; $i < sizeof($parts); ++$i ) {
|
32 |
-
$title = $parts[$i];
|
33 |
-
}
|
34 |
-
echo '<div class="no_image"><a href="'.$settings[$value->item_id].'">'.$title.'</a>'.$remove.'</div>';
|
35 |
-
}
|
36 |
-
}
|
37 |
-
?>
|
38 |
-
</div>
|
39 |
-
<?php } ?>
|
40 |
-
</div>
|
41 |
-
<div class="description">
|
42 |
-
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
</div>
|
46 |
-
<?php
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/functions.load.php
DELETED
@@ -1,35 +0,0 @@
|
|
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 |
-
include( OT_PLUGIN_DIR . '/functions/functions.php' );
|
11 |
-
|
12 |
-
if ( is_admin() && isset( $_GET['page'] ) && strpos( '_' . $_GET['page'], 'option_tree' ) ) {
|
13 |
-
include( OT_PLUGIN_DIR . '/functions/admin/export.php' );
|
14 |
-
include( OT_PLUGIN_DIR . '/functions/admin/heading.php' );
|
15 |
-
include( OT_PLUGIN_DIR . '/functions/admin/input.php' );
|
16 |
-
include( OT_PLUGIN_DIR . '/functions/admin/checkbox.php' );
|
17 |
-
include( OT_PLUGIN_DIR . '/functions/admin/radio.php' );
|
18 |
-
include( OT_PLUGIN_DIR . '/functions/admin/select.php' );
|
19 |
-
include( OT_PLUGIN_DIR . '/functions/admin/textarea.php' );
|
20 |
-
include( OT_PLUGIN_DIR . '/functions/admin/upload.php' );
|
21 |
-
include( OT_PLUGIN_DIR . '/functions/admin/colorpicker.php' );
|
22 |
-
include( OT_PLUGIN_DIR . '/functions/admin/textblock.php' );
|
23 |
-
include( OT_PLUGIN_DIR . '/functions/admin/post.php' );
|
24 |
-
include( OT_PLUGIN_DIR . '/functions/admin/page.php' );
|
25 |
-
include( OT_PLUGIN_DIR . '/functions/admin/category.php' );
|
26 |
-
include( OT_PLUGIN_DIR . '/functions/admin/tag.php' );
|
27 |
-
include( OT_PLUGIN_DIR . '/functions/admin/custom-post.php' );
|
28 |
-
include( OT_PLUGIN_DIR . '/functions/admin/measurement.php' );
|
29 |
-
include( OT_PLUGIN_DIR . '/functions/admin/slider.php' );
|
30 |
-
include( OT_PLUGIN_DIR . '/functions/admin/background.php' );
|
31 |
-
include( OT_PLUGIN_DIR . '/functions/admin/typography.php' );
|
32 |
-
include( OT_PLUGIN_DIR . '/functions/admin/css.php' );
|
33 |
-
} else if ( ! is_admin() ) {
|
34 |
-
include( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/functions.php
DELETED
@@ -1,384 +0,0 @@
|
|
1 |
-
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed');
|
2 |
-
/**
|
3 |
-
* General Functions
|
4 |
-
*
|
5 |
-
* @package WordPress
|
6 |
-
* @subpackage OptionTree
|
7 |
-
* @since 1.1.8
|
8 |
-
* @author Derek Herman
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Recognized font styles
|
13 |
-
*
|
14 |
-
* Returns an array of all recognized font styles.
|
15 |
-
*
|
16 |
-
* @uses apply_filters()
|
17 |
-
*
|
18 |
-
* @access public
|
19 |
-
* @since 1.1.8
|
20 |
-
*
|
21 |
-
* @return array
|
22 |
-
*/
|
23 |
-
function recognized_font_styles() {
|
24 |
-
return apply_filters( 'recognized_font_styles', array(
|
25 |
-
'normal' => 'Normal',
|
26 |
-
'italic' => 'Italic',
|
27 |
-
'oblique' => 'Oblique',
|
28 |
-
'inherit' => 'Inherit'
|
29 |
-
) );
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Recognized font weights
|
34 |
-
*
|
35 |
-
* Returns an array of all recognized font weights.
|
36 |
-
*
|
37 |
-
* @uses apply_filters()
|
38 |
-
*
|
39 |
-
* @access public
|
40 |
-
* @since 1.1.8
|
41 |
-
*
|
42 |
-
* @return array
|
43 |
-
*/
|
44 |
-
function recognized_font_weights() {
|
45 |
-
return apply_filters( 'recognized_font_weights', array(
|
46 |
-
'normal' => 'Normal',
|
47 |
-
'bold' => 'Bold',
|
48 |
-
'bolder' => 'Bolder',
|
49 |
-
'lighter' => 'Lighter',
|
50 |
-
'100' => '100',
|
51 |
-
'200' => '200',
|
52 |
-
'300' => '300',
|
53 |
-
'400' => '400',
|
54 |
-
'500' => '500',
|
55 |
-
'600' => '600',
|
56 |
-
'700' => '700',
|
57 |
-
'800' => '800',
|
58 |
-
'900' => '900',
|
59 |
-
'inherit' => 'Inherit'
|
60 |
-
) );
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Recognized font variants
|
65 |
-
*
|
66 |
-
* Returns an array of all recognized font variants.
|
67 |
-
*
|
68 |
-
* @uses apply_filters()
|
69 |
-
*
|
70 |
-
* @access public
|
71 |
-
* @since 1.1.8
|
72 |
-
*
|
73 |
-
* @return array
|
74 |
-
*/
|
75 |
-
function recognized_font_variants() {
|
76 |
-
return apply_filters( 'recognized_font_variants', array(
|
77 |
-
'normal' => 'Normal',
|
78 |
-
'small-caps' => 'Small Caps',
|
79 |
-
'inherit' => 'Inherit'
|
80 |
-
) );
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Recognized font families
|
85 |
-
*
|
86 |
-
* Returns an array of all recognized font families.
|
87 |
-
* Keys are intended to be stored in the database
|
88 |
-
* while values are ready for display in html.
|
89 |
-
*
|
90 |
-
* @uses apply_filters()
|
91 |
-
*
|
92 |
-
* @access public
|
93 |
-
* @since 1.1.8
|
94 |
-
*
|
95 |
-
* @return array
|
96 |
-
*/
|
97 |
-
function recognized_font_families() {
|
98 |
-
return apply_filters( 'recognized_font_families', array(
|
99 |
-
'arial' => 'Arial',
|
100 |
-
'georgia' => 'Georgia',
|
101 |
-
'helvetica' => 'Helvetica',
|
102 |
-
'palatino' => 'Palatino',
|
103 |
-
'tahoma' => 'Tahoma',
|
104 |
-
'times' => '"Times New Roman", sans-serif',
|
105 |
-
'trebuchet' => 'Trebuchet',
|
106 |
-
'verdana' => 'Verdana'
|
107 |
-
) );
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Recognized background repeat
|
112 |
-
*
|
113 |
-
* Returns an array of all recognized background repeat values.
|
114 |
-
*
|
115 |
-
* @uses apply_filters()
|
116 |
-
*
|
117 |
-
* @access public
|
118 |
-
* @since 1.1.8
|
119 |
-
*
|
120 |
-
* @return array
|
121 |
-
*/
|
122 |
-
function recognized_background_repeat() {
|
123 |
-
return apply_filters( 'recognized_background_repeat', array(
|
124 |
-
'no-repeat' => 'No Repeat',
|
125 |
-
'repeat' => 'Repeat All',
|
126 |
-
'repeat-x' => 'Repeat Horizontally',
|
127 |
-
'repeat-y' => 'Repeat Vertically',
|
128 |
-
'inherit' => 'Inherit'
|
129 |
-
) );
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Recognized background attachment
|
134 |
-
*
|
135 |
-
* Returns an array of all recognized background attachment values.
|
136 |
-
*
|
137 |
-
* @uses apply_filters()
|
138 |
-
*
|
139 |
-
* @access public
|
140 |
-
* @since 1.1.8
|
141 |
-
*
|
142 |
-
* @return array
|
143 |
-
*/
|
144 |
-
function recognized_background_attachment() {
|
145 |
-
return apply_filters( 'recognized_background_attachment', array(
|
146 |
-
"fixed" => "Fixed",
|
147 |
-
"scroll" => "Scroll",
|
148 |
-
"inherit" => "Inherit"
|
149 |
-
) );
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Recognized background position
|
154 |
-
*
|
155 |
-
* Returns an array of all recognized background position values.
|
156 |
-
*
|
157 |
-
* @uses apply_filters()
|
158 |
-
*
|
159 |
-
* @access public
|
160 |
-
* @since 1.1.8
|
161 |
-
*
|
162 |
-
* @return array
|
163 |
-
*/
|
164 |
-
function recognized_background_position() {
|
165 |
-
return apply_filters( 'recognized_background_position', array(
|
166 |
-
"left top" => "Left Top",
|
167 |
-
"left center" => "Left Center",
|
168 |
-
"left bottom" => "Left Bottom",
|
169 |
-
"center top" => "Center Top",
|
170 |
-
"center center" => "Center Center",
|
171 |
-
"center bottom" => "Center Bottom",
|
172 |
-
"right top" => "Right Top",
|
173 |
-
"right center" => "Right Center",
|
174 |
-
"right bottom" => "Right Bottom"
|
175 |
-
) );
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Measurement Units
|
180 |
-
*
|
181 |
-
* Returns an array of all available unit types.
|
182 |
-
*
|
183 |
-
* @uses apply_filters()
|
184 |
-
*
|
185 |
-
* @access public
|
186 |
-
* @since 1.1.8
|
187 |
-
*
|
188 |
-
* @return array
|
189 |
-
*/
|
190 |
-
function measurement_unit_types() {
|
191 |
-
return apply_filters( 'measurement_unit_types', array(
|
192 |
-
'px' => 'px',
|
193 |
-
'%' => '%',
|
194 |
-
'em' => 'em',
|
195 |
-
'pt' => 'pt'
|
196 |
-
) );
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Find CSS option type and add to style.css
|
201 |
-
*
|
202 |
-
* @since 1.1.8
|
203 |
-
*
|
204 |
-
* @return bool True on write success, false on failure.
|
205 |
-
*/
|
206 |
-
function option_tree_css_save() {
|
207 |
-
global $wpdb;
|
208 |
-
|
209 |
-
$options = $wpdb->get_results( "SELECT item_id FROM " . OT_TABLE_NAME . " WHERE `item_type` = 'css' ORDER BY `item_sort` ASC" );
|
210 |
-
foreach ( $options as $option )
|
211 |
-
option_tree_insert_css_with_markers( $option->item_id );
|
212 |
-
|
213 |
-
return false;
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Inserts CSS with Markers
|
218 |
-
*
|
219 |
-
* Inserts CSS into a dynamic.css file, placing it between
|
220 |
-
* BEGIN and END markers. Replaces existing marked info. Retains surrounding
|
221 |
-
* data.
|
222 |
-
*
|
223 |
-
* @since 1.1.8
|
224 |
-
*
|
225 |
-
* @return bool True on write success, false on failure.
|
226 |
-
*/
|
227 |
-
function option_tree_insert_css_with_markers( $option = '' ) {
|
228 |
-
/* No option defined */
|
229 |
-
if ( !$option )
|
230 |
-
return;
|
231 |
-
|
232 |
-
/* path to the dynamic.css file */
|
233 |
-
$filepath = get_stylesheet_directory().'/dynamic.css';
|
234 |
-
|
235 |
-
/* allow filter on path */
|
236 |
-
$filepath = apply_filters( 'css_option_file_path', $filepath, $option );
|
237 |
-
|
238 |
-
/* Insert CSS into file */
|
239 |
-
if ( ! file_exists( $filepath ) || is_writeable( $filepath ) ) {
|
240 |
-
|
241 |
-
/* Get options & set CSS value */
|
242 |
-
$options = get_option('option_tree');
|
243 |
-
$insertion = option_tree_normalize_css( stripslashes( $options[$option] ) );
|
244 |
-
$regex = "/{{([a-zA-Z0-9\_\-\#\|\=]+)}}/";
|
245 |
-
$marker = $option;
|
246 |
-
|
247 |
-
/* Match custom CSS */
|
248 |
-
preg_match_all( $regex, $insertion, $matches );
|
249 |
-
|
250 |
-
/* Loop through CSS */
|
251 |
-
foreach( $matches[0] as $option ) {
|
252 |
-
$the_option = str_replace( array('{{', '}}'), '', $option );
|
253 |
-
$option_array = explode("|", $the_option );
|
254 |
-
/* get array by key from key|value explode */
|
255 |
-
if ( is_array( $option_array ) ) {
|
256 |
-
$value = $options[$option_array[0]];
|
257 |
-
/* get the whole array from $option param */
|
258 |
-
} else {
|
259 |
-
$value = $options[$option];
|
260 |
-
}
|
261 |
-
if ( is_array( $value ) ) {
|
262 |
-
/* key|value explode didn't return a second value */
|
263 |
-
if ( !isset($option_array[1]) ) {
|
264 |
-
/* Measurement */
|
265 |
-
if ( isset( $value[0] ) && isset( $value[1] ) ) {
|
266 |
-
$value = $value[0].$value[1];
|
267 |
-
/* typography */
|
268 |
-
} else if ( isset( $value['font-color'] ) || isset( $value['font-style'] ) || isset( $value['font-variant'] ) || isset( $value['font-weight'] ) || isset( $value['font-size'] ) || isset( $value['font-family'] ) ) {
|
269 |
-
$font = array();
|
270 |
-
|
271 |
-
if ( ! empty( $value['font-color'] ) )
|
272 |
-
$font[] = "font-color: " . $value['font-color'] . ";";
|
273 |
-
|
274 |
-
foreach ( recognized_font_families() as $key => $v ) {
|
275 |
-
if ( ! empty( $value['font-family'] ) && $key == $value['font-family'] )
|
276 |
-
$font[] = "font-family: " . $v . ";";
|
277 |
-
}
|
278 |
-
|
279 |
-
if ( ! empty( $value['font-size'] ) )
|
280 |
-
$font[] = "font-size: " . $value['font-size'] . ";";
|
281 |
-
|
282 |
-
if ( ! empty( $value['font-style'] ) )
|
283 |
-
$font[] = "font-style: " . $value['font-style'] . ";";
|
284 |
-
|
285 |
-
if ( ! empty( $value['font-variant'] ) )
|
286 |
-
$font[] = "font-variant: " . $value['font-variant'] . ";";
|
287 |
-
|
288 |
-
if ( ! empty( $value['font-weight'] ) )
|
289 |
-
$font[] = "font-weight: " . $value['font-weight'] . ";";
|
290 |
-
|
291 |
-
if ( ! empty( $font ) )
|
292 |
-
$value = implode( "\n", $font );
|
293 |
-
/* background */
|
294 |
-
} else if ( isset( $value['background-color'] ) || isset( $value['background-image'] ) ) {
|
295 |
-
$bg = array();
|
296 |
-
|
297 |
-
if ( ! empty( $value['background-color'] ) )
|
298 |
-
$bg[] = $value['background-color'];
|
299 |
-
|
300 |
-
if ( ! empty( $value['background-image'] ) )
|
301 |
-
$bg[] = 'url("' . $value['background-image'] . '")';
|
302 |
-
|
303 |
-
if ( ! empty( $value['background-repeat'] ) )
|
304 |
-
$bg[] = $value['background-repeat'];
|
305 |
-
|
306 |
-
if ( ! empty( $value['background-attachment'] ) )
|
307 |
-
$bg[] = $value['background-attachment'];
|
308 |
-
|
309 |
-
if ( ! empty( $value['background-position'] ) )
|
310 |
-
$bg[] = $value['background-position'];
|
311 |
-
|
312 |
-
if ( ! empty( $bg ) )
|
313 |
-
$value = 'background: ' . implode( " ", $bg ) . ';';
|
314 |
-
}
|
315 |
-
/* key|value explode return a second value */
|
316 |
-
} else {
|
317 |
-
$value = $value[$option_array[1]];
|
318 |
-
}
|
319 |
-
}
|
320 |
-
$insertion = stripslashes( str_replace( $option, $value, $insertion ) );
|
321 |
-
}
|
322 |
-
|
323 |
-
/* file doesn't exist */
|
324 |
-
if ( ! file_exists( $filepath ) ) {
|
325 |
-
$markerdata = '';
|
326 |
-
/* file exist, create array from the lines of code */
|
327 |
-
} else {
|
328 |
-
$markerdata = explode( "\n", implode( '', file( $filepath ) ) );
|
329 |
-
}
|
330 |
-
|
331 |
-
/* can't write to the file return false */
|
332 |
-
if ( !$f = @fopen( $filepath, 'w' ) )
|
333 |
-
return false;
|
334 |
-
|
335 |
-
$foundit = false;
|
336 |
-
|
337 |
-
/* has array of lines */
|
338 |
-
if ( $markerdata ) {
|
339 |
-
$state = true;
|
340 |
-
/* foreach line of code */
|
341 |
-
foreach ( $markerdata as $n => $markerline ) {
|
342 |
-
/* found begining of marker, set state to false */
|
343 |
-
if ( strpos( $markerline, '/* BEGIN ' . $marker . ' */' ) !== false )
|
344 |
-
$state = false;
|
345 |
-
/* state is true, rebuild css */
|
346 |
-
if ( $state ) {
|
347 |
-
if ( $n + 1 < count( $markerdata ) )
|
348 |
-
fwrite( $f, "{$markerline}\n" );
|
349 |
-
else
|
350 |
-
fwrite( $f, "{$markerline}" );
|
351 |
-
}
|
352 |
-
/* found end marker write code */
|
353 |
-
if ( strpos( $markerline, '/* END ' . $marker . ' */' ) !== false ) {
|
354 |
-
fwrite( $f, "/* BEGIN {$marker} */\n" );
|
355 |
-
fwrite( $f, "{$insertion}\n" );
|
356 |
-
fwrite( $f, "/* END {$marker} */\n" );
|
357 |
-
$state = true;
|
358 |
-
$foundit = true;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
}
|
362 |
-
/* nothing inserted, write code. DO IT, DO IT! */
|
363 |
-
if ( ! $foundit ) {
|
364 |
-
fwrite( $f, "\n\n/* BEGIN {$marker} */\n" );
|
365 |
-
fwrite( $f, "{$insertion}\n" );
|
366 |
-
fwrite( $f, "/* END {$marker} */\n" );
|
367 |
-
}
|
368 |
-
/* close file */
|
369 |
-
fclose( $f );
|
370 |
-
return true;
|
371 |
-
} else {
|
372 |
-
return false;
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
function option_tree_normalize_css( $s ) {
|
377 |
-
// Normalize line endings
|
378 |
-
// Convert all line-endings to UNIX format
|
379 |
-
$s = str_replace( "\r\n", "\n", $s );
|
380 |
-
$s = str_replace( "\r", "\n", $s );
|
381 |
-
// Don't allow out-of-control blank lines
|
382 |
-
$s = preg_replace( "/\n{2,}/", "\n\n", $s );
|
383 |
-
return $s;
|
384 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/get-option-tree.php
DELETED
@@ -1,79 +0,0 @@
|
|
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 array or comma seperated lists of values
|
17 |
-
*/
|
18 |
-
function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1) {
|
19 |
-
// load saved options
|
20 |
-
if ( !$options )
|
21 |
-
$options = get_option( 'option_tree' );
|
22 |
-
|
23 |
-
// no value return
|
24 |
-
if ( !isset( $options[$item_id] ) || empty( $options[$item_id] ) )
|
25 |
-
return;
|
26 |
-
|
27 |
-
// set content value & strip slashes
|
28 |
-
$content = option_tree_stripslashes( $options[$item_id] );
|
29 |
-
|
30 |
-
// is an array
|
31 |
-
if ( $is_array == true ) {
|
32 |
-
// saved as a comma seperated lists of values, explode into an array
|
33 |
-
if ( !is_array( $content ) )
|
34 |
-
$content = explode( ',', $content );
|
35 |
-
|
36 |
-
// get an array value using an offset
|
37 |
-
if ( is_numeric( $offset ) && $offset >= 0 )
|
38 |
-
$content = $content[$offset];
|
39 |
-
|
40 |
-
// not an array
|
41 |
-
} else if ( $is_array == false ) {
|
42 |
-
// saved as array, implode and return a comma seperated lists of values
|
43 |
-
if ( is_array( $content ) )
|
44 |
-
$content = implode( ',', $content );
|
45 |
-
}
|
46 |
-
|
47 |
-
// echo content
|
48 |
-
if ($echo)
|
49 |
-
echo $content;
|
50 |
-
|
51 |
-
return $content;
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Custom stripslashes from single value or array.
|
56 |
-
*
|
57 |
-
* @uses stripslashes()
|
58 |
-
*
|
59 |
-
* @access public
|
60 |
-
* @since 1.1.3
|
61 |
-
*
|
62 |
-
* @param mixed $input
|
63 |
-
*
|
64 |
-
* @return mixed
|
65 |
-
*/
|
66 |
-
function option_tree_stripslashes( $input ) {
|
67 |
-
if ( is_array( $input ) ) {
|
68 |
-
foreach( $input as &$val ) {
|
69 |
-
if ( is_array( $val ) ) {
|
70 |
-
$val = option_tree_stripslashes( $val );
|
71 |
-
} else {
|
72 |
-
$val = stripslashes( $val );
|
73 |
-
}
|
74 |
-
}
|
75 |
-
} else {
|
76 |
-
$input = stripslashes( $input );
|
77 |
-
}
|
78 |
-
return $input;
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
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) 2012, Derek Herman
|
11 |
+
* @since 2.0
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Runs directly after the Theme Options are save.
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*
|
19 |
+
* @access public
|
20 |
+
* @since 2.0
|
21 |
+
*/
|
22 |
+
if ( ! function_exists( 'ot_after_theme_options_save' ) ) {
|
23 |
+
|
24 |
+
function ot_after_theme_options_save() {
|
25 |
+
|
26 |
+
$page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
|
27 |
+
$updated = isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ? true : false;
|
28 |
+
|
29 |
+
/* only execute after the theme options are saved */
|
30 |
+
if ( 'ot-theme-options' == $page && $updated ) {
|
31 |
+
|
32 |
+
/* grab a copy of the theme options */
|
33 |
+
$options = get_option( 'option_tree' );
|
34 |
+
|
35 |
+
/* execute the action hook and pass the theme options to it */
|
36 |
+
do_action( 'ot_after_theme_options_save', $options );
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Validate the options by type before saving.
|
46 |
+
*
|
47 |
+
* This function will run on only some of the option types
|
48 |
+
* as all of them don't need to be validated, just the
|
49 |
+
* ones users are going to input data into; because they
|
50 |
+
* can't be trusted.
|
51 |
+
*
|
52 |
+
* @param mixed Setting value
|
53 |
+
* @param string Setting type
|
54 |
+
* @return mixed
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
* @since 2.0
|
58 |
+
*/
|
59 |
+
if ( ! function_exists( 'ot_validate_setting' ) ) {
|
60 |
+
|
61 |
+
function ot_validate_setting( $input, $type ) {
|
62 |
+
|
63 |
+
/* exit early if missing data */
|
64 |
+
if ( ! $input || ! $type )
|
65 |
+
return $input;
|
66 |
+
|
67 |
+
$input = apply_filters( 'ot_validate_setting', $input, $type );
|
68 |
+
|
69 |
+
if ( 'background' == $type ) {
|
70 |
+
|
71 |
+
$input['background-color'] = ot_validate_setting( $input['background-color'], 'colorpicker' );
|
72 |
+
|
73 |
+
$input['background-image'] = ot_validate_setting( $input['background-image'], 'upload' );
|
74 |
+
|
75 |
+
} else if ( 'colorpicker' == $type ) {
|
76 |
+
|
77 |
+
/* return empty & set error */
|
78 |
+
if ( 0 === preg_match( '/^#([a-f0-9]{6}|[a-f0-9]{3})$/i', $input ) ) {
|
79 |
+
|
80 |
+
$input = '';
|
81 |
+
|
82 |
+
add_settings_error( 'option-tree', 'invalid_hex', __( 'The Colorpicker only allows valid hexadecimal values.', 'option-tree' ), 'error' );
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
} else if ( in_array( $type, array( 'css', 'text', 'textarea', 'textarea-simple' ) ) ) {
|
87 |
+
|
88 |
+
if ( ! current_user_can( 'unfiltered_html' ) && OT_ALLOW_UNFILTERED_HTML == false ) {
|
89 |
+
|
90 |
+
$input = wp_kses_post( $input );
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
} else if ( 'measurement' == $type ) {
|
95 |
+
|
96 |
+
$input[0] = sanitize_text_field( $input[0] );
|
97 |
+
|
98 |
+
} else if ( 'typography' == $type ) {
|
99 |
+
|
100 |
+
$input['font-color'] = ot_validate_setting( $input['font-color'], 'colorpicker' );
|
101 |
+
|
102 |
+
} else if ( 'upload' == $type ) {
|
103 |
+
|
104 |
+
$input = sanitize_text_field( $input );
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
return $input;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Setup the default admin styles
|
116 |
+
*
|
117 |
+
* @return void
|
118 |
+
*
|
119 |
+
* @access public
|
120 |
+
* @since 2.0
|
121 |
+
*/
|
122 |
+
if ( ! function_exists( 'ot_admin_styles' ) ) {
|
123 |
+
|
124 |
+
function ot_admin_styles() {
|
125 |
+
|
126 |
+
wp_enqueue_style( 'ot-admin-css', OT_URL . 'assets/css/ot-admin.css', false, OT_VERSION );
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Setup the default admin scripts
|
134 |
+
*
|
135 |
+
* @uses add_thickbox() Include Thickbox for file uploads
|
136 |
+
* @uses wp_enqueue_script() Add OptionTree scripts
|
137 |
+
* @uses wp_localize_script() Used to include arbitrary Javascript data
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
*
|
141 |
+
* @access public
|
142 |
+
* @since 2.0
|
143 |
+
*/
|
144 |
+
if ( ! function_exists( 'ot_admin_scripts' ) ) {
|
145 |
+
|
146 |
+
function ot_admin_scripts() {
|
147 |
+
|
148 |
+
/* enqueue admin scripts */
|
149 |
+
add_thickbox();
|
150 |
+
|
151 |
+
/* load the colorpicker */
|
152 |
+
wp_enqueue_script( 'ot-colorpicker-js', OT_URL . 'assets/js/ot-colorpicker.js', array( 'jquery' ), OT_VERSION );
|
153 |
+
|
154 |
+
/* load all the required scripts */
|
155 |
+
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 );
|
156 |
+
|
157 |
+
/* create localized JS array */
|
158 |
+
$localized_array = array(
|
159 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
160 |
+
'upload_text' => __( 'Send to OptionTree', 'option-tree' ),
|
161 |
+
'remove_media_text' => __( 'Remove Media', 'option-tree' ),
|
162 |
+
'reset_agree' => __( 'Are you sure you want to reset back to the defaults?', 'option-tree' ),
|
163 |
+
'remove_no' => __( 'You can\'t remove this! But you can edit the values.', 'option-tree' ),
|
164 |
+
'remove_agree' => __( 'Are you sure you want to remove this?', 'option-tree' ),
|
165 |
+
'activate_layout_agree' => __( 'Are you sure you want to activate this layout?', 'option-tree' ),
|
166 |
+
'setting_limit' => __( 'Sorry, you can\'t have settings three levels deep.', 'option-tree' )
|
167 |
+
);
|
168 |
+
|
169 |
+
/* localized script attached to 'option_tree' */
|
170 |
+
wp_localize_script( 'ot-admin-js', 'option_tree', $localized_array );
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Returns the ID of a custom post type by post_name.
|
178 |
+
*
|
179 |
+
* @uses get_results()
|
180 |
+
*
|
181 |
+
* @return int
|
182 |
+
*
|
183 |
+
* @access public
|
184 |
+
* @since 2.0
|
185 |
+
*/
|
186 |
+
function ot_get_media_post_ID() {
|
187 |
+
global $wpdb;
|
188 |
+
|
189 |
+
return $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE `post_name` = 'media' AND `post_type` = 'option-tree' AND `post_status` = 'private'" );
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Register custom post type & create the media post used to attach images.
|
195 |
+
*
|
196 |
+
* @uses get_results()
|
197 |
+
*
|
198 |
+
* @return void
|
199 |
+
*
|
200 |
+
* @access public
|
201 |
+
* @since 2.0
|
202 |
+
*/
|
203 |
+
function ot_create_media_post() {
|
204 |
+
global $current_user;
|
205 |
+
|
206 |
+
register_post_type( 'option-tree', array(
|
207 |
+
'labels' => array( 'name' => __( 'Option Tree', 'option-tree' ) ),
|
208 |
+
'public' => true,
|
209 |
+
'show_ui' => false,
|
210 |
+
'capability_type' => 'post',
|
211 |
+
'exclude_from_search' => true,
|
212 |
+
'hierarchical' => false,
|
213 |
+
'rewrite' => false,
|
214 |
+
'supports' => array( 'title', 'editor' ),
|
215 |
+
'can_export' => true,
|
216 |
+
'show_in_nav_menus' => false
|
217 |
+
) );
|
218 |
+
|
219 |
+
/* look for custom page */
|
220 |
+
$post_id = ot_get_media_post_ID();
|
221 |
+
|
222 |
+
/* no post exists */
|
223 |
+
if ( $post_id > 0 ) {
|
224 |
+
|
225 |
+
/* create post object */
|
226 |
+
$_p = array();
|
227 |
+
$_p['post_title'] = 'Media';
|
228 |
+
$_p['post_status'] = 'private';
|
229 |
+
$_p['post_type'] = 'option-tree';
|
230 |
+
$_p['comment_status'] = 'closed';
|
231 |
+
$_p['ping_status'] = 'closed';
|
232 |
+
|
233 |
+
/* insert the post into the database */
|
234 |
+
wp_insert_post( $_p );
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Setup default settings array.
|
242 |
+
*
|
243 |
+
* @return void
|
244 |
+
*
|
245 |
+
* @access public
|
246 |
+
* @since 2.0
|
247 |
+
*/
|
248 |
+
if ( ! function_exists( 'ot_default_settings' ) ) {
|
249 |
+
|
250 |
+
function ot_default_settings() {
|
251 |
+
global $wpdb, $table_prefix;
|
252 |
+
|
253 |
+
if ( ! get_option( 'option_tree_settings' ) ) {
|
254 |
+
|
255 |
+
$section_count = 0;
|
256 |
+
$settings_count = 0;
|
257 |
+
$settings = array();
|
258 |
+
|
259 |
+
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" ) ) {
|
260 |
+
|
261 |
+
foreach ( $old_settings as $setting ) {
|
262 |
+
|
263 |
+
/* heading is a section now */
|
264 |
+
if ( $setting->item_type == 'heading' ) {
|
265 |
+
|
266 |
+
/* add section to the sections array */
|
267 |
+
$settings['sections'][$section_count]['id'] = $setting->item_id;
|
268 |
+
$settings['sections'][$section_count]['title'] = $setting->item_title;
|
269 |
+
|
270 |
+
/* save the last section id to use in creating settings */
|
271 |
+
$section = $setting->item_id;
|
272 |
+
|
273 |
+
/* increment the section count */
|
274 |
+
$section_count++;
|
275 |
+
|
276 |
+
} else {
|
277 |
+
|
278 |
+
/* add setting to the settings array */
|
279 |
+
$settings['settings'][$settings_count]['id'] = $setting->item_id;
|
280 |
+
$settings['settings'][$settings_count]['label'] = $setting->item_title;
|
281 |
+
$settings['settings'][$settings_count]['desc'] = $setting->item_desc;
|
282 |
+
$settings['settings'][$settings_count]['section'] = $section;
|
283 |
+
$settings['settings'][$settings_count]['type'] = ot_map_old_option_types( $setting->item_type );
|
284 |
+
$settings['settings'][$settings_count]['std'] = '';
|
285 |
+
$settings['settings'][$settings_count]['class'] = '';
|
286 |
+
|
287 |
+
/* textarea rows */
|
288 |
+
$rows = '';
|
289 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
|
290 |
+
if ( (int) $setting->item_options > 0 ) {
|
291 |
+
$rows = (int) $setting->item_options;
|
292 |
+
} else {
|
293 |
+
$rows = 15;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
$settings['settings'][$settings_count]['rows'] = $rows;
|
297 |
+
|
298 |
+
/* post type */
|
299 |
+
$post_type = '';
|
300 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
|
301 |
+
if ( '' != $setting->item_options ) {
|
302 |
+
$post_type = $setting->item_options;
|
303 |
+
} else {
|
304 |
+
$post_type = 'post';
|
305 |
+
}
|
306 |
+
}
|
307 |
+
$settings['settings'][$settings_count]['post_type'] = $post_type;
|
308 |
+
|
309 |
+
/* choices */
|
310 |
+
$choices = array();
|
311 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
|
312 |
+
if ( '' != $setting->item_options ) {
|
313 |
+
$choices = ot_convert_string_to_array( $setting->item_options );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
$settings['settings'][$settings_count]['choices'] = $choices;
|
317 |
+
|
318 |
+
$settings_count++;
|
319 |
+
}
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
/* make sure each setting has a section just incase */
|
324 |
+
if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
|
325 |
+
foreach( $settings['settings'] as $k => $setting ) {
|
326 |
+
if ( '' == $setting['section'] ) {
|
327 |
+
$settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
/* if array if not properly formed create fallback settings array */
|
335 |
+
if ( ! isset( $settings['sections'] ) || ! isset( $settings['settings'] ) ) {
|
336 |
+
|
337 |
+
$settings = array(
|
338 |
+
'sections' => array(
|
339 |
+
array(
|
340 |
+
'id' => 'general',
|
341 |
+
'title' => __( 'General', 'option-tree' )
|
342 |
+
)
|
343 |
+
),
|
344 |
+
'settings' => array(
|
345 |
+
array(
|
346 |
+
'id' => 'sample_text',
|
347 |
+
'label' => __( 'Sample Text Field Label', 'option-tree' ),
|
348 |
+
'desc' => __( 'Description for the sample text field.', 'option-tree' ),
|
349 |
+
'section' => 'general',
|
350 |
+
'type' => 'text',
|
351 |
+
'std' => '',
|
352 |
+
'class' => '',
|
353 |
+
'rows' => '',
|
354 |
+
'post_type' => '',
|
355 |
+
'choices' => array()
|
356 |
+
)
|
357 |
+
)
|
358 |
+
);
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
/* update the DB */
|
363 |
+
update_option( 'option_tree_settings', $settings );
|
364 |
+
|
365 |
+
}
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Helper function to update the CSS option type after save.
|
373 |
+
*
|
374 |
+
* @return void
|
375 |
+
*
|
376 |
+
* @access public
|
377 |
+
* @since 2.0
|
378 |
+
*/
|
379 |
+
if ( ! function_exists( 'ot_save_css' ) ) {
|
380 |
+
|
381 |
+
function ot_save_css( $options ) {
|
382 |
+
|
383 |
+
/* grab a copy of the settings */
|
384 |
+
$settings = get_option( 'option_tree_settings' );
|
385 |
+
|
386 |
+
/* has settings */
|
387 |
+
if ( isset( $settings['settings'] ) ) {
|
388 |
+
|
389 |
+
/* loop through sections and insert CSS when needed */
|
390 |
+
foreach( $settings['settings'] as $k => $setting ) {
|
391 |
+
|
392 |
+
/* is the CSS option type */
|
393 |
+
if ( isset( $setting['type'] ) && 'css' == $setting['type'] ) {
|
394 |
+
|
395 |
+
/* insert CSS into dynamic.css */
|
396 |
+
if ( isset( $options[$setting['id']] ) && '' !== $options[$setting['id']] ) {
|
397 |
+
|
398 |
+
ot_insert_css_with_markers( $setting['id'], $options[$setting['id']] );
|
399 |
+
|
400 |
+
/* remove old CSS from dynamic.css */
|
401 |
+
} else {
|
402 |
+
|
403 |
+
ot_remove_old_css( $setting['id'] );
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
}
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
}
|
412 |
+
|
413 |
+
}
|
414 |
+
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Helper function to load filters for XML mime type.
|
419 |
+
*
|
420 |
+
* @return void
|
421 |
+
*
|
422 |
+
* @access public
|
423 |
+
* @since 2.0
|
424 |
+
*/
|
425 |
+
if ( ! function_exists( 'ot_add_xml_to_upload_filetypes' ) ) {
|
426 |
+
|
427 |
+
function ot_add_xml_to_upload_filetypes() {
|
428 |
+
|
429 |
+
add_filter( 'upload_mimes', 'ot_upload_mimes' );
|
430 |
+
add_filter( 'wp_mime_type_icon', 'ot_xml_mime_type_icon', 10, 2 );
|
431 |
+
|
432 |
+
}
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Filter 'upload_mimes' and add xml.
|
438 |
+
*
|
439 |
+
* @param array $mimes An array of valid upload mime types
|
440 |
+
* @return array
|
441 |
+
*
|
442 |
+
* @access public
|
443 |
+
* @since 2.0
|
444 |
+
*/
|
445 |
+
if ( ! function_exists( 'ot_upload_mimes' ) ) {
|
446 |
+
|
447 |
+
function ot_upload_mimes( $mimes ) {
|
448 |
+
|
449 |
+
$mimes['xml'] = 'application/xml';
|
450 |
+
|
451 |
+
return $mimes;
|
452 |
+
|
453 |
+
}
|
454 |
+
|
455 |
+
}
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Filters 'wp_mime_type_icon' and have xml display as a document.
|
459 |
+
*
|
460 |
+
* @param string $icon The mime icon
|
461 |
+
* @param string $mime The mime type
|
462 |
+
* @return string
|
463 |
+
*
|
464 |
+
* @access public
|
465 |
+
* @since 2.0
|
466 |
+
*/
|
467 |
+
if ( ! function_exists( 'ot_xml_mime_type_icon' ) ) {
|
468 |
+
|
469 |
+
function ot_xml_mime_type_icon( $icon, $mime ) {
|
470 |
+
|
471 |
+
if ( $mime == 'application/xml' || $mime == 'text/xml' )
|
472 |
+
return wp_mime_type_icon( 'document' );
|
473 |
+
|
474 |
+
return $icon;
|
475 |
+
|
476 |
+
}
|
477 |
+
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Import data before the screen is displayed.
|
482 |
+
*
|
483 |
+
* @return void
|
484 |
+
*
|
485 |
+
* @access public
|
486 |
+
* @since 2.0
|
487 |
+
*/
|
488 |
+
if ( ! function_exists( 'ot_import' ) ) {
|
489 |
+
|
490 |
+
function ot_import() {
|
491 |
+
|
492 |
+
/* check and verify import xml nonce */
|
493 |
+
if ( isset( $_POST['import_xml_nonce'] ) && wp_verify_nonce( $_POST['import_xml_nonce'], 'import_xml_form' ) ) {
|
494 |
+
|
495 |
+
/* import input value */
|
496 |
+
$file = isset( $_POST['import_xml'] ) ? esc_url( $_POST['import_xml'] ) : '';
|
497 |
+
|
498 |
+
/* validate xml file */
|
499 |
+
if ( preg_match( "/(.xml)$/i", $file ) && class_exists( 'SimpleXMLElement' ) && function_exists( 'file_get_contents' ) ) {
|
500 |
+
|
501 |
+
if ( $rawdata = @file_get_contents( $file ) ) {
|
502 |
+
|
503 |
+
$section_count = 0;
|
504 |
+
$settings_count = 0;
|
505 |
+
|
506 |
+
$section = '';
|
507 |
+
|
508 |
+
$settings = array();
|
509 |
+
$xml = new SimpleXMLElement( $rawdata );
|
510 |
+
|
511 |
+
foreach ( $xml->row as $value ) {
|
512 |
+
|
513 |
+
/* heading is a section now */
|
514 |
+
if ( $value->item_type == 'heading' ) {
|
515 |
+
|
516 |
+
/* add section to the sections array */
|
517 |
+
$settings['sections'][$section_count]['id'] = (string) $value->item_id;
|
518 |
+
$settings['sections'][$section_count]['title'] = (string) $value->item_title;
|
519 |
+
|
520 |
+
/* save the last section id to use in creating settings */
|
521 |
+
$section = (string) $value->item_id;
|
522 |
+
|
523 |
+
/* increment the section count */
|
524 |
+
$section_count++;
|
525 |
+
|
526 |
+
} else {
|
527 |
+
|
528 |
+
/* add setting to the settings array */
|
529 |
+
$settings['settings'][$settings_count]['id'] = (string) $value->item_id;
|
530 |
+
$settings['settings'][$settings_count]['label'] = (string) $value->item_title;
|
531 |
+
$settings['settings'][$settings_count]['desc'] = (string) $value->item_desc;
|
532 |
+
$settings['settings'][$settings_count]['section'] = $section;
|
533 |
+
$settings['settings'][$settings_count]['type'] = ot_map_old_option_types( (string) $value->item_type );
|
534 |
+
$settings['settings'][$settings_count]['std'] = '';
|
535 |
+
$settings['settings'][$settings_count]['class'] = '';
|
536 |
+
|
537 |
+
/* textarea rows */
|
538 |
+
$rows = '';
|
539 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
|
540 |
+
if ( (int) $value->item_options > 0 ) {
|
541 |
+
$rows = (int) $value->item_options;
|
542 |
+
} else {
|
543 |
+
$rows = 15;
|
544 |
+
}
|
545 |
+
}
|
546 |
+
$settings['settings'][$settings_count]['rows'] = $rows;
|
547 |
+
|
548 |
+
/* post type */
|
549 |
+
$post_type = '';
|
550 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
|
551 |
+
if ( '' != (string) $value->item_options ) {
|
552 |
+
$post_type = (string) $value->item_options;
|
553 |
+
} else {
|
554 |
+
$post_type = 'post';
|
555 |
+
}
|
556 |
+
}
|
557 |
+
$settings['settings'][$settings_count]['post_type'] = $post_type;
|
558 |
+
|
559 |
+
/* choices */
|
560 |
+
$choices = array();
|
561 |
+
if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
|
562 |
+
if ( '' != (string) $value->item_options ) {
|
563 |
+
$choices = ot_convert_string_to_array( (string) $value->item_options );
|
564 |
+
}
|
565 |
+
}
|
566 |
+
$settings['settings'][$settings_count]['choices'] = $choices;
|
567 |
+
|
568 |
+
$settings_count++;
|
569 |
+
}
|
570 |
+
|
571 |
+
}
|
572 |
+
|
573 |
+
/* make sure each setting has a section just incase */
|
574 |
+
if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
|
575 |
+
foreach( $settings['settings'] as $k => $setting ) {
|
576 |
+
if ( '' == $setting['section'] ) {
|
577 |
+
$settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
|
578 |
+
}
|
579 |
+
}
|
580 |
+
}
|
581 |
+
|
582 |
+
}
|
583 |
+
}
|
584 |
+
|
585 |
+
/* default message */
|
586 |
+
$message = 'failed';
|
587 |
+
|
588 |
+
/* cleanup, save, & show success message */
|
589 |
+
if ( isset( $settings ) && ! empty( $settings ) ) {
|
590 |
+
|
591 |
+
/* delete file */
|
592 |
+
if ( $file ) {
|
593 |
+
global $wpdb;
|
594 |
+
$attachmentid = $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE guid='$file'" );
|
595 |
+
wp_delete_attachment( $attachmentid, true );
|
596 |
+
}
|
597 |
+
|
598 |
+
/* update settings */
|
599 |
+
update_option( 'option_tree_settings', $settings );
|
600 |
+
|
601 |
+
/* set message */
|
602 |
+
$message = 'success';
|
603 |
+
|
604 |
+
}
|
605 |
+
|
606 |
+
/* redirect */
|
607 |
+
wp_redirect( add_query_arg( array( 'action' => 'import-xml', 'message' => $message ), $_POST['_wp_http_referer'] ) );
|
608 |
+
exit;
|
609 |
+
|
610 |
+
}
|
611 |
+
|
612 |
+
/* check and verify import settings nonce */
|
613 |
+
if ( isset( $_POST['import_settings_nonce'] ) && wp_verify_nonce( $_POST['import_settings_nonce'], 'import_settings_form' ) ) {
|
614 |
+
|
615 |
+
/* textarea value */
|
616 |
+
$textarea = isset( $_POST['import_settings'] ) ? unserialize( base64_decode( $_POST['import_settings'] ) ) : '';
|
617 |
+
|
618 |
+
/* default message */
|
619 |
+
$message = 'failed';
|
620 |
+
|
621 |
+
/* is array: save & show success message */
|
622 |
+
if ( is_array( $textarea ) ) {
|
623 |
+
update_option( 'option_tree_settings', $textarea );
|
624 |
+
$message = 'success';
|
625 |
+
}
|
626 |
+
|
627 |
+
/* redirect */
|
628 |
+
wp_redirect( add_query_arg( array( 'action' => 'import-settings', 'message' => $message ), $_POST['_wp_http_referer'] ) );
|
629 |
+
exit;
|
630 |
+
|
631 |
+
}
|
632 |
+
|
633 |
+
/* check and verify import theme options data nonce */
|
634 |
+
if ( isset( $_POST['import_data_nonce'] ) && wp_verify_nonce( $_POST['import_data_nonce'], 'import_data_form' ) ) {
|
635 |
+
|
636 |
+
/* textarea value */
|
637 |
+
$textarea = isset( $_POST['import_data'] ) ? unserialize( base64_decode( $_POST['import_data'] ) ) : '';
|
638 |
+
|
639 |
+
/* default message */
|
640 |
+
$message = 'failed';
|
641 |
+
|
642 |
+
/* is array: save & show success message */
|
643 |
+
if ( is_array( $textarea ) ) {
|
644 |
+
update_option( 'option_tree', $textarea );
|
645 |
+
$message = 'success';
|
646 |
+
}
|
647 |
+
|
648 |
+
/* redirect accordingly */
|
649 |
+
wp_redirect( add_query_arg( array( 'action' => 'import-data', 'message' => $message ), $_POST['_wp_http_referer'] ) );
|
650 |
+
exit;
|
651 |
+
|
652 |
+
}
|
653 |
+
|
654 |
+
/* check and verify import layouts nonce */
|
655 |
+
if ( isset( $_POST['import_layouts_nonce'] ) && wp_verify_nonce( $_POST['import_layouts_nonce'], 'import_layouts_form' ) ) {
|
656 |
+
|
657 |
+
/* textarea value */
|
658 |
+
$textarea = isset( $_POST['import_layouts'] ) ? unserialize( base64_decode( $_POST['import_layouts'] ) ) : '';
|
659 |
+
|
660 |
+
/* default message */
|
661 |
+
$message = 'failed';
|
662 |
+
|
663 |
+
/* is array: save & show success message */
|
664 |
+
if ( is_array( $textarea ) ) {
|
665 |
+
if ( isset( $textarea['active_layout'] ) ) {
|
666 |
+
update_option( 'option_tree', unserialize( base64_decode( $textarea[$textarea['active_layout']] ) ) );
|
667 |
+
}
|
668 |
+
update_option( 'option_tree_layouts', $textarea );
|
669 |
+
$message = 'success';
|
670 |
+
}
|
671 |
+
|
672 |
+
/* redirect accordingly */
|
673 |
+
wp_redirect( add_query_arg( array( 'action' => 'import-layouts', 'message' => $message ), $_POST['_wp_http_referer'] ) );
|
674 |
+
exit;
|
675 |
+
|
676 |
+
}
|
677 |
+
|
678 |
+
return false;
|
679 |
+
|
680 |
+
}
|
681 |
+
|
682 |
+
}
|
683 |
+
|
684 |
+
/**
|
685 |
+
* Save settings array before the screen is displayed.
|
686 |
+
*
|
687 |
+
* @return void
|
688 |
+
*
|
689 |
+
* @access public
|
690 |
+
* @since 2.0
|
691 |
+
*/
|
692 |
+
if ( ! function_exists( 'ot_save_settings' ) ) {
|
693 |
+
|
694 |
+
function ot_save_settings() {
|
695 |
+
|
696 |
+
/* check and verify import settings nonce */
|
697 |
+
if ( isset( $_POST['option_tree_settings_nonce'] ) && wp_verify_nonce( $_POST['option_tree_settings_nonce'], 'option_tree_settings_form' ) ) {
|
698 |
+
|
699 |
+
/* settings value */
|
700 |
+
$settings = isset( $_POST['option_tree_settings'] ) ? $_POST['option_tree_settings'] : '';
|
701 |
+
|
702 |
+
/* validate sections */
|
703 |
+
if ( isset( $settings['sections'] ) ) {
|
704 |
+
|
705 |
+
/* fix numeric keys since drag & drop will change them */
|
706 |
+
$settings['sections'] = array_values( $settings['sections'] );
|
707 |
+
|
708 |
+
/* loop through sections */
|
709 |
+
foreach( $settings['sections'] as $k => $section ) {
|
710 |
+
|
711 |
+
/* remove from array if missing values */
|
712 |
+
if ( ! $section['title'] && ! $section['id'] ) {
|
713 |
+
|
714 |
+
unset( $settings['sections'][$k] );
|
715 |
+
|
716 |
+
} else {
|
717 |
+
|
718 |
+
/* missing title set to unfiltered ID */
|
719 |
+
if ( ! $section['title'] ) {
|
720 |
+
|
721 |
+
$settings['sections'][$k]['title'] = esc_attr( $section['id'] );
|
722 |
+
|
723 |
+
/* missing ID set to title */
|
724 |
+
} else if ( ! $section['id'] ) {
|
725 |
+
|
726 |
+
$section['id'] = esc_attr( $section['title'] );
|
727 |
+
|
728 |
+
}
|
729 |
+
|
730 |
+
/* sanitize ID once everything has been checked first */
|
731 |
+
$settings['sections'][$k]['id'] = ot_sanitize_option_id( $section['id'] );
|
732 |
+
|
733 |
+
}
|
734 |
+
|
735 |
+
}
|
736 |
+
|
737 |
+
}
|
738 |
+
|
739 |
+
/* validate settings by looping over array as many times as it takes */
|
740 |
+
if ( isset( $settings['settings'] ) ) {
|
741 |
+
|
742 |
+
$settings['settings'] = ot_validate_settings_array( $settings['settings'] );
|
743 |
+
|
744 |
+
}
|
745 |
+
|
746 |
+
/* validate contextual_help */
|
747 |
+
if ( isset( $settings['contextual_help']['content'] ) ) {
|
748 |
+
|
749 |
+
/* fix numeric keys since drag & drop will change them */
|
750 |
+
$settings['contextual_help']['content'] = array_values( $settings['contextual_help']['content'] );
|
751 |
+
|
752 |
+
/* loop through content */
|
753 |
+
foreach( $settings['contextual_help']['content'] as $k => $content ) {
|
754 |
+
|
755 |
+
/* remove from array if missing values */
|
756 |
+
if ( ! $content['title'] && ! $content['id'] ) {
|
757 |
+
|
758 |
+
unset( $settings['contextual_help']['content'][$k] );
|
759 |
+
|
760 |
+
} else {
|
761 |
+
|
762 |
+
/* missing title set to unfiltered ID */
|
763 |
+
if ( ! $content['title'] ) {
|
764 |
+
|
765 |
+
$settings['contextual_help']['content'][$k]['title'] = esc_attr( $content['id'] );
|
766 |
+
|
767 |
+
/* missing ID set to title */
|
768 |
+
} else if ( ! $content['id'] ) {
|
769 |
+
|
770 |
+
$content['id'] = esc_attr( $content['title'] );
|
771 |
+
|
772 |
+
}
|
773 |
+
|
774 |
+
/* sanitize ID once everything has been checked first */
|
775 |
+
$settings['contextual_help']['content'][$k]['id'] = ot_sanitize_option_id( $content['id'] );
|
776 |
+
|
777 |
+
}
|
778 |
+
|
779 |
+
/* validate textarea description */
|
780 |
+
if ( isset( $content['content'] ) ) {
|
781 |
+
|
782 |
+
$settings['contextual_help']['content'][$k]['content'] = esc_html( stripcslashes( $content['content'] ) );
|
783 |
+
|
784 |
+
}
|
785 |
+
|
786 |
+
}
|
787 |
+
|
788 |
+
}
|
789 |
+
|
790 |
+
/* validate contextual_help sidebar */
|
791 |
+
if ( isset( $settings['contextual_help']['sidebar'] ) ) {
|
792 |
+
|
793 |
+
$settings['contextual_help']['sidebar'] = esc_html( stripcslashes( $settings['contextual_help']['sidebar'] ) );
|
794 |
+
|
795 |
+
}
|
796 |
+
|
797 |
+
/* default message */
|
798 |
+
$message = 'failed';
|
799 |
+
|
800 |
+
/* is array: save & show success message */
|
801 |
+
if ( is_array( $settings ) ) {
|
802 |
+
update_option( 'option_tree_settings', $settings );
|
803 |
+
$message = 'success';
|
804 |
+
}
|
805 |
+
|
806 |
+
/* redirect */
|
807 |
+
wp_redirect( add_query_arg( array( 'action' => 'save-settings', 'message' => $message ), $_POST['_wp_http_referer'] ) );
|
808 |
+
exit;
|
809 |
+
|
810 |
+
}
|
811 |
+
|
812 |
+
return false;
|
813 |
+
|
814 |
+
}
|
815 |
+
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Validate the settings array before save.
|
820 |
+
*
|
821 |
+
* This function will loop over the settings array as many
|
822 |
+
* times as it takes to validate every sub setting.
|
823 |
+
*
|
824 |
+
* @param array $settings The array of settings.
|
825 |
+
* @return array
|
826 |
+
*
|
827 |
+
* @access public
|
828 |
+
* @since 2.0
|
829 |
+
*/
|
830 |
+
if ( ! function_exists( 'ot_validate_settings_array' ) ) {
|
831 |
+
|
832 |
+
function ot_validate_settings_array( $settings = array() ) {
|
833 |
+
|
834 |
+
/* validate settings */
|
835 |
+
if ( count( $settings ) > 0 ) {
|
836 |
+
|
837 |
+
/* fix numeric keys since drag & drop will change them */
|
838 |
+
$settings = array_values( $settings );
|
839 |
+
|
840 |
+
/* loop through settings */
|
841 |
+
foreach( $settings as $k => $setting ) {
|
842 |
+
|
843 |
+
/* remove from array if missing values */
|
844 |
+
if ( ! $setting['label'] && ! $setting['id'] ) {
|
845 |
+
|
846 |
+
unset( $settings[$k] );
|
847 |
+
|
848 |
+
} else {
|
849 |
+
|
850 |
+
/* missing label set to unfiltered ID */
|
851 |
+
if ( ! $setting['label'] ) {
|
852 |
+
|
853 |
+
$settings[$k]['label'] = esc_attr( $setting['id'] );
|
854 |
+
|
855 |
+
/* missing ID set to label */
|
856 |
+
} else if ( ! $setting['id'] ) {
|
857 |
+
|
858 |
+
$setting['id'] = esc_attr( $setting['label'] );
|
859 |
+
|
860 |
+
}
|
861 |
+
|
862 |
+
/* sanitize ID once everything has been checked first */
|
863 |
+
$settings[$k]['id'] = ot_sanitize_option_id( $setting['id'] );
|
864 |
+
|
865 |
+
}
|
866 |
+
|
867 |
+
/* validate textarea description */
|
868 |
+
if ( isset( $setting['desc'] ) ) {
|
869 |
+
|
870 |
+
$settings[$k]['desc'] = esc_html( stripcslashes( $setting['desc'] ) );
|
871 |
+
|
872 |
+
}
|
873 |
+
|
874 |
+
/* validate choices */
|
875 |
+
if ( isset( $setting['choices'] ) ) {
|
876 |
+
|
877 |
+
/* loop through choices */
|
878 |
+
foreach( $setting['choices'] as $ck => $choice ) {
|
879 |
+
|
880 |
+
/* remove from array if missing values */
|
881 |
+
if ( ! $choice['label'] && ! $choice['value'] ) {
|
882 |
+
|
883 |
+
unset( $setting['choices'][$ck] );
|
884 |
+
|
885 |
+
} else {
|
886 |
+
|
887 |
+
/* missing label set to unfiltered ID */
|
888 |
+
if ( ! $choice['label'] ) {
|
889 |
+
|
890 |
+
$setting['choices'][$ck]['label'] = esc_attr( $choice['value'] );
|
891 |
+
|
892 |
+
/* missing value set to label */
|
893 |
+
} else if ( ! $choice['value'] ) {
|
894 |
+
|
895 |
+
$setting['choices'][$ck]['value'] = ot_sanitize_option_id( $choice['label'] );
|
896 |
+
|
897 |
+
}
|
898 |
+
|
899 |
+
}
|
900 |
+
|
901 |
+
}
|
902 |
+
|
903 |
+
/* update keys and push new array values */
|
904 |
+
$settings[$k]['choices'] = array_values( $setting['choices'] );
|
905 |
+
|
906 |
+
}
|
907 |
+
|
908 |
+
/* validate sub settings */
|
909 |
+
if ( isset( $setting['settings'] ) ) {
|
910 |
+
|
911 |
+
$settings[$k]['settings'] = ot_validate_settings_array( $setting['settings'] );
|
912 |
+
|
913 |
+
}
|
914 |
+
|
915 |
+
}
|
916 |
+
|
917 |
+
}
|
918 |
+
|
919 |
+
return $settings;
|
920 |
+
|
921 |
+
}
|
922 |
+
|
923 |
+
}
|
924 |
+
|
925 |
+
/**
|
926 |
+
* Save layouts array before the screen is displayed.
|
927 |
+
*
|
928 |
+
* @return void
|
929 |
+
*
|
930 |
+
* @access public
|
931 |
+
* @since 2.0
|
932 |
+
*/
|
933 |
+
if ( ! function_exists( 'ot_modify_layouts' ) ) {
|
934 |
+
|
935 |
+
function ot_modify_layouts() {
|
936 |
+
|
937 |
+
/* check and verify modify layouts nonce */
|
938 |
+
if ( isset( $_POST['option_tree_modify_layouts_nonce'] ) && wp_verify_nonce( $_POST['option_tree_modify_layouts_nonce'], 'option_tree_modify_layouts_form' ) ) {
|
939 |
+
|
940 |
+
/* previous layouts value */
|
941 |
+
$option_tree_layouts = get_option( 'option_tree_layouts' );
|
942 |
+
|
943 |
+
/* new layouts value */
|
944 |
+
$layouts = isset( $_POST['option_tree_layouts'] ) ? $_POST['option_tree_layouts'] : '';
|
945 |
+
|
946 |
+
/* rebuild layout array */
|
947 |
+
$rebuild = array();
|
948 |
+
|
949 |
+
/* validate layouts */
|
950 |
+
if ( is_array( $layouts ) && ! empty( $layouts ) ) {
|
951 |
+
|
952 |
+
/* setup active layout */
|
953 |
+
if ( isset( $layouts['active_layout'] ) && '' != $layouts['active_layout'] ) {
|
954 |
+
$rebuild['active_layout'] = $layouts['active_layout'];
|
955 |
+
}
|
956 |
+
|
957 |
+
/* add new and overwrite active layout */
|
958 |
+
if ( isset( $layouts['_add_new_layout_'] ) && '' != $layouts['_add_new_layout_'] ) {
|
959 |
+
$rebuild['active_layout'] = ot_sanitize_layout_id( $layouts['_add_new_layout_'] );
|
960 |
+
$rebuild[$rebuild['active_layout']] = base64_encode( serialize( get_option( 'option_tree' ) ) );
|
961 |
+
}
|
962 |
+
|
963 |
+
$first_layout = '';
|
964 |
+
|
965 |
+
/* loop through layouts */
|
966 |
+
foreach( $layouts as $key => $layout ) {
|
967 |
+
|
968 |
+
/* skip over active layout key */
|
969 |
+
if ( $key == 'active_layout' )
|
970 |
+
continue;
|
971 |
+
|
972 |
+
/* check if the key exists then set value */
|
973 |
+
if ( isset( $option_tree_layouts[$key] ) ) {
|
974 |
+
$rebuild[$key] = $option_tree_layouts[$key];
|
975 |
+
if ( '' == $first_layout ) {
|
976 |
+
$first_layout = $key;
|
977 |
+
}
|
978 |
+
}
|
979 |
+
|
980 |
+
}
|
981 |
+
|
982 |
+
|
983 |
+
if ( ! isset( $rebuild[$rebuild['active_layout']] ) && '' != $first_layout ) {
|
984 |
+
$rebuild['active_layout'] = $first_layout;
|
985 |
+
}
|
986 |
+
|
987 |
+
}
|
988 |
+
|
989 |
+
/* default message */
|
990 |
+
$message = 'failed';
|
991 |
+
|
992 |
+
/* is array: save & show success message */
|
993 |
+
if ( count( $rebuild ) > 1 ) {
|
994 |
+
|
995 |
+
/* rebuild the theme options */
|
996 |
+
$rebuild_option_tree = unserialize( base64_decode( $rebuild[$rebuild['active_layout']] ) );
|
997 |
+
if ( is_array( $rebuild_option_tree ) ) {
|
998 |
+
update_option( 'option_tree', $rebuild_option_tree );
|
999 |
+
}
|
1000 |
+
|
1001 |
+
/* rebuild the layouts */
|
1002 |
+
update_option( 'option_tree_layouts', $rebuild );
|
1003 |
+
|
1004 |
+
/* change message */
|
1005 |
+
$message = 'success';
|
1006 |
+
|
1007 |
+
} else if ( count( $rebuild ) <= 1 ) {
|
1008 |
+
|
1009 |
+
/* delete layouts option */
|
1010 |
+
delete_option( 'option_tree_layouts' );
|
1011 |
+
|
1012 |
+
/* change message */
|
1013 |
+
$message = 'deleted';
|
1014 |
+
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/* redirect */
|
1018 |
+
if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ot-theme-options' ) {
|
1019 |
+
$query_args = add_query_arg( array( 'settings-updated' => 'layout' ), remove_query_arg( array( 'action', 'message' ), $_POST['_wp_http_referer'] ) );
|
1020 |
+
} else {
|
1021 |
+
$query_args = add_query_arg( array( 'action' => 'save-layouts', 'message' => $message ), $_POST['_wp_http_referer'] );
|
1022 |
+
}
|
1023 |
+
wp_redirect( $query_args );
|
1024 |
+
exit;
|
1025 |
+
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
return false;
|
1029 |
+
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
/**
|
1035 |
+
* Helper function to display alert messages.
|
1036 |
+
*
|
1037 |
+
* @param array Page array
|
1038 |
+
* @return mixed
|
1039 |
+
*
|
1040 |
+
* @access public
|
1041 |
+
* @since 2.0
|
1042 |
+
*/
|
1043 |
+
if ( ! function_exists( 'ot_alert_message' ) ) {
|
1044 |
+
|
1045 |
+
function ot_alert_message( $page = array() ) {
|
1046 |
+
|
1047 |
+
if ( empty( $page ) )
|
1048 |
+
return false;
|
1049 |
+
|
1050 |
+
$current_page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
|
1051 |
+
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
|
1052 |
+
$message = isset( $_REQUEST['message'] ) ? $_REQUEST['message'] : '';
|
1053 |
+
|
1054 |
+
/* theme options messages */
|
1055 |
+
if ( $current_page == 'ot-theme-options' ) {
|
1056 |
+
|
1057 |
+
if ( isset( $_POST['action'] ) && $_POST['action'] == 'reset' ) {
|
1058 |
+
|
1059 |
+
return '<div id="message" class="updated fade below-h2"><p>' . $page['reset_message'] . '</p></div>';
|
1060 |
+
|
1061 |
+
} else if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] == 'true' ) {
|
1062 |
+
|
1063 |
+
return '<div id="message" class="updated fade below-h2"><p>' . $page['updated_message'] . '</p></div>';
|
1064 |
+
|
1065 |
+
} else if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] == 'layout' ) {
|
1066 |
+
|
1067 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layout activated.', 'option-tree' ) . '</p></div>';
|
1068 |
+
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
/* settings messages */
|
1074 |
+
if ( $current_page == 'ot-settings' ) {
|
1075 |
+
|
1076 |
+
if ( $action == 'save-settings' ) {
|
1077 |
+
|
1078 |
+
if ( $message == 'success' ) {
|
1079 |
+
|
1080 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Settings updated.', 'option-tree' ) . '</p></div>';
|
1081 |
+
|
1082 |
+
} else if ( $message == 'failed' ) {
|
1083 |
+
|
1084 |
+
return '<div id="message" class="error fade below-h2"><p>' . __( 'Settings could not be saved.', 'option-tree' ) . '</p></div>';
|
1085 |
+
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
} else if ( $action == 'import-xml' || $action == 'import-settings' ) {
|
1089 |
+
|
1090 |
+
if ( $message == 'success' ) {
|
1091 |
+
|
1092 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Settings Imported.', 'option-tree' ) . '</p></div>';
|
1093 |
+
|
1094 |
+
} else if ( $message == 'failed' ) {
|
1095 |
+
|
1096 |
+
return '<div id="message" class="error fade below-h2"><p>' . __( 'Settings could not be imported.', 'option-tree' ) . '</p></div>';
|
1097 |
+
|
1098 |
+
}
|
1099 |
+
} else if ( $action == 'import-data' ) {
|
1100 |
+
|
1101 |
+
if ( $message == 'success' ) {
|
1102 |
+
|
1103 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Data Imported.', 'option-tree' ) . '</p></div>';
|
1104 |
+
|
1105 |
+
} else if ( $message == 'failed' ) {
|
1106 |
+
|
1107 |
+
return '<div id="message" class="error fade below-h2"><p>' . __( 'Data could not be imported.', 'option-tree' ) . '</p></div>';
|
1108 |
+
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
} else if ( $action == 'import-layouts' ) {
|
1112 |
+
|
1113 |
+
if ( $message == 'success' ) {
|
1114 |
+
|
1115 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layouts Imported.', 'option-tree' ) . '</p></div>';
|
1116 |
+
|
1117 |
+
} else if ( $message == 'failed' ) {
|
1118 |
+
|
1119 |
+
return '<div id="message" class="error fade below-h2"><p>' . __( 'Layouts could not be imported.', 'option-tree' ) . '</p></div>';
|
1120 |
+
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
} else if ( $action == 'save-layouts' ) {
|
1124 |
+
|
1125 |
+
if ( $message == 'success' ) {
|
1126 |
+
|
1127 |
+
return '<div id="message" class="updated fade below-h2"><p>' . __( 'Layouts Updated.', 'option-tree' ) . '</p></div>';
|
1128 |
+
|
1129 |
+
} else if ( $message == 'failed' ) {
|
1130 |
+
|
1131 |
+
return '<div id="message" class="error fade below-h2"><p>' . __( 'Layouts could not be updated.', 'option-tree' ) . '</p></div>';
|
1132 |
+
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
return false;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
/**
|
1145 |
+
* Setup the default option types.
|
1146 |
+
*
|
1147 |
+
* The returned option types are filterable so you can add your own.
|
1148 |
+
* This is not a task for a beginner as you'll need to add the function
|
1149 |
+
* that displays the option to the user and validate the saved data.
|
1150 |
+
*
|
1151 |
+
* @return array
|
1152 |
+
*
|
1153 |
+
* @access public
|
1154 |
+
* @since 2.0
|
1155 |
+
*/
|
1156 |
+
if ( ! function_exists( 'ot_option_types_array' ) ) {
|
1157 |
+
|
1158 |
+
function ot_option_types_array() {
|
1159 |
+
|
1160 |
+
return apply_filters( 'ot_option_types_array', array(
|
1161 |
+
'background' => 'Background',
|
1162 |
+
'category-checkbox' => 'Category Checkbox',
|
1163 |
+
'category-select' => 'Category Select',
|
1164 |
+
'checkbox' => 'Checkbox',
|
1165 |
+
'colorpicker' => 'Colorpicker',
|
1166 |
+
'css' => 'CSS',
|
1167 |
+
'custom-post-type-checkbox' => 'Custom Post Type Checkbox',
|
1168 |
+
'custom-post-type-select' => 'Custom Post Type Select',
|
1169 |
+
'list-item' => 'List Item',
|
1170 |
+
'measurement' => 'Measurement',
|
1171 |
+
'page-checkbox' => 'Page Checkbox',
|
1172 |
+
'page-select' => 'Page Select',
|
1173 |
+
'post-checkbox' => 'Post Checkbox',
|
1174 |
+
'post-select' => 'Post Select',
|
1175 |
+
'radio' => 'Radio',
|
1176 |
+
'radio-image' => 'Radio Image',
|
1177 |
+
'select' => 'Select',
|
1178 |
+
'slider' => 'Slider',
|
1179 |
+
'tag-checkbox' => 'Tag Checkbox',
|
1180 |
+
'tag-select' => 'Tag Select',
|
1181 |
+
'taxonomy-checkbox' => 'Taxonomy Checkbox',
|
1182 |
+
'taxonomy-select' => 'Taxonomy Select',
|
1183 |
+
'text' => 'Text',
|
1184 |
+
'textarea' => 'Textarea',
|
1185 |
+
'textarea-simple' => 'Textarea Simple',
|
1186 |
+
'textblock' => 'Textblock',
|
1187 |
+
'textblock-titled' => 'Textblock Titled',
|
1188 |
+
'typography' => 'Typography',
|
1189 |
+
'upload' => 'Upload'
|
1190 |
+
) );
|
1191 |
+
|
1192 |
+
}
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
/**
|
1196 |
+
* Map old option types for rebuilding XML and Table data.
|
1197 |
+
*
|
1198 |
+
* @param string $type The old option type
|
1199 |
+
* @return string The new option type
|
1200 |
+
*
|
1201 |
+
* @access public
|
1202 |
+
* @since 2.0
|
1203 |
+
*/
|
1204 |
+
if ( ! function_exists( 'ot_map_old_option_types' ) ) {
|
1205 |
+
|
1206 |
+
function ot_map_old_option_types( $type = '' ) {
|
1207 |
+
|
1208 |
+
if ( ! $type )
|
1209 |
+
return 'text';
|
1210 |
+
|
1211 |
+
$types = array(
|
1212 |
+
'background' => 'background',
|
1213 |
+
'category' => 'category-select',
|
1214 |
+
'categories' => 'category-checkbox',
|
1215 |
+
'checkbox' => 'checkbox',
|
1216 |
+
'colorpicker' => 'colorpicker',
|
1217 |
+
'css' => 'css',
|
1218 |
+
'custom_post' => 'custom-post-type-select',
|
1219 |
+
'custom_posts' => 'custom-post-type-checkbox',
|
1220 |
+
'input' => 'text',
|
1221 |
+
'image' => 'upload',
|
1222 |
+
'measurement' => 'measurement',
|
1223 |
+
'page' => 'page-select',
|
1224 |
+
'pages' => 'page-checkbox',
|
1225 |
+
'post' => 'post-select',
|
1226 |
+
'posts' => 'post-checkbox',
|
1227 |
+
'radio' => 'radio',
|
1228 |
+
'select' => 'select',
|
1229 |
+
'slider' => 'slider',
|
1230 |
+
'tag' => 'tag-select',
|
1231 |
+
'tags' => 'tag-checkbox',
|
1232 |
+
'textarea' => 'textarea',
|
1233 |
+
'textblock' => 'textblock',
|
1234 |
+
'typography' => 'typography',
|
1235 |
+
'upload' => 'upload'
|
1236 |
+
);
|
1237 |
+
|
1238 |
+
if ( isset( $types[$type] ) )
|
1239 |
+
return $types[$type];
|
1240 |
+
|
1241 |
+
return false;
|
1242 |
+
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
|
1247 |
+
/**
|
1248 |
+
* Recognized font styles
|
1249 |
+
*
|
1250 |
+
* Returns an array of all recognized font styles.
|
1251 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1252 |
+
*
|
1253 |
+
* @uses apply_filters()
|
1254 |
+
*
|
1255 |
+
* @return array
|
1256 |
+
*
|
1257 |
+
* @access public
|
1258 |
+
* @since 1.1.8
|
1259 |
+
* @updated 2.0
|
1260 |
+
*/
|
1261 |
+
if ( ! function_exists( 'ot_recognized_font_styles' ) ) {
|
1262 |
+
|
1263 |
+
function ot_recognized_font_styles( $field_id = '' ) {
|
1264 |
+
|
1265 |
+
return apply_filters( 'ot_recognized_font_styles', array(
|
1266 |
+
'normal' => 'Normal',
|
1267 |
+
'italic' => 'Italic',
|
1268 |
+
'oblique' => 'Oblique',
|
1269 |
+
'inherit' => 'Inherit'
|
1270 |
+
), $field_id );
|
1271 |
+
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
/**
|
1277 |
+
* Recognized font weights
|
1278 |
+
*
|
1279 |
+
* Returns an array of all recognized font weights.
|
1280 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1281 |
+
*
|
1282 |
+
* @uses apply_filters()
|
1283 |
+
*
|
1284 |
+
* @return array
|
1285 |
+
*
|
1286 |
+
* @access public
|
1287 |
+
* @since 1.1.8
|
1288 |
+
* @updated 2.0
|
1289 |
+
*/
|
1290 |
+
if ( ! function_exists( 'ot_recognized_font_weights' ) ) {
|
1291 |
+
|
1292 |
+
function ot_recognized_font_weights( $field_id = '' ) {
|
1293 |
+
|
1294 |
+
return apply_filters( 'ot_recognized_font_weights', array(
|
1295 |
+
'normal' => 'Normal',
|
1296 |
+
'bold' => 'Bold',
|
1297 |
+
'bolder' => 'Bolder',
|
1298 |
+
'lighter' => 'Lighter',
|
1299 |
+
'100' => '100',
|
1300 |
+
'200' => '200',
|
1301 |
+
'300' => '300',
|
1302 |
+
'400' => '400',
|
1303 |
+
'500' => '500',
|
1304 |
+
'600' => '600',
|
1305 |
+
'700' => '700',
|
1306 |
+
'800' => '800',
|
1307 |
+
'900' => '900',
|
1308 |
+
'inherit' => 'Inherit'
|
1309 |
+
), $field_id );
|
1310 |
+
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
/**
|
1316 |
+
* Recognized font variants
|
1317 |
+
*
|
1318 |
+
* Returns an array of all recognized font variants.
|
1319 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1320 |
+
*
|
1321 |
+
* @uses apply_filters()
|
1322 |
+
*
|
1323 |
+
* @return array
|
1324 |
+
*
|
1325 |
+
* @access public
|
1326 |
+
* @since 1.1.8
|
1327 |
+
* @updated 2.0
|
1328 |
+
*/
|
1329 |
+
if ( ! function_exists( 'ot_recognized_font_variants' ) ) {
|
1330 |
+
|
1331 |
+
function ot_recognized_font_variants( $field_id = '' ) {
|
1332 |
+
|
1333 |
+
return apply_filters( 'ot_recognized_font_variants', array(
|
1334 |
+
'normal' => 'Normal',
|
1335 |
+
'small-caps' => 'Small Caps',
|
1336 |
+
'inherit' => 'Inherit'
|
1337 |
+
), $field_id );
|
1338 |
+
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
/**
|
1344 |
+
* Recognized font families
|
1345 |
+
*
|
1346 |
+
* Returns an array of all recognized font families.
|
1347 |
+
* Keys are intended to be stored in the database
|
1348 |
+
* while values are ready for display in html.
|
1349 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1350 |
+
*
|
1351 |
+
* @uses apply_filters()
|
1352 |
+
*
|
1353 |
+
* @return array
|
1354 |
+
*
|
1355 |
+
* @access public
|
1356 |
+
* @since 1.1.8
|
1357 |
+
* @updated 2.0
|
1358 |
+
*/
|
1359 |
+
if ( ! function_exists( 'ot_recognized_font_families' ) ) {
|
1360 |
+
|
1361 |
+
function ot_recognized_font_families( $field_id = '' ) {
|
1362 |
+
|
1363 |
+
return apply_filters( 'ot_recognized_font_families', array(
|
1364 |
+
'arial' => 'Arial',
|
1365 |
+
'georgia' => 'Georgia',
|
1366 |
+
'helvetica' => 'Helvetica',
|
1367 |
+
'palatino' => 'Palatino',
|
1368 |
+
'tahoma' => 'Tahoma',
|
1369 |
+
'times' => '"Times New Roman", sans-serif',
|
1370 |
+
'trebuchet' => 'Trebuchet',
|
1371 |
+
'verdana' => 'Verdana'
|
1372 |
+
), $field_id );
|
1373 |
+
|
1374 |
+
}
|
1375 |
+
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
/**
|
1379 |
+
* Recognized background repeat
|
1380 |
+
*
|
1381 |
+
* Returns an array of all recognized background repeat values.
|
1382 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1383 |
+
*
|
1384 |
+
* @uses apply_filters()
|
1385 |
+
*
|
1386 |
+
* @return array
|
1387 |
+
*
|
1388 |
+
* @access public
|
1389 |
+
* @since 1.1.8
|
1390 |
+
* @updated 2.0
|
1391 |
+
*/
|
1392 |
+
if ( ! function_exists( 'ot_recognized_background_repeat' ) ) {
|
1393 |
+
|
1394 |
+
function ot_recognized_background_repeat( $field_id = '' ) {
|
1395 |
+
|
1396 |
+
return apply_filters( 'ot_recognized_background_repeat', array(
|
1397 |
+
'no-repeat' => 'No Repeat',
|
1398 |
+
'repeat' => 'Repeat All',
|
1399 |
+
'repeat-x' => 'Repeat Horizontally',
|
1400 |
+
'repeat-y' => 'Repeat Vertically',
|
1401 |
+
'inherit' => 'Inherit'
|
1402 |
+
), $field_id );
|
1403 |
+
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
/**
|
1409 |
+
* Recognized background attachment
|
1410 |
+
*
|
1411 |
+
* Returns an array of all recognized background attachment values.
|
1412 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1413 |
+
*
|
1414 |
+
* @uses apply_filters()
|
1415 |
+
*
|
1416 |
+
* @return array
|
1417 |
+
*
|
1418 |
+
* @access public
|
1419 |
+
* @since 1.1.8
|
1420 |
+
* @updated 2.0
|
1421 |
+
*/
|
1422 |
+
if ( ! function_exists( 'ot_recognized_background_attachment' ) ) {
|
1423 |
+
|
1424 |
+
function ot_recognized_background_attachment( $field_id = '' ) {
|
1425 |
+
|
1426 |
+
return apply_filters( 'ot_recognized_background_attachment', array(
|
1427 |
+
"fixed" => "Fixed",
|
1428 |
+
"scroll" => "Scroll",
|
1429 |
+
"inherit" => "Inherit"
|
1430 |
+
), $field_id );
|
1431 |
+
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
/**
|
1437 |
+
* Recognized background position
|
1438 |
+
*
|
1439 |
+
* Returns an array of all recognized background position values.
|
1440 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1441 |
+
*
|
1442 |
+
* @uses apply_filters()
|
1443 |
+
*
|
1444 |
+
* @return array
|
1445 |
+
*
|
1446 |
+
* @access public
|
1447 |
+
* @since 1.1.8
|
1448 |
+
* @updated 2.0
|
1449 |
+
*/
|
1450 |
+
if ( ! function_exists( 'ot_recognized_background_position' ) ) {
|
1451 |
+
|
1452 |
+
function ot_recognized_background_position( $field_id = '' ) {
|
1453 |
+
|
1454 |
+
return apply_filters( 'ot_recognized_background_position', array(
|
1455 |
+
"left top" => "Left Top",
|
1456 |
+
"left center" => "Left Center",
|
1457 |
+
"left bottom" => "Left Bottom",
|
1458 |
+
"center top" => "Center Top",
|
1459 |
+
"center center" => "Center Center",
|
1460 |
+
"center bottom" => "Center Bottom",
|
1461 |
+
"right top" => "Right Top",
|
1462 |
+
"right center" => "Right Center",
|
1463 |
+
"right bottom" => "Right Bottom"
|
1464 |
+
), $field_id );
|
1465 |
+
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
/**
|
1471 |
+
* Measurement Units
|
1472 |
+
*
|
1473 |
+
* Returns an array of all available unit types.
|
1474 |
+
* Renamed in version 2.0 to avoid name collisions.
|
1475 |
+
*
|
1476 |
+
* @uses apply_filters()
|
1477 |
+
*
|
1478 |
+
* @return array
|
1479 |
+
*
|
1480 |
+
* @access public
|
1481 |
+
* @since 1.1.8
|
1482 |
+
* @updated 2.0
|
1483 |
+
*/
|
1484 |
+
if ( ! function_exists( 'ot_measurement_unit_types' ) ) {
|
1485 |
+
|
1486 |
+
function ot_measurement_unit_types( $field_id = '' ) {
|
1487 |
+
|
1488 |
+
return apply_filters( 'ot_measurement_unit_types', array(
|
1489 |
+
'px' => 'px',
|
1490 |
+
'%' => '%',
|
1491 |
+
'em' => 'em',
|
1492 |
+
'pt' => 'pt'
|
1493 |
+
), $field_id );
|
1494 |
+
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
}
|
1498 |
+
|
1499 |
+
/**
|
1500 |
+
* Radio Images default array.
|
1501 |
+
*
|
1502 |
+
* Returns an array of all available radio images.
|
1503 |
+
* You can filter this function to change the images
|
1504 |
+
* on a per option basis.
|
1505 |
+
*
|
1506 |
+
* @uses apply_filters()
|
1507 |
+
*
|
1508 |
+
* @return array
|
1509 |
+
*
|
1510 |
+
* @access public
|
1511 |
+
* @since 2.0
|
1512 |
+
*/
|
1513 |
+
if ( ! function_exists( 'ot_radio_images' ) ) {
|
1514 |
+
|
1515 |
+
function ot_radio_images( $field_id = '' ) {
|
1516 |
+
|
1517 |
+
return apply_filters( 'ot_radio_images', array(
|
1518 |
+
array(
|
1519 |
+
'value' => 'left-sidebar',
|
1520 |
+
'label' => __( 'Left Sidebar', 'option-tree' ),
|
1521 |
+
'src' => OT_URL . 'assets/images/layout/left-sidebar.png'
|
1522 |
+
),
|
1523 |
+
array(
|
1524 |
+
'value' => 'right-sidebar',
|
1525 |
+
'label' => __( 'Right Sidebar', 'option-tree' ),
|
1526 |
+
'src' => OT_URL . 'assets/images/layout/right-sidebar.png'
|
1527 |
+
),
|
1528 |
+
array(
|
1529 |
+
'value' => 'full-width',
|
1530 |
+
'label' => __( 'Full Width (no sidebar)', 'option-tree' ),
|
1531 |
+
'src' => OT_URL . 'assets/images/layout/full-width.png'
|
1532 |
+
),
|
1533 |
+
array(
|
1534 |
+
'value' => 'dual-sidebar',
|
1535 |
+
'label' => __( 'Dual Sidebar', 'option-tree' ),
|
1536 |
+
'src' => OT_URL . 'assets/images/layout/dual-sidebar.png'
|
1537 |
+
),
|
1538 |
+
array(
|
1539 |
+
'value' => 'left-dual-sidebar',
|
1540 |
+
'label' => __( 'Left Dual Sidebar', 'option-tree' ),
|
1541 |
+
'src' => OT_URL . 'assets/images/layout/left-dual-sidebar.png'
|
1542 |
+
),
|
1543 |
+
array(
|
1544 |
+
'value' => 'right-dual-sidebar',
|
1545 |
+
'label' => __( 'Right Dual Sidebar', 'option-tree' ),
|
1546 |
+
'src' => OT_URL . 'assets/images/layout/right-dual-sidebar.png'
|
1547 |
+
)
|
1548 |
+
), $field_id );
|
1549 |
+
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
/**
|
1555 |
+
* Default List Item Settings array.
|
1556 |
+
*
|
1557 |
+
* Returns an array of the default list item settings.
|
1558 |
+
* You can filter this function to change the settings
|
1559 |
+
* on a per option basis.
|
1560 |
+
*
|
1561 |
+
* @uses apply_filters()
|
1562 |
+
*
|
1563 |
+
* @return array
|
1564 |
+
*
|
1565 |
+
* @access public
|
1566 |
+
* @since 2.0
|
1567 |
+
*/
|
1568 |
+
if ( ! function_exists( 'ot_list_item_settings' ) ) {
|
1569 |
+
|
1570 |
+
function ot_list_item_settings( $id ) {
|
1571 |
+
|
1572 |
+
$settings = apply_filters( 'ot_list_item_settings', array(
|
1573 |
+
array(
|
1574 |
+
'id' => 'image',
|
1575 |
+
'label' => __( 'Image', 'option-tree' ),
|
1576 |
+
'desc' => '',
|
1577 |
+
'std' => '',
|
1578 |
+
'type' => 'upload',
|
1579 |
+
'rows' => '',
|
1580 |
+
'class' => '',
|
1581 |
+
'post_type' => '',
|
1582 |
+
'choices' => array()
|
1583 |
+
),
|
1584 |
+
array(
|
1585 |
+
'id' => 'link',
|
1586 |
+
'label' => __( 'Link', 'option-tree' ),
|
1587 |
+
'desc' => '',
|
1588 |
+
'std' => '',
|
1589 |
+
'type' => 'text',
|
1590 |
+
'rows' => '',
|
1591 |
+
'class' => '',
|
1592 |
+
'post_type' => '',
|
1593 |
+
'choices' => array()
|
1594 |
+
),
|
1595 |
+
array(
|
1596 |
+
'id' => 'caption',
|
1597 |
+
'label' => __( 'Caption', 'option-tree' ),
|
1598 |
+
'desc' => '',
|
1599 |
+
'std' => '',
|
1600 |
+
'type' => 'textarea-simple',
|
1601 |
+
'rows' => 10,
|
1602 |
+
'class' => '',
|
1603 |
+
'post_type' => '',
|
1604 |
+
'choices' => array()
|
1605 |
+
)
|
1606 |
+
), $id );
|
1607 |
+
|
1608 |
+
return $settings;
|
1609 |
+
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
/**
|
1615 |
+
* Default Slider Settings array.
|
1616 |
+
*
|
1617 |
+
* Returns an array of the default slider settings.
|
1618 |
+
* You can filter this function to change the settings
|
1619 |
+
* on a per option basis.
|
1620 |
+
*
|
1621 |
+
* @uses apply_filters()
|
1622 |
+
*
|
1623 |
+
* @return array
|
1624 |
+
*
|
1625 |
+
* @access public
|
1626 |
+
* @since 2.0
|
1627 |
+
*/
|
1628 |
+
if ( ! function_exists( 'ot_slider_settings' ) ) {
|
1629 |
+
|
1630 |
+
function ot_slider_settings( $id ) {
|
1631 |
+
|
1632 |
+
$settings = apply_filters( 'image_slider_fields', array(
|
1633 |
+
array(
|
1634 |
+
'name' => 'image',
|
1635 |
+
'type' => 'image',
|
1636 |
+
'label' => __( 'Image', 'option-tree' ),
|
1637 |
+
'class' => ''
|
1638 |
+
),
|
1639 |
+
array(
|
1640 |
+
'name' => 'link',
|
1641 |
+
'type' => 'text',
|
1642 |
+
'label' => __( 'Link', 'option-tree' ),
|
1643 |
+
'class' => ''
|
1644 |
+
),
|
1645 |
+
array(
|
1646 |
+
'name' => 'description',
|
1647 |
+
'type' => 'textarea',
|
1648 |
+
'label' => __( 'Description', 'option-tree' ),
|
1649 |
+
'class' => ''
|
1650 |
+
)
|
1651 |
+
), $id );
|
1652 |
+
|
1653 |
+
/* fix the array keys, values, and just get it 2.0 ready */
|
1654 |
+
foreach( $settings as $_k => $setting ) {
|
1655 |
+
|
1656 |
+
foreach( $setting as $s_key => $s_value ) {
|
1657 |
+
|
1658 |
+
if ( 'name' == $s_key ) {
|
1659 |
+
|
1660 |
+
$settings[$_k]['id'] = $s_value;
|
1661 |
+
unset($settings[$_k]['name']);
|
1662 |
+
|
1663 |
+
} else if ( 'type' == $s_key ) {
|
1664 |
+
|
1665 |
+
if ( 'input' == $s_value ) {
|
1666 |
+
|
1667 |
+
$settings[$_k]['type'] = 'text';
|
1668 |
+
|
1669 |
+
} else if ( 'textarea' == $s_value ) {
|
1670 |
+
|
1671 |
+
$settings[$_k]['type'] = 'textarea-simple';
|
1672 |
+
|
1673 |
+
} else if ( 'image' == $s_value ) {
|
1674 |
+
|
1675 |
+
$settings[$_k]['type'] = 'upload';
|
1676 |
+
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
}
|
1684 |
+
|
1685 |
+
return $settings;
|
1686 |
+
|
1687 |
+
}
|
1688 |
+
|
1689 |
+
}
|
1690 |
+
|
1691 |
+
/**
|
1692 |
+
* Inserts CSS with field_id markers.
|
1693 |
+
*
|
1694 |
+
* Inserts CSS into a dynamic.css file, placing it between
|
1695 |
+
* BEGIN and END field_id markers. Replaces existing marked info,
|
1696 |
+
* but still retains surrounding data.
|
1697 |
+
*
|
1698 |
+
* @param string $field_id The CSS option field ID.
|
1699 |
+
* @param array $options The current option_tree array.
|
1700 |
+
* @return bool True on write success, false on failure.
|
1701 |
+
*
|
1702 |
+
* @access public
|
1703 |
+
* @since 1.1.8
|
1704 |
+
* @updated 2.0
|
1705 |
+
*/
|
1706 |
+
if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
|
1707 |
+
|
1708 |
+
function ot_insert_css_with_markers( $field_id = '', $insertion = '' ) {
|
1709 |
+
|
1710 |
+
/* missing $field_id or $insertion exit early */
|
1711 |
+
if ( '' == $field_id || '' == $insertion )
|
1712 |
+
return;
|
1713 |
+
|
1714 |
+
/* path to the dynamic.css file */
|
1715 |
+
$filepath = get_stylesheet_directory() . '/dynamic.css';
|
1716 |
+
|
1717 |
+
/* allow filter on path */
|
1718 |
+
$filepath = apply_filters( 'css_option_file_path', $filepath, $field_id );
|
1719 |
+
|
1720 |
+
/* grab a copy of the paths array */
|
1721 |
+
$ot_css_file_paths = get_option( 'ot_css_file_paths', array() );
|
1722 |
+
|
1723 |
+
/* set the path for this field */
|
1724 |
+
$ot_css_file_paths[$field_id] = $filepath;
|
1725 |
+
|
1726 |
+
/* update the paths */
|
1727 |
+
update_option( 'ot_css_file_paths', $ot_css_file_paths );
|
1728 |
+
|
1729 |
+
/* insert CSS into file */
|
1730 |
+
if ( file_exists( $filepath ) ) {
|
1731 |
+
|
1732 |
+
$insertion = ot_normalize_css( $insertion );
|
1733 |
+
$regex = "/{{([a-zA-Z0-9\_\-\#\|\=]+)}}/";
|
1734 |
+
$marker = $field_id;
|
1735 |
+
|
1736 |
+
/* Match custom CSS */
|
1737 |
+
preg_match_all( $regex, $insertion, $matches );
|
1738 |
+
|
1739 |
+
/* Loop through CSS */
|
1740 |
+
foreach( $matches[0] as $option ) {
|
1741 |
+
|
1742 |
+
$value = '';
|
1743 |
+
$option_id = str_replace( array( '{{', '}}' ), '', $option );
|
1744 |
+
$option_array = explode( '|', $option_id );
|
1745 |
+
|
1746 |
+
/* get value array by key or option_id */
|
1747 |
+
if ( is_array( $option_array ) && isset( $options[$option_array[0]] ) ) {
|
1748 |
+
|
1749 |
+
$value = $options[$option_array[0]];
|
1750 |
+
|
1751 |
+
} else if ( isset( $options[$option_id] ) ) {
|
1752 |
+
|
1753 |
+
$value = $options[$option_id];
|
1754 |
+
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
if ( is_array( $value ) ) {
|
1758 |
+
|
1759 |
+
if ( ! isset( $option_array[1] ) ) {
|
1760 |
+
|
1761 |
+
/* Measurement */
|
1762 |
+
if ( isset( $value[0] ) && isset( $value[1] ) ) {
|
1763 |
+
|
1764 |
+
/* set $value with measurement properties */
|
1765 |
+
$value = $value[0].$value[1];
|
1766 |
+
|
1767 |
+
/* typography */
|
1768 |
+
} else if ( ot_array_keys_exists( $value, array( 'font-color', 'font-family', 'font-style', 'font-variant', 'font-weight', 'font-size' ) ) ) {
|
1769 |
+
$font = array();
|
1770 |
+
|
1771 |
+
if ( ! empty( $value['font-color'] ) )
|
1772 |
+
$font[] = "color: " . $value['font-color'] . ";";
|
1773 |
+
|
1774 |
+
if ( ! empty( $value['font-family'] ) ) {
|
1775 |
+
foreach ( ot_recognized_font_families() as $key => $v ) {
|
1776 |
+
if ( $key == $value['font-family'] ) {
|
1777 |
+
$font[] = "font-family: " . $v . ";";
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
if ( ! empty( $value['font-size'] ) )
|
1783 |
+
$font[] = "font-size: " . $value['font-size'] . ";";
|
1784 |
+
|
1785 |
+
if ( ! empty( $value['font-style'] ) )
|
1786 |
+
$font[] = "font-style: " . $value['font-style'] . ";";
|
1787 |
+
|
1788 |
+
if ( ! empty( $value['font-variant'] ) )
|
1789 |
+
$font[] = "font-variant: " . $value['font-variant'] . ";";
|
1790 |
+
|
1791 |
+
if ( ! empty( $value['font-weight'] ) )
|
1792 |
+
$font[] = "font-weight: " . $value['font-weight'] . ";";
|
1793 |
+
|
1794 |
+
/* set $value with font properties or empty string */
|
1795 |
+
$value = ! empty( $font ) ? implode( "\n", $font ) : '';
|
1796 |
+
|
1797 |
+
/* background */
|
1798 |
+
} else if ( ot_array_keys_exists( $value, array( 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position' ) ) ) {
|
1799 |
+
$bg = array();
|
1800 |
+
|
1801 |
+
if ( ! empty( $value['background-color'] ) )
|
1802 |
+
$bg[] = $value['background-color'];
|
1803 |
+
|
1804 |
+
if ( ! empty( $value['background-image'] ) )
|
1805 |
+
$bg[] = 'url("' . $value['background-image'] . '")';
|
1806 |
+
|
1807 |
+
if ( ! empty( $value['background-repeat'] ) )
|
1808 |
+
$bg[] = $value['background-repeat'];
|
1809 |
+
|
1810 |
+
if ( ! empty( $value['background-attachment'] ) )
|
1811 |
+
$bg[] = $value['background-attachment'];
|
1812 |
+
|
1813 |
+
if ( ! empty( $value['background-position'] ) )
|
1814 |
+
$bg[] = $value['background-position'];
|
1815 |
+
|
1816 |
+
/* set $value with background properties or empty string */
|
1817 |
+
$value = ! empty( $bg ) ? 'background: ' . implode( " ", $bg ) . ';' : '';
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
} else {
|
1821 |
+
|
1822 |
+
$value = $value[$option_array[1]];
|
1823 |
+
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
/* insert CSS, even if the value is empty */
|
1829 |
+
$insertion = stripslashes( str_replace( $option, $value, $insertion ) );
|
1830 |
+
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
/* create array from the lines of code */
|
1834 |
+
$markerdata = explode( "\n", implode( '', file( $filepath ) ) );
|
1835 |
+
|
1836 |
+
/* can't write to the file return false */
|
1837 |
+
if ( ! $f = @fopen( $filepath, 'w' ) )
|
1838 |
+
return false;
|
1839 |
+
|
1840 |
+
$searching = true;
|
1841 |
+
$foundit = false;
|
1842 |
+
|
1843 |
+
/* has array of lines */
|
1844 |
+
if ( ! empty( $markerdata ) ) {
|
1845 |
+
|
1846 |
+
/* foreach line of code */
|
1847 |
+
foreach( $markerdata as $n => $markerline ) {
|
1848 |
+
|
1849 |
+
/* found begining of marker, set $searching to false */
|
1850 |
+
if ( $markerline == "/* BEGIN {$marker} */" )
|
1851 |
+
$searching = false;
|
1852 |
+
|
1853 |
+
/* keep rewrite each line of CSS */
|
1854 |
+
if ( $searching == true ) {
|
1855 |
+
if ( $n + 1 < count( $markerdata ) )
|
1856 |
+
fwrite( $f, "{$markerline}\n" );
|
1857 |
+
else
|
1858 |
+
fwrite( $f, "{$markerline}" );
|
1859 |
+
}
|
1860 |
+
|
1861 |
+
/* found end marker write code */
|
1862 |
+
if ( $markerline == "/* END {$marker} */" ) {
|
1863 |
+
fwrite( $f, "/* BEGIN {$marker} */\n" );
|
1864 |
+
fwrite( $f, "{$insertion}\n" );
|
1865 |
+
fwrite( $f, "/* END {$marker} */\n" );
|
1866 |
+
$searching = true;
|
1867 |
+
$foundit = true;
|
1868 |
+
}
|
1869 |
+
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
/* nothing inserted, write code. DO IT, DO IT! */
|
1875 |
+
if ( ! $foundit ) {
|
1876 |
+
fwrite( $f, "/* BEGIN {$marker} */\n" );
|
1877 |
+
fwrite( $f, "{$insertion}\n" );
|
1878 |
+
fwrite( $f, "/* END {$marker} */\n" );
|
1879 |
+
}
|
1880 |
+
|
1881 |
+
/* close file */
|
1882 |
+
fclose( $f );
|
1883 |
+
return true;
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
return false;
|
1887 |
+
|
1888 |
+
}
|
1889 |
+
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
/**
|
1893 |
+
* Remove old CSS.
|
1894 |
+
*
|
1895 |
+
* Removes CSS when the textarea is empty, but still retains surrounding styles.
|
1896 |
+
*
|
1897 |
+
* @param string $field_id The CSS option field ID.
|
1898 |
+
* @return bool True on write success, false on failure.
|
1899 |
+
*
|
1900 |
+
* @access public
|
1901 |
+
* @since 2.0
|
1902 |
+
*/
|
1903 |
+
if ( ! function_exists( 'ot_remove_old_css' ) ) {
|
1904 |
+
|
1905 |
+
function ot_remove_old_css( $field_id = '' ) {
|
1906 |
+
|
1907 |
+
/* missing $field_id string */
|
1908 |
+
if ( '' == $field_id )
|
1909 |
+
return false;
|
1910 |
+
|
1911 |
+
/* path to the dynamic.css file */
|
1912 |
+
$filepath = get_stylesheet_directory() . '/dynamic.css';
|
1913 |
+
|
1914 |
+
/* allow filter on path */
|
1915 |
+
$filepath = apply_filters( 'css_option_file_path', $filepath, $field_id );
|
1916 |
+
|
1917 |
+
/* remove CSS from file */
|
1918 |
+
if ( is_writeable( $filepath ) ) {
|
1919 |
+
|
1920 |
+
/* get each line in the file */
|
1921 |
+
$markerdata = explode( "\n", implode( '', file( $filepath ) ) );
|
1922 |
+
|
1923 |
+
/* can't write to the file return false */
|
1924 |
+
if ( ! $f = @fopen( $filepath, 'w' ) )
|
1925 |
+
return false;
|
1926 |
+
|
1927 |
+
$searching = true;
|
1928 |
+
|
1929 |
+
/* has array of lines */
|
1930 |
+
if ( ! empty( $markerdata ) ) {
|
1931 |
+
|
1932 |
+
/* foreach line of code */
|
1933 |
+
foreach ( $markerdata as $n => $markerline ) {
|
1934 |
+
|
1935 |
+
/* found begining of marker, set $searching to false */
|
1936 |
+
if ( $markerline == "/* BEGIN {$field_id} */" )
|
1937 |
+
$searching = false;
|
1938 |
+
|
1939 |
+
/* $searching is true, keep rewrite each line of CSS */
|
1940 |
+
if ( $searching == true ) {
|
1941 |
+
if ( $n + 1 < count( $markerdata ) )
|
1942 |
+
fwrite( $f, "{$markerline}\n" );
|
1943 |
+
else
|
1944 |
+
fwrite( $f, "{$markerline}" );
|
1945 |
+
}
|
1946 |
+
|
1947 |
+
/* found end marker delete old CSS */
|
1948 |
+
if ( $markerline == "/* END {$field_id} */" ) {
|
1949 |
+
fwrite( $f, "" );
|
1950 |
+
$searching = true;
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
}
|
1954 |
+
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
/* close file */
|
1958 |
+
fclose( $f );
|
1959 |
+
return true;
|
1960 |
+
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
return false;
|
1964 |
+
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
}
|
1968 |
+
|
1969 |
+
/**
|
1970 |
+
* Normalize CSS
|
1971 |
+
*
|
1972 |
+
* Normalize & Convert all line-endings to UNIX format.
|
1973 |
+
*
|
1974 |
+
* @param string $css
|
1975 |
+
* @return string
|
1976 |
+
*
|
1977 |
+
* @access public
|
1978 |
+
* @since 1.1.8
|
1979 |
+
* @updated 2.0
|
1980 |
+
*/
|
1981 |
+
if ( ! function_exists( 'ot_normalize_css' ) ) {
|
1982 |
+
|
1983 |
+
function ot_normalize_css( $css ) {
|
1984 |
+
|
1985 |
+
/* Normalize & Convert */
|
1986 |
+
$css = str_replace( "\r\n", "\n", $css );
|
1987 |
+
$css = str_replace( "\r", "\n", $css );
|
1988 |
+
|
1989 |
+
/* Don't allow out-of-control blank lines */
|
1990 |
+
$css = preg_replace( "/\n{2,}/", "\n\n", $css );
|
1991 |
+
|
1992 |
+
return $css;
|
1993 |
+
}
|
1994 |
+
|
1995 |
+
}
|
1996 |
+
|
1997 |
+
/**
|
1998 |
+
* Helper function to loop over the option types.
|
1999 |
+
*
|
2000 |
+
* @param array $type The current option type.
|
2001 |
+
*
|
2002 |
+
* @return string
|
2003 |
+
*
|
2004 |
+
* @access public
|
2005 |
+
* @since 2.0
|
2006 |
+
*/
|
2007 |
+
if ( ! function_exists( 'ot_loop_through_option_types' ) ) {
|
2008 |
+
|
2009 |
+
function ot_loop_through_option_types( $type = '', $child = false ) {
|
2010 |
+
|
2011 |
+
$content = '';
|
2012 |
+
$types = ot_option_types_array();
|
2013 |
+
|
2014 |
+
if ( $child )
|
2015 |
+
unset($types['list-item']);
|
2016 |
+
|
2017 |
+
foreach( $types as $key => $value )
|
2018 |
+
$content.= '<option value="' . $key . '" ' . selected( $type, $key, false ) . '>' . $value . '</option>';
|
2019 |
+
|
2020 |
+
return $content;
|
2021 |
+
|
2022 |
+
}
|
2023 |
+
|
2024 |
+
}
|
2025 |
+
|
2026 |
+
/**
|
2027 |
+
* Helper function to loop over choices.
|
2028 |
+
*
|
2029 |
+
* @param string $name The form element name.
|
2030 |
+
* @param array $choices The array of choices.
|
2031 |
+
*
|
2032 |
+
* @return string
|
2033 |
+
*
|
2034 |
+
* @access public
|
2035 |
+
* @since 2.0
|
2036 |
+
*/
|
2037 |
+
if ( ! function_exists( 'ot_loop_through_choices' ) ) {
|
2038 |
+
|
2039 |
+
function ot_loop_through_choices( $name, $choices = array() ) {
|
2040 |
+
|
2041 |
+
$content = '';
|
2042 |
+
|
2043 |
+
foreach( $choices as $key => $choice )
|
2044 |
+
$content.= '<li class="ui-state-default list-choice">' . ot_choices_view( $name, $key, $choice ) . '</li>';
|
2045 |
+
|
2046 |
+
return $content;
|
2047 |
+
}
|
2048 |
+
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
/**
|
2052 |
+
* Helper function to loop over sub settings.
|
2053 |
+
*
|
2054 |
+
* @param string $name The form element name.
|
2055 |
+
* @param array $settings The array of settings.
|
2056 |
+
*
|
2057 |
+
* @return string
|
2058 |
+
*
|
2059 |
+
* @access public
|
2060 |
+
* @since 2.0
|
2061 |
+
*/
|
2062 |
+
if ( ! function_exists( 'ot_loop_through_sub_settings' ) ) {
|
2063 |
+
|
2064 |
+
function ot_loop_through_sub_settings( $name, $settings = array() ) {
|
2065 |
+
|
2066 |
+
$content = '';
|
2067 |
+
|
2068 |
+
foreach( $settings as $key => $setting )
|
2069 |
+
$content.= '<li class="ui-state-default list-sub-setting">' . ot_settings_view( $name, $key, $setting ) . '</li>';
|
2070 |
+
|
2071 |
+
return $content;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
}
|
2075 |
+
|
2076 |
+
/**
|
2077 |
+
* Helper function to display sections.
|
2078 |
+
*
|
2079 |
+
* This function is used in AJAX to add a new section
|
2080 |
+
* and when section have already been added and saved.
|
2081 |
+
*
|
2082 |
+
* @param int $key The array key for the current element.
|
2083 |
+
* @param array An array of values for the current section.
|
2084 |
+
*
|
2085 |
+
* @return void
|
2086 |
+
*
|
2087 |
+
* @access public
|
2088 |
+
* @since 2.0
|
2089 |
+
*/
|
2090 |
+
if ( ! function_exists( 'ot_sections_view' ) ) {
|
2091 |
+
|
2092 |
+
function ot_sections_view( $name, $key, $section = array() ) {
|
2093 |
+
|
2094 |
+
return '
|
2095 |
+
<div class="option-tree-setting is-section">
|
2096 |
+
<div class="open">' . ( isset( $section['title'] ) ? esc_attr( $section['title'] ) : 'Section ' . ( $key + 1 ) ) . '</div>
|
2097 |
+
<div class="button-section">
|
2098 |
+
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'edit', 'option-tree' ) . '">
|
2099 |
+
<span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
|
2100 |
+
</a>
|
2101 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __( 'Delete', 'option-tree' ) . '">
|
2102 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2103 |
+
</a>
|
2104 |
+
</div>
|
2105 |
+
<div class="option-tree-setting-body">
|
2106 |
+
<div class="format-settings">
|
2107 |
+
<div class="format-setting type-text">
|
2108 |
+
<div class="description">' . __( '<strong>Section Title</strong>: Displayed as a menu item on the Theme Options page.', 'option-tree' ) . '</div>
|
2109 |
+
<div class="format-setting-inner">
|
2110 |
+
<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" />
|
2111 |
+
</div>
|
2112 |
+
</div>
|
2113 |
+
</div>
|
2114 |
+
<div class="format-settings">
|
2115 |
+
<div class="format-setting type-text">
|
2116 |
+
<div class="description">' . __( '<strong>Section ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
|
2117 |
+
<div class="format-setting-inner">
|
2118 |
+
<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" />
|
2119 |
+
</div>
|
2120 |
+
</div>
|
2121 |
+
</div>
|
2122 |
+
</div>
|
2123 |
+
</div>';
|
2124 |
+
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
/**
|
2130 |
+
* Helper function to display settings.
|
2131 |
+
*
|
2132 |
+
* This function is used in AJAX to add a new setting
|
2133 |
+
* and when settings have already been added and saved.
|
2134 |
+
*
|
2135 |
+
* @param int $key The array key for the current element.
|
2136 |
+
* @param array An array of values for the current section.
|
2137 |
+
*
|
2138 |
+
* @return void
|
2139 |
+
*
|
2140 |
+
* @access public
|
2141 |
+
* @since 2.0
|
2142 |
+
*/
|
2143 |
+
if ( ! function_exists( 'ot_settings_view' ) ) {
|
2144 |
+
|
2145 |
+
function ot_settings_view( $name, $key, $setting = array() ) {
|
2146 |
+
|
2147 |
+
$child = ( strpos( $name, '][settings]') !== false ) ? true : false;
|
2148 |
+
|
2149 |
+
return '
|
2150 |
+
<div class="option-tree-setting">
|
2151 |
+
<div class="open">' . ( isset( $setting['label'] ) ? esc_attr( $setting['label'] ) : 'Setting ' . ( $key + 1 ) ) . '</div>
|
2152 |
+
<div class="button-section">
|
2153 |
+
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
|
2154 |
+
<span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
|
2155 |
+
</a>
|
2156 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __( 'Delete', 'option-tree' ) . '">
|
2157 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2158 |
+
</a>
|
2159 |
+
</div>
|
2160 |
+
<div class="option-tree-setting-body">
|
2161 |
+
<div class="format-settings">
|
2162 |
+
<div class="format-setting type-text wide-desc">
|
2163 |
+
<div class="description">' . __( '<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree' ) . '</div>
|
2164 |
+
<div class="format-setting-inner">
|
2165 |
+
<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" />
|
2166 |
+
</div>
|
2167 |
+
</div>
|
2168 |
+
</div>
|
2169 |
+
<div class="format-settings">
|
2170 |
+
<div class="format-setting type-text wide-desc">
|
2171 |
+
<div class="description">' . __( '<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
|
2172 |
+
<div class="format-setting-inner">
|
2173 |
+
<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" />
|
2174 |
+
</div>
|
2175 |
+
</div>
|
2176 |
+
</div>
|
2177 |
+
<div class="format-settings">
|
2178 |
+
<div class="format-setting type-select wide-desc">
|
2179 |
+
<div class="description">' . __( '<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree' ) . '</div>
|
2180 |
+
<div class="format-setting-inner">
|
2181 |
+
<select name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][type]" value="' . ( isset( $setting['type'] ) ? esc_attr( $setting['type'] ) : '' ) . '" class="option-tree-ui-select">
|
2182 |
+
' . ( isset( $setting['type'] ) ? ot_loop_through_option_types( $setting['type'], $child ) : ot_loop_through_option_types( '', $child ) ) . '
|
2183 |
+
|
2184 |
+
</select>
|
2185 |
+
</div>
|
2186 |
+
</div>
|
2187 |
+
</div>
|
2188 |
+
<div class="format-settings">
|
2189 |
+
<div class="format-setting type-textarea wide-desc">
|
2190 |
+
<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>
|
2191 |
+
<div class="format-setting-inner">
|
2192 |
+
<textarea class="textarea" rows="10" cols="40" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][desc]">' . ( isset( $setting['desc'] ) ? esc_html( $setting['desc'] ) : '' ) . '</textarea>
|
2193 |
+
</div>
|
2194 |
+
</div>
|
2195 |
+
</div>
|
2196 |
+
<div class="format-settings">
|
2197 |
+
<div class="format-setting type-textblock wide-desc">
|
2198 |
+
<div class="description">' . __( '<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree' ) . '</div>
|
2199 |
+
<div class="format-setting-inner">
|
2200 |
+
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . ']">
|
2201 |
+
' . ( isset( $setting['choices'] ) ? ot_loop_through_choices( $name . '[' . $key . ']', $setting['choices'] ) : '' ) . '
|
2202 |
+
</ul>
|
2203 |
+
<a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button hug-left">' . __( 'Add Choice', 'option-tree' ) . '</a>
|
2204 |
+
</div>
|
2205 |
+
</div>
|
2206 |
+
</div>
|
2207 |
+
<div class="format-settings">
|
2208 |
+
<div class="format-setting type-textblock wide-desc">
|
2209 |
+
<div class="description">' . __( '<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree' ) . '</div>
|
2210 |
+
<div class="format-setting-inner">
|
2211 |
+
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . ']">
|
2212 |
+
' . ( isset( $setting['settings'] ) ? ot_loop_through_sub_settings( $name . '[' . $key . '][settings]', $setting['settings'] ) : '' ) . '
|
2213 |
+
</ul>
|
2214 |
+
<a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button hug-left">' . __( 'Add Setting', 'option-tree' ) . '</a>
|
2215 |
+
</div>
|
2216 |
+
</div>
|
2217 |
+
</div>
|
2218 |
+
<div class="format-settings">
|
2219 |
+
<div class="format-setting type-text wide-desc">
|
2220 |
+
<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>
|
2221 |
+
<div class="format-setting-inner">
|
2222 |
+
<input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][std]" value="' . ( isset( $setting['std'] ) ? esc_attr( $setting['std'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
|
2223 |
+
</div>
|
2224 |
+
</div>
|
2225 |
+
</div>
|
2226 |
+
<div class="format-settings">
|
2227 |
+
<div class="format-setting type-text wide-desc">
|
2228 |
+
<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>
|
2229 |
+
<div class="format-setting-inner">
|
2230 |
+
<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" />
|
2231 |
+
</div>
|
2232 |
+
</div>
|
2233 |
+
</div>
|
2234 |
+
<div class="format-settings">
|
2235 |
+
<div class="format-setting type-text wide-desc">
|
2236 |
+
<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>
|
2237 |
+
<div class="format-setting-inner">
|
2238 |
+
<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" />
|
2239 |
+
</div>
|
2240 |
+
</div>
|
2241 |
+
</div>
|
2242 |
+
<div class="format-settings">
|
2243 |
+
<div class="format-setting type-text wide-desc">
|
2244 |
+
<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>
|
2245 |
+
<div class="format-setting-inner">
|
2246 |
+
<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" />
|
2247 |
+
</div>
|
2248 |
+
</div>
|
2249 |
+
</div>
|
2250 |
+
<div class="format-settings">
|
2251 |
+
<div class="format-setting type-text wide-desc">
|
2252 |
+
<div class="description">' . __( '<strong>CSS Class</strong>: Add and optional class to this option type.', 'option-tree' ) . '</div>
|
2253 |
+
<div class="format-setting-inner">
|
2254 |
+
<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" />
|
2255 |
+
</div>
|
2256 |
+
</div>
|
2257 |
+
</div>
|
2258 |
+
</div>
|
2259 |
+
</div>
|
2260 |
+
' . ( ! $child ? '<input type="hidden" class="hidden-section" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][section]" value="' . ( isset( $setting['section'] ) ? esc_attr( $setting['section'] ) : '' ) . '" />' : '' );
|
2261 |
+
|
2262 |
+
}
|
2263 |
+
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
/**
|
2267 |
+
* Helper function to display setting choices.
|
2268 |
+
*
|
2269 |
+
* This function is used in AJAX to add a new choice
|
2270 |
+
* and when choices have already been added and saved.
|
2271 |
+
*
|
2272 |
+
* @param string $name The form element name.
|
2273 |
+
* @param array $key The array key for the current element.
|
2274 |
+
* @param array An array of values for the current choice.
|
2275 |
+
*
|
2276 |
+
* @return void
|
2277 |
+
*
|
2278 |
+
* @access public
|
2279 |
+
* @since 2.0
|
2280 |
+
*/
|
2281 |
+
if ( ! function_exists( 'ot_choices_view' ) ) {
|
2282 |
+
|
2283 |
+
function ot_choices_view( $name, $key, $choice = array() ) {
|
2284 |
+
|
2285 |
+
return '
|
2286 |
+
<div class="option-tree-setting">
|
2287 |
+
<div class="open">' . ( isset( $choice['label'] ) ? esc_attr( $choice['label'] ) : 'Choice ' . ( $key + 1 ) ) . '</div>
|
2288 |
+
<div class="button-section">
|
2289 |
+
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
|
2290 |
+
<span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
|
2291 |
+
</a>
|
2292 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __( 'Delete', 'option-tree' ) . '">
|
2293 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2294 |
+
</a>
|
2295 |
+
</div>
|
2296 |
+
<div class="option-tree-setting-body">
|
2297 |
+
<div class="format-settings">
|
2298 |
+
<div class="format-setting-label">
|
2299 |
+
<h5>' . __( 'Label', 'option-tree' ) . '</h5>
|
2300 |
+
</div>
|
2301 |
+
<div class="format-setting type-text wide-desc">
|
2302 |
+
<div class="format-setting-inner">
|
2303 |
+
<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" />
|
2304 |
+
</div>
|
2305 |
+
</div>
|
2306 |
+
</div>
|
2307 |
+
<div class="format-settings">
|
2308 |
+
<div class="format-setting-label">
|
2309 |
+
<h5>' . __( 'Value', 'option-tree' ) . '</h5>
|
2310 |
+
</div>
|
2311 |
+
<div class="format-setting type-text wide-desc">
|
2312 |
+
<div class="format-setting-inner">
|
2313 |
+
<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" />
|
2314 |
+
</div>
|
2315 |
+
</div>
|
2316 |
+
</div>
|
2317 |
+
<div class="format-settings">
|
2318 |
+
<div class="format-setting-label">
|
2319 |
+
<h5>' . __( 'Image Source (Radio Image only)', 'option-tree' ) . '</h5>
|
2320 |
+
</div>
|
2321 |
+
<div class="format-setting type-text wide-desc">
|
2322 |
+
<div class="format-setting-inner">
|
2323 |
+
<input type="text" name="' . esc_attr( $name ) . '[choices][' . esc_attr( $key ) . '][src]" value="' . ( isset( $choice['src'] ) ? esc_url( $choice['src'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
|
2324 |
+
</div>
|
2325 |
+
</div>
|
2326 |
+
</div>
|
2327 |
+
</div>';
|
2328 |
+
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
}
|
2332 |
+
|
2333 |
+
/**
|
2334 |
+
* Helper function to display sections.
|
2335 |
+
*
|
2336 |
+
* This function is used in AJAX to add a new section
|
2337 |
+
* and when section have already been added and saved.
|
2338 |
+
*
|
2339 |
+
* @param int $key The array key for the current element.
|
2340 |
+
* @param array An array of values for the current section.
|
2341 |
+
*
|
2342 |
+
* @return void
|
2343 |
+
*
|
2344 |
+
* @access public
|
2345 |
+
* @since 2.0
|
2346 |
+
*/
|
2347 |
+
if ( ! function_exists( 'ot_contextual_help_view' ) ) {
|
2348 |
+
|
2349 |
+
function ot_contextual_help_view( $name, $key, $content = array() ) {
|
2350 |
+
|
2351 |
+
return '
|
2352 |
+
<div class="option-tree-setting">
|
2353 |
+
<div class="open">' . ( isset( $content['title'] ) ? esc_attr( $content['title'] ) : 'Content ' . ( $key + 1 ) ) . '</div>
|
2354 |
+
<div class="button-section">
|
2355 |
+
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
|
2356 |
+
<span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
|
2357 |
+
</a>
|
2358 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __( 'Delete', 'option-tree' ) . '">
|
2359 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2360 |
+
</a>
|
2361 |
+
</div>
|
2362 |
+
<div class="option-tree-setting-body">
|
2363 |
+
<div class="format-settings">
|
2364 |
+
<div class="format-setting type-text no-desc">
|
2365 |
+
<div class="description">' . __( '<strong>Title</strong>: Displayed as a contextual help menu item on the Theme Options page.', 'option-tree' ) . '</div>
|
2366 |
+
<div class="format-setting-inner">
|
2367 |
+
<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" />
|
2368 |
+
</div>
|
2369 |
+
</div>
|
2370 |
+
</div>
|
2371 |
+
<div class="format-settings">
|
2372 |
+
<div class="format-setting type-text no-desc">
|
2373 |
+
<div class="description">' . __( '<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree' ) . '</div>
|
2374 |
+
<div class="format-setting-inner">
|
2375 |
+
<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" />
|
2376 |
+
</div>
|
2377 |
+
</div>
|
2378 |
+
</div>
|
2379 |
+
<div class="format-settings">
|
2380 |
+
<div class="format-setting type-textarea no-desc">
|
2381 |
+
<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>
|
2382 |
+
<div class="format-setting-inner">
|
2383 |
+
<textarea class="textarea" rows="15" cols="40" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][content]">' . ( isset( $content['content'] ) ? esc_html( $content['content'] ) : '' ) . '</textarea>
|
2384 |
+
</div>
|
2385 |
+
</div>
|
2386 |
+
</div>
|
2387 |
+
</div>
|
2388 |
+
</div>';
|
2389 |
+
|
2390 |
+
}
|
2391 |
+
|
2392 |
+
}
|
2393 |
+
|
2394 |
+
/**
|
2395 |
+
* Helper function to display sections.
|
2396 |
+
*
|
2397 |
+
* @param string $key
|
2398 |
+
* @param string $data
|
2399 |
+
* @param string $active_layout
|
2400 |
+
*
|
2401 |
+
* @return void
|
2402 |
+
*
|
2403 |
+
* @access public
|
2404 |
+
* @since 2.0
|
2405 |
+
*/
|
2406 |
+
if ( ! function_exists( 'ot_layouts_view' ) ) {
|
2407 |
+
|
2408 |
+
function ot_layout_view( $key, $data, $active_layout ) {
|
2409 |
+
|
2410 |
+
return '
|
2411 |
+
<div class="option-tree-setting">
|
2412 |
+
<div class="open">' . ( isset( $key ) ? esc_attr( $key ) : __( 'Layout', 'option-tree' ) ) . '</div>
|
2413 |
+
<div class="button-section">
|
2414 |
+
<a href="javascript:void(0);" class="option-tree-layout-activate option-tree-ui-button left-item' . ( $active_layout == $key ? ' active' : '' ) . '" title="' . __( 'Activate', 'option-tree' ) . '">
|
2415 |
+
<span class="icon check">' . __( 'Activate', 'option-tree' ) . '</span>
|
2416 |
+
</a>
|
2417 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="'. __( 'Delete', 'option-tree' ) . '">
|
2418 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2419 |
+
</a>
|
2420 |
+
</div>
|
2421 |
+
<input type="hidden" name="option_tree_layouts[' . esc_attr( $key ) . ']" value="' . ( isset( $data ) ? $data : '' ) . '" />
|
2422 |
+
</div>';
|
2423 |
+
|
2424 |
+
}
|
2425 |
+
|
2426 |
+
}
|
2427 |
+
|
2428 |
+
/**
|
2429 |
+
* Helper function to display list items.
|
2430 |
+
*
|
2431 |
+
* This function is used in AJAX to add a new list items
|
2432 |
+
* and when they have already been added and saved.
|
2433 |
+
*
|
2434 |
+
* @param string $name The form field name.
|
2435 |
+
* @param int $key The array key for the current element.
|
2436 |
+
* @param array An array of values for the current list item.
|
2437 |
+
*
|
2438 |
+
* @return void
|
2439 |
+
*
|
2440 |
+
* @access public
|
2441 |
+
* @since 2.0
|
2442 |
+
*/
|
2443 |
+
if ( ! function_exists( 'ot_list_item_view' ) ) {
|
2444 |
+
|
2445 |
+
function ot_list_item_view( $name, $key, $list_item = array(), $post_id = 0, $get_option = '', $settings = array(), $type = '' ) {
|
2446 |
+
|
2447 |
+
/* required title setting */
|
2448 |
+
$required_setting = array(
|
2449 |
+
array(
|
2450 |
+
'id' => 'title',
|
2451 |
+
'label' => __( 'Title', 'option-tree' ),
|
2452 |
+
'desc' => '',
|
2453 |
+
'std' => '',
|
2454 |
+
'type' => 'text',
|
2455 |
+
'rows' => '',
|
2456 |
+
'class' => 'option-tree-setting-title',
|
2457 |
+
'post_type' => '',
|
2458 |
+
'choices' => array()
|
2459 |
+
)
|
2460 |
+
);
|
2461 |
+
|
2462 |
+
/* load the old filterable slider settings */
|
2463 |
+
if ( 'slider' == $type ) {
|
2464 |
+
|
2465 |
+
$settings = ot_slider_settings( $name );
|
2466 |
+
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
/* if no settings array load the filterable list item settings */
|
2470 |
+
if ( empty( $settings ) ) {
|
2471 |
+
|
2472 |
+
$settings = ot_list_item_settings( $name );
|
2473 |
+
|
2474 |
+
}
|
2475 |
+
|
2476 |
+
/* merge the two settings array */
|
2477 |
+
$settings = array_merge( $required_setting, $settings );
|
2478 |
+
|
2479 |
+
echo '
|
2480 |
+
<div class="option-tree-setting">
|
2481 |
+
<div class="open">' . ( isset( $list_item['title'] ) ? esc_attr( $list_item['title'] ) : 'Item ' . ( $key + 1 ) ) . '</div>
|
2482 |
+
<div class="button-section">
|
2483 |
+
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __( 'Edit', 'option-tree' ) . '">
|
2484 |
+
<span class="icon pencil">' . __( 'Edit', 'option-tree' ) . '</span>
|
2485 |
+
</a>
|
2486 |
+
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __( 'Delete', 'option-tree' ) . '">
|
2487 |
+
<span class="icon trash-can">' . __( 'Delete', 'option-tree' ) . '</span>
|
2488 |
+
</a>
|
2489 |
+
</div>
|
2490 |
+
<div class="option-tree-setting-body">';
|
2491 |
+
|
2492 |
+
foreach( $settings as $field ) {
|
2493 |
+
|
2494 |
+
/* set default to standard value */
|
2495 |
+
if ( ! isset( $list_item[$field['id']] ) && isset( $field['std'] ) ) {
|
2496 |
+
$list_item[$field['id']] = trim( $field['std'] );
|
2497 |
+
}
|
2498 |
+
|
2499 |
+
/* make life easier */
|
2500 |
+
$_field_name = $get_option ? $get_option . '[' . $name . ']' : $name;
|
2501 |
+
|
2502 |
+
/* build the arguments array */
|
2503 |
+
$_args = array(
|
2504 |
+
'type' => $field['type'],
|
2505 |
+
'field_id' => $name . '_' . $field['id'] . '_' . $key,
|
2506 |
+
'field_name' => $_field_name . '[' . $key . '][' . $field['id'] . ']',
|
2507 |
+
'field_value' => isset( $list_item[$field['id']] ) ? $list_item[$field['id']] : '',
|
2508 |
+
'field_desc' => isset( $field['desc'] ) ? $field['desc'] : '',
|
2509 |
+
'field_std' => isset( $field['std'] ) ? $field['std'] : '',
|
2510 |
+
'field_rows' => isset( $rows ) ? $rows : 10,
|
2511 |
+
'field_post_type' => isset( $field['post_type'] ) && ! empty( $field['post_type'] ) ? $field['post_type'] : 'post',
|
2512 |
+
'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
|
2513 |
+
'field_class' => isset( $field['class'] ) ? $field['class'] : '',
|
2514 |
+
'field_choices' => isset( $field['choices'] ) && ! empty( $field['choices'] ) ? $field['choices'] : array(),
|
2515 |
+
'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
|
2516 |
+
'post_id' => $post_id,
|
2517 |
+
'get_option' => $get_option
|
2518 |
+
);
|
2519 |
+
|
2520 |
+
/* option label */
|
2521 |
+
echo '<div class="format-settings">';
|
2522 |
+
|
2523 |
+
echo '<div class="format-setting-label">';
|
2524 |
+
echo '<h3 class="label">' . esc_attr( $field['label'] ) . '</h3>';
|
2525 |
+
echo '</div>';
|
2526 |
+
|
2527 |
+
/* only allow simple textarea inside a list-item due to known DOM issues with wp_editor() */
|
2528 |
+
if ( $_args['type'] == 'textarea' )
|
2529 |
+
$_args['type'] = 'textarea-simple';
|
2530 |
+
|
2531 |
+
/* option body, list-item is not allowed inside another list-item */
|
2532 |
+
if ( $_args['type'] !== 'list-item' && $_args['type'] !== 'slider' ) {
|
2533 |
+
echo ot_display_by_type( $_args );
|
2534 |
+
}
|
2535 |
+
|
2536 |
+
echo '</div>';
|
2537 |
+
|
2538 |
+
}
|
2539 |
+
|
2540 |
+
echo
|
2541 |
+
'</div>
|
2542 |
+
</div>';
|
2543 |
+
|
2544 |
+
}
|
2545 |
+
|
2546 |
+
}
|
2547 |
+
|
2548 |
+
/**
|
2549 |
+
* Helper function to display Theme Options layouts form.
|
2550 |
+
*
|
2551 |
+
* @return string
|
2552 |
+
*
|
2553 |
+
* @access public
|
2554 |
+
* @since 2.0
|
2555 |
+
*/
|
2556 |
+
if ( ! function_exists( 'ot_theme_options_layouts_form' ) ) {
|
2557 |
+
|
2558 |
+
function ot_theme_options_layouts_form() {
|
2559 |
+
|
2560 |
+
echo '<form method="post" id="option-tree-options-layouts-form">';
|
2561 |
+
|
2562 |
+
/* form nonce */
|
2563 |
+
wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' );
|
2564 |
+
|
2565 |
+
/* get the saved layouts */
|
2566 |
+
$layouts = get_option( 'option_tree_layouts' );
|
2567 |
+
|
2568 |
+
/* set active layout */
|
2569 |
+
$active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : '';
|
2570 |
+
|
2571 |
+
/* new layout wrapper */
|
2572 |
+
echo '<div class="option-tree-save-layout">';
|
2573 |
+
|
2574 |
+
/* add new layout */
|
2575 |
+
echo '<input type="text" name="option_tree_layouts[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
|
2576 |
+
|
2577 |
+
echo '<button type="submit" class="option-tree-ui-button blue light save-layout" title="' . __( 'New Layout', 'option-tree' ) . '">' . __( 'New Layout', 'option-tree' ) . '</button>';
|
2578 |
+
|
2579 |
+
echo '</div>';
|
2580 |
+
|
2581 |
+
if ( is_array( $layouts ) && count( $layouts ) > 1 ) {
|
2582 |
+
|
2583 |
+
$active_layout = esc_attr( $layouts['active_layout'] );
|
2584 |
+
|
2585 |
+
echo '<input type="hidden" id="the_current_layout" value="' . $active_layout . '" />';
|
2586 |
+
|
2587 |
+
echo '<select name="option_tree_layouts[active_layout]" class="option-tree-ui-select option-tree-active-layout">';
|
2588 |
+
|
2589 |
+
foreach( $layouts as $key => $data ) {
|
2590 |
+
|
2591 |
+
if ( $key == 'active_layout' )
|
2592 |
+
continue;
|
2593 |
+
|
2594 |
+
echo '<option' . selected( $key, $active_layout, false ) . ' value="' . esc_attr( $key ) . '">' . esc_attr( $key ) . '</option>';
|
2595 |
+
}
|
2596 |
+
|
2597 |
+
echo '</select>';
|
2598 |
+
|
2599 |
+
foreach( $layouts as $key => $data ) {
|
2600 |
+
|
2601 |
+
if ( $key == 'active_layout' )
|
2602 |
+
continue;
|
2603 |
+
|
2604 |
+
echo '<input type="hidden" name="option_tree_layouts[' . $key . ']" value="' . ( isset( $data ) ? $data : '' ) . '" />';
|
2605 |
+
|
2606 |
+
}
|
2607 |
+
|
2608 |
+
}
|
2609 |
+
|
2610 |
+
echo '</form>';
|
2611 |
+
|
2612 |
+
}
|
2613 |
+
|
2614 |
+
}
|
2615 |
+
|
2616 |
+
/**
|
2617 |
+
* Helper function to validate option ID's
|
2618 |
+
*
|
2619 |
+
* @param string $input The string to sanitize.
|
2620 |
+
* @return string
|
2621 |
+
*
|
2622 |
+
* @access public
|
2623 |
+
* @since 2.0
|
2624 |
+
*/
|
2625 |
+
if ( ! function_exists( 'ot_sanitize_option_id' ) ) {
|
2626 |
+
|
2627 |
+
function ot_sanitize_option_id( $input ) {
|
2628 |
+
|
2629 |
+
return preg_replace( '/[^a-z0-9]/', '_', trim( strtolower( $input ) ) );
|
2630 |
+
|
2631 |
+
}
|
2632 |
+
|
2633 |
+
}
|
2634 |
+
|
2635 |
+
/**
|
2636 |
+
* Helper function to validate layout ID's
|
2637 |
+
*
|
2638 |
+
* @param string $input The string to sanitize.
|
2639 |
+
* @return string
|
2640 |
+
*
|
2641 |
+
* @access public
|
2642 |
+
* @since 2.0
|
2643 |
+
*/
|
2644 |
+
if ( ! function_exists( 'ot_sanitize_layout_id' ) ) {
|
2645 |
+
|
2646 |
+
function ot_sanitize_layout_id( $input ) {
|
2647 |
+
|
2648 |
+
return preg_replace( '/[^a-z0-9]/', '-', trim( strtolower( $input ) ) );
|
2649 |
+
|
2650 |
+
}
|
2651 |
+
|
2652 |
+
}
|
2653 |
+
|
2654 |
+
/**
|
2655 |
+
* Convert choices array to string
|
2656 |
+
*
|
2657 |
+
* @return string
|
2658 |
+
*
|
2659 |
+
* @access public
|
2660 |
+
* @since 2.0
|
2661 |
+
*/
|
2662 |
+
if ( ! function_exists( 'ot_convert_array_to_string' ) ) {
|
2663 |
+
|
2664 |
+
function ot_convert_array_to_string( $input ) {
|
2665 |
+
|
2666 |
+
if ( is_array( $input ) ) {
|
2667 |
+
|
2668 |
+
foreach( $input as $k => $choice ) {
|
2669 |
+
$choices[$k] = $choice['value'] . '|' . $choice['label'];
|
2670 |
+
|
2671 |
+
if ( isset( $choice['src'] ) )
|
2672 |
+
$choices[$k].= '|' . $choice['src'];
|
2673 |
+
|
2674 |
+
}
|
2675 |
+
|
2676 |
+
return implode( ',', $choices );
|
2677 |
+
}
|
2678 |
+
|
2679 |
+
return false;
|
2680 |
+
}
|
2681 |
+
}
|
2682 |
+
|
2683 |
+
/**
|
2684 |
+
* Convert choices string to array
|
2685 |
+
*
|
2686 |
+
* @return array
|
2687 |
+
*
|
2688 |
+
* @access public
|
2689 |
+
* @since 2.0
|
2690 |
+
*/
|
2691 |
+
if ( ! function_exists( 'ot_convert_string_to_array' ) ) {
|
2692 |
+
|
2693 |
+
function ot_convert_string_to_array( $input ) {
|
2694 |
+
|
2695 |
+
if ( '' !== $input ) {
|
2696 |
+
|
2697 |
+
/* empty choices array */
|
2698 |
+
$choices = array();
|
2699 |
+
|
2700 |
+
/* exlode the string into an array */
|
2701 |
+
foreach( explode( ',', $input ) as $k => $choice ) {
|
2702 |
+
|
2703 |
+
/* if ":" is splitting the string go deeper */
|
2704 |
+
if ( preg_match( '/\|/', $choice ) ) {
|
2705 |
+
$split = explode( '|', $choice );
|
2706 |
+
$choices[$k]['value'] = trim( $split[0] );
|
2707 |
+
$choices[$k]['label'] = trim( $split[1] );
|
2708 |
+
|
2709 |
+
/* if radio image there are three values */
|
2710 |
+
if ( isset( $split[2] ) )
|
2711 |
+
$choices[$k]['src'] = trim( $split[2] );
|
2712 |
+
|
2713 |
+
} else {
|
2714 |
+
$choices[$k]['value'] = $choice;
|
2715 |
+
$choices[$k]['label'] = $choice;
|
2716 |
+
}
|
2717 |
+
|
2718 |
+
}
|
2719 |
+
|
2720 |
+
/* return a formated choices array */
|
2721 |
+
return $choices;
|
2722 |
+
|
2723 |
+
}
|
2724 |
+
|
2725 |
+
return false;
|
2726 |
+
|
2727 |
+
}
|
2728 |
+
}
|
2729 |
+
|
2730 |
+
/**
|
2731 |
+
* Helper function - strpos() with arrays.
|
2732 |
+
*
|
2733 |
+
* @param string $haystack
|
2734 |
+
* @param array $needles
|
2735 |
+
* @return bool
|
2736 |
+
*
|
2737 |
+
* @access public
|
2738 |
+
* @since 2.0
|
2739 |
+
*/
|
2740 |
+
if ( ! function_exists( 'ot_strpos_array' ) ) {
|
2741 |
+
|
2742 |
+
function ot_strpos_array( $haystack, $needles = array() ) {
|
2743 |
+
|
2744 |
+
foreach( $needles as $needle ) {
|
2745 |
+
$pos = strpos( $haystack, $needle );
|
2746 |
+
if ( $pos !== false ) {
|
2747 |
+
return true;
|
2748 |
+
}
|
2749 |
+
}
|
2750 |
+
|
2751 |
+
return false;
|
2752 |
+
}
|
2753 |
+
|
2754 |
+
}
|
2755 |
+
|
2756 |
+
/**
|
2757 |
+
* Helper function - strpos() with arrays.
|
2758 |
+
*
|
2759 |
+
* @param string $haystack
|
2760 |
+
* @param array $needles
|
2761 |
+
* @return bool
|
2762 |
+
*
|
2763 |
+
* @access public
|
2764 |
+
* @since 2.0
|
2765 |
+
*/
|
2766 |
+
if ( ! function_exists( 'ot_array_keys_exists' ) ) {
|
2767 |
+
|
2768 |
+
function ot_array_keys_exists( $array, $keys ) {
|
2769 |
+
|
2770 |
+
foreach($keys as $k) {
|
2771 |
+
if ( isset($array[$k]) ) {
|
2772 |
+
return true;
|
2773 |
+
}
|
2774 |
+
}
|
2775 |
+
|
2776 |
+
return false;
|
2777 |
+
}
|
2778 |
+
|
2779 |
+
}
|
2780 |
+
|
2781 |
+
/* End of file ot-functions-admin.php */
|
2782 |
+
/* Location: ./includes/ot-functions-admin.php */
|
includes/ot-functions-compat.php
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, Derek Herman
|
8 |
+
* @since 2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* add all the old filters */
|
12 |
+
add_filter( 'ot_option_types_array', 'compat_ot_option_types_array', 10, 1 );
|
13 |
+
add_filter( 'ot_recognized_font_styles', 'compat_ot_recognized_font_styles', 10, 2 );
|
14 |
+
add_filter( 'ot_recognized_font_weights', 'compat_ot_recognized_font_weights', 10, 2 );
|
15 |
+
add_filter( 'ot_recognized_font_variants', 'compat_ot_recognized_font_variants', 10, 2 );
|
16 |
+
add_filter( 'ot_recognized_font_families', 'compat_ot_recognized_font_families', 10, 2 );
|
17 |
+
add_filter( 'ot_recognized_background_repeat', 'compat_ot_recognized_background_repeat', 10, 2 );
|
18 |
+
add_filter( 'ot_recognized_background_position', 'compat_ot_recognized_background_position', 10, 2 );
|
19 |
+
add_filter( 'ot_measurement_unit_types', 'compat_ot_measurement_unit_types', 10, 2 );
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Filters the option types array.
|
23 |
+
*
|
24 |
+
* Allows the old 'option_tree_option_types' filter to
|
25 |
+
* change the new 'ot_option_types_array' return value.
|
26 |
+
*
|
27 |
+
* @return array
|
28 |
+
*
|
29 |
+
* @access public
|
30 |
+
* @since 2.0
|
31 |
+
*/
|
32 |
+
if ( ! function_exists( 'compat_ot_option_types_array' ) ) {
|
33 |
+
|
34 |
+
function compat_ot_option_types_array( $array ) {
|
35 |
+
|
36 |
+
return apply_filters( 'option_tree_option_types', $array );
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Filters the recognized font styles array.
|
44 |
+
*
|
45 |
+
* Allows the old 'recognized_font_styles' filter to
|
46 |
+
* change the new 'ot_recognized_font_styles' return value.
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @since 2.0
|
52 |
+
*/
|
53 |
+
if ( ! function_exists( 'compat_ot_recognized_font_styles' ) ) {
|
54 |
+
|
55 |
+
function compat_ot_recognized_font_styles( $array, $id ) {
|
56 |
+
|
57 |
+
return apply_filters( 'recognized_font_styles', $array, $id );
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Filters the recognized font weights array.
|
65 |
+
*
|
66 |
+
* Allows the old 'recognized_font_weights' filter to
|
67 |
+
* change the new 'ot_recognized_font_weights' return value.
|
68 |
+
*
|
69 |
+
* @return array
|
70 |
+
*
|
71 |
+
* @access public
|
72 |
+
* @since 2.0
|
73 |
+
*/
|
74 |
+
if ( ! function_exists( 'compat_ot_recognized_font_weights' ) ) {
|
75 |
+
|
76 |
+
function compat_ot_recognized_font_weights( $array, $id ) {
|
77 |
+
|
78 |
+
return apply_filters( 'recognized_font_weights', $array, $id );
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Filters the recognized font variants array.
|
86 |
+
*
|
87 |
+
* Allows the old 'recognized_font_variants' filter to
|
88 |
+
* change the new 'ot_recognized_font_variants' return value.
|
89 |
+
*
|
90 |
+
* @return array
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @since 2.0
|
94 |
+
*/
|
95 |
+
if ( ! function_exists( 'compat_ot_recognized_font_variants' ) ) {
|
96 |
+
|
97 |
+
function compat_ot_recognized_font_variants( $array, $id ) {
|
98 |
+
|
99 |
+
return apply_filters( 'recognized_font_variants', $array, $id );
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Filters the recognized font families array.
|
107 |
+
*
|
108 |
+
* Allows the old 'recognized_font_families' filter to
|
109 |
+
* change the new 'ot_recognized_font_families' return value.
|
110 |
+
*
|
111 |
+
* @return array
|
112 |
+
*
|
113 |
+
* @access public
|
114 |
+
* @since 2.0
|
115 |
+
*/
|
116 |
+
if ( ! function_exists( 'compat_ot_recognized_font_families' ) ) {
|
117 |
+
|
118 |
+
function compat_ot_recognized_font_families( $array, $id ) {
|
119 |
+
|
120 |
+
return apply_filters( 'recognized_font_families', $array, $id );
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Filters the recognized background repeat array.
|
128 |
+
*
|
129 |
+
* Allows the old 'recognized_background_repeat' filter to
|
130 |
+
* change the new 'ot_recognized_background_repeat' return value.
|
131 |
+
*
|
132 |
+
* @return array
|
133 |
+
*
|
134 |
+
* @access public
|
135 |
+
* @since 2.0
|
136 |
+
*/
|
137 |
+
if ( ! function_exists( 'compat_ot_recognized_background_repeat' ) ) {
|
138 |
+
|
139 |
+
function compat_ot_recognized_background_repeat( $array, $id ) {
|
140 |
+
|
141 |
+
return apply_filters( 'recognized_background_repeat', $array, $id );
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Filters the recognized background position array.
|
149 |
+
*
|
150 |
+
* Allows the old 'recognized_background_position' filter to
|
151 |
+
* change the new 'ot_recognized_background_position' return value.
|
152 |
+
*
|
153 |
+
* @return array
|
154 |
+
*
|
155 |
+
* @access public
|
156 |
+
* @since 2.0
|
157 |
+
*/
|
158 |
+
if ( ! function_exists( 'compat_ot_recognized_background_position' ) ) {
|
159 |
+
|
160 |
+
function compat_ot_recognized_background_position( $array, $id ) {
|
161 |
+
|
162 |
+
return apply_filters( 'recognized_background_position', $array, $id );
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Filters the measurement unit types array.
|
170 |
+
*
|
171 |
+
* Allows the old 'measurement_unit_types' filter to
|
172 |
+
* change the new 'ot_measurement_unit_types' return value.
|
173 |
+
*
|
174 |
+
* @return array
|
175 |
+
*
|
176 |
+
* @access public
|
177 |
+
* @since 2.0
|
178 |
+
*/
|
179 |
+
if ( ! function_exists( 'compat_ot_measurement_unit_types' ) ) {
|
180 |
+
|
181 |
+
function compat_ot_measurement_unit_types( $array, $id ) {
|
182 |
+
|
183 |
+
return apply_filters( 'measurement_unit_types', $array, $id );
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
/* End of file ot-functions-compat.php */
|
191 |
+
/* Location: ./includes/ot-functions-compat.php */
|
includes/ot-functions-deprecated.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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
ADDED
@@ -0,0 +1,950 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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 '</div>';
|
71 |
+
|
72 |
+
echo '</div>';
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* ot_get_option() option type.
|
80 |
+
*
|
81 |
+
* This is a callback function to display text about ot_get_option().
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*
|
85 |
+
* @access public
|
86 |
+
* @since 2.0
|
87 |
+
*/
|
88 |
+
if ( ! function_exists( 'ot_type_option_types' ) ) {
|
89 |
+
|
90 |
+
function ot_type_option_types() {
|
91 |
+
|
92 |
+
/* format setting outer wrapper */
|
93 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
94 |
+
|
95 |
+
/* description */
|
96 |
+
echo '<div class="description">';
|
97 |
+
|
98 |
+
echo '<h4>'. __( 'Background', 'option-tree' ) . ':</h4>';
|
99 |
+
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>';
|
100 |
+
|
101 |
+
echo '<h4>'. __( 'Category Select', 'option-tree' ) . ':</h4>';
|
102 |
+
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>';
|
103 |
+
|
104 |
+
echo '<h4>'. __( 'Category Checkbox', 'option-tree' ) . ':</h4>';
|
105 |
+
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>';
|
106 |
+
|
107 |
+
echo '<h4>'. __( 'Checkbox', 'option-tree' ) . ':</h4>';
|
108 |
+
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>';
|
109 |
+
|
110 |
+
echo '<h4>'. __( 'Colorpicker', 'option-tree' ) . ':</h4>';
|
111 |
+
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>';
|
112 |
+
|
113 |
+
echo '<h4>'. __( 'CSS', 'option-tree' ) . ':</h4>';
|
114 |
+
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>';
|
115 |
+
|
116 |
+
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>';
|
117 |
+
|
118 |
+
echo '<p>'. __( 'Input', 'option-tree' ) . ':</p>';
|
119 |
+
echo '<pre><code>body {
|
120 |
+
{{custom_background_css}}
|
121 |
+
background-color: {{custom_background_css|background-color}};
|
122 |
+
}</code></pre>';
|
123 |
+
|
124 |
+
echo '<p>'. __( 'Output', 'option-tree' ) . ':</p>';
|
125 |
+
echo '<pre><code>/* BEGIN custom_background_css */
|
126 |
+
body {
|
127 |
+
background: color image repeat attachment position;
|
128 |
+
background-color: color;
|
129 |
+
}
|
130 |
+
/* END custom_background_css */</code></pre>';
|
131 |
+
|
132 |
+
echo '<h4>'. __( 'Custom Post Type Select', 'option-tree' ) . ':</h4>';
|
133 |
+
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>';
|
134 |
+
|
135 |
+
echo '<h4>'. __( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>';
|
136 |
+
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>';
|
137 |
+
|
138 |
+
echo '<h4>'. __( 'List Item', 'option-tree' ) . ':</h4>';
|
139 |
+
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>';
|
140 |
+
|
141 |
+
echo '<h4>'. __( 'Measurement', 'option-tree' ) . ':</h4>';
|
142 |
+
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>';
|
143 |
+
|
144 |
+
echo '<p>' . __( 'Example filter to add new units to the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
|
145 |
+
echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
|
146 |
+
|
147 |
+
/* only run the filter on measurement with a field ID of my_measurement */
|
148 |
+
if ( $field_id == \'my_measurement\' ) {
|
149 |
+
$array[\'in\'] = \'inches\';
|
150 |
+
$array[\'ft\'] = \'feet\';
|
151 |
+
}
|
152 |
+
|
153 |
+
return $array;
|
154 |
+
}
|
155 |
+
add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 1 );</code></pre>';
|
156 |
+
|
157 |
+
echo '<p>' . __( 'Example filter to completely change the units in the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
|
158 |
+
echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
|
159 |
+
|
160 |
+
/* only run the filter on measurement with a field ID of my_measurement */
|
161 |
+
if ( $field_id == \'my_measurement\' ) {
|
162 |
+
$array = array(
|
163 |
+
\'in\' => \'inches\',
|
164 |
+
\'ft\' => \'feet\'
|
165 |
+
);
|
166 |
+
}
|
167 |
+
|
168 |
+
return $array;
|
169 |
+
}
|
170 |
+
add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 1 );</code></pre>';
|
171 |
+
|
172 |
+
echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
|
173 |
+
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>';
|
174 |
+
|
175 |
+
echo '<h4>'. __( 'Page Checkbox', 'option-tree' ) . ':</h4>';
|
176 |
+
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>';
|
177 |
+
|
178 |
+
echo '<h4>'. __( 'Post Select', 'option-tree' ) . ':</h4>';
|
179 |
+
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>';
|
180 |
+
|
181 |
+
echo '<h4>'. __( 'Post Checkbox', 'option-tree' ) . ':</h4>';
|
182 |
+
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>';
|
183 |
+
|
184 |
+
echo '<h4>'. __( 'Radio', 'option-tree' ) . ':</h4>';
|
185 |
+
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>';
|
186 |
+
|
187 |
+
echo '<h4>'. __( 'Radio Image', 'option-tree' ) . ':</h4>';
|
188 |
+
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>';
|
189 |
+
|
190 |
+
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>';
|
191 |
+
echo '<pre><code>function filter_radio_images( $array, $field_id ) {
|
192 |
+
|
193 |
+
/* only run the filter where the field ID is my_radio_images */
|
194 |
+
if ( $field_id == \'my_radio_images\' ) {
|
195 |
+
$array = array(
|
196 |
+
array(
|
197 |
+
\'value\' => \'left-sidebar\',
|
198 |
+
\'label\' => __( \'Left Sidebar\', \'option-tree\' ),
|
199 |
+
\'src\' => OT_URL . \'/assets/images/layout/left-sidebar.png\'
|
200 |
+
),
|
201 |
+
array(
|
202 |
+
\'value\' => \'right-sidebar\',
|
203 |
+
\'label\' => __( \'Right Sidebar\', \'option-tree\' ),
|
204 |
+
\'src\' => OT_URL . \'/assets/images/layout/right-sidebar.png\'
|
205 |
+
)
|
206 |
+
);
|
207 |
+
}
|
208 |
+
|
209 |
+
return $array;
|
210 |
+
|
211 |
+
}
|
212 |
+
add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 1 );</code></pre>';
|
213 |
+
|
214 |
+
echo '<h4>'. __( 'Select', 'option-tree' ) . ':</h4>';
|
215 |
+
echo '<p>' . __( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>';
|
216 |
+
|
217 |
+
echo '<h4>'. __( 'Slider', 'option-tree' ) . ':</h4>';
|
218 |
+
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>';
|
219 |
+
|
220 |
+
echo '<h4>'. __( 'Tag Checkbox', 'option-tree' ) . ':</h4>';
|
221 |
+
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>';
|
222 |
+
|
223 |
+
echo '<h4>'. __( 'Tag Select', 'option-tree' ) . ':</h4>';
|
224 |
+
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>';
|
225 |
+
|
226 |
+
echo '<h4>'. __( 'Taxonomy Checkbox', 'option-tree' ) . ':</h4>';
|
227 |
+
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>';
|
228 |
+
|
229 |
+
echo '<h4>'. __( 'Taxonomy Select', 'option-tree' ) . ':</h4>';
|
230 |
+
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>';
|
231 |
+
|
232 |
+
echo '<h4>'. __( 'Text (Input)', 'option-tree' ) . ':</h4>';
|
233 |
+
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>';
|
234 |
+
|
235 |
+
echo '<h4>'. __( 'Textarea', 'option-tree' ) . ':</h4>';
|
236 |
+
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>';
|
237 |
+
|
238 |
+
echo '<p class="aside">' . __( 'Example filters to alter the Textarea option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
|
239 |
+
|
240 |
+
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>';
|
241 |
+
echo '<pre><code>function filter_textarea_wpautop( $content, $field_id ) {
|
242 |
+
|
243 |
+
/* only run the filter on the textarea with a field ID of my_textarea */
|
244 |
+
if ( $field_id == \'my_textarea\' ) {
|
245 |
+
return false;
|
246 |
+
}
|
247 |
+
|
248 |
+
return $content;
|
249 |
+
|
250 |
+
}
|
251 |
+
add_filter( \'ot_wpautop\', \'filter_textarea_wpautop\', 10, 1 );</code></pre>';
|
252 |
+
|
253 |
+
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>';
|
254 |
+
echo '<pre><code>function filter_textarea_media_buttons( $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_media_buttons\', \'filter_textarea_media_buttons\', 10, 1 );</code></pre>';
|
265 |
+
|
266 |
+
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>';
|
267 |
+
echo '<pre><code>function filter_textarea_tinymce( $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_tinymce\', \'filter_textarea_tinymce\', 10, 1 );</code></pre>';
|
278 |
+
|
279 |
+
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>';
|
280 |
+
echo '<pre><code>function filter_textarea_quicktags( $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 array( \'buttons\' => \'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close,fullscreen\' );
|
285 |
+
} else if ( $field_id == \'my_other_textarea\' ) {
|
286 |
+
return false; /* show no quicktags */
|
287 |
+
}
|
288 |
+
|
289 |
+
return $content;
|
290 |
+
|
291 |
+
}
|
292 |
+
add_filter( \'ot_quicktags\', \'filter_textarea_quicktags\', 10, 1 );</code></pre>';
|
293 |
+
|
294 |
+
echo '<h4>'. __( 'Textarea Simple', 'option-tree' ) . ':</h4>';
|
295 |
+
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>';
|
296 |
+
|
297 |
+
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>';
|
298 |
+
echo '<pre><code>function filter_textarea_simple_wpautop( $content, $field_id ) {
|
299 |
+
|
300 |
+
/* only run the filter on the textarea with a field ID of my_textarea */
|
301 |
+
if ( $field_id == \'my_textarea\' ) {
|
302 |
+
return true;
|
303 |
+
}
|
304 |
+
|
305 |
+
return $content;
|
306 |
+
|
307 |
+
}
|
308 |
+
add_filter( \'ot_wpautop\', \'filter_textarea_simple_wpautop\', 10, 1 );</code></pre>';
|
309 |
+
|
310 |
+
echo '<h4>'. __( 'Textblock', 'option-tree' ) . ':</h4>';
|
311 |
+
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>';
|
312 |
+
|
313 |
+
echo '<h4>'. __( 'Textblock Titled', 'option-tree' ) . ':</h4>';
|
314 |
+
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>';
|
315 |
+
|
316 |
+
echo '<h4>'. __( 'Typography', 'option-tree' ) . ':</h4>';
|
317 |
+
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>';
|
318 |
+
|
319 |
+
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>';
|
320 |
+
echo '<pre><code>function filter_ot_recognized_font_families( $array, $field_id ) {
|
321 |
+
|
322 |
+
/* only run the filter when the field ID is my_google_fonts_headings */
|
323 |
+
if ( $field_id == \'my_google_fonts_headings\' ) {
|
324 |
+
$array = array(
|
325 |
+
\'sans-serif\' => \'sans-serif\',
|
326 |
+
\'open-sans\' => \'"Open Sans", sans-serif\',
|
327 |
+
\'droid-sans\' => \'"Droid Sans", sans-serif\'
|
328 |
+
);
|
329 |
+
}
|
330 |
+
|
331 |
+
return $array;
|
332 |
+
|
333 |
+
}
|
334 |
+
add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 1 );</code></pre>';
|
335 |
+
|
336 |
+
echo '<h4>'. __( 'Upload', 'option-tree' ) . ':</h4>';
|
337 |
+
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>';
|
338 |
+
|
339 |
+
echo '</div>';
|
340 |
+
|
341 |
+
echo '</div>';
|
342 |
+
|
343 |
+
}
|
344 |
+
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* ot_get_option() option type.
|
349 |
+
*
|
350 |
+
* This is a callback function to display text about ot_get_option().
|
351 |
+
*
|
352 |
+
* @return string
|
353 |
+
*
|
354 |
+
* @access public
|
355 |
+
* @since 2.0
|
356 |
+
*/
|
357 |
+
if ( ! function_exists( 'ot_type_ot_get_option' ) ) {
|
358 |
+
|
359 |
+
function ot_type_ot_get_option() {
|
360 |
+
|
361 |
+
/* format setting outer wrapper */
|
362 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
363 |
+
|
364 |
+
/* description */
|
365 |
+
echo '<div class="description">';
|
366 |
+
|
367 |
+
echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
|
368 |
+
|
369 |
+
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, or array.', 'option-tree' ) . '</p>';
|
370 |
+
|
371 |
+
echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
|
372 |
+
|
373 |
+
echo '<p><code><?php ot_get_option( $option_id, $default ); ?></code></p>';
|
374 |
+
|
375 |
+
echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>';
|
376 |
+
|
377 |
+
echo '<code>$option_id</code>';
|
378 |
+
|
379 |
+
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>';
|
380 |
+
|
381 |
+
echo '<code>$default</code>';
|
382 |
+
|
383 |
+
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>';
|
384 |
+
|
385 |
+
echo '</div>';
|
386 |
+
|
387 |
+
echo '</div>';
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* get_option_tree() option type.
|
395 |
+
*
|
396 |
+
* This is a callback function to display text about get_option_tree().
|
397 |
+
*
|
398 |
+
* @return string
|
399 |
+
*
|
400 |
+
* @access public
|
401 |
+
* @since 2.0
|
402 |
+
*/
|
403 |
+
if ( ! function_exists( 'ot_type_get_option_tree' ) ) {
|
404 |
+
|
405 |
+
function ot_type_get_option_tree() {
|
406 |
+
|
407 |
+
/* format setting outer wrapper */
|
408 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
409 |
+
|
410 |
+
/* description */
|
411 |
+
echo '<div class="description">';
|
412 |
+
|
413 |
+
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>';
|
414 |
+
|
415 |
+
echo '<p>' . __( 'Use', 'option-tree' ) . '<code>ot_get_option()</code>' . __( 'instead', 'option-tree' ) . '.</p>';
|
416 |
+
|
417 |
+
echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
|
418 |
+
|
419 |
+
echo '<p>' . __( 'This function returns, or echos if asked, a value from the "option_tree" array of saved values.', 'option-tree' ) . '</p>';
|
420 |
+
|
421 |
+
echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
|
422 |
+
|
423 |
+
echo '<p><code><?php get_option_tree( $item_id, $options, $echo, $is_array, $offset ); ?></code></p>';
|
424 |
+
|
425 |
+
echo '<h4>' . __( 'Parameters', 'option-tree' ) . ':</h4>';
|
426 |
+
|
427 |
+
echo '<code>$item_id</code>';
|
428 |
+
|
429 |
+
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>';
|
430 |
+
|
431 |
+
echo '<code>$options</code>';
|
432 |
+
|
433 |
+
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>';
|
434 |
+
|
435 |
+
echo '<code>$echo</code>';
|
436 |
+
|
437 |
+
echo '<p>(<em>' . __( 'boolean', 'option-tree' ) . '</em>) (<em>' . __( 'optional', 'option-tree' ) . '</em>) ' . __( 'Echo the output.', 'option-tree' ) . '<br />' . __( 'Default', 'option-tree' ) . ': FALSE</p>';
|
438 |
+
|
439 |
+
echo '<code>$is_array</code>';
|
440 |
+
|
441 |
+
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>';
|
442 |
+
|
443 |
+
echo '<code>$offset</code>';
|
444 |
+
|
445 |
+
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>';
|
446 |
+
|
447 |
+
echo '</div>';
|
448 |
+
|
449 |
+
echo '</div>';
|
450 |
+
|
451 |
+
}
|
452 |
+
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Examples option type.
|
457 |
+
*
|
458 |
+
* @return string
|
459 |
+
*
|
460 |
+
* @access public
|
461 |
+
* @since 2.0
|
462 |
+
*/
|
463 |
+
if ( ! function_exists( 'ot_type_examples' ) ) {
|
464 |
+
|
465 |
+
function ot_type_examples() {
|
466 |
+
|
467 |
+
/* format setting outer wrapper */
|
468 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
469 |
+
|
470 |
+
/* description */
|
471 |
+
echo '<div class="description">';
|
472 |
+
|
473 |
+
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>';
|
474 |
+
|
475 |
+
echo '<h4>' . __( 'String Examples', 'option-tree' ) . ':</h4>';
|
476 |
+
|
477 |
+
echo '<p>' . __( 'Returns the value of <code>test_input</code>.', 'option-tree' ) . '</p>';
|
478 |
+
|
479 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
480 |
+
$test_input = ot_get_option( \'test_input\' );
|
481 |
+
}</code></pre>';
|
482 |
+
|
483 |
+
echo '<p>' . __( 'Returns the value of <code>test_input</code>, but also has a default value if it returns empty.', 'option-tree' ) . '</p>';
|
484 |
+
|
485 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
486 |
+
$test_input = ot_get_option( \'test_input\', \'default input value goes here.\' );
|
487 |
+
}</code></pre>';
|
488 |
+
|
489 |
+
echo '<h4>' . __( 'Array Examples', 'option-tree' ) . ':</h4>';
|
490 |
+
|
491 |
+
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>';
|
492 |
+
|
493 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
494 |
+
/* get an array of page id\'s */
|
495 |
+
$ids = ot_get_option( \'navigation_ids\', array() );
|
496 |
+
|
497 |
+
/* echo custom navigation using wp_list_pages() */
|
498 |
+
if ( ! empty( $ids ) )
|
499 |
+
echo \'<ul>\';
|
500 |
+
wp_list_pages(
|
501 |
+
array(
|
502 |
+
\'include\' => $ids,
|
503 |
+
\'title_li\' => \'\'
|
504 |
+
)
|
505 |
+
);
|
506 |
+
echo \'</ul>\';
|
507 |
+
}
|
508 |
+
|
509 |
+
}</code></pre>';
|
510 |
+
|
511 |
+
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>';
|
512 |
+
|
513 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
514 |
+
/* get the array */
|
515 |
+
$measurement = ot_get_option( \'measurement_option_type_id\' );
|
516 |
+
|
517 |
+
/* only echo values if they actually exist, else echo some default value */
|
518 |
+
if ( isset( measurement[0] ) && $measurement[1] ) {
|
519 |
+
echo $measurement[0].$measurement[1];
|
520 |
+
} else {
|
521 |
+
echo \'10px\';
|
522 |
+
}
|
523 |
+
|
524 |
+
}</code></pre>';
|
525 |
+
|
526 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
527 |
+
/* get the array, and have a default just incase */
|
528 |
+
$measurement = ot_get_option( \'measurement_option_type_id\', array( \'10\', \'px\' ) );
|
529 |
+
|
530 |
+
/* implode array into a string value */
|
531 |
+
if ( ! empty( measurement ) ) {
|
532 |
+
echo implode( \'\', $measurement );
|
533 |
+
}
|
534 |
+
|
535 |
+
}</code></pre>';
|
536 |
+
|
537 |
+
echo '<p>' . __( 'This example displays a very basic slider loop.', 'option-tree' ) . '</p>';
|
538 |
+
|
539 |
+
echo '<pre><code>if ( function_exists( \'ot_get_option\' ) ) {
|
540 |
+
|
541 |
+
/* get the slider array */
|
542 |
+
$slides = ot_get_option( \'my_slider\', array() );
|
543 |
+
|
544 |
+
if ( ! empty( $slides ) ) {
|
545 |
+
foreach( $slides as $slide ) {
|
546 |
+
echo \'
|
547 |
+
<li>
|
548 |
+
<a href="\' . $slide[\'link\'] . \'"><img src="\' . $slide[\'image\'] . \'" alt="\' . $slide[\'title\'] . \'" /></a>
|
549 |
+
<div class="description">\' . $slide[\'caption\'] . \'</div>
|
550 |
+
</li>\';
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
+
}</code></pre>';
|
555 |
+
|
556 |
+
echo '</div>';
|
557 |
+
|
558 |
+
echo '</div>';
|
559 |
+
|
560 |
+
}
|
561 |
+
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Layouts Overview option type.
|
566 |
+
*
|
567 |
+
* @return string
|
568 |
+
*
|
569 |
+
* @access public
|
570 |
+
* @since 2.0
|
571 |
+
*/
|
572 |
+
if ( ! function_exists( 'ot_type_layouts_overview' ) ) {
|
573 |
+
|
574 |
+
function ot_type_layouts_overview() {
|
575 |
+
|
576 |
+
/* format setting outer wrapper */
|
577 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
578 |
+
|
579 |
+
/* description */
|
580 |
+
echo '<div class="description">';
|
581 |
+
|
582 |
+
echo '<h4>'. __( 'It\'s Super Simple', 'option-tree' ) . '</h4>';
|
583 |
+
|
584 |
+
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>';
|
585 |
+
|
586 |
+
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>';
|
587 |
+
|
588 |
+
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>';
|
589 |
+
|
590 |
+
echo '<h4>' . __( 'For Developers', 'option-tree' ) . ':</h4>';
|
591 |
+
echo '<p>' . __( '', 'option-tree' ) . '</p>';
|
592 |
+
|
593 |
+
echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>';
|
594 |
+
echo '<ul class="docs-ul">';
|
595 |
+
echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>';
|
596 |
+
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>';
|
597 |
+
echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>';
|
598 |
+
echo '</ul>';
|
599 |
+
|
600 |
+
echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>';
|
601 |
+
echo '<ul class="docs-ul">';
|
602 |
+
echo '<li>'. __( 'Go to the <code>OptionTre->Settings->Layouts</code> tab.', 'option-tree' ) . '</li>';
|
603 |
+
echo '<li>' . __( 'Click on the activate layout button in the actions list.', 'option-tree' ) . '</li>';
|
604 |
+
echo '</ul>';
|
605 |
+
|
606 |
+
echo '<h5>' . __( 'Deleting 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>' . __( 'Click on the delete layout button in the actions list.', 'option-tree' ) . '</li>';
|
610 |
+
echo '</ul>';
|
611 |
+
|
612 |
+
echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>';
|
613 |
+
echo '<ul class="docs-ul">';
|
614 |
+
echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
|
615 |
+
echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>';
|
616 |
+
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>';
|
617 |
+
echo '<li>' . __( 'If you want to edit a new layout, first create it then save your theme options.', 'option-tree' ) . '</li>';
|
618 |
+
echo '</ul>';
|
619 |
+
|
620 |
+
echo '<h4>' . __( 'End-Users Mode', 'option-tree' ) . ':</h4>';
|
621 |
+
echo '<p>' . __( '', 'option-tree' ) . '</p>';
|
622 |
+
|
623 |
+
echo '<h5>' . __( 'Creating a Layout', 'option-tree' ) . ':</h5>';
|
624 |
+
echo '<ul class="docs-ul">';
|
625 |
+
echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
|
626 |
+
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>';
|
627 |
+
echo '<li>' . __( 'Adding a new layout is as easy as repeating the steps above.', 'option-tree' ) . '</li>';
|
628 |
+
echo '</ul>';
|
629 |
+
|
630 |
+
echo '<h5>' . __( 'Activating a Layout', 'option-tree' ) . ':</h5>';
|
631 |
+
echo '<ul class="docs-ul">';
|
632 |
+
echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> page.', 'option-tree' ) . '</li>';
|
633 |
+
echo '<li>' . __( 'Choose a layout from the select list and click the "Activate Layout" button.', 'option-tree' ) . '</li>';
|
634 |
+
echo '</ul>';
|
635 |
+
|
636 |
+
echo '<h5>' . __( 'Deleting a Layout', 'option-tree' ) . ':</h5>';
|
637 |
+
echo '<ul class="docs-ul">';
|
638 |
+
echo '<li>'. __( 'End-Users mode does not allow deleting layouts.', 'option-tree' ) . '</li>';
|
639 |
+
echo '</ul>';
|
640 |
+
|
641 |
+
echo '<h5>' . __( 'Edit Layout Data', 'option-tree' ) . ':</h5>';
|
642 |
+
echo '<ul class="docs-ul">';
|
643 |
+
echo '<li>'. __( 'Go to the <code>Appearance->Theme Options</code> tab.', 'option-tree' ) . '</li>';
|
644 |
+
echo '<li>' . __( 'Modify and save your theme options and the layout will be updated automatically.', 'option-tree' ) . '</li>';
|
645 |
+
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>';
|
646 |
+
echo '</ul>';
|
647 |
+
|
648 |
+
echo '</div>';
|
649 |
+
|
650 |
+
echo '</div>';
|
651 |
+
|
652 |
+
}
|
653 |
+
|
654 |
+
}
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Meta Boxes option type.
|
658 |
+
*
|
659 |
+
* @return string
|
660 |
+
*
|
661 |
+
* @access public
|
662 |
+
* @since 2.0
|
663 |
+
*/
|
664 |
+
if ( ! function_exists( 'ot_type_meta_boxes' ) ) {
|
665 |
+
|
666 |
+
function ot_type_meta_boxes() {
|
667 |
+
|
668 |
+
/* format setting outer wrapper */
|
669 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
670 |
+
|
671 |
+
/* description */
|
672 |
+
echo '<div class="description">';
|
673 |
+
|
674 |
+
echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>';
|
675 |
+
|
676 |
+
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>';
|
677 |
+
|
678 |
+
echo '<h5>' . __( 'Create and include your custom meta boxes file.', 'option-tree' ) . '</h5>';
|
679 |
+
echo '<ul class="docs-ul">';
|
680 |
+
echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>meta-boxes.php</code>.', 'option-tree' ) . '</li>';
|
681 |
+
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>';
|
682 |
+
echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
|
683 |
+
echo '</ul>';
|
684 |
+
|
685 |
+
echo '<pre><code>/**
|
686 |
+
* Meta Boxes
|
687 |
+
*/
|
688 |
+
include_once( \'includes/meta-boxes.php\' );
|
689 |
+
</code></pre>';
|
690 |
+
|
691 |
+
echo '<ul class="docs-ul">';
|
692 |
+
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>';
|
693 |
+
echo '</ul>';
|
694 |
+
|
695 |
+
echo "<pre><code>/**
|
696 |
+
* Initialize the meta boxes.
|
697 |
+
*/
|
698 |
+
add_action( 'admin_init', 'custom_meta_boxes' );
|
699 |
+
|
700 |
+
function custom_meta_boxes() {
|
701 |
+
|
702 |
+
$my_meta_box = array(
|
703 |
+
'id' => 'my_meta_box',
|
704 |
+
'title' => 'My Meta Box',
|
705 |
+
'desc' => '',
|
706 |
+
'pages' => array( 'post' ),
|
707 |
+
'context' => 'normal',
|
708 |
+
'priority' => 'high',
|
709 |
+
'fields' => array(
|
710 |
+
array(
|
711 |
+
'id' => 'background',
|
712 |
+
'label' => 'Background',
|
713 |
+
'desc' => '',
|
714 |
+
'std' => '',
|
715 |
+
'type' => 'background',
|
716 |
+
'class' => '',
|
717 |
+
'choices' => array()
|
718 |
+
)
|
719 |
+
)
|
720 |
+
);
|
721 |
+
|
722 |
+
ot_register_meta_box( $my_meta_box );
|
723 |
+
|
724 |
+
}</code></pre>";
|
725 |
+
|
726 |
+
echo '</div>';
|
727 |
+
|
728 |
+
echo '</div>';
|
729 |
+
|
730 |
+
}
|
731 |
+
|
732 |
+
}
|
733 |
+
|
734 |
+
/**
|
735 |
+
* Theme Mode option type.
|
736 |
+
*
|
737 |
+
* @return string
|
738 |
+
*
|
739 |
+
* @access public
|
740 |
+
* @since 2.0
|
741 |
+
*/
|
742 |
+
if ( ! function_exists( 'ot_type_theme_mode' ) ) {
|
743 |
+
|
744 |
+
function ot_type_theme_mode() {
|
745 |
+
|
746 |
+
/* format setting outer wrapper */
|
747 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
748 |
+
|
749 |
+
/* description */
|
750 |
+
echo '<div class="description">';
|
751 |
+
|
752 |
+
echo '<h4>'. __( 'How-to-guide', 'option-tree' ) . '</h4>';
|
753 |
+
|
754 |
+
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>';
|
755 |
+
|
756 |
+
echo '<h5>' . __( 'Step 1: Include the plugin & turn on theme mode.', 'option-tree' ) . '</h5>';
|
757 |
+
echo '<ul class="docs-ul">';
|
758 |
+
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>';
|
759 |
+
echo '<li>' . __( 'Unpack the ZIP archive.', 'option-tree' ) . '</li>';
|
760 |
+
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>';
|
761 |
+
echo '<li>' . __( 'Add the following code to the beginning of your <code>functions.php</code>.', 'option-tree' ) . '</li>';
|
762 |
+
echo '</ul>';
|
763 |
+
|
764 |
+
echo '<pre><code>/**
|
765 |
+
* Optional: set \'ot_show_pages\' filter to false.
|
766 |
+
* This will hide the settings & documentation pages.
|
767 |
+
*/
|
768 |
+
add_filter( \'ot_show_pages\', \'__return_false\' );
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Required: set \'ot_theme_mode\' filter to true.
|
772 |
+
*/
|
773 |
+
add_filter( \'ot_theme_mode\', \'__return_true\' );
|
774 |
+
|
775 |
+
/**
|
776 |
+
* Required: include OptionTree.
|
777 |
+
*/
|
778 |
+
include_once( \'option-tree/ot-loader.php\' );
|
779 |
+
</code></pre>';
|
780 |
+
|
781 |
+
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>';
|
782 |
+
|
783 |
+
echo '<h5>' . __( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>';
|
784 |
+
echo '<ul class="docs-ul">';
|
785 |
+
echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>theme-options.php</code>.', 'option-tree' ) . '</li>';
|
786 |
+
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>';
|
787 |
+
echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
|
788 |
+
echo '</ul>';
|
789 |
+
|
790 |
+
echo '<pre><code>/**
|
791 |
+
* Theme Options
|
792 |
+
*/
|
793 |
+
include_once( \'includes/theme-options.php\' );
|
794 |
+
</code></pre>';
|
795 |
+
|
796 |
+
echo '<ul class="docs-ul">';
|
797 |
+
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>';
|
798 |
+
echo '</ul>';
|
799 |
+
|
800 |
+
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 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>';
|
801 |
+
|
802 |
+
echo "<pre><code>/**
|
803 |
+
* Initialize the options before anything else.
|
804 |
+
*/
|
805 |
+
add_action( 'admin_init', 'custom_theme_options', 1 );
|
806 |
+
|
807 |
+
function custom_theme_options() {
|
808 |
+
/**
|
809 |
+
* Get a copy of the saved settings array.
|
810 |
+
*/
|
811 |
+
$saved_settings = get_option( 'option_tree_settings', array() );
|
812 |
+
|
813 |
+
/**
|
814 |
+
* Create your own custom array that will be passes to the
|
815 |
+
* OptionTree Settings API Class.
|
816 |
+
*/
|
817 |
+
$custom_settings = array(
|
818 |
+
'contextual_help' => array(
|
819 |
+
'content' => array(
|
820 |
+
array(
|
821 |
+
'id' => 'general_help',
|
822 |
+
'title' => 'General',
|
823 |
+
'content' => '<p>Help content goes here!</p>'
|
824 |
+
)
|
825 |
+
),
|
826 |
+
'sidebar' => '<p>Sidebar content goes here!</p>',
|
827 |
+
),
|
828 |
+
'sections' => array(
|
829 |
+
array(
|
830 |
+
'id' => 'general',
|
831 |
+
'title' => 'General'
|
832 |
+
)
|
833 |
+
),
|
834 |
+
'settings' => array(
|
835 |
+
array(
|
836 |
+
'id' => 'my_checkbox',
|
837 |
+
'label' => 'Checkbox',
|
838 |
+
'desc' => '',
|
839 |
+
'std' => '',
|
840 |
+
'type' => 'checkbox',
|
841 |
+
'section' => 'general',
|
842 |
+
'class' => '',
|
843 |
+
'choices' => array(
|
844 |
+
array(
|
845 |
+
'value' => 'yes',
|
846 |
+
'label' => 'Yes'
|
847 |
+
)
|
848 |
+
)
|
849 |
+
),
|
850 |
+
array(
|
851 |
+
'id' => 'my_layout',
|
852 |
+
'label' => 'Layout',
|
853 |
+
'desc' => 'Choose a layout for your theme',
|
854 |
+
'std' => 'right-sidebar',
|
855 |
+
'type' => 'radio-image',
|
856 |
+
'section' => 'general',
|
857 |
+
'class' => '',
|
858 |
+
'choices' => array(
|
859 |
+
array(
|
860 |
+
'value' => 'left-sidebar',
|
861 |
+
'label' => 'Left Sidebar',
|
862 |
+
'src' => OT_URL . '/assets/images/layout/left-sidebar.png'
|
863 |
+
),
|
864 |
+
array(
|
865 |
+
'value' => 'right-sidebar',
|
866 |
+
'label' => 'Right Sidebar',
|
867 |
+
'src' => OT_URL . '/assets/images/layout/right-sidebar.png'
|
868 |
+
),
|
869 |
+
array(
|
870 |
+
'value' => 'full-width',
|
871 |
+
'label' => 'Full Width (no sidebar)',
|
872 |
+
'src' => OT_URL . '/assets/images/layout/full-width.png'
|
873 |
+
),
|
874 |
+
array(
|
875 |
+
'value' => 'dual-sidebar',
|
876 |
+
'label' => __( 'Dual Sidebar', 'option-tree' ),
|
877 |
+
'src' => OT_URL . '/assets/images/layout/dual-sidebar.png'
|
878 |
+
),
|
879 |
+
array(
|
880 |
+
'value' => 'left-dual-sidebar',
|
881 |
+
'label' => __( 'Left Dual Sidebar', 'option-tree' ),
|
882 |
+
'src' => OT_URL . '/assets/images/layout/left-dual-sidebar.png'
|
883 |
+
),
|
884 |
+
array(
|
885 |
+
'value' => 'right-dual-sidebar',
|
886 |
+
'label' => __( 'Right Dual Sidebar', 'option-tree' ),
|
887 |
+
'src' => OT_URL . '/assets/images/layout/right-dual-sidebar.png'
|
888 |
+
)
|
889 |
+
)
|
890 |
+
),
|
891 |
+
array(
|
892 |
+
'id' => 'my_slider',
|
893 |
+
'label' => 'Images',
|
894 |
+
'desc' => '',
|
895 |
+
'std' => '',
|
896 |
+
'type' => 'list-item',
|
897 |
+
'section' => 'general',
|
898 |
+
'class' => '',
|
899 |
+
'choices' => array(),
|
900 |
+
'settings' => array(
|
901 |
+
array(
|
902 |
+
'id' => 'slider_image',
|
903 |
+
'label' => 'Image',
|
904 |
+
'desc' => '',
|
905 |
+
'std' => '',
|
906 |
+
'type' => 'upload',
|
907 |
+
'class' => '',
|
908 |
+
'choices' => array()
|
909 |
+
),
|
910 |
+
array(
|
911 |
+
'id' => 'slider_link',
|
912 |
+
'label' => 'Link to Post',
|
913 |
+
'desc' => 'Enter the posts url.',
|
914 |
+
'std' => '',
|
915 |
+
'type' => 'text',
|
916 |
+
'class' => '',
|
917 |
+
'choices' => array()
|
918 |
+
),
|
919 |
+
array(
|
920 |
+
'id' => 'slider_description',
|
921 |
+
'label' => 'Description',
|
922 |
+
'desc' => 'This text is used to add fancy captions in the slider.',
|
923 |
+
'std' => '',
|
924 |
+
'type' => 'textarea',
|
925 |
+
'class' => '',
|
926 |
+
'choices' => array()
|
927 |
+
)
|
928 |
+
)
|
929 |
+
)
|
930 |
+
)
|
931 |
+
);
|
932 |
+
|
933 |
+
/* settings are not the same update the DB */
|
934 |
+
if ( $saved_settings !== $custom_settings ) {
|
935 |
+
update_option( 'option_tree_settings', $custom_settings );
|
936 |
+
}
|
937 |
+
|
938 |
+
}
|
939 |
+
</code></pre>";
|
940 |
+
|
941 |
+
echo '</div>';
|
942 |
+
|
943 |
+
echo '</div>';
|
944 |
+
|
945 |
+
}
|
946 |
+
|
947 |
+
}
|
948 |
+
|
949 |
+
/* End of file ot-functions-docs-page.php */
|
950 |
+
/* Location: ./includes/ot-functions-docs-page.php */
|
includes/ot-functions-option-types.php
ADDED
@@ -0,0 +1,1712 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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 |
+
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" 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 |
+
$count = 0;
|
202 |
+
foreach ( $categories as $category ) {
|
203 |
+
echo '<p>';
|
204 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( $category->term_id ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], $category->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
205 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . esc_attr( $category->name ) . '</label>';
|
206 |
+
echo '</p>';
|
207 |
+
$count++;
|
208 |
+
}
|
209 |
+
} else {
|
210 |
+
echo '<p>' . __( 'No Categories Found', 'option-tree' ) . '</p>';
|
211 |
+
}
|
212 |
+
|
213 |
+
echo '</div>';
|
214 |
+
|
215 |
+
echo '</div>';
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Category Select option type.
|
223 |
+
*
|
224 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
225 |
+
*
|
226 |
+
* @param array An array of arguments.
|
227 |
+
* @return string
|
228 |
+
*
|
229 |
+
* @access public
|
230 |
+
* @since 2.0
|
231 |
+
*/
|
232 |
+
if ( ! function_exists( 'ot_type_category_select' ) ) {
|
233 |
+
|
234 |
+
function ot_type_category_select( $args = array() ) {
|
235 |
+
|
236 |
+
/* turns arguments array into variables */
|
237 |
+
extract( $args );
|
238 |
+
|
239 |
+
/* verify a description */
|
240 |
+
$has_desc = $field_desc ? true : false;
|
241 |
+
|
242 |
+
/* format setting outer wrapper */
|
243 |
+
echo '<div class="format-setting type-category-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
244 |
+
|
245 |
+
/* description */
|
246 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
247 |
+
|
248 |
+
/* format setting inner wrapper */
|
249 |
+
echo '<div class="format-setting-inner">';
|
250 |
+
|
251 |
+
/* build category */
|
252 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '"">';
|
253 |
+
|
254 |
+
/* get category array */
|
255 |
+
$categories = get_categories( array( 'hide_empty' => false ) );
|
256 |
+
|
257 |
+
/* has cats */
|
258 |
+
if ( ! empty( $categories ) ) {
|
259 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
260 |
+
foreach ( $categories as $category ) {
|
261 |
+
echo '<option value="' . esc_attr( $category->term_id ) . '"' . selected( $field_value, $category->term_id, false ) . '>' . esc_attr( $category->name ) . '</option>';
|
262 |
+
}
|
263 |
+
} else {
|
264 |
+
echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
|
265 |
+
}
|
266 |
+
echo '</select>';
|
267 |
+
|
268 |
+
echo '</div>';
|
269 |
+
|
270 |
+
echo '</div>';
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Checkbox option type.
|
278 |
+
*
|
279 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
280 |
+
*
|
281 |
+
* @param array An array of arguments.
|
282 |
+
* @return string
|
283 |
+
*
|
284 |
+
* @access public
|
285 |
+
* @since 2.0
|
286 |
+
*/
|
287 |
+
if ( ! function_exists( 'ot_type_checkbox' ) ) {
|
288 |
+
|
289 |
+
function ot_type_checkbox( $args = array() ) {
|
290 |
+
|
291 |
+
/* turns arguments array into variables */
|
292 |
+
extract( $args );
|
293 |
+
|
294 |
+
/* verify a description */
|
295 |
+
$has_desc = $field_desc ? true : false;
|
296 |
+
|
297 |
+
/* format setting outer wrapper */
|
298 |
+
echo '<div class="format-setting type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
299 |
+
|
300 |
+
/* description */
|
301 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
302 |
+
|
303 |
+
/* format setting inner wrapper */
|
304 |
+
echo '<div class="format-setting-inner">';
|
305 |
+
|
306 |
+
/* build checkbox */
|
307 |
+
foreach ( (array) $field_choices as $key => $choice ) {
|
308 |
+
if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
|
309 |
+
echo '<p>';
|
310 |
+
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 ) . '" />';
|
311 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label>';
|
312 |
+
echo '</p>';
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
echo '</div>';
|
317 |
+
|
318 |
+
echo '</div>';
|
319 |
+
|
320 |
+
}
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Colorpicker option type.
|
326 |
+
*
|
327 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
328 |
+
*
|
329 |
+
* @param array An array of arguments.
|
330 |
+
* @return string
|
331 |
+
*
|
332 |
+
* @access public
|
333 |
+
* @since 2.0
|
334 |
+
*/
|
335 |
+
if ( ! function_exists( 'ot_type_colorpicker' ) ) {
|
336 |
+
|
337 |
+
function ot_type_colorpicker( $args = array() ) {
|
338 |
+
|
339 |
+
/* turns arguments array into variables */
|
340 |
+
extract( $args );
|
341 |
+
|
342 |
+
/* verify a description */
|
343 |
+
$has_desc = $field_desc ? true : false;
|
344 |
+
|
345 |
+
/* format setting outer wrapper */
|
346 |
+
echo '<div class="format-setting type-colorpicker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
347 |
+
|
348 |
+
/* description */
|
349 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
350 |
+
|
351 |
+
/* format setting inner wrapper */
|
352 |
+
echo '<div class="format-setting-inner">';
|
353 |
+
|
354 |
+
/* build colorpicker */
|
355 |
+
echo '<div class="option-tree-ui-colorpicker-input-wrap">';
|
356 |
+
|
357 |
+
/* colorpicker JS */
|
358 |
+
echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
|
359 |
+
|
360 |
+
/* input */
|
361 |
+
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" />';
|
362 |
+
|
363 |
+
/* set border color */
|
364 |
+
$border_color = in_array( $field_value, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : esc_attr( $field_value );
|
365 |
+
|
366 |
+
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>';
|
367 |
+
|
368 |
+
echo '</div>';
|
369 |
+
|
370 |
+
echo '</div>';
|
371 |
+
|
372 |
+
echo '</div>';
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* CSS option type.
|
380 |
+
*
|
381 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
382 |
+
*
|
383 |
+
* @param array An array of arguments.
|
384 |
+
* @return string
|
385 |
+
*
|
386 |
+
* @access public
|
387 |
+
* @since 2.0
|
388 |
+
*/
|
389 |
+
if ( ! function_exists( 'ot_type_css' ) ) {
|
390 |
+
|
391 |
+
function ot_type_css( $args = array() ) {
|
392 |
+
|
393 |
+
/* turns arguments array into variables */
|
394 |
+
extract( $args );
|
395 |
+
|
396 |
+
/* verify a description */
|
397 |
+
$has_desc = $field_desc ? true : false;
|
398 |
+
|
399 |
+
/* format setting outer wrapper */
|
400 |
+
echo '<div class="format-setting type-css simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
401 |
+
|
402 |
+
/* description */
|
403 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
404 |
+
|
405 |
+
/* format setting inner wrapper */
|
406 |
+
echo '<div class="format-setting-inner">';
|
407 |
+
|
408 |
+
/* build textarea for CSS */
|
409 |
+
wp_editor(
|
410 |
+
$field_value,
|
411 |
+
esc_attr( $field_id ),
|
412 |
+
array(
|
413 |
+
'wpautop' => false,
|
414 |
+
'media_buttons' => false,
|
415 |
+
'textarea_name' => esc_attr( $field_name ),
|
416 |
+
'textarea_rows' => esc_attr( $field_rows ),
|
417 |
+
'tinymce' => false,
|
418 |
+
'quicktags' => false
|
419 |
+
)
|
420 |
+
);
|
421 |
+
|
422 |
+
echo '</div>';
|
423 |
+
|
424 |
+
echo '</div>';
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Custom Post Type Checkbox option type.
|
432 |
+
*
|
433 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
434 |
+
*
|
435 |
+
* @param array An array of arguments.
|
436 |
+
* @return string
|
437 |
+
*
|
438 |
+
* @access public
|
439 |
+
* @since 2.0
|
440 |
+
*/
|
441 |
+
if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
|
442 |
+
|
443 |
+
function ot_type_custom_post_type_checkbox( $args = array() ) {
|
444 |
+
|
445 |
+
/* turns arguments array into variables */
|
446 |
+
extract( $args );
|
447 |
+
|
448 |
+
/* verify a description */
|
449 |
+
$has_desc = $field_desc ? true : false;
|
450 |
+
|
451 |
+
/* format setting outer wrapper */
|
452 |
+
echo '<div class="format-setting type-custom-post-type-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
453 |
+
|
454 |
+
/* description */
|
455 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
456 |
+
|
457 |
+
/* format setting inner wrapper */
|
458 |
+
echo '<div class="format-setting-inner">';
|
459 |
+
|
460 |
+
/* setup the post types */
|
461 |
+
$post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
|
462 |
+
|
463 |
+
/* query posts array */
|
464 |
+
$query = new WP_Query( array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
465 |
+
|
466 |
+
/* has posts */
|
467 |
+
if ( $query->have_posts() ) {
|
468 |
+
$count = 0;
|
469 |
+
while ( $query->have_posts() ) {
|
470 |
+
$query->the_post();
|
471 |
+
echo '<p>';
|
472 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
473 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . get_the_title() . '</label>';
|
474 |
+
echo '</p>';
|
475 |
+
$count++;
|
476 |
+
}
|
477 |
+
} else {
|
478 |
+
echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
|
479 |
+
}
|
480 |
+
|
481 |
+
echo '</div>';
|
482 |
+
|
483 |
+
echo '</div>';
|
484 |
+
|
485 |
+
}
|
486 |
+
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Custom Post Type Select option type.
|
491 |
+
*
|
492 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
493 |
+
*
|
494 |
+
* @param array An array of arguments.
|
495 |
+
* @return string
|
496 |
+
*
|
497 |
+
* @access public
|
498 |
+
* @since 2.0
|
499 |
+
*/
|
500 |
+
if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
|
501 |
+
|
502 |
+
function ot_type_custom_post_type_select( $args = array() ) {
|
503 |
+
|
504 |
+
/* turns arguments array into variables */
|
505 |
+
extract( $args );
|
506 |
+
|
507 |
+
/* verify a description */
|
508 |
+
$has_desc = $field_desc ? true : false;
|
509 |
+
|
510 |
+
/* format setting outer wrapper */
|
511 |
+
echo '<div class="format-setting type-custom-post-type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
512 |
+
|
513 |
+
/* description */
|
514 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
515 |
+
|
516 |
+
/* format setting inner wrapper */
|
517 |
+
echo '<div class="format-setting-inner">';
|
518 |
+
|
519 |
+
/* build category */
|
520 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
|
521 |
+
|
522 |
+
/* setup the post types */
|
523 |
+
$post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
|
524 |
+
|
525 |
+
/* query posts array */
|
526 |
+
$query = new WP_Query( array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
527 |
+
|
528 |
+
/* has posts */
|
529 |
+
if ( $query->have_posts() ) {
|
530 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
531 |
+
while ( $query->have_posts() ) {
|
532 |
+
$query->the_post();
|
533 |
+
echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
|
534 |
+
}
|
535 |
+
} else {
|
536 |
+
echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
|
537 |
+
}
|
538 |
+
echo '</select>';
|
539 |
+
|
540 |
+
echo '</div>';
|
541 |
+
|
542 |
+
echo '</div>';
|
543 |
+
|
544 |
+
}
|
545 |
+
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* List Item option type.
|
550 |
+
*
|
551 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
552 |
+
*
|
553 |
+
* @param array An array of arguments.
|
554 |
+
* @return string
|
555 |
+
*
|
556 |
+
* @access public
|
557 |
+
* @since 2.0
|
558 |
+
*/
|
559 |
+
if ( ! function_exists( 'ot_type_list_item' ) ) {
|
560 |
+
|
561 |
+
function ot_type_list_item( $args = array() ) {
|
562 |
+
|
563 |
+
/* turns arguments array into variables */
|
564 |
+
extract( $args );
|
565 |
+
|
566 |
+
/* verify a description */
|
567 |
+
$has_desc = $field_desc ? true : false;
|
568 |
+
|
569 |
+
/* format setting outer wrapper */
|
570 |
+
echo '<div class="format-setting type-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
571 |
+
|
572 |
+
/* description */
|
573 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
574 |
+
|
575 |
+
/* format setting inner wrapper */
|
576 |
+
echo '<div class="format-setting-inner">';
|
577 |
+
|
578 |
+
/* pass the settings array arround */
|
579 |
+
echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . base64_encode( serialize( $field_settings ) ) . '" />';
|
580 |
+
|
581 |
+
/**
|
582 |
+
* settings pages have array wrappers like 'option_tree'.
|
583 |
+
* So we need that value to create a proper array to save to.
|
584 |
+
* This is only for NON metaboxes settings.
|
585 |
+
*/
|
586 |
+
if ( ! isset( $get_option ) )
|
587 |
+
$get_option = '';
|
588 |
+
|
589 |
+
/* build list items */
|
590 |
+
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 ) . '">';
|
591 |
+
|
592 |
+
if ( is_array( $field_value ) && ! empty( $field_value ) ) {
|
593 |
+
|
594 |
+
foreach( $field_value as $key => $list_item ) {
|
595 |
+
|
596 |
+
echo '<li class="ui-state-default list-list-item">';
|
597 |
+
ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
|
598 |
+
echo '</li>';
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
}
|
603 |
+
|
604 |
+
echo '</ul>';
|
605 |
+
|
606 |
+
/* button */
|
607 |
+
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>';
|
608 |
+
|
609 |
+
/* description */
|
610 |
+
echo '<div class="list-item-description">' . __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) . '</div>';
|
611 |
+
|
612 |
+
echo '</div>';
|
613 |
+
|
614 |
+
echo '</div>';
|
615 |
+
|
616 |
+
}
|
617 |
+
|
618 |
+
}
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Measurement option type.
|
622 |
+
*
|
623 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
624 |
+
*
|
625 |
+
* @param array An array of arguments.
|
626 |
+
* @return string
|
627 |
+
*
|
628 |
+
* @access public
|
629 |
+
* @since 2.0
|
630 |
+
*/
|
631 |
+
if ( ! function_exists( 'ot_type_measurement' ) ) {
|
632 |
+
|
633 |
+
function ot_type_measurement( $args = array() ) {
|
634 |
+
|
635 |
+
/* turns arguments array into variables */
|
636 |
+
extract( $args );
|
637 |
+
|
638 |
+
/* verify a description */
|
639 |
+
$has_desc = $field_desc ? true : false;
|
640 |
+
|
641 |
+
/* format setting outer wrapper */
|
642 |
+
echo '<div class="format-setting type-measurement ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
643 |
+
|
644 |
+
/* description */
|
645 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
646 |
+
|
647 |
+
/* format setting inner wrapper */
|
648 |
+
echo '<div class="format-setting-inner">';
|
649 |
+
|
650 |
+
echo '<div class="option-tree-ui-measurement-input-wrap">';
|
651 |
+
|
652 |
+
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 ) . '" />';
|
653 |
+
|
654 |
+
echo '</div>';
|
655 |
+
|
656 |
+
/* build measurement */
|
657 |
+
echo '<select name="' . esc_attr( $field_name ) . '[1]" id="' . esc_attr( $field_id ) . '-1" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
658 |
+
|
659 |
+
echo '<option value=""> -- </option>';
|
660 |
+
|
661 |
+
foreach ( ot_measurement_unit_types( $field_id ) as $unit ) {
|
662 |
+
echo '<option value="' . esc_attr( $unit ) . '"' . selected( $field_value[1], $unit, false ) . '>' . esc_attr( $unit ) . '</option>';
|
663 |
+
}
|
664 |
+
|
665 |
+
echo '</select>';
|
666 |
+
|
667 |
+
echo '</div>';
|
668 |
+
|
669 |
+
echo '</div>';
|
670 |
+
|
671 |
+
}
|
672 |
+
|
673 |
+
}
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Page Checkbox option type.
|
677 |
+
*
|
678 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
679 |
+
*
|
680 |
+
* @param array An array of arguments.
|
681 |
+
* @return string
|
682 |
+
*
|
683 |
+
* @access public
|
684 |
+
* @since 2.0
|
685 |
+
*/
|
686 |
+
if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
|
687 |
+
|
688 |
+
function ot_type_page_checkbox( $args = array() ) {
|
689 |
+
|
690 |
+
/* turns arguments array into variables */
|
691 |
+
extract( $args );
|
692 |
+
|
693 |
+
/* verify a description */
|
694 |
+
$has_desc = $field_desc ? true : false;
|
695 |
+
|
696 |
+
/* format setting outer wrapper */
|
697 |
+
echo '<div class="format-setting type-page-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
698 |
+
|
699 |
+
/* description */
|
700 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
701 |
+
|
702 |
+
/* format setting inner wrapper */
|
703 |
+
echo '<div class="format-setting-inner">';
|
704 |
+
|
705 |
+
/* query pages array */
|
706 |
+
$query = new WP_Query( array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
707 |
+
|
708 |
+
/* has pages */
|
709 |
+
if ( $query->have_posts() ) {
|
710 |
+
$count = 0;
|
711 |
+
while ( $query->have_posts() ) {
|
712 |
+
$query->the_post();
|
713 |
+
echo '<p>';
|
714 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
715 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . get_the_title() . '</label>';
|
716 |
+
echo '</p>';
|
717 |
+
$count++;
|
718 |
+
}
|
719 |
+
} else {
|
720 |
+
echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
|
721 |
+
}
|
722 |
+
|
723 |
+
echo '</div>';
|
724 |
+
|
725 |
+
echo '</div>';
|
726 |
+
|
727 |
+
}
|
728 |
+
|
729 |
+
}
|
730 |
+
|
731 |
+
/**
|
732 |
+
* Page Select option type.
|
733 |
+
*
|
734 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
735 |
+
*
|
736 |
+
* @param array An array of arguments.
|
737 |
+
* @return string
|
738 |
+
*
|
739 |
+
* @access public
|
740 |
+
* @since 2.0
|
741 |
+
*/
|
742 |
+
if ( ! function_exists( 'ot_type_page_select' ) ) {
|
743 |
+
|
744 |
+
function ot_type_page_select( $args = array() ) {
|
745 |
+
|
746 |
+
/* turns arguments array into variables */
|
747 |
+
extract( $args );
|
748 |
+
|
749 |
+
/* verify a description */
|
750 |
+
$has_desc = $field_desc ? true : false;
|
751 |
+
|
752 |
+
/* format setting outer wrapper */
|
753 |
+
echo '<div class="format-setting type-page-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
754 |
+
|
755 |
+
/* description */
|
756 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
757 |
+
|
758 |
+
/* format setting inner wrapper */
|
759 |
+
echo '<div class="format-setting-inner">';
|
760 |
+
|
761 |
+
/* build page select */
|
762 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
|
763 |
+
|
764 |
+
/* query pages array */
|
765 |
+
$query = new WP_Query( array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
766 |
+
|
767 |
+
/* has pages */
|
768 |
+
if ( $query->have_posts() ) {
|
769 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
770 |
+
while ( $query->have_posts() ) {
|
771 |
+
$query->the_post();
|
772 |
+
echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
|
773 |
+
}
|
774 |
+
} else {
|
775 |
+
echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
|
776 |
+
}
|
777 |
+
echo '</select>';
|
778 |
+
|
779 |
+
echo '</div>';
|
780 |
+
|
781 |
+
echo '</div>';
|
782 |
+
|
783 |
+
}
|
784 |
+
|
785 |
+
}
|
786 |
+
|
787 |
+
/**
|
788 |
+
* List Item option type.
|
789 |
+
*
|
790 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
791 |
+
*
|
792 |
+
* @param array An array of arguments.
|
793 |
+
* @return string
|
794 |
+
*
|
795 |
+
* @access public
|
796 |
+
* @since 2.0
|
797 |
+
*/
|
798 |
+
if ( ! function_exists( 'ot_type_slider' ) ) {
|
799 |
+
|
800 |
+
function ot_type_slider( $args = array() ) {
|
801 |
+
|
802 |
+
/* turns arguments array into variables */
|
803 |
+
extract( $args );
|
804 |
+
|
805 |
+
/* verify a description */
|
806 |
+
$has_desc = $field_desc ? true : false;
|
807 |
+
|
808 |
+
/* format setting outer wrapper */
|
809 |
+
echo '<div class="format-setting type-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
810 |
+
|
811 |
+
/* description */
|
812 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
813 |
+
|
814 |
+
/* format setting inner wrapper */
|
815 |
+
echo '<div class="format-setting-inner">';
|
816 |
+
|
817 |
+
/* pass the settings array arround */
|
818 |
+
echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . base64_encode( serialize( $field_settings ) ) . '" />';
|
819 |
+
|
820 |
+
/**
|
821 |
+
* settings pages have array wrappers like 'option_tree'.
|
822 |
+
* So we need that value to create a proper array to save to.
|
823 |
+
* This is only for NON metaboxes settings.
|
824 |
+
*/
|
825 |
+
if ( ! isset( $get_option ) )
|
826 |
+
$get_option = '';
|
827 |
+
|
828 |
+
/* build list items */
|
829 |
+
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 ) . '">';
|
830 |
+
|
831 |
+
if ( is_array( $field_value ) && ! empty( $field_value ) ) {
|
832 |
+
|
833 |
+
foreach( $field_value as $key => $list_item ) {
|
834 |
+
|
835 |
+
echo '<li class="ui-state-default list-list-item">';
|
836 |
+
ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
|
837 |
+
echo '</li>';
|
838 |
+
|
839 |
+
}
|
840 |
+
|
841 |
+
}
|
842 |
+
|
843 |
+
echo '</ul>';
|
844 |
+
|
845 |
+
/* button */
|
846 |
+
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>';
|
847 |
+
|
848 |
+
/* description */
|
849 |
+
echo '<div class="list-item-description">' . __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) . '</div>';
|
850 |
+
|
851 |
+
echo '</div>';
|
852 |
+
|
853 |
+
echo '</div>';
|
854 |
+
|
855 |
+
}
|
856 |
+
|
857 |
+
}
|
858 |
+
|
859 |
+
/**
|
860 |
+
* Post Checkbox option type.
|
861 |
+
*
|
862 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
863 |
+
*
|
864 |
+
* @param array An array of arguments.
|
865 |
+
* @return string
|
866 |
+
*
|
867 |
+
* @access public
|
868 |
+
* @since 2.0
|
869 |
+
*/
|
870 |
+
if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
|
871 |
+
|
872 |
+
function ot_type_post_checkbox( $args = array() ) {
|
873 |
+
|
874 |
+
/* turns arguments array into variables */
|
875 |
+
extract( $args );
|
876 |
+
|
877 |
+
/* verify a description */
|
878 |
+
$has_desc = $field_desc ? true : false;
|
879 |
+
|
880 |
+
/* format setting outer wrapper */
|
881 |
+
echo '<div class="format-setting type-post-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
882 |
+
|
883 |
+
/* description */
|
884 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
885 |
+
|
886 |
+
/* format setting inner wrapper */
|
887 |
+
echo '<div class="format-setting-inner">';
|
888 |
+
|
889 |
+
/* query posts array */
|
890 |
+
$query = new WP_Query( array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
891 |
+
|
892 |
+
/* has posts */
|
893 |
+
if ( $query->have_posts() ) {
|
894 |
+
$count = 0;
|
895 |
+
while ( $query->have_posts() ) {
|
896 |
+
$query->the_post();
|
897 |
+
echo '<p>';
|
898 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
899 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . esc_attr( get_the_title() ) . '</label>';
|
900 |
+
echo '</p>';
|
901 |
+
$count++;
|
902 |
+
}
|
903 |
+
} else {
|
904 |
+
echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
|
905 |
+
}
|
906 |
+
|
907 |
+
echo '</div>';
|
908 |
+
|
909 |
+
echo '</div>';
|
910 |
+
|
911 |
+
}
|
912 |
+
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Post Select option type.
|
917 |
+
*
|
918 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
919 |
+
*
|
920 |
+
* @param array An array of arguments.
|
921 |
+
* @return string
|
922 |
+
*
|
923 |
+
* @access public
|
924 |
+
* @since 2.0
|
925 |
+
*/
|
926 |
+
if ( ! function_exists( 'ot_type_post_select' ) ) {
|
927 |
+
|
928 |
+
function ot_type_post_select( $args = array() ) {
|
929 |
+
|
930 |
+
/* turns arguments array into variables */
|
931 |
+
extract( $args );
|
932 |
+
|
933 |
+
/* verify a description */
|
934 |
+
$has_desc = $field_desc ? true : false;
|
935 |
+
|
936 |
+
/* format setting outer wrapper */
|
937 |
+
echo '<div class="format-setting type-post-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
938 |
+
|
939 |
+
/* description */
|
940 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
941 |
+
|
942 |
+
/* format setting inner wrapper */
|
943 |
+
echo '<div class="format-setting-inner">';
|
944 |
+
|
945 |
+
/* build page select */
|
946 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
|
947 |
+
|
948 |
+
/* query posts array */
|
949 |
+
$query = new WP_Query( array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ) );
|
950 |
+
|
951 |
+
/* has posts */
|
952 |
+
if ( $query->have_posts() ) {
|
953 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
954 |
+
while ( $query->have_posts() ) {
|
955 |
+
$query->the_post();
|
956 |
+
echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
|
957 |
+
}
|
958 |
+
} else {
|
959 |
+
echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
|
960 |
+
}
|
961 |
+
echo '</select>';
|
962 |
+
|
963 |
+
echo '</div>';
|
964 |
+
|
965 |
+
echo '</div>';
|
966 |
+
|
967 |
+
}
|
968 |
+
|
969 |
+
}
|
970 |
+
|
971 |
+
/**
|
972 |
+
* Radio option type.
|
973 |
+
*
|
974 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
975 |
+
*
|
976 |
+
* @param array An array of arguments.
|
977 |
+
* @return string
|
978 |
+
*
|
979 |
+
* @access public
|
980 |
+
* @since 2.0
|
981 |
+
*/
|
982 |
+
if ( ! function_exists( 'ot_type_radio' ) ) {
|
983 |
+
|
984 |
+
function ot_type_radio( $args = array() ) {
|
985 |
+
|
986 |
+
/* turns arguments array into variables */
|
987 |
+
extract( $args );
|
988 |
+
|
989 |
+
/* verify a description */
|
990 |
+
$has_desc = $field_desc ? true : false;
|
991 |
+
|
992 |
+
/* format setting outer wrapper */
|
993 |
+
echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
994 |
+
|
995 |
+
/* description */
|
996 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
997 |
+
|
998 |
+
/* format setting inner wrapper */
|
999 |
+
echo '<div class="format-setting-inner">';
|
1000 |
+
|
1001 |
+
/* build radio */
|
1002 |
+
foreach ( (array) $field_choices as $key => $choice ) {
|
1003 |
+
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>';
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
echo '</div>';
|
1007 |
+
|
1008 |
+
echo '</div>';
|
1009 |
+
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
/**
|
1015 |
+
* Radio Images option type.
|
1016 |
+
*
|
1017 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1018 |
+
*
|
1019 |
+
* @param array An array of arguments.
|
1020 |
+
* @return string
|
1021 |
+
*
|
1022 |
+
* @access public
|
1023 |
+
* @since 2.0
|
1024 |
+
*/
|
1025 |
+
if ( ! function_exists( 'ot_type_radio_image' ) ) {
|
1026 |
+
|
1027 |
+
function ot_type_radio_image( $args = array() ) {
|
1028 |
+
|
1029 |
+
/* turns arguments array into variables */
|
1030 |
+
extract( $args );
|
1031 |
+
|
1032 |
+
/* verify a description */
|
1033 |
+
$has_desc = $field_desc ? true : false;
|
1034 |
+
|
1035 |
+
/* format setting outer wrapper */
|
1036 |
+
echo '<div class="format-setting type-radio-image ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1037 |
+
|
1038 |
+
/* description */
|
1039 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1040 |
+
|
1041 |
+
/* format setting inner wrapper */
|
1042 |
+
echo '<div class="format-setting-inner">';
|
1043 |
+
|
1044 |
+
/**
|
1045 |
+
* load the default filterable images if nothing
|
1046 |
+
* has been set in the choices array.
|
1047 |
+
*/
|
1048 |
+
if ( empty( $field_choices ) )
|
1049 |
+
$field_choices = ot_radio_images( $field_id );
|
1050 |
+
|
1051 |
+
/* build radio image */
|
1052 |
+
foreach ( (array) $field_choices as $key => $choice ) {
|
1053 |
+
echo '<div class="option-tree-ui-radio-images">';
|
1054 |
+
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>';
|
1055 |
+
echo '<img src="' . esc_url( $choice['src'] ) . '" alt="" 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' : '' ) . '" />';
|
1056 |
+
echo '</div>';
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
echo '</div>';
|
1060 |
+
|
1061 |
+
echo '</div>';
|
1062 |
+
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
/**
|
1068 |
+
* Select option type.
|
1069 |
+
*
|
1070 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1071 |
+
*
|
1072 |
+
* @param array An array of arguments.
|
1073 |
+
* @return string
|
1074 |
+
*
|
1075 |
+
* @access public
|
1076 |
+
* @since 2.0
|
1077 |
+
*/
|
1078 |
+
if ( ! function_exists( 'ot_type_select' ) ) {
|
1079 |
+
|
1080 |
+
function ot_type_select( $args = array() ) {
|
1081 |
+
|
1082 |
+
/* turns arguments array into variables */
|
1083 |
+
extract( $args );
|
1084 |
+
|
1085 |
+
/* verify a description */
|
1086 |
+
$has_desc = $field_desc ? true : false;
|
1087 |
+
|
1088 |
+
/* format setting outer wrapper */
|
1089 |
+
echo '<div class="format-setting type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1090 |
+
|
1091 |
+
/* description */
|
1092 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1093 |
+
|
1094 |
+
/* format setting inner wrapper */
|
1095 |
+
echo '<div class="format-setting-inner">';
|
1096 |
+
|
1097 |
+
/* build select */
|
1098 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1099 |
+
foreach ( (array) $field_choices as $choice ) {
|
1100 |
+
if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
|
1101 |
+
echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
|
1102 |
+
}
|
1103 |
+
}
|
1104 |
+
echo '</select>';
|
1105 |
+
|
1106 |
+
echo '</div>';
|
1107 |
+
|
1108 |
+
echo '</div>';
|
1109 |
+
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
/**
|
1115 |
+
* Tag Checkbox option type.
|
1116 |
+
*
|
1117 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1118 |
+
*
|
1119 |
+
* @param array An array of arguments.
|
1120 |
+
* @return string
|
1121 |
+
*
|
1122 |
+
* @access public
|
1123 |
+
* @since 2.0
|
1124 |
+
*/
|
1125 |
+
if ( ! function_exists( 'ot_type_tag_checkbox' ) ) {
|
1126 |
+
|
1127 |
+
function ot_type_tag_checkbox( $args = array() ) {
|
1128 |
+
|
1129 |
+
/* turns arguments array into variables */
|
1130 |
+
extract( $args );
|
1131 |
+
|
1132 |
+
/* verify a description */
|
1133 |
+
$has_desc = $field_desc ? true : false;
|
1134 |
+
|
1135 |
+
/* format setting outer wrapper */
|
1136 |
+
echo '<div class="format-setting type-tag-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1137 |
+
|
1138 |
+
/* description */
|
1139 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1140 |
+
|
1141 |
+
/* format setting inner wrapper */
|
1142 |
+
echo '<div class="format-setting-inner">';
|
1143 |
+
|
1144 |
+
/* get tags */
|
1145 |
+
$tags = get_tags( array( 'hide_empty' => false ) );
|
1146 |
+
|
1147 |
+
/* has tags */
|
1148 |
+
if ( $tags ) {
|
1149 |
+
$count = 0;
|
1150 |
+
foreach( $tags as $tag ) {
|
1151 |
+
echo '<p>';
|
1152 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( $tag->term_id ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], $tag->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
1153 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . esc_attr( $tag->name ) . '</label>';
|
1154 |
+
echo '</p>';
|
1155 |
+
$count++;
|
1156 |
+
}
|
1157 |
+
} else {
|
1158 |
+
echo '<p>' . __( 'No Tags Found', 'option-tree' ) . '</p>';
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
echo '</div>';
|
1162 |
+
|
1163 |
+
echo '</div>';
|
1164 |
+
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
/**
|
1170 |
+
* Tag Select option type.
|
1171 |
+
*
|
1172 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1173 |
+
*
|
1174 |
+
* @param array An array of arguments.
|
1175 |
+
* @return string
|
1176 |
+
*
|
1177 |
+
* @access public
|
1178 |
+
* @since 2.0
|
1179 |
+
*/
|
1180 |
+
if ( ! function_exists( 'ot_type_tag_select' ) ) {
|
1181 |
+
|
1182 |
+
function ot_type_tag_select( $args = array() ) {
|
1183 |
+
|
1184 |
+
/* turns arguments array into variables */
|
1185 |
+
extract( $args );
|
1186 |
+
|
1187 |
+
/* verify a description */
|
1188 |
+
$has_desc = $field_desc ? true : false;
|
1189 |
+
|
1190 |
+
/* format setting outer wrapper */
|
1191 |
+
echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1192 |
+
|
1193 |
+
/* description */
|
1194 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1195 |
+
|
1196 |
+
/* format setting inner wrapper */
|
1197 |
+
echo '<div class="format-setting-inner">';
|
1198 |
+
|
1199 |
+
/* build tag select */
|
1200 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
|
1201 |
+
|
1202 |
+
/* get tags */
|
1203 |
+
$tags = get_tags( array( 'hide_empty' => false ) );
|
1204 |
+
|
1205 |
+
/* has tags */
|
1206 |
+
if ( $tags ) {
|
1207 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
1208 |
+
foreach( $tags as $tag ) {
|
1209 |
+
echo '<option value="' . esc_attr( $tag->term_id ) . '"' . selected( $field_value, $tag->term_id, false ) . '>' . esc_attr( $tag->name ) . '</option>';
|
1210 |
+
}
|
1211 |
+
} else {
|
1212 |
+
echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
|
1213 |
+
}
|
1214 |
+
echo '</select>';
|
1215 |
+
|
1216 |
+
echo '</div>';
|
1217 |
+
|
1218 |
+
echo '</div>';
|
1219 |
+
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
/**
|
1225 |
+
* Taxonomy 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_taxonomy_checkbox' ) ) {
|
1236 |
+
|
1237 |
+
function ot_type_taxonomy_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-taxonomy-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 |
+
/* setup the taxonomy */
|
1255 |
+
$taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
|
1256 |
+
|
1257 |
+
/* get taxonomies */
|
1258 |
+
$taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
|
1259 |
+
|
1260 |
+
/* has tags */
|
1261 |
+
if ( $taxonomies ) {
|
1262 |
+
$count = 0;
|
1263 |
+
foreach( $taxonomies as $taxonomy ) {
|
1264 |
+
echo '<p>';
|
1265 |
+
echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $count ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '" value="' . esc_attr( $taxonomy->term_id ) . '" ' . ( isset( $field_value[$count] ) ? checked( $field_value[$count], $taxonomy->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
|
1266 |
+
echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $count ) . '">' . esc_attr( $taxonomy->name ) . '</label>';
|
1267 |
+
echo '</p>';
|
1268 |
+
$count++;
|
1269 |
+
}
|
1270 |
+
} else {
|
1271 |
+
echo '<p>' . __( 'No Taxonomies Found', 'option-tree' ) . '</p>';
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
echo '</div>';
|
1275 |
+
|
1276 |
+
echo '</div>';
|
1277 |
+
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
/**
|
1283 |
+
* Taxonomy Select option type.
|
1284 |
+
*
|
1285 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1286 |
+
*
|
1287 |
+
* @param array An array of arguments.
|
1288 |
+
* @return string
|
1289 |
+
*
|
1290 |
+
* @access public
|
1291 |
+
* @since 2.0
|
1292 |
+
*/
|
1293 |
+
if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
|
1294 |
+
|
1295 |
+
function ot_type_taxonomy_select( $args = array() ) {
|
1296 |
+
|
1297 |
+
/* turns arguments array into variables */
|
1298 |
+
extract( $args );
|
1299 |
+
|
1300 |
+
/* verify a description */
|
1301 |
+
$has_desc = $field_desc ? true : false;
|
1302 |
+
|
1303 |
+
/* format setting outer wrapper */
|
1304 |
+
echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1305 |
+
|
1306 |
+
/* description */
|
1307 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1308 |
+
|
1309 |
+
/* format setting inner wrapper */
|
1310 |
+
echo '<div class="format-setting-inner">';
|
1311 |
+
|
1312 |
+
/* build tag select */
|
1313 |
+
echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
|
1314 |
+
|
1315 |
+
/* setup the taxonomy */
|
1316 |
+
$taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
|
1317 |
+
|
1318 |
+
/* get taxonomies */
|
1319 |
+
$taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
|
1320 |
+
|
1321 |
+
/* has tags */
|
1322 |
+
if ( $taxonomies ) {
|
1323 |
+
echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
|
1324 |
+
foreach( $taxonomies as $taxonomy ) {
|
1325 |
+
echo '<option value="' . esc_attr( $taxonomy->term_id ) . '"' . selected( $field_value, $taxonomy->term_id, false ) . '>' . esc_attr( $taxonomy->name ) . '</option>';
|
1326 |
+
}
|
1327 |
+
} else {
|
1328 |
+
echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
|
1329 |
+
}
|
1330 |
+
echo '</select>';
|
1331 |
+
|
1332 |
+
echo '</div>';
|
1333 |
+
|
1334 |
+
echo '</div>';
|
1335 |
+
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
/**
|
1341 |
+
* Text option type.
|
1342 |
+
*
|
1343 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1344 |
+
*
|
1345 |
+
* @param array An array of arguments.
|
1346 |
+
* @return string
|
1347 |
+
*
|
1348 |
+
* @access public
|
1349 |
+
* @since 2.0
|
1350 |
+
*/
|
1351 |
+
if ( ! function_exists( 'ot_type_text' ) ) {
|
1352 |
+
|
1353 |
+
function ot_type_text( $args = array() ) {
|
1354 |
+
|
1355 |
+
/* turns arguments array into variables */
|
1356 |
+
extract( $args );
|
1357 |
+
|
1358 |
+
/* verify a description */
|
1359 |
+
$has_desc = $field_desc ? true : false;
|
1360 |
+
|
1361 |
+
/* format setting outer wrapper */
|
1362 |
+
echo '<div class="format-setting type-text ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1363 |
+
|
1364 |
+
/* description */
|
1365 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1366 |
+
|
1367 |
+
/* format setting inner wrapper */
|
1368 |
+
echo '<div class="format-setting-inner">';
|
1369 |
+
|
1370 |
+
/* build text input */
|
1371 |
+
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 ) . '" />';
|
1372 |
+
|
1373 |
+
echo '</div>';
|
1374 |
+
|
1375 |
+
echo '</div>';
|
1376 |
+
|
1377 |
+
}
|
1378 |
+
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
/**
|
1382 |
+
* Textarea option type.
|
1383 |
+
*
|
1384 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1385 |
+
*
|
1386 |
+
* @param array An array of arguments.
|
1387 |
+
* @return string
|
1388 |
+
*
|
1389 |
+
* @access public
|
1390 |
+
* @since 2.0
|
1391 |
+
*/
|
1392 |
+
if ( ! function_exists( 'ot_type_textarea' ) ) {
|
1393 |
+
|
1394 |
+
function ot_type_textarea( $args = array() ) {
|
1395 |
+
|
1396 |
+
/* turns arguments array into variables */
|
1397 |
+
extract( $args );
|
1398 |
+
|
1399 |
+
/* verify a description */
|
1400 |
+
$has_desc = $field_desc ? true : false;
|
1401 |
+
|
1402 |
+
/* format setting outer wrapper */
|
1403 |
+
echo '<div class="format-setting type-textarea ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . ' fill-area">';
|
1404 |
+
|
1405 |
+
/* description */
|
1406 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1407 |
+
|
1408 |
+
/* format setting inner wrapper */
|
1409 |
+
echo '<div class="format-setting-inner">';
|
1410 |
+
|
1411 |
+
/* build textarea */
|
1412 |
+
wp_editor(
|
1413 |
+
$field_value,
|
1414 |
+
esc_attr( $field_id ),
|
1415 |
+
array(
|
1416 |
+
'wpautop' => apply_filters( 'ot_wpautop', false, $field_id ),
|
1417 |
+
'media_buttons' => apply_filters( 'ot_media_buttons', true, $field_id ),
|
1418 |
+
'textarea_name' => esc_attr( $field_name ),
|
1419 |
+
'textarea_rows' => esc_attr( $field_rows ),
|
1420 |
+
'tinymce' => apply_filters( 'ot_tinymce', true, $field_id ),
|
1421 |
+
'quicktags' => apply_filters( 'ot_quicktags', array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ), $field_id )
|
1422 |
+
)
|
1423 |
+
);
|
1424 |
+
|
1425 |
+
echo '</div>';
|
1426 |
+
|
1427 |
+
echo '</div>';
|
1428 |
+
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
/**
|
1434 |
+
* Textarea Simple option type.
|
1435 |
+
*
|
1436 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1437 |
+
*
|
1438 |
+
* @param array An array of arguments.
|
1439 |
+
* @return string
|
1440 |
+
*
|
1441 |
+
* @access public
|
1442 |
+
* @since 2.0
|
1443 |
+
*/
|
1444 |
+
if ( ! function_exists( 'ot_type_textarea_simple' ) ) {
|
1445 |
+
|
1446 |
+
function ot_type_textarea_simple( $args = array() ) {
|
1447 |
+
|
1448 |
+
/* turns arguments array into variables */
|
1449 |
+
extract( $args );
|
1450 |
+
|
1451 |
+
/* verify a description */
|
1452 |
+
$has_desc = $field_desc ? true : false;
|
1453 |
+
|
1454 |
+
/* format setting outer wrapper */
|
1455 |
+
echo '<div class="format-setting type-textarea simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1456 |
+
|
1457 |
+
/* description */
|
1458 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1459 |
+
|
1460 |
+
/* format setting inner wrapper */
|
1461 |
+
echo '<div class="format-setting-inner">';
|
1462 |
+
|
1463 |
+
/* build textarea simple */
|
1464 |
+
wp_editor(
|
1465 |
+
$field_value,
|
1466 |
+
esc_attr( $field_id ),
|
1467 |
+
array(
|
1468 |
+
'wpautop' => apply_filters( 'ot_wpautop', false, $field_id ),
|
1469 |
+
'media_buttons' => false,
|
1470 |
+
'textarea_name' => esc_attr( $field_name ),
|
1471 |
+
'textarea_rows' => esc_attr( $field_rows ),
|
1472 |
+
'tinymce' => false,
|
1473 |
+
'quicktags' => false
|
1474 |
+
)
|
1475 |
+
);
|
1476 |
+
|
1477 |
+
echo '</div>';
|
1478 |
+
|
1479 |
+
echo '</div>';
|
1480 |
+
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
/**
|
1486 |
+
* Textblock option type.
|
1487 |
+
*
|
1488 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1489 |
+
*
|
1490 |
+
* @param array An array of arguments.
|
1491 |
+
* @return string
|
1492 |
+
*
|
1493 |
+
* @access public
|
1494 |
+
* @since 2.0
|
1495 |
+
*/
|
1496 |
+
if ( ! function_exists( 'ot_type_textblock' ) ) {
|
1497 |
+
|
1498 |
+
function ot_type_textblock( $args = array() ) {
|
1499 |
+
|
1500 |
+
/* turns arguments array into variables */
|
1501 |
+
extract( $args );
|
1502 |
+
|
1503 |
+
/* format setting outer wrapper */
|
1504 |
+
echo '<div class="format-setting type-textblock wide-desc">';
|
1505 |
+
|
1506 |
+
/* description */
|
1507 |
+
echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
|
1508 |
+
|
1509 |
+
echo '</div>';
|
1510 |
+
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
/**
|
1516 |
+
* Textblock Titled option type.
|
1517 |
+
*
|
1518 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1519 |
+
*
|
1520 |
+
* @param array An array of arguments.
|
1521 |
+
* @return string
|
1522 |
+
*
|
1523 |
+
* @access public
|
1524 |
+
* @since 2.0
|
1525 |
+
*/
|
1526 |
+
if ( ! function_exists( 'ot_type_textblock_titled' ) ) {
|
1527 |
+
|
1528 |
+
function ot_type_textblock_titled( $args = array() ) {
|
1529 |
+
|
1530 |
+
/* turns arguments array into variables */
|
1531 |
+
extract( $args );
|
1532 |
+
|
1533 |
+
/* format setting outer wrapper */
|
1534 |
+
echo '<div class="format-setting type-textblock titled wide-desc">';
|
1535 |
+
|
1536 |
+
/* description */
|
1537 |
+
echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
|
1538 |
+
|
1539 |
+
echo '</div>';
|
1540 |
+
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
}
|
1544 |
+
|
1545 |
+
/**
|
1546 |
+
* Typography option type.
|
1547 |
+
*
|
1548 |
+
* See @ot_display_by_type to see the full list of available arguments.
|
1549 |
+
*
|
1550 |
+
* @param array An array of arguments.
|
1551 |
+
* @return string
|
1552 |
+
*
|
1553 |
+
* @access public
|
1554 |
+
* @since 2.0
|
1555 |
+
*/
|
1556 |
+
if ( ! function_exists( 'ot_type_typography' ) ) {
|
1557 |
+
|
1558 |
+
function ot_type_typography( $args = array() ) {
|
1559 |
+
|
1560 |
+
/* turns arguments array into variables */
|
1561 |
+
extract( $args );
|
1562 |
+
|
1563 |
+
/* verify a description */
|
1564 |
+
$has_desc = $field_desc ? true : false;
|
1565 |
+
|
1566 |
+
/* format setting outer wrapper */
|
1567 |
+
echo '<div class="format-setting type-typography ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
|
1568 |
+
|
1569 |
+
/* description */
|
1570 |
+
echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
|
1571 |
+
|
1572 |
+
/* format setting inner wrapper */
|
1573 |
+
echo '<div class="format-setting-inner">';
|
1574 |
+
|
1575 |
+
/* build background colorpicker */
|
1576 |
+
echo '<div class="option-tree-ui-colorpicker-input-wrap">';
|
1577 |
+
|
1578 |
+
/* colorpicker JS */
|
1579 |
+
echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
|
1580 |
+
|
1581 |
+
/* set background color */
|
1582 |
+
$background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
|
1583 |
+
|
1584 |
+
/* set border color */
|
1585 |
+
$border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color;
|
1586 |
+
|
1587 |
+
/* input */
|
1588 |
+
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" />';
|
1589 |
+
|
1590 |
+
echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>';
|
1591 |
+
|
1592 |
+
echo '</div>';
|
1593 |
+
|
1594 |
+
/* build font family */
|
1595 |
+
$font_family = isset( $field_value['font-family'] ) ? esc_attr( $field_value['font-family'] ) : '';
|
1596 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-family]" id="' . esc_attr( $field_id ) . '-family" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1597 |
+
echo '<option value="">font-family</option>';
|
1598 |
+
foreach ( ot_recognized_font_families( $field_id ) as $key => $value ) {
|
1599 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_family, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1600 |
+
}
|
1601 |
+
echo '</select>';
|
1602 |
+
|
1603 |
+
/* build font style */
|
1604 |
+
$font_style = isset( $field_value['font-style'] ) ? esc_attr( $field_value['font-style'] ) : '';
|
1605 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-style]" id="' . esc_attr( $field_id ) . '-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1606 |
+
echo '<option value="">font-style</option>';
|
1607 |
+
foreach ( ot_recognized_font_styles( $field_id ) as $key => $value ) {
|
1608 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_style, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1609 |
+
}
|
1610 |
+
echo '</select>';
|
1611 |
+
|
1612 |
+
/* build font variant */
|
1613 |
+
$font_variant = isset( $field_value['font-variant'] ) ? esc_attr( $field_value['font-variant'] ) : '';
|
1614 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-variant]" id="' . esc_attr( $field_id ) . '-variant" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1615 |
+
echo '<option value="">font-variant</option>';
|
1616 |
+
foreach ( ot_recognized_font_variants( $field_id ) as $key => $value ) {
|
1617 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_variant, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1618 |
+
}
|
1619 |
+
echo '</select>';
|
1620 |
+
|
1621 |
+
/* build font weight */
|
1622 |
+
$font_weight = isset( $field_value['font-weight'] ) ? esc_attr( $field_value['font-weight'] ) : '';
|
1623 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-weight]" id="' . esc_attr( $field_id ) . '-weight" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1624 |
+
echo '<option value="">font-weight</option>';
|
1625 |
+
foreach ( ot_recognized_font_weights( $field_id ) as $key => $value ) {
|
1626 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_weight, $key, false ) . '>' . esc_attr( $value ) . '</option>';
|
1627 |
+
}
|
1628 |
+
echo '</select>';
|
1629 |
+
|
1630 |
+
/* build font size */
|
1631 |
+
$font_size = isset( $field_value['font-size'] ) ? esc_attr( $field_value['font-size'] ) : '';
|
1632 |
+
echo '<select name="' . esc_attr( $field_name ) . '[font-size]" id="' . esc_attr( $field_id ) . '-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
|
1633 |
+
echo '<option value="">font-size</option>';
|
1634 |
+
for ( $i = 8; $i <= 72; $i++ ) {
|
1635 |
+
$size = $i . 'px';
|
1636 |
+
echo '<option value="' . esc_attr( $size ) . '" ' . selected( $font_size, $size, false ) . '>' . esc_attr( $size ) . '</option>';
|
1637 |
+
}
|
1638 |
+
echo '</select>';
|
1639 |
+
|
1640 |
+
echo '</div>';
|
1641 |
+
|
1642 |
+
echo '</div>';
|
1643 |
+
|
1644 |
+
}
|
1645 |
+
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
/**
|
1649 |
+
* Upload 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_upload' ) ) {
|
1660 |
+
|
1661 |
+
function ot_type_upload( $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-upload ' . ( $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 |
+
/* build upload */
|
1679 |
+
echo '<div class="option-tree-ui-upload-parent">';
|
1680 |
+
|
1681 |
+
/* input */
|
1682 |
+
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 ) . '" />';
|
1683 |
+
|
1684 |
+
/* add media button */
|
1685 |
+
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>';
|
1686 |
+
|
1687 |
+
echo '</div>';
|
1688 |
+
|
1689 |
+
/* media */
|
1690 |
+
if ( $field_value ) {
|
1691 |
+
|
1692 |
+
echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
|
1693 |
+
|
1694 |
+
if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value ) )
|
1695 |
+
echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value ) . '" alt="" /></div>';
|
1696 |
+
|
1697 |
+
echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon trash-can">' . __( 'Remove Media', 'option-tree' ) . '</span></a>';
|
1698 |
+
|
1699 |
+
echo '</div>';
|
1700 |
+
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
echo '</div>';
|
1704 |
+
|
1705 |
+
echo '</div>';
|
1706 |
+
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
/* End of file ot-functions-option-types.php */
|
1712 |
+
/* Location: ./includes/ot-functions-option-types.php */
|
includes/ot-functions-settings-page.php
ADDED
@@ -0,0 +1,529 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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 blue hug-left">' . __( 'Add Section', 'option-tree' ) . '</a>';
|
93 |
+
echo '<a href="javascript:void(0);" class="option-tree-setting-add blue option-tree-ui-button">' . __( 'Add Setting', 'option-tree' ) . '</a>';
|
94 |
+
echo '<button class="option-tree-ui-button grey 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 blue option-tree-ui-button hug-left">' . __( 'Add Contextual Help Content', 'option-tree' ) . '</a>';
|
133 |
+
echo '<button class="option-tree-ui-button grey 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-settings-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 grey 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 grey 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 |
+
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 grey 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-data-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 |
+
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 grey 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 option type.
|
344 |
+
*
|
345 |
+
* @return string
|
346 |
+
*
|
347 |
+
* @access public
|
348 |
+
* @since 2.0
|
349 |
+
*/
|
350 |
+
if ( ! function_exists( 'ot_type_export_settings' ) ) {
|
351 |
+
|
352 |
+
function ot_type_export_settings() {
|
353 |
+
|
354 |
+
/* format setting outer wrapper */
|
355 |
+
echo '<div class="format-setting type-textarea simple has-desc">';
|
356 |
+
|
357 |
+
/* description */
|
358 |
+
echo '<div class="description">';
|
359 |
+
|
360 |
+
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>';
|
361 |
+
|
362 |
+
echo '</div>';
|
363 |
+
|
364 |
+
/* get theme options data */
|
365 |
+
$settings = get_option( 'option_tree_settings' );
|
366 |
+
$settings = ! empty( $settings ) ? base64_encode( serialize( $settings ) ) : '';
|
367 |
+
|
368 |
+
echo '<div class="format-setting-inner">';
|
369 |
+
echo '<form action="options.php" method="post" id="option-tree-settings-api">';
|
370 |
+
echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>';
|
371 |
+
echo '</form>';
|
372 |
+
echo '</div>';
|
373 |
+
|
374 |
+
echo '</div>';
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Export Data option type.
|
382 |
+
*
|
383 |
+
* @return string
|
384 |
+
*
|
385 |
+
* @access public
|
386 |
+
* @since 2.0
|
387 |
+
*/
|
388 |
+
if ( ! function_exists( 'ot_type_export_data' ) ) {
|
389 |
+
|
390 |
+
function ot_type_export_data() {
|
391 |
+
|
392 |
+
/* format setting outer wrapper */
|
393 |
+
echo '<div class="format-setting type-textarea simple has-desc">';
|
394 |
+
|
395 |
+
/* description */
|
396 |
+
echo '<div class="description">';
|
397 |
+
|
398 |
+
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>';
|
399 |
+
|
400 |
+
echo '</div>';
|
401 |
+
|
402 |
+
/* get theme options data */
|
403 |
+
$data = get_option( 'option_tree' );
|
404 |
+
$data = ! empty( $data ) ? base64_encode( serialize( $data ) ) : '';
|
405 |
+
|
406 |
+
echo '<div class="format-setting-inner">';
|
407 |
+
echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>';
|
408 |
+
echo '</div>';
|
409 |
+
|
410 |
+
echo '</div>';
|
411 |
+
|
412 |
+
}
|
413 |
+
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Export Layouts option type.
|
418 |
+
*
|
419 |
+
* @return string
|
420 |
+
*
|
421 |
+
* @access public
|
422 |
+
* @since 2.0
|
423 |
+
*/
|
424 |
+
if ( ! function_exists( 'ot_type_export_layouts' ) ) {
|
425 |
+
|
426 |
+
function ot_type_export_layouts() {
|
427 |
+
|
428 |
+
/* format setting outer wrapper */
|
429 |
+
echo '<div class="format-setting type-textarea simple has-desc">';
|
430 |
+
|
431 |
+
/* description */
|
432 |
+
echo '<div class="description">';
|
433 |
+
|
434 |
+
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>';
|
435 |
+
|
436 |
+
|
437 |
+
echo '</div>';
|
438 |
+
|
439 |
+
/* get layout data */
|
440 |
+
$layouts = get_option( 'option_tree_layouts' );
|
441 |
+
$layouts = ! empty( $layouts ) ? base64_encode( serialize( $layouts ) ) : '';
|
442 |
+
|
443 |
+
echo '<div class="format-setting-inner">';
|
444 |
+
echo '<textarea rows="10" cols="40" name="export_layouts" id="export_layouts" class="textarea">' . $layouts . '</textarea>';
|
445 |
+
echo '</div>';
|
446 |
+
|
447 |
+
echo '</div>';
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Modify Layouts option type.
|
455 |
+
*
|
456 |
+
* @return string
|
457 |
+
*
|
458 |
+
* @access public
|
459 |
+
* @since 2.0
|
460 |
+
*/
|
461 |
+
if ( ! function_exists( 'ot_type_modify_layouts' ) ) {
|
462 |
+
|
463 |
+
function ot_type_modify_layouts() {
|
464 |
+
|
465 |
+
echo '<form method="post" id="option-tree-settings-form">';
|
466 |
+
|
467 |
+
/* form nonce */
|
468 |
+
wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' );
|
469 |
+
|
470 |
+
/* format setting outer wrapper */
|
471 |
+
echo '<div class="format-setting type-textarea has-desc">';
|
472 |
+
|
473 |
+
/* description */
|
474 |
+
echo '<div class="description">';
|
475 |
+
|
476 |
+
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>';
|
477 |
+
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>';
|
478 |
+
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>';
|
479 |
+
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>';
|
480 |
+
|
481 |
+
echo '</div>';
|
482 |
+
|
483 |
+
echo '<div class="format-setting-inner">';
|
484 |
+
|
485 |
+
/* get the saved layouts */
|
486 |
+
$layouts = get_option( 'option_tree_layouts' );
|
487 |
+
|
488 |
+
/* set active layout */
|
489 |
+
$active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : '';
|
490 |
+
|
491 |
+
echo '<input type="hidden" name="option_tree_layouts[active_layout]" value="' . esc_attr( $active_layout ) . '" class="active-layout-input" />';
|
492 |
+
|
493 |
+
/* add new layout */
|
494 |
+
echo '<input type="text" name="option_tree_layouts[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
|
495 |
+
|
496 |
+
/* loop through each layout */
|
497 |
+
echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_layouts">';
|
498 |
+
|
499 |
+
if ( is_array( $layouts ) && ! empty( $layouts ) ) {
|
500 |
+
|
501 |
+
foreach( $layouts as $key => $data ) {
|
502 |
+
|
503 |
+
/* skip active layout array */
|
504 |
+
if ( $key == 'active_layout' )
|
505 |
+
continue;
|
506 |
+
|
507 |
+
/* content */
|
508 |
+
echo '<li class="ui-state-default list-layouts">' . ot_layout_view( $key, $data, $active_layout ) . '</li>';
|
509 |
+
|
510 |
+
}
|
511 |
+
|
512 |
+
}
|
513 |
+
|
514 |
+
echo '</ul>';
|
515 |
+
|
516 |
+
echo '<button class="option-tree-ui-button grey right hug-right">' . __( 'Save Layouts', 'option-tree' ) . '</button>';
|
517 |
+
|
518 |
+
echo '</div>';
|
519 |
+
|
520 |
+
echo '</div>';
|
521 |
+
|
522 |
+
echo '</form>';
|
523 |
+
|
524 |
+
}
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
+
/* End of file ot-functions-settings-page.php */
|
529 |
+
/* Location: ./includes/ot-functions-settings-page.php */
|
includes/ot-functions.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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 |
+
return $options[$option_id];
|
34 |
+
}
|
35 |
+
|
36 |
+
return $default;
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Enqueue the dynamic CSS.
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*
|
47 |
+
* @access public
|
48 |
+
* @since 2.0
|
49 |
+
*/
|
50 |
+
if ( ! function_exists( 'ot_load_dynamic_css' ) ) {
|
51 |
+
|
52 |
+
function ot_load_dynamic_css() {
|
53 |
+
|
54 |
+
/* don't load in the admin */
|
55 |
+
if ( is_admin() )
|
56 |
+
return;
|
57 |
+
|
58 |
+
/* grab a copy of the paths */
|
59 |
+
$ot_css_file_paths = get_option( 'ot_css_file_paths', array() );
|
60 |
+
|
61 |
+
if ( ! empty( $ot_css_file_paths ) ) {
|
62 |
+
|
63 |
+
$last_css = '';
|
64 |
+
|
65 |
+
/* loop through paths */
|
66 |
+
foreach( $ot_css_file_paths as $key => $path ) {
|
67 |
+
|
68 |
+
if ( '' != $path && file_exists( $path ) ) {
|
69 |
+
|
70 |
+
$parts = explode( '/wp-content', $path );
|
71 |
+
|
72 |
+
if ( isset( $parts[1] ) ) {
|
73 |
+
|
74 |
+
$css = home_url( '/wp-content' . $parts[1] );
|
75 |
+
|
76 |
+
if ( $last_css !== $css ) {
|
77 |
+
|
78 |
+
/* enqueue filtered file */
|
79 |
+
wp_enqueue_style( 'ot-dynamic-' . $key, $css, false, OT_VERSION );
|
80 |
+
|
81 |
+
$last_css = $css;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/* End of file ot-functions.php */
|
98 |
+
/* Location: ./includes/ot-functions.php */
|
includes/ot-meta-box-api.php
ADDED
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'TEMPLATEPATH') ) 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) 2012, 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'] ) ? '<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 default to standard value */
|
83 |
+
if ( '' == $field_value && isset( $field['std'] ) ) {
|
84 |
+
$field_value = trim( $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_class' => isset( $field['class'] ) ? $field['class'] : '',
|
99 |
+
'field_choices' => isset( $field['choices'] ) ? $field['choices'] : array(),
|
100 |
+
'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
|
101 |
+
'post_id' => $post->ID,
|
102 |
+
'meta' => true
|
103 |
+
);
|
104 |
+
|
105 |
+
/* only allow simple textarea due to DOM issues with wp_editor() */
|
106 |
+
if ( $_args['type'] == 'textarea' )
|
107 |
+
$_args['type'] = 'textarea-simple';
|
108 |
+
|
109 |
+
/* option label */
|
110 |
+
echo '<div class="format-settings">';
|
111 |
+
echo '<div class="format-setting-label">';
|
112 |
+
echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>';
|
113 |
+
echo '</div>';
|
114 |
+
|
115 |
+
/* get the option HTML */
|
116 |
+
echo ot_display_by_type( $_args );
|
117 |
+
|
118 |
+
echo '</div>';
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
echo '</div>';
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Saves the meta box values
|
128 |
+
*
|
129 |
+
* @return void
|
130 |
+
*
|
131 |
+
* @access public
|
132 |
+
* @since 1.0
|
133 |
+
*/
|
134 |
+
function save_meta_box( $post_id, $post_object ) {
|
135 |
+
global $pagenow;
|
136 |
+
|
137 |
+
/* don't save during quick edit */
|
138 |
+
if ( $pagenow == 'admin-ajax.php' )
|
139 |
+
return $post_id;
|
140 |
+
|
141 |
+
/* don't save during autosave */
|
142 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
143 |
+
return $post_id;
|
144 |
+
|
145 |
+
/* don't save if viewing a revision */
|
146 |
+
if ( $post_object->post_type == 'revision' )
|
147 |
+
return $post_id;
|
148 |
+
|
149 |
+
/* verify nonce */
|
150 |
+
if ( isset( $_POST[ $this->meta_box['id'] . '_nonce'] ) && ! wp_verify_nonce( $_POST[ $this->meta_box['id'] . '_nonce'], $this->meta_box['id'] ) )
|
151 |
+
return $post_id;
|
152 |
+
|
153 |
+
/* check permissions */
|
154 |
+
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
155 |
+
if ( ! current_user_can( 'edit_page', $post_id ) )
|
156 |
+
return $post_id;
|
157 |
+
} else {
|
158 |
+
if ( ! current_user_can( 'edit_post', $post_id ) )
|
159 |
+
return $post_id;
|
160 |
+
}
|
161 |
+
|
162 |
+
foreach ( $this->meta_box['fields'] as $field ) {
|
163 |
+
|
164 |
+
$old = get_post_meta( $post_id, $field['id'], true );
|
165 |
+
$new = '';
|
166 |
+
|
167 |
+
/* there is data to validate */
|
168 |
+
if ( isset( $_POST[$field['id']] ) ) {
|
169 |
+
|
170 |
+
/* slider and list item */
|
171 |
+
if ( in_array( $field['type'], array( 'list-item', 'slider' ) ) ) {
|
172 |
+
|
173 |
+
/* required title setting */
|
174 |
+
$required_setting = array(
|
175 |
+
array(
|
176 |
+
'id' => 'title',
|
177 |
+
'label' => __( 'Title', 'option-tree' ),
|
178 |
+
'desc' => '',
|
179 |
+
'std' => '',
|
180 |
+
'type' => 'text',
|
181 |
+
'rows' => '',
|
182 |
+
'class' => 'option-tree-setting-title',
|
183 |
+
'post_type' => '',
|
184 |
+
'choices' => array()
|
185 |
+
)
|
186 |
+
);
|
187 |
+
|
188 |
+
/* get the settings array */
|
189 |
+
$settings = isset( $_POST[$field['id'] . '_settings_array'] ) ? unserialize( base64_decode( $_POST[$field['id'] . '_settings_array'] ) ) : array();
|
190 |
+
|
191 |
+
/* settings are empty for some odd ass reason get the defaults */
|
192 |
+
if ( empty( $settings ) ) {
|
193 |
+
$settings = 'slider' == $field['type'] ?
|
194 |
+
ot_slider_settings( $field['id'] ) :
|
195 |
+
ot_list_item_settings( $field['id'] );
|
196 |
+
}
|
197 |
+
|
198 |
+
/* merge the two settings array */
|
199 |
+
$settings = array_merge( $required_setting, $settings );
|
200 |
+
|
201 |
+
foreach( $_POST[$field['id']] as $k => $setting_array ) {
|
202 |
+
|
203 |
+
foreach( $settings as $sub_setting ) {
|
204 |
+
|
205 |
+
/* verify sub setting has a type & value */
|
206 |
+
if ( isset( $sub_setting['type'] ) && isset( $_POST[$field['id']][$k][$sub_setting['id']] ) ) {
|
207 |
+
|
208 |
+
$_POST[$field['id']][$k][$sub_setting['id']] = ot_validate_setting( $_POST[$field['id']][$k][$sub_setting['id']], $sub_setting['type'] );
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/* set up new data with validated data */
|
217 |
+
$new = $_POST[$field['id']];
|
218 |
+
|
219 |
+
} else {
|
220 |
+
|
221 |
+
/* run through validattion */
|
222 |
+
$new = ot_validate_setting( $_POST[$field['id']], $field['type'] );
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
/* insert CSS */
|
227 |
+
if ( $field['type'] == 'css' ) {
|
228 |
+
|
229 |
+
/* insert CSS into dynamic.css */
|
230 |
+
if ( '' !== $new ) {
|
231 |
+
|
232 |
+
ot_insert_css_with_markers( $field['id'], $new );
|
233 |
+
|
234 |
+
/* remove old CSS from dynamic.css */
|
235 |
+
} else {
|
236 |
+
|
237 |
+
ot_remove_old_css( $field['id'] );
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
if ( $new && $new !== $old ) {
|
246 |
+
update_post_meta( $post_id, $field['id'], $new );
|
247 |
+
} else if ( '' == $new && $old ) {
|
248 |
+
delete_post_meta( $post_id, $field['id'], $old );
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
}
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* This method instantiates the meta box class & builds the UI.
|
260 |
+
*
|
261 |
+
* @uses OT_Meta_Box()
|
262 |
+
*
|
263 |
+
* @param array Array of arguments to create a meta box
|
264 |
+
* @return void
|
265 |
+
*
|
266 |
+
* @access public
|
267 |
+
* @since 2.0
|
268 |
+
*/
|
269 |
+
if ( ! function_exists( 'ot_register_meta_box' ) ) {
|
270 |
+
|
271 |
+
function ot_register_meta_box( $args ) {
|
272 |
+
if ( ! $args )
|
273 |
+
return;
|
274 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2012, 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 |
+
/* load page in WP top level menu */
|
87 |
+
if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
|
88 |
+
$page_hook = add_menu_page(
|
89 |
+
$page['page_title'],
|
90 |
+
$page['menu_title'],
|
91 |
+
$page['capability'],
|
92 |
+
$page['menu_slug'],
|
93 |
+
array( &$this, 'display_page' ),
|
94 |
+
$page['icon_url'],
|
95 |
+
$page['position']
|
96 |
+
);
|
97 |
+
/* load page in WP sub menu */
|
98 |
+
} else {
|
99 |
+
$page_hook = add_submenu_page(
|
100 |
+
$page['parent_slug'],
|
101 |
+
$page['page_title'],
|
102 |
+
$page['menu_title'],
|
103 |
+
$page['capability'],
|
104 |
+
$page['menu_slug'],
|
105 |
+
array( &$this, 'display_page' )
|
106 |
+
);
|
107 |
+
}
|
108 |
+
|
109 |
+
/* only load if not a hidden page */
|
110 |
+
if ( ! isset( $page['hidden_page'] ) ) {
|
111 |
+
|
112 |
+
/* associate $page_hook with page id */
|
113 |
+
$this->page_hook[$page['id']] = $page_hook;
|
114 |
+
|
115 |
+
/* add scripts */
|
116 |
+
add_action( 'admin_print_scripts-' . $page_hook, array( &$this, 'scripts' ) );
|
117 |
+
|
118 |
+
/* add styles */
|
119 |
+
add_action( 'admin_print_styles-' . $page_hook, array( &$this, 'styles' ) );
|
120 |
+
|
121 |
+
/* add contextual help */
|
122 |
+
add_action( 'load-' . $page_hook, array( &$this, 'help' ) );
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Loads the scripts
|
135 |
+
*
|
136 |
+
* @return void
|
137 |
+
*
|
138 |
+
* @access public
|
139 |
+
* @since 2.0
|
140 |
+
*/
|
141 |
+
public function scripts() {
|
142 |
+
ot_admin_scripts();
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Loads the styles
|
147 |
+
*
|
148 |
+
* @return void
|
149 |
+
*
|
150 |
+
* @access public
|
151 |
+
* @since 2.0
|
152 |
+
*/
|
153 |
+
public function styles() {
|
154 |
+
ot_admin_styles();
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Loads the contextual help for each page
|
159 |
+
*
|
160 |
+
* @return void
|
161 |
+
*
|
162 |
+
* @access public
|
163 |
+
* @since 2.0
|
164 |
+
*/
|
165 |
+
public function help() {
|
166 |
+
$screen = get_current_screen();
|
167 |
+
|
168 |
+
/* loop through options */
|
169 |
+
foreach( (array) $this->options as $option ) {
|
170 |
+
|
171 |
+
/* loop through pages */
|
172 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
173 |
+
|
174 |
+
/* verify page */
|
175 |
+
if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
|
176 |
+
|
177 |
+
/* set up the help tabs */
|
178 |
+
if ( ! empty( $page['contextual_help']['content'] ) ) {
|
179 |
+
foreach( $page['contextual_help']['content'] as $contextual_help ) {
|
180 |
+
$screen->add_help_tab(
|
181 |
+
array(
|
182 |
+
'id' => esc_attr( $contextual_help['id'] ),
|
183 |
+
'title' => esc_attr( $contextual_help['title'] ),
|
184 |
+
'content' => htmlspecialchars_decode( $contextual_help['content'] ),
|
185 |
+
)
|
186 |
+
);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
/* set up the help sidebar */
|
191 |
+
if ( ! empty( $page['contextual_help']['sidebar'] ) ) {
|
192 |
+
$screen->set_help_sidebar( htmlspecialchars_decode( $page['contextual_help']['sidebar'] ) );
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
return false;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Loads the content for each page
|
206 |
+
*
|
207 |
+
* @return string
|
208 |
+
*
|
209 |
+
* @access public
|
210 |
+
* @since 2.0
|
211 |
+
*/
|
212 |
+
public function display_page() {
|
213 |
+
$screen = get_current_screen();
|
214 |
+
|
215 |
+
/* loop through settings */
|
216 |
+
foreach( (array) $this->options as $option ) {
|
217 |
+
|
218 |
+
/* loop through pages */
|
219 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
220 |
+
|
221 |
+
/* verify page */
|
222 |
+
if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
|
223 |
+
|
224 |
+
$show_buttons = isset( $page['show_buttons'] ) && $page['show_buttons'] == false ? false : true;
|
225 |
+
|
226 |
+
/* update active layout content */
|
227 |
+
if ( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) {
|
228 |
+
|
229 |
+
$layouts = get_option( 'option_tree_layouts' );
|
230 |
+
|
231 |
+
/* has active layout */
|
232 |
+
if ( isset( $layouts['active_layout'] ) ) {
|
233 |
+
$option_tree = get_option( $option['id'] );
|
234 |
+
$layouts[$layouts['active_layout']] = base64_encode( serialize( $option_tree ) );
|
235 |
+
update_option( 'option_tree_layouts', $layouts );
|
236 |
+
}
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
|
241 |
+
|
242 |
+
screen_icon( ( isset( $page['screen_icon'] ) ? $page['screen_icon'] : 'options-general' ) );
|
243 |
+
echo '<h2>' . $page['page_title'] . '</h2>';
|
244 |
+
|
245 |
+
echo ot_alert_message( $page );
|
246 |
+
|
247 |
+
settings_errors( 'option-tree' );
|
248 |
+
|
249 |
+
/* Header */
|
250 |
+
echo '<div id="option-tree-header-wrap">';
|
251 |
+
|
252 |
+
echo '<ul id="option-tree-header">';
|
253 |
+
|
254 |
+
echo '<li id="option-tree-logo"><a href="http://wordpress.org/extend/plugins/option-tree/" target="_blank">OptionTree</a></li>';
|
255 |
+
|
256 |
+
echo '<li id="option-tree-version"><span>Version ' . OT_VERSION . '</span></li>';
|
257 |
+
|
258 |
+
echo '</ul>';
|
259 |
+
|
260 |
+
/* layouts form */
|
261 |
+
if ( $page['id'] == 'ot_theme_options' )
|
262 |
+
ot_theme_options_layouts_form();
|
263 |
+
|
264 |
+
echo '</div>';
|
265 |
+
|
266 |
+
/* remove forms on the custom settings pages */
|
267 |
+
if ( $show_buttons ) {
|
268 |
+
|
269 |
+
echo '<form action="options.php" method="post" id="option-tree-settings-api">';
|
270 |
+
|
271 |
+
settings_fields( $option['id'] );
|
272 |
+
|
273 |
+
} else {
|
274 |
+
|
275 |
+
echo '<div id="option-tree-settings-api">';
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
/* Sub Header */
|
280 |
+
echo '<div id="option-tree-sub-header">';
|
281 |
+
|
282 |
+
if ( $show_buttons )
|
283 |
+
echo '<button class="option-tree-ui-button grey right">' . $page['button_text'] . '</button>';
|
284 |
+
|
285 |
+
echo '</div>';
|
286 |
+
|
287 |
+
/* Navigation */
|
288 |
+
echo '<div class="ui-tabs">';
|
289 |
+
|
290 |
+
/* check for sections */
|
291 |
+
if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
|
292 |
+
|
293 |
+
echo '<ul class="ui-tabs-nav">';
|
294 |
+
|
295 |
+
/* loop through page sections */
|
296 |
+
foreach( (array) $page['sections'] as $section ) {
|
297 |
+
echo '<li><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
|
298 |
+
}
|
299 |
+
|
300 |
+
echo '</ul>';
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
/* sections */
|
305 |
+
echo '<div id="poststuff" class="metabox-holder">';
|
306 |
+
|
307 |
+
echo '<div id="post-body">';
|
308 |
+
|
309 |
+
echo '<div id="post-body-content">';
|
310 |
+
|
311 |
+
$this->do_settings_sections( $_GET['page'] );
|
312 |
+
|
313 |
+
echo '</div>';
|
314 |
+
|
315 |
+
echo '</div>';
|
316 |
+
|
317 |
+
echo '</div>';
|
318 |
+
|
319 |
+
echo '<div class="clear"></div>';
|
320 |
+
|
321 |
+
echo '</div>';
|
322 |
+
|
323 |
+
/* buttons */
|
324 |
+
if ( $show_buttons ) {
|
325 |
+
|
326 |
+
echo '<div class="option-tree-ui-buttons">';
|
327 |
+
|
328 |
+
echo '<button class="option-tree-ui-button grey right">' . $page['button_text'] . '</button>';
|
329 |
+
|
330 |
+
echo '</div>';
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
echo $show_buttons ? '</form>' : '</div>';
|
335 |
+
|
336 |
+
/* reset button */
|
337 |
+
if ( $show_buttons ) {
|
338 |
+
|
339 |
+
echo '<form method="post" action="' . str_replace( '&settings-updated=true', '', $_SERVER["REQUEST_URI"] ) . '">';
|
340 |
+
|
341 |
+
/* form nonce */
|
342 |
+
wp_nonce_field( 'option_tree_reset_form', 'option_tree_reset_nonce' );
|
343 |
+
|
344 |
+
echo '<input type="hidden" name="action" value="reset" />';
|
345 |
+
|
346 |
+
echo '<button type="submit" class="option-tree-ui-button red light left reset-settings" title="' . __( 'Reset Options', 'option-tree' ) . '">' . __( 'Reset Options', 'option-tree' ) . '</button>';
|
347 |
+
|
348 |
+
echo '</form>';
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
echo '</div>';
|
353 |
+
|
354 |
+
}
|
355 |
+
|
356 |
+
}
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Adds sections to the page
|
365 |
+
*
|
366 |
+
* @return void
|
367 |
+
*
|
368 |
+
* @access public
|
369 |
+
* @since 2.0
|
370 |
+
*/
|
371 |
+
public function add_sections() {
|
372 |
+
|
373 |
+
/* loop through options */
|
374 |
+
foreach( (array) $this->options as $option ) {
|
375 |
+
|
376 |
+
/* loop through pages */
|
377 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
378 |
+
|
379 |
+
/* loop through page sections */
|
380 |
+
foreach( (array) $this->get_sections( $page ) as $section ) {
|
381 |
+
|
382 |
+
/* add each section */
|
383 |
+
add_settings_section(
|
384 |
+
$section['id'],
|
385 |
+
$section['title'],
|
386 |
+
array( &$this, 'display_section' ),
|
387 |
+
$page['menu_slug']
|
388 |
+
);
|
389 |
+
|
390 |
+
}
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
return false;
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Callback for add_settings_section()
|
401 |
+
*
|
402 |
+
* @return string
|
403 |
+
*
|
404 |
+
* @access public
|
405 |
+
* @since 2.0
|
406 |
+
*/
|
407 |
+
public function display_section() {
|
408 |
+
/* currently pointless */
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Add settings the the page
|
413 |
+
*
|
414 |
+
* @return void
|
415 |
+
*
|
416 |
+
* @access public
|
417 |
+
* @since 2.0
|
418 |
+
*/
|
419 |
+
public function add_settings() {
|
420 |
+
|
421 |
+
/* loop through options */
|
422 |
+
foreach( (array) $this->options as $option ) {
|
423 |
+
|
424 |
+
register_setting( $option['id'], $option['id'], array ( &$this, 'sanitize_callback' ) );
|
425 |
+
|
426 |
+
/* loop through pages */
|
427 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
428 |
+
|
429 |
+
/* loop through page settings */
|
430 |
+
foreach( (array) $this->get_settings( $page ) as $setting ) {
|
431 |
+
|
432 |
+
/* skip if no setting ID */
|
433 |
+
if ( ! isset( $setting['id'] ) )
|
434 |
+
continue;
|
435 |
+
|
436 |
+
/* add get_option param to the array */
|
437 |
+
$setting['get_option'] = $option['id'];
|
438 |
+
|
439 |
+
/* add each setting */
|
440 |
+
add_settings_field(
|
441 |
+
$setting['id'],
|
442 |
+
$setting['label'],
|
443 |
+
array( &$this, 'display_setting' ),
|
444 |
+
$page['menu_slug'],
|
445 |
+
$setting['section'],
|
446 |
+
$setting
|
447 |
+
);
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
}
|
452 |
+
|
453 |
+
}
|
454 |
+
|
455 |
+
return false;
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Callback for add_settings_field() to build each setting by type
|
460 |
+
*
|
461 |
+
* @param array Setting object array
|
462 |
+
* @return string
|
463 |
+
*
|
464 |
+
* @access public
|
465 |
+
* @since 2.0
|
466 |
+
*/
|
467 |
+
public function display_setting( $args = array() ) {
|
468 |
+
extract( $args );
|
469 |
+
|
470 |
+
/* get current saved data */
|
471 |
+
$options = get_option( $get_option, false );
|
472 |
+
|
473 |
+
/* set default to standard value */
|
474 |
+
if ( ! isset( $options[$id] ) && isset( $std ) ) {
|
475 |
+
$options[$id] = trim( $std );
|
476 |
+
}
|
477 |
+
|
478 |
+
/* build the arguments array */
|
479 |
+
$_args = array(
|
480 |
+
'type' => $type,
|
481 |
+
'field_id' => $id,
|
482 |
+
'field_name' => 'option_tree[' . $id . ']',
|
483 |
+
'field_value' => isset( $options[$id] ) ? $options[$id] : '',
|
484 |
+
'field_desc' => isset( $desc ) ? $desc : '',
|
485 |
+
'field_std' => isset( $std ) ? $std : '',
|
486 |
+
'field_rows' => isset( $rows ) && ! empty( $rows ) ? $rows : 15,
|
487 |
+
'field_post_type' => isset( $post_type ) && ! empty( $post_type ) ? $post_type : 'post',
|
488 |
+
'field_taxonomy' => isset( $taxonomy ) && ! empty( $taxonomy ) ? $taxonomy : 'category',
|
489 |
+
'field_class' => isset( $class ) ? $class : '',
|
490 |
+
'field_choices' => isset( $choices ) && ! empty( $choices ) ? $choices : array(),
|
491 |
+
'field_settings' => isset( $settings ) && ! empty( $settings ) ? $settings : array(),
|
492 |
+
'post_id' => ot_get_media_post_ID(),
|
493 |
+
'get_option' => $get_option,
|
494 |
+
);
|
495 |
+
|
496 |
+
/* get the option HTML */
|
497 |
+
echo ot_display_by_type( $_args );
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Sets the option standards if nothing yet exists.
|
502 |
+
*
|
503 |
+
* @return void
|
504 |
+
*
|
505 |
+
* @access public
|
506 |
+
* @since 2.0
|
507 |
+
*/
|
508 |
+
public function initialize_settings() {
|
509 |
+
|
510 |
+
/* loop through options */
|
511 |
+
foreach( (array) $this->options as $option ) {
|
512 |
+
|
513 |
+
/* skip if option is already set */
|
514 |
+
if ( isset( $option['id'] ) && get_option( $option['id'], false ) ) {
|
515 |
+
return false;
|
516 |
+
}
|
517 |
+
|
518 |
+
$defaults = array();
|
519 |
+
|
520 |
+
/* loop through pages */
|
521 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
522 |
+
|
523 |
+
/* loop through page settings */
|
524 |
+
foreach( (array) $this->get_settings( $page ) as $setting ) {
|
525 |
+
|
526 |
+
if ( isset( $setting['std'] ) ) {
|
527 |
+
|
528 |
+
$defaults[$setting['id']] = ot_validate_setting( $setting['std'], $setting['type'] );
|
529 |
+
|
530 |
+
}
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
}
|
535 |
+
|
536 |
+
update_option( $option['id'], $defaults );
|
537 |
+
|
538 |
+
}
|
539 |
+
|
540 |
+
return false;
|
541 |
+
}
|
542 |
+
|
543 |
+
/**
|
544 |
+
* Sanitize callback for register_setting()
|
545 |
+
*
|
546 |
+
* @return string
|
547 |
+
*
|
548 |
+
* @access public
|
549 |
+
* @since 2.0
|
550 |
+
*/
|
551 |
+
public function sanitize_callback( $input ) {
|
552 |
+
|
553 |
+
/* loop through options */
|
554 |
+
foreach( (array) $this->options as $option ) {
|
555 |
+
|
556 |
+
/* loop through pages */
|
557 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
558 |
+
|
559 |
+
/* loop through page settings */
|
560 |
+
foreach( (array) $this->get_settings( $page ) as $setting ) {
|
561 |
+
|
562 |
+
/* verify setting has a type & value */
|
563 |
+
if ( isset( $setting['type'] ) && isset( $input[$setting['id']] ) ) {
|
564 |
+
|
565 |
+
/* validate setting */
|
566 |
+
if ( is_array( $input[$setting['id']] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
|
567 |
+
|
568 |
+
/* required title setting */
|
569 |
+
$required_setting = array(
|
570 |
+
array(
|
571 |
+
'id' => 'title',
|
572 |
+
'label' => __( 'Title', 'option-tree' ),
|
573 |
+
'desc' => '',
|
574 |
+
'std' => '',
|
575 |
+
'type' => 'text',
|
576 |
+
'rows' => '',
|
577 |
+
'class' => 'option-tree-setting-title',
|
578 |
+
'post_type' => '',
|
579 |
+
'choices' => array()
|
580 |
+
)
|
581 |
+
);
|
582 |
+
|
583 |
+
/* get the settings array */
|
584 |
+
$settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( base64_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
|
585 |
+
|
586 |
+
/* settings are empty for some odd ass reason get the defaults */
|
587 |
+
if ( empty( $settings ) ) {
|
588 |
+
$settings = 'slider' == $setting['type'] ?
|
589 |
+
ot_slider_settings( $setting['id'] ) :
|
590 |
+
ot_list_item_settings( $setting['id'] );
|
591 |
+
}
|
592 |
+
|
593 |
+
/* merge the two settings array */
|
594 |
+
$settings = array_merge( $required_setting, $settings );
|
595 |
+
|
596 |
+
foreach( $input[$setting['id']] as $k => $setting_array ) {
|
597 |
+
|
598 |
+
foreach( $settings as $sub_setting ) {
|
599 |
+
|
600 |
+
/* verify sub setting has a type & value */
|
601 |
+
if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
|
602 |
+
|
603 |
+
$input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'] );
|
604 |
+
|
605 |
+
}
|
606 |
+
|
607 |
+
}
|
608 |
+
|
609 |
+
}
|
610 |
+
|
611 |
+
} else {
|
612 |
+
|
613 |
+
$input[$setting['id']] = ot_validate_setting( $input[$setting['id']], $setting['type'] );
|
614 |
+
|
615 |
+
}
|
616 |
+
|
617 |
+
}
|
618 |
+
|
619 |
+
}
|
620 |
+
|
621 |
+
}
|
622 |
+
|
623 |
+
}
|
624 |
+
|
625 |
+
return $input;
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Helper function to get the pages array for an option
|
630 |
+
*
|
631 |
+
* @param array Option array
|
632 |
+
* @return mixed
|
633 |
+
*
|
634 |
+
* @access public
|
635 |
+
* @since 2.0
|
636 |
+
*/
|
637 |
+
public function get_pages( $option = array() ) {
|
638 |
+
|
639 |
+
if ( empty( $option ) )
|
640 |
+
return false;
|
641 |
+
|
642 |
+
/* check for pages */
|
643 |
+
if ( isset( $option['pages'] ) && ! empty( $option['pages'] ) ) {
|
644 |
+
|
645 |
+
/* return pages array */
|
646 |
+
return $option['pages'];
|
647 |
+
|
648 |
+
}
|
649 |
+
|
650 |
+
return false;
|
651 |
+
}
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Helper function to get the sections array for a page
|
655 |
+
*
|
656 |
+
* @param array Page array
|
657 |
+
* @return mixed
|
658 |
+
*
|
659 |
+
* @access public
|
660 |
+
* @since 2.0
|
661 |
+
*/
|
662 |
+
public function get_sections( $page = array() ) {
|
663 |
+
|
664 |
+
if ( empty( $page ) )
|
665 |
+
return false;
|
666 |
+
|
667 |
+
/* check for sections */
|
668 |
+
if ( isset( $page['sections'] ) && ! empty( $page['sections'] ) ) {
|
669 |
+
|
670 |
+
/* return sections array */
|
671 |
+
return $page['sections'];
|
672 |
+
|
673 |
+
}
|
674 |
+
|
675 |
+
return false;
|
676 |
+
}
|
677 |
+
|
678 |
+
/**
|
679 |
+
* Helper function to get the settings array for a page
|
680 |
+
*
|
681 |
+
* @param array Page array
|
682 |
+
* @return mixed
|
683 |
+
*
|
684 |
+
* @access public
|
685 |
+
* @since 2.0
|
686 |
+
*/
|
687 |
+
public function get_settings( $page = array() ) {
|
688 |
+
|
689 |
+
if ( empty( $page ) )
|
690 |
+
return false;
|
691 |
+
|
692 |
+
/* check for settings */
|
693 |
+
if ( isset( $page['settings'] ) && ! empty( $page['settings'] ) ) {
|
694 |
+
|
695 |
+
/* return settings array */
|
696 |
+
return $page['settings'];
|
697 |
+
|
698 |
+
}
|
699 |
+
|
700 |
+
return false;
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* Prints out all settings sections added to a particular settings page
|
705 |
+
*
|
706 |
+
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
|
707 |
+
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
|
708 |
+
*
|
709 |
+
* @param string The slug name of the page whos settings sections you want to output
|
710 |
+
* @return string
|
711 |
+
*
|
712 |
+
* @access public
|
713 |
+
* @since 2.0
|
714 |
+
*/
|
715 |
+
public function do_settings_sections( $page ) {
|
716 |
+
global $wp_settings_sections, $wp_settings_fields;
|
717 |
+
|
718 |
+
if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[$page] ) ) {
|
719 |
+
return false;
|
720 |
+
}
|
721 |
+
|
722 |
+
foreach ( (array) $wp_settings_sections[$page] as $section ) {
|
723 |
+
|
724 |
+
if ( ! isset( $section['id'] ) )
|
725 |
+
continue;
|
726 |
+
|
727 |
+
echo '<div id="section_' . $section['id'] . '" class="postbox ui-tabs-panel">';
|
728 |
+
|
729 |
+
call_user_func( $section['callback'], $section );
|
730 |
+
|
731 |
+
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[$page] ) || ! isset( $wp_settings_fields[$page][$section['id']] ) )
|
732 |
+
continue;
|
733 |
+
|
734 |
+
echo '<div class="inside">';
|
735 |
+
|
736 |
+
$this->do_settings_fields( $page, $section['id'] );
|
737 |
+
|
738 |
+
echo '</div>';
|
739 |
+
|
740 |
+
echo '</div>';
|
741 |
+
|
742 |
+
}
|
743 |
+
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Print out the settings fields for a particular settings section
|
748 |
+
*
|
749 |
+
* @global $wp_settings_fields Storage array of settings fields and their pages/sections
|
750 |
+
*
|
751 |
+
* @param string $page Slug title of the admin page who's settings fields you want to show.
|
752 |
+
* @param string $section Slug title of the settings section who's fields you want to show.
|
753 |
+
* @return string
|
754 |
+
*
|
755 |
+
* @access public
|
756 |
+
* @since 2.0
|
757 |
+
*/
|
758 |
+
public function do_settings_fields( $page, $section ) {
|
759 |
+
global $wp_settings_fields;
|
760 |
+
|
761 |
+
if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
|
762 |
+
return;
|
763 |
+
|
764 |
+
foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
|
765 |
+
|
766 |
+
echo '<div class="format-settings">';
|
767 |
+
|
768 |
+
if ( $field['args']['type'] != 'textblock' ) {
|
769 |
+
|
770 |
+
echo '<div class="format-setting-label">';
|
771 |
+
|
772 |
+
echo '<h3 class="label">' . $field['title'] . '</h3>';
|
773 |
+
|
774 |
+
echo '</div>';
|
775 |
+
|
776 |
+
}
|
777 |
+
|
778 |
+
call_user_func( $field['callback'], $field['args'] );
|
779 |
+
|
780 |
+
echo '</div>';
|
781 |
+
|
782 |
+
}
|
783 |
+
|
784 |
+
}
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Resets page options before the screen is displayed
|
788 |
+
*
|
789 |
+
* @return void
|
790 |
+
*
|
791 |
+
* @access public
|
792 |
+
* @since 2.0
|
793 |
+
*/
|
794 |
+
public function reset_options() {
|
795 |
+
|
796 |
+
/* check for reset action */
|
797 |
+
if ( isset( $_POST['option_tree_reset_nonce'] ) && wp_verify_nonce( $_POST['option_tree_reset_nonce'], 'option_tree_reset_form' ) ) {
|
798 |
+
|
799 |
+
/* loop through options */
|
800 |
+
foreach( (array) $this->options as $option ) {
|
801 |
+
|
802 |
+
/* loop through pages */
|
803 |
+
foreach( (array) $this->get_pages( $option ) as $page ) {
|
804 |
+
|
805 |
+
/* verify page */
|
806 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $page['menu_slug'] ) {
|
807 |
+
|
808 |
+
/* reset options */
|
809 |
+
delete_option( $option['id'] );
|
810 |
+
|
811 |
+
}
|
812 |
+
|
813 |
+
}
|
814 |
+
|
815 |
+
}
|
816 |
+
|
817 |
+
}
|
818 |
+
|
819 |
+
return false;
|
820 |
+
}
|
821 |
+
|
822 |
+
}
|
823 |
+
|
824 |
+
}
|
825 |
+
|
826 |
+
/**
|
827 |
+
* This method instantiates the settings class & builds the UI.
|
828 |
+
*
|
829 |
+
* @uses OT_Settings()
|
830 |
+
*
|
831 |
+
* @param array Array of arguments to create settings
|
832 |
+
* @return void
|
833 |
+
*
|
834 |
+
* @access public
|
835 |
+
* @since 2.0
|
836 |
+
*/
|
837 |
+
if ( ! function_exists( 'ot_register_settings' ) ) {
|
838 |
+
|
839 |
+
function ot_register_settings( $args ) {
|
840 |
+
if ( ! $args )
|
841 |
+
return;
|
842 |
+
|
843 |
+
$ot_settings =& new OT_Settings( $args );
|
844 |
+
}
|
845 |
+
|
846 |
+
}
|
847 |
+
|
848 |
+
/* End of file ot-settings-api.php */
|
849 |
+
/* Location: ./includes/ot-settings-api.php */
|
includes/ot-ui-admin.php
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'OT_VERSION') ) exit( 'No direct script access allowed' );
|
2 |
+
/**
|
3 |
+
* Builds the Setting & Documentation UI.
|
4 |
+
*
|
5 |
+
* @uses ot_register_settings()
|
6 |
+
*
|
7 |
+
* @package OptionTree
|
8 |
+
* @author Derek Herman <derek@valendesigns.com>
|
9 |
+
* @copyright Copyright (c) 2012, Derek Herman
|
10 |
+
*/
|
11 |
+
if ( function_exists( 'ot_register_settings' ) ) {
|
12 |
+
|
13 |
+
ot_register_settings( array(
|
14 |
+
array(
|
15 |
+
'id' => 'option_tree_settings',
|
16 |
+
'pages' => apply_filters( 'ot_register_pages_array', array(
|
17 |
+
array(
|
18 |
+
'id' => 'ot',
|
19 |
+
'page_title' => __( 'OptionTree', 'option-tree' ),
|
20 |
+
'menu_title' => __( 'OptionTree', 'option-tree' ),
|
21 |
+
'capability' => 'manage_options',
|
22 |
+
'menu_slug' => 'ot-settings',
|
23 |
+
'icon_url' => OT_URL . '/assets/images/ot-logo-mini.png',
|
24 |
+
'position' => 61,
|
25 |
+
'hidden_page' => true
|
26 |
+
),
|
27 |
+
array(
|
28 |
+
'id' => 'settings',
|
29 |
+
'parent_slug' => 'ot-settings',
|
30 |
+
'page_title' => __( 'Settings', 'option-tree' ),
|
31 |
+
'menu_title' => __( 'Settings', 'option-tree' ),
|
32 |
+
'capability' => 'manage_options',
|
33 |
+
'menu_slug' => 'ot-settings',
|
34 |
+
'icon_url' => null,
|
35 |
+
'position' => null,
|
36 |
+
'updated_message' => __( 'Theme Options updated.', 'option-tree' ),
|
37 |
+
'reset_message' => __( 'Theme Options reset.', 'option-tree' ),
|
38 |
+
'button_text' => __( 'Save Settings', 'option-tree' ),
|
39 |
+
'show_buttons' => false,
|
40 |
+
'screen_icon' => 'themes',
|
41 |
+
'sections' => array(
|
42 |
+
array(
|
43 |
+
'id' => 'create_setting',
|
44 |
+
'title' => __( 'Theme Options UI', 'option-tree' )
|
45 |
+
),
|
46 |
+
array(
|
47 |
+
'id' => 'import',
|
48 |
+
'title' => __( 'Import', 'option-tree' )
|
49 |
+
),
|
50 |
+
array(
|
51 |
+
'id' => 'export',
|
52 |
+
'title' => __( 'Export', 'option-tree' )
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'id' => 'layouts',
|
56 |
+
'title' => __( 'Layouts', 'option-tree' )
|
57 |
+
)
|
58 |
+
),
|
59 |
+
'settings' => array(
|
60 |
+
array(
|
61 |
+
'id' => 'theme_options_ui_text',
|
62 |
+
'label' => __( 'Theme Options UI Builder', 'option-tree' ),
|
63 |
+
'type' => 'theme_options_ui',
|
64 |
+
'section' => 'create_setting'
|
65 |
+
),
|
66 |
+
array(
|
67 |
+
'id' => 'import_xml_text',
|
68 |
+
'label' => __( 'Settings XML', 'option-tree' ),
|
69 |
+
'type' => 'import-xml',
|
70 |
+
'section' => 'import'
|
71 |
+
),
|
72 |
+
array(
|
73 |
+
'id' => 'import_settings_text',
|
74 |
+
'label' => __( 'Settings', 'option-tree' ),
|
75 |
+
'type' => 'import-settings',
|
76 |
+
'section' => 'import'
|
77 |
+
),
|
78 |
+
array(
|
79 |
+
'id' => 'import_data_text',
|
80 |
+
'label' => __( 'Theme Options', 'option-tree' ),
|
81 |
+
'type' => 'import-data',
|
82 |
+
'section' => 'import'
|
83 |
+
),
|
84 |
+
array(
|
85 |
+
'id' => 'import_layouts_text',
|
86 |
+
'label' => __( 'Layouts', 'option-tree' ),
|
87 |
+
'type' => 'import-layouts',
|
88 |
+
'section' => 'import'
|
89 |
+
),
|
90 |
+
array(
|
91 |
+
'id' => 'export_settings_text',
|
92 |
+
'label' => __( 'Settings', 'option-tree' ),
|
93 |
+
'type' => 'export-settings',
|
94 |
+
'section' => 'export'
|
95 |
+
),
|
96 |
+
array(
|
97 |
+
'id' => 'export_data_text',
|
98 |
+
'label' => __( 'Theme Options', 'option-tree' ),
|
99 |
+
'type' => 'export-data',
|
100 |
+
'section' => 'export'
|
101 |
+
),
|
102 |
+
array(
|
103 |
+
'id' => 'export_layout_text',
|
104 |
+
'label' => __( 'Layouts', 'option-tree' ),
|
105 |
+
'type' => 'export-layouts',
|
106 |
+
'section' => 'export'
|
107 |
+
),
|
108 |
+
array(
|
109 |
+
'id' => 'modify_layouts_text',
|
110 |
+
'label' => __( 'Add, Activate, & Remove Layouts', 'option-tree' ),
|
111 |
+
'type' => 'modify-layouts',
|
112 |
+
'section' => 'layouts'
|
113 |
+
)
|
114 |
+
)
|
115 |
+
),
|
116 |
+
array(
|
117 |
+
'id' => 'documentation',
|
118 |
+
'parent_slug' => 'ot-settings',
|
119 |
+
'page_title' => __( 'Documentation', 'option-tree' ),
|
120 |
+
'menu_title' => __( 'Documentation', 'option-tree' ),
|
121 |
+
'capability' => 'manage_options',
|
122 |
+
'menu_slug' => 'ot-documentation',
|
123 |
+
'icon_url' => null,
|
124 |
+
'position' => null,
|
125 |
+
'updated_message' => __( 'Theme Options updated.', 'option-tree' ),
|
126 |
+
'reset_message' => __( 'Theme Options reset.', 'option-tree' ),
|
127 |
+
'button_text' => __( 'Save Settings', 'option-tree' ),
|
128 |
+
'show_buttons' => false,
|
129 |
+
'screen_icon' => 'themes',
|
130 |
+
'sections' => array(
|
131 |
+
array(
|
132 |
+
'id' => 'creating_options',
|
133 |
+
'title' => __( 'Creating Options', 'option-tree' )
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
'id' => 'option_types',
|
137 |
+
'title' => __( 'Option Types', 'option-tree' )
|
138 |
+
),
|
139 |
+
array(
|
140 |
+
'id' => 'functions',
|
141 |
+
'title' => __( 'Function References', 'option-tree' )
|
142 |
+
),
|
143 |
+
array(
|
144 |
+
'id' => 'theme_mode',
|
145 |
+
'title' => __( 'Theme Mode', 'option-tree' )
|
146 |
+
),
|
147 |
+
array(
|
148 |
+
'id' => 'meta_boxes',
|
149 |
+
'title' => __( 'Meta Boxes', 'option-tree' )
|
150 |
+
),
|
151 |
+
array(
|
152 |
+
'id' => 'examples',
|
153 |
+
'title' => __( 'Code Examples', 'option-tree' )
|
154 |
+
),
|
155 |
+
array(
|
156 |
+
'id' => 'layouts_overview',
|
157 |
+
'title' => __( 'Layouts Overview', 'option-tree' )
|
158 |
+
)
|
159 |
+
),
|
160 |
+
'settings' => array(
|
161 |
+
array(
|
162 |
+
'id' => 'creating_options_text',
|
163 |
+
'label' => __( 'Overview of available Theme Option fields.', 'option-tree' ),
|
164 |
+
'type' => 'creating-options',
|
165 |
+
'section' => 'creating_options'
|
166 |
+
),
|
167 |
+
array(
|
168 |
+
'id' => 'option_types_text',
|
169 |
+
'label' => __( 'Option types in alphabetical order & hooks to filter them.', 'option-tree' ),
|
170 |
+
'type' => 'option-types',
|
171 |
+
'section' => 'option_types'
|
172 |
+
),
|
173 |
+
array(
|
174 |
+
'id' => 'functions_ot_get_option',
|
175 |
+
'label' => __( 'Function Reference:ot_get_option()', 'option-tree' ),
|
176 |
+
'type' => 'ot-get-option',
|
177 |
+
'section' => 'functions'
|
178 |
+
),
|
179 |
+
array(
|
180 |
+
'id' => 'functions_get_option_tree',
|
181 |
+
'label' => __( 'Function Reference:get_option_tree()', 'option-tree' ),
|
182 |
+
'type' => 'get-option-tree',
|
183 |
+
'section' => 'functions'
|
184 |
+
),
|
185 |
+
array(
|
186 |
+
'id' => 'theme_mode_text',
|
187 |
+
'label' => __( 'Theme Mode', 'option-tree' ),
|
188 |
+
'type' => 'theme-mode',
|
189 |
+
'section' => 'theme_mode'
|
190 |
+
),
|
191 |
+
array(
|
192 |
+
'id' => 'meta_boxes_text',
|
193 |
+
'label' => __( 'Meta Boxes', 'option-tree' ),
|
194 |
+
'type' => 'meta-boxes',
|
195 |
+
'section' => 'meta_boxes'
|
196 |
+
),
|
197 |
+
array(
|
198 |
+
'id' => 'example_text',
|
199 |
+
'label' => __( 'Code examples for front-end development.', 'option-tree' ),
|
200 |
+
'type' => 'examples',
|
201 |
+
'section' => 'examples'
|
202 |
+
),
|
203 |
+
array(
|
204 |
+
'id' => 'layouts_overview_text',
|
205 |
+
'label' => __( 'What\'s a layout anyhow?', 'option-tree' ),
|
206 |
+
'type' => 'layouts-overview',
|
207 |
+
'section' => 'layouts_overview'
|
208 |
+
)
|
209 |
+
)
|
210 |
+
)
|
211 |
+
) )
|
212 |
+
)
|
213 |
+
)
|
214 |
+
);
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
/* End of file ot-ui-admin.php */
|
219 |
+
/* Location: ./option-tree/ot-ui-admin.php */
|
includes/ot-ui-theme-options.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'OT_VERSION') ) exit( 'No direct script access allowed' );
|
2 |
+
/**
|
3 |
+
* Builds the Theme Option UI.
|
4 |
+
*
|
5 |
+
* @uses ot_register_settings()
|
6 |
+
*
|
7 |
+
* @package OptionTree
|
8 |
+
* @author Derek Herman <derek@valendesigns.com>
|
9 |
+
* @copyright Copyright (c) 2012, Derek Herman
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* get the settings array */
|
13 |
+
$get_settings = get_option( 'option_tree_settings' );
|
14 |
+
|
15 |
+
/* sections array */
|
16 |
+
$sections = isset( $get_settings['sections'] ) ? $get_settings['sections'] : array();
|
17 |
+
|
18 |
+
/* settings array */
|
19 |
+
$settings = isset( $get_settings['settings'] ) ? $get_settings['settings'] : array();
|
20 |
+
|
21 |
+
/* contexual_help array */
|
22 |
+
$contextual_help = isset( $get_settings['contextual_help'] ) ? $get_settings['contextual_help'] : array();
|
23 |
+
|
24 |
+
/* build the Theme Options */
|
25 |
+
if ( function_exists( 'ot_register_settings' ) ) {
|
26 |
+
|
27 |
+
ot_register_settings( array(
|
28 |
+
array(
|
29 |
+
'id' => 'option_tree',
|
30 |
+
'pages' => array(
|
31 |
+
array(
|
32 |
+
'id' => 'ot_theme_options',
|
33 |
+
'parent_slug' => 'themes.php',
|
34 |
+
'page_title' => __( 'Theme Options', 'option-tree' ),
|
35 |
+
'menu_title' => __( 'Theme Options', 'option-tree' ),
|
36 |
+
'capability' => 'manage_options',
|
37 |
+
'menu_slug' => 'ot-theme-options',
|
38 |
+
'icon_url' => null,
|
39 |
+
'position' => null,
|
40 |
+
'updated_message' => __( 'Theme Options updated.', 'option-tree' ),
|
41 |
+
'reset_message' => __( 'Theme Options reset.', 'option-tree' ),
|
42 |
+
'button_text' => __( 'Save Changes', 'option-tree' ),
|
43 |
+
'screen_icon' => 'themes',
|
44 |
+
'contextual_help' => $contextual_help,
|
45 |
+
'sections' => $sections,
|
46 |
+
'settings' => $settings
|
47 |
+
)
|
48 |
+
)
|
49 |
+
)
|
50 |
+
)
|
51 |
+
);
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
/* End of file ot-ui-theme-options.php */
|
56 |
+
/* Location: ./option-tree/ot-ui-theme-options.php */
|
index.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: OptionTree
|
4 |
-
Plugin URI: http://wp.envato.com
|
5 |
-
Description: Customizable WordPress Theme Options Admin Interface
|
6 |
-
Version: 1.1.8.1
|
7 |
-
Author: Derek Herman
|
8 |
-
Author URI: http://valendesigns.com
|
9 |
-
License: GPLv2
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Definitions
|
14 |
-
*
|
15 |
-
* @since 1.0.0
|
16 |
-
*/
|
17 |
-
define( 'OT_VERSION', '1.1.8.1' );
|
18 |
-
define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
19 |
-
define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Required Files
|
23 |
-
*
|
24 |
-
* @since 1.0.0
|
25 |
-
*/
|
26 |
-
require_once( OT_PLUGIN_DIR . '/functions/functions.load.php' );
|
27 |
-
require_once( OT_PLUGIN_DIR . '/classes/class.admin.php' );
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Instantiate Classe
|
31 |
-
*
|
32 |
-
* @since 1.0.0
|
33 |
-
*/
|
34 |
-
$ot_admin = new OT_Admin();
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Wordpress Activate/Deactivate
|
38 |
-
*
|
39 |
-
* @uses register_activation_hook()
|
40 |
-
* @uses register_deactivation_hook()
|
41 |
-
*
|
42 |
-
* @since 1.0.0
|
43 |
-
*/
|
44 |
-
register_activation_hook( __FILE__, array( $ot_admin, 'option_tree_activate' ) );
|
45 |
-
register_deactivation_hook( __FILE__, array( $ot_admin, 'option_tree_deactivate' ) );
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Required action filters
|
49 |
-
*
|
50 |
-
* @uses add_action()
|
51 |
-
*
|
52 |
-
* @since 1.0.0
|
53 |
-
*/
|
54 |
-
add_action( 'init', array( $ot_admin, 'create_option_post' ), 5 );
|
55 |
-
add_action( 'admin_init', array( $ot_admin, 'option_tree_init' ) );
|
56 |
-
add_action( 'admin_menu', array( $ot_admin, 'option_tree_admin' ) );
|
57 |
-
|
58 |
-
/* All the AJAX to run OT */
|
59 |
-
add_action( 'wp_ajax_option_tree_array_save', array( $ot_admin, 'option_tree_array_save' ) );
|
60 |
-
add_action( 'wp_ajax_option_tree_array_reload', array( $ot_admin, 'option_tree_array_reload' ) );
|
61 |
-
add_action( 'wp_ajax_option_tree_array_reset', array( $ot_admin, 'option_tree_array_reset' ) );
|
62 |
-
add_action( 'wp_ajax_option_tree_add', array( $ot_admin, 'option_tree_add' ) );
|
63 |
-
add_action( 'wp_ajax_option_tree_edit', array( $ot_admin, 'option_tree_edit' ) );
|
64 |
-
add_action( 'wp_ajax_option_tree_delete', array( $ot_admin, 'option_tree_delete' ) );
|
65 |
-
add_action( 'wp_ajax_option_tree_next_id', array( $ot_admin, 'option_tree_next_id' ) );
|
66 |
-
add_action( 'wp_ajax_option_tree_sort', array( $ot_admin, 'option_tree_sort' ) );
|
67 |
-
add_action( 'wp_ajax_option_tree_import_data', array( $ot_admin, 'option_tree_import_data' ) );
|
68 |
-
add_action( 'wp_ajax_option_tree_update_export_data', array( $ot_admin, 'option_tree_update_export_data' ) );
|
69 |
-
add_action( 'wp_ajax_option_tree_add_slider', array( $ot_admin, 'option_tree_add_slider' ) );
|
70 |
-
add_action( 'wp_ajax_option_tree_save_layout', array( $ot_admin, 'option_tree_save_layout' ) );
|
71 |
-
add_action( 'wp_ajax_option_tree_delete_layout', array( $ot_admin, 'option_tree_delete_layout' ) );
|
72 |
-
add_action( 'wp_ajax_option_tree_activate_layout', array( $ot_admin, 'option_tree_activate_layout' ) );
|
73 |
-
add_action( 'wp_ajax_option_tree_import_layout', array( $ot_admin, 'option_tree_import_layout' ) );
|
74 |
-
add_action( 'wp_ajax_option_tree_update_export_layout', array( $ot_admin, 'option_tree_update_export_layout' ) );
|
75 |
-
|
76 |
-
/* Add Use profile info to turn on/off docs in end-user mode */
|
77 |
-
add_action( 'show_user_profile', array( $ot_admin, 'option_tree_extra_profile_fields' ) );
|
78 |
-
add_action( 'edit_user_profile', array( $ot_admin, 'option_tree_extra_profile_fields' ) );
|
79 |
-
add_action( 'personal_options_update', array( $ot_admin, 'option_tree_save_extra_profile_fields' ) );
|
80 |
-
add_action( 'edit_user_profile_update', array( $ot_admin, 'option_tree_save_extra_profile_fields' ) );
|
81 |
-
|
82 |
-
/* Save custom CSS options */
|
83 |
-
add_action( 'option_tree_array_save', 'option_tree_css_save', 5 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
license.txt
DELETED
@@ -1,281 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 2, June 1991
|
3 |
-
|
4 |
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
5 |
-
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
6 |
-
|
7 |
-
Everyone is permitted to copy and distribute verbatim copies
|
8 |
-
of this license document, but changing it is not allowed.
|
9 |
-
|
10 |
-
Preamble
|
11 |
-
|
12 |
-
The licenses for most software are designed to take away your
|
13 |
-
freedom to share and change it. By contrast, the GNU General Public
|
14 |
-
License is intended to guarantee your freedom to share and change free
|
15 |
-
software--to make sure the software is free for all its users. This
|
16 |
-
General Public License applies to most of the Free Software
|
17 |
-
Foundation's software and to any other program whose authors commit to
|
18 |
-
using it. (Some other Free Software Foundation software is covered by
|
19 |
-
the GNU Library General Public License instead.) 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 |
-
this service if you wish), that you receive source code or can get it
|
26 |
-
if you want it, that you can change the software or use pieces of it
|
27 |
-
in new free programs; and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to make restrictions that forbid
|
30 |
-
anyone to deny you these rights or to ask you to surrender the rights.
|
31 |
-
These restrictions translate to certain responsibilities for you if you
|
32 |
-
distribute copies of the software, or if you modify it.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must give the recipients all the rights that
|
36 |
-
you have. You must make sure that they, too, receive or can get the
|
37 |
-
source code. And you must show them these terms so they know their
|
38 |
-
rights.
|
39 |
-
|
40 |
-
We protect your rights with two steps: (1) copyright the software, and
|
41 |
-
(2) offer you this license which gives you legal permission to copy,
|
42 |
-
distribute and/or modify the software.
|
43 |
-
|
44 |
-
Also, for each author's protection and ours, we want to make certain
|
45 |
-
that everyone understands that there is no warranty for this free
|
46 |
-
software. If the software is modified by someone else and passed on, we
|
47 |
-
want its recipients to know that what they have is not the original, so
|
48 |
-
that any problems introduced by others will not reflect on the original
|
49 |
-
authors' reputations.
|
50 |
-
|
51 |
-
Finally, any free program is threatened constantly by software
|
52 |
-
patents. We wish to avoid the danger that redistributors of a free
|
53 |
-
program will individually obtain patent licenses, in effect making the
|
54 |
-
program proprietary. To prevent this, we have made it clear that any
|
55 |
-
patent must be licensed for everyone's free use or not licensed at all.
|
56 |
-
|
57 |
-
The precise terms and conditions for copying, distribution and
|
58 |
-
modification follow.
|
59 |
-
|
60 |
-
GNU GENERAL PUBLIC LICENSE
|
61 |
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
62 |
-
|
63 |
-
0. This License applies to any program or other work which contains
|
64 |
-
a notice placed by the copyright holder saying it may be distributed
|
65 |
-
under the terms of this General Public License. The "Program", below,
|
66 |
-
refers to any such program or work, and a "work based on the Program"
|
67 |
-
means either the Program or any derivative work under copyright law:
|
68 |
-
that is to say, a work containing the Program or a portion of it,
|
69 |
-
either verbatim or with modifications and/or translated into another
|
70 |
-
language. (Hereinafter, translation is included without limitation in
|
71 |
-
the term "modification".) Each licensee is addressed as "you".
|
72 |
-
|
73 |
-
Activities other than copying, distribution and modification are not
|
74 |
-
covered by this License; they are outside its scope. The act of
|
75 |
-
running the Program is not restricted, and the output from the Program
|
76 |
-
is covered only if its contents constitute a work based on the
|
77 |
-
Program (independent of having been made by running the Program).
|
78 |
-
Whether that is true depends on what the Program does.
|
79 |
-
|
80 |
-
1. You may copy and distribute verbatim copies of the Program's
|
81 |
-
source code as you receive it, in any medium, provided that you
|
82 |
-
conspicuously and appropriately publish on each copy an appropriate
|
83 |
-
copyright notice and disclaimer of warranty; keep intact all the
|
84 |
-
notices that refer to this License and to the absence of any warranty;
|
85 |
-
and give any other recipients of the Program a copy of this License
|
86 |
-
along with the Program.
|
87 |
-
|
88 |
-
You may charge a fee for the physical act of transferring a copy, and
|
89 |
-
you may at your option offer warranty protection in exchange for a fee.
|
90 |
-
|
91 |
-
2. You may modify your copy or copies of the Program or any portion
|
92 |
-
of it, thus forming a work based on the Program, and copy and
|
93 |
-
distribute such modifications or work under the terms of Section 1
|
94 |
-
above, provided that you also meet all of these conditions:
|
95 |
-
|
96 |
-
a) You must cause the modified files to carry prominent notices
|
97 |
-
stating that you changed the files and the date of any change.
|
98 |
-
|
99 |
-
b) You must cause any work that you distribute or publish, that in
|
100 |
-
whole or in part contains or is derived from the Program or any
|
101 |
-
part thereof, to be licensed as a whole at no charge to all third
|
102 |
-
parties under the terms of this License.
|
103 |
-
|
104 |
-
c) If the modified program normally reads commands interactively
|
105 |
-
when run, you must cause it, when started running for such
|
106 |
-
interactive use in the most ordinary way, to print or display an
|
107 |
-
announcement including an appropriate copyright notice and a
|
108 |
-
notice that there is no warranty (or else, saying that you provide
|
109 |
-
a warranty) and that users may redistribute the program under
|
110 |
-
these conditions, and telling the user how to view a copy of this
|
111 |
-
License. (Exception: if the Program itself is interactive but
|
112 |
-
does not normally print such an announcement, your work based on
|
113 |
-
the Program is not required to print an announcement.)
|
114 |
-
|
115 |
-
These requirements apply to the modified work as a whole. If
|
116 |
-
identifiable sections of that work are not derived from the Program,
|
117 |
-
and can be reasonably considered independent and separate works in
|
118 |
-
themselves, then this License, and its terms, do not apply to those
|
119 |
-
sections when you distribute them as separate works. But when you
|
120 |
-
distribute the same sections as part of a whole which is a work based
|
121 |
-
on the Program, the distribution of the whole must be on the terms of
|
122 |
-
this License, whose permissions for other licensees extend to the
|
123 |
-
entire whole, and thus to each and every part regardless of who wrote it.
|
124 |
-
Thus, it is not the intent of this section to claim rights or contest
|
125 |
-
your rights to work written entirely by you; rather, the intent is to
|
126 |
-
exercise the right to control the distribution of derivative or
|
127 |
-
collective works based on the Program.
|
128 |
-
|
129 |
-
In addition, mere aggregation of another work not based on the Program
|
130 |
-
with the Program (or with a work based on the Program) on a volume of
|
131 |
-
a storage or distribution medium does not bring the other work under
|
132 |
-
the scope of this License.
|
133 |
-
|
134 |
-
3. You may copy and distribute the Program (or a work based on it,
|
135 |
-
under Section 2) in object code or executable form under the terms of
|
136 |
-
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
-
|
138 |
-
a) Accompany it with the complete corresponding machine-readable
|
139 |
-
source code, which must be distributed under the terms of Sections
|
140 |
-
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
-
|
142 |
-
b) Accompany it with a written offer, valid for at least three
|
143 |
-
years, to give any third party, for a charge no more than your
|
144 |
-
cost of physically performing source distribution, a complete
|
145 |
-
machine-readable copy of the corresponding source code, to be
|
146 |
-
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
-
customarily used for software interchange; or,
|
148 |
-
|
149 |
-
c) Accompany it with the information you received as to the offer
|
150 |
-
to distribute corresponding source code. (This alternative is
|
151 |
-
allowed only for noncommercial distribution and only if you
|
152 |
-
received the program in object code or executable form with such
|
153 |
-
an offer, in accord with Subsection b above.)
|
154 |
-
|
155 |
-
The source code for a work means the preferred form of the work for
|
156 |
-
making modifications to it. For an executable work, complete source
|
157 |
-
code means all the source code for all modules it contains, plus any
|
158 |
-
associated interface definition files, plus the scripts used to
|
159 |
-
control compilation and installation of the executable. However, as a
|
160 |
-
special exception, the source code distributed need not include
|
161 |
-
anything that is normally distributed (in either source or binary
|
162 |
-
form) with the major components (compiler, kernel, and so on) of the
|
163 |
-
operating system on which the executable runs, unless that component
|
164 |
-
itself accompanies the executable.
|
165 |
-
|
166 |
-
If distribution of executable or object code is made by offering
|
167 |
-
access to copy from a designated place, then offering equivalent
|
168 |
-
access to copy the source code from the same place counts as
|
169 |
-
distribution of the source code, even though third parties are not
|
170 |
-
compelled to copy the source along with the object code.
|
171 |
-
|
172 |
-
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
-
except as expressly provided under this License. Any attempt
|
174 |
-
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
-
void, and will automatically terminate your rights under this License.
|
176 |
-
However, parties who have received copies, or rights, from you under
|
177 |
-
this License will not have their licenses terminated so long as such
|
178 |
-
parties remain in full compliance.
|
179 |
-
|
180 |
-
5. You are not required to accept this License, since you have not
|
181 |
-
signed it. However, nothing else grants you permission to modify or
|
182 |
-
distribute the Program or its derivative works. These actions are
|
183 |
-
prohibited by law if you do not accept this License. Therefore, by
|
184 |
-
modifying or distributing the Program (or any work based on the
|
185 |
-
Program), you indicate your acceptance of this License to do so, and
|
186 |
-
all its terms and conditions for copying, distributing or modifying
|
187 |
-
the Program or works based on it.
|
188 |
-
|
189 |
-
6. Each time you redistribute the Program (or any work based on the
|
190 |
-
Program), the recipient automatically receives a license from the
|
191 |
-
original licensor to copy, distribute or modify the Program subject to
|
192 |
-
these terms and conditions. You may not impose any further
|
193 |
-
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
-
You are not responsible for enforcing compliance by third parties to
|
195 |
-
this License.
|
196 |
-
|
197 |
-
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
-
infringement or for any other reason (not limited to patent issues),
|
199 |
-
conditions are imposed on you (whether by court order, agreement or
|
200 |
-
otherwise) that contradict the conditions of this License, they do not
|
201 |
-
excuse you from the conditions of this License. If you cannot
|
202 |
-
distribute so as to satisfy simultaneously your obligations under this
|
203 |
-
License and any other pertinent obligations, then as a consequence you
|
204 |
-
may not distribute the Program at all. For example, if a patent
|
205 |
-
license would not permit royalty-free redistribution of the Program by
|
206 |
-
all those who receive copies directly or indirectly through you, then
|
207 |
-
the only way you could satisfy both it and this License would be to
|
208 |
-
refrain entirely from distribution of the Program.
|
209 |
-
|
210 |
-
If any portion of this section is held invalid or unenforceable under
|
211 |
-
any particular circumstance, the balance of the section is intended to
|
212 |
-
apply and the section as a whole is intended to apply in other
|
213 |
-
circumstances.
|
214 |
-
|
215 |
-
It is not the purpose of this section to induce you to infringe any
|
216 |
-
patents or other property right claims or to contest validity of any
|
217 |
-
such claims; this section has the sole purpose of protecting the
|
218 |
-
integrity of the free software distribution system, which is
|
219 |
-
implemented by public license practices. Many people have made
|
220 |
-
generous contributions to the wide range of software distributed
|
221 |
-
through that system in reliance on consistent application of that
|
222 |
-
system; it is up to the author/donor to decide if he or she is willing
|
223 |
-
to distribute software through any other system and a licensee cannot
|
224 |
-
impose that choice.
|
225 |
-
|
226 |
-
This section is intended to make thoroughly clear what is believed to
|
227 |
-
be a consequence of the rest of this License.
|
228 |
-
|
229 |
-
8. If the distribution and/or use of the Program is restricted in
|
230 |
-
certain countries either by patents or by copyrighted interfaces, the
|
231 |
-
original copyright holder who places the Program under this License
|
232 |
-
may add an explicit geographical distribution limitation excluding
|
233 |
-
those countries, so that distribution is permitted only in or among
|
234 |
-
countries not thus excluded. In such case, this License incorporates
|
235 |
-
the limitation as if written in the body of this License.
|
236 |
-
|
237 |
-
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
-
of the General Public License from time to time. Such new versions will
|
239 |
-
be similar in spirit to the present version, but may differ in detail to
|
240 |
-
address new problems or concerns.
|
241 |
-
|
242 |
-
Each version is given a distinguishing version number. If the Program
|
243 |
-
specifies a version number of this License which applies to it and "any
|
244 |
-
later version", you have the option of following the terms and conditions
|
245 |
-
either of that version or of any later version published by the Free
|
246 |
-
Software Foundation. If the Program does not specify a version number of
|
247 |
-
this License, you may choose any version ever published by the Free Software
|
248 |
-
Foundation.
|
249 |
-
|
250 |
-
10. If you wish to incorporate parts of the Program into other free
|
251 |
-
programs whose distribution conditions are different, write to the author
|
252 |
-
to ask for permission. For software which is copyrighted by the Free
|
253 |
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
-
make exceptions for this. Our decision will be guided by the two goals
|
255 |
-
of preserving the free status of all derivatives of our free software and
|
256 |
-
of promoting the sharing and reuse of software generally.
|
257 |
-
|
258 |
-
NO WARRANTY
|
259 |
-
|
260 |
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
-
REPAIR OR CORRECTION.
|
269 |
-
|
270 |
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
-
POSSIBILITY OF SUCH DAMAGES.
|
279 |
-
|
280 |
-
END OF TERMS AND CONDITIONS
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.0
|
7 |
+
* Author: Derek Herman
|
8 |
+
* Author URI: http://valendesigns.com
|
9 |
+
* License: GPLv2
|
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) 2012, 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 |
+
add_action( 'after_setup_theme', array( &$this, 'constants' ), 2 );
|
36 |
+
|
37 |
+
/* include the required admin files */
|
38 |
+
add_action( 'after_setup_theme', array( &$this, 'admin_includes' ), 3 );
|
39 |
+
|
40 |
+
/* include the required files */
|
41 |
+
add_action( 'after_setup_theme', array( &$this, 'includes' ), 4 );
|
42 |
+
|
43 |
+
/* hook into WordPress */
|
44 |
+
add_action( 'after_setup_theme', array( &$this, 'hooks' ), 5 );
|
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 |
+
public function constants() {
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Current Version number.
|
62 |
+
*/
|
63 |
+
define( 'OT_VERSION', '2.0' );
|
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: Show Pages.
|
91 |
+
*
|
92 |
+
* Run a filter and set to false if you don't want to load the
|
93 |
+
* settings & documentation pages in the admin area of WordPress.
|
94 |
+
*
|
95 |
+
* @since 2.0
|
96 |
+
*/
|
97 |
+
define( 'OT_SHOW_PAGES', apply_filters( 'ot_show_pages', true ) );
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Check if in theme mode.
|
101 |
+
*
|
102 |
+
* If theme mode is false then set the directory path & URL
|
103 |
+
* like it's a plugin. Else make it look in the parent
|
104 |
+
* theme root directory or child theme directory if
|
105 |
+
* OT_CHILD_MODE is set to true.
|
106 |
+
*
|
107 |
+
* @since 2.0
|
108 |
+
*/
|
109 |
+
if ( false == OT_THEME_MODE ) {
|
110 |
+
define( 'OT_DIR', plugin_dir_path( __FILE__ ) );
|
111 |
+
define( 'OT_URL', plugin_dir_url( __FILE__ ) );
|
112 |
+
} else {
|
113 |
+
define( 'OT_DIR', trailingslashit( get_template_directory() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
|
114 |
+
define( 'OT_URL', trailingslashit( get_template_directory_uri() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Include admin files
|
121 |
+
*
|
122 |
+
* These functions are included on admin pages only.
|
123 |
+
*
|
124 |
+
* @return void
|
125 |
+
*
|
126 |
+
* @access private
|
127 |
+
* @since 2.0
|
128 |
+
*/
|
129 |
+
public function admin_includes() {
|
130 |
+
|
131 |
+
/* exit early if we're not on an admin page */
|
132 |
+
if ( ! is_admin() )
|
133 |
+
return false;
|
134 |
+
|
135 |
+
/* global include files */
|
136 |
+
$files = array(
|
137 |
+
'ot-functions-admin',
|
138 |
+
'ot-functions-option-types',
|
139 |
+
'ot-functions-compat',
|
140 |
+
'ot-settings-api',
|
141 |
+
'ot-meta-box-api',
|
142 |
+
'ot-ui-theme-options'
|
143 |
+
);
|
144 |
+
|
145 |
+
/* include the settings & docs pages */
|
146 |
+
if ( OT_SHOW_PAGES == true ) {
|
147 |
+
$files[] = 'ot-functions-settings-page';
|
148 |
+
$files[] = 'ot-functions-docs-page';
|
149 |
+
$files[] = 'ot-ui-admin';
|
150 |
+
}
|
151 |
+
|
152 |
+
/* require the files */
|
153 |
+
foreach ( $files as $file ) {
|
154 |
+
require_once( OT_DIR . "includes/{$file}.php" );
|
155 |
+
}
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Include front-end files
|
161 |
+
*
|
162 |
+
* These functions are included on every page load
|
163 |
+
* incase other plugins need to access them.
|
164 |
+
*
|
165 |
+
* @return void
|
166 |
+
*
|
167 |
+
* @access private
|
168 |
+
* @since 2.0
|
169 |
+
*/
|
170 |
+
public function includes() {
|
171 |
+
|
172 |
+
$files = array(
|
173 |
+
'ot-functions',
|
174 |
+
'ot-functions-deprecated'
|
175 |
+
);
|
176 |
+
|
177 |
+
/* require the files */
|
178 |
+
foreach ( $files as $file ) {
|
179 |
+
require_once( OT_DIR . "includes/{$file}.php" );
|
180 |
+
}
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Execute the WordPress Hooks
|
186 |
+
*
|
187 |
+
* @return void
|
188 |
+
*
|
189 |
+
* @access public
|
190 |
+
* @since 2.0
|
191 |
+
*/
|
192 |
+
public function hooks() {
|
193 |
+
|
194 |
+
/* add scripts for metaboxes to post-new.php & post.php */
|
195 |
+
add_action( 'admin_print_scripts-post-new.php', 'ot_admin_scripts', 11 );
|
196 |
+
add_action( 'admin_print_scripts-post.php', 'ot_admin_scripts', 11 );
|
197 |
+
|
198 |
+
/* add styles for metaboxes to post-new.php & post.php */
|
199 |
+
add_action( 'admin_print_styles-post-new.php', 'ot_admin_styles', 11 );
|
200 |
+
add_action( 'admin_print_styles-post.php', 'ot_admin_styles', 11 );
|
201 |
+
|
202 |
+
/* prepares the after save do_action */
|
203 |
+
add_action( 'admin_init', 'ot_after_theme_options_save', 1 );
|
204 |
+
|
205 |
+
/* default settings */
|
206 |
+
add_action( 'admin_init', 'ot_default_settings', 2 );
|
207 |
+
|
208 |
+
/* add xml to upload filetypes array */
|
209 |
+
add_action( 'admin_init', 'ot_add_xml_to_upload_filetypes', 3 );
|
210 |
+
|
211 |
+
/* import */
|
212 |
+
add_action( 'admin_init', 'ot_import', 4 );
|
213 |
+
|
214 |
+
/* save settings */
|
215 |
+
add_action( 'admin_init', 'ot_save_settings', 5 );
|
216 |
+
|
217 |
+
/* save layouts */
|
218 |
+
add_action( 'admin_init', 'ot_modify_layouts', 6 );
|
219 |
+
|
220 |
+
/* create media post */
|
221 |
+
add_action( 'admin_init', 'ot_create_media_post', 7 );
|
222 |
+
|
223 |
+
/* global CSS */
|
224 |
+
add_action( 'admin_head', array( &$this, 'global_admin_css' ) );
|
225 |
+
|
226 |
+
/* dynamic front-end CSS */
|
227 |
+
add_action( 'wp_enqueue_scripts', 'ot_load_dynamic_css' );
|
228 |
+
|
229 |
+
/* insert theme CSS dynamically */
|
230 |
+
add_action( 'ot_after_theme_options_save', 'ot_save_css' );
|
231 |
+
|
232 |
+
/* AJAX call to create a new section */
|
233 |
+
add_action( 'wp_ajax_add_section', array( &$this, 'add_section' ) );
|
234 |
+
|
235 |
+
/* AJAX call to create a new setting */
|
236 |
+
add_action( 'wp_ajax_add_setting', array( &$this, 'add_setting' ) );
|
237 |
+
|
238 |
+
/* AJAX call to create a new contextual help */
|
239 |
+
add_action( 'wp_ajax_add_contextual_help', array( &$this, 'add_contextual_help' ) );
|
240 |
+
|
241 |
+
/* AJAX call to create a new choice */
|
242 |
+
add_action( 'wp_ajax_add_choice', array( &$this, 'add_choice' ) );
|
243 |
+
|
244 |
+
/* AJAX call to create a new list item setting */
|
245 |
+
add_action( 'wp_ajax_add_list_item_setting', array( &$this, 'add_list_item_setting' ) );
|
246 |
+
|
247 |
+
/* AJAX call to create a new layout */
|
248 |
+
add_action( 'wp_ajax_add_layout', array( &$this, 'add_layout' ) );
|
249 |
+
|
250 |
+
/* AJAX call to create a new list item */
|
251 |
+
add_action( 'wp_ajax_add_list_item', array( &$this, 'add_list_item' ) );
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Adds the global CSS to fix the menu icon.
|
257 |
+
*/
|
258 |
+
public function global_admin_css() {
|
259 |
+
echo '
|
260 |
+
<style>
|
261 |
+
#adminmenu #toplevel_page_ot-settings .wp-menu-image img { padding: 4px 0px 1px 2px !important; }
|
262 |
+
</style>
|
263 |
+
';
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* AJAX utility function for adding a new section.
|
268 |
+
*/
|
269 |
+
public function add_section() {
|
270 |
+
echo ot_sections_view( 'option_tree_settings[sections]', $_GET['count'] );
|
271 |
+
die();
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* AJAX utility function for adding a new setting.
|
276 |
+
*/
|
277 |
+
public function add_setting() {
|
278 |
+
echo ot_settings_view( $_GET['name'], $_GET['count'] );
|
279 |
+
die();
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* AJAX utility function for adding a new list item setting.
|
284 |
+
*/
|
285 |
+
public function add_list_item_setting() {
|
286 |
+
echo ot_settings_view( $_GET['name'] . '[settings]', $_GET['count'] );
|
287 |
+
die();
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* AJAX utility function for adding new contextual help content.
|
292 |
+
*/
|
293 |
+
public function add_contextual_help() {
|
294 |
+
echo ot_contextual_help_view( $_GET['name'], $_GET['count'] );
|
295 |
+
die();
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* AJAX utility function for adding a new choice.
|
300 |
+
*/
|
301 |
+
public function add_choice() {
|
302 |
+
echo ot_choices_view( $_GET['name'], $_GET['count'] );
|
303 |
+
die();
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* AJAX utility function for adding a new layout.
|
308 |
+
*/
|
309 |
+
public function add_layout() {
|
310 |
+
echo ot_layout_view( $_GET['count'] );
|
311 |
+
die();
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* AJAX utility function for adding a new list item.
|
316 |
+
*/
|
317 |
+
public function add_list_item() {
|
318 |
+
ot_list_item_view( $_GET['name'], $_GET['count'], array(), $_GET['post_id'], $_GET['get_option'], unserialize( base64_decode( $_GET['settings'] ) ), $_GET['type'] );
|
319 |
+
die();
|
320 |
+
}
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Instantiate the OptionTree loader class.
|
326 |
+
*
|
327 |
+
* @since 2.0
|
328 |
+
*/
|
329 |
+
$ot_loader =& new OT_Loader();
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
/* End of file ot-loader.php */
|
334 |
+
/* Location: ./ot-loader.php */
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== OptionTree ===
|
2 |
Contributors: valendesigns
|
3 |
-
Donate link:
|
4 |
-
Tags: admin, theme options, options, admin interface, ajax
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag:
|
8 |
License: GPLv2
|
9 |
|
10 |
-
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -17,13 +17,7 @@ With OptionTree you can create as many Theme Options as your project requires an
|
|
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 |
-
|
21 |
-
|
22 |
-
**Update**: Since v1.1.8 you can build custom CSS code that will automatically get inserted into dynamic.css (created by the server) or any file you choose, just be sure it's permissions are writable. As well, typography & background options were added with a ton of filters to extend them.
|
23 |
-
|
24 |
-
**Update**: Since v1.1.7 you can create layouts (theme variations) and import/export those layouts. You can also activate them at anytime from the Theme Options page. Added an upload feature to the slider.
|
25 |
-
|
26 |
-
**Update**: Since v1.1.6 it's now possible to have a default XML file included in your theme to populate the theme options and hide the 'Settings' and 'Documentation' pages from the end uses. You can read more about this in the plugins built in documentation by clicking the 'Theme Integration' tab.
|
27 |
|
28 |
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!
|
29 |
|
@@ -31,23 +25,38 @@ OptionTree is a project sponsored by <a href="http://themeforest.net/?ref=valend
|
|
31 |
|
32 |
1. Upload `option-tree` to the `/wp-content/plugins/` directory
|
33 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
34 |
-
1. If included in your theme, import the XML file & data by going to `OptionTree->Settings->Import`
|
35 |
1. Click the `OptionTree->Documentation` link in the WordPress admin sidebar menu for further setup assistance.
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
39 |
= Is this plugin PHP5 only? =
|
40 |
|
41 |
-
|
42 |
|
43 |
== Screenshots ==
|
44 |
|
45 |
-
1.
|
46 |
-
2.
|
47 |
3. Documentation
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
= 1.1.8.1 =
|
52 |
* Removed get_option_tree() in the WordPress admin area due to theme conflicts.
|
53 |
* Removed demo files in the assets folder at the request of WordPress
|
@@ -126,6 +135,9 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
|
|
126 |
|
127 |
== Upgrade Notice ==
|
128 |
|
|
|
|
|
|
|
129 |
= 1.1.8.1 =
|
130 |
Removed get_option_tree() in the WordPress admin area due to theme conflicts.
|
131 |
|
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.3
|
6 |
+
Tested up to: 3.5
|
7 |
+
Stable tag: 2.0
|
8 |
License: GPLv2
|
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 |
|
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 |
|
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.0 =
|
45 |
+
* Complete rewrite form the ground up.
|
46 |
+
* Better Theme Options UI Builder.
|
47 |
+
* New in-plugin documentation.
|
48 |
+
* Brand new responsive UI.
|
49 |
+
* Add new option types, most notable the List Item which should eventually replace the Slider.
|
50 |
+
* Added the simpler ot_get_option() function to eventually replace get_option_tree().
|
51 |
+
* Added support for Meta Boxes.
|
52 |
+
* Added Theme Mode where you can now include the plugin directly in your theme.
|
53 |
+
* Better validation on saved data.
|
54 |
+
* Simplified the import process.
|
55 |
+
* Added support for contextual help.
|
56 |
+
* Permanently move the Theme Option to the Appearance tab.
|
57 |
+
* Added a ton of filters.
|
58 |
+
* Made huge improvements to the code base and tested rigorously.
|
59 |
+
|
60 |
= 1.1.8.1 =
|
61 |
* Removed get_option_tree() in the WordPress admin area due to theme conflicts.
|
62 |
* Removed demo files in the assets folder at the request of WordPress
|
135 |
|
136 |
== Upgrade Notice ==
|
137 |
|
138 |
+
= 2.0 =
|
139 |
+
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.
|
140 |
+
|
141 |
= 1.1.8.1 =
|
142 |
Removed get_option_tree() in the WordPress admin area due to theme conflicts.
|
143 |
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|