Version Description
- Fixed scrolling issue on extra tall pages
- Added ability to show/hide settings & documentation via the User Profile page.
- Added Background option type.
- Added Typography option type.
- Added CSS option type.
- Better looking selects with 1=Yes,2=No where '1' is the value and 'Yes' is the text in the select.
- Made the AJAX message CSS more prominent.
- functions.load.php will now only load option type functions if viewing an OT admin page.
- Deregistered the custom jQuery UI in the 'Cispm Mail Contact' plugin when viewing an OptionTree page.
- Can now save layouts from the Theme Options page.
- You can now change the slider fields by targeting a specific "Option Key"
- Modified upload for situations where you manually enter a relative path
- Allow get_option_tree() function to be used in WP admin
- Changed permissions to edit_theme_options
Download this release
Release Info
Developer | valendesigns |
Plugin | OptionTree |
Version | 1.1.8 |
Comparing to | |
See all releases |
Code changes from version 1.1.7.1 to 1.1.8
- assets/css/style.css +56 -25
- assets/js/jquery.option.tree.js +96 -29
- classes/class.admin.php +87 -16
- front-end/docs.php +108 -61
- front-end/options.php +45 -41
- front-end/settings.php +31 -29
- functions/admin/background.php +96 -0
- functions/admin/css.php +31 -0
- functions/admin/measurement.php +2 -15
- functions/admin/select.php +6 -6
- functions/admin/slider.php +6 -7
- functions/admin/typography.php +102 -0
- functions/admin/upload.php +6 -9
- functions/functions.load.php +8 -6
- functions/functions.php +384 -0
- functions/get-option-tree.php +10 -21
- index.php +14 -3
- readme.txt +24 -6
assets/css/style.css
CHANGED
@@ -97,6 +97,25 @@ a:hover strong {
|
|
97 |
border-top: 1px solid #fff;
|
98 |
border-bottom: 1px solid #e3e3e3;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
a.toggle_tabs {
|
101 |
cursor: pointer;
|
102 |
background: url(../images/toggle_tabs.png) no-repeat -2px -1px;
|
@@ -151,28 +170,28 @@ a:hover strong {
|
|
151 |
}
|
152 |
.ajax-message {
|
153 |
position: absolute;
|
154 |
-
left:
|
155 |
-
top:
|
156 |
-
width:
|
157 |
z-index: 100;
|
158 |
display: none;
|
159 |
overflow: visible;
|
160 |
}
|
161 |
#framework_wrap #content_wrap .message {
|
162 |
text-align: center;
|
163 |
-
color: #
|
164 |
-
text-shadow: 0 1px 0 #
|
165 |
-
font-size:
|
166 |
-
line-height:
|
167 |
-
padding:
|
168 |
-
background: #
|
169 |
-
border: 1px solid #
|
170 |
-webkit-border-radius: 5px;
|
171 |
-moz-border-radius: 5px;
|
172 |
border-radius: 5px;
|
173 |
-
-moz-box-shadow: 0px 2px 5px
|
174 |
-
-webkit-box-shadow: 0px 2px 5px
|
175 |
-
box-shadow: 0px 2px 5px
|
176 |
}
|
177 |
#framework_wrap #content_wrap .message span {
|
178 |
display: block;
|
@@ -517,7 +536,7 @@ a:hover strong {
|
|
517 |
#framework_wrap #content input[type="text"],
|
518 |
#framework_wrap #content select,
|
519 |
#framework_wrap #content textarea,
|
520 |
-
#framework_wrap input.input_layout {
|
521 |
background: #fafafa;
|
522 |
border-color: #ccc #eee #eee #ccc;
|
523 |
border-style: solid;
|
@@ -531,11 +550,14 @@ a:hover strong {
|
|
531 |
color: #888;
|
532 |
resize: none;
|
533 |
}
|
534 |
-
#framework_wrap
|
|
|
|
|
|
|
535 |
-webkit-border-radius: 4px;
|
536 |
-moz-border-radius: 4px;
|
537 |
border-radius: 4px;
|
538 |
-
width:
|
539 |
float: left;
|
540 |
}
|
541 |
#framework_wrap #content tbody tr.inline-edit-option td input[type="text"],
|
@@ -610,8 +632,8 @@ a:hover strong {
|
|
610 |
#framework_wrap #content input[type="text"]:hover,
|
611 |
#framework_wrap #content select:hover,
|
612 |
#framework_wrap #content textarea:hover,
|
613 |
-
#framework_wrap input:hover.input_layout,
|
614 |
-
#framework_wrap input:focus.input_layout {
|
615 |
background: #fff;
|
616 |
border-color: #bbb #eee #eee #bbb;
|
617 |
color: #333;
|
@@ -627,11 +649,14 @@ a:hover strong {
|
|
627 |
width: 100%;
|
628 |
padding-top: 15px;
|
629 |
}
|
630 |
-
#framework_wrap .select-layout
|
|
|
|
|
631 |
float: right;
|
632 |
-
|
633 |
-
|
634 |
-
|
|
|
635 |
}
|
636 |
#framework_wrap .select-layout select {
|
637 |
margin: 5px 10px 0 0;
|
@@ -650,10 +675,9 @@ a:hover strong {
|
|
650 |
border-width: 1px;
|
651 |
float: left;
|
652 |
height: 26px;
|
653 |
-
width:
|
654 |
margin: 0;
|
655 |
margin-bottom: 9px !important;
|
656 |
-
width: 344px;
|
657 |
display: block;
|
658 |
color: #888;
|
659 |
}
|
@@ -1096,4 +1120,11 @@ div.file_wrap {
|
|
1096 |
filter: alpha(opacity: 0);
|
1097 |
opacity: 0;
|
1098 |
z-index: 2;
|
1099 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
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;
|
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;
|
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"],
|
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;
|
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;
|
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 |
}
|
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 |
+
}
|
assets/js/jquery.option.tree.js
CHANGED
@@ -112,7 +112,7 @@
|
|
112 |
// Activate
|
113 |
$("#options_tabs").tabs();
|
114 |
// Append Toggle Button
|
115 |
-
$('.top-info').
|
116 |
// Toggle Tabs
|
117 |
$('.toggle_tabs').toggle(function() {
|
118 |
$("#options_tabs").tabs('destroy');
|
@@ -141,30 +141,36 @@
|
|
141 |
init: function () {
|
142 |
var formfield,
|
143 |
formID,
|
144 |
-
btnContent =
|
|
|
145 |
// On Click
|
146 |
$('.upload_button').live("click", function () {
|
147 |
formfield = $(this).prev('input').attr('id');
|
148 |
formID = $(this).attr('rel');
|
149 |
tb_show('', 'media-upload.php?post_id='+formID+'&type=image&TB_iframe=1');
|
|
|
150 |
return false;
|
151 |
});
|
152 |
-
|
153 |
window.original_send_to_editor = window.send_to_editor;
|
154 |
window.send_to_editor = function(html) {
|
155 |
if (formfield) {
|
|
|
156 |
itemurl = $(html).attr('href');
|
157 |
var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi;
|
158 |
var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi;
|
159 |
var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi;
|
160 |
var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi;
|
161 |
-
if (itemurl
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
165 |
}
|
166 |
$('#' + formfield).val(itemurl);
|
167 |
-
$('#' + formfield
|
|
|
|
|
168 |
tb_remove();
|
169 |
} else {
|
170 |
window.original_send_to_editor(html);
|
@@ -177,6 +183,13 @@
|
|
177 |
})
|
178 |
})(jQuery);
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
/**
|
181 |
*
|
182 |
* Inline Edit Options
|
@@ -195,8 +208,13 @@
|
|
195 |
return false;
|
196 |
});
|
197 |
$('.reload-options', '#the-theme-options').live("click", function () {
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
200 |
});
|
201 |
$('.reset', '#the-theme-options').live("click", function () {
|
202 |
var agree = confirm("Are you absolutely sure you wish to delete all of your saved Theme Option?");
|
@@ -220,6 +238,14 @@
|
|
220 |
e.preventDefault();
|
221 |
return false;
|
222 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
$('a.delete-saved').live("click", function () {
|
224 |
if ($("a.delete-saved").hasClass('disable')) {
|
225 |
event.preventDefault();
|
@@ -229,22 +255,24 @@
|
|
229 |
if (agree) {
|
230 |
inlineEditOption.delete_layout(this);
|
231 |
return false;
|
232 |
-
} else {
|
233 |
-
return false;
|
234 |
}
|
235 |
}
|
|
|
236 |
});
|
237 |
$("a.activate-saved").live("click", function(){
|
238 |
var agree = confirm("Are you sure you want to activate this layout?");
|
239 |
if (agree) {
|
240 |
inlineEditOption.activate_layout(this);
|
241 |
return false;
|
242 |
-
} else {
|
243 |
-
return false;
|
244 |
}
|
|
|
245 |
});
|
246 |
$('.user-activate-layout', '#the-theme-options').live("click", function () {
|
247 |
-
|
|
|
|
|
|
|
|
|
248 |
return false;
|
249 |
});
|
250 |
$("a.edit-inline").live("click", function (event) {
|
@@ -352,21 +380,24 @@
|
|
352 |
img.attr('src', val);
|
353 |
}
|
354 |
// no image to change add it
|
355 |
-
if ( val !== '' && ( typeof src == 'undefined' || src == false ) ) {
|
356 |
btnContent = '<img src="'+val+'" alt="" /><a href="" class="remove">Remove Image</a>';
|
357 |
-
$(this).parent().
|
358 |
-
|
|
|
359 |
img.remove();
|
360 |
btn.remove();
|
361 |
}
|
362 |
});
|
363 |
-
// add
|
364 |
$('.cp_input').live('blur', function() {
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
370 |
});
|
371 |
},
|
372 |
save_options: function (e) {
|
@@ -414,9 +445,26 @@
|
|
414 |
.removeAttr('checked')
|
415 |
.removeAttr('selected');
|
416 |
$('.select').each(function () {
|
|
|
417 |
var new_text = '-- Choose One --';
|
418 |
-
if (
|
419 |
new_text = ' --';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
$(this).prev('span').html(new_text);
|
421 |
});
|
422 |
$('ul.option-tree-slider-wrap li').each(function () {
|
@@ -455,6 +503,24 @@
|
|
455 |
}
|
456 |
});
|
457 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
},
|
459 |
activate_layout: function (b) {
|
460 |
var c = true;
|
@@ -661,7 +727,7 @@
|
|
661 |
$('.option-desc', '#edit-'+c).show();
|
662 |
$('.option-options', '#edit-'+c).show();
|
663 |
} else {
|
664 |
-
if (temp_select == 'Textarea') {
|
665 |
$('.regular').hide();
|
666 |
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
667 |
$('.option-desc', '#edit-'+c).show();
|
@@ -682,7 +748,8 @@
|
|
682 |
});
|
683 |
|
684 |
// Scroll
|
685 |
-
$('
|
|
|
686 |
|
687 |
return false;
|
688 |
},
|
@@ -809,7 +876,7 @@
|
|
809 |
$('.option-desc', editRow).show();
|
810 |
$('.option-options', editRow).show();
|
811 |
} else {
|
812 |
-
if (temp_select == 'Textarea') {
|
813 |
$('.regular').hide();
|
814 |
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
815 |
$('.option-desc', editRow).show();
|
@@ -844,7 +911,7 @@
|
|
844 |
$('.option-desc', editRow).show();
|
845 |
$('.option-options', editRow).show();
|
846 |
} else {
|
847 |
-
if (temp_select == 'Textarea') {
|
848 |
$('.regular').hide();
|
849 |
$('.alternative').show().html('<strong>Row Count:</strong> Enter a numeric value for the number of rows in your textarea.');
|
850 |
$('.option-desc', editRow).show();
|
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');
|
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);
|
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
|
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?");
|
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();
|
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) {
|
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) {
|
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 () {
|
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;
|
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();
|
748 |
});
|
749 |
|
750 |
// Scroll
|
751 |
+
var $elem = $('#framework_wrap');
|
752 |
+
$('html, body').animate({ scrollTop: $elem.height() }, 500);
|
753 |
|
754 |
return false;
|
755 |
},
|
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();
|
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();
|
classes/class.admin.php
CHANGED
@@ -44,6 +44,7 @@ class OT_Admin
|
|
44 |
|
45 |
$this->version = OT_VERSION;
|
46 |
$this->table_name = $table_prefix . 'option_tree';
|
|
|
47 |
$this->option_array = $this->option_tree_data();
|
48 |
|
49 |
// file path & name without extention
|
@@ -70,11 +71,7 @@ class OT_Admin
|
|
70 |
$this->has_xml = ( is_readable( $this->theme_options_xml ) ) ? true : false;
|
71 |
$this->has_data = ( is_readable( $this->theme_options_data ) ) ? true : false;
|
72 |
$this->has_layout = ( is_readable( $this->theme_options_layout ) ) ? true : false;
|
73 |
-
|
74 |
-
// show or hide docs
|
75 |
-
// TODO find a way to set this outside of the plugin before it loads
|
76 |
-
$this->show_docs = false;
|
77 |
-
|
78 |
}
|
79 |
|
80 |
/**
|
@@ -383,7 +380,7 @@ class OT_Admin
|
|
383 |
global $wpdb;
|
384 |
|
385 |
// export XML - run before anything else
|
386 |
-
if ( isset($_GET['action']) && $_GET['action'] == 'export' )
|
387 |
option_tree_export_xml( $this->option_tree_data(), $this->table_name );
|
388 |
|
389 |
// grab saved table option
|
@@ -406,7 +403,7 @@ class OT_Admin
|
|
406 |
if ( $this->has_xml == true && $this->show_docs == false )
|
407 |
{
|
408 |
// create menu item
|
409 |
-
$option_tree_options = add_submenu_page( 'themes.php', 'OptionTree Theme Options','Theme Options', '
|
410 |
|
411 |
// add menu item
|
412 |
add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
|
@@ -417,17 +414,16 @@ class OT_Admin
|
|
417 |
$icon = ( get_user_option( 'admin_color' ) == 'classic' ) ? OT_PLUGIN_URL.'/assets/images/icon_classic.png' : OT_PLUGIN_URL.'/assets/images/icon_dark.png';
|
418 |
|
419 |
// create menu items
|
420 |
-
add_object_page( 'OptionTree', 'OptionTree', '
|
421 |
-
$option_tree_options = add_submenu_page( 'option_tree', 'OptionTree', 'Theme Options', '
|
422 |
-
$option_tree_docs = add_submenu_page( 'option_tree', 'OptionTree', 'Documentation', '
|
423 |
-
$option_tree_settings = add_submenu_page( 'option_tree', 'OptionTree', 'Settings', '
|
424 |
|
425 |
// add menu items
|
426 |
add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
|
427 |
add_action( "admin_print_styles-$option_tree_docs", array( $this, 'option_tree_load' ) );
|
428 |
add_action( "admin_print_styles-$option_tree_settings", array( $this, 'option_tree_load' ) );
|
429 |
}
|
430 |
-
|
431 |
}
|
432 |
|
433 |
/**
|
@@ -462,6 +458,9 @@ class OT_Admin
|
|
462 |
// remove GD star rating conflicts
|
463 |
wp_deregister_style( 'gdsr-jquery-ui-core' );
|
464 |
wp_deregister_style( 'gdsr-jquery-ui-theme' );
|
|
|
|
|
|
|
465 |
}
|
466 |
|
467 |
/**
|
@@ -1035,7 +1034,7 @@ class OT_Admin
|
|
1035 |
}
|
1036 |
|
1037 |
// action == upload
|
1038 |
-
if ( isset($_GET['action']) && $_GET['action'] == 'upload' )
|
1039 |
{
|
1040 |
// fail no file
|
1041 |
if ( $_FILES["import"]['name'] == null )
|
@@ -1203,7 +1202,16 @@ class OT_Admin
|
|
1203 |
global $wpdb;
|
1204 |
|
1205 |
// check AJAX referer
|
1206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1207 |
|
1208 |
// Get Data
|
1209 |
$string = $_REQUEST['options_name'];
|
@@ -1236,8 +1244,16 @@ class OT_Admin
|
|
1236 |
|
1237 |
// hook after save, before AJAX is returned
|
1238 |
do_action( 'option_tree_save_layout' );
|
1239 |
-
|
1240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1241 |
}
|
1242 |
|
1243 |
/**
|
@@ -1475,6 +1491,11 @@ class OT_Admin
|
|
1475 |
*/
|
1476 |
function create_option_post()
|
1477 |
{
|
|
|
|
|
|
|
|
|
|
|
1478 |
register_post_type( 'option-tree', array(
|
1479 |
'labels' => array(
|
1480 |
'name' => __( 'Options' ),
|
@@ -1639,5 +1660,55 @@ class OT_Admin
|
|
1639 |
delete_post_meta( $post_id, '_edit_lock' );
|
1640 |
delete_post_meta( $post_id, '_edit_last' );
|
1641 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1642 |
|
1643 |
}
|
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
|
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 |
/**
|
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
|
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' ) );
|
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 |
/**
|
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 |
/**
|
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 )
|
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'];
|
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 |
/**
|
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' ),
|
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 |
}
|
front-end/docs.php
CHANGED
@@ -236,7 +236,7 @@ if ( function_exists( 'get_option_tree' ) ) {
|
|
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>" 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>
|
@@ -306,8 +306,7 @@ if ( function_exists( 'get_option_tree' ) ) {
|
|
306 |
|
307 |
<pre><code>add_filter( 'measurement_unit_types', 'custom_unit_types' );
|
308 |
|
309 |
-
function custom_unit_types()
|
310 |
-
{
|
311 |
$array = array(
|
312 |
'in' => 'inches',
|
313 |
'ft' => 'feet'
|
@@ -322,8 +321,7 @@ function custom_unit_types()
|
|
322 |
|
323 |
<pre><code>add_filter( 'measurement_unit_types', 'custom_unit_types' );
|
324 |
|
325 |
-
function custom_unit_types($array)
|
326 |
-
{
|
327 |
$array['in'] = 'inches';
|
328 |
$array['ft'] = 'feet';
|
329 |
return $array;
|
@@ -337,50 +335,89 @@ function custom_unit_types($array)
|
|
337 |
<strong>Filter to completely change the input fields in the Slider option type</strong><br />
|
338 |
Added to functions.php
|
339 |
</p>
|
340 |
-
<pre><code>add_filter( 'image_slider_fields', 'new_slider_fields' );
|
341 |
|
342 |
-
function new_slider_fields()
|
343 |
-
{
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
365 |
}</code></pre>
|
366 |
|
367 |
<p>
|
368 |
<strong>Filter to add a new field to the Slider option type</strong><br />
|
369 |
Added to functions.php
|
370 |
</p>
|
371 |
-
<pre><code>add_filter( 'image_slider_fields', 'new_slider_fields' );
|
372 |
|
373 |
-
function new_slider_fields($
|
374 |
-
{
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
383 |
}</code></pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
</div>
|
386 |
|
@@ -403,27 +440,37 @@ function new_slider_fields($array)
|
|
403 |
You are required to choose one of the supported option types. They are:
|
404 |
</p>
|
405 |
<ul class="doc_list">
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
</ul>
|
428 |
|
429 |
<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>
|
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'
|
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;
|
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 |
|
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>
|
front-end/options.php
CHANGED
@@ -1,5 +1,4 @@
|
|
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">
|
@@ -14,45 +13,56 @@
|
|
14 |
|
15 |
<form method="post" id="the-theme-options">
|
16 |
|
17 |
-
<div class="info top-info">
|
18 |
|
19 |
<input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit" />
|
20 |
-
|
21 |
-
<?php if ( $this->has_xml && $this->show_docs == false ) { ?>
|
22 |
-
<input type="submit" value="<?php _e('Reload XML') ?>" class="button-framework reload-options" name="reload" style="margin-right:10px;" />
|
23 |
-
<?php } ?>
|
24 |
-
<?php
|
25 |
-
if ( is_array( $layouts ) && !empty($layouts) )
|
26 |
-
{
|
27 |
-
echo '<div class="select-layout">';
|
28 |
-
echo '<select name="active_theme_layout" id="active_theme_layout">';
|
29 |
-
echo '<option value="">-- Choose One --</option>';
|
30 |
|
31 |
-
|
32 |
-
foreach( $layouts as $key => $v )
|
33 |
-
{
|
34 |
-
if ( $key == 'active_layout')
|
35 |
-
continue;
|
36 |
-
|
37 |
-
$selected = '';
|
38 |
-
if ( $active_layout == trim( $key ) )
|
39 |
-
$selected = ' selected="selected"';
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
</div>
|
52 |
|
53 |
-
<div class="ajax-message<?php if ( isset( $message ) || isset($_GET['updated']) || isset($_GET['layout']) ) { echo ' show'; } ?>">
|
54 |
<?php if (isset($_GET['updated'])) { echo '<div class="message"><span> </span>Theme Options were updated.</div>'; } ?>
|
55 |
<?php if (isset($_GET['layout'])) { echo '<div class="message"><span> </span>Your Layout has been activated.</div>'; } ?>
|
|
|
56 |
<?php if ( isset( $message ) ) { echo $message; } ?>
|
57 |
</div>
|
58 |
|
@@ -76,19 +86,13 @@
|
|
76 |
// set count
|
77 |
$count = 0;
|
78 |
// loop options & load corresponding function
|
79 |
-
foreach ( $ot_array as $value )
|
80 |
-
{
|
81 |
$count++;
|
82 |
-
if ( $value->item_type == 'upload' || $value->item_type == 'slider' )
|
83 |
-
{
|
84 |
$int = $post_id;
|
85 |
-
}
|
86 |
-
|
87 |
-
{
|
88 |
-
$int = ( is_numeric( trim( $value->item_options ) ) ) ? trim( $value->item_options ) : 8;
|
89 |
-
}
|
90 |
-
else
|
91 |
-
{
|
92 |
$int = $count;
|
93 |
}
|
94 |
call_user_func_array( 'option_tree_' . $value->item_type, array( $value, $settings, $int ) );
|
1 |
<?php if (!defined('OT_VERSION')) exit('No direct script access allowed'); ?>
|
|
|
2 |
<div id="framework_wrap" class="wrap">
|
3 |
|
4 |
<div id="header">
|
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 |
|
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 ) );
|
front-end/settings.php
CHANGED
@@ -112,31 +112,33 @@
|
|
112 |
<div class="select_wrapper">
|
113 |
<select name="item_type" class="select item_type">
|
114 |
<?php
|
115 |
-
$types = array(
|
116 |
-
'heading'
|
117 |
-
'
|
118 |
-
'
|
119 |
-
'
|
120 |
-
'
|
121 |
-
'
|
122 |
-
'
|
123 |
-
'
|
124 |
-
'
|
125 |
-
'
|
126 |
-
'
|
127 |
-
'page'
|
128 |
-
'pages'
|
129 |
-
'
|
130 |
-
'
|
131 |
-
'
|
132 |
-
'
|
133 |
-
'
|
134 |
-
'
|
135 |
-
'
|
136 |
-
'
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
echo '<option value="'.$key.'">'.$value.'</option>';
|
141 |
}
|
142 |
?>
|
@@ -200,7 +202,7 @@
|
|
200 |
<div id="import_options" class="block">
|
201 |
<h2>Import</h2>
|
202 |
|
203 |
-
<form method="post" action="admin.php?page=option_tree_settings&action=upload" enctype="multipart/form-data" id="upload-xml">
|
204 |
<input type="hidden" name="action" value="upload" />
|
205 |
<div class="option option-upload">
|
206 |
<h3>Theme Options XML</h3>
|
@@ -251,7 +253,7 @@
|
|
251 |
|
252 |
<div id="export_options" class="block">
|
253 |
<h2>Export</h2>
|
254 |
-
<form method="post" action="admin.php?page=option_tree_settings&action=export">
|
255 |
<div class="option option-input">
|
256 |
<h3>Theme Options XML</h3>
|
257 |
<div class="section desc-text">
|
@@ -294,7 +296,7 @@
|
|
294 |
<div class="section">
|
295 |
<div class="element">
|
296 |
<form method="post" id="save-layout">
|
297 |
-
<input type="
|
298 |
<?php wp_nonce_field( '_save_layout', '_ajax_nonce', false ); ?>
|
299 |
<input type="submit" value="Save Layout" class="ob_button right save-layout" />
|
300 |
</form>
|
@@ -322,7 +324,7 @@
|
|
322 |
<?php
|
323 |
if ( is_array( $layouts ) && !empty($layouts) ) {
|
324 |
arsort( $layouts );
|
325 |
-
$active_layout = $layouts['active_layout'];
|
326 |
foreach( $layouts as $key => $values ) {
|
327 |
if ( $key == 'active_layout')
|
328 |
continue;
|
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 |
?>
|
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>
|
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">
|
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>
|
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;
|
functions/admin/background.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if (!defined('OT_VERSION')) 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/css.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/measurement.php
CHANGED
@@ -26,21 +26,8 @@ function option_tree_measurement( $value, $settings, $int ) { ?>
|
|
26 |
<select name="<?php echo $value->item_id; ?>[1]" class="select">
|
27 |
<?php
|
28 |
echo '<option value=""> -- </option>';
|
29 |
-
$
|
30 |
-
'
|
31 |
-
'%' => '%',
|
32 |
-
'em' => 'em',
|
33 |
-
'pt' => 'pt'
|
34 |
-
);
|
35 |
-
// filter the unit types
|
36 |
-
$units = apply_filters( 'measurement_unit_types', $units );
|
37 |
-
foreach ( $units as $unit ) {
|
38 |
-
if ( isset( $measurement[1] ) && $measurement[1] == trim( $unit ) ) {
|
39 |
-
$selected = ' selected="selected"';
|
40 |
-
} else {
|
41 |
-
$selected = '';
|
42 |
-
}
|
43 |
-
echo '<option'.$selected.' value="'.trim( $unit ).'"> '.trim( $unit ).'</option>';
|
44 |
}
|
45 |
?>
|
46 |
</select>
|
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>
|
functions/admin/select.php
CHANGED
@@ -23,14 +23,14 @@ function option_tree_select( $value, $settings, $int )
|
|
23 |
<select name="<?php echo $value->item_id; ?>" id="<?php echo $value->item_id; ?>" class="select">
|
24 |
<?php
|
25 |
echo '<option value="">-- Choose One --</option>';
|
26 |
-
foreach ( $options_array as $option )
|
27 |
-
{
|
28 |
$selected = '';
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
}
|
33 |
-
echo '<option'.$selected.'>'.trim( $option ).'</option>';
|
34 |
}
|
35 |
?>
|
36 |
</select>
|
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>
|
functions/admin/slider.php
CHANGED
@@ -51,8 +51,7 @@ function option_tree_slider( $value, $settings, $int )
|
|
51 |
*
|
52 |
* @return string
|
53 |
*/
|
54 |
-
function option_tree_slider_view( $id, $image, $int, $count )
|
55 |
-
{
|
56 |
// required fileds
|
57 |
$requred_fields = array(
|
58 |
array(
|
@@ -73,7 +72,7 @@ function option_tree_slider_view( $id, $image, $int, $count )
|
|
73 |
$image_slider_fields = array(
|
74 |
array(
|
75 |
'name' => 'image',
|
76 |
-
'type' => '
|
77 |
'label' => 'Image URL',
|
78 |
'class' => ''
|
79 |
),
|
@@ -86,15 +85,15 @@ function option_tree_slider_view( $id, $image, $int, $count )
|
|
86 |
array(
|
87 |
'name' => 'description',
|
88 |
'type' => 'textarea',
|
89 |
-
'label' => '
|
90 |
'class' => ''
|
91 |
)
|
92 |
);
|
93 |
|
94 |
// filter the optional fields
|
95 |
-
$image_slider_fields = apply_filters( 'image_slider_fields', $image_slider_fields );
|
96 |
|
97 |
-
// merge required & optional
|
98 |
$image_slider_fields = array_merge( $requred_fields, $image_slider_fields );
|
99 |
?>
|
100 |
<div id="option-tree-slider-editor_<?php echo $count; ?>" class="option-tree-slider">
|
@@ -107,7 +106,7 @@ function option_tree_slider_view( $id, $image, $int, $count )
|
|
107 |
<?php
|
108 |
foreach( $image_slider_fields as $field ) {
|
109 |
|
110 |
-
if ( $field['name'] == 'image' ){ ?>
|
111 |
<div>
|
112 |
<label><?php echo $field['label']; ?></label>
|
113 |
<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'; } ?>"/>
|
51 |
*
|
52 |
* @return string
|
53 |
*/
|
54 |
+
function option_tree_slider_view( $id, $image, $int, $count ) {
|
|
|
55 |
// required fileds
|
56 |
$requred_fields = array(
|
57 |
array(
|
72 |
$image_slider_fields = array(
|
73 |
array(
|
74 |
'name' => 'image',
|
75 |
+
'type' => 'image',
|
76 |
'label' => 'Image URL',
|
77 |
'class' => ''
|
78 |
),
|
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">
|
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'; } ?>"/>
|
functions/admin/typography.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
CHANGED
@@ -18,21 +18,17 @@ function option_tree_upload( $value, $settings, $int ) { ?>
|
|
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 |
<div class="screenshot" id="<?php echo $value->item_id; ?>_image">
|
22 |
<?php
|
23 |
-
if ( isset( $settings[$value->item_id] ) && $settings[$value->item_id] != '' )
|
24 |
-
{
|
25 |
$remove = '<a href="javascript:(void);" class="remove">Remove</a>';
|
26 |
$image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $settings[$value->item_id] );
|
27 |
-
if ( $image )
|
28 |
-
{
|
29 |
echo '<img src="'.$settings[$value->item_id].'" alt="" />'.$remove.'';
|
30 |
-
}
|
31 |
-
else
|
32 |
-
{
|
33 |
$parts = explode( "/", $settings[$value->item_id] );
|
34 |
-
for( $i = 0; $i < sizeof($parts); ++$i )
|
35 |
-
{
|
36 |
$title = $parts[$i];
|
37 |
}
|
38 |
echo '<div class="no_image"><a href="'.$settings[$value->item_id].'">'.$title.'</a>'.$remove.'</div>';
|
@@ -40,6 +36,7 @@ function option_tree_upload( $value, $settings, $int ) { ?>
|
|
40 |
}
|
41 |
?>
|
42 |
</div>
|
|
|
43 |
</div>
|
44 |
<div class="description">
|
45 |
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
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>';
|
36 |
}
|
37 |
?>
|
38 |
</div>
|
39 |
+
<?php } ?>
|
40 |
</div>
|
41 |
<div class="description">
|
42 |
<?php echo htmlspecialchars_decode( $value->item_desc ); ?>
|
functions/functions.load.php
CHANGED
@@ -7,8 +7,10 @@
|
|
7 |
* @since 1.0.0
|
8 |
* @author Derek Herman
|
9 |
*/
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
include( OT_PLUGIN_DIR . '/functions/admin/export.php' );
|
13 |
include( OT_PLUGIN_DIR . '/functions/admin/heading.php' );
|
14 |
include( OT_PLUGIN_DIR . '/functions/admin/input.php' );
|
@@ -26,8 +28,8 @@ if ( is_admin() )
|
|
26 |
include( OT_PLUGIN_DIR . '/functions/admin/custom-post.php' );
|
27 |
include( OT_PLUGIN_DIR . '/functions/admin/measurement.php' );
|
28 |
include( OT_PLUGIN_DIR . '/functions/admin/slider.php' );
|
|
|
|
|
|
|
29 |
}
|
30 |
-
|
31 |
-
{
|
32 |
-
include( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );
|
33 |
-
}
|
7 |
* @since 1.0.0
|
8 |
* @author Derek Herman
|
9 |
*/
|
10 |
+
include( OT_PLUGIN_DIR . '/functions/functions.php' );
|
11 |
+
include( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );
|
12 |
+
|
13 |
+
if ( is_admin() && isset( $_GET['page'] ) && strpos( '_' . $_GET['page'], 'option_tree' ) ) {
|
14 |
include( OT_PLUGIN_DIR . '/functions/admin/export.php' );
|
15 |
include( OT_PLUGIN_DIR . '/functions/admin/heading.php' );
|
16 |
include( OT_PLUGIN_DIR . '/functions/admin/input.php' );
|
28 |
include( OT_PLUGIN_DIR . '/functions/admin/custom-post.php' );
|
29 |
include( OT_PLUGIN_DIR . '/functions/admin/measurement.php' );
|
30 |
include( OT_PLUGIN_DIR . '/functions/admin/slider.php' );
|
31 |
+
include( OT_PLUGIN_DIR . '/functions/admin/background.php' );
|
32 |
+
include( OT_PLUGIN_DIR . '/functions/admin/typography.php' );
|
33 |
+
include( OT_PLUGIN_DIR . '/functions/admin/css.php' );
|
34 |
}
|
35 |
+
|
|
|
|
|
|
functions/functions.php
ADDED
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
functions/get-option-tree.php
CHANGED
@@ -15,8 +15,7 @@
|
|
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 |
-
{
|
20 |
// load saved options
|
21 |
if ( !$options )
|
22 |
$options = get_option( 'option_tree' );
|
@@ -29,8 +28,7 @@ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array
|
|
29 |
$content = option_tree_stripslashes( $options[$item_id] );
|
30 |
|
31 |
// is an array
|
32 |
-
if ( $is_array == true )
|
33 |
-
{
|
34 |
// saved as a comma seperated lists of values, explode into an array
|
35 |
if ( !is_array( $content ) )
|
36 |
$content = explode( ',', $content );
|
@@ -38,10 +36,9 @@ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array
|
|
38 |
// get an array value using an offset
|
39 |
if ( is_numeric( $offset ) && $offset >= 0 )
|
40 |
$content = $content[$offset];
|
41 |
-
|
42 |
// not an array
|
43 |
-
else if ( $is_array == false )
|
44 |
-
{
|
45 |
// saved as array, implode and return a comma seperated lists of values
|
46 |
if ( is_array( $content ) )
|
47 |
$content = implode( ',', $content );
|
@@ -66,24 +63,16 @@ function get_option_tree( $item_id = '', $options = '', $echo = false, $is_array
|
|
66 |
*
|
67 |
* @return mixed
|
68 |
*/
|
69 |
-
function option_tree_stripslashes( $input )
|
70 |
-
{
|
71 |
-
|
72 |
-
|
73 |
-
foreach( $input as &$val )
|
74 |
-
{
|
75 |
-
if ( is_array( $val ) )
|
76 |
-
{
|
77 |
$val = option_tree_stripslashes( $val );
|
78 |
-
}
|
79 |
-
else
|
80 |
-
{
|
81 |
$val = stripslashes( $val );
|
82 |
}
|
83 |
}
|
84 |
-
}
|
85 |
-
else
|
86 |
-
{
|
87 |
$input = stripslashes( $input );
|
88 |
}
|
89 |
return $input;
|
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' );
|
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 );
|
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 );
|
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;
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: OptionTree
|
4 |
Plugin URI: http://wp.envato.com
|
5 |
Description: Customizable WordPress Theme Options Admin Interface
|
6 |
-
Version: 1.1.
|
7 |
Author: Derek Herman
|
8 |
Author URI: http://valendesigns.com
|
9 |
License: GPLv2
|
@@ -14,7 +14,7 @@ License: GPLv2
|
|
14 |
*
|
15 |
* @since 1.0.0
|
16 |
*/
|
17 |
-
define( 'OT_VERSION', '1.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 |
|
@@ -54,6 +54,8 @@ register_deactivation_hook( __FILE__, array( $ot_admin, 'option_tree_deactivate'
|
|
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 |
add_action( 'wp_ajax_option_tree_array_save', array( $ot_admin, 'option_tree_array_save' ) );
|
58 |
add_action( 'wp_ajax_option_tree_array_reload', array( $ot_admin, 'option_tree_array_reload' ) );
|
59 |
add_action( 'wp_ajax_option_tree_array_reset', array( $ot_admin, 'option_tree_array_reset' ) );
|
@@ -69,4 +71,13 @@ add_action( 'wp_ajax_option_tree_save_layout', array( $ot_admin, 'option_tree_sa
|
|
69 |
add_action( 'wp_ajax_option_tree_delete_layout', array( $ot_admin, 'option_tree_delete_layout' ) );
|
70 |
add_action( 'wp_ajax_option_tree_activate_layout', array( $ot_admin, 'option_tree_activate_layout' ) );
|
71 |
add_action( 'wp_ajax_option_tree_import_layout', array( $ot_admin, 'option_tree_import_layout' ) );
|
72 |
-
add_action( 'wp_ajax_option_tree_update_export_layout', array( $ot_admin, 'option_tree_update_export_layout' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Plugin Name: OptionTree
|
4 |
Plugin URI: http://wp.envato.com
|
5 |
Description: Customizable WordPress Theme Options Admin Interface
|
6 |
+
Version: 1.1.8
|
7 |
Author: Derek Herman
|
8 |
Author URI: http://valendesigns.com
|
9 |
License: GPLv2
|
14 |
*
|
15 |
* @since 1.0.0
|
16 |
*/
|
17 |
+
define( 'OT_VERSION', '1.1.8' );
|
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 |
|
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' ) );
|
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 );
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: valendesigns
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=accounts@valendesigns.com&item_name=OptionTree
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.1
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2
|
9 |
|
10 |
Extremely customizable Theme Options interface for WordPress.
|
@@ -17,6 +17,8 @@ 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 |
**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.
|
21 |
|
22 |
**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.
|
@@ -34,7 +36,7 @@ OptionTree is a project sponsored by <a href="http://themeforest.net/?ref=valend
|
|
34 |
|
35 |
= Is this plugin PHP5 only? =
|
36 |
|
37 |
-
Sorry, but yes. OptionTree requires PHP5 to work correctly.
|
38 |
|
39 |
== Screenshots ==
|
40 |
|
@@ -44,8 +46,24 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
= 1.1.7.1 =
|
48 |
-
* Revert load
|
49 |
|
50 |
= 1.1.7 =
|
51 |
* Added layout (theme variation) support with save/delete/activate/import/export capabilities. Contributions form Brian of flauntbooks.com
|
@@ -102,8 +120,8 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
|
|
102 |
|
103 |
== Upgrade Notice ==
|
104 |
|
105 |
-
= 1.1.
|
106 |
-
|
107 |
|
108 |
= 1.1.7 =
|
109 |
Lots of additions, none critical just fun. Added layouts & upload to slider. As well, started including action hooks for extending and integrating with other plugins.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=accounts@valendesigns.com&item_name=OptionTree
|
4 |
Tags: admin, theme options, options, admin interface, ajax
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.2.1
|
7 |
+
Stable tag: 1.1.8
|
8 |
License: GPLv2
|
9 |
|
10 |
Extremely customizable Theme Options interface for WordPress.
|
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 |
+
**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.
|
21 |
+
|
22 |
**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.
|
23 |
|
24 |
**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.
|
36 |
|
37 |
= Is this plugin PHP5 only? =
|
38 |
|
39 |
+
Sorry, but yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
|
40 |
|
41 |
== Screenshots ==
|
42 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
= 1.1.8 =
|
50 |
+
* Fixed scrolling issue on extra tall pages
|
51 |
+
* Added ability to show/hide settings & documentation via the User Profile page.
|
52 |
+
* Added Background option type.
|
53 |
+
* Added Typography option type.
|
54 |
+
* Added CSS option type.
|
55 |
+
* Better looking selects with 1=Yes,2=No where '1' is the value and 'Yes' is the text in the select.
|
56 |
+
* Made the AJAX message CSS more prominent.
|
57 |
+
* functions.load.php will now only load option type functions if viewing an OT admin page.
|
58 |
+
* Deregistered the custom jQuery UI in the 'Cispm Mail Contact' plugin when viewing an OptionTree page.
|
59 |
+
* Can now save layouts from the Theme Options page.
|
60 |
+
* You can now change the slider fields by targeting a specific "Option Key"
|
61 |
+
* Modified upload for situations where you manually enter a relative path
|
62 |
+
* Allow get_option_tree() function to be used in WP admin
|
63 |
+
* Changed permissions to edit_theme_options
|
64 |
+
|
65 |
= 1.1.7.1 =
|
66 |
+
* Revert functions.load.php, will fix and update in next version
|
67 |
|
68 |
= 1.1.7 =
|
69 |
* Added layout (theme variation) support with save/delete/activate/import/export capabilities. Contributions form Brian of flauntbooks.com
|
120 |
|
121 |
== Upgrade Notice ==
|
122 |
|
123 |
+
= 1.1.8 =
|
124 |
+
Added Typography, Background, & CSS option types. Lots of way to extend them, as well.
|
125 |
|
126 |
= 1.1.7 =
|
127 |
Lots of additions, none critical just fun. Added layouts & upload to slider. As well, started including action hooks for extending and integrating with other plugins.
|