OptionTree - Version 2.0.8

Version Description

  • Add auto import for backwards compatibility of old 1.x files.
  • Added the ability to export settings into a fully functional theme-options.php.
  • Fix typo in docs regarding the filter demo code.
  • Removed slashes in the section and contextual help titles.
  • Attempt to align colorpicker inputs for other browsers (needs to be tested).
Download this release

Release Info

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

Code changes from version 2.0.7 to 2.0.8

assets/css/ot-admin.css CHANGED
@@ -248,9 +248,9 @@ select.option-tree-ui-select option { padding: 3px 15px !important; }
248
  .colorpicker_hue div { position: absolute; width: 35px; height: 9px; overflow: hidden; background: url(../images/colorpicker/color_indicator.png) left top; margin: -5px 0 0 0; }
249
  .colorpicker_new_color { position: absolute; width: 60px; height: 30px; right: 80px; top: 10px; background: #f00; }
250
  .colorpicker_current_color { position: absolute; width: 60px; height: 30px; right: 10px; top: 10px; background: #f00; }
251
- .colorpicker input { background-color: transparent !important; border: 1px solid transparent !important; position: absolute !important; font-size: 10px !important; font-family: Arial, Helvetica, sans-serif !important; color: #666 !important; top: 6px !important; right: 11px !important; text-align: right !important; margin: 0 !important; padding: 0 !important; height: 11px !important;line-height: 11px !important; }
252
  .colorpicker_hex { position: absolute; width: 72px; height: 22px; background: url(../images/colorpicker/color_hex.png) top; left: 201px; bottom: 9px; }
253
- .colorpicker_hex input { right: 6px; }
254
  .colorpicker_field { height: 22px; width: 62px; background-position: top; position: absolute; }
255
  .colorpicker_field span { position: absolute; width: 12px; height: 22px; overflow: hidden; top: 0; right: 0; cursor: n-resize; }
256
  .colorpicker_rgb_r { background-image: url(../images/colorpicker/color_rgb_r.png); top: 49px; left: 201px; }
248
  .colorpicker_hue div { position: absolute; width: 35px; height: 9px; overflow: hidden; background: url(../images/colorpicker/color_indicator.png) left top; margin: -5px 0 0 0; }
249
  .colorpicker_new_color { position: absolute; width: 60px; height: 30px; right: 80px; top: 10px; background: #f00; }
250
  .colorpicker_current_color { position: absolute; width: 60px; height: 30px; right: 10px; top: 10px; background: #f00; }
251
+ .colorpicker input { background-color: transparent !important; border: 1px solid transparent !important; position: absolute !important; font-size: 10px !important; font-family: Arial, Helvetica, sans-serif !important; color: #666 !important; top: 0px !important; right: 12px !important; text-align: right !important; margin: 0 !important; padding: 0 !important; height: 22px !important;line-height: 22px !important; }
252
  .colorpicker_hex { position: absolute; width: 72px; height: 22px; background: url(../images/colorpicker/color_hex.png) top; left: 201px; bottom: 9px; }
253
+ .colorpicker_hex input { left: 13px; height: 22px; line-height: 22px; padding: 10px; }
254
  .colorpicker_field { height: 22px; width: 62px; background-position: top; position: absolute; }
255
  .colorpicker_field span { position: absolute; width: 12px; height: 22px; overflow: hidden; top: 0; right: 0; cursor: n-resize; }
256
  .colorpicker_rgb_r { background-image: url(../images/colorpicker/color_rgb_r.png); top: 49px; left: 201px; }
includes/ot-functions-admin.php CHANGED
@@ -508,7 +508,7 @@ if ( ! function_exists( 'ot_xml_mime_type_icon' ) ) {
508
  }
509
 
510
  /**
511
- * Import data before the screen is displayed.
512
  *
513
  * @return void
514
  *
@@ -527,89 +527,9 @@ if ( ! function_exists( 'ot_import' ) ) {
527
 
528
  /* validate xml file */
529
  if ( preg_match( "/(.xml)$/i", $file ) && class_exists( 'SimpleXMLElement' ) && function_exists( 'file_get_contents' ) ) {
530
-
531
- if ( $rawdata = @file_get_contents( $file ) ) {
532
-
533
- $section_count = 0;
534
- $settings_count = 0;
535
-
536
- $section = '';
537
-
538
- $settings = array();
539
- $xml = new SimpleXMLElement( $rawdata );
540
 
541
- foreach ( $xml->row as $value ) {
542
-
543
- /* heading is a section now */
544
- if ( $value->item_type == 'heading' ) {
545
-
546
- /* add section to the sections array */
547
- $settings['sections'][$section_count]['id'] = (string) $value->item_id;
548
- $settings['sections'][$section_count]['title'] = (string) $value->item_title;
549
-
550
- /* save the last section id to use in creating settings */
551
- $section = (string) $value->item_id;
552
-
553
- /* increment the section count */
554
- $section_count++;
555
-
556
- } else {
557
-
558
- /* add setting to the settings array */
559
- $settings['settings'][$settings_count]['id'] = (string) $value->item_id;
560
- $settings['settings'][$settings_count]['label'] = (string) $value->item_title;
561
- $settings['settings'][$settings_count]['desc'] = (string) $value->item_desc;
562
- $settings['settings'][$settings_count]['section'] = $section;
563
- $settings['settings'][$settings_count]['type'] = ot_map_old_option_types( (string) $value->item_type );
564
- $settings['settings'][$settings_count]['std'] = '';
565
- $settings['settings'][$settings_count]['class'] = '';
566
-
567
- /* textarea rows */
568
- $rows = '';
569
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
570
- if ( (int) $value->item_options > 0 ) {
571
- $rows = (int) $value->item_options;
572
- } else {
573
- $rows = 15;
574
- }
575
- }
576
- $settings['settings'][$settings_count]['rows'] = $rows;
577
-
578
- /* post type */
579
- $post_type = '';
580
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
581
- if ( '' != (string) $value->item_options ) {
582
- $post_type = (string) $value->item_options;
583
- } else {
584
- $post_type = 'post';
585
- }
586
- }
587
- $settings['settings'][$settings_count]['post_type'] = $post_type;
588
-
589
- /* choices */
590
- $choices = array();
591
- if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
592
- if ( '' != (string) $value->item_options ) {
593
- $choices = ot_convert_string_to_array( (string) $value->item_options );
594
- }
595
- }
596
- $settings['settings'][$settings_count]['choices'] = $choices;
597
-
598
- $settings_count++;
599
- }
600
-
601
- }
602
-
603
- /* make sure each setting has a section just incase */
604
- if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
605
- foreach( $settings['settings'] as $k => $setting ) {
606
- if ( '' == $setting['section'] ) {
607
- $settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
608
- }
609
- }
610
- }
611
-
612
- }
613
  }
614
 
615
  /* default message */
@@ -774,6 +694,355 @@ if ( ! function_exists( 'ot_import' ) ) {
774
 
775
  }
776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  /**
778
  * Save settings array before the screen is displayed.
779
  *
@@ -808,24 +1077,33 @@ if ( ! function_exists( 'ot_save_settings' ) ) {
808
 
809
  } else {
810
 
 
 
 
 
 
 
 
811
  /* missing title set to unfiltered ID */
812
  if ( ! $section['title'] ) {
813
 
814
- $settings['sections'][$k]['title'] = esc_attr( $section['id'] );
815
 
816
  /* missing ID set to title */
817
  } else if ( ! $section['id'] ) {
818
 
819
- $section['id'] = esc_attr( $section['title'] );
820
 
821
  }
822
 
823
  /* sanitize ID once everything has been checked first */
824
- $settings['sections'][$k]['id'] = ot_sanitize_option_id( $section['id'] );
825
 
826
  }
827
 
828
  }
 
 
829
 
830
  }
831
 
@@ -852,27 +1130,34 @@ if ( ! function_exists( 'ot_save_settings' ) ) {
852
 
853
  } else {
854
 
 
 
 
 
 
 
 
855
  /* missing title set to unfiltered ID */
856
  if ( ! $content['title'] ) {
857
 
858
- $settings['contextual_help']['content'][$k]['title'] = esc_attr( $content['id'] );
859
 
860
  /* missing ID set to title */
861
  } else if ( ! $content['id'] ) {
862
 
863
- $content['id'] = esc_attr( $content['title'] );
864
 
865
  }
866
 
867
  /* sanitize ID once everything has been checked first */
868
- $settings['contextual_help']['content'][$k]['id'] = ot_sanitize_option_id( $content['id'] );
869
 
870
  }
871
 
872
  /* validate textarea description */
873
  if ( isset( $content['content'] ) ) {
874
 
875
- $settings['contextual_help']['content'][$k]['content'] = esc_html( stripcslashes( $content['content'] ) );
876
 
877
  }
878
 
@@ -883,10 +1168,13 @@ if ( ! function_exists( 'ot_save_settings' ) ) {
883
  /* validate contextual_help sidebar */
884
  if ( isset( $settings['contextual_help']['sidebar'] ) ) {
885
 
886
- $settings['contextual_help']['sidebar'] = esc_html( stripcslashes( $settings['contextual_help']['sidebar'] ) );
887
 
888
  }
889
 
 
 
 
890
  /* default message */
891
  $message = 'failed';
892
 
508
  }
509
 
510
  /**
511
+ * Import before the screen is displayed.
512
  *
513
  * @return void
514
  *
527
 
528
  /* validate xml file */
529
  if ( preg_match( "/(.xml)$/i", $file ) && class_exists( 'SimpleXMLElement' ) && function_exists( 'file_get_contents' ) ) {
 
 
 
 
 
 
 
 
 
 
530
 
531
+ $settings = ot_import_xml( $file );
532
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  }
534
 
535
  /* default message */
694
 
695
  }
696
 
697
+ /**
698
+ * Export before the screen is displayed.
699
+ *
700
+ * @return void
701
+ *
702
+ * @access public
703
+ * @since 2.0.8
704
+ */
705
+ if ( ! function_exists( 'ot_export' ) ) {
706
+
707
+ function ot_export() {
708
+
709
+ /* check and verify export settings file nonce */
710
+ if ( isset( $_POST['export_settings_file_nonce'] ) && wp_verify_nonce( $_POST['export_settings_file_nonce'], 'export_settings_file_form' ) ) {
711
+
712
+ ot_export_php_settings_array();
713
+
714
+ }
715
+
716
+ }
717
+
718
+ }
719
+
720
+ /**
721
+ * Reusable XMl import helper function.
722
+ *
723
+ * @param string $file The path to the file.
724
+ * @return mixed False or an array of settings.
725
+ *
726
+ * @access public
727
+ * @since 2.0.8
728
+ */
729
+ if ( ! function_exists( 'ot_import_xml' ) ) {
730
+
731
+ function ot_import_xml( $file ) {
732
+
733
+ if ( $rawdata = @file_get_contents( $file ) ) {
734
+
735
+ $section_count = 0;
736
+ $settings_count = 0;
737
+
738
+ $section = '';
739
+
740
+ $settings = array();
741
+ $xml = new SimpleXMLElement( $rawdata );
742
+
743
+ foreach ( $xml->row as $value ) {
744
+
745
+ /* heading is a section now */
746
+ if ( $value->item_type == 'heading' ) {
747
+
748
+ /* add section to the sections array */
749
+ $settings['sections'][$section_count]['id'] = (string) $value->item_id;
750
+ $settings['sections'][$section_count]['title'] = (string) $value->item_title;
751
+
752
+ /* save the last section id to use in creating settings */
753
+ $section = (string) $value->item_id;
754
+
755
+ /* increment the section count */
756
+ $section_count++;
757
+
758
+ } else {
759
+
760
+ /* add setting to the settings array */
761
+ $settings['settings'][$settings_count]['id'] = (string) $value->item_id;
762
+ $settings['settings'][$settings_count]['label'] = (string) $value->item_title;
763
+ $settings['settings'][$settings_count]['desc'] = (string) $value->item_desc;
764
+ $settings['settings'][$settings_count]['section'] = $section;
765
+ $settings['settings'][$settings_count]['type'] = ot_map_old_option_types( (string) $value->item_type );
766
+ $settings['settings'][$settings_count]['std'] = '';
767
+ $settings['settings'][$settings_count]['class'] = '';
768
+
769
+ /* textarea rows */
770
+ $rows = '';
771
+ if ( in_array( $settings['settings'][$settings_count]['type'], array( 'css', 'textarea' ) ) ) {
772
+ if ( (int) $value->item_options > 0 ) {
773
+ $rows = (int) $value->item_options;
774
+ } else {
775
+ $rows = 15;
776
+ }
777
+ }
778
+ $settings['settings'][$settings_count]['rows'] = $rows;
779
+
780
+ /* post type */
781
+ $post_type = '';
782
+ if ( in_array( $settings['settings'][$settings_count]['type'], array( 'custom-post-type-select', 'custom-post-type-checkbox' ) ) ) {
783
+ if ( '' != (string) $value->item_options ) {
784
+ $post_type = (string) $value->item_options;
785
+ } else {
786
+ $post_type = 'post';
787
+ }
788
+ }
789
+ $settings['settings'][$settings_count]['post_type'] = $post_type;
790
+
791
+ /* choices */
792
+ $choices = array();
793
+ if ( in_array( $settings['settings'][$settings_count]['type'], array( 'checkbox', 'radio', 'select' ) ) ) {
794
+ if ( '' != (string) $value->item_options ) {
795
+ $choices = ot_convert_string_to_array( (string) $value->item_options );
796
+ }
797
+ }
798
+ $settings['settings'][$settings_count]['choices'] = $choices;
799
+
800
+ $settings_count++;
801
+ }
802
+
803
+ }
804
+
805
+ /* make sure each setting has a section just incase */
806
+ if ( isset( $settings['sections'] ) && isset( $settings['settings'] ) ) {
807
+ foreach( $settings['settings'] as $k => $setting ) {
808
+ if ( '' == $setting['section'] ) {
809
+ $settings['settings'][$k]['section'] = $settings['sections'][0]['id'];
810
+ }
811
+ }
812
+ }
813
+
814
+ return $settings;
815
+
816
+ }
817
+
818
+ return false;
819
+ }
820
+
821
+ }
822
+
823
+ /**
824
+ * Export the Theme Mode theme-options.php
825
+ *
826
+ * @return attachment
827
+ *
828
+ * @access public
829
+ * @since 2.0.8
830
+ */
831
+ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
832
+
833
+ function ot_export_php_settings_array() {
834
+
835
+ $content = '';
836
+ $build_settings = '';
837
+ $contextual_help = '';
838
+ $sections = '';
839
+ $settings = '';
840
+ $option_tree_settings = get_option( 'option_tree_settings', array() );
841
+
842
+ header( "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
843
+ header( "Pragma: no-cache ");
844
+ header( "Content-Description: File Transfer" );
845
+ header( 'Content-Disposition: attachment; filename="theme-options.php"');
846
+ header( "Content-Type: application/octet-stream");
847
+ header( "Content-Transfer-Encoding: binary" );
848
+
849
+ /* build contextual help content */
850
+ if ( isset( $option_tree_settings['contextual_help']['content'] ) ) {
851
+ $help = '';
852
+ foreach( $option_tree_settings['contextual_help']['content'] as $value ) {
853
+ $_id = isset( $value['id'] ) ? $value['id'] : '';
854
+ $_title = isset( $value['title'] ) ? str_replace( "'", "\'", $value['title'] ) : '';
855
+ $_content = isset( $value['content'] ) ? html_entity_decode( str_replace( "'", "\'", $value['content'] ) ) : '';
856
+ $help.= "
857
+ array(
858
+ 'id' => '$_id',
859
+ 'title' => '$_title',
860
+ 'content' => '$_content'
861
+ ),";
862
+ }
863
+ $help = substr_replace( $help, '' , -1 );
864
+ $contextual_help = "'content' => array( $help
865
+ ),";
866
+ }
867
+
868
+ /* build contextual help sidebar */
869
+ if ( isset( $option_tree_settings['contextual_help']['sidebar'] ) ) {
870
+ $contextual_help.= "
871
+ 'sidebar' => '" . html_entity_decode( str_replace( "'", "\'", $option_tree_settings['contextual_help']['sidebar'] ) ) . "'";
872
+ }
873
+
874
+ /* check that $contexual_help has a value and add to $build_settings */
875
+ if ( '' != $contextual_help ) {
876
+ $build_settings.= "
877
+ 'contextual_help' => array(
878
+ $contextual_help
879
+ )";
880
+ }
881
+
882
+ /* build sections */
883
+ if ( isset( $option_tree_settings['sections'] ) ) {
884
+ foreach( $option_tree_settings['sections'] as $value ) {
885
+ $_id = isset( $value['id'] ) ? $value['id'] : '';
886
+ $_title = isset( $value['title'] ) ? str_replace( "'", "\'", $value['title'] ) : '';
887
+ $sections.= "
888
+ array(
889
+ 'id' => '$_id',
890
+ 'title' => '$_title'
891
+ ),";
892
+ }
893
+ $sections = substr_replace( $sections, '' , -1 );
894
+ }
895
+
896
+ /* check that $sections has a value and add to $build_settings */
897
+ if ( '' != $sections ) {
898
+ $build_settings.= ",
899
+ 'sections' => array( $sections
900
+ )";
901
+ }
902
+
903
+ /* build settings */
904
+ if ( isset( $option_tree_settings['settings'] ) ) {
905
+ foreach( $option_tree_settings['settings'] as $value ) {
906
+ $_id = isset( $value['id'] ) ? $value['id'] : '';
907
+ $_label = isset( $value['label'] ) ? str_replace( "'", "\'", $value['label'] ) : '';
908
+ $_desc = isset( $value['desc'] ) ? str_replace( "'", "\'", $value['desc'] ) : '';
909
+ $_std = isset( $value['std'] ) ? $value['std'] : '';
910
+ $_type = isset( $value['type'] ) ? $value['type'] : '';
911
+ $_section = isset( $value['section'] ) ? $value['section'] : '';
912
+ $_rows = isset( $value['rows'] ) ? $value['rows'] : '';
913
+ $_post_type = isset( $value['post_type'] ) ? $value['post_type'] : '';
914
+ $_taxonomy = isset( $value['taxonomy'] ) ? $value['taxonomy'] : '';
915
+ $_class = isset( $value['class'] ) ? $value['class'] : '';
916
+
917
+ $choices = '';
918
+ if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
919
+ foreach( $value['choices'] as $choice ) {
920
+ $_value = isset( $choice['value'] ) ? $choice['value'] : '';
921
+ $_label = isset( $choice['label'] ) ? str_replace( "'", "\'", $choice['label'] ) : '';
922
+ $_src = isset( $choice['src'] ) ? str_replace( "'", "\'", $choice['src'] ) : '';
923
+ $choices.= "
924
+ array(
925
+ 'value' => '$_value',
926
+ 'label' => '$_label',
927
+ 'src' => '$_src'
928
+ ),";
929
+ }
930
+ $choices = substr_replace( $choices, '' , -1 );
931
+ $choices = ",
932
+ 'choices' => array( $choices
933
+ ),";
934
+ }
935
+
936
+ $sub_settings = '';
937
+ if ( isset( $value['settings'] ) && ! empty( $value['settings'] ) ) {
938
+ foreach( $value['settings'] as $setting ) {
939
+ $_sub_id = isset( $setting['id'] ) ? $setting['id'] : '';
940
+ $_sub_label = isset( $setting['label'] ) ? str_replace( "'", "\'", $setting['label'] ) : '';
941
+ $_sub_desc = isset( $setting['desc'] ) ? str_replace( "'", "\'", $setting['desc'] ) : '';
942
+ $_sub_std = isset( $setting['std'] ) ? $setting['std'] : '';
943
+ $_sub_type = isset( $setting['type'] ) ? $setting['type'] : '';
944
+ $_sub_rows = isset( $setting['rows'] ) ? $setting['rows'] : '';
945
+ $_sub_post_type = isset( $setting['post_type'] ) ? $setting['post_type'] : '';
946
+ $_sub_taxonomy = isset( $setting['taxonomy'] ) ? $setting['taxonomy'] : '';
947
+ $_sub_class = isset( $setting['class'] ) ? $setting['class'] : '';
948
+
949
+ $sub_choices = '';
950
+ if ( isset( $setting['choices'] ) && ! empty( $setting['choices'] ) ) {
951
+ foreach( $setting['choices'] as $sub_choice ) {
952
+ $_sub_choice_value = isset( $sub_choice['value'] ) ? $sub_choice['value'] : '';
953
+ $_sub_choice_label = isset( $sub_choice['label'] ) ? str_replace( "'", "\'", $sub_choice['label'] ) : '';
954
+ $_sub_choice_src = isset( $sub_choice['src'] ) ? str_replace( "'", "\'", $sub_choice['src'] ) : '';
955
+ $sub_choices.= "
956
+ array(
957
+ 'value' => '$_sub_choice_value',
958
+ 'label' => '$_sub_choice_label',
959
+ 'src' => '$_sub_choice_src'
960
+ ),";
961
+ }
962
+ $sub_choices = substr_replace( $sub_choices, '' , -1 );
963
+ $sub_choices = ",
964
+ 'choices' => array( $sub_choices
965
+ ),";
966
+ }
967
+
968
+ $sub_settings.= "
969
+ array(
970
+ 'id' => '$_sub_id',
971
+ 'label' => '$_sub_label',
972
+ 'desc' => '$_sub_desc',
973
+ 'std' => '$_sub_std',
974
+ 'type' => '$_sub_type',
975
+ 'rows' => '$_sub_rows',
976
+ 'post_type' => '$_sub_post_type',
977
+ 'taxonomy' => '$_sub_taxonomy',
978
+ 'class' => '$_sub_class'$sub_choices
979
+ ),";
980
+ }
981
+ $sub_settings = substr_replace( $sub_settings, '' , -1 );
982
+ $sub_settings = ",
983
+ 'settings' => array( $sub_settings
984
+ )";
985
+ }
986
+
987
+ $settings.= "
988
+ array(
989
+ 'id' => '$_id',
990
+ 'label' => '$_label',
991
+ 'desc' => '$_desc',
992
+ 'std' => '$_std',
993
+ 'type' => '$_type',
994
+ 'section' => '$_section',
995
+ 'rows' => '$_rows',
996
+ 'post_type' => '$_post_type',
997
+ 'taxonomy' => '$_taxonomy',
998
+ 'class' => '$_class'$choices$sub_settings
999
+ ),";
1000
+ }
1001
+ $settings = substr_replace( $settings, '' , -1 );
1002
+ }
1003
+
1004
+ /* check that $sections has a value and add to $build_settings */
1005
+ if ( '' != $settings ) {
1006
+ $build_settings.= ",
1007
+ 'settings' => array( $settings
1008
+ )";
1009
+ }
1010
+
1011
+ $content.= "<?php
1012
+ /**
1013
+ * Initialize the options before anything else.
1014
+ */
1015
+ add_action( 'admin_init', 'custom_theme_options', 1 );
1016
+
1017
+ /**
1018
+ * Build the custom settings & update OptionTree.
1019
+ */
1020
+ function custom_theme_options() {
1021
+ /**
1022
+ * Get a copy of the saved settings array.
1023
+ */
1024
+ \$saved_settings = get_option( 'option_tree_settings', array() );
1025
+
1026
+ /**
1027
+ * Custom settings array that will eventually be
1028
+ * passes to the OptionTree Settings API Class.
1029
+ */
1030
+ \$custom_settings = array( $build_settings
1031
+ );
1032
+
1033
+ /* settings are not the same update the DB */
1034
+ if ( \$saved_settings !== \$custom_settings ) {
1035
+ update_option( 'option_tree_settings', \$custom_settings );
1036
+ }
1037
+
1038
+ }";
1039
+
1040
+ echo $content;
1041
+ die();
1042
+ }
1043
+
1044
+ }
1045
+
1046
  /**
1047
  * Save settings array before the screen is displayed.
1048
  *
1077
 
1078
  } else {
1079
 
1080
+ /* validate label */
1081
+ if ( '' != $section['title'] ) {
1082
+
1083
+ $settings['sections'][$k]['title'] = wp_kses_post( $section['title'] );
1084
+
1085
+ }
1086
+
1087
  /* missing title set to unfiltered ID */
1088
  if ( ! $section['title'] ) {
1089
 
1090
+ $settings['sections'][$k]['title'] = wp_kses_post( $section['id'] );
1091
 
1092
  /* missing ID set to title */
1093
  } else if ( ! $section['id'] ) {
1094
 
1095
+ $section['id'] = wp_kses_post( $section['title'] );
1096
 
1097
  }
1098
 
1099
  /* sanitize ID once everything has been checked first */
1100
+ $settings['sections'][$k]['id'] = ot_sanitize_option_id( wp_kses_post( $section['id'] ) );
1101
 
1102
  }
1103
 
1104
  }
1105
+
1106
+ $settings['sections'] = ot_stripslashes( $settings['sections'] );
1107
 
1108
  }
1109
 
1130
 
1131
  } else {
1132
 
1133
+ /* validate label */
1134
+ if ( '' != $content['title'] ) {
1135
+
1136
+ $settings['contextual_help']['content'][$k]['title'] = wp_kses_post( $content['title'] );
1137
+
1138
+ }
1139
+
1140
  /* missing title set to unfiltered ID */
1141
  if ( ! $content['title'] ) {
1142
 
1143
+ $settings['contextual_help']['content'][$k]['title'] = wp_kses_post( $content['id'] );
1144
 
1145
  /* missing ID set to title */
1146
  } else if ( ! $content['id'] ) {
1147
 
1148
+ $content['id'] = wp_kses_post( $content['title'] );
1149
 
1150
  }
1151
 
1152
  /* sanitize ID once everything has been checked first */
1153
+ $settings['contextual_help']['content'][$k]['id'] = ot_sanitize_option_id( wp_kses_post( $content['id'] ) );
1154
 
1155
  }
1156
 
1157
  /* validate textarea description */
1158
  if ( isset( $content['content'] ) ) {
1159
 
1160
+ $settings['contextual_help']['content'][$k]['content'] = wp_kses_post( $content['content'] );
1161
 
1162
  }
1163
 
1168
  /* validate contextual_help sidebar */
1169
  if ( isset( $settings['contextual_help']['sidebar'] ) ) {
1170
 
1171
+ $settings['contextual_help']['sidebar'] = wp_kses_post( $settings['contextual_help']['sidebar'] );
1172
 
1173
  }
1174
 
1175
+
1176
+ $settings['contextual_help'] = ot_stripslashes( $settings['contextual_help'] );
1177
+
1178
  /* default message */
1179
  $message = 'failed';
1180
 
includes/ot-functions-compat.php CHANGED
@@ -8,7 +8,8 @@
8
  * @since 2.0
9
  */
10
 
11
- /* add all the old filters */
 
12
  add_filter( 'ot_option_types_array', 'compat_ot_option_types_array', 10, 1 );
13
  add_filter( 'ot_recognized_font_styles', 'compat_ot_recognized_font_styles', 10, 2 );
14
  add_filter( 'ot_recognized_font_weights', 'compat_ot_recognized_font_weights', 10, 2 );
@@ -18,6 +19,150 @@ add_filter( 'ot_recognized_background_repeat', 'compat_ot_recognized_backgrou
18
  add_filter( 'ot_recognized_background_position', 'compat_ot_recognized_background_position', 10, 2 );
19
  add_filter( 'ot_measurement_unit_types', 'compat_ot_measurement_unit_types', 10, 2 );
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  /**
22
  * Filters the option types array.
23
  *
8
  * @since 2.0
9
  */
10
 
11
+ /* run the actions & filters */
12
+ add_action( 'admin_init', 'compat_ot_import_from_files', 1 );
13
  add_filter( 'ot_option_types_array', 'compat_ot_option_types_array', 10, 1 );
14
  add_filter( 'ot_recognized_font_styles', 'compat_ot_recognized_font_styles', 10, 2 );
15
  add_filter( 'ot_recognized_font_weights', 'compat_ot_recognized_font_weights', 10, 2 );
19
  add_filter( 'ot_recognized_background_position', 'compat_ot_recognized_background_position', 10, 2 );
20
  add_filter( 'ot_measurement_unit_types', 'compat_ot_measurement_unit_types', 10, 2 );
21
 
22
+ /**
23
+ * Import from the old 1.x files for backwards compatibility.
24
+ *
25
+ * @return void
26
+ *
27
+ * @access private
28
+ * @since 2.0.8
29
+ */
30
+ if ( ! function_exists( 'compat_ot_import_from_files' ) ) {
31
+
32
+ function compat_ot_import_from_files() {
33
+
34
+ /* file path & name without extention */
35
+ $ot_xml = '/option-tree/theme-options.xml';
36
+ $ot_data = '/option-tree/theme-options.txt';
37
+ $ot_layout = '/option-tree/layouts.txt';
38
+
39
+ /* XML file path - child theme first then parent */
40
+ $xml_file = get_stylesheet_directory() . $ot_xml;
41
+ if ( ! is_readable( $xml_file ) )
42
+ $xml_file = get_template_directory() . $ot_xml;
43
+
44
+ /* Data file path - child theme first then parent */
45
+ $data_file = get_stylesheet_directory() . $ot_data;
46
+ if ( ! is_readable( $data_file ) )
47
+ $data_file = get_template_directory() . $ot_data;
48
+
49
+ /* Layout file path - child theme first then parent */
50
+ $layout_file = get_stylesheet_directory() . $ot_layout;
51
+ if ( ! is_readable( $layout_file ) )
52
+ $layout_file = get_template_directory() . $ot_layout;
53
+
54
+ /* check for files */
55
+ $has_xml = ( is_readable( $xml_file ) ) ? true : false;
56
+ $has_data = ( is_readable( $data_file ) ) ? true : false;
57
+ $has_layout = ( is_readable( $layout_file ) ) ? true : false;
58
+
59
+ /* auto import XML file */
60
+ if ( $has_xml == true && ! get_option( 'option_tree_settings' ) && class_exists( 'SimpleXMLElement' ) && function_exists( 'file_get_contents' ) ) {
61
+
62
+ $settings = ot_import_xml( $xml_file );
63
+
64
+ if ( isset( $settings ) && ! empty( $settings ) ) {
65
+
66
+ update_option( 'option_tree_settings', $settings );
67
+
68
+ }
69
+
70
+ }
71
+
72
+ /* auto import Data file */
73
+ if ( $has_data == true && ! get_option( 'option_tree' ) && function_exists( 'file_get_contents' ) ) {
74
+
75
+ $rawdata = @file_get_contents( $data_file );
76
+ $options = unserialize( base64_decode( $rawdata ) );
77
+
78
+ /* get settings array */
79
+ $settings = get_option( 'option_tree_settings' );
80
+
81
+ /* has options */
82
+ if ( is_array( $options ) ) {
83
+
84
+ /* validate options */
85
+ if ( is_array( $settings ) ) {
86
+
87
+ foreach( $settings['settings'] as $setting ) {
88
+
89
+ if ( isset( $options[$setting['id']] ) ) {
90
+
91
+ $content = ot_stripslashes( $options[$setting['id']] );
92
+
93
+ $options[$setting['id']] = ot_validate_setting( $content, $setting['type'] );
94
+
95
+ }
96
+
97
+ }
98
+
99
+ }
100
+
101
+ /* update the option tree array */
102
+ update_option( 'option_tree', $options );
103
+
104
+ }
105
+
106
+ }
107
+
108
+ /* auto import Layout file */
109
+ if ( $has_layout == true && ! get_option( 'option_tree_layouts' ) && function_exists( 'file_get_contents' ) ) {
110
+
111
+ $rawdata = @file_get_contents( $layout_file );
112
+ $layouts = unserialize( base64_decode( $rawdata ) );
113
+
114
+ /* get settings array */
115
+ $settings = get_option( 'option_tree_settings' );
116
+
117
+ /* has layouts */
118
+ if ( is_array( $layouts ) ) {
119
+
120
+ /* validate options */
121
+ if ( is_array( $settings ) ) {
122
+
123
+ foreach( $layouts as $key => $value ) {
124
+
125
+ if ( $key == 'active_layout' )
126
+ continue;
127
+
128
+ $options = unserialize( base64_decode( $value ) );
129
+
130
+ foreach( $settings['settings'] as $setting ) {
131
+
132
+ if ( isset( $options[$setting['id']] ) ) {
133
+
134
+ $content = ot_stripslashes( $options[$setting['id']] );
135
+
136
+ $options[$setting['id']] = ot_validate_setting( $content, $setting['type'] );
137
+
138
+ }
139
+
140
+ }
141
+
142
+ $layouts[$key] = base64_encode( serialize( $options ) );
143
+
144
+ }
145
+
146
+ }
147
+
148
+ /* update the option tree array */
149
+ if ( isset( $layouts['active_layout'] ) ) {
150
+
151
+ update_option( 'option_tree', unserialize( base64_decode( $layouts[$layouts['active_layout']] ) ) );
152
+
153
+ }
154
+
155
+ /* update the option tree layouts array */
156
+ update_option( 'option_tree_layouts', $layouts );
157
+
158
+ }
159
+
160
+ }
161
+
162
+ }
163
+
164
+ }
165
+
166
  /**
167
  * Filters the option types array.
168
  *
includes/ot-functions-docs-page.php CHANGED
@@ -152,7 +152,7 @@ body {
152
 
153
  return $array;
154
  }
155
- add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 1 );</code></pre>';
156
 
157
  echo '<p>' . __( 'Example filter to completely change the units in the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
158
  echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
@@ -167,7 +167,7 @@ add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10
167
 
168
  return $array;
169
  }
170
- add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 1 );</code></pre>';
171
 
172
  echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
173
  echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It will return a single page ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
@@ -209,7 +209,7 @@ add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10
209
  return $array;
210
 
211
  }
212
- add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 1 );</code></pre>';
213
 
214
  echo '<h4>'. __( 'Select', 'option-tree' ) . ':</h4>';
215
  echo '<p>' . __( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>';
@@ -261,7 +261,7 @@ add_filter( \'ot_wpautop\', \'filter_textarea_wpautop\', 10, 1 );</code></pre>';
261
  return $content;
262
 
263
  }
264
- add_filter( \'ot_media_buttons\', \'filter_textarea_media_buttons\', 10, 1 );</code></pre>';
265
 
266
  echo '<p>' . __( 'This example keeps WordPress from executing the <code>tinymce</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the tinymce.', 'option-tree' ) . '</p>';
267
  echo '<pre><code>function filter_textarea_tinymce( $content, $field_id ) {
@@ -274,7 +274,7 @@ add_filter( \'ot_media_buttons\', \'filter_textarea_media_buttons\', 10, 1 );</c
274
  return $content;
275
 
276
  }
277
- add_filter( \'ot_tinymce\', \'filter_textarea_tinymce\', 10, 1 );</code></pre>';
278
 
279
  echo '<p>' . __( 'This example alters the <code>quicktags</code> filter on the textarea WYSIWYG. The default is <code>array( \'buttons\' => \'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close\' )</code> which means show those quicktags. It also means you can filter in your own custom quicktags.', 'option-tree' ) . '</p>';
280
  echo '<pre><code>function filter_textarea_quicktags( $content, $field_id ) {
@@ -305,7 +305,7 @@ add_filter( \'ot_quicktags\', \'filter_textarea_quicktags\', 10, 1 );</code></pr
305
  return $content;
306
 
307
  }
308
- add_filter( \'ot_wpautop\', \'filter_textarea_simple_wpautop\', 10, 1 );</code></pre>';
309
 
310
  echo '<h4>'. __( 'Textblock', 'option-tree' ) . ':</h4>';
311
  echo '<p>' . __( 'The Textblock option type is used only on the Theme Option page. It will allow you to create & display HTML on your Theme Options page but has no title above the text block. You can then use the Textblock to add a more detailed set of instruction on how the options are used in your theme. You would NEVER use this in your themes template files as it does not save a value.', 'option-tree' ) . '</p>';
@@ -331,7 +331,7 @@ add_filter( \'ot_wpautop\', \'filter_textarea_simple_wpautop\', 10, 1 );</code><
331
  return $array;
332
 
333
  }
334
- add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 1 );</code></pre>';
335
 
336
  echo '<h4>'. __( 'Upload', 'option-tree' ) . ':</h4>';
337
  echo '<p>' . __( 'The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "Send to OptionTree" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You\'ll have to re-upload or FTP any media to your new server and change the URIs if necessary.', 'option-tree' ) . '</p>';
@@ -366,7 +366,7 @@ if ( ! function_exists( 'ot_type_ot_get_option' ) ) {
366
 
367
  echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
368
 
369
- echo '<p>' . __( 'This function returns a value from the "option_tree" array of saved values or the default value supplied. The returned value would be mixed. Meaning it could be a string, integer, or array.', 'option-tree' ) . '</p>';
370
 
371
  echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
372
 
@@ -782,7 +782,7 @@ include_once( \'option-tree/ot-loader.php\' );
782
 
783
  echo '<h5>' . __( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>';
784
  echo '<ul class="docs-ul">';
785
- echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>theme-options.php</code>.', 'option-tree' ) . '</li>';
786
  echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>theme-options.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>';
787
  echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
788
  echo '</ul>';
@@ -804,6 +804,9 @@ include_once( \'includes/theme-options.php\' );
804
  */
805
  add_action( 'admin_init', 'custom_theme_options', 1 );
806
 
 
 
 
807
  function custom_theme_options() {
808
  /**
809
  * Get a copy of the saved settings array.
@@ -811,8 +814,8 @@ function custom_theme_options() {
811
  &#36;saved_settings = get_option( 'option_tree_settings', array() );
812
 
813
  /**
814
- * Create your own custom array that will be passes to the
815
- * OptionTree Settings API Class.
816
  */
817
  &#36;custom_settings = array(
818
  'contextual_help' => array(
152
 
153
  return $array;
154
  }
155
+ add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 2 );</code></pre>';
156
 
157
  echo '<p>' . __( 'Example filter to completely change the units in the Measurement option type. Added to <code>functions.php</code>.', 'option-tree' ) . '</p>';
158
  echo '<pre><code>function filter_measurement_unit_types( $array, $field_id ) {
167
 
168
  return $array;
169
  }
170
+ add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10, 2 );</code></pre>';
171
 
172
  echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
173
  echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It will return a single page ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
209
  return $array;
210
 
211
  }
212
+ add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 2 );</code></pre>';
213
 
214
  echo '<h4>'. __( 'Select', 'option-tree' ) . ':</h4>';
215
  echo '<p>' . __( 'The Select option type is used to list anything you want that would be chosen from a select list.', 'option-tree' ) . '</p>';
261
  return $content;
262
 
263
  }
264
+ add_filter( \'ot_media_buttons\', \'filter_textarea_media_buttons\', 10, 2 );</code></pre>';
265
 
266
  echo '<p>' . __( 'This example keeps WordPress from executing the <code>tinymce</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the tinymce.', 'option-tree' ) . '</p>';
267
  echo '<pre><code>function filter_textarea_tinymce( $content, $field_id ) {
274
  return $content;
275
 
276
  }
277
+ add_filter( \'ot_tinymce\', \'filter_textarea_tinymce\', 10, 2 );</code></pre>';
278
 
279
  echo '<p>' . __( 'This example alters the <code>quicktags</code> filter on the textarea WYSIWYG. The default is <code>array( \'buttons\' => \'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close\' )</code> which means show those quicktags. It also means you can filter in your own custom quicktags.', 'option-tree' ) . '</p>';
280
  echo '<pre><code>function filter_textarea_quicktags( $content, $field_id ) {
305
  return $content;
306
 
307
  }
308
+ add_filter( \'ot_wpautop\', \'filter_textarea_simple_wpautop\', 10, 2 );</code></pre>';
309
 
310
  echo '<h4>'. __( 'Textblock', 'option-tree' ) . ':</h4>';
311
  echo '<p>' . __( 'The Textblock option type is used only on the Theme Option page. It will allow you to create & display HTML on your Theme Options page but has no title above the text block. You can then use the Textblock to add a more detailed set of instruction on how the options are used in your theme. You would NEVER use this in your themes template files as it does not save a value.', 'option-tree' ) . '</p>';
331
  return $array;
332
 
333
  }
334
+ add_filter( \'ot_recognized_font_families\', \'filter_ot_recognized_font_families\', 10, 2 );</code></pre>';
335
 
336
  echo '<h4>'. __( 'Upload', 'option-tree' ) . ':</h4>';
337
  echo '<p>' . __( 'The Upload option type is used to upload any WordPress supported media. After uploading, users are required to press the "Send to OptionTree" button in order to populate the input with the URI of that media. There is one caveat of this feature. If you import the theme options and have uploaded media on one site the old URI will not reflect the URI of your new site. You\'ll have to re-upload or FTP any media to your new server and change the URIs if necessary.', 'option-tree' ) . '</p>';
366
 
367
  echo '<h4>'. __( 'Description', 'option-tree' ) . ':</h4>';
368
 
369
+ echo '<p>' . __( 'This function returns a value from the "option_tree" array of saved values or the default value supplied. The returned value would be mixed. Meaning it could be a string, integer, boolean, or array.', 'option-tree' ) . '</p>';
370
 
371
  echo '<h4>' . __( 'Usage', 'option-tree' ) . ':</h4>';
372
 
782
 
783
  echo '<h5>' . __( 'Step 2: Create Theme Options without using the UI Builder.', 'option-tree' ) . '</h5>';
784
  echo '<ul class="docs-ul">';
785
+ echo '<li>'. __( 'Create a file and name it anything you want, maybe <code>theme-options.php</code>, or use the built in file export to create it for you. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ) . '</li>';
786
  echo '<li>'. __( 'As well, you\'ll probably want to create a directory named <code>includes</code> to put your <code>theme-options.php</code> into which will help keep you file structure nice and tidy.', 'option-tree' ) . '</li>';
787
  echo '<li>' . __( 'Add the following code to your <code>functions.php</code>.', 'option-tree' ) . '</li>';
788
  echo '</ul>';
804
  */
805
  add_action( 'admin_init', 'custom_theme_options', 1 );
806
 
807
+ /**
808
+ * Build the custom settings & update OptionTree.
809
+ */
810
  function custom_theme_options() {
811
  /**
812
  * Get a copy of the saved settings array.
814
  &#36;saved_settings = get_option( 'option_tree_settings', array() );
815
 
816
  /**
817
+ * Custom settings array that will eventually be
818
+ * passes to the OptionTree Settings API Class.
819
  */
820
  &#36;custom_settings = array(
821
  'contextual_help' => array(
includes/ot-functions-settings-page.php CHANGED
@@ -154,7 +154,7 @@ if ( ! function_exists( 'ot_type_import_xml' ) ) {
154
 
155
  function ot_type_import_xml() {
156
 
157
- echo '<form method="post" id="import-settings-form">';
158
 
159
  /* form nonce */
160
  wp_nonce_field( 'import_xml_form', 'import_xml_nonce' );
@@ -304,7 +304,7 @@ if ( ! function_exists( 'ot_type_import_layouts' ) ) {
304
 
305
  function ot_type_import_layouts() {
306
 
307
- echo '<form method="post" id="import-data-form">';
308
 
309
  /* form nonce */
310
  wp_nonce_field( 'import_layouts_form', 'import_layouts_nonce' );
@@ -339,6 +339,49 @@ if ( ! function_exists( 'ot_type_import_layouts' ) ) {
339
 
340
  }
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  /**
343
  * Export Settings option type.
344
  *
@@ -366,9 +409,7 @@ if ( ! function_exists( 'ot_type_export_settings' ) ) {
366
  $settings = ! empty( $settings ) ? base64_encode( serialize( $settings ) ) : '';
367
 
368
  echo '<div class="format-setting-inner">';
369
- echo '<form action="options.php" method="post" id="option-tree-settings-api">';
370
- echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>';
371
- echo '</form>';
372
  echo '</div>';
373
 
374
  echo '</div>';
154
 
155
  function ot_type_import_xml() {
156
 
157
+ echo '<form method="post" id="import-xml-form">';
158
 
159
  /* form nonce */
160
  wp_nonce_field( 'import_xml_form', 'import_xml_nonce' );
304
 
305
  function ot_type_import_layouts() {
306
 
307
+ echo '<form method="post" id="import-layouts-form">';
308
 
309
  /* form nonce */
310
  wp_nonce_field( 'import_layouts_form', 'import_layouts_nonce' );
339
 
340
  }
341
 
342
+ /**
343
+ * Export Settings File option type.
344
+ *
345
+ * @return string
346
+ *
347
+ * @access public
348
+ * @since 2.0.8
349
+ */
350
+ if ( ! function_exists( 'ot_type_export_settings_file' ) ) {
351
+
352
+ function ot_type_export_settings_file() {
353
+ global $blog_id;
354
+
355
+ echo '<form method="post" id="export-settings-file-form">';
356
+
357
+ /* form nonce */
358
+ wp_nonce_field( 'export_settings_file_form', 'export_settings_file_nonce' );
359
+
360
+ /* format setting outer wrapper */
361
+ echo '<div class="format-setting type-textarea simple has-desc">';
362
+
363
+ /* description */
364
+ echo '<div class="description">';
365
+
366
+ echo '<p>' . sprintf( __( 'Export your Settings into a fully functional <code>theme-options.php</code> file by clicking this button. For more information on how to use this file read the theme mode %s. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' ), '<a href="' . get_admin_url( $blog_id, 'admin.php?page=ot-documentation#section_theme_mode' ) . '"><code>OptionTree->Documentation</code></a>' ) . '</p>';
367
+
368
+ echo '</div>';
369
+
370
+ echo '<div class="format-setting-inner">';
371
+
372
+ /* button */
373
+ echo '<button class="option-tree-ui-button grey hug-left">' . __( 'Export Settings File', 'option-tree' ) . '</button>';
374
+
375
+ echo '</div>';
376
+
377
+ echo '</div>';
378
+
379
+ echo '</form>';
380
+
381
+ }
382
+
383
+ }
384
+
385
  /**
386
  * Export Settings option type.
387
  *
409
  $settings = ! empty( $settings ) ? base64_encode( serialize( $settings ) ) : '';
410
 
411
  echo '<div class="format-setting-inner">';
412
+ echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>';
 
 
413
  echo '</div>';
414
 
415
  echo '</div>';
includes/ot-ui-admin.php CHANGED
@@ -87,6 +87,12 @@ if ( function_exists( 'ot_register_settings' ) ) {
87
  'type' => 'import-layouts',
88
  'section' => 'import'
89
  ),
 
 
 
 
 
 
90
  array(
91
  'id' => 'export_settings_text',
92
  'label' => __( 'Settings', 'option-tree' ),
87
  'type' => 'import-layouts',
88
  'section' => 'import'
89
  ),
90
+ array(
91
+ 'id' => 'export_settings_file_text',
92
+ 'label' => __( 'Settings PHP File', 'option-tree' ),
93
+ 'type' => 'export-settings-file',
94
+ 'section' => 'export'
95
+ ),
96
  array(
97
  'id' => 'export_settings_text',
98
  'label' => __( 'Settings', 'option-tree' ),
languages/option-tree.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
- "POT-Creation-Date: 2012-07-20 09:46:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -62,237 +62,237 @@ msgstr ""
62
  msgid "Description for the sample text field."
63
  msgstr ""
64
 
65
- #: includes/ot-functions-admin.php:1106
66
  msgid "Layout activated."
67
  msgstr ""
68
 
69
- #: includes/ot-functions-admin.php:1119
70
  msgid "Settings updated."
71
  msgstr ""
72
 
73
- #: includes/ot-functions-admin.php:1123
74
  msgid "Settings could not be saved."
75
  msgstr ""
76
 
77
- #: includes/ot-functions-admin.php:1131
78
  msgid "Settings Imported."
79
  msgstr ""
80
 
81
- #: includes/ot-functions-admin.php:1135
82
  msgid "Settings could not be imported."
83
  msgstr ""
84
 
85
- #: includes/ot-functions-admin.php:1142
86
  msgid "Data Imported."
87
  msgstr ""
88
 
89
- #: includes/ot-functions-admin.php:1146
90
  msgid "Data could not be imported."
91
  msgstr ""
92
 
93
- #: includes/ot-functions-admin.php:1154
94
  msgid "Layouts Imported."
95
  msgstr ""
96
 
97
- #: includes/ot-functions-admin.php:1158
98
  msgid "Layouts could not be imported."
99
  msgstr ""
100
 
101
- #: includes/ot-functions-admin.php:1166
102
  msgid "Layouts Updated."
103
  msgstr ""
104
 
105
- #: includes/ot-functions-admin.php:1170
106
  msgid "Layouts could not be updated."
107
  msgstr ""
108
 
109
- #: includes/ot-functions-admin.php:1559
110
  msgid "Left Sidebar"
111
  msgstr ""
112
 
113
- #: includes/ot-functions-admin.php:1564
114
  msgid "Right Sidebar"
115
  msgstr ""
116
 
117
- #: includes/ot-functions-admin.php:1569
118
  msgid "Full Width (no sidebar)"
119
  msgstr ""
120
 
121
- #: includes/ot-functions-admin.php:1574
122
  msgid "Dual Sidebar"
123
  msgstr ""
124
 
125
- #: includes/ot-functions-admin.php:1579
126
  msgid "Left Dual Sidebar"
127
  msgstr ""
128
 
129
- #: includes/ot-functions-admin.php:1584
130
  msgid "Right Dual Sidebar"
131
  msgstr ""
132
 
133
- #: includes/ot-functions-admin.php:1614 includes/ot-functions-admin.php:1675
134
  msgid "Image"
135
  msgstr ""
136
 
137
- #: includes/ot-functions-admin.php:1625 includes/ot-functions-admin.php:1681
138
  msgid "Link"
139
  msgstr ""
140
 
141
- #: includes/ot-functions-admin.php:1636 includes/ot-functions-admin.php:1687
142
  #: includes/ot-functions-docs-page.php:43
143
  #: includes/ot-functions-docs-page.php:367
144
  #: includes/ot-functions-docs-page.php:417
145
  msgid "Description"
146
  msgstr ""
147
 
148
- #: includes/ot-functions-admin.php:2144
149
  msgid "edit"
150
  msgstr ""
151
 
152
- #: includes/ot-functions-admin.php:2145 includes/ot-functions-admin.php:2199
153
- #: includes/ot-functions-admin.php:2200 includes/ot-functions-admin.php:2335
154
- #: includes/ot-functions-admin.php:2336 includes/ot-functions-admin.php:2401
155
- #: includes/ot-functions-admin.php:2402 includes/ot-functions-admin.php:2529
156
- #: includes/ot-functions-admin.php:2530
157
  msgid "Edit"
158
  msgstr ""
159
 
160
- #: includes/ot-functions-admin.php:2147 includes/ot-functions-admin.php:2148
161
- #: includes/ot-functions-admin.php:2202 includes/ot-functions-admin.php:2203
162
- #: includes/ot-functions-admin.php:2338 includes/ot-functions-admin.php:2339
163
- #: includes/ot-functions-admin.php:2404 includes/ot-functions-admin.php:2405
164
- #: includes/ot-functions-admin.php:2463 includes/ot-functions-admin.php:2464
165
- #: includes/ot-functions-admin.php:2532 includes/ot-functions-admin.php:2533
166
  msgid "Delete"
167
  msgstr ""
168
 
169
- #: includes/ot-functions-admin.php:2154
170
  msgid ""
171
  "<strong>Section Title</strong>: Displayed as a menu item on the Theme "
172
  "Options page."
173
  msgstr ""
174
 
175
- #: includes/ot-functions-admin.php:2162
176
  msgid ""
177
  "<strong>Section ID</strong>: A unique lower case alphanumeric string, "
178
  "underscores allowed."
179
  msgstr ""
180
 
181
- #: includes/ot-functions-admin.php:2209
182
  msgid ""
183
  "<strong>Label</strong>: Displayed as the label of a form element on the "
184
  "Theme Options page."
185
  msgstr ""
186
 
187
- #: includes/ot-functions-admin.php:2217 includes/ot-functions-admin.php:2419
188
  msgid ""
189
  "<strong>ID</strong>: A unique lower case alphanumeric string, underscores "
190
  "allowed."
191
  msgstr ""
192
 
193
- #: includes/ot-functions-admin.php:2225
194
  msgid ""
195
  "<strong>Type</strong>: Choose one of the available option types from the "
196
  "dropdown."
197
  msgstr ""
198
 
199
- #: includes/ot-functions-admin.php:2236
200
  msgid ""
201
  "<strong>Description</strong>: Enter a detailed description for the users to "
202
  "read on the Theme Options page, HTML is allowed. This is also where you "
203
  "enter content for both the Textblock & Textblock Titled option types."
204
  msgstr ""
205
 
206
- #: includes/ot-functions-admin.php:2244
207
  msgid ""
208
  "<strong>Choices</strong>: This will only affect the following option types: "
209
  "Checkbox, Radio, Select & Select Image."
210
  msgstr ""
211
 
212
- #: includes/ot-functions-admin.php:2249
213
  msgid "Add Choice"
214
  msgstr ""
215
 
216
- #: includes/ot-functions-admin.php:2255
217
  msgid ""
218
  "<strong>Settings</strong>: This will only affect the List Item option type."
219
  msgstr ""
220
 
221
- #: includes/ot-functions-admin.php:2260
222
  #: includes/ot-functions-settings-page.php:93
223
  msgid "Add Setting"
224
  msgstr ""
225
 
226
- #: includes/ot-functions-admin.php:2266
227
  msgid ""
228
  "<strong>Standard</strong>: Setting the standard value for your option only "
229
  "works for some option types. Read the <code>OptionTree->Documentation</code> "
230
  "for more information on which ones."
231
  msgstr ""
232
 
233
- #: includes/ot-functions-admin.php:2274
234
  msgid ""
235
  "<strong>Rows</strong>: Enter a numeric value for the number of rows in your "
236
  "textarea. This will only affect the following option types: CSS, Textarea, & "
237
  "Textarea Simple."
238
  msgstr ""
239
 
240
- #: includes/ot-functions-admin.php:2282
241
  msgid ""
242
  "<strong>Post Type</strong>: Add a comma separated list of post type like "
243
  "'post,page'. This will only affect the following option types: Custom Post "
244
  "Type Checkbox, & Custom Post Type Select."
245
  msgstr ""
246
 
247
- #: includes/ot-functions-admin.php:2290
248
  msgid ""
249
  "<strong>Taxonomy</strong>: Add a comma separated list of any registered "
250
  "taxonomy like 'category,post_tag'. This will only affect the following "
251
  "option types: Taxonomy Checkbox, & Taxonomy Select."
252
  msgstr ""
253
 
254
- #: includes/ot-functions-admin.php:2298
255
  msgid "<strong>CSS Class</strong>: Add and optional class to this option type."
256
  msgstr ""
257
 
258
- #: includes/ot-functions-admin.php:2345 includes/ot-functions-docs-page.php:29
259
  msgid "Label"
260
  msgstr ""
261
 
262
- #: includes/ot-functions-admin.php:2355
263
  msgid "Value"
264
  msgstr ""
265
 
266
- #: includes/ot-functions-admin.php:2365
267
  msgid "Image Source (Radio Image only)"
268
  msgstr ""
269
 
270
- #: includes/ot-functions-admin.php:2411
271
  msgid ""
272
  "<strong>Title</strong>: Displayed as a contextual help menu item on the "
273
  "Theme Options page."
274
  msgstr ""
275
 
276
- #: includes/ot-functions-admin.php:2427
277
  msgid ""
278
  "<strong>Content</strong>: Enter the HTML content about this contextual help "
279
  "item displayed on the Theme Option page for end users to read."
280
  msgstr ""
281
 
282
- #: includes/ot-functions-admin.php:2458
283
  msgid "Layout"
284
  msgstr ""
285
 
286
- #: includes/ot-functions-admin.php:2460 includes/ot-functions-admin.php:2461
287
  msgid "Activate"
288
  msgstr ""
289
 
290
- #: includes/ot-functions-admin.php:2497 includes/ot-meta-box-api.php:177
291
  #: includes/ot-settings-api.php:572
292
  msgid "Title"
293
  msgstr ""
294
 
295
- #: includes/ot-functions-admin.php:2623
296
  msgid "New Layout"
297
  msgstr ""
298
 
@@ -346,7 +346,7 @@ msgstr ""
346
 
347
  #: includes/ot-functions-docs-page.php:49 includes/ot-ui-admin.php:30
348
  #: includes/ot-ui-admin.php:31 includes/ot-ui-admin.php:74
349
- #: includes/ot-ui-admin.php:92
350
  msgid "Settings"
351
  msgstr ""
352
 
@@ -849,7 +849,7 @@ msgstr ""
849
  msgid ""
850
  "This function returns a value from the \"option_tree\" array of saved values "
851
  "or the default value supplied. The returned value would be mixed. Meaning it "
852
- "could be a string, integer, or array."
853
  msgstr ""
854
 
855
  #: includes/ot-functions-docs-page.php:371
@@ -1237,7 +1237,8 @@ msgstr ""
1237
  #: includes/ot-functions-docs-page.php:785
1238
  msgid ""
1239
  "Create a file and name it anything you want, maybe <code>theme-options.php</"
1240
- "code>."
 
1241
  msgstr ""
1242
 
1243
  #: includes/ot-functions-docs-page.php:786
@@ -1477,7 +1478,19 @@ msgstr ""
1477
  msgid "Import Layouts"
1478
  msgstr ""
1479
 
1480
- #: includes/ot-functions-settings-page.php:360
 
 
 
 
 
 
 
 
 
 
 
 
1481
  msgid ""
1482
  "Export your Settings by highlighting this text and doing a copy/paste into a "
1483
  "blank .txt file. Then save the file for importing into another install of "
@@ -1486,7 +1499,7 @@ msgid ""
1486
  "on another web site."
1487
  msgstr ""
1488
 
1489
- #: includes/ot-functions-settings-page.php:398
1490
  msgid ""
1491
  "Export your Theme Options data by highlighting this text and doing a copy/"
1492
  "paste into a blank .txt file. Then save the file for importing into another "
@@ -1495,7 +1508,7 @@ msgid ""
1495
  "textarea on another web site."
1496
  msgstr ""
1497
 
1498
- #: includes/ot-functions-settings-page.php:434
1499
  msgid ""
1500
  "Export your Layouts by highlighting this text and doing a copy/paste into a "
1501
  "blank .txt file. Then save the file for importing into another install of "
@@ -1504,19 +1517,19 @@ msgid ""
1504
  "on another web site."
1505
  msgstr ""
1506
 
1507
- #: includes/ot-functions-settings-page.php:476
1508
  msgid ""
1509
  "To add a new layout enter a unique lower case alphanumeric string (dashes "
1510
  "allowed) in the text field and click \"Save Layouts\"."
1511
  msgstr ""
1512
 
1513
- #: includes/ot-functions-settings-page.php:477
1514
  msgid ""
1515
  "As well, you can activate, remove, and drag & drop the order; all situations "
1516
  "require you to click \"Save Layouts\" for the changes to be applied."
1517
  msgstr ""
1518
 
1519
- #: includes/ot-functions-settings-page.php:478
1520
  msgid ""
1521
  "When you create a new layout it will become active and any changes made to "
1522
  "the Theme Options will be applied to it. If you switch back to a different "
@@ -1524,13 +1537,13 @@ msgid ""
1524
  "snapshot of the current Theme Options data attached to it."
1525
  msgstr ""
1526
 
1527
- #: includes/ot-functions-settings-page.php:479
1528
  msgid ""
1529
  "Visit <code>OptionTree->Documentation->Layouts Overview</code> to see a more "
1530
  "in-depth description of what layouts are and how to use them."
1531
  msgstr ""
1532
 
1533
- #: includes/ot-functions-settings-page.php:516
1534
  msgid "Save Layouts"
1535
  msgstr ""
1536
 
@@ -1542,17 +1555,17 @@ msgstr ""
1542
  msgid "OptionTree"
1543
  msgstr ""
1544
 
1545
- #: includes/ot-ui-admin.php:36 includes/ot-ui-admin.php:125
1546
  #: includes/ot-ui-theme-options.php:40
1547
  msgid "Theme Options updated."
1548
  msgstr ""
1549
 
1550
- #: includes/ot-ui-admin.php:37 includes/ot-ui-admin.php:126
1551
  #: includes/ot-ui-theme-options.php:41
1552
  msgid "Theme Options reset."
1553
  msgstr ""
1554
 
1555
- #: includes/ot-ui-admin.php:38 includes/ot-ui-admin.php:127
1556
  msgid "Save Settings"
1557
  msgstr ""
1558
 
@@ -1569,7 +1582,7 @@ msgid "Export"
1569
  msgstr ""
1570
 
1571
  #: includes/ot-ui-admin.php:56 includes/ot-ui-admin.php:86
1572
- #: includes/ot-ui-admin.php:104
1573
  msgid "Layouts"
1574
  msgstr ""
1575
 
@@ -1581,67 +1594,71 @@ msgstr ""
1581
  msgid "Settings XML"
1582
  msgstr ""
1583
 
1584
- #: includes/ot-ui-admin.php:80 includes/ot-ui-admin.php:98
1585
  #: includes/ot-ui-theme-options.php:34 includes/ot-ui-theme-options.php:35
1586
  msgid "Theme Options"
1587
  msgstr ""
1588
 
1589
- #: includes/ot-ui-admin.php:110
 
 
 
 
1590
  msgid "Add, Activate, & Remove Layouts"
1591
  msgstr ""
1592
 
1593
- #: includes/ot-ui-admin.php:119 includes/ot-ui-admin.php:120
1594
  msgid "Documentation"
1595
  msgstr ""
1596
 
1597
- #: includes/ot-ui-admin.php:133
1598
  msgid "Creating Options"
1599
  msgstr ""
1600
 
1601
- #: includes/ot-ui-admin.php:137
1602
  msgid "Option Types"
1603
  msgstr ""
1604
 
1605
- #: includes/ot-ui-admin.php:141
1606
  msgid "Function References"
1607
  msgstr ""
1608
 
1609
- #: includes/ot-ui-admin.php:145 includes/ot-ui-admin.php:187
1610
  msgid "Theme Mode"
1611
  msgstr ""
1612
 
1613
- #: includes/ot-ui-admin.php:149 includes/ot-ui-admin.php:193
1614
  msgid "Meta Boxes"
1615
  msgstr ""
1616
 
1617
- #: includes/ot-ui-admin.php:153
1618
  msgid "Code Examples"
1619
  msgstr ""
1620
 
1621
- #: includes/ot-ui-admin.php:157
1622
  msgid "Layouts Overview"
1623
  msgstr ""
1624
 
1625
- #: includes/ot-ui-admin.php:163
1626
  msgid "Overview of available Theme Option fields."
1627
  msgstr ""
1628
 
1629
- #: includes/ot-ui-admin.php:169
1630
  msgid "Option types in alphabetical order & hooks to filter them."
1631
  msgstr ""
1632
 
1633
- #: includes/ot-ui-admin.php:175
1634
  msgid "Function Reference:ot_get_option()"
1635
  msgstr ""
1636
 
1637
- #: includes/ot-ui-admin.php:181
1638
  msgid "Function Reference:get_option_tree()"
1639
  msgstr ""
1640
 
1641
- #: includes/ot-ui-admin.php:199
1642
  msgid "Code examples for front-end development."
1643
  msgstr ""
1644
 
1645
- #: includes/ot-ui-admin.php:205
1646
  msgid "What's a layout anyhow?"
1647
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
+ "POT-Creation-Date: 2012-07-23 11:10:54+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
62
  msgid "Description for the sample text field."
63
  msgstr ""
64
 
65
+ #: includes/ot-functions-admin.php:1457
66
  msgid "Layout activated."
67
  msgstr ""
68
 
69
+ #: includes/ot-functions-admin.php:1470
70
  msgid "Settings updated."
71
  msgstr ""
72
 
73
+ #: includes/ot-functions-admin.php:1474
74
  msgid "Settings could not be saved."
75
  msgstr ""
76
 
77
+ #: includes/ot-functions-admin.php:1482
78
  msgid "Settings Imported."
79
  msgstr ""
80
 
81
+ #: includes/ot-functions-admin.php:1486
82
  msgid "Settings could not be imported."
83
  msgstr ""
84
 
85
+ #: includes/ot-functions-admin.php:1493
86
  msgid "Data Imported."
87
  msgstr ""
88
 
89
+ #: includes/ot-functions-admin.php:1497
90
  msgid "Data could not be imported."
91
  msgstr ""
92
 
93
+ #: includes/ot-functions-admin.php:1505
94
  msgid "Layouts Imported."
95
  msgstr ""
96
 
97
+ #: includes/ot-functions-admin.php:1509
98
  msgid "Layouts could not be imported."
99
  msgstr ""
100
 
101
+ #: includes/ot-functions-admin.php:1517
102
  msgid "Layouts Updated."
103
  msgstr ""
104
 
105
+ #: includes/ot-functions-admin.php:1521
106
  msgid "Layouts could not be updated."
107
  msgstr ""
108
 
109
+ #: includes/ot-functions-admin.php:1910
110
  msgid "Left Sidebar"
111
  msgstr ""
112
 
113
+ #: includes/ot-functions-admin.php:1915
114
  msgid "Right Sidebar"
115
  msgstr ""
116
 
117
+ #: includes/ot-functions-admin.php:1920
118
  msgid "Full Width (no sidebar)"
119
  msgstr ""
120
 
121
+ #: includes/ot-functions-admin.php:1925
122
  msgid "Dual Sidebar"
123
  msgstr ""
124
 
125
+ #: includes/ot-functions-admin.php:1930
126
  msgid "Left Dual Sidebar"
127
  msgstr ""
128
 
129
+ #: includes/ot-functions-admin.php:1935
130
  msgid "Right Dual Sidebar"
131
  msgstr ""
132
 
133
+ #: includes/ot-functions-admin.php:1965 includes/ot-functions-admin.php:2026
134
  msgid "Image"
135
  msgstr ""
136
 
137
+ #: includes/ot-functions-admin.php:1976 includes/ot-functions-admin.php:2032
138
  msgid "Link"
139
  msgstr ""
140
 
141
+ #: includes/ot-functions-admin.php:1987 includes/ot-functions-admin.php:2038
142
  #: includes/ot-functions-docs-page.php:43
143
  #: includes/ot-functions-docs-page.php:367
144
  #: includes/ot-functions-docs-page.php:417
145
  msgid "Description"
146
  msgstr ""
147
 
148
+ #: includes/ot-functions-admin.php:2495
149
  msgid "edit"
150
  msgstr ""
151
 
152
+ #: includes/ot-functions-admin.php:2496 includes/ot-functions-admin.php:2550
153
+ #: includes/ot-functions-admin.php:2551 includes/ot-functions-admin.php:2686
154
+ #: includes/ot-functions-admin.php:2687 includes/ot-functions-admin.php:2752
155
+ #: includes/ot-functions-admin.php:2753 includes/ot-functions-admin.php:2880
156
+ #: includes/ot-functions-admin.php:2881
157
  msgid "Edit"
158
  msgstr ""
159
 
160
+ #: includes/ot-functions-admin.php:2498 includes/ot-functions-admin.php:2499
161
+ #: includes/ot-functions-admin.php:2553 includes/ot-functions-admin.php:2554
162
+ #: includes/ot-functions-admin.php:2689 includes/ot-functions-admin.php:2690
163
+ #: includes/ot-functions-admin.php:2755 includes/ot-functions-admin.php:2756
164
+ #: includes/ot-functions-admin.php:2814 includes/ot-functions-admin.php:2815
165
+ #: includes/ot-functions-admin.php:2883 includes/ot-functions-admin.php:2884
166
  msgid "Delete"
167
  msgstr ""
168
 
169
+ #: includes/ot-functions-admin.php:2505
170
  msgid ""
171
  "<strong>Section Title</strong>: Displayed as a menu item on the Theme "
172
  "Options page."
173
  msgstr ""
174
 
175
+ #: includes/ot-functions-admin.php:2513
176
  msgid ""
177
  "<strong>Section ID</strong>: A unique lower case alphanumeric string, "
178
  "underscores allowed."
179
  msgstr ""
180
 
181
+ #: includes/ot-functions-admin.php:2560
182
  msgid ""
183
  "<strong>Label</strong>: Displayed as the label of a form element on the "
184
  "Theme Options page."
185
  msgstr ""
186
 
187
+ #: includes/ot-functions-admin.php:2568 includes/ot-functions-admin.php:2770
188
  msgid ""
189
  "<strong>ID</strong>: A unique lower case alphanumeric string, underscores "
190
  "allowed."
191
  msgstr ""
192
 
193
+ #: includes/ot-functions-admin.php:2576
194
  msgid ""
195
  "<strong>Type</strong>: Choose one of the available option types from the "
196
  "dropdown."
197
  msgstr ""
198
 
199
+ #: includes/ot-functions-admin.php:2587
200
  msgid ""
201
  "<strong>Description</strong>: Enter a detailed description for the users to "
202
  "read on the Theme Options page, HTML is allowed. This is also where you "
203
  "enter content for both the Textblock & Textblock Titled option types."
204
  msgstr ""
205
 
206
+ #: includes/ot-functions-admin.php:2595
207
  msgid ""
208
  "<strong>Choices</strong>: This will only affect the following option types: "
209
  "Checkbox, Radio, Select & Select Image."
210
  msgstr ""
211
 
212
+ #: includes/ot-functions-admin.php:2600
213
  msgid "Add Choice"
214
  msgstr ""
215
 
216
+ #: includes/ot-functions-admin.php:2606
217
  msgid ""
218
  "<strong>Settings</strong>: This will only affect the List Item option type."
219
  msgstr ""
220
 
221
+ #: includes/ot-functions-admin.php:2611
222
  #: includes/ot-functions-settings-page.php:93
223
  msgid "Add Setting"
224
  msgstr ""
225
 
226
+ #: includes/ot-functions-admin.php:2617
227
  msgid ""
228
  "<strong>Standard</strong>: Setting the standard value for your option only "
229
  "works for some option types. Read the <code>OptionTree->Documentation</code> "
230
  "for more information on which ones."
231
  msgstr ""
232
 
233
+ #: includes/ot-functions-admin.php:2625
234
  msgid ""
235
  "<strong>Rows</strong>: Enter a numeric value for the number of rows in your "
236
  "textarea. This will only affect the following option types: CSS, Textarea, & "
237
  "Textarea Simple."
238
  msgstr ""
239
 
240
+ #: includes/ot-functions-admin.php:2633
241
  msgid ""
242
  "<strong>Post Type</strong>: Add a comma separated list of post type like "
243
  "'post,page'. This will only affect the following option types: Custom Post "
244
  "Type Checkbox, & Custom Post Type Select."
245
  msgstr ""
246
 
247
+ #: includes/ot-functions-admin.php:2641
248
  msgid ""
249
  "<strong>Taxonomy</strong>: Add a comma separated list of any registered "
250
  "taxonomy like 'category,post_tag'. This will only affect the following "
251
  "option types: Taxonomy Checkbox, & Taxonomy Select."
252
  msgstr ""
253
 
254
+ #: includes/ot-functions-admin.php:2649
255
  msgid "<strong>CSS Class</strong>: Add and optional class to this option type."
256
  msgstr ""
257
 
258
+ #: includes/ot-functions-admin.php:2696 includes/ot-functions-docs-page.php:29
259
  msgid "Label"
260
  msgstr ""
261
 
262
+ #: includes/ot-functions-admin.php:2706
263
  msgid "Value"
264
  msgstr ""
265
 
266
+ #: includes/ot-functions-admin.php:2716
267
  msgid "Image Source (Radio Image only)"
268
  msgstr ""
269
 
270
+ #: includes/ot-functions-admin.php:2762
271
  msgid ""
272
  "<strong>Title</strong>: Displayed as a contextual help menu item on the "
273
  "Theme Options page."
274
  msgstr ""
275
 
276
+ #: includes/ot-functions-admin.php:2778
277
  msgid ""
278
  "<strong>Content</strong>: Enter the HTML content about this contextual help "
279
  "item displayed on the Theme Option page for end users to read."
280
  msgstr ""
281
 
282
+ #: includes/ot-functions-admin.php:2809
283
  msgid "Layout"
284
  msgstr ""
285
 
286
+ #: includes/ot-functions-admin.php:2811 includes/ot-functions-admin.php:2812
287
  msgid "Activate"
288
  msgstr ""
289
 
290
+ #: includes/ot-functions-admin.php:2848 includes/ot-meta-box-api.php:177
291
  #: includes/ot-settings-api.php:572
292
  msgid "Title"
293
  msgstr ""
294
 
295
+ #: includes/ot-functions-admin.php:2974
296
  msgid "New Layout"
297
  msgstr ""
298
 
346
 
347
  #: includes/ot-functions-docs-page.php:49 includes/ot-ui-admin.php:30
348
  #: includes/ot-ui-admin.php:31 includes/ot-ui-admin.php:74
349
+ #: includes/ot-ui-admin.php:98
350
  msgid "Settings"
351
  msgstr ""
352
 
849
  msgid ""
850
  "This function returns a value from the \"option_tree\" array of saved values "
851
  "or the default value supplied. The returned value would be mixed. Meaning it "
852
+ "could be a string, integer, boolean, or array."
853
  msgstr ""
854
 
855
  #: includes/ot-functions-docs-page.php:371
1237
  #: includes/ot-functions-docs-page.php:785
1238
  msgid ""
1239
  "Create a file and name it anything you want, maybe <code>theme-options.php</"
1240
+ "code>, or use the built in file export to create it for you. Remember, you "
1241
+ "should always check the file for errors before including it in your theme."
1242
  msgstr ""
1243
 
1244
  #: includes/ot-functions-docs-page.php:786
1478
  msgid "Import Layouts"
1479
  msgstr ""
1480
 
1481
+ #: includes/ot-functions-settings-page.php:366
1482
+ msgid ""
1483
+ "Export your Settings into a fully functional <code>theme-options.php</code> "
1484
+ "file by clicking this button. For more information on how to use this file "
1485
+ "read the theme mode %s. Remember, you should always check the file for "
1486
+ "errors before including it in your theme."
1487
+ msgstr ""
1488
+
1489
+ #: includes/ot-functions-settings-page.php:373
1490
+ msgid "Export Settings File"
1491
+ msgstr ""
1492
+
1493
+ #: includes/ot-functions-settings-page.php:403
1494
  msgid ""
1495
  "Export your Settings by highlighting this text and doing a copy/paste into a "
1496
  "blank .txt file. Then save the file for importing into another install of "
1499
  "on another web site."
1500
  msgstr ""
1501
 
1502
+ #: includes/ot-functions-settings-page.php:439
1503
  msgid ""
1504
  "Export your Theme Options data by highlighting this text and doing a copy/"
1505
  "paste into a blank .txt file. Then save the file for importing into another "
1508
  "textarea on another web site."
1509
  msgstr ""
1510
 
1511
+ #: includes/ot-functions-settings-page.php:475
1512
  msgid ""
1513
  "Export your Layouts by highlighting this text and doing a copy/paste into a "
1514
  "blank .txt file. Then save the file for importing into another install of "
1517
  "on another web site."
1518
  msgstr ""
1519
 
1520
+ #: includes/ot-functions-settings-page.php:517
1521
  msgid ""
1522
  "To add a new layout enter a unique lower case alphanumeric string (dashes "
1523
  "allowed) in the text field and click \"Save Layouts\"."
1524
  msgstr ""
1525
 
1526
+ #: includes/ot-functions-settings-page.php:518
1527
  msgid ""
1528
  "As well, you can activate, remove, and drag & drop the order; all situations "
1529
  "require you to click \"Save Layouts\" for the changes to be applied."
1530
  msgstr ""
1531
 
1532
+ #: includes/ot-functions-settings-page.php:519
1533
  msgid ""
1534
  "When you create a new layout it will become active and any changes made to "
1535
  "the Theme Options will be applied to it. If you switch back to a different "
1537
  "snapshot of the current Theme Options data attached to it."
1538
  msgstr ""
1539
 
1540
+ #: includes/ot-functions-settings-page.php:520
1541
  msgid ""
1542
  "Visit <code>OptionTree->Documentation->Layouts Overview</code> to see a more "
1543
  "in-depth description of what layouts are and how to use them."
1544
  msgstr ""
1545
 
1546
+ #: includes/ot-functions-settings-page.php:557
1547
  msgid "Save Layouts"
1548
  msgstr ""
1549
 
1555
  msgid "OptionTree"
1556
  msgstr ""
1557
 
1558
+ #: includes/ot-ui-admin.php:36 includes/ot-ui-admin.php:131
1559
  #: includes/ot-ui-theme-options.php:40
1560
  msgid "Theme Options updated."
1561
  msgstr ""
1562
 
1563
+ #: includes/ot-ui-admin.php:37 includes/ot-ui-admin.php:132
1564
  #: includes/ot-ui-theme-options.php:41
1565
  msgid "Theme Options reset."
1566
  msgstr ""
1567
 
1568
+ #: includes/ot-ui-admin.php:38 includes/ot-ui-admin.php:133
1569
  msgid "Save Settings"
1570
  msgstr ""
1571
 
1582
  msgstr ""
1583
 
1584
  #: includes/ot-ui-admin.php:56 includes/ot-ui-admin.php:86
1585
+ #: includes/ot-ui-admin.php:110
1586
  msgid "Layouts"
1587
  msgstr ""
1588
 
1594
  msgid "Settings XML"
1595
  msgstr ""
1596
 
1597
+ #: includes/ot-ui-admin.php:80 includes/ot-ui-admin.php:104
1598
  #: includes/ot-ui-theme-options.php:34 includes/ot-ui-theme-options.php:35
1599
  msgid "Theme Options"
1600
  msgstr ""
1601
 
1602
+ #: includes/ot-ui-admin.php:92
1603
+ msgid "Settings PHP File"
1604
+ msgstr ""
1605
+
1606
+ #: includes/ot-ui-admin.php:116
1607
  msgid "Add, Activate, & Remove Layouts"
1608
  msgstr ""
1609
 
1610
+ #: includes/ot-ui-admin.php:125 includes/ot-ui-admin.php:126
1611
  msgid "Documentation"
1612
  msgstr ""
1613
 
1614
+ #: includes/ot-ui-admin.php:139
1615
  msgid "Creating Options"
1616
  msgstr ""
1617
 
1618
+ #: includes/ot-ui-admin.php:143
1619
  msgid "Option Types"
1620
  msgstr ""
1621
 
1622
+ #: includes/ot-ui-admin.php:147
1623
  msgid "Function References"
1624
  msgstr ""
1625
 
1626
+ #: includes/ot-ui-admin.php:151 includes/ot-ui-admin.php:193
1627
  msgid "Theme Mode"
1628
  msgstr ""
1629
 
1630
+ #: includes/ot-ui-admin.php:155 includes/ot-ui-admin.php:199
1631
  msgid "Meta Boxes"
1632
  msgstr ""
1633
 
1634
+ #: includes/ot-ui-admin.php:159
1635
  msgid "Code Examples"
1636
  msgstr ""
1637
 
1638
+ #: includes/ot-ui-admin.php:163
1639
  msgid "Layouts Overview"
1640
  msgstr ""
1641
 
1642
+ #: includes/ot-ui-admin.php:169
1643
  msgid "Overview of available Theme Option fields."
1644
  msgstr ""
1645
 
1646
+ #: includes/ot-ui-admin.php:175
1647
  msgid "Option types in alphabetical order & hooks to filter them."
1648
  msgstr ""
1649
 
1650
+ #: includes/ot-ui-admin.php:181
1651
  msgid "Function Reference:ot_get_option()"
1652
  msgstr ""
1653
 
1654
+ #: includes/ot-ui-admin.php:187
1655
  msgid "Function Reference:get_option_tree()"
1656
  msgstr ""
1657
 
1658
+ #: includes/ot-ui-admin.php:205
1659
  msgid "Code examples for front-end development."
1660
  msgstr ""
1661
 
1662
+ #: includes/ot-ui-admin.php:211
1663
  msgid "What's a layout anyhow?"
1664
  msgstr ""
ot-loader.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
- * Version: 2.0.7
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv2
@@ -63,7 +63,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
63
  /**
64
  * Current Version number.
65
  */
66
- define( 'OT_VERSION', '2.0.7' );
67
 
68
  /**
69
  * For developers: Allow Unfiltered HTML in all the textareas.
@@ -248,14 +248,17 @@ if ( ! class_exists( 'OT_Loader' ) ) {
248
  /* import */
249
  add_action( 'admin_init', 'ot_import', 4 );
250
 
 
 
 
251
  /* save settings */
252
- add_action( 'admin_init', 'ot_save_settings', 5 );
253
 
254
  /* save layouts */
255
- add_action( 'admin_init', 'ot_modify_layouts', 6 );
256
 
257
  /* create media post */
258
- add_action( 'admin_init', 'ot_create_media_post', 7 );
259
 
260
  /* global CSS */
261
  add_action( 'admin_head', array( &$this, 'global_admin_css' ) );
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
+ * Version: 2.0.8
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv2
63
  /**
64
  * Current Version number.
65
  */
66
+ define( 'OT_VERSION', '2.0.8' );
67
 
68
  /**
69
  * For developers: Allow Unfiltered HTML in all the textareas.
248
  /* import */
249
  add_action( 'admin_init', 'ot_import', 4 );
250
 
251
+ /* export */
252
+ add_action( 'admin_init', 'ot_export', 5 );
253
+
254
  /* save settings */
255
+ add_action( 'admin_init', 'ot_save_settings', 6 );
256
 
257
  /* save layouts */
258
+ add_action( 'admin_init', 'ot_modify_layouts', 7 );
259
 
260
  /* create media post */
261
+ add_action( 'admin_init', 'ot_create_media_post', 8 );
262
 
263
  /* global CSS */
264
  add_action( 'admin_head', array( &$this, 'global_admin_css' ) );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://bit.ly/NuXI3T
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
- Stable tag: 2.0.7
8
  License: GPLv2
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
@@ -41,6 +41,13 @@ Yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
44
  = 2.0.7 =
45
  * Fixed the load order to be compatible with 1.x version themes that think the get_option_tree() function doesn't exist yet.
46
  * Tested and compatible with Cudazi themes, but the nag message is still visible.
@@ -164,7 +171,7 @@ Yes. OptionTree requires PHP5 to work correctly (so does WP 3.2+).
164
 
165
  == Upgrade Notice ==
166
 
167
- = 2.0.7 =
168
  The plugin has undertaken a complete rebuild! If you are not the theme developer, I urge you to contact that person before you upgrade and ask them to test the themes compatibility.
169
 
170
  = 1.1.8.1 =
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 2.0.8
8
  License: GPLv2
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
41
 
42
  == Changelog ==
43
 
44
+ = 2.0.8 =
45
+ * Add auto import for backwards compatibility of old 1.x files.
46
+ * Added the ability to export settings into a fully functional theme-options.php.
47
+ * Fix typo in docs regarding the filter demo code.
48
+ * Removed slashes in the section and contextual help titles.
49
+ * Attempt to align colorpicker inputs for other browsers (needs to be tested).
50
+
51
  = 2.0.7 =
52
  * Fixed the load order to be compatible with 1.x version themes that think the get_option_tree() function doesn't exist yet.
53
  * Tested and compatible with Cudazi themes, but the nag message is still visible.
171
 
172
  == Upgrade Notice ==
173
 
174
+ = 2.0.8 =
175
  The plugin has undertaken a complete rebuild! If you are not the theme developer, I urge you to contact that person before you upgrade and ask them to test the themes compatibility.
176
 
177
  = 1.1.8.1 =