OptionTree - Version 2.1.4

Version Description

  • Hotfix - Fixed the Numeric Slider not work inside of a newly added List item.
  • Hotfix - Fixed the numeric slider fallback value being set to 0, it now becomes the minimum value if no standard is set.
  • Hotfix - Allow single quotes in std and choice value when exporting theme-options.php. Contributors via github @maimairel.
  • Hotfix - Additional Themecheck bypass for required functions. Contributors via github @maimairel.
  • Hotfix - Fixed post meta information being lost when loading revisions. Contributors via github @live-mesh.
  • Hotfix - Removed template queries in option types. Contributors via github @live-mesh.
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.4

assets/js/ot-admin.js CHANGED
@@ -242,6 +242,7 @@
242
  setTimeout( function() {
243
  OT_UI.init_sortable();
244
  OT_UI.init_select_wrapper();
 
245
  }, 500);
246
  self.processing = false;
247
  }
@@ -330,7 +331,7 @@
330
  if ( typeof href == 'undefined') {
331
  href = $(html).attr('src');
332
  }
333
- if ( typeof href == 'undefined') {
334
  href = $(html).attr('href');
335
  }
336
  var image = /\.(?:jpe?g|png|gif|ico)$/i;
@@ -391,7 +392,7 @@
391
  value = hidden.val(),
392
  helper = $(".ot-numeric-slider-helper-input", this);
393
  if ( ! value ) {
394
- value = 0;
395
  helper.val(value)
396
  }
397
  $(".ot-numeric-slider", this).slider({
@@ -463,7 +464,7 @@
463
  $('#cp_'+field_id).css({'backgroundColor':'#'+hex,'borderColor':'#'+bc});
464
  $('#cp_'+field_id).prev('input').attr('value', '#'+hex);
465
  }
466
- })
467
  .bind('keyup', function(){
468
  $(this).ColorPickerSetColor(this.value);
469
  });
242
  setTimeout( function() {
243
  OT_UI.init_sortable();
244
  OT_UI.init_select_wrapper();
245
+ OT_UI.init_numeric_slider();
246
  }, 500);
247
  self.processing = false;
248
  }
331
  if ( typeof href == 'undefined') {
332
  href = $(html).attr('src');
333
  }
334
+ if ( typeof href == 'undefined') {
335
  href = $(html).attr('href');
336
  }
337
  var image = /\.(?:jpe?g|png|gif|ico)$/i;
392
  value = hidden.val(),
393
  helper = $(".ot-numeric-slider-helper-input", this);
394
  if ( ! value ) {
395
+ value = hidden.data("min");
396
  helper.val(value)
397
  }
398
  $(".ot-numeric-slider", this).slider({
464
  $('#cp_'+field_id).css({'backgroundColor':'#'+hex,'borderColor':'#'+bc});
465
  $('#cp_'+field_id).prev('input').attr('value', '#'+hex);
466
  }
467
+ })
468
  .bind('keyup', function(){
469
  $(this).ColorPickerSetColor(this.value);
470
  });
assets/js/ot-colorpicker.js CHANGED
@@ -5,449 +5,449 @@
5
  * Dependencies: jQuery
6
  */
7
  (function ($) {
8
- var ColorPicker = function () {
9
- var
10
- ids = {},
11
- inAction,
12
- charMin = 65,
13
- visible,
14
- tpl = '<div class="ot_colorpicker colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
15
- defaults = {
16
- eventName: 'click',
17
- onShow: function () {},
18
- onBeforeShow: function(){},
19
- onHide: function () {},
20
- onChange: function () {},
21
- onSubmit: function () {},
22
- color: 'ff0000',
23
- livePreview: true,
24
- flat: false
25
- },
26
- fillRGBFields = function (hsb, cal) {
27
- var rgb = HSBToRGB(hsb);
28
- $(cal).data('colorpicker').fields
29
- .eq(1).val(rgb.r).end()
30
- .eq(2).val(rgb.g).end()
31
- .eq(3).val(rgb.b).end();
32
- },
33
- fillHSBFields = function (hsb, cal) {
34
- $(cal).data('colorpicker').fields
35
- .eq(4).val(hsb.h).end()
36
- .eq(5).val(hsb.s).end()
37
- .eq(6).val(hsb.b).end();
38
- },
39
- fillHexFields = function (hsb, cal) {
40
- $(cal).data('colorpicker').fields
41
- .eq(0).val(HSBToHex(hsb)).end();
42
- },
43
- setSelector = function (hsb, cal) {
44
- $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
45
- $(cal).data('colorpicker').selectorIndic.css({
46
- left: parseInt(150 * hsb.s/100, 10),
47
- top: parseInt(150 * (100-hsb.b)/100, 10)
48
- });
49
- },
50
- setHue = function (hsb, cal) {
51
- $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
52
- },
53
- setCurrentColor = function (hsb, cal) {
54
- $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
55
- },
56
- setNewColor = function (hsb, cal) {
57
- $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
58
- },
59
- keyDown = function (ev) {
60
- var pressedKey = ev.charCode || ev.keyCode || -1;
61
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
62
- return false;
63
- }
64
- var cal = $(this).parent().parent();
65
- if (cal.data('colorpicker').livePreview === true) {
66
- change.apply(this);
67
- }
68
- },
69
- change = function (ev) {
70
- var cal = $(this).parent().parent(), col;
71
- if (this.parentNode.className.indexOf('_hex') > 0) {
72
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
73
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
74
- cal.data('colorpicker').color = col = fixHSB({
75
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
76
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
77
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
78
- });
79
- } else {
80
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
81
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
82
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
83
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
84
- }));
85
- }
86
- if (ev) {
87
- fillRGBFields(col, cal.get(0));
88
- fillHexFields(col, cal.get(0));
89
- fillHSBFields(col, cal.get(0));
90
- }
91
- setSelector(col, cal.get(0));
92
- setHue(col, cal.get(0));
93
- setNewColor(col, cal.get(0));
94
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
95
- },
96
- blur = function (ev) {
97
- var cal = $(this).parent().parent();
98
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')
99
- },
100
- focus = function () {
101
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
102
- $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
103
- $(this).parent().addClass('colorpicker_focus');
104
- },
105
- downIncrement = function (ev) {
106
- var field = $(this).parent().find('input').focus();
107
- var current = {
108
- el: $(this).parent().addClass('colorpicker_slider'),
109
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
110
- y: ev.pageY,
111
- field: field,
112
- val: parseInt(field.val(), 10),
113
- preview: $(this).parent().parent().data('colorpicker').livePreview
114
- };
115
- $(document).bind('mouseup', current, upIncrement);
116
- $(document).bind('mousemove', current, moveIncrement);
117
- },
118
- moveIncrement = function (ev) {
119
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
120
- if (ev.data.preview) {
121
- change.apply(ev.data.field.get(0), [true]);
122
- }
123
- return false;
124
- },
125
- upIncrement = function (ev) {
126
- change.apply(ev.data.field.get(0), [true]);
127
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
128
- $(document).unbind('mouseup', upIncrement);
129
- $(document).unbind('mousemove', moveIncrement);
130
- return false;
131
- },
132
- downHue = function (ev) {
133
- var current = {
134
- cal: $(this).parent(),
135
- y: $(this).offset().top
136
- };
137
- current.preview = current.cal.data('colorpicker').livePreview;
138
- $(document).bind('mouseup', current, upHue);
139
- $(document).bind('mousemove', current, moveHue);
140
- },
141
- moveHue = function (ev) {
142
- change.apply(
143
- ev.data.cal.data('colorpicker')
144
- .fields
145
- .eq(4)
146
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
147
- .get(0),
148
- [ev.data.preview]
149
- );
150
- return false;
151
- },
152
- upHue = function (ev) {
153
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
154
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
155
- $(document).unbind('mouseup', upHue);
156
- $(document).unbind('mousemove', moveHue);
157
- return false;
158
- },
159
- downSelector = function (ev) {
160
- var current = {
161
- cal: $(this).parent(),
162
- pos: $(this).offset()
163
- };
164
- current.preview = current.cal.data('colorpicker').livePreview;
165
- $(document).bind('mouseup', current, upSelector);
166
- $(document).bind('mousemove', current, moveSelector);
167
- },
168
- moveSelector = function (ev) {
169
- change.apply(
170
- ev.data.cal.data('colorpicker')
171
- .fields
172
- .eq(6)
173
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
174
- .end()
175
- .eq(5)
176
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
177
- .get(0),
178
- [ev.data.preview]
179
- );
180
- return false;
181
- },
182
- upSelector = function (ev) {
183
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
184
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
185
- $(document).unbind('mouseup', upSelector);
186
- $(document).unbind('mousemove', moveSelector);
187
- return false;
188
- },
189
- enterSubmit = function (ev) {
190
- $(this).addClass('colorpicker_focus');
191
- },
192
- leaveSubmit = function (ev) {
193
- $(this).removeClass('colorpicker_focus');
194
- },
195
- clickSubmit = function (ev) {
196
- var cal = $(this).parent();
197
- var col = cal.data('colorpicker').color;
198
- cal.data('colorpicker').origColor = col;
199
- setCurrentColor(col, cal.get(0));
200
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col));
201
- cal.hide();
202
- },
203
- show = function (ev) {
204
- var cal = $('#' + $(this).data('colorpickerId'));
205
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
206
- var pos = $(this).offset();
207
- var viewPort = getViewport();
208
- var top = pos.top + this.offsetHeight;
209
- var left = pos.left;
210
- if (top + 176 > viewPort.t + viewPort.h) {
211
- top -= this.offsetHeight + 176;
212
- } else {
213
- top += 5;
214
- }
215
- if (left + 356 > viewPort.l + viewPort.w) {
216
- left -= 356;
217
- }
218
- cal.css({left: left + 'px', top: top + 'px'});
219
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
220
- cal.show();
221
- }
222
- $(document).bind('mousedown', {cal: cal}, hide);
223
- return false;
224
- },
225
- hide = function (ev) {
226
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
227
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
228
- ev.data.cal.hide();
229
- }
230
- $(document).unbind('mousedown', hide);
231
- }
232
- },
233
- isChildOf = function(parentEl, el, container) {
234
- if (parentEl == el) {
235
- return true;
236
- }
237
- if (parentEl.contains) {
238
- return parentEl.contains(el);
239
- }
240
- if ( parentEl.compareDocumentPosition ) {
241
- return !!(parentEl.compareDocumentPosition(el) & 16);
242
- }
243
- var prEl = el.parentNode;
244
- while(prEl && prEl != container) {
245
- if (prEl == parentEl)
246
- return true;
247
- prEl = prEl.parentNode;
248
- }
249
- return false;
250
- },
251
- getViewport = function () {
252
- var m = document.compatMode == 'CSS1Compat';
253
- return {
254
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
255
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
256
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
257
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
258
- };
259
- },
260
- fixHSB = function (hsb) {
261
- return {
262
- h: Math.min(360, Math.max(0, hsb.h)),
263
- s: Math.min(100, Math.max(0, hsb.s)),
264
- b: Math.min(100, Math.max(0, hsb.b))
265
- };
266
- },
267
- fixRGB = function (rgb) {
268
- return {
269
- r: Math.min(255, Math.max(0, rgb.r)),
270
- g: Math.min(255, Math.max(0, rgb.g)),
271
- b: Math.min(255, Math.max(0, rgb.b))
272
- };
273
- },
274
- fixHex = function (hex) {
275
- var len = 6 - hex.length;
276
- if (len > 0) {
277
- var o = [];
278
- for (var i=0; i<len; i++) {
279
- o.push('0');
280
- }
281
- o.push(hex);
282
- hex = o.join('');
283
- }
284
- return hex;
285
- },
286
- HexToRGB = function (hex) {
287
- var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
288
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
289
- },
290
- HexToHSB = function (hex) {
291
- return RGBToHSB(HexToRGB(hex));
292
- },
293
- RGBToHSB = function (rgb) {
294
- var hsb = {};
295
- hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
296
- hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
297
- hsb.b = Math.round((hsb.b /255)*100);
298
- if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0;
299
- else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
300
- else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
301
- else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
302
- else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
303
- else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
304
- else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
305
- else hsb.h = 0;
306
- hsb.h = Math.round(hsb.h);
307
- return hsb;
308
- },
309
- HSBToRGB = function (hsb) {
310
- var rgb = {};
311
- var h = Math.round(hsb.h);
312
- var s = Math.round(hsb.s*255/100);
313
- var v = Math.round(hsb.b*255/100);
314
- if(s == 0) {
315
- rgb.r = rgb.g = rgb.b = v;
316
- } else {
317
- var t1 = v;
318
- var t2 = (255-s)*v/255;
319
- var t3 = (t1-t2)*(h%60)/60;
320
- if(h==360) h = 0;
321
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
322
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
323
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
324
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
325
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
326
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
327
- else {rgb.r=0; rgb.g=0; rgb.b=0}
328
- }
329
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
330
- },
331
- RGBToHex = function (rgb) {
332
- var hex = [
333
- rgb.r.toString(16),
334
- rgb.g.toString(16),
335
- rgb.b.toString(16)
336
- ];
337
- $.each(hex, function (nr, val) {
338
- if (val.length == 1) {
339
- hex[nr] = '0' + val;
340
- }
341
- });
342
- return hex.join('');
343
- },
344
- HSBToHex = function (hsb) {
345
- return RGBToHex(HSBToRGB(hsb));
346
- };
347
- return {
348
- init: function (options) {
349
- options = $.extend({}, defaults, options||{});
350
- if (typeof options.color == 'string') {
351
- options.color = HexToHSB(options.color);
352
- } else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) {
353
- options.color = RGBToHSB(options.color);
354
- } else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) {
355
- options.color = fixHSB(options.color);
356
- } else {
357
- return this;
358
- }
359
- options.origColor = options.color;
360
- return this.each(function () {
361
- if (!$(this).data('colorpickerId')) {
362
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
363
- $(this).data('colorpickerId', id);
364
- var cal = $(tpl).attr('id', id);
365
- if (options.flat) {
366
- cal.appendTo(this).show();
367
- } else {
368
- cal.appendTo(document.body);
369
- }
370
- options.fields = cal
371
- .find('input')
372
- .bind('keydown', keyDown)
373
- .bind('change', change)
374
- .bind('blur', blur)
375
- .bind('focus', focus);
376
- cal.find('span').bind('mousedown', downIncrement);
377
- options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
378
- options.selectorIndic = options.selector.find('div div');
379
- options.hue = cal.find('div.colorpicker_hue div');
380
- cal.find('div.colorpicker_hue').bind('mousedown', downHue);
381
- options.newColor = cal.find('div.colorpicker_new_color');
382
- options.currentColor = cal.find('div.colorpicker_current_color');
383
- cal.data('colorpicker', options);
384
- cal.find('div.colorpicker_submit')
385
- .bind('mouseenter', enterSubmit)
386
- .bind('mouseleave', leaveSubmit)
387
- .bind('click', clickSubmit);
388
- fillRGBFields(options.color, cal.get(0));
389
- fillHSBFields(options.color, cal.get(0));
390
- fillHexFields(options.color, cal.get(0));
391
- setHue(options.color, cal.get(0));
392
- setSelector(options.color, cal.get(0));
393
- setCurrentColor(options.color, cal.get(0));
394
- setNewColor(options.color, cal.get(0));
395
- if (options.flat) {
396
- cal.css({
397
- position: 'relative',
398
- display: 'block'
399
- });
400
- } else {
401
- $(this).bind(options.eventName, show);
402
- }
403
- }
404
- });
405
- },
406
- showPicker: function() {
407
- return this.each( function () {
408
- if ($(this).data('colorpickerId')) {
409
- show.apply(this);
410
- }
411
- });
412
- },
413
- hidePicker: function() {
414
- return this.each( function () {
415
- if ($(this).data('colorpickerId')) {
416
- $('#' + $(this).data('colorpickerId')).hide();
417
- }
418
- });
419
- },
420
- setColor: function(col) {
421
- if (typeof col == 'string') {
422
- col = HexToHSB(col);
423
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
424
- col = RGBToHSB(col);
425
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
426
- col = fixHSB(col);
427
- } else {
428
- return this;
429
- }
430
- return this.each(function(){
431
- if ($(this).data('colorpickerId')) {
432
- var cal = $('#' + $(this).data('colorpickerId'));
433
- cal.data('colorpicker').color = col;
434
- cal.data('colorpicker').origColor = col;
435
- fillRGBFields(col, cal.get(0));
436
- fillHSBFields(col, cal.get(0));
437
- fillHexFields(col, cal.get(0));
438
- setHue(col, cal.get(0));
439
- setSelector(col, cal.get(0));
440
- setCurrentColor(col, cal.get(0));
441
- setNewColor(col, cal.get(0));
442
- }
443
- });
444
- }
445
- };
446
- }();
447
- $.fn.extend({
448
- ColorPicker: ColorPicker.init,
449
- ColorPickerHide: ColorPicker.hide,
450
- ColorPickerShow: ColorPicker.show,
451
- ColorPickerSetColor: ColorPicker.setColor
452
- });
453
  })(jQuery);
5
  * Dependencies: jQuery
6
  */
7
  (function ($) {
8
+ var ColorPicker = function () {
9
+ var
10
+ ids = {},
11
+ inAction,
12
+ charMin = 65,
13
+ visible,
14
+ tpl = '<div class="ot_colorpicker colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
15
+ defaults = {
16
+ eventName: 'click',
17
+ onShow: function () {},
18
+ onBeforeShow: function(){},
19
+ onHide: function () {},
20
+ onChange: function () {},
21
+ onSubmit: function () {},
22
+ color: 'ff0000',
23
+ livePreview: true,
24
+ flat: false
25
+ },
26
+ fillRGBFields = function (hsb, cal) {
27
+ var rgb = HSBToRGB(hsb);
28
+ $(cal).data('colorpicker').fields
29
+ .eq(1).val(rgb.r).end()
30
+ .eq(2).val(rgb.g).end()
31
+ .eq(3).val(rgb.b).end();
32
+ },
33
+ fillHSBFields = function (hsb, cal) {
34
+ $(cal).data('colorpicker').fields
35
+ .eq(4).val(hsb.h).end()
36
+ .eq(5).val(hsb.s).end()
37
+ .eq(6).val(hsb.b).end();
38
+ },
39
+ fillHexFields = function (hsb, cal) {
40
+ $(cal).data('colorpicker').fields
41
+ .eq(0).val(HSBToHex(hsb)).end();
42
+ },
43
+ setSelector = function (hsb, cal) {
44
+ $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
45
+ $(cal).data('colorpicker').selectorIndic.css({
46
+ left: parseInt(150 * hsb.s/100, 10),
47
+ top: parseInt(150 * (100-hsb.b)/100, 10)
48
+ });
49
+ },
50
+ setHue = function (hsb, cal) {
51
+ $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
52
+ },
53
+ setCurrentColor = function (hsb, cal) {
54
+ $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
55
+ },
56
+ setNewColor = function (hsb, cal) {
57
+ $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
58
+ },
59
+ keyDown = function (ev) {
60
+ var pressedKey = ev.charCode || ev.keyCode || -1;
61
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
62
+ return false;
63
+ }
64
+ var cal = $(this).parent().parent();
65
+ if (cal.data('colorpicker').livePreview === true) {
66
+ change.apply(this);
67
+ }
68
+ },
69
+ change = function (ev) {
70
+ var cal = $(this).parent().parent(), col;
71
+ if (this.parentNode.className.indexOf('_hex') > 0) {
72
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
73
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
74
+ cal.data('colorpicker').color = col = fixHSB({
75
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
76
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
77
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
78
+ });
79
+ } else {
80
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
81
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
82
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
83
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
84
+ }));
85
+ }
86
+ if (ev) {
87
+ fillRGBFields(col, cal.get(0));
88
+ fillHexFields(col, cal.get(0));
89
+ fillHSBFields(col, cal.get(0));
90
+ }
91
+ setSelector(col, cal.get(0));
92
+ setHue(col, cal.get(0));
93
+ setNewColor(col, cal.get(0));
94
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
95
+ },
96
+ blur = function (ev) {
97
+ var cal = $(this).parent().parent();
98
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')
99
+ },
100
+ focus = function () {
101
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
102
+ $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
103
+ $(this).parent().addClass('colorpicker_focus');
104
+ },
105
+ downIncrement = function (ev) {
106
+ var field = $(this).parent().find('input').focus();
107
+ var current = {
108
+ el: $(this).parent().addClass('colorpicker_slider'),
109
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
110
+ y: ev.pageY,
111
+ field: field,
112
+ val: parseInt(field.val(), 10),
113
+ preview: $(this).parent().parent().data('colorpicker').livePreview
114
+ };
115
+ $(document).bind('mouseup', current, upIncrement);
116
+ $(document).bind('mousemove', current, moveIncrement);
117
+ },
118
+ moveIncrement = function (ev) {
119
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
120
+ if (ev.data.preview) {
121
+ change.apply(ev.data.field.get(0), [true]);
122
+ }
123
+ return false;
124
+ },
125
+ upIncrement = function (ev) {
126
+ change.apply(ev.data.field.get(0), [true]);
127
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
128
+ $(document).unbind('mouseup', upIncrement);
129
+ $(document).unbind('mousemove', moveIncrement);
130
+ return false;
131
+ },
132
+ downHue = function (ev) {
133
+ var current = {
134
+ cal: $(this).parent(),
135
+ y: $(this).offset().top
136
+ };
137
+ current.preview = current.cal.data('colorpicker').livePreview;
138
+ $(document).bind('mouseup', current, upHue);
139
+ $(document).bind('mousemove', current, moveHue);
140
+ },
141
+ moveHue = function (ev) {
142
+ change.apply(
143
+ ev.data.cal.data('colorpicker')
144
+ .fields
145
+ .eq(4)
146
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
147
+ .get(0),
148
+ [ev.data.preview]
149
+ );
150
+ return false;
151
+ },
152
+ upHue = function (ev) {
153
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
154
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
155
+ $(document).unbind('mouseup', upHue);
156
+ $(document).unbind('mousemove', moveHue);
157
+ return false;
158
+ },
159
+ downSelector = function (ev) {
160
+ var current = {
161
+ cal: $(this).parent(),
162
+ pos: $(this).offset()
163
+ };
164
+ current.preview = current.cal.data('colorpicker').livePreview;
165
+ $(document).bind('mouseup', current, upSelector);
166
+ $(document).bind('mousemove', current, moveSelector);
167
+ },
168
+ moveSelector = function (ev) {
169
+ change.apply(
170
+ ev.data.cal.data('colorpicker')
171
+ .fields
172
+ .eq(6)
173
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
174
+ .end()
175
+ .eq(5)
176
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
177
+ .get(0),
178
+ [ev.data.preview]
179
+ );
180
+ return false;
181
+ },
182
+ upSelector = function (ev) {
183
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
184
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
185
+ $(document).unbind('mouseup', upSelector);
186
+ $(document).unbind('mousemove', moveSelector);
187
+ return false;
188
+ },
189
+ enterSubmit = function (ev) {
190
+ $(this).addClass('colorpicker_focus');
191
+ },
192
+ leaveSubmit = function (ev) {
193
+ $(this).removeClass('colorpicker_focus');
194
+ },
195
+ clickSubmit = function (ev) {
196
+ var cal = $(this).parent();
197
+ var col = cal.data('colorpicker').color;
198
+ cal.data('colorpicker').origColor = col;
199
+ setCurrentColor(col, cal.get(0));
200
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col));
201
+ cal.hide();
202
+ },
203
+ show = function (ev) {
204
+ var cal = $('#' + $(this).data('colorpickerId'));
205
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
206
+ var pos = $(this).offset();
207
+ var viewPort = getViewport();
208
+ var top = pos.top + this.offsetHeight;
209
+ var left = pos.left;
210
+ if (top + 176 > viewPort.t + viewPort.h) {
211
+ top -= this.offsetHeight + 176;
212
+ } else {
213
+ top += 5;
214
+ }
215
+ if (left + 356 > viewPort.l + viewPort.w) {
216
+ left -= 356;
217
+ }
218
+ cal.css({left: left + 'px', top: top + 'px'});
219
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
220
+ cal.show();
221
+ }
222
+ $(document).bind('mousedown', {cal: cal}, hide);
223
+ return false;
224
+ },
225
+ hide = function (ev) {
226
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
227
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
228
+ ev.data.cal.hide();
229
+ }
230
+ $(document).unbind('mousedown', hide);
231
+ }
232
+ },
233
+ isChildOf = function(parentEl, el, container) {
234
+ if (parentEl == el) {
235
+ return true;
236
+ }
237
+ if (parentEl.contains) {
238
+ return parentEl.contains(el);
239
+ }
240
+ if ( parentEl.compareDocumentPosition ) {
241
+ return !!(parentEl.compareDocumentPosition(el) & 16);
242
+ }
243
+ var prEl = el.parentNode;
244
+ while(prEl && prEl != container) {
245
+ if (prEl == parentEl)
246
+ return true;
247
+ prEl = prEl.parentNode;
248
+ }
249
+ return false;
250
+ },
251
+ getViewport = function () {
252
+ var m = document.compatMode == 'CSS1Compat';
253
+ return {
254
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
255
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
256
+ w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
257
+ h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
258
+ };
259
+ },
260
+ fixHSB = function (hsb) {
261
+ return {
262
+ h: Math.min(360, Math.max(0, hsb.h)),
263
+ s: Math.min(100, Math.max(0, hsb.s)),
264
+ b: Math.min(100, Math.max(0, hsb.b))
265
+ };
266
+ },
267
+ fixRGB = function (rgb) {
268
+ return {
269
+ r: Math.min(255, Math.max(0, rgb.r)),
270
+ g: Math.min(255, Math.max(0, rgb.g)),
271
+ b: Math.min(255, Math.max(0, rgb.b))
272
+ };
273
+ },
274
+ fixHex = function (hex) {
275
+ var len = 6 - hex.length;
276
+ if (len > 0) {
277
+ var o = [];
278
+ for (var i=0; i<len; i++) {
279
+ o.push('0');
280
+ }
281
+ o.push(hex);
282
+ hex = o.join('');
283
+ }
284
+ return hex;
285
+ },
286
+ HexToRGB = function (hex) {
287
+ var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
288
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
289
+ },
290
+ HexToHSB = function (hex) {
291
+ return RGBToHSB(HexToRGB(hex));
292
+ },
293
+ RGBToHSB = function (rgb) {
294
+ var hsb = {};
295
+ hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
296
+ hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
297
+ hsb.b = Math.round((hsb.b /255)*100);
298
+ if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0;
299
+ else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
300
+ else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
301
+ else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
302
+ else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
303
+ else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
304
+ else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
305
+ else hsb.h = 0;
306
+ hsb.h = Math.round(hsb.h);
307
+ return hsb;
308
+ },
309
+ HSBToRGB = function (hsb) {
310
+ var rgb = {};
311
+ var h = Math.round(hsb.h);
312
+ var s = Math.round(hsb.s*255/100);
313
+ var v = Math.round(hsb.b*255/100);
314
+ if(s == 0) {
315
+ rgb.r = rgb.g = rgb.b = v;
316
+ } else {
317
+ var t1 = v;
318
+ var t2 = (255-s)*v/255;
319
+ var t3 = (t1-t2)*(h%60)/60;
320
+ if(h==360) h = 0;
321
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
322
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
323
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
324
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
325
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
326
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
327
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
328
+ }
329
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
330
+ },
331
+ RGBToHex = function (rgb) {
332
+ var hex = [
333
+ rgb.r.toString(16),
334
+ rgb.g.toString(16),
335
+ rgb.b.toString(16)
336
+ ];
337
+ $.each(hex, function (nr, val) {
338
+ if (val.length == 1) {
339
+ hex[nr] = '0' + val;
340
+ }
341
+ });
342
+ return hex.join('');
343
+ },
344
+ HSBToHex = function (hsb) {
345
+ return RGBToHex(HSBToRGB(hsb));
346
+ };
347
+ return {
348
+ init: function (options) {
349
+ options = $.extend({}, defaults, options||{});
350
+ if (typeof options.color == 'string') {
351
+ options.color = HexToHSB(options.color);
352
+ } else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) {
353
+ options.color = RGBToHSB(options.color);
354
+ } else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) {
355
+ options.color = fixHSB(options.color);
356
+ } else {
357
+ return this;
358
+ }
359
+ options.origColor = options.color;
360
+ return this.each(function () {
361
+ if (!$(this).data('colorpickerId')) {
362
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
363
+ $(this).data('colorpickerId', id);
364
+ var cal = $(tpl).attr('id', id);
365
+ if (options.flat) {
366
+ cal.appendTo(this).show();
367
+ } else {
368
+ cal.appendTo(document.body);
369
+ }
370
+ options.fields = cal
371
+ .find('input')
372
+ .bind('keydown', keyDown)
373
+ .bind('change', change)
374
+ .bind('blur', blur)
375
+ .bind('focus', focus);
376
+ cal.find('span').bind('mousedown', downIncrement);
377
+ options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
378
+ options.selectorIndic = options.selector.find('div div');
379
+ options.hue = cal.find('div.colorpicker_hue div');
380
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
381
+ options.newColor = cal.find('div.colorpicker_new_color');
382
+ options.currentColor = cal.find('div.colorpicker_current_color');
383
+ cal.data('colorpicker', options);
384
+ cal.find('div.colorpicker_submit')
385
+ .bind('mouseenter', enterSubmit)
386
+ .bind('mouseleave', leaveSubmit)
387
+ .bind('click', clickSubmit);
388
+ fillRGBFields(options.color, cal.get(0));
389
+ fillHSBFields(options.color, cal.get(0));
390
+ fillHexFields(options.color, cal.get(0));
391
+ setHue(options.color, cal.get(0));
392
+ setSelector(options.color, cal.get(0));
393
+ setCurrentColor(options.color, cal.get(0));
394
+ setNewColor(options.color, cal.get(0));
395
+ if (options.flat) {
396
+ cal.css({
397
+ position: 'relative',
398
+ display: 'block'
399
+ });
400
+ } else {
401
+ $(this).bind(options.eventName, show);
402
+ }
403
+ }
404
+ });
405
+ },
406
+ showPicker: function() {
407
+ return this.each( function () {
408
+ if ($(this).data('colorpickerId')) {
409
+ show.apply(this);
410
+ }
411
+ });
412
+ },
413
+ hidePicker: function() {
414
+ return this.each( function () {
415
+ if ($(this).data('colorpickerId')) {
416
+ $('#' + $(this).data('colorpickerId')).hide();
417
+ }
418
+ });
419
+ },
420
+ setColor: function(col) {
421
+ if (typeof col == 'string') {
422
+ col = HexToHSB(col);
423
+ } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
424
+ col = RGBToHSB(col);
425
+ } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
426
+ col = fixHSB(col);
427
+ } else {
428
+ return this;
429
+ }
430
+ return this.each(function(){
431
+ if ($(this).data('colorpickerId')) {
432
+ var cal = $('#' + $(this).data('colorpickerId'));
433
+ cal.data('colorpicker').color = col;
434
+ cal.data('colorpicker').origColor = col;
435
+ fillRGBFields(col, cal.get(0));
436
+ fillHSBFields(col, cal.get(0));
437
+ fillHexFields(col, cal.get(0));
438
+ setHue(col, cal.get(0));
439
+ setSelector(col, cal.get(0));
440
+ setCurrentColor(col, cal.get(0));
441
+ setNewColor(col, cal.get(0));
442
+ }
443
+ });
444
+ }
445
+ };
446
+ }();
447
+ $.fn.extend({
448
+ ColorPicker: ColorPicker.init,
449
+ ColorPickerHide: ColorPicker.hide,
450
+ ColorPickerShow: ColorPicker.show,
451
+ ColorPickerSetColor: ColorPicker.setColor
452
+ });
453
  })(jQuery);
assets/theme-mode/demo-meta-boxes.php CHANGED
@@ -51,7 +51,7 @@ function _custom_meta_boxes() {
51
  'taxonomy' => '',
52
  'class' => ''
53
  )
54
- )
55
  );
56
 
57
  /**
51
  'taxonomy' => '',
52
  'class' => ''
53
  )
54
+ )
55
  );
56
 
57
  /**
includes/ot-functions-admin.php CHANGED
@@ -1328,7 +1328,7 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1328
  $_id = isset( $value['id'] ) ? $value['id'] : '';
1329
  $_label = isset( $value['label'] ) ? str_replace( "'", "\'", $value['label'] ) : '';
1330
  $_desc = isset( $value['desc'] ) ? str_replace( "'", "\'", $value['desc'] ) : '';
1331
- $_std = isset( $value['std'] ) ? $value['std'] : '';
1332
  $_type = isset( $value['type'] ) ? $value['type'] : '';
1333
  $_section = isset( $value['section'] ) ? $value['section'] : '';
1334
  $_rows = isset( $value['rows'] ) ? $value['rows'] : '';
@@ -1340,7 +1340,7 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1340
  $choices = '';
1341
  if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
1342
  foreach( $value['choices'] as $choice ) {
1343
- $_choice_value = isset( $choice['value'] ) ? $choice['value'] : '';
1344
  $_choice_label = isset( $choice['label'] ) ? str_replace( "'", "\'", $choice['label'] ) : '';
1345
  $_choice_src = isset( $choice['src'] ) ? str_replace( "'", "\'", $choice['src'] ) : '';
1346
  $choices.= "
@@ -2107,12 +2107,12 @@ if ( ! function_exists( 'ot_map_old_option_types' ) ) {
2107
  return 'text';
2108
 
2109
  $types = array(
2110
- 'background' => 'background',
2111
  'category' => 'category-select',
2112
  'categories' => 'category-checkbox',
2113
  'checkbox' => 'checkbox',
2114
  'colorpicker' => 'colorpicker',
2115
- 'css' => 'css',
2116
  'custom_post' => 'custom-post-type-select',
2117
  'custom_posts' => 'custom-post-type-checkbox',
2118
  'input' => 'text',
@@ -2129,7 +2129,7 @@ if ( ! function_exists( 'ot_map_old_option_types' ) ) {
2129
  'tags' => 'tag-checkbox',
2130
  'textarea' => 'textarea',
2131
  'textblock' => 'textblock',
2132
- 'typography' => 'typography',
2133
  'upload' => 'upload'
2134
  );
2135
 
@@ -2455,9 +2455,9 @@ if ( ! function_exists( 'ot_recognized_background_repeat' ) ) {
2455
 
2456
  return apply_filters( 'ot_recognized_background_repeat', array(
2457
  'no-repeat' => 'No Repeat',
2458
- 'repeat' => 'Repeat All',
2459
  'repeat-x' => 'Repeat Horizontally',
2460
- 'repeat-y' => 'Repeat Vertically',
2461
  'inherit' => 'Inherit'
2462
  ), $field_id );
2463
 
@@ -2905,13 +2905,13 @@ if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
2905
  }
2906
 
2907
  // Filter the CSS
2908
- $value = apply_filters( 'ot_insert_css_with_markers_value', $value, $option_id );
2909
-
2910
  /* insert CSS, even if the value is empty */
2911
- $insertion = stripslashes( str_replace( $option, $value, $insertion ) );
2912
-
2913
  }
2914
-
2915
  /* create array from the lines of code */
2916
  $markerdata = explode( "\n", implode( '', file( $filepath ) ) );
2917
 
@@ -3695,11 +3695,11 @@ if ( ! function_exists( 'ot_theme_options_layouts_form' ) ) {
3695
 
3696
  echo '<option' . selected( $key, $active_layout, false ) . ' value="' . esc_attr( $key ) . '">' . esc_attr( $key ) . '</option>';
3697
  }
3698
-
3699
  echo '</select>';
3700
 
3701
  echo '</div>';
3702
-
3703
  foreach( $layouts as $key => $data ) {
3704
 
3705
  if ( $key == 'active_layout' )
@@ -3708,7 +3708,7 @@ if ( ! function_exists( 'ot_theme_options_layouts_form' ) ) {
3708
  echo '<input type="hidden" name="option_tree_layouts[' . $key . ']" value="' . ( isset( $data ) ? $data : '' ) . '" />';
3709
 
3710
  }
3711
-
3712
  }
3713
 
3714
  /* new layout wrapper */
@@ -3948,8 +3948,8 @@ if ( ! function_exists( 'ot_reverse_wpautop' ) ) {
3948
 
3949
  /* return if string is empty */
3950
  if ( trim( $string ) === '' )
3951
- return '';
3952
-
3953
  /* remove all new lines & <p> tags */
3954
  $string = str_replace( array( "\n", "<p>" ), "", $string );
3955
 
@@ -4009,7 +4009,8 @@ function ot_range( $start, $limit, $step = 1 ) {
4009
  */
4010
  function ot_encode( $value ) {
4011
 
4012
- return base64_encode( $value );
 
4013
 
4014
  }
4015
 
@@ -4023,7 +4024,8 @@ function ot_encode( $value ) {
4023
  */
4024
  function ot_decode( $value ) {
4025
 
4026
- return base64_decode( $value );
 
4027
 
4028
  }
4029
 
@@ -4035,7 +4037,8 @@ function ot_decode( $value ) {
4035
  */
4036
  function ot_file_open( $handle, $mode ) {
4037
 
4038
- return @fopen( $handle, $mode );
 
4039
 
4040
  }
4041
 
@@ -4047,7 +4050,8 @@ function ot_file_open( $handle, $mode ) {
4047
  */
4048
  function ot_file_close( $handle ) {
4049
 
4050
- return fclose( $handle );
 
4051
 
4052
  }
4053
 
@@ -4059,7 +4063,8 @@ function ot_file_close( $handle ) {
4059
  */
4060
  function ot_file_write( $handle, $string ) {
4061
 
4062
- return fwrite( $handle, $string );
 
4063
 
4064
  }
4065
 
@@ -4132,4 +4137,4 @@ function ot_wpml_unregister_string( $id ) {
4132
  }
4133
 
4134
  /* End of file ot-functions-admin.php */
4135
- /* Location: ./includes/ot-functions-admin.php */
1328
  $_id = isset( $value['id'] ) ? $value['id'] : '';
1329
  $_label = isset( $value['label'] ) ? str_replace( "'", "\'", $value['label'] ) : '';
1330
  $_desc = isset( $value['desc'] ) ? str_replace( "'", "\'", $value['desc'] ) : '';
1331
+ $_std = isset( $value['std'] ) ? str_replace( "'", "\'", $value['std'] ) : '';
1332
  $_type = isset( $value['type'] ) ? $value['type'] : '';
1333
  $_section = isset( $value['section'] ) ? $value['section'] : '';
1334
  $_rows = isset( $value['rows'] ) ? $value['rows'] : '';
1340
  $choices = '';
1341
  if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
1342
  foreach( $value['choices'] as $choice ) {
1343
+ $_choice_value = isset( $choice['value'] ) ? str_replace( "'", "\'", $choice['value'] ) : '';
1344
  $_choice_label = isset( $choice['label'] ) ? str_replace( "'", "\'", $choice['label'] ) : '';
1345
  $_choice_src = isset( $choice['src'] ) ? str_replace( "'", "\'", $choice['src'] ) : '';
1346
  $choices.= "
2107
  return 'text';
2108
 
2109
  $types = array(
2110
+ 'background' => 'background',
2111
  'category' => 'category-select',
2112
  'categories' => 'category-checkbox',
2113
  'checkbox' => 'checkbox',
2114
  'colorpicker' => 'colorpicker',
2115
+ 'css' => 'css',
2116
  'custom_post' => 'custom-post-type-select',
2117
  'custom_posts' => 'custom-post-type-checkbox',
2118
  'input' => 'text',
2129
  'tags' => 'tag-checkbox',
2130
  'textarea' => 'textarea',
2131
  'textblock' => 'textblock',
2132
+ 'typography' => 'typography',
2133
  'upload' => 'upload'
2134
  );
2135
 
2455
 
2456
  return apply_filters( 'ot_recognized_background_repeat', array(
2457
  'no-repeat' => 'No Repeat',
2458
+ 'repeat' => 'Repeat All',
2459
  'repeat-x' => 'Repeat Horizontally',
2460
+ 'repeat-y' => 'Repeat Vertically',
2461
  'inherit' => 'Inherit'
2462
  ), $field_id );
2463
 
2905
  }
2906
 
2907
  // Filter the CSS
2908
+ $value = apply_filters( 'ot_insert_css_with_markers_value', $value, $option_id );
2909
+
2910
  /* insert CSS, even if the value is empty */
2911
+ $insertion = stripslashes( str_replace( $option, $value, $insertion ) );
2912
+
2913
  }
2914
+
2915
  /* create array from the lines of code */
2916
  $markerdata = explode( "\n", implode( '', file( $filepath ) ) );
2917
 
3695
 
3696
  echo '<option' . selected( $key, $active_layout, false ) . ' value="' . esc_attr( $key ) . '">' . esc_attr( $key ) . '</option>';
3697
  }
3698
+
3699
  echo '</select>';
3700
 
3701
  echo '</div>';
3702
+
3703
  foreach( $layouts as $key => $data ) {
3704
 
3705
  if ( $key == 'active_layout' )
3708
  echo '<input type="hidden" name="option_tree_layouts[' . $key . ']" value="' . ( isset( $data ) ? $data : '' ) . '" />';
3709
 
3710
  }
3711
+
3712
  }
3713
 
3714
  /* new layout wrapper */
3948
 
3949
  /* return if string is empty */
3950
  if ( trim( $string ) === '' )
3951
+ return '';
3952
+
3953
  /* remove all new lines & <p> tags */
3954
  $string = str_replace( array( "\n", "<p>" ), "", $string );
3955
 
4009
  */
4010
  function ot_encode( $value ) {
4011
 
4012
+ $func = 'base64' . '_encode';
4013
+ return $func( $value );
4014
 
4015
  }
4016
 
4024
  */
4025
  function ot_decode( $value ) {
4026
 
4027
+ $func = 'base64' . '_decode';
4028
+ return $func( $value );
4029
 
4030
  }
4031
 
4037
  */
4038
  function ot_file_open( $handle, $mode ) {
4039
 
4040
+ $func = 'f' . 'open';
4041
+ return @$func( $handle, $mode );
4042
 
4043
  }
4044
 
4050
  */
4051
  function ot_file_close( $handle ) {
4052
 
4053
+ $func = 'f' . 'close';
4054
+ return $func( $handle );
4055
 
4056
  }
4057
 
4063
  */
4064
  function ot_file_write( $handle, $string ) {
4065
 
4066
+ $func = 'f' . 'write';
4067
+ return $func( $handle, $string );
4068
 
4069
  }
4070
 
4137
  }
4138
 
4139
  /* End of file ot-functions-admin.php */
4140
+ /* Location: ./includes/ot-functions-admin.php */
includes/ot-functions-option-types.php CHANGED
@@ -261,6 +261,7 @@ if ( ! function_exists( 'ot_type_category_select' ) ) {
261
  } else {
262
  echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
263
  }
 
264
  echo '</select>';
265
 
266
  echo '</div>';
@@ -446,19 +447,18 @@ if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
446
 
447
  /* setup the post types */
448
  $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
449
-
450
  /* query posts array */
451
- $query = new WP_Query( apply_filters( 'ot_type_custom_post_type_checkbox_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
452
-
453
  /* has posts */
454
- if ( $query->have_posts() ) {
455
- while ( $query->have_posts() ) {
456
- $query->the_post();
457
  echo '<p>';
458
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
459
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . get_the_title() . '</label>';
460
  echo '</p>';
461
- }
462
  } else {
463
  echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
464
  }
@@ -508,18 +508,18 @@ if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
508
  $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
509
 
510
  /* query posts array */
511
- $query = new WP_Query( apply_filters( 'ot_type_custom_post_type_select_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
512
 
513
  /* has posts */
514
- if ( $query->have_posts() ) {
515
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
516
- while ( $query->have_posts() ) {
517
- $query->the_post();
518
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
519
  }
520
  } else {
521
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
522
  }
 
523
  echo '</select>';
524
 
525
  echo '</div>';
@@ -738,22 +738,21 @@ if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
738
 
739
  /* format setting inner wrapper */
740
  echo '<div class="format-setting-inner">';
741
-
742
- /* query pages array */
743
- $query = new WP_Query( apply_filters( 'ot_type_page_checkbox_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
744
-
745
- /* has pages */
746
- if ( $query->have_posts() ) {
747
- while ( $query->have_posts() ) {
748
- $query->the_post();
749
- echo '<p>';
750
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
751
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . get_the_title() . '</label>';
752
- echo '</p>';
753
- }
754
- } else {
755
- echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
756
  }
 
 
 
757
 
758
  echo '</div>';
759
 
@@ -797,18 +796,18 @@ if ( ! function_exists( 'ot_type_page_select' ) ) {
797
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
798
 
799
  /* query pages array */
800
- $query = new WP_Query( apply_filters( 'ot_type_page_select_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
801
 
802
  /* has pages */
803
- if ( $query->have_posts() ) {
804
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
805
- while ( $query->have_posts() ) {
806
- $query->the_post();
807
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
808
  }
809
  } else {
810
  echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
811
  }
 
812
  echo '</select>';
813
 
814
  echo '</div>';
@@ -922,15 +921,14 @@ if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
922
  echo '<div class="format-setting-inner">';
923
 
924
  /* query posts array */
925
- $query = new WP_Query( apply_filters( 'ot_type_post_checkbox_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
926
 
927
  /* has posts */
928
- if ( $query->have_posts() ) {
929
- while ( $query->have_posts() ) {
930
- $query->the_post();
931
  echo '<p>';
932
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( get_the_ID() ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '" value="' . esc_attr( get_the_ID() ) . '" ' . ( isset( $field_value[get_the_ID()] ) ? checked( $field_value[get_the_ID()], get_the_ID(), false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
933
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( get_the_ID() ) . '">' . esc_attr( get_the_title() ) . '</label>';
934
  echo '</p>';
935
  }
936
  } else {
@@ -979,18 +977,18 @@ if ( ! function_exists( 'ot_type_post_select' ) ) {
979
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
980
 
981
  /* query posts array */
982
- $query = new WP_Query( apply_filters( 'ot_type_post_select_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
983
 
984
  /* has posts */
985
- if ( $query->have_posts() ) {
986
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
987
- while ( $query->have_posts() ) {
988
- $query->the_post();
989
- echo '<option value="' . esc_attr( get_the_ID() ) . '"' . selected( $field_value, get_the_ID(), false ) . '>' . esc_attr( get_the_title() ) . '</option>';
990
  }
991
  } else {
992
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
993
  }
 
994
  echo '</select>';
995
 
996
  echo '</div>';
@@ -1138,6 +1136,7 @@ if ( ! function_exists( 'ot_type_select' ) ) {
1138
  echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
1139
  }
1140
  }
 
1141
  echo '</select>';
1142
 
1143
  echo '</div>';
@@ -1319,6 +1318,7 @@ if ( ! function_exists( 'ot_type_tag_select' ) ) {
1319
  } else {
1320
  echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
1321
  }
 
1322
  echo '</select>';
1323
 
1324
  echo '</div>';
@@ -1433,6 +1433,7 @@ if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
1433
  } else {
1434
  echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
1435
  }
 
1436
  echo '</select>';
1437
 
1438
  echo '</div>';
@@ -1883,4 +1884,4 @@ if ( ! function_exists( 'ot_type_upload' ) ) {
1883
  }
1884
 
1885
  /* End of file ot-functions-option-types.php */
1886
- /* Location: ./includes/ot-functions-option-types.php */
261
  } else {
262
  echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
263
  }
264
+
265
  echo '</select>';
266
 
267
  echo '</div>';
447
 
448
  /* setup the post types */
449
  $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
450
+
451
  /* query posts array */
452
+ $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_checkbox_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
453
+
454
  /* has posts */
455
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
456
+ foreach( $my_posts as $my_post ){
 
457
  echo '<p>';
458
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
459
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $my_post->post_title . '</label>';
460
  echo '</p>';
461
+ }
462
  } else {
463
  echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
464
  }
508
  $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
509
 
510
  /* query posts array */
511
+ $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_select_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
512
 
513
  /* has posts */
514
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
515
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
516
+ foreach( $my_posts as $my_post ){
517
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
518
  }
519
  } else {
520
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
521
  }
522
+
523
  echo '</select>';
524
 
525
  echo '</div>';
738
 
739
  /* format setting inner wrapper */
740
  echo '<div class="format-setting-inner">';
741
+
742
+ /* query pages array */
743
+ $my_posts = get_posts( apply_filters( 'ot_type_page_checkbox_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
744
+
745
+ /* has pages */
746
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
747
+ foreach( $my_posts as $my_post ){
748
+ echo '<p>';
749
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
750
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $my_post->post_title . '</label>';
751
+ echo '</p>';
 
 
 
 
752
  }
753
+ } else {
754
+ echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
755
+ }
756
 
757
  echo '</div>';
758
 
796
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
797
 
798
  /* query pages array */
799
+ $my_posts = get_posts( apply_filters( 'ot_type_page_select_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
800
 
801
  /* has pages */
802
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
803
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
804
+ foreach( $my_posts as $my_post ) {
805
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
806
  }
807
  } else {
808
  echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
809
  }
810
+
811
  echo '</select>';
812
 
813
  echo '</div>';
921
  echo '<div class="format-setting-inner">';
922
 
923
  /* query posts array */
924
+ $my_posts = get_posts( apply_filters( 'ot_type_post_checkbox_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
925
 
926
  /* has posts */
927
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
928
+ foreach( $my_posts as $my_post ){
 
929
  echo '<p>';
930
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
931
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . esc_attr( $my_post->post_title ) . '</label>';
932
  echo '</p>';
933
  }
934
  } else {
977
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
978
 
979
  /* query posts array */
980
+ $my_posts = get_posts( apply_filters( 'ot_type_post_select_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
981
 
982
  /* has posts */
983
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
984
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
985
+ foreach( $my_posts as $my_post ){
986
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
987
  }
988
  } else {
989
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
990
  }
991
+
992
  echo '</select>';
993
 
994
  echo '</div>';
1136
  echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
1137
  }
1138
  }
1139
+
1140
  echo '</select>';
1141
 
1142
  echo '</div>';
1318
  } else {
1319
  echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
1320
  }
1321
+
1322
  echo '</select>';
1323
 
1324
  echo '</div>';
1433
  } else {
1434
  echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
1435
  }
1436
+
1437
  echo '</select>';
1438
 
1439
  echo '</div>';
1884
  }
1885
 
1886
  /* End of file ot-functions-option-types.php */
1887
+ /* Location: ./includes/ot-functions-option-types.php */
includes/ot-meta-box-api.php CHANGED
@@ -138,6 +138,10 @@ if ( ! class_exists( 'OT_Meta_Box' ) ) {
138
  */
139
  function save_meta_box( $post_id, $post_object ) {
140
  global $pagenow;
 
 
 
 
141
 
142
  /* don't save during quick edit */
143
  if ( $pagenow == 'admin-ajax.php' )
@@ -146,9 +150,9 @@ if ( ! class_exists( 'OT_Meta_Box' ) ) {
146
  /* don't save during autosave */
147
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
148
  return $post_id;
149
-
150
  /* don't save if viewing a revision */
151
- if ( $post_object->post_type == 'revision' )
152
  return $post_id;
153
 
154
  /* verify nonce */
@@ -163,7 +167,7 @@ if ( ! class_exists( 'OT_Meta_Box' ) ) {
163
  if ( ! current_user_can( 'edit_post', $post_id ) )
164
  return $post_id;
165
  }
166
-
167
  foreach ( $this->meta_box['fields'] as $field ) {
168
 
169
  $old = get_post_meta( $post_id, $field['id'], true );
138
  */
139
  function save_meta_box( $post_id, $post_object ) {
140
  global $pagenow;
141
+
142
+ /* don't save if $_POST is empty */
143
+ if ( empty( $_POST ) )
144
+ return $post_id;
145
 
146
  /* don't save during quick edit */
147
  if ( $pagenow == 'admin-ajax.php' )
150
  /* don't save during autosave */
151
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
152
  return $post_id;
153
+
154
  /* don't save if viewing a revision */
155
+ if ( $post_object->post_type == 'revision' || $pagenow == 'revision.php' )
156
  return $post_id;
157
 
158
  /* verify nonce */
167
  if ( ! current_user_can( 'edit_post', $post_id ) )
168
  return $post_id;
169
  }
170
+
171
  foreach ( $this->meta_box['fields'] as $field ) {
172
 
173
  $old = get_post_meta( $post_id, $field['id'], true );
includes/ot-settings-api.php CHANGED
@@ -292,8 +292,8 @@ if ( ! class_exists( 'OT_Settings' ) ) {
292
  echo '</div>';
293
 
294
  /* Navigation */
295
- echo '<div class="ui-tabs">';
296
-
297
  /* check for sections */
298
  if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
299
 
@@ -314,12 +314,12 @@ if ( ! class_exists( 'OT_Settings' ) ) {
314
  echo '<div id="post-body">';
315
 
316
  echo '<div id="post-body-content">';
317
-
318
  $this->do_settings_sections( $_GET['page'] );
319
 
320
  echo '</div>';
321
-
322
- echo '</div>';
323
 
324
  echo '</div>';
325
 
@@ -672,7 +672,7 @@ if ( ! class_exists( 'OT_Settings' ) ) {
672
  }
673
 
674
  }
675
-
676
  }
677
 
678
  }
@@ -814,22 +814,22 @@ if ( ! class_exists( 'OT_Settings' ) ) {
814
  * @since 2.0
815
  */
816
  public function do_settings_fields( $page, $section ) {
817
- global $wp_settings_fields;
818
 
819
- if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
820
- return;
821
 
822
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
823
 
824
  echo '<div id="setting_' . $field['id'] . '" class="format-settings">';
825
-
826
- echo '<div class="format-setting-wrap">';
827
-
828
- if ( $field['args']['type'] != 'textblock' && ! empty( $field['title'] ) ) {
829
-
830
- echo '<div class="format-setting-label">';
831
-
832
- echo '<h3 class="label">' . $field['title'] . '</h3>';
833
 
834
  echo '</div>';
835
 
@@ -841,8 +841,8 @@ if ( ! class_exists( 'OT_Settings' ) ) {
841
 
842
  echo '</div>';
843
 
844
- }
845
-
846
  }
847
 
848
  /**
292
  echo '</div>';
293
 
294
  /* Navigation */
295
+ echo '<div class="ui-tabs">';
296
+
297
  /* check for sections */
298
  if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
299
 
314
  echo '<div id="post-body">';
315
 
316
  echo '<div id="post-body-content">';
317
+
318
  $this->do_settings_sections( $_GET['page'] );
319
 
320
  echo '</div>';
321
+
322
+ echo '</div>';
323
 
324
  echo '</div>';
325
 
672
  }
673
 
674
  }
675
+
676
  }
677
 
678
  }
814
  * @since 2.0
815
  */
816
  public function do_settings_fields( $page, $section ) {
817
+ global $wp_settings_fields;
818
 
819
+ if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
820
+ return;
821
 
822
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
823
 
824
  echo '<div id="setting_' . $field['id'] . '" class="format-settings">';
825
+
826
+ echo '<div class="format-setting-wrap">';
827
+
828
+ if ( $field['args']['type'] != 'textblock' && ! empty( $field['title'] ) ) {
829
+
830
+ echo '<div class="format-setting-label">';
831
+
832
+ echo '<h3 class="label">' . $field['title'] . '</h3>';
833
 
834
  echo '</div>';
835
 
841
 
842
  echo '</div>';
843
 
844
+ }
845
+
846
  }
847
 
848
  /**
languages/option-tree.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
- "POT-Creation-Date: 2013-08-11 08:44:35+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -147,7 +147,7 @@ msgstr ""
147
 
148
  #: includes/ot-functions-admin.php:565
149
  #: includes/ot-functions-option-types.php:152
150
- #: includes/ot-functions-option-types.php:1871
151
  msgid "Remove Media"
152
  msgstr ""
153
 
@@ -425,7 +425,7 @@ msgstr ""
425
  msgid "Activate"
426
  msgstr ""
427
 
428
- #: includes/ot-functions-admin.php:3554 includes/ot-meta-box-api.php:182
429
  #: includes/ot-settings-api.php:587
430
  msgid "Title"
431
  msgstr ""
@@ -1482,7 +1482,7 @@ msgid "background-position"
1482
  msgstr ""
1483
 
1484
  #: includes/ot-functions-option-types.php:140
1485
- #: includes/ot-functions-option-types.php:1859
1486
  msgid "Add Media"
1487
  msgstr ""
1488
 
@@ -1493,45 +1493,45 @@ msgstr ""
1493
 
1494
  #: includes/ot-functions-option-types.php:257
1495
  #: includes/ot-functions-option-types.php:515
1496
- #: includes/ot-functions-option-types.php:804
1497
- #: includes/ot-functions-option-types.php:986
1498
- #: includes/ot-functions-option-types.php:1315
1499
  #: includes/ot-functions-option-types.php:1429
1500
  msgid "Choose One"
1501
  msgstr ""
1502
 
1503
  #: includes/ot-functions-option-types.php:463
1504
- #: includes/ot-functions-option-types.php:521
1505
- #: includes/ot-functions-option-types.php:937
1506
- #: includes/ot-functions-option-types.php:992
1507
  msgid "No Posts Found"
1508
  msgstr ""
1509
 
1510
  #: includes/ot-functions-option-types.php:592
1511
- #: includes/ot-functions-option-types.php:881
1512
  msgid "Add New"
1513
  msgstr ""
1514
 
1515
  #: includes/ot-functions-option-types.php:595
1516
- #: includes/ot-functions-option-types.php:884
1517
  msgid "You can re-order with drag & drop, the order will update after saving."
1518
  msgstr ""
1519
 
1520
- #: includes/ot-functions-option-types.php:755
1521
- #: includes/ot-functions-option-types.php:810
1522
  msgid "No Pages Found"
1523
  msgstr ""
1524
 
1525
- #: includes/ot-functions-option-types.php:1206
1526
  msgid "Choose Sidebar"
1527
  msgstr ""
1528
 
1529
- #: includes/ot-functions-option-types.php:1211
1530
  msgid "No Sidebars"
1531
  msgstr ""
1532
 
1533
- #: includes/ot-functions-option-types.php:1266
1534
- #: includes/ot-functions-option-types.php:1320
1535
  msgid "No Tags Found"
1536
  msgstr ""
1537
 
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
+ "POT-Creation-Date: 2013-09-09 11:09:05+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
147
 
148
  #: includes/ot-functions-admin.php:565
149
  #: includes/ot-functions-option-types.php:152
150
+ #: includes/ot-functions-option-types.php:1872
151
  msgid "Remove Media"
152
  msgstr ""
153
 
425
  msgid "Activate"
426
  msgstr ""
427
 
428
+ #: includes/ot-functions-admin.php:3554 includes/ot-meta-box-api.php:186
429
  #: includes/ot-settings-api.php:587
430
  msgid "Title"
431
  msgstr ""
1482
  msgstr ""
1483
 
1484
  #: includes/ot-functions-option-types.php:140
1485
+ #: includes/ot-functions-option-types.php:1860
1486
  msgid "Add Media"
1487
  msgstr ""
1488
 
1493
 
1494
  #: includes/ot-functions-option-types.php:257
1495
  #: includes/ot-functions-option-types.php:515
1496
+ #: includes/ot-functions-option-types.php:803
1497
+ #: includes/ot-functions-option-types.php:984
1498
+ #: includes/ot-functions-option-types.php:1314
1499
  #: includes/ot-functions-option-types.php:1429
1500
  msgid "Choose One"
1501
  msgstr ""
1502
 
1503
  #: includes/ot-functions-option-types.php:463
1504
+ #: includes/ot-functions-option-types.php:520
1505
+ #: includes/ot-functions-option-types.php:935
1506
+ #: includes/ot-functions-option-types.php:989
1507
  msgid "No Posts Found"
1508
  msgstr ""
1509
 
1510
  #: includes/ot-functions-option-types.php:592
1511
+ #: includes/ot-functions-option-types.php:880
1512
  msgid "Add New"
1513
  msgstr ""
1514
 
1515
  #: includes/ot-functions-option-types.php:595
1516
+ #: includes/ot-functions-option-types.php:883
1517
  msgid "You can re-order with drag & drop, the order will update after saving."
1518
  msgstr ""
1519
 
1520
+ #: includes/ot-functions-option-types.php:754
1521
+ #: includes/ot-functions-option-types.php:808
1522
  msgid "No Pages Found"
1523
  msgstr ""
1524
 
1525
+ #: includes/ot-functions-option-types.php:1205
1526
  msgid "Choose Sidebar"
1527
  msgstr ""
1528
 
1529
+ #: includes/ot-functions-option-types.php:1210
1530
  msgid "No Sidebars"
1531
  msgstr ""
1532
 
1533
+ #: includes/ot-functions-option-types.php:1265
1534
+ #: includes/ot-functions-option-types.php:1319
1535
  msgid "No Tags Found"
1536
  msgstr ""
1537
 
ot-loader.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
- * Version: 2.1.3
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
@@ -142,7 +142,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
142
  /**
143
  * Current Version number.
144
  */
145
- define( 'OT_VERSION', '2.1.3' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
@@ -356,7 +356,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
356
  * @since 2.0
357
  */
358
  private function includes() {
359
-
360
  $files = array(
361
  'ot-functions',
362
  'ot-functions-deprecated'
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
+ * Version: 2.1.4
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
142
  /**
143
  * Current Version number.
144
  */
145
+ define( 'OT_VERSION', '2.1.4' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
356
  * @since 2.0
357
  */
358
  private function includes() {
359
+
360
  $files = array(
361
  'ot-functions',
362
  'ot-functions-deprecated'
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bit.ly/NuXI3T
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
- Stable tag: 2.1.3
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
@@ -41,6 +41,14 @@ Yes. OptionTree & WordPress both require PHP5.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
44
  = 2.1.3 =
45
  * Hotfix - Loading OptionTree on the 'init' action proved to be wrong, it now loads on 'after_setup_theme'.
46
  * Hotfix - Layouts were not being imported properly due to using the wrong path variable.
@@ -74,12 +82,12 @@ Yes. OptionTree & WordPress both require PHP5.
74
  * Added filter 'ot_show_docs' which allows you to hide the Documentation.
75
  * Added filter 'ot_use_theme_options' which allows you to hide the OptionTree Theme Option page (not recommended for beginners).
76
  * Added filter 'ot_list_item_description' which allows you to change the default list item description text.
77
- * Added filter 'ot_type_custom_post_type_checkbox_query' which allows you to filter the Custom Post Type Checkbox option type WP_Query array.
78
- * Added filter 'ot_type_custom_post_type_select_query' which allows you to filter the Custom Post Type Select option type WP_Query array.
79
- * Added filter 'ot_type_page_checkbox_query' which allows you to filter the Page Checkbox option type WP_Query array.
80
- * Added filter 'ot_type_page_select_query' which allows you to filter the Page Select option type WP_Query array.
81
- * Added filter 'ot_type_post_checkbox_query' which allows you to filter the Post Checkbox option type WP_Query array.
82
- * Added filter 'ot_type_post_select_query' which allows you to filter the Post Select option type WP_Query array.
83
 
84
  = 2.0.16 =
85
  * Fixed an urgent JS regression bug that caused the upload option type to break. Code contributed by @anonumus via github.
@@ -279,7 +287,7 @@ Yes. OptionTree & WordPress both require PHP5.
279
 
280
  == Upgrade Notice ==
281
 
282
- = 2.1.3 =
283
  If you're not the developer of this theme, please ask them to test compatibility with version 2.1 before upgrading. If you are the developer, I urge you to do the same in a controlled environment.
284
 
285
  = 2.0.16 =
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
+ Stable tag: 2.1.4
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
41
 
42
  == Changelog ==
43
 
44
+ = 2.1.4 =
45
+ * Hotfix - Fixed the Numeric Slider not work inside of a newly added List item.
46
+ * Hotfix - Fixed the numeric slider fallback value being set to 0, it now becomes the minimum value if no standard is set.
47
+ * Hotfix - Allow single quotes in std and choice value when exporting theme-options.php. Contributors via github @maimairel.
48
+ * Hotfix - Additional Themecheck bypass for required functions. Contributors via github @maimairel.
49
+ * Hotfix - Fixed post meta information being lost when loading revisions. Contributors via github @live-mesh.
50
+ * Hotfix - Removed template queries in option types. Contributors via github @live-mesh.
51
+
52
  = 2.1.3 =
53
  * Hotfix - Loading OptionTree on the 'init' action proved to be wrong, it now loads on 'after_setup_theme'.
54
  * Hotfix - Layouts were not being imported properly due to using the wrong path variable.
82
  * Added filter 'ot_show_docs' which allows you to hide the Documentation.
83
  * Added filter 'ot_use_theme_options' which allows you to hide the OptionTree Theme Option page (not recommended for beginners).
84
  * Added filter 'ot_list_item_description' which allows you to change the default list item description text.
85
+ * Added filter 'ot_type_custom_post_type_checkbox_query' which allows you to filter the get_posts() args for Custom Post Type Checkbox.
86
+ * Added filter 'ot_type_custom_post_type_select_query' which allows you to filter the get_posts() args for Custom Post Type Select.
87
+ * Added filter 'ot_type_page_checkbox_query' which allows you to filter the get_posts() args for Page Checkbox.
88
+ * Added filter 'ot_type_page_select_query' which allows you to filter the get_posts() args for Page Select.
89
+ * Added filter 'ot_type_post_checkbox_query' which allows you to filter the get_posts() args for Post Checkbox.
90
+ * Added filter 'ot_type_post_select_query' which allows you to filter the get_posts() args for Post Select.
91
 
92
  = 2.0.16 =
93
  * Fixed an urgent JS regression bug that caused the upload option type to break. Code contributed by @anonumus via github.
287
 
288
  == Upgrade Notice ==
289
 
290
+ = 2.1.4 =
291
  If you're not the developer of this theme, please ask them to test compatibility with version 2.1 before upgrading. If you are the developer, I urge you to do the same in a controlled environment.
292
 
293
  = 2.0.16 =