OptionTree - Version 1.1.7

Version Description

  • Added layout (theme variation) support with save/delete/activate/import/export capabilities. Contributions form Brian of flauntbooks.com
  • Allow layout change on Theme Options page.
  • Full Multisite compatibility by manually adding xml mime type for import options.
  • Replaced eregi() with preg_match() for 5.3+ compatibility.
  • Changed test data in the assets directory for new layout option.
  • Made it so when the slider & upload image changes it's reflected on blur.
  • Gave the slider image an upload button.
  • Added do_action('option_tree_import_data') to option_tree_import_data() function before exit.
  • Added do_action('option_tree_array_save') to option_tree_array_save() function before exit.
  • Added do_action('option_tree_save_layout') to option_tree_save_layout() function before exit.
  • Added do_action('option_tree_delete_layout') to option_tree_delete_layout() function before exit.
  • Added do_action('option_tree_activate_layout') to option_tree_activate_layout() function before exit.
  • Added do_action('option_tree_import_layout') to option_tree_import_layout() function before redirect.
  • Added do_action('option_tree_admin_header') hook before all admin pages.
  • Fixed bug where users could add a color without a hash.
  • Only load option type function on Theme Options page
  • Loading resources with absolute paths, no longer relative.
  • Fixed a bug with uploader creating extra option-tree draft pages.
  • Fixed slider toggle bug, now the sliders close when you open another or create new slide.
Download this release

Release Info

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

Code changes from version 1.1.6 to 1.1.7

assets/css/style-classic.css CHANGED
@@ -36,6 +36,9 @@ tbody tr.inline-edit-option td {
36
  #framework_wrap #content tbody tr.inline-edit-option td h3 {
37
  border-bottom-color: #dae1e8;
38
  }
 
 
 
39
  #framework_wrap code {
40
  background-color: #eaf3fa;
41
  }
36
  #framework_wrap #content tbody tr.inline-edit-option td h3 {
37
  border-bottom-color: #dae1e8;
38
  }
39
+ #framework_wrap tr.active-layout {
40
+ background: #F7F6F1;
41
+ }
42
  #framework_wrap code {
43
  background-color: #eaf3fa;
44
  }
assets/css/style.css CHANGED
@@ -142,6 +142,9 @@ a:hover strong {
142
  color: #d54e45;
143
  float: left;
144
  }
 
 
 
145
  #framework_wrap #content_wrap a.reset {
146
  margin-right: 10px;
147
  color: #d54e45;
@@ -229,8 +232,7 @@ a:hover strong {
229
  #framework_wrap a:hover.button-framework.light {
230
  color: #000;
231
  border-color: #adaca7;
232
- }
233
-
234
  /* Content Inner */
235
  #framework_wrap #content {
236
  padding: 0;
@@ -320,7 +322,6 @@ a:hover strong {
320
  -moz-border-radius: 4px;
321
  border-radius: 4px;
322
  }
323
-
324
  #framework_wrap #content .has-table table th {
325
  background: #f1f1f1;
326
  background-image: -moz-linear-gradient(top, #f9f9f9, #f1f1f1);
@@ -392,6 +393,9 @@ a:hover strong {
392
  padding: 6px 10px;
393
  font-size: 11px !important;
394
  }
 
 
 
395
  .has-table table a {
396
  text-decoration: none;
397
  }
@@ -401,7 +405,9 @@ a:hover strong {
401
  }
402
  a.edit-inline,
403
  a.delete-inline,
404
- a.add-option {
 
 
405
  background: url(../images/icon_edit.png) no-repeat 0 0;
406
  display: block;
407
  height: 16px;
@@ -411,13 +417,20 @@ a:hover strong {
411
  margin-right: 5px;
412
  display: block;
413
  }
414
- a.delete-inline {
 
415
  background-image: url(../images/icon_delete.png);
416
  }
417
  a.add-option {
418
  background-image: url(../images/icon_add.png);
419
  margin-left: 21px;
420
  }
 
 
 
 
 
 
421
  a:hover.edit-inline {
422
  border-color: #666;
423
  }
@@ -503,7 +516,8 @@ a:hover strong {
503
  }
504
  #framework_wrap #content input[type="text"],
505
  #framework_wrap #content select,
506
- #framework_wrap #content textarea {
 
507
  background: #fafafa;
508
  border-color: #ccc #eee #eee #ccc;
509
  border-style: solid;
@@ -517,6 +531,13 @@ a:hover strong {
517
  color: #888;
518
  resize: none;
519
  }
 
 
 
 
 
 
 
520
  #framework_wrap #content tbody tr.inline-edit-option td input[type="text"],
521
  #framework_wrap #content tbody tr.inline-edit-option td select,
522
  #framework_wrap #content tbody tr.inline-edit-option td textarea {
@@ -588,7 +609,9 @@ a:hover strong {
588
  #framework_wrap #content textarea:focus,
589
  #framework_wrap #content input[type="text"]:hover,
590
  #framework_wrap #content select:hover,
591
- #framework_wrap #content textarea:hover {
 
 
592
  background: #fff;
593
  border-color: #bbb #eee #eee #bbb;
594
  color: #333;
@@ -604,6 +627,17 @@ a:hover strong {
604
  width: 100%;
605
  padding-top: 15px;
606
  }
 
 
 
 
 
 
 
 
 
 
 
607
  #framework_wrap #content .select_wrapper {
608
  -moz-border-radius: 4px;
609
  -webkit-border-radius: 4px;
@@ -684,6 +718,10 @@ a:hover strong {
684
  background: #fff;
685
  width: 323px;
686
  }
 
 
 
 
687
  .option-tree-slider-wrap .edit {
688
  position: absolute;
689
  height: 16px;
@@ -716,7 +754,26 @@ a:hover strong {
716
  font-size: 11px;
717
  }
718
  .option-tree-slider-wrap .option-tree-slider-body {
719
- display: ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
  }
721
  /* Docs */
722
  #framework_wrap #options_tabs.docs {
@@ -761,33 +818,33 @@ a:hover strong {
761
  background: url(../images/pre_bg.gif) repeat left top; /*--Background of lined paper--*/
762
  }
763
  /* Tabs */
764
- .options_tabs {
765
  display: none;
766
  }
767
- .ui-tabs {
768
  zoom: 1;
769
  background: url(../images/tabs_bg.png) repeat-y 0 0;
770
  }
771
- .ui-tabs .options_tabs {
772
  display: block;
773
  }
774
- .ui-tabs-panel .description {
775
  width: 225px !important;
776
  }
777
- .ui-tabs-panel .inline-edit-option .description {
778
  width: 200px !important;
779
  }
780
- .ui-tabs-panel h2 {
781
  display: none;
782
  }
783
- .ui-tabs .ui-tabs-nav {
784
  list-style: none;
785
  position: relative;
786
  float: left;
787
  width: 148px;
788
  word-wrap: break-word;
789
  }
790
- .ui-tabs .ui-tabs-nav li {
791
  position: relative;
792
  float: left;
793
  display: block;
@@ -795,7 +852,7 @@ a:hover strong {
795
  padding: 0;
796
  overflow: visible;
797
  }
798
- .ui-tabs .ui-tabs-nav li a {
799
  float: left;
800
  text-decoration: none;
801
  display: block;
@@ -809,34 +866,34 @@ a:hover strong {
809
  background-position: 0 0;
810
  font-size: 11px;
811
  }
812
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
813
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a:hover {
814
  background: #fff;
815
  color: #d54e45;
816
  width: 128px;
817
  }
818
- .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
819
- .ui-tabs .ui-tabs-nav li.ui-state-processing a {
820
  cursor: text;
821
  }
822
- .ui-tabs .ui-tabs-nav li a,
823
- .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
824
  cursor: pointer;
825
  }
826
- .ui-tabs .ui-tabs-nav li.ui-state-hover a {
827
  background-color: #eaf2fa;
828
  color: #555;
829
  }
830
- .ui-tabs .ui-tabs-panel {
831
  display: block;
832
  float: right;
833
  width: 595px;
834
  min-height: 400px;
835
  }
836
- .ui-tabs .ui-tabs-hide {
837
  display: none !important;
838
  }
839
- .options_tabs li.ui-tabs-selected span {
840
  position: absolute;
841
  left: -1px;
842
  top: 12px;
142
  color: #d54e45;
143
  float: left;
144
  }
145
+ #framework_wrap #content_wrap .info input.reload-options {
146
+ color: #d54e45
147
+ }
148
  #framework_wrap #content_wrap a.reset {
149
  margin-right: 10px;
150
  color: #d54e45;
232
  #framework_wrap a:hover.button-framework.light {
233
  color: #000;
234
  border-color: #adaca7;
235
+ }
 
236
  /* Content Inner */
237
  #framework_wrap #content {
238
  padding: 0;
322
  -moz-border-radius: 4px;
323
  border-radius: 4px;
324
  }
 
325
  #framework_wrap #content .has-table table th {
326
  background: #f1f1f1;
327
  background-image: -moz-linear-gradient(top, #f9f9f9, #f1f1f1);
393
  padding: 6px 10px;
394
  font-size: 11px !important;
395
  }
396
+ #framework_wrap tr.active-layout {
397
+ background: #eaf3fa;
398
+ }
399
  .has-table table a {
400
  text-decoration: none;
401
  }
405
  }
406
  a.edit-inline,
407
  a.delete-inline,
408
+ a.add-option,
409
+ a.activate-saved,
410
+ a.delete-saved {
411
  background: url(../images/icon_edit.png) no-repeat 0 0;
412
  display: block;
413
  height: 16px;
417
  margin-right: 5px;
418
  display: block;
419
  }
420
+ a.delete-inline,
421
+ a.delete-saved {
422
  background-image: url(../images/icon_delete.png);
423
  }
424
  a.add-option {
425
  background-image: url(../images/icon_add.png);
426
  margin-left: 21px;
427
  }
428
+ a.activate-saved {
429
+ background-image: url(../images/icon_off.png);
430
+ }
431
+ .active-layout a.activate-saved {
432
+ background-image: url(../images/icon_on.png);
433
+ }
434
  a:hover.edit-inline {
435
  border-color: #666;
436
  }
516
  }
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
  color: #888;
532
  resize: none;
533
  }
534
+ #framework_wrap input.input_layout {
535
+ -webkit-border-radius: 4px;
536
+ -moz-border-radius: 4px;
537
+ border-radius: 4px;
538
+ width: 240px;
539
+ float: left;
540
+ }
541
  #framework_wrap #content tbody tr.inline-edit-option td input[type="text"],
542
  #framework_wrap #content tbody tr.inline-edit-option td select,
543
  #framework_wrap #content tbody tr.inline-edit-option td textarea {
609
  #framework_wrap #content textarea:focus,
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
  width: 100%;
628
  padding-top: 15px;
629
  }
630
+ #framework_wrap .select-layout {
631
+ float: right;
632
+ margin-right: 10px;
633
+ border-right: 1px solid #e3e3e3;
634
+ height: 34px
635
+ }
636
+ #framework_wrap .select-layout select {
637
+ margin: 5px 10px 0 0;
638
+ height: 25px;
639
+ padding: 4px 5px;
640
+ }
641
  #framework_wrap #content .select_wrapper {
642
  -moz-border-radius: 4px;
643
  -webkit-border-radius: 4px;
718
  background: #fff;
719
  width: 323px;
720
  }
721
+ #framework_wrap #content .option-option-tree-slider .section .element input[type="text"].upload {
722
+ width: 261px;
723
+ float: left;
724
+ }
725
  .option-tree-slider-wrap .edit {
726
  position: absolute;
727
  height: 16px;
754
  font-size: 11px;
755
  }
756
  .option-tree-slider-wrap .option-tree-slider-body {
757
+
758
+ }
759
+ .option-tree-slider p {
760
+ clear: both;
761
+ }
762
+ .option-tree-slider-wrap .option-tree-slider-body div label {
763
+ color: #555;
764
+ font-size: 11px;
765
+ display: block;
766
+ }
767
+ .option-tree-slider-wrap .option-tree-slider-body .screenshot {
768
+ display: block;
769
+ width: 320px;
770
+ }
771
+ .option-tree-slider-wrap .option-tree-slider-body .screenshot img {
772
+ max-width: 314px;
773
+ margin: 10px 0;
774
+ }
775
+ .option-tree-slider-wrap .option-tree-slider-body .screenshot .remove {
776
+ bottom: 6px;
777
  }
778
  /* Docs */
779
  #framework_wrap #options_tabs.docs {
818
  background: url(../images/pre_bg.gif) repeat left top; /*--Background of lined paper--*/
819
  }
820
  /* Tabs */
821
+ #framework_wrap .options_tabs {
822
  display: none;
823
  }
824
+ #framework_wrap .ui-tabs {
825
  zoom: 1;
826
  background: url(../images/tabs_bg.png) repeat-y 0 0;
827
  }
828
+ #framework_wrap .ui-tabs .options_tabs {
829
  display: block;
830
  }
831
+ #framework_wrap .ui-tabs-panel .description {
832
  width: 225px !important;
833
  }
834
+ #framework_wrap .ui-tabs-panel .inline-edit-option .description {
835
  width: 200px !important;
836
  }
837
+ #framework_wrap .ui-tabs-panel h2 {
838
  display: none;
839
  }
840
+ #framework_wrap .ui-tabs .ui-tabs-nav {
841
  list-style: none;
842
  position: relative;
843
  float: left;
844
  width: 148px;
845
  word-wrap: break-word;
846
  }
847
+ #framework_wrap .ui-tabs .ui-tabs-nav li {
848
  position: relative;
849
  float: left;
850
  display: block;
852
  padding: 0;
853
  overflow: visible;
854
  }
855
+ #framework_wrap .ui-tabs .ui-tabs-nav li a {
856
  float: left;
857
  text-decoration: none;
858
  display: block;
866
  background-position: 0 0;
867
  font-size: 11px;
868
  }
869
+ #framework_wrap .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
870
+ #framework_wrap .ui-tabs .ui-tabs-nav li.ui-tabs-selected a:hover {
871
  background: #fff;
872
  color: #d54e45;
873
  width: 128px;
874
  }
875
+ #framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
876
+ #framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-processing a {
877
  cursor: text;
878
  }
879
+ #framework_wrap .ui-tabs .ui-tabs-nav li a,
880
+ #framework_wrap .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
881
  cursor: pointer;
882
  }
883
+ #framework_wrap .ui-tabs .ui-tabs-nav li.ui-state-hover a {
884
  background-color: #eaf2fa;
885
  color: #555;
886
  }
887
+ #framework_wrap .ui-tabs .ui-tabs-panel {
888
  display: block;
889
  float: right;
890
  width: 595px;
891
  min-height: 400px;
892
  }
893
+ #framework_wrap .ui-tabs .ui-tabs-hide {
894
  display: none !important;
895
  }
896
+ #framework_wrap .options_tabs li.ui-tabs-selected span {
897
  position: absolute;
898
  left: -1px;
899
  top: 12px;
assets/images/icon_off.png ADDED
Binary file
assets/images/icon_on.png ADDED
Binary file
assets/js/jquery.option.tree.js CHANGED
@@ -144,12 +144,12 @@
144
  btnContent = true;
145
  // On Click
146
  $('.upload_button').live("click", function () {
147
- formfield = $(this).prev('input').attr('name');
148
  formID = $(this).attr('rel');
149
  tb_show('', 'media-upload.php?post_id='+formID+'&type=image&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) {
@@ -194,6 +194,10 @@
194
  inlineEditOption.save_options(this);
195
  return false;
196
  });
 
 
 
 
197
  $('.reset', '#the-theme-options').live("click", function () {
198
  var agree = confirm("Are you absolutely sure you wish to delete all of your saved Theme Option?");
199
  if (agree) {
@@ -207,6 +211,42 @@
207
  inlineEditOption.import_data(this);
208
  return false;
209
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  $("a.edit-inline").live("click", function (event) {
211
  if ($("a.edit-inline").hasClass('disable')) {
212
  event.preventDefault();
@@ -292,10 +332,42 @@
292
  $('.remove').live('click', function(event) {
293
  $(this).hide();
294
  $(this).parents().prev().prev('.upload').attr('value', '');
295
- $(this).parents('.screenshot').slideUp();
 
 
 
296
  });
297
  // Hide the delete button on the first row
298
  $('a.delete-inline', "#option-1").hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  },
300
  save_options: function (e) {
301
  var d = {
@@ -314,6 +386,20 @@
314
  });
315
  return false;
316
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  reset_options: function () {
318
  var d = {
319
  action: "option_tree_array_reset",
@@ -323,7 +409,7 @@
323
  if (r != -1) {
324
  $('.screenshot').hide();
325
  $(':input','#the-theme-options')
326
- .not(':button, :submit, :reset, :hidden')
327
  .val('')
328
  .removeAttr('checked')
329
  .removeAttr('selected');
@@ -343,6 +429,124 @@
343
  });
344
  return false;
345
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  import_data: function (e) {
347
  var d = {
348
  action: "option_tree_import_data"
@@ -351,14 +555,29 @@
351
  d = b + "&" + $.param(d);
352
  $.post(ajaxurl, d, function (r) {
353
  if (r != -1) {
354
- $("textarea", "#import_options").val('');
355
  $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Your Theme Options data was successfully imported.</div>');
 
356
  } else {
357
  $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Your Theme Options data could not be imported.</div>');
358
  }
359
  });
360
  return false;
361
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  remove: function (b) {
363
  var c = true;
364
 
@@ -563,10 +782,10 @@
563
  $('.item_id', editRow).attr('value', item_id);
564
 
565
  // Item Type
566
- item_type = $('.item_type', rowData).text();
567
- $('select[name=item_type] option[value='+item_type+']', editRow).attr('selected', true);
568
- var temp_item_type = $('select[name=item_type] option[value='+item_type+']', editRow).text();
569
- $('.select_wrapper span', editRow).text(temp_item_type);
570
 
571
  // Item Description
572
  item_desc = $('.item_desc', rowData).text();
@@ -774,65 +993,69 @@
774
  $(".option-tree-slider-body").hide();
775
  $('.option-tree-slider .edit').live('click', function(event){
776
  event.preventDefault();
 
 
777
  $(this).toggleClass('down');
778
  $(this).parent().find('.option-tree-slider-body').toggle();
779
  });
780
  $('.option-tree-slider-title').live('keyup', function(){
781
- ImageSlider.update_slider_title(this);
782
- });
783
- $('.remove-slide').live('click', function(event){
784
- event.preventDefault();
785
- var agree = confirm("Are you sure you wish to delete this slide?");
786
  if (agree) {
787
  ImageSlider.delete_slider_image(this);
788
  return false;
789
  } else {
790
  return false;
791
  }
792
- });
793
- $('.add-slide').live('click', function(event){
794
- event.preventDefault();
795
- ImageSlider.add_slider($(this).attr('id'));
796
- });
797
-
798
- $('.option-tree-slider-wrap').each( function() {
799
- var id = $(this).attr('id');
800
- if ( $('#'+id).length ) {
801
- $('#'+id).sortable({
802
- update: function(event,ui){
803
- $('#'+id).find('li:not(.ui-sortable-helper)').each(function(inc){
804
- var target = $(this).find('a.open').attr('href').split("#")[1];
805
- $('#' + target).find('input.option-tree-slider-order').val(inc + 1);
806
- });
807
- }
808
- });
809
- }
810
  });
811
  },
812
  update_slider_title: function(e) {
813
- var element = e;
814
- if ( this.timer ) {
815
- clearTimeout( element.timer );
816
- }
817
- this.timer = setTimeout( function() {
818
- $(element).parents('.option-tree-slider').find('.open').text( element.value );
819
- }, 100);
820
- return true;
821
- },
822
- add_slider: function(id) {
823
  var self = this;
824
- if ( this.processing === false ) {
825
- this.processing = true;
826
  var image_count = parseInt($( '#'+id+'_list li' ).length) - 1;
827
  $.ajax({
828
- url: ajaxurl,
829
- type: 'get',
830
- data: {
831
  action: 'option_tree_add_slider',
832
  slide_id: id,
833
- count: image_count
 
834
  },
835
  complete: function( data ) {
 
 
836
  $('#'+id+'_list').append( '<li>' + data.responseText + '</li>' );
837
  $('#'+id+'_list li:last .option-tree-slider .edit').toggleClass('down');
838
  self.processing = false;
@@ -840,7 +1063,7 @@
840
  });
841
  }
842
  },
843
- delete_slider_image: function(e) {
844
  $(e).parents('li').remove();
845
  }
846
  };
144
  btnContent = true;
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&amp;TB_iframe=1');
150
  return false;
151
  });
152
+
153
  window.original_send_to_editor = window.send_to_editor;
154
  window.send_to_editor = function(html) {
155
  if (formfield) {
194
  inlineEditOption.save_options(this);
195
  return false;
196
  });
197
+ $('.reload-options', '#the-theme-options').live("click", function () {
198
+ inlineEditOption.reload_options(this);
199
+ return false;
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?");
203
  if (agree) {
211
  inlineEditOption.import_data(this);
212
  return false;
213
  });
214
+ $('.import-layout', '#import-layout').live("click", function () {
215
+ inlineEditOption.import_layout(this);
216
+ return false;
217
+ });
218
+ $('.save-layout', '#save-layout').live("click", function (e) {
219
+ inlineEditOption.save_layout(this);
220
+ e.preventDefault();
221
+ return false;
222
+ });
223
+ $('a.delete-saved').live("click", function () {
224
+ if ($("a.delete-saved").hasClass('disable')) {
225
+ event.preventDefault();
226
+ return false;
227
+ } else {
228
+ var agree = confirm("Are you sure you want to delete this saved layout?");
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
+ inlineEditOption.activate_layout_user_side(this);
248
+ return false;
249
+ });
250
  $("a.edit-inline").live("click", function (event) {
251
  if ($("a.edit-inline").hasClass('disable')) {
252
  event.preventDefault();
332
  $('.remove').live('click', function(event) {
333
  $(this).hide();
334
  $(this).parents().prev().prev('.upload').attr('value', '');
335
+ //$(this).parents('.screenshot').slideUp();
336
+ $(this).parents('.screenshot').find('img').remove();
337
+ $(this).parents('.screenshot').find('.remove').remove();
338
+ event.preventDefault();
339
  });
340
  // Hide the delete button on the first row
341
  $('a.delete-inline', "#option-1").hide();
342
+ // change upload input
343
+ $('.upload').live('blur', function() {
344
+ var id = $(this).attr('id'),
345
+ val = $(this).val(),
346
+ img = $(this).parent().find('img'),
347
+ btn = $(this).parent().find('.remove'),
348
+ src = img.attr('src');
349
+
350
+ // don't match update
351
+ if ( val != src ) {
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().find('.screenshot').append(btnContent);
358
+ } else if ( val == '' ) {
359
+ img.remove();
360
+ btn.remove();
361
+ }
362
+ });
363
+ // add a # to color
364
+ $('.cp_input').live('blur', function() {
365
+ var val = $(this).val();
366
+ var reg = /^[A-Fa-f0-9]{6}$/;
367
+ if( reg.test( val) && val != '' ) {
368
+ $(this).attr('value', '#'+val )
369
+ }
370
+ });
371
  },
372
  save_options: function (e) {
373
  var d = {
386
  });
387
  return false;
388
  },
389
+ reload_options: function (e) {
390
+ var d = {
391
+ action: "option_tree_array_reload",
392
+ _ajax_nonce: $("#_ajax_nonce").val()
393
+ };
394
+ $.post(ajaxurl, d, function (r) {
395
+ if (r != -1) {
396
+ window.location.href = r;
397
+ } else {
398
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Theme Options could not be updated.</div>');
399
+ }
400
+ });
401
+ return false;
402
+ },
403
  reset_options: function () {
404
  var d = {
405
  action: "option_tree_array_reset",
409
  if (r != -1) {
410
  $('.screenshot').hide();
411
  $(':input','#the-theme-options')
412
+ .not(':button, :submit, :reset, :hidden, #active_theme_layout')
413
  .val('')
414
  .removeAttr('checked')
415
  .removeAttr('selected');
429
  });
430
  return false;
431
  },
432
+ save_layout: function(e){
433
+ var d = {
434
+ action: "option_tree_save_layout"
435
+ };
436
+ var aa = $(':input', '#save-layout').val();
437
+ if ( !aa ) {
438
+ aa = 'default';
439
+ }
440
+ var ab = aa.replace(' ', '-');
441
+ ab = ab.toLowerCase();
442
+
443
+ b = $(':input', '#save-layout').serialize();
444
+ d = b + "&" + $.param(d);
445
+ $.post(ajaxurl, d, function (r) {
446
+ if (r != -1) {
447
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Layout Saved Successfully.</div>');
448
+ $("#saved-options > tbody").prepend("<tr id='saved-"+ab+"'><td class='col-title'>"+aa+"</td><td class='col-key>'><textarea>"+r+"</textarea></td><td class='col-edit' style='padding-left:10px !important; width: 55px;'><a href='#' class='activate-saved' alt='Activate'>Activate</a><a href='#' class='delete-saved' alt='Delete'>Delete</a></td></tr>");
449
+ inlineEditOption.update_export_layout();
450
+ $('tr').removeClass('active-layout');
451
+ $('#layout-settings tr:first').addClass('active-layout');
452
+ $('.empty-layouts').remove();
453
+ } else {
454
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Your Layout could not be saved.</div>');
455
+ }
456
+ });
457
+ return false;
458
+ },
459
+ activate_layout: function (b) {
460
+ var c = true;
461
+
462
+ // Set ID
463
+ c = $(b).parents("tr:first").attr('id');
464
+ c = c.replace("saved-", "");
465
+
466
+ d = {
467
+ action: "option_tree_activate_layout",
468
+ id: c,
469
+ _ajax_nonce: $("#_ajax_nonce").val()
470
+ };
471
+ $.post(ajaxurl, d, function (r) {
472
+ if (r != -1) {
473
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Your Layout has been activated.</div>');
474
+ inlineEditOption.update_export_data();
475
+ inlineEditOption.update_export_layout();
476
+ $('tr').removeClass('active-layout');
477
+ $('#'+$(b).parents("tr:first").attr('id')).addClass('active-layout');
478
+ } else {
479
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
480
+ }
481
+ });
482
+ return false;
483
+ },
484
+ activate_layout_user_side: function(b) {
485
+ d = {
486
+ action: "option_tree_activate_layout",
487
+ id: $("#active_theme_layout").val(),
488
+ _ajax_nonce: $("#_ajax_nonce").val(),
489
+ themes: true
490
+ };
491
+ $.post(ajaxurl, d, function (r) {
492
+ if (r != -1) {
493
+ window.location.href = r;
494
+ } else {
495
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Theme Options could not be saved</div>');
496
+ }
497
+ });
498
+ },
499
+ delete_layout: function (b) {
500
+ var c = true;
501
+
502
+ // Set ID
503
+ c = $(b).parents("tr:first").attr('id');
504
+ c = c.replace("saved-", "");
505
+
506
+ d = {
507
+ action: "option_tree_delete_layout",
508
+ id: c,
509
+ _ajax_nonce: $("#_ajax_nonce").val()
510
+ };
511
+ $.post(ajaxurl, d, function (r) {
512
+ if (r != -1) {
513
+ $("#saved-" + c).remove();
514
+ $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Your Layout has been deleted.</div>');
515
+ inlineEditOption.update_export_layout();
516
+ } else {
517
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>'+r+'</div>');
518
+ }
519
+ });
520
+ return false;
521
+ },
522
+ import_layout: function (e) {
523
+ var d = {
524
+ action: "option_tree_import_layout"
525
+ };
526
+ b = $(':input', '#import-layout').serialize();
527
+ d = b + "&" + $.param(d);
528
+ $.post(ajaxurl, d, function (r) {
529
+ if (r != -1) {
530
+ window.location.href = r;
531
+ } else {
532
+ $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Your Layouts could not be imported.</div>');
533
+ }
534
+ });
535
+ return false;
536
+ },
537
+ update_export_layout: function () {
538
+ var d = {
539
+ action: "option_tree_update_export_layout",
540
+ saved: $("textarea#export_layouts").val(),
541
+ _ajax_nonce: $("#_ajax_nonce").val()
542
+ };
543
+ $.post(ajaxurl, d, function (r) {
544
+ if (r != -1) {
545
+ $("textarea#export_layouts").val(r);
546
+ }
547
+ });
548
+ return false;
549
+ },
550
  import_data: function (e) {
551
  var d = {
552
  action: "option_tree_import_data"
555
  d = b + "&" + $.param(d);
556
  $.post(ajaxurl, d, function (r) {
557
  if (r != -1) {
558
+ $("textarea#import_options_data").val('');
559
  $('.ajax-message').ajaxMessage('<div class="message"><span>&nbsp;</span>Your Theme Options data was successfully imported.</div>');
560
+ inlineEditOption.update_export_data();
561
  } else {
562
  $('.ajax-message').ajaxMessage('<div class="message warning"><span>&nbsp;</span>Your Theme Options data could not be imported.</div>');
563
  }
564
  });
565
  return false;
566
  },
567
+ update_export_data: function () {
568
+ var d = {
569
+ action: "option_tree_update_export_data",
570
+ saved: $("textarea#export_data").val(),
571
+ _ajax_nonce: $("#_ajax_nonce").val()
572
+ };
573
+ $.post(ajaxurl, d, function (r) {
574
+ if (r != -1) {
575
+ $("textarea#export_data").val(r);
576
+ $('.active-layout textarea').val(r);
577
+ }
578
+ });
579
+ return false;
580
+ },
581
  remove: function (b) {
582
  var c = true;
583
 
782
  $('.item_id', editRow).attr('value', item_id);
783
 
784
  // Item Type
785
+ item_type = $('.item_type', rowData).text();
786
+ $('select[name=item_type] option[value='+item_type+']', editRow).attr('selected', true);
787
+ var temp_item_type = $('select[name=item_type] option[value='+item_type+']', editRow).text();
788
+ $('.select_wrapper span', editRow).text(temp_item_type);
789
 
790
  // Item Description
791
  item_desc = $('.item_desc', rowData).text();
993
  $(".option-tree-slider-body").hide();
994
  $('.option-tree-slider .edit').live('click', function(event){
995
  event.preventDefault();
996
+ $('.option-tree-slider .edit').not($(this)).removeClass('down');
997
+ $('.option-tree-slider-body').not($(this).parent().find('.option-tree-slider-body')).hide();
998
  $(this).toggleClass('down');
999
  $(this).parent().find('.option-tree-slider-body').toggle();
1000
  });
1001
  $('.option-tree-slider-title').live('keyup', function(){
1002
+ ImageSlider.update_slider_title(this);
1003
+ });
1004
+ $('.remove-slide').live('click', function(event){
1005
+ event.preventDefault();
1006
+ var agree = confirm("Are you sure you wish to delete this slide?");
1007
  if (agree) {
1008
  ImageSlider.delete_slider_image(this);
1009
  return false;
1010
  } else {
1011
  return false;
1012
  }
1013
+ });
1014
+ $('.add-slide').live('click', function(event){
1015
+ event.preventDefault();
1016
+ ImageSlider.add_slider($(this).attr('id'));
1017
+ });
1018
+ $('.option-tree-slider-wrap').each( function() {
1019
+ var id = $(this).attr('id');
1020
+ if ( $('#'+id).length ) {
1021
+ $('#'+id).sortable({
1022
+ update: function(event,ui){
1023
+ $('#'+id).find('li:not(.ui-sortable-helper)').each(function(inc){
1024
+ var target = $(this).find('a.open').attr('href').split("#")[1];
1025
+ $('#' + target).find('input.option-tree-slider-order').val(inc + 1);
1026
+ });
1027
+ }
1028
+ });
1029
+ }
 
1030
  });
1031
  },
1032
  update_slider_title: function(e) {
1033
+ var element = e;
1034
+ if ( this.timer ) {
1035
+ clearTimeout( element.timer );
1036
+ }
1037
+ this.timer = setTimeout( function() {
1038
+ $(element).parents('.option-tree-slider').find('.open').text( element.value );
1039
+ }, 100);
1040
+ return true;
1041
+ },
1042
+ add_slider: function(id) {
1043
  var self = this;
1044
+ if ( this.processing === false ) {
1045
+ this.processing = true;
1046
  var image_count = parseInt($( '#'+id+'_list li' ).length) - 1;
1047
  $.ajax({
1048
+ url: ajaxurl,
1049
+ type: 'get',
1050
+ data: {
1051
  action: 'option_tree_add_slider',
1052
  slide_id: id,
1053
+ count: image_count,
1054
+ page: 'option_tree'
1055
  },
1056
  complete: function( data ) {
1057
+ $('.option-tree-slider .edit').removeClass('down');
1058
+ $('.option-tree-slider-body').hide();
1059
  $('#'+id+'_list').append( '<li>' + data.responseText + '</li>' );
1060
  $('#'+id+'_list li:last .option-tree-slider .edit').toggleClass('down');
1061
  self.processing = false;
1063
  });
1064
  }
1065
  },
1066
+ delete_slider_image: function(e) {
1067
  $(e).parents('li').remove();
1068
  }
1069
  };
assets/option-tree/layouts.txt ADDED
@@ -0,0 +1 @@
 
1
+ YTozOntzOjEzOiJhY3RpdmVfbGF5b3V0IjtzOjc6ImRlZmF1bHQiO3M6NzoiZGVmYXVsdCI7czo1NTY6IllUb3hPVHA3Y3pveE5Ub2laMlZ1WlhKaGJGOWtaV1poZFd4MElqdHpPakE2SWlJN2N6bzVPaUowWlhoMFlteHZZMnNpTzNNNk1Eb2lJanR6T2pVNkltbHVjSFYwSWp0ek9qQTZJaUk3Y3pvNE9pSmphR1ZqYTJKdmVDSTdjem93T2lJaU8zTTZOVG9pY21Ga2FXOGlPM002TURvaUlqdHpPalk2SW5ObGJHVmpkQ0k3Y3pvd09pSWlPM002T0RvaWRHVjRkR0Z5WldFaU8zTTZNRG9pSWp0ek9qWTZJblZ3Ykc5aFpDSTdjem93T2lJaU8zTTZNVEU2SW1OdmJHOXljR2xqYTJWeUlqdHpPakE2SWlJN2N6bzRPaUpqWVhSbFoyOXllU0k3Y3pvd09pSWlPM002TVRBNkltTmhkR1ZuYjNKcFpYTWlPM002TURvaUlqdHpPak02SW5SaFp5STdjem93T2lJaU8zTTZORG9pZEdGbmN5STdjem93T2lJaU8zTTZORG9pY0c5emRDSTdjem93T2lJaU8zTTZOVG9pY0c5emRITWlPM002TURvaUlqdHpPalE2SW5CaFoyVWlPM002TURvaUlqdHpPalU2SW5CaFoyVnpJanR6T2pBNklpSTdjem94TVRvaVkzVnpkRzl0WDNCdmMzUWlPM002TURvaUlqdHpPakV5T2lKamRYTjBiMjFmY0c5emRITWlPM002TURvaUlqdDkiO3M6NzoidGVzdGluZyI7czo1NTY6IllUb3hPVHA3Y3pveE5Ub2laMlZ1WlhKaGJGOWtaV1poZFd4MElqdHpPakE2SWlJN2N6bzVPaUowWlhoMFlteHZZMnNpTzNNNk1Eb2lJanR6T2pVNkltbHVjSFYwSWp0ek9qQTZJaUk3Y3pvNE9pSmphR1ZqYTJKdmVDSTdjem93T2lJaU8zTTZOVG9pY21Ga2FXOGlPM002TURvaUlqdHpPalk2SW5ObGJHVmpkQ0k3Y3pvd09pSWlPM002T0RvaWRHVjRkR0Z5WldFaU8zTTZNRG9pSWp0ek9qWTZJblZ3Ykc5aFpDSTdjem93T2lJaU8zTTZNVEU2SW1OdmJHOXljR2xqYTJWeUlqdHpPakE2SWlJN2N6bzRPaUpqWVhSbFoyOXllU0k3Y3pvd09pSWlPM002TVRBNkltTmhkR1ZuYjNKcFpYTWlPM002TURvaUlqdHpPak02SW5SaFp5STdjem93T2lJaU8zTTZORG9pZEdGbmN5STdjem93T2lJaU8zTTZORG9pY0c5emRDSTdjem93T2lJaU8zTTZOVG9pY0c5emRITWlPM002TURvaUlqdHpPalE2SW5CaFoyVWlPM002TURvaUlqdHpPalU2SW5CaFoyVnpJanR6T2pBNklpSTdjem94TVRvaVkzVnpkRzl0WDNCdmMzUWlPM002TURvaUlqdHpPakV5T2lKamRYTjBiMjFmY0c5emRITWlPM002TURvaUlqdDkiO30=
assets/option-tree/theme-options.txt ADDED
@@ -0,0 +1 @@
 
1
+ YToxOTp7czoxNToiZ2VuZXJhbF9kZWZhdWx0IjtzOjA6IiI7czo5OiJ0ZXh0YmxvY2siO3M6MDoiIjtzOjU6ImlucHV0IjtzOjA6IiI7czo4OiJjaGVja2JveCI7czowOiIiO3M6NToicmFkaW8iO3M6MDoiIjtzOjY6InNlbGVjdCI7czowOiIiO3M6ODoidGV4dGFyZWEiO3M6MDoiIjtzOjY6InVwbG9hZCI7czowOiIiO3M6MTE6ImNvbG9ycGlja2VyIjtzOjA6IiI7czo4OiJjYXRlZ29yeSI7czowOiIiO3M6MTA6ImNhdGVnb3JpZXMiO3M6MDoiIjtzOjM6InRhZyI7czowOiIiO3M6NDoidGFncyI7czowOiIiO3M6NDoicG9zdCI7czowOiIiO3M6NToicG9zdHMiO3M6MDoiIjtzOjQ6InBhZ2UiO3M6MDoiIjtzOjU6InBhZ2VzIjtzOjA6IiI7czoxMToiY3VzdG9tX3Bvc3QiO3M6MDoiIjtzOjEyOiJjdXN0b21fcG9zdHMiO3M6MDoiIjt9
assets/{test/test-options.xml → option-tree/theme-options.xml} RENAMED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <wp_option_tree>
3
  <row>
4
  <id>1</id>
5
  <item_id>general_default</item_id>
@@ -17,7 +17,7 @@
17
  &amp;lt;p&amp;gt;Here is a &amp;lt;strong&amp;gt;textblock&amp;lt;/strong&amp;gt; with HTML in it. You can use this space to transition to the next section or subsection within a tab on the &amp;lt;em&amp;gt;Theme Options&amp;lt;/em&amp;gt; page. It&amp;#039;s use is strictly for the admin UI and is not for the front-end of the web site.&amp;lt;/p&amp;gt;</item_desc>
18
  <item_type>textblock</item_type>
19
  <item_options></item_options>
20
- <item_sort>2</item_sort>
21
  </row>
22
  <row>
23
  <id>3</id>
@@ -26,7 +26,7 @@
26
  <item_desc>You can save a simple string here. Maybe a link to feedburner or your Twitter username.</item_desc>
27
  <item_type>input</item_type>
28
  <item_options></item_options>
29
- <item_sort>3</item_sort>
30
  </row>
31
  <row>
32
  <id>4</id>
@@ -35,7 +35,7 @@
35
  <item_desc>You could ask a question with a checkbox. For example, do you want to activate asynchronous Google analytics?</item_desc>
36
  <item_type>checkbox</item_type>
37
  <item_options>yes</item_options>
38
- <item_sort>4</item_sort>
39
  </row>
40
  <row>
41
  <id>5</id>
@@ -44,7 +44,7 @@
44
  <item_desc>You could ask a question with a radio input. For example, do you want to activate asynchronous Google analytics?</item_desc>
45
  <item_type>radio</item_type>
46
  <item_options>yes,no</item_options>
47
- <item_sort>5</item_sort>
48
  </row>
49
  <row>
50
  <id>6</id>
@@ -53,7 +53,7 @@
53
  <item_desc>Use this to list different theme styles or choose some other important setting.</item_desc>
54
  <item_type>select</item_type>
55
  <item_options>yes,no</item_options>
56
- <item_sort>6</item_sort>
57
  </row>
58
  <row>
59
  <id>7</id>
@@ -62,7 +62,7 @@
62
  <item_desc>Here users can add custom code or text for use in your theme.</item_desc>
63
  <item_type>textarea</item_type>
64
  <item_options>6</item_options>
65
- <item_sort>7</item_sort>
66
  </row>
67
  <row>
68
  <id>8</id>
@@ -71,7 +71,7 @@
71
  <item_desc>Here you can upload any WordPress supported media. After uploading, hit the &amp;quot;Insert into Post&amp;quot; button. One caveat of this feature is that if you upload media on one site the URL will no be correct if you import the data to a new one. You&amp;#039;ll have to re-upload the media.</item_desc>
72
  <item_type>upload</item_type>
73
  <item_options></item_options>
74
- <item_sort>8</item_sort>
75
  </row>
76
  <row>
77
  <id>9</id>
@@ -80,7 +80,7 @@
80
  <item_desc>This is a very self explanatory feature. Use it to change the color of something.</item_desc>
81
  <item_type>colorpicker</item_type>
82
  <item_options></item_options>
83
- <item_sort>9</item_sort>
84
  </row>
85
  <row>
86
  <id>10</id>
@@ -89,7 +89,7 @@
89
  <item_desc>Choose from a list of categories and save as a single category ID for use in a function or loop.</item_desc>
90
  <item_type>category</item_type>
91
  <item_options></item_options>
92
- <item_sort>10</item_sort>
93
  </row>
94
  <row>
95
  <id>11</id>
@@ -98,7 +98,7 @@
98
  <item_desc>Choose from a list of categories and save multiple category ID&amp;#039;s for use in a function or loop.</item_desc>
99
  <item_type>categories</item_type>
100
  <item_options></item_options>
101
- <item_sort>11</item_sort>
102
  </row>
103
  <row>
104
  <id>12</id>
@@ -107,7 +107,7 @@
107
  <item_desc>Choose from a list of tags and save as a single tag ID for use in a function or loop.</item_desc>
108
  <item_type>tag</item_type>
109
  <item_options></item_options>
110
- <item_sort>12</item_sort>
111
  </row>
112
  <row>
113
  <id>13</id>
@@ -116,7 +116,7 @@
116
  <item_desc>Choose from a list of tags and save as multiple tag ID&amp;#039;s for use in a function or loop.</item_desc>
117
  <item_type>tags</item_type>
118
  <item_options></item_options>
119
- <item_sort>13</item_sort>
120
  </row>
121
  <row>
122
  <id>14</id>
@@ -125,7 +125,7 @@
125
  <item_desc>Choose from a list of posts and save as a single post ID for use in a function or loop.</item_desc>
126
  <item_type>post</item_type>
127
  <item_options></item_options>
128
- <item_sort>14</item_sort>
129
  </row>
130
  <row>
131
  <id>15</id>
@@ -134,7 +134,7 @@
134
  <item_desc>Choose from a list of posts and save as multiple post ID&amp;#039;s for use in a function or loop.</item_desc>
135
  <item_type>posts</item_type>
136
  <item_options></item_options>
137
- <item_sort>15</item_sort>
138
  </row>
139
  <row>
140
  <id>16</id>
@@ -143,7 +143,7 @@
143
  <item_desc>Choose from a list of pages and save as a single page ID for use in a function or loop.</item_desc>
144
  <item_type>page</item_type>
145
  <item_options></item_options>
146
- <item_sort>16</item_sort>
147
  </row>
148
  <row>
149
  <id>17</id>
@@ -152,7 +152,7 @@
152
  <item_desc>Choose from a list of pages and save as multiple page ID&amp;#039;s for use in a function or loop.</item_desc>
153
  <item_type>pages</item_type>
154
  <item_options></item_options>
155
- <item_sort>17</item_sort>
156
  </row>
157
  <row>
158
  <id>18</id>
@@ -161,7 +161,7 @@
161
  <item_desc>Choose from a list of any post type and save as a single ID for use in a function or loop.</item_desc>
162
  <item_type>custom_post</item_type>
163
  <item_options>attachment</item_options>
164
- <item_sort>18</item_sort>
165
  </row>
166
  <row>
167
  <id>19</id>
@@ -170,6 +170,6 @@
170
  <item_desc>Choose from a list of any post type and save as multiple ID&amp;#039;s for use in a function or loop.</item_desc>
171
  <item_type>custom_posts</item_type>
172
  <item_options>attachment</item_options>
173
- <item_sort>19</item_sort>
174
  </row>
175
- </wp_option_tree>
1
  <?xml version="1.0"?>
2
+ <wp_4_option_tree>
3
  <row>
4
  <id>1</id>
5
  <item_id>general_default</item_id>
17
  &amp;lt;p&amp;gt;Here is a &amp;lt;strong&amp;gt;textblock&amp;lt;/strong&amp;gt; with HTML in it. You can use this space to transition to the next section or subsection within a tab on the &amp;lt;em&amp;gt;Theme Options&amp;lt;/em&amp;gt; page. It&amp;#039;s use is strictly for the admin UI and is not for the front-end of the web site.&amp;lt;/p&amp;gt;</item_desc>
18
  <item_type>textblock</item_type>
19
  <item_options></item_options>
20
+ <item_sort>3</item_sort>
21
  </row>
22
  <row>
23
  <id>3</id>
26
  <item_desc>You can save a simple string here. Maybe a link to feedburner or your Twitter username.</item_desc>
27
  <item_type>input</item_type>
28
  <item_options></item_options>
29
+ <item_sort>4</item_sort>
30
  </row>
31
  <row>
32
  <id>4</id>
35
  <item_desc>You could ask a question with a checkbox. For example, do you want to activate asynchronous Google analytics?</item_desc>
36
  <item_type>checkbox</item_type>
37
  <item_options>yes</item_options>
38
+ <item_sort>5</item_sort>
39
  </row>
40
  <row>
41
  <id>5</id>
44
  <item_desc>You could ask a question with a radio input. For example, do you want to activate asynchronous Google analytics?</item_desc>
45
  <item_type>radio</item_type>
46
  <item_options>yes,no</item_options>
47
+ <item_sort>6</item_sort>
48
  </row>
49
  <row>
50
  <id>6</id>
53
  <item_desc>Use this to list different theme styles or choose some other important setting.</item_desc>
54
  <item_type>select</item_type>
55
  <item_options>yes,no</item_options>
56
+ <item_sort>7</item_sort>
57
  </row>
58
  <row>
59
  <id>7</id>
62
  <item_desc>Here users can add custom code or text for use in your theme.</item_desc>
63
  <item_type>textarea</item_type>
64
  <item_options>6</item_options>
65
+ <item_sort>8</item_sort>
66
  </row>
67
  <row>
68
  <id>8</id>
71
  <item_desc>Here you can upload any WordPress supported media. After uploading, hit the &amp;quot;Insert into Post&amp;quot; button. One caveat of this feature is that if you upload media on one site the URL will no be correct if you import the data to a new one. You&amp;#039;ll have to re-upload the media.</item_desc>
72
  <item_type>upload</item_type>
73
  <item_options></item_options>
74
+ <item_sort>9</item_sort>
75
  </row>
76
  <row>
77
  <id>9</id>
80
  <item_desc>This is a very self explanatory feature. Use it to change the color of something.</item_desc>
81
  <item_type>colorpicker</item_type>
82
  <item_options></item_options>
83
+ <item_sort>10</item_sort>
84
  </row>
85
  <row>
86
  <id>10</id>
89
  <item_desc>Choose from a list of categories and save as a single category ID for use in a function or loop.</item_desc>
90
  <item_type>category</item_type>
91
  <item_options></item_options>
92
+ <item_sort>11</item_sort>
93
  </row>
94
  <row>
95
  <id>11</id>
98
  <item_desc>Choose from a list of categories and save multiple category ID&amp;#039;s for use in a function or loop.</item_desc>
99
  <item_type>categories</item_type>
100
  <item_options></item_options>
101
+ <item_sort>12</item_sort>
102
  </row>
103
  <row>
104
  <id>12</id>
107
  <item_desc>Choose from a list of tags and save as a single tag ID for use in a function or loop.</item_desc>
108
  <item_type>tag</item_type>
109
  <item_options></item_options>
110
+ <item_sort>13</item_sort>
111
  </row>
112
  <row>
113
  <id>13</id>
116
  <item_desc>Choose from a list of tags and save as multiple tag ID&amp;#039;s for use in a function or loop.</item_desc>
117
  <item_type>tags</item_type>
118
  <item_options></item_options>
119
+ <item_sort>14</item_sort>
120
  </row>
121
  <row>
122
  <id>14</id>
125
  <item_desc>Choose from a list of posts and save as a single post ID for use in a function or loop.</item_desc>
126
  <item_type>post</item_type>
127
  <item_options></item_options>
128
+ <item_sort>15</item_sort>
129
  </row>
130
  <row>
131
  <id>15</id>
134
  <item_desc>Choose from a list of posts and save as multiple post ID&amp;#039;s for use in a function or loop.</item_desc>
135
  <item_type>posts</item_type>
136
  <item_options></item_options>
137
+ <item_sort>16</item_sort>
138
  </row>
139
  <row>
140
  <id>16</id>
143
  <item_desc>Choose from a list of pages and save as a single page ID for use in a function or loop.</item_desc>
144
  <item_type>page</item_type>
145
  <item_options></item_options>
146
+ <item_sort>17</item_sort>
147
  </row>
148
  <row>
149
  <id>17</id>
152
  <item_desc>Choose from a list of pages and save as multiple page ID&amp;#039;s for use in a function or loop.</item_desc>
153
  <item_type>pages</item_type>
154
  <item_options></item_options>
155
+ <item_sort>18</item_sort>
156
  </row>
157
  <row>
158
  <id>18</id>
161
  <item_desc>Choose from a list of any post type and save as a single ID for use in a function or loop.</item_desc>
162
  <item_type>custom_post</item_type>
163
  <item_options>attachment</item_options>
164
+ <item_sort>19</item_sort>
165
  </row>
166
  <row>
167
  <id>19</id>
170
  <item_desc>Choose from a list of any post type and save as multiple ID&amp;#039;s for use in a function or loop.</item_desc>
171
  <item_type>custom_posts</item_type>
172
  <item_options>attachment</item_options>
173
+ <item_sort>20</item_sort>
174
  </row>
175
+ </wp_4_option_tree>
assets/test/test-data.txt DELETED
@@ -1 +0,0 @@
1
- YToxMzp7czoxNToiZ2VuZXJhbF9kZWZhdWx0IjtzOjEyOiJUZXN0IE9wdGlvbnMiO3M6NToiaW5wdXQiO3M6MTQ6IlRoaXMgaXMgYSB0ZXMhIjtzOjg6ImNoZWNrYm94IjtzOjM6InllcyI7czo1OiJyYWRpbyI7czoyOiJubyI7czo2OiJzZWxlY3QiO3M6MDoiIjtzOjg6InRleHRhcmVhIjtzOjI1OiJKdXN0IHNvbWUgbW9yZSB0ZXN0IGRhdGEhIjtzOjY6InVwbG9hZCI7czowOiIiO3M6MTE6ImNvbG9ycGlja2VyIjtzOjA6IiI7czo4OiJjYXRlZ29yeSI7czowOiIiO3M6MzoidGFnIjtzOjA6IiI7czo0OiJwb3N0IjtzOjA6IiI7czo0OiJwYWdlIjtzOjA6IiI7czoxMToiY3VzdG9tX3Bvc3QiO3M6MDoiIjt9
 
classes/class.admin.php CHANGED
@@ -13,13 +13,20 @@ class OT_Admin
13
  private $version;
14
  private $option_array;
15
  private $ot_file;
 
 
16
  private $theme_options_xml;
17
- private $theme_options_txt;
 
18
  private $has_xml;
19
- private $has_txt;
 
 
20
 
21
  /**
22
  * PHP4 contructor
 
 
23
  */
24
  function OT_Admin()
25
  {
@@ -28,31 +35,46 @@ class OT_Admin
28
 
29
  /**
30
  * PHP5 contructor
 
 
31
  */
32
  function __construct()
33
  {
34
  global $table_prefix;
35
 
36
- $this->table_name = $table_prefix . 'option_tree';
37
  $this->version = OT_VERSION;
 
38
  $this->option_array = $this->option_tree_data();
39
 
40
  // file path & name without extention
41
- $this->ot_file = '/option-tree/theme-options';
 
 
42
 
43
  // XML file path
44
- $this->theme_options_xml = get_stylesheet_directory() . $this->ot_file.'.xml';
45
- if ( $this->theme_options_xml == '' ) // no file try parent theme
46
- $this->theme_options_xml = get_template_directory() . $this->ot_file.'.xml';
47
 
48
- // TXT file path
49
- $this->theme_options_txt = get_stylesheet_directory() . $this->ot_file.'.txt';
50
- if ( $this->theme_options_txt == '' ) // no file try parent theme
51
- $this->theme_options_xml = get_template_directory() . $this->ot_file.'.txt';
 
 
 
 
 
52
 
53
  // check for files
54
- $this->has_xml = ( is_readable( $this->theme_options_xml ) ) ? true : false;
55
- $this->has_txt = ( is_readable( $this->theme_options_txt ) ) ? true : false;
 
 
 
 
 
 
56
  }
57
 
58
  /**
@@ -76,25 +98,13 @@ class OT_Admin
76
 
77
  if ( $check != "set" )
78
  {
79
- // set blank option values
80
- foreach ( $this->option_array as $value )
81
- {
82
- $key = $value->item_id;
83
- $new_options[$key] = '';
84
- }
85
-
86
- // add theme options
87
- add_option( 'option_tree', $new_options );
88
  add_option( 'option_tree_activation', 'set');
89
 
90
  // load DB activation function if updating plugin
91
  $this->option_tree_activate();
92
 
93
- if ( $this->has_xml == true )
94
  {
95
- // load defaults from XML
96
- $this->option_tree_default_data(false);
97
-
98
  // Redirect
99
  wp_redirect( admin_url().'themes.php?page=option_tree' );
100
  }
@@ -167,13 +177,15 @@ class OT_Admin
167
  // run query
168
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
169
  dbDelta( $this->option_tree_table( 'create' ) );
 
 
 
 
170
  }
171
 
172
- // new install default data
173
  if ( $new_installation )
174
- {
175
- $this->option_tree_default_data(true);
176
- }
177
 
178
  // New Version Update
179
  if ( $installed_ver != $this->version )
@@ -204,23 +216,21 @@ class OT_Admin
204
  }
205
 
206
  /**
207
- * Plugin Activation Default Data
208
- *
209
- * @uses query()
210
- * @uses prepare()
211
  *
212
  * @access public
213
- * @since 1.0.0
214
  *
215
  * @return void
216
  */
217
- function option_tree_default_data($new = false)
218
  {
219
- global $wpdb;
220
-
221
- if ( $this->has_xml == true )
 
 
222
  {
223
- $rawdata = file_get_contents( $this->theme_options_xml );
224
  $new_options = new SimpleXMLElement( $rawdata );
225
 
226
  // drop table
@@ -241,39 +251,72 @@ class OT_Admin
241
  )
242
  );
243
  }
 
 
 
 
 
 
 
244
 
245
- // check for TXT file and is new install
246
- if ( $new && $this->has_txt == true )
247
  {
248
- $rawdata = file_get_contents( $this->theme_options_txt );
249
- $new_options = unserialize( base64_decode( $rawdata ) );
250
-
251
- // check if array()
252
- if ( is_array( $new_options ) )
253
- {
254
- // delete old options
255
- delete_option( 'option_tree' );
256
 
257
- // create new options
258
- add_option('option_tree', $new_options);
259
- }
 
 
 
 
 
 
 
 
260
  }
261
- return false;
262
  }
263
-
264
- // default data no XML file
265
- $wpdb->query( $wpdb->prepare( "
266
- INSERT INTO {$this->table_name}
267
- ( item_id, item_title, item_type )
268
- VALUES ( %s, %s, %s ) ",
269
- array('general_default','General','heading') ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
 
271
- $wpdb->query( $wpdb->prepare( "
272
- INSERT INTO {$this->table_name}
273
- ( item_id, item_title, item_type )
274
- VALUES ( %s, %s, %s ) ",
275
- array('test_input','Test Input','input') ) );
276
-
 
 
 
 
 
 
 
277
  }
278
 
279
  /**
@@ -303,7 +346,7 @@ class OT_Admin
303
  $this->option_tree_activate();
304
 
305
  // Redirect
306
- if ( is_readable( $this->theme_options_xml ) )
307
  {
308
  wp_redirect( admin_url().'themes.php?page=option_tree' );
309
  }
@@ -360,7 +403,7 @@ class OT_Admin
360
  $this->option_tree_import_xml();
361
 
362
  // if XML file came with the theme don't build the whole UI
363
- if ( $this->has_xml == true )
364
  {
365
  // create menu item
366
  $option_tree_options = add_submenu_page( 'themes.php', 'OptionTree Theme Options','Theme Options', 'activate_plugins', 'option_tree', array( $this, 'option_tree_options_page' ) );
@@ -374,10 +417,10 @@ class OT_Admin
374
  $icon = ( get_user_option( 'admin_color' ) == 'classic' ) ? OT_PLUGIN_URL.'/assets/images/icon_classic.png' : OT_PLUGIN_URL.'/assets/images/icon_dark.png';
375
 
376
  // create menu items
377
- add_object_page( 'OptionTree', 'OptionTree', 'level_7', 'option_tree', array( $this, 'option_tree_options_page' ), $icon);
378
- $option_tree_options = add_submenu_page( 'option_tree', 'OptionTree', 'Theme Options', 'level_7', 'option_tree', array( $this, 'option_tree_options_page' ) );
379
- $option_tree_docs = add_submenu_page( 'option_tree', 'OptionTree', 'Documentation', 'level_7', 'option_tree_docs', array( $this, 'option_tree_docs_page' ) );
380
- $option_tree_settings = add_submenu_page( 'option_tree', 'OptionTree', 'Settings', 'level_10', 'option_tree_settings', array( $this, 'option_tree_settings_page' ) );
381
 
382
  // add menu items
383
  add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
@@ -456,12 +499,18 @@ class OT_Admin
456
  */
457
  function option_tree_options_page()
458
  {
 
 
 
459
  // set
460
  $ot_array = $this->option_array;
461
 
462
  // load saved option_tree
463
  $settings = get_option( 'option_tree' );
464
 
 
 
 
465
  // private page ID
466
  $post_id = $this->get_option_page_ID( 'media' );
467
 
@@ -476,7 +525,7 @@ class OT_Admin
476
  }
477
 
478
  // Grab Options Page
479
- include( OT_PLUGIN_DIR.'/front-end/options.php' );
480
  }
481
 
482
  /**
@@ -495,11 +544,18 @@ class OT_Admin
495
  */
496
  function option_tree_settings_page()
497
  {
 
 
 
 
498
  $ot_array = $this->option_array;
499
 
500
  // Load Saved Options
501
  $settings = get_option('option_tree');
502
 
 
 
 
503
  // private page ID
504
  $post_id = $this->get_option_page_ID( 'options' );
505
 
@@ -514,7 +570,7 @@ class OT_Admin
514
  }
515
 
516
  // Get Settings Page
517
- include( OT_PLUGIN_DIR.'/front-end/settings.php');
518
  }
519
 
520
  /**
@@ -527,8 +583,11 @@ class OT_Admin
527
  */
528
  function option_tree_docs_page()
529
  {
 
 
 
530
  // Get Settings Page
531
- include( OT_PLUGIN_DIR.'/front-end/docs.php');
532
  }
533
 
534
  /**
@@ -562,10 +621,73 @@ class OT_Admin
562
 
563
  // Update Theme Options
564
  update_option( 'option_tree', $new_settings );
 
 
 
 
 
 
 
 
 
565
  $this->option_tree_set_post_lock( $this->get_option_page_ID( 'media' ) );
566
 
 
 
 
567
  die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  }
570
 
571
  /**
@@ -594,6 +716,13 @@ class OT_Admin
594
  // update theme Options
595
  update_option( 'option_tree', $new_options );
596
 
 
 
 
 
 
 
 
597
  die();
598
  }
599
 
@@ -610,7 +739,8 @@ class OT_Admin
610
  *
611
  * @return void
612
  */
613
- function option_tree_add() {
 
614
  global $wpdb;
615
 
616
  // check AJAX referer
@@ -637,7 +767,7 @@ class OT_Admin
637
  }
638
 
639
  // verify key is alphanumeric
640
- if ( eregi( '[^a-z0-9_]', $item_id ) )
641
  die("You must enter a valid option key.");
642
 
643
  // verify title
@@ -667,7 +797,7 @@ class OT_Admin
667
  AND item_title = '$item_title'
668
  AND item_type = '$item_type'
669
  AND item_options = '$item_options'
670
- ");
671
 
672
  // if updated
673
  if ( $updated )
@@ -693,7 +823,8 @@ class OT_Admin
693
  *
694
  * @return void
695
  */
696
- function option_tree_edit() {
 
697
  global $wpdb;
698
 
699
  // Check AJAX Referer
@@ -727,7 +858,7 @@ class OT_Admin
727
  }
728
 
729
  // verify key is alphanumeric
730
- if ( eregi( '[^a-z0-9_]', $item_id ) )
731
  die("You must enter a valid option key.");
732
 
733
  // verify title
@@ -838,7 +969,8 @@ class OT_Admin
838
  *
839
  * @return void
840
  */
841
- function option_tree_sort() {
 
842
  global $wpdb;
843
 
844
  // check AJAX referer
@@ -879,6 +1011,29 @@ class OT_Admin
879
  {
880
  global $wpdb;
881
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
882
  // action == upload
883
  if ( isset($_GET['action']) && $_GET['action'] == 'upload' )
884
  {
@@ -969,11 +1124,11 @@ class OT_Admin
969
  check_ajax_referer( '_import_data', '_ajax_nonce' );
970
 
971
  // Get Data
972
- $string = $_REQUEST['import_options'];
973
 
974
  // Unserialize The Array
975
  $new_options = unserialize( base64_decode( $string ) );
976
-
977
  // check if array()
978
  if ( is_array( $new_options ) )
979
  {
@@ -983,11 +1138,295 @@ class OT_Admin
983
  // create new options
984
  add_option('option_tree', $new_options);
985
 
 
 
 
 
 
 
 
 
 
 
986
  // redirect
987
  die();
988
  }
989
  // failed
990
- die(-1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  }
992
 
993
  function option_tree_add_slider()
@@ -1001,7 +1440,7 @@ class OT_Admin
1001
  'link' => '',
1002
  'description' => ''
1003
  );
1004
- slider_view( $id, $image, $count );
1005
  die();
1006
  }
1007
 
@@ -1021,7 +1460,7 @@ class OT_Admin
1021
  {
1022
  global $wpdb;
1023
 
1024
- return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '{$page_title}' AND post_type = 'option-tree' AND post_status != 'trash'");
1025
  }
1026
 
1027
  /**
13
  private $version;
14
  private $option_array;
15
  private $ot_file;
16
+ private $ot_data;
17
+ private $ot_layout;
18
  private $theme_options_xml;
19
+ private $theme_options_data;
20
+ private $theme_options_layout;
21
  private $has_xml;
22
+ private $has_data;
23
+ private $has_layout;
24
+ private $show_docs;
25
 
26
  /**
27
  * PHP4 contructor
28
+ *
29
+ * @since 1.1.6
30
  */
31
  function OT_Admin()
32
  {
35
 
36
  /**
37
  * PHP5 contructor
38
+ *
39
+ * @since 1.0.0
40
  */
41
  function __construct()
42
  {
43
  global $table_prefix;
44
 
 
45
  $this->version = OT_VERSION;
46
+ $this->table_name = $table_prefix . 'option_tree';
47
  $this->option_array = $this->option_tree_data();
48
 
49
  // file path & name without extention
50
+ $this->ot_file = '/option-tree/theme-options.xml';
51
+ $this->ot_data = '/option-tree/theme-options.txt';
52
+ $this->ot_layout = '/option-tree/layouts.txt';
53
 
54
  // XML file path
55
+ $this->theme_options_xml = get_stylesheet_directory() . $this->ot_file;
56
+ if ( !is_readable( $this->theme_options_xml ) ) // no file try parent theme
57
+ $this->theme_options_xml = get_template_directory() . $this->ot_file;
58
 
59
+ // Data file path
60
+ $this->theme_options_data = get_stylesheet_directory() . $this->ot_data;
61
+ if ( !is_readable( $this->theme_options_data ) ) // no file try parent theme
62
+ $this->theme_options_data = get_template_directory() . $this->ot_data;
63
+
64
+ // Layout file path
65
+ $this->theme_options_layout = get_stylesheet_directory() . $this->ot_layout;
66
+ if ( !is_readable( $this->theme_options_layout ) ) // no file try parent theme
67
+ $this->theme_options_layout = get_template_directory() . $this->ot_layout;
68
 
69
  // check for files
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
  /**
98
 
99
  if ( $check != "set" )
100
  {
 
 
 
 
 
 
 
 
 
101
  add_option( 'option_tree_activation', 'set');
102
 
103
  // load DB activation function if updating plugin
104
  $this->option_tree_activate();
105
 
106
+ if ( $this->has_xml == true && $this->show_docs == false )
107
  {
 
 
 
108
  // Redirect
109
  wp_redirect( admin_url().'themes.php?page=option_tree' );
110
  }
177
  // run query
178
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
179
  dbDelta( $this->option_tree_table( 'create' ) );
180
+
181
+ // has xml file load defaults
182
+ if ( $this->has_xml == true )
183
+ $this->option_tree_load_theme_files();
184
  }
185
 
186
+ // new install
187
  if ( $new_installation )
188
+ $this->option_tree_default_data();
 
 
189
 
190
  // New Version Update
191
  if ( $installed_ver != $this->version )
216
  }
217
 
218
  /**
219
+ * Load Default Data from theme included files
 
 
 
220
  *
221
  * @access public
222
+ * @since 1.1.7
223
  *
224
  * @return void
225
  */
226
+ function option_tree_load_theme_files()
227
  {
228
+ global $wpdb;
229
+
230
+ $rawdata = file_get_contents( $this->theme_options_xml );
231
+
232
+ if ( $rawdata )
233
  {
 
234
  $new_options = new SimpleXMLElement( $rawdata );
235
 
236
  // drop table
251
  )
252
  );
253
  }
254
+ }
255
+
256
+ // check for Data file and data not saved
257
+ if ( $this->has_data == true && !get_option( 'option_tree' ) )
258
+ {
259
+ $rawdata = file_get_contents( $this->theme_options_data );
260
+ $new_options = unserialize( base64_decode( $rawdata ) );
261
 
262
+ // check if array()
263
+ if ( is_array( $new_options ) )
264
  {
265
+ // create new options
266
+ add_option('option_tree', $new_options);
267
+ }
268
+ }
 
 
 
 
269
 
270
+ // check for Layout file and layouts not saved
271
+ if ( $this->has_layout == true && !get_option( 'option_tree_layouts' ) )
272
+ {
273
+ $rawdata = file_get_contents( $this->theme_options_layout );
274
+ $new_layouts = unserialize( base64_decode( $rawdata ) );
275
+
276
+ // check if array()
277
+ if ( is_array( $new_layouts ) )
278
+ {
279
+ // create new layouts
280
+ add_option('option_tree_layouts', $new_layouts);
281
  }
 
282
  }
283
+ }
284
+
285
+ /**
286
+ * Plugin Activation Default Data
287
+ *
288
+ * @uses query()
289
+ * @uses prepare()
290
+ *
291
+ * @access public
292
+ * @since 1.0.0
293
+ *
294
+ * @return void
295
+ */
296
+ function option_tree_default_data()
297
+ {
298
+ // load from files if they exist
299
+ if ( $this->has_xml == true )
300
+ {
301
+ $this->option_tree_load_theme_files();
302
+ }
303
+ else
304
+ {
305
+ global $wpdb;
306
 
307
+ // only run these queries if no xml file exist
308
+ $wpdb->query( $wpdb->prepare( "
309
+ INSERT INTO {$this->table_name}
310
+ ( item_id, item_title, item_type )
311
+ VALUES ( %s, %s, %s ) ",
312
+ array('general_default','General','heading') ) );
313
+
314
+ $wpdb->query( $wpdb->prepare( "
315
+ INSERT INTO {$this->table_name}
316
+ ( item_id, item_title, item_type )
317
+ VALUES ( %s, %s, %s ) ",
318
+ array('test_input','Test Input','input') ) );
319
+ }
320
  }
321
 
322
  /**
346
  $this->option_tree_activate();
347
 
348
  // Redirect
349
+ if ( $this->has_xml == true && $this->show_docs == false )
350
  {
351
  wp_redirect( admin_url().'themes.php?page=option_tree' );
352
  }
403
  $this->option_tree_import_xml();
404
 
405
  // if XML file came with the theme don't build the whole UI
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', 'activate_plugins', 'option_tree', array( $this, 'option_tree_options_page' ) );
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', 'manage_options', 'option_tree', array( $this, 'option_tree_options_page' ), $icon);
421
+ $option_tree_options = add_submenu_page( 'option_tree', 'OptionTree', 'Theme Options', 'manage_options', 'option_tree', array( $this, 'option_tree_options_page' ) );
422
+ $option_tree_docs = add_submenu_page( 'option_tree', 'OptionTree', 'Documentation', 'manage_options', 'option_tree_docs', array( $this, 'option_tree_docs_page' ) );
423
+ $option_tree_settings = add_submenu_page( 'option_tree', 'OptionTree', 'Settings', 'manage_options', 'option_tree_settings', array( $this, 'option_tree_settings_page' ) );
424
 
425
  // add menu items
426
  add_action( "admin_print_styles-$option_tree_options", array( $this, 'option_tree_load' ) );
499
  */
500
  function option_tree_options_page()
501
  {
502
+ // hook before page loads
503
+ do_action( 'option_tree_admin_header' );
504
+
505
  // set
506
  $ot_array = $this->option_array;
507
 
508
  // load saved option_tree
509
  $settings = get_option( 'option_tree' );
510
 
511
+ // Load Saved Layouts
512
+ $layouts = get_option('option_tree_layouts');
513
+
514
  // private page ID
515
  $post_id = $this->get_option_page_ID( 'media' );
516
 
525
  }
526
 
527
  // Grab Options Page
528
+ include( OT_PLUGIN_DIR. '/front-end/options.php' );
529
  }
530
 
531
  /**
544
  */
545
  function option_tree_settings_page()
546
  {
547
+ // hook before page loads
548
+ do_action( 'option_tree_admin_header' );
549
+
550
+ // set
551
  $ot_array = $this->option_array;
552
 
553
  // Load Saved Options
554
  $settings = get_option('option_tree');
555
 
556
+ // Load Saved Layouts
557
+ $layouts = get_option('option_tree_layouts');
558
+
559
  // private page ID
560
  $post_id = $this->get_option_page_ID( 'options' );
561
 
570
  }
571
 
572
  // Get Settings Page
573
+ include( OT_PLUGIN_DIR . '/front-end/settings.php' );
574
  }
575
 
576
  /**
583
  */
584
  function option_tree_docs_page()
585
  {
586
+ // hook before page loads
587
+ do_action( 'option_tree_admin_header' );
588
+
589
  // Get Settings Page
590
+ include( OT_PLUGIN_DIR . '/front-end/docs.php' );
591
  }
592
 
593
  /**
621
 
622
  // Update Theme Options
623
  update_option( 'option_tree', $new_settings );
624
+
625
+ // update active layout content
626
+ $options_layouts = get_option( 'option_tree_layouts' );
627
+ if ( isset( $options_layouts['active_layout'] ) ) {
628
+ $options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_settings ) );
629
+ update_option( 'option_tree_layouts', $options_layouts );
630
+ }
631
+
632
+ // lock post editing
633
  $this->option_tree_set_post_lock( $this->get_option_page_ID( 'media' ) );
634
 
635
+ // hook before AJAX is returned
636
+ do_action( 'option_tree_array_save' );
637
+
638
  die();
639
+ }
640
+
641
+ /**
642
+ * Update XML Theme Option via AJAX
643
+ *
644
+ * @uses check_ajax_referer()
645
+ * @uses update_option()
646
+ * @uses option_tree_set_post_lock()
647
+ * @uses get_option_page_ID()
648
+ *
649
+ * @access public
650
+ * @since 1.0.0
651
+ *
652
+ * @return void
653
+ */
654
+ function option_tree_array_reload()
655
+ {
656
+ // Check AJAX Referer
657
+ check_ajax_referer( '_theme_options', '_ajax_nonce' );
658
+
659
+ global $wpdb;
660
 
661
+ $rawdata = file_get_contents( $this->theme_options_xml );
662
+
663
+ if ( $rawdata )
664
+ {
665
+ $new_options = new SimpleXMLElement( $rawdata );
666
+
667
+ // drop table
668
+ $wpdb->query( "DROP TABLE $this->table_name" );
669
+
670
+ // create table
671
+ $wpdb->query( $this->option_tree_table( 'create' ) );
672
+
673
+ foreach ( $new_options->row as $value )
674
+ {
675
+ $wpdb->insert( $this->table_name,
676
+ array(
677
+ 'item_id' => $value->item_id,
678
+ 'item_title' => $value->item_title,
679
+ 'item_desc' => $value->item_desc,
680
+ 'item_type' => $value->item_type,
681
+ 'item_options' => $value->item_options
682
+ )
683
+ );
684
+ }
685
+ die('themes.php?page=option_tree&updated=true&cache=buster_'.mt_rand(5, 100));
686
+ }
687
+ else
688
+ {
689
+ die('-1');
690
+ }
691
  }
692
 
693
  /**
716
  // update theme Options
717
  update_option( 'option_tree', $new_options );
718
 
719
+ // update active layout content
720
+ $options_layouts = get_option( 'option_tree_layouts' );
721
+ if ( isset( $options_layouts['active_layout'] ) ) {
722
+ $options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_options ) );
723
+ update_option( 'option_tree_layouts', $options_layouts );
724
+ }
725
+
726
  die();
727
  }
728
 
739
  *
740
  * @return void
741
  */
742
+ function option_tree_add()
743
+ {
744
  global $wpdb;
745
 
746
  // check AJAX referer
767
  }
768
 
769
  // verify key is alphanumeric
770
+ if ( preg_match( '/[^a-z0-9_]/', $item_id ) )
771
  die("You must enter a valid option key.");
772
 
773
  // verify title
797
  AND item_title = '$item_title'
798
  AND item_type = '$item_type'
799
  AND item_options = '$item_options'
800
+ ");
801
 
802
  // if updated
803
  if ( $updated )
823
  *
824
  * @return void
825
  */
826
+ function option_tree_edit()
827
+ {
828
  global $wpdb;
829
 
830
  // Check AJAX Referer
858
  }
859
 
860
  // verify key is alphanumeric
861
+ if ( preg_match( '/[^a-z0-9_]/', $item_id ) )
862
  die("You must enter a valid option key.");
863
 
864
  // verify title
969
  *
970
  * @return void
971
  */
972
+ function option_tree_sort()
973
+ {
974
  global $wpdb;
975
 
976
  // check AJAX referer
1011
  {
1012
  global $wpdb;
1013
 
1014
+ // Check for multisite and add xml mime type if needed
1015
+ if ( is_multisite() )
1016
+ {
1017
+ $xml_ext = false;
1018
+
1019
+ // build ext array
1020
+ $site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );
1021
+
1022
+ // check for xml ext
1023
+ foreach ( $site_exts as $ext )
1024
+ {
1025
+ if ( $ext == 'xml' )
1026
+ $xml_ext = true;
1027
+ }
1028
+
1029
+ // add xml to mime types
1030
+ if ( $xml_ext == false )
1031
+ {
1032
+ $new_site_exts = implode( ' ', $site_exts );
1033
+ update_site_option( 'upload_filetypes', $new_site_exts.' xml' );
1034
+ }
1035
+ }
1036
+
1037
  // action == upload
1038
  if ( isset($_GET['action']) && $_GET['action'] == 'upload' )
1039
  {
1124
  check_ajax_referer( '_import_data', '_ajax_nonce' );
1125
 
1126
  // Get Data
1127
+ $string = $_REQUEST['import_options_data'];
1128
 
1129
  // Unserialize The Array
1130
  $new_options = unserialize( base64_decode( $string ) );
1131
+
1132
  // check if array()
1133
  if ( is_array( $new_options ) )
1134
  {
1138
  // create new options
1139
  add_option('option_tree', $new_options);
1140
 
1141
+ // update active layout content
1142
+ $options_layouts = get_option( 'option_tree_layouts' );
1143
+ if ( isset( $options_layouts['active_layout'] ) ) {
1144
+ $options_layouts[$options_layouts['active_layout']] = base64_encode( serialize( $new_options ) );
1145
+ update_option( 'option_tree_layouts', $options_layouts );
1146
+ }
1147
+
1148
+ // hook after import, before AJAX is returned
1149
+ do_action( 'option_tree_import_data' );
1150
+
1151
  // redirect
1152
  die();
1153
  }
1154
  // failed
1155
+ die('-1');
1156
+ }
1157
+
1158
+ /**
1159
+ * Update Layouts data via AJAX
1160
+ *
1161
+ * @uses check_ajax_referer()
1162
+ * @uses get_option()
1163
+ *
1164
+ * @access public
1165
+ * @since 1.1.7
1166
+ *
1167
+ * @return void
1168
+ */
1169
+ function option_tree_update_export_data()
1170
+ {
1171
+ global $wpdb;
1172
+
1173
+ // check AJAX referer
1174
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
1175
+
1176
+ $saved = $_REQUEST['saved'];
1177
+ $updated = base64_encode( serialize( get_option( 'option_tree' ) ) );
1178
+
1179
+ // check if array()
1180
+ if ( $saved != $updated )
1181
+ {
1182
+ die($updated);
1183
+ }
1184
+ // failed
1185
+ die('-1');
1186
+ }
1187
+
1188
+ /**
1189
+ * Save Layout via AJAX
1190
+ *
1191
+ * @uses check_ajax_referer()
1192
+ * @uses get_option()
1193
+ * @uses update_option()
1194
+ * @uses add_option()
1195
+ *
1196
+ * @access public
1197
+ * @since 1.1.7
1198
+ *
1199
+ * @return void
1200
+ */
1201
+ function option_tree_save_layout()
1202
+ {
1203
+ global $wpdb;
1204
+
1205
+ // check AJAX referer
1206
+ check_ajax_referer( '_save_layout', '_ajax_nonce' );
1207
+
1208
+ // Get Data
1209
+ $string = $_REQUEST['options_name'];
1210
+
1211
+ // set default layout name
1212
+ if ( !$string )
1213
+ $string = 'default';
1214
+
1215
+ // replace whitespace and set to lower case
1216
+ $string = str_replace(' ', '-', strtolower( $string ) );
1217
+
1218
+ // get options and encode
1219
+ $options = get_option( 'option_tree' );
1220
+ $options = base64_encode( serialize( $options ) );
1221
+
1222
+ // get saved layouts
1223
+ $options_layouts = get_option( 'option_tree_layouts' );
1224
+
1225
+ if ( is_array( $options_layouts ) )
1226
+ {
1227
+ $options_layouts['active_layout'] = $string;
1228
+ $options_layouts[$string] = $options;
1229
+ update_option( 'option_tree_layouts', $options_layouts );
1230
+ }
1231
+ else
1232
+ {
1233
+ delete_option( 'option_tree_layouts' );
1234
+ add_option( 'option_tree_layouts', array( 'active_layout' => $string, $string => $options ) );
1235
+ }
1236
+
1237
+ // hook after save, before AJAX is returned
1238
+ do_action( 'option_tree_save_layout' );
1239
+
1240
+ die( $options );
1241
+ }
1242
+
1243
+ /**
1244
+ * Delete Layout via AJAX
1245
+ *
1246
+ * @uses check_ajax_referer()
1247
+ * @uses get_option()
1248
+ * @uses update_option()
1249
+ * @uses add_option()
1250
+ *
1251
+ * @access public
1252
+ * @since 1.1.7
1253
+ *
1254
+ * @return void
1255
+ */
1256
+ function option_tree_delete_layout()
1257
+ {
1258
+ global $wpdb;
1259
+
1260
+ // check AJAX referer
1261
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
1262
+
1263
+ // grab ID
1264
+ $id = $_REQUEST['id'];
1265
+
1266
+ $options_layouts = get_option( 'option_tree_layouts' );
1267
+
1268
+ // remove the item
1269
+ unset( $options_layouts[$id] );
1270
+
1271
+ // check active layout and unset if deleted
1272
+ if ( $options_layouts['active_layout'] == $id )
1273
+ {
1274
+ unset( $options_layouts['active_layout'] );
1275
+ }
1276
+
1277
+ update_option( 'option_tree_layouts', $options_layouts );
1278
+
1279
+ // hook after delete, before AJAX is returned
1280
+ do_action( 'option_tree_delete_layout' );
1281
+
1282
+ die( 'removed' );
1283
+ }
1284
+
1285
+ /**
1286
+ * Activate Layout via AJAX
1287
+ *
1288
+ * @uses check_ajax_referer()
1289
+ * @uses get_option()
1290
+ * @uses update_option()
1291
+ * @uses add_option()
1292
+ *
1293
+ * @access public
1294
+ * @since 1.1.7
1295
+ *
1296
+ * @return void
1297
+ */
1298
+ function option_tree_activate_layout()
1299
+ {
1300
+ global $wpdb;
1301
+
1302
+ if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
1303
+ {
1304
+ // Check AJAX Referer
1305
+ check_ajax_referer( '_theme_options', '_ajax_nonce' );
1306
+ }
1307
+ else
1308
+ {
1309
+ // check AJAX referer
1310
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
1311
+ }
1312
+
1313
+ // grab ID
1314
+ $id = $_REQUEST['id'];
1315
+
1316
+ // Get Saved Options
1317
+ $options_layouts = get_option('option_tree_layouts');
1318
+
1319
+ // Unserialize The Array
1320
+ $new_options = unserialize( base64_decode( $options_layouts[$id] ) );
1321
+
1322
+ // check if array()
1323
+ if ( is_array( $new_options ) )
1324
+ {
1325
+ // delete old options
1326
+ delete_option( 'option_tree' );
1327
+
1328
+ // set active layout
1329
+ $options_layouts['active_layout'] = $id;
1330
+ update_option('option_tree_layouts', $options_layouts);
1331
+
1332
+ // create new options
1333
+ add_option( 'option_tree', $new_options );
1334
+
1335
+ // hook after activate, before AJAX is returned
1336
+ do_action( 'option_tree_activate_layout' );
1337
+
1338
+ // redirect
1339
+ if ( $this->has_xml == true && $this->show_docs == false )
1340
+ {
1341
+ die('themes.php?page=option_tree&layout=true');
1342
+ }
1343
+ else if ( isset($_REQUEST['themes']) && $_REQUEST['themes'] == true )
1344
+ {
1345
+ die('admin.php?page=option_tree&layout=true');
1346
+ }
1347
+ else
1348
+ {
1349
+ die('activated');
1350
+ }
1351
+
1352
+ }
1353
+
1354
+ // failed
1355
+ die('-1');
1356
+ }
1357
+
1358
+ /**
1359
+ * Import Layouts via AJAX
1360
+ *
1361
+ * @uses check_ajax_referer()
1362
+ * @uses delete_option()
1363
+ * @uses add_option()
1364
+ *
1365
+ * @access public
1366
+ * @since 1.1.7
1367
+ *
1368
+ * @return void
1369
+ */
1370
+ function option_tree_import_layout()
1371
+ {
1372
+ global $wpdb;
1373
+
1374
+ // check AJAX referer
1375
+ check_ajax_referer( '_import_layout', '_ajax_nonce' );
1376
+
1377
+ // Get Data
1378
+ $string = $_REQUEST['import_option_layouts'];
1379
+
1380
+ // Unserialize The Array
1381
+ $new_options = unserialize( base64_decode( $string ) );
1382
+
1383
+ // check if array()
1384
+ if ( is_array( $new_options ) )
1385
+ {
1386
+ // delete old layouts
1387
+ delete_option( 'option_tree_layouts' );
1388
+
1389
+ // create new layouts
1390
+ add_option('option_tree_layouts', $new_options);
1391
+
1392
+ // hook after import, before redirect
1393
+ do_action( 'option_tree_import_layout' );
1394
+
1395
+ // redirect
1396
+ die('admin.php?page=option_tree_settings&layout=true&cache=buster_'.mt_rand(5, 100).'#layout_options');
1397
+ }
1398
+ // failed
1399
+ die('-1');
1400
+ }
1401
+
1402
+ /**
1403
+ * Update Layouts data via AJAX
1404
+ *
1405
+ * @uses check_ajax_referer()
1406
+ * @uses get_option()
1407
+ *
1408
+ * @access public
1409
+ * @since 1.1.7
1410
+ *
1411
+ * @return void
1412
+ */
1413
+ function option_tree_update_export_layout()
1414
+ {
1415
+ global $wpdb;
1416
+
1417
+ // check AJAX referer
1418
+ check_ajax_referer( 'inlineeditnonce', '_ajax_nonce' );
1419
+
1420
+ $saved = $_REQUEST['saved'];
1421
+ $updated = base64_encode( serialize( get_option( 'option_tree_layouts' ) ) );
1422
+
1423
+ // check if array()
1424
+ if ( $saved != $updated )
1425
+ {
1426
+ die($updated);
1427
+ }
1428
+ // failed
1429
+ die('-1');
1430
  }
1431
 
1432
  function option_tree_add_slider()
1440
  'link' => '',
1441
  'description' => ''
1442
  );
1443
+ option_tree_slider_view( $id, $image, $this->get_option_page_ID('media'), $count );
1444
  die();
1445
  }
1446
 
1460
  {
1461
  global $wpdb;
1462
 
1463
+ return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE `post_name` = '{$page_title}' AND `post_type` = 'option-tree' AND `post_status` = 'private'");
1464
  }
1465
 
1466
  /**
front-end/docs.php CHANGED
@@ -21,6 +21,7 @@
21
  <li><a href="#general">Usage &amp; Examples</a><span></span></li>
22
  <li><a href="#option_types">Option Types</a><span></span></li>
23
  <li><a href="#settings">Creating Options</a><span></span></li>
 
24
  <li><a href="#integration">Theme Integration</a><span></span></li>
25
  </ul>
26
 
@@ -453,6 +454,88 @@ function new_slider_fields($array)
453
 
454
  </div>
455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  <div id="integration" class="block">
457
  <h2>Theme Integration</h2>
458
  <h3>Overview on how Theme Integration works.</h3>
@@ -471,16 +554,17 @@ function new_slider_fields($array)
471
  <span style="color:red;">Follow these instructions.</span>
472
  </p>
473
  <ul class="doc_list">
474
- <li>Export your <a href="http://localhost/framework/wp-admin/admin.php?page=option_tree_settings#export_options">Theme Options XML</a> file and save it somewhere you can get to it and once it's saved, rename it to '<strong>theme-options.xml</strong>'.</li>
475
- <li>Copy the <a href="http://localhost/framework/wp-admin/admin.php?page=option_tree_settings#export_options">Theme Options Data</a> string to a new .txt file and name it '<strong>theme-options.txt</strong>' and save it where you can get to it.</li>
 
476
  <li>Create a new directory in the root of your themes directory and name it '<strong>option-tree</strong>'.</li>
477
- <li>Move your '<strong>theme-options.xml</strong>' and '<strong>theme-options.txt</strong>' into the '<strong>option-tree</strong>' directory and when the plugin is activated it will populate the defaults from those files.</li>
478
  </ul>
479
 
480
  <p>
481
- <span style="color:red;">NOTE</span>: the .txt file is optional and will only be used to populate the data on activation.<br />
482
  <span style="color:red;">NOTE</span>: The file names are important, so be sure you have named them correctly.<br />
483
- <span style="color:red;">NOTE</span>: If the theme options are not creating properly or you can still see the OptionTree menu the .xml file is not readable to the server or you have the files in the wrong place.<br />
484
  <span style="color:red;">NOTE</span>: The plugin looks for the '<strong>option-tree</strong>' directory in the child themes root directory first, then the parent if you use a child/parent theme relationship.
485
  </p>
486
 
21
  <li><a href="#general">Usage &amp; Examples</a><span></span></li>
22
  <li><a href="#option_types">Option Types</a><span></span></li>
23
  <li><a href="#settings">Creating Options</a><span></span></li>
24
+ <li><a href="#layouts">Adding Layouts</a><span></span></li>
25
  <li><a href="#integration">Theme Integration</a><span></span></li>
26
  </ul>
27
 
454
 
455
  </div>
456
 
457
+ <div id="layouts" class="block">
458
+ <h2>Adding Layouts</h2>
459
+ <h3>Overview on how Layouts work.</h3>
460
+
461
+ <p>
462
+ <strong>It's Super Simple</strong>:<br />
463
+ Layouts make your theme awesome! Package them with different theme variations, with very little effort. I made adding a layout ridiculously easy, just follow these steps and youl'll be on your way to having a WordPress super theme.
464
+ </p>
465
+
466
+ <h3>For Developers</h3>
467
+
468
+ <p style="padding-bottom:5px">
469
+ <strong>Creating a Layout</strong>:<br />
470
+ </p>
471
+ <ul class="doc_list">
472
+ <li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
473
+ <li>Enter a name for your layout in the text field and hit "Save Layout", you've created your first layout.</li>
474
+ <li>Adding new layout is as easy as repeating the steps above.</li>
475
+ </ul>
476
+
477
+ <p style="padding-bottom:5px">
478
+ <strong>Activating a Layout</strong>:<br />
479
+ </p>
480
+ <ul class="doc_list">
481
+ <li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
482
+ <li>Click on the activate layout button in the actions list.</li>
483
+ </ul>
484
+
485
+ <p style="padding-bottom:5px">
486
+ <strong>Deleting a Layout</strong>:<br />
487
+ </p>
488
+ <ul class="doc_list">
489
+ <li>Go to the <a href="admin.php?page=option_tree_settings#layout_options">Layouts</a> page.</li>
490
+ <li>Click on the delete layout button in the actions list.</li>
491
+ </ul>
492
+
493
+ <p style="padding-bottom:5px">
494
+ <strong>Editing the data of a Layout</strong>:<br />
495
+ </p>
496
+ <ul class="doc_list">
497
+ <li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
498
+ <li>Modify and save your theme options and the layout will be updated automatically.</li>
499
+ <li><span style="color:red;">NOTE:</span> Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.</li>
500
+ <li>If you want to edit a new layout, first create it then save your theme options.</li>
501
+ </ul>
502
+
503
+ <h3>End-Users Mode</h3>
504
+
505
+ <p style="padding-bottom:5px">
506
+ <strong>Creating a Layout</strong>:<br />
507
+ </p>
508
+ <ul class="doc_list">
509
+ <li>End-Users mode does not allow creating new layouts.</li>
510
+ </ul>
511
+
512
+ <p style="padding-bottom:5px">
513
+ <strong>Activating a Layout</strong>:<br />
514
+ </p>
515
+ <ul class="doc_list">
516
+ <li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
517
+ <li>Choose a layout from the select list and click the "Activate Layout" button.</li>
518
+ </ul>
519
+
520
+ <p style="padding-bottom:5px">
521
+ <strong>Deleting a Layout</strong>:<br />
522
+ </p>
523
+ <ul class="doc_list">
524
+ <li>End-Users mode does not allow deleting layouts.</li>
525
+ </ul>
526
+
527
+ <p style="padding-bottom:5px">
528
+ <strong>Editing the data of a Layout</strong>:<br />
529
+ </p>
530
+ <ul class="doc_list">
531
+ <li>Go to the <a href="admin.php?page=option_tree">Theme Options</a> page.</li>
532
+ <li>Modify and save your theme options and the layout will be updated automatically.</li>
533
+ <li><span style="color:red;">NOTE:</span> Saving theme options data will update the currently active layout, so before you start saving make sure you want to modify the current layout.</li>
534
+ </ul>
535
+
536
+
537
+ </div>
538
+
539
  <div id="integration" class="block">
540
  <h2>Theme Integration</h2>
541
  <h3>Overview on how Theme Integration works.</h3>
554
  <span style="color:red;">Follow these instructions.</span>
555
  </p>
556
  <ul class="doc_list">
557
+ <li>Export your <a href="admin.php?page=option_tree_settings#export_options">Theme Options XML</a> file and save it somewhere you can get to it and once it's saved, rename it to '<strong>theme-options.xml</strong>'.</li>
558
+ <li>Copy the <a href="admin.php?page=option_tree_settings#export_options">Theme Options Data</a> string to a new .txt file and name it '<strong>theme-options.txt</strong>' and save it where you can get to it.</li>
559
+ <li>Copy the <a href="admin.php?page=option_tree_settings#export_options">Layouts</a> string to a new .txt file and name it '<strong>layouts.txt</strong>' and save it where you can get to it.</li>
560
  <li>Create a new directory in the root of your themes directory and name it '<strong>option-tree</strong>'.</li>
561
+ <li>Move your '<strong>layouts.txt</strong>', '<strong>theme-options.txt</strong>', and '<strong>theme-options.xml</strong>' into the '<strong>option-tree</strong>' directory and when the plugin is activated it will populate the defaults from those files.</li>
562
  </ul>
563
 
564
  <p>
565
+ <span style="color:red;">NOTE</span>: the .txt filee are optional and will only be used to populate the data on activation.<br />
566
  <span style="color:red;">NOTE</span>: The file names are important, so be sure you have named them correctly.<br />
567
+ <span style="color:red;">NOTE</span>: If the theme options are not created properly or you can still see the OptionTree menu the .xml file is not readable to the server or you have the files in the wrong place.<br />
568
  <span style="color:red;">NOTE</span>: The plugin looks for the '<strong>option-tree</strong>' directory in the child themes root directory first, then the parent if you use a child/parent theme relationship.
569
  </p>
570
 
front-end/options.php CHANGED
@@ -9,21 +9,51 @@
9
  <?php echo OT_VERSION; ?>
10
  </div>
11
  </div>
12
-
13
  <div id="content_wrap">
14
 
15
  <form method="post" id="the-theme-options">
16
 
17
  <div class="info top-info">
18
-
19
- <input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  </div>
22
 
23
- <div class="ajax-message<?php if ( isset( $message ) ) { echo ' show'; } ?>">
24
-
 
25
  <?php if ( isset( $message ) ) { echo $message; } ?>
26
-
27
  </div>
28
 
29
  <div id="content">
@@ -49,7 +79,7 @@
49
  foreach ( $ot_array as $value )
50
  {
51
  $count++;
52
- if ( $value->item_type == 'upload' )
53
  {
54
  $int = $post_id;
55
  }
9
  <?php echo OT_VERSION; ?>
10
  </div>
11
  </div>
12
+
13
  <div id="content_wrap">
14
 
15
  <form method="post" id="the-theme-options">
16
 
17
  <div class="info top-info">
18
+
19
+ <input type="submit" value="<?php _e('Save All Changes') ?>" class="button-framework save-options" name="submit" />
20
+
21
+ <?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
+ $active_layout = $layouts['active_layout'];
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
+ echo '<option'.$selected.'>'.trim( $key ).'</option>';
42
+ }
43
+ echo '</select>';
44
+ ?>
45
+ <input type="submit" value="<?php _e('Activate Layout') ?>" class="button-framework user-activate-layout" name="user-activate-layout" style="margin-right:10px;" />
46
+ <?php
47
+ echo '</div>';
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>&nbsp;</span>Theme Options were updated.</div>'; } ?>
55
+ <?php if (isset($_GET['layout'])) { echo '<div class="message"><span>&nbsp;</span>Your Layout has been activated.</div>'; } ?>
56
  <?php if ( isset( $message ) ) { echo $message; } ?>
 
57
  </div>
58
 
59
  <div id="content">
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
  }
front-end/settings.php CHANGED
@@ -15,11 +15,12 @@
15
  <div class="info top-info">
16
  </div>
17
 
18
- <div class="ajax-message<?php if ( isset($_GET['xml']) || isset($_GET['error']) || isset($_GET['nofile']) || isset($_GET['empty']) || isset( $message ) ) { echo ' show'; } ?>">
19
  <?php if(isset($_GET['xml'])) { echo '<div class="message"><span>&nbsp;</span>Theme Options Created</div>'; } ?>
20
  <?php if(isset($_GET['error'])) { echo '<div class="message warning"><span>&nbsp;</span>Wrong File Type!</div>'; } ?>
21
  <?php if(isset($_GET['nofile'])) { echo '<div class="message warning"><span>&nbsp;</span>Please add a file.</div>'; } ?>
22
  <?php if(isset($_GET['empty'])) { echo '<div class="message warning"><span>&nbsp;</span>An error occurred while importing your data.</div>'; } ?>
 
23
  <?php if ( isset( $message ) ) { echo $message; } ?>
24
  </div>
25
 
@@ -29,6 +30,7 @@
29
  <li><a href="#tree_settings">Create</a><span></span></li>
30
  <li><a href="#import_options">Import</a><span></span></li>
31
  <li><a href="#export_options">Export</a><span></span></li>
 
32
  </ul>
33
 
34
  <div id="tree_settings" class="block has-table">
@@ -216,7 +218,7 @@
216
  <h3>Theme Options Data</h3>
217
  <div class="section">
218
  <div class="element">
219
- <textarea name="import_options" rows="8" id="import_options" class="import_options"></textarea>
220
  </div>
221
  <div class="description">
222
  <p>Only after you've imported the Theme Options XML file should you try and update your Theme Options Data.</p>
@@ -228,6 +230,23 @@
228
  <?php wp_nonce_field( '_import_data', '_ajax_nonce', false ); ?>
229
  </form>
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  </div>
232
 
233
  <div id="export_options" class="block">
@@ -245,13 +264,90 @@
245
  <h3>Theme Options Data</h3>
246
  <div class="section">
247
  <div class="element">
248
- <textarea name="export_options" rows="8"><?php echo base64_encode(serialize($settings)); ?></textarea>
249
  </div>
250
  <div class="description">
251
  Export your saved Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> on another web site.
252
  </div>
253
  </div>
254
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  </div>
256
 
257
  <br class="clear" />
15
  <div class="info top-info">
16
  </div>
17
 
18
+ <div class="ajax-message<?php if ( isset($_GET['xml']) || isset($_GET['error']) || isset($_GET['nofile']) || isset($_GET['empty']) || isset($_GET['layout']) || isset( $message ) ) { echo ' show'; } ?>">
19
  <?php if(isset($_GET['xml'])) { echo '<div class="message"><span>&nbsp;</span>Theme Options Created</div>'; } ?>
20
  <?php if(isset($_GET['error'])) { echo '<div class="message warning"><span>&nbsp;</span>Wrong File Type!</div>'; } ?>
21
  <?php if(isset($_GET['nofile'])) { echo '<div class="message warning"><span>&nbsp;</span>Please add a file.</div>'; } ?>
22
  <?php if(isset($_GET['empty'])) { echo '<div class="message warning"><span>&nbsp;</span>An error occurred while importing your data.</div>'; } ?>
23
+ <?php if(isset($_GET['layout'])) { echo '<div class="message"><span>&nbsp;</span>Your Layouts were successfully imported.</div>'; } ?>
24
  <?php if ( isset( $message ) ) { echo $message; } ?>
25
  </div>
26
 
30
  <li><a href="#tree_settings">Create</a><span></span></li>
31
  <li><a href="#import_options">Import</a><span></span></li>
32
  <li><a href="#export_options">Export</a><span></span></li>
33
+ <li><a href="#layout_options">Layouts</a><span></span></li>
34
  </ul>
35
 
36
  <div id="tree_settings" class="block has-table">
218
  <h3>Theme Options Data</h3>
219
  <div class="section">
220
  <div class="element">
221
+ <textarea name="import_options_data" rows="8" id="import_options_data" class="import_options_data"></textarea>
222
  </div>
223
  <div class="description">
224
  <p>Only after you've imported the Theme Options XML file should you try and update your Theme Options Data.</p>
230
  <?php wp_nonce_field( '_import_data', '_ajax_nonce', false ); ?>
231
  </form>
232
 
233
+ <form method="post" id="import-layout">
234
+ <div class="option option-input">
235
+ <h3>Layouts</h3>
236
+ <div class="section">
237
+ <div class="element">
238
+ <textarea name="import_option_layouts" rows="8" id="import_option_layouts" class="import_option_layouts"></textarea>
239
+ </div>
240
+ <div class="description">
241
+ <p>Only after you've imported the Theme Options XML file should you try and update your Layouts.</p>
242
+ <p>To import the values of your layouts copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Layouts" button below.</p>
243
+ </div>
244
+ </div>
245
+ <input type="submit" value="<?php _e('Import Layouts') ?>" class="ob_button right import-layout" />
246
+ </div>
247
+ <?php wp_nonce_field( '_import_layout', '_ajax_nonce', false ); ?>
248
+ </form>
249
+
250
  </div>
251
 
252
  <div id="export_options" class="block">
264
  <h3>Theme Options Data</h3>
265
  <div class="section">
266
  <div class="element">
267
+ <textarea name="export_data" id="export_data" rows="8"><?php echo base64_encode(serialize($settings)); ?></textarea>
268
  </div>
269
  <div class="description">
270
  Export your saved Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> on another web site.
271
  </div>
272
  </div>
273
  </div>
274
+ <div class="option option-input">
275
+ <h3>Layouts</h3>
276
+ <div class="section">
277
+ <div class="element">
278
+ <textarea name="export_layouts" id="export_layouts" rows="8"><?php echo base64_encode(serialize($layouts)); ?></textarea>
279
+ </div>
280
+ <div class="description">
281
+ Export your saved Layouts by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> on another web site.
282
+ </div>
283
+ </div>
284
+ </div>
285
+ </div>
286
+
287
+ <div id="layout_options" class="block">
288
+ <h2>Layouts</h2>
289
+ <div class="option option-input">
290
+ <h3>What's a layout?</h3>
291
+ <p>It's a variation of your theme options data that you can save and import/export. Basically, you save your data as layouts you can activate later, or save them as a text file for use in a clients theme. Simply enter a name and hit "Save Layout", then you can edit your theme options so everything is setup correctly for your new layout. It's important you save layouts before you save the options because you're editing the active layout.</p>
292
+ <p>Once you have created all your different layouts, or theme variations, you can save them to a separate text file for repackaging with your theme. Alternatively, you could just make different variations for yourself and change your theme with the click of a button, all without deleting your previous options data.</p>
293
+ <h3>Save your Layouts</h3>
294
+ <div class="section">
295
+ <div class="element">
296
+ <form method="post" id="save-layout">
297
+ <input type="options_name" name="options_name" value="" class="input_layout" />
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>
301
+ </div>
302
+ <div class="description">
303
+ Use a simple naming structure for new layouts (no special characters).
304
+ </div>
305
+ <div style="clear:both; padding-top:20px;" class="has-table">
306
+ <table cellspacing="0" id="saved-options">
307
+ <thead>
308
+ <tr>
309
+ <th class="col-title">Name</th>
310
+ <th class="col-key">Theme Options Data (Copy & Save)</th>
311
+ <th class="col-edit" style="padding-left:10px !important; width: 55px;">Action</th>
312
+ </tr>
313
+ </thead>
314
+ <tfoot>
315
+ <tr>
316
+ <th class="col-title">Name</th>
317
+ <th class="col-key">Theme Options Data (Copy & Save)</th>
318
+ <th class="col-edit" style="padding-left:10px !important; width: 55px;">Action</th>
319
+ </tr>
320
+ </tfoot>
321
+ <tbody id="layout-settings">
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;
329
+ ?>
330
+ <tr id="saved-<?php echo $key; ?>"<?php echo ( $key == $active_layout ) ? ' class="active-layout"' : ''; ?>>
331
+ <td class="col-title"><?php echo $key; ?></td>
332
+ <td class="col-key>"><?php echo '<textarea>'. $values.'</textarea>'; ?></td>
333
+ <td class="col-edit" style="padding-left:10px !important; width: 55px;">
334
+ <a href="#" class="activate-saved" title="Activate">Activate</a>
335
+ <a href="#" class="delete-saved" title="Delete">Delete</a>
336
+ </td>
337
+ </tr>
338
+ <?php
339
+ }
340
+ }
341
+ else
342
+ {
343
+ echo '<tr class="empty-layouts"><td colspan="3">No Saved Layouts.</td></tr>';
344
+ }
345
+ ?>
346
+ </tbody>
347
+ </table>
348
+ </div>
349
+ </div>
350
+ </div>
351
  </div>
352
 
353
  <br class="clear" />
functions/admin/slider.php CHANGED
@@ -23,8 +23,8 @@ function option_tree_slider( $value, $settings, $int )
23
  <?php
24
  if ( !empty( $settings[$value->item_id] ) ) {
25
  foreach( $settings[$value->item_id] as $image ) { ?>
26
- <li><?php slider_view( $value->item_id, $image, $count ); ?></li><?php
27
- $count++;
28
  }
29
  }
30
  ?>
@@ -51,7 +51,7 @@ function option_tree_slider( $value, $settings, $int )
51
  *
52
  * @return string
53
  */
54
- function slider_view( $id, $image, $count )
55
  {
56
  // required fileds
57
  $requred_fields = array(
@@ -106,7 +106,29 @@ function slider_view( $id, $image, $count )
106
  <div class="option-tree-slider-body">
107
  <?php
108
  foreach( $image_slider_fields as $field ) {
109
- if ( $field['type'] == 'text' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  echo '
111
  <p>
112
  <label>'.$field['label'].'</label>
23
  <?php
24
  if ( !empty( $settings[$value->item_id] ) ) {
25
  foreach( $settings[$value->item_id] as $image ) { ?>
26
+ <li><?php option_tree_slider_view( $value->item_id, $image, $int, $count ); ?></li><?php
27
+ $count++;
28
  }
29
  }
30
  ?>
51
  *
52
  * @return string
53
  */
54
+ function option_tree_slider_view( $id, $image, $int, $count )
55
  {
56
  // required fileds
57
  $requred_fields = array(
106
  <div class="option-tree-slider-body">
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'; } ?>"/>
114
+ <input id="upload_<?php echo $id ?>-<?php echo $count ?>-<?php echo $field['name'] ?>" class="upload_button" type="button" value="Upload" rel="<?php echo $int; ?>" />
115
+ <div class="screenshot" id="<?php echo $id ?>-<?php echo $count ?>-<?php echo $field['name'] ?>_image">
116
+ <?php
117
+ if ( isset( $image[$field['name']] ) && $image[$field['name']] != '' )
118
+ {
119
+ $remove = '<a href="javascript:(void);" class="remove">Remove</a>';
120
+ $screenshot_image = $image[$field['name']];
121
+ $new_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $image[$field['name']] );
122
+ if ( $new_image )
123
+ {
124
+ echo '<img src="'.$screenshot_image.'" alt="" />'.$remove.'';
125
+ }
126
+ }
127
+ ?>
128
+ </div>
129
+ </div>
130
+ <?php
131
+ } else if ( $field['type'] == 'text' ) {
132
  echo '
133
  <p>
134
  <label>'.$field['label'].'</label>
functions/functions.load.php CHANGED
@@ -7,27 +7,27 @@
7
  * @since 1.0.0
8
  * @author Derek Herman
9
  */
10
- if ( is_admin() )
11
  {
12
- include( 'admin/export.php' );
13
- include( 'admin/heading.php' );
14
- include( 'admin/input.php' );
15
- include( 'admin/checkbox.php' );
16
- include( 'admin/radio.php' );
17
- include( 'admin/select.php' );
18
- include( 'admin/textarea.php' );
19
- include( 'admin/upload.php' );
20
- include( 'admin/colorpicker.php' );
21
- include( 'admin/textblock.php' );
22
- include( 'admin/post.php' );
23
- include( 'admin/page.php' );
24
- include( 'admin/category.php' );
25
- include( 'admin/tag.php' );
26
- include( 'admin/custom-post.php' );
27
- include( 'admin/measurement.php' );
28
- include( 'admin/slider.php' );
29
  }
30
  else if ( !is_admin() )
31
  {
32
- include( 'get-option-tree.php' );
33
  }
7
  * @since 1.0.0
8
  * @author Derek Herman
9
  */
10
+ if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'option_tree' )
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' );
15
+ include( OT_PLUGIN_DIR . '/functions/admin/checkbox.php' );
16
+ include( OT_PLUGIN_DIR . '/functions/admin/radio.php' );
17
+ include( OT_PLUGIN_DIR . '/functions/admin/select.php' );
18
+ include( OT_PLUGIN_DIR . '/functions/admin/textarea.php' );
19
+ include( OT_PLUGIN_DIR . '/functions/admin/upload.php' );
20
+ include( OT_PLUGIN_DIR . '/functions/admin/colorpicker.php' );
21
+ include( OT_PLUGIN_DIR . '/functions/admin/textblock.php' );
22
+ include( OT_PLUGIN_DIR . '/functions/admin/post.php' );
23
+ include( OT_PLUGIN_DIR . '/functions/admin/page.php' );
24
+ include( OT_PLUGIN_DIR . '/functions/admin/category.php' );
25
+ include( OT_PLUGIN_DIR . '/functions/admin/tag.php' );
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
  else if ( !is_admin() )
31
  {
32
+ include( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );
33
  }
index.php CHANGED
@@ -3,9 +3,10 @@
3
  Plugin Name: OptionTree
4
  Plugin URI: http://wp.envato.com
5
  Description: Customizable WordPress Theme Options Admin Interface
6
- Version: 1.1.6
7
  Author: Derek Herman
8
  Author URI: http://valendesigns.com
 
9
  */
10
 
11
  /**
@@ -13,7 +14,7 @@ Author URI: http://valendesigns.com
13
  *
14
  * @since 1.0.0
15
  */
16
- define( 'OT_VERSION', '1.1.6' );
17
  define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
18
  define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
19
 
@@ -22,8 +23,8 @@ define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE_
22
  *
23
  * @since 1.0.0
24
  */
25
- require_once('functions/functions.load.php');
26
- require_once('classes/class.admin.php');
27
 
28
  /**
29
  * Instantiate Classe
@@ -54,6 +55,7 @@ add_action( 'init', array( $ot_admin, 'create_option_post' ), 5 );
54
  add_action( 'admin_init', array( $ot_admin, 'option_tree_init' ) );
55
  add_action( 'admin_menu', array( $ot_admin, 'option_tree_admin' ) );
56
  add_action( 'wp_ajax_option_tree_array_save', array( $ot_admin, 'option_tree_array_save' ) );
 
57
  add_action( 'wp_ajax_option_tree_array_reset', array( $ot_admin, 'option_tree_array_reset' ) );
58
  add_action( 'wp_ajax_option_tree_add', array( $ot_admin, 'option_tree_add' ) );
59
  add_action( 'wp_ajax_option_tree_edit', array( $ot_admin, 'option_tree_edit' ) );
@@ -61,4 +63,10 @@ add_action( 'wp_ajax_option_tree_delete', array( $ot_admin, 'option_tree_delete'
61
  add_action( 'wp_ajax_option_tree_next_id', array( $ot_admin, 'option_tree_next_id' ) );
62
  add_action( 'wp_ajax_option_tree_sort', array( $ot_admin, 'option_tree_sort' ) );
63
  add_action( 'wp_ajax_option_tree_import_data', array( $ot_admin, 'option_tree_import_data' ) );
64
- add_action( 'wp_ajax_option_tree_add_slider', array( $ot_admin, 'option_tree_add_slider' ) );
 
 
 
 
 
 
3
  Plugin Name: OptionTree
4
  Plugin URI: http://wp.envato.com
5
  Description: Customizable WordPress Theme Options Admin Interface
6
+ Version: 1.1.7
7
  Author: Derek Herman
8
  Author URI: http://valendesigns.com
9
+ License: GPLv2
10
  */
11
 
12
  /**
14
  *
15
  * @since 1.0.0
16
  */
17
+ define( 'OT_VERSION', '1.1.7' );
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
 
23
  *
24
  * @since 1.0.0
25
  */
26
+ require_once( OT_PLUGIN_DIR . '/functions/functions.load.php' );
27
+ require_once( OT_PLUGIN_DIR . '/classes/class.admin.php' );
28
 
29
  /**
30
  * Instantiate Classe
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' ) );
60
  add_action( 'wp_ajax_option_tree_add', array( $ot_admin, 'option_tree_add' ) );
61
  add_action( 'wp_ajax_option_tree_edit', array( $ot_admin, 'option_tree_edit' ) );
63
  add_action( 'wp_ajax_option_tree_next_id', array( $ot_admin, 'option_tree_next_id' ) );
64
  add_action( 'wp_ajax_option_tree_sort', array( $ot_admin, 'option_tree_sort' ) );
65
  add_action( 'wp_ajax_option_tree_import_data', array( $ot_admin, 'option_tree_import_data' ) );
66
+ add_action( 'wp_ajax_option_tree_update_export_data', array( $ot_admin, 'option_tree_update_export_data' ) );
67
+ add_action( 'wp_ajax_option_tree_add_slider', array( $ot_admin, 'option_tree_add_slider' ) );
68
+ add_action( 'wp_ajax_option_tree_save_layout', array( $ot_admin, 'option_tree_save_layout' ) );
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' ) );
license.txt ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
readme.txt CHANGED
@@ -1,12 +1,13 @@
1
  === OptionTree ===
2
  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.1
7
- Stable tag: 1.1.6
 
8
 
9
- Customizable WordPress Theme Options Admin Interface
10
 
11
  == Description ==
12
 
@@ -16,6 +17,8 @@ With OptionTree you can create as many Theme Options as your project requires an
16
 
17
  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.
18
 
 
 
19
  **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.
20
 
21
  OptionTree is a project sponsored by <a href="http://themeforest.net/?ref=valendesigns">ThemeForest</a>, the largest WordPress theme marketplace on the web, and was originally conceived to help ThemeForest authors quickly power up their themes. But it's here for the benefit of one and all, so option up folks!
@@ -41,6 +44,27 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  = 1.1.6 =
45
  * Theme Integration added.
46
  * Made the upload XML file openbase_dir compliant.
@@ -75,6 +99,9 @@ Sorry, but yes. OptionTree requires PHP5 to work correctly.
75
 
76
  == Upgrade Notice ==
77
 
 
 
 
78
  = 1.1.6 =
79
  Added theme integration for developers. It's now possible to have a default XML file included in your theme to populate the theme options and hide the settings and docs pages. Read more about this in the plugins built in documentation.
80
 
1
  === OptionTree ===
2
  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.2
7
+ Stable tag: 1.1.7
8
+ License: GPLv2
9
 
10
+ Extremely customizable Theme Options interface for WordPress.
11
 
12
  == Description ==
13
 
17
 
18
  Included is the ability to Import/Export all the theme options and data for packaging with custom themes or local development. With the Import/Export feature you can get a theme set up on a live server in minutes. Theme authors can now create different version of their themes and include them with the download. It makes setting up different theme styles & options easier than ever because a theme user installs the plugin and theme and either adds their own settings or imports your defaults.
19
 
20
+ **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.
23
 
24
  OptionTree is a project sponsored by <a href="http://themeforest.net/?ref=valendesigns">ThemeForest</a>, the largest WordPress theme marketplace on the web, and was originally conceived to help ThemeForest authors quickly power up their themes. But it's here for the benefit of one and all, so option up folks!
44
 
45
  == Changelog ==
46
 
47
+ = 1.1.7 =
48
+ * Added layout (theme variation) support with save/delete/activate/import/export capabilities. Contributions form Brian of flauntbooks.com
49
+ * Allow layout change on Theme Options page.
50
+ * Full Multisite compatibility by manually adding xml mime type for import options.
51
+ * Replaced eregi() with preg_match() for 5.3+ compatibility.
52
+ * Changed test data in the assets directory for new layout option.
53
+ * Made it so when the slider & upload image changes it's reflected on blur.
54
+ * Gave the slider image an upload button.
55
+ * Added do_action('option_tree_import_data') to option_tree_import_data() function before exit.
56
+ * Added do_action('option_tree_array_save') to option_tree_array_save() function before exit.
57
+ * Added do_action('option_tree_save_layout') to option_tree_save_layout() function before exit.
58
+ * Added do_action('option_tree_delete_layout') to option_tree_delete_layout() function before exit.
59
+ * Added do_action('option_tree_activate_layout') to option_tree_activate_layout() function before exit.
60
+ * Added do_action('option_tree_import_layout') to option_tree_import_layout() function before redirect.
61
+ * Added do_action('option_tree_admin_header') hook before all admin pages.
62
+ * Fixed bug where users could add a color without a hash.
63
+ * Only load option type function on Theme Options page
64
+ * Loading resources with absolute paths, no longer relative.
65
+ * Fixed a bug with uploader creating extra option-tree draft pages.
66
+ * Fixed slider toggle bug, now the sliders close when you open another or create new slide.
67
+
68
  = 1.1.6 =
69
  * Theme Integration added.
70
  * Made the upload XML file openbase_dir compliant.
99
 
100
  == Upgrade Notice ==
101
 
102
+ = 1.1.7 =
103
+ 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.
104
+
105
  = 1.1.6 =
106
  Added theme integration for developers. It's now possible to have a default XML file included in your theme to populate the theme options and hide the settings and docs pages. Read more about this in the plugins built in documentation.
107