* @copyright Copyright (c) 2013, Derek Herman * @since 2.0 */ /** * Create option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_theme_options_ui' ) ) { function ot_type_theme_options_ui() { global $blog_id; echo '
'; /* form nonce */ wp_nonce_field( 'option_tree_settings_form', 'option_tree_settings_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

'. __( 'Warning!', 'option-tree' ) . '

'; echo '

' . sprintf( __( 'Go to the %s page if you want to save data, this page is for adding settings.', 'option-tree' ), 'Appearance->Theme Options' ) . '

'; echo '

' . sprintf( __( 'If you\'re unsure or not completely positive that you should be editing these settings, you should read the %s first.', 'option-tree' ), 'OptionTree->Documentation' ) . '

'; echo '

'. __( 'Things could break or be improperly displayed to the end-user if you do one of the following:', 'option-tree' ) . '

'; echo '

' . __( 'Give two sections the same ID, give two settings the same ID, give two contextual help content areas the same ID, don\'t create any settings, or have a section at the end of the settings list.', 'option-tree' ) . '

'; echo '

' . __( 'You can create as many settings as your project requires and use them how you see fit. When you add a setting here, it will be available on the Theme Options page for use in your theme. To separate your settings into sections, click the "Add Section" button, fill in the input fields, and a new navigation menu item will be created.', 'option-tree' ) . '

'; echo '

' . __( 'All of the settings can be sorted and rearranged to your liking with Drag & Drop. Don\'t worry about the order in which you create your settings, you can always reorder them.', 'option-tree' ) . '

'; echo '
'; /* get the saved settings */ $settings = get_option( 'option_tree_settings' ); /* wrap settings array */ echo '
'; /* set count to zero */ $count = 0; /* loop through each section and its settings */ echo '
    '; if ( isset( $settings['sections'] ) ) { foreach( $settings['sections'] as $section ) { /* section */ echo '
  • ' . ot_sections_view( 'option_tree_settings[sections]', $count, $section ) . '
  • '; /* increment item count */ $count++; /* settings in this section */ if ( isset( $settings['settings'] ) ) { foreach( $settings['settings'] as $setting ) { if ( isset( $setting['section'] ) && $setting['section'] == $section['id'] ) { echo '
  • ' . ot_settings_view( 'option_tree_settings[settings]', $count, $setting ) . '
  • '; /* increment item count */ $count++; } } } } } echo '
'; /* buttons */ echo '' . __( 'Add Section', 'option-tree' ) . ''; echo '' . __( 'Add Setting', 'option-tree' ) . ''; echo ''; /* sidebar textarea */ echo '

' . __( 'Contextual Help', 'option-tree' ) . '

' . __( 'Contextual Help Sidebar', 'option-tree' ) . ': ' . __( 'If you decide to add contextual help to the Theme Option page, enter the optional "Sidebar" HTML here. This would be an extremely useful place to add links to your themes documentation or support forum. Only after you\'ve added some content below will this display to the user.', 'option-tree' ) . '
'; /* set count to zero */ $count = 0; /* loop through each contextual_help content section */ echo '
    '; if ( isset( $settings['contextual_help']['content'] ) ) { foreach( $settings['contextual_help']['content'] as $content ) { /* content */ echo '
  • ' . ot_contextual_help_view( 'option_tree_settings[contextual_help][content]', $count, $content ) . '
  • '; /* increment content count */ $count++; } } echo '
'; echo '' . __( 'Add Contextual Help Content', 'option-tree' ) . ''; echo ''; echo '
'; echo '
'; echo '
'; } } /** * Import XML option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_import_xml' ) ) { function ot_type_import_xml() { echo '
'; /* form nonce */ wp_nonce_field( 'import_xml_form', 'import_xml_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'This import method has been deprecated. That means it has been replaced by a new method and is no longer supported, and may be removed from future versions. All themes that use this import method should be converted to use its replacement below.', 'option-tree' ) . '

'; echo '

' . __( 'If you were given a Theme Options XML file with a premium or free theme, locate it on your hard drive and upload that file by clicking the blue upload button. A popup window will appear, upload the XML file and click "Send to OptionTree". The file URL should be in the upload input, if it is click "Import XML".', 'option-tree' ) . '

'; /* button */ echo ''; echo '
'; echo '
'; /* build upload */ echo '
'; /* input */ echo ''; /* get media post_id */ $post_id = ( $id = ot_get_media_post_ID() ) ? (int) $id : 0; /* add xml button */ echo '' . __( 'Add XML', 'option-tree' ) . ''; echo '
'; echo '
'; echo '
'; echo '
'; } } /** * Import Settings option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_import_settings' ) ) { function ot_type_import_settings() { echo '
'; /* form nonce */ wp_nonce_field( 'import_settings_form', 'import_settings_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'To import your Settings copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Settings" button.', 'option-tree' ) . '

'; /* button */ echo ''; echo '
'; /* textarea */ echo '
'; echo ''; echo '
'; echo '
'; echo '
'; } } /** * Import Data option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_import_data' ) ) { function ot_type_import_data() { echo '
'; /* form nonce */ wp_nonce_field( 'import_data_form', 'import_data_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; if ( OT_SHOW_SETTINGS_IMPORT ) echo '

' . __( 'Only after you\'ve imported the Settings should you try and update your Theme Options.', 'option-tree' ) . '

'; echo '

' . __( 'To import your Theme Options copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Theme Options" button.', 'option-tree' ) . '

'; /* button */ echo ''; echo '
'; /* textarea */ echo '
'; echo ''; echo '
'; echo '
'; echo '
'; } } /** * Import Layouts option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_import_layouts' ) ) { function ot_type_import_layouts() { echo '
'; /* form nonce */ wp_nonce_field( 'import_layouts_form', 'import_layouts_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; if ( OT_SHOW_SETTINGS_IMPORT ) echo '

' . __( 'Only after you\'ve imported the Settings should you try and update your Layouts.', 'option-tree' ) . '

'; echo '

' . __( 'To import your Layouts copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Layouts" button. Keep in mind that when you import your layouts, the active layout\'s saved data will write over the current data set for your Theme Options.', 'option-tree' ) . '

'; /* button */ echo ''; echo '
'; /* textarea */ echo '
'; echo ''; echo '
'; echo '
'; echo '
'; } } /** * Export Settings File option type. * * @return string * * @access public * @since 2.0.8 */ if ( ! function_exists( 'ot_type_export_settings_file' ) ) { function ot_type_export_settings_file() { global $blog_id; echo '
'; /* form nonce */ wp_nonce_field( 'export_settings_file_form', 'export_settings_file_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . sprintf( __( 'Export your Settings into a fully functional theme-options.php 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' ), 'OptionTree->Documentation' ) . '

'; echo '
'; echo '
'; /* button */ echo ''; echo '
'; echo '
'; echo '
'; } } /** * Export Settings option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_export_settings' ) ) { function ot_type_export_settings() { /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'Export your Settings by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the OptionTree->Settings->Import Settings textarea on another web site.', 'option-tree' ) . '

'; echo '
'; /* get theme options data */ $settings = get_option( 'option_tree_settings' ); $settings = ! empty( $settings ) ? ot_encode( serialize( $settings ) ) : ''; echo '
'; echo ''; echo '
'; echo '
'; } } /** * Export Data option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_export_data' ) ) { function ot_type_export_data() { /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'Export your Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the OptionTree->Settings->Import Theme Options textarea on another web site.', 'option-tree' ) . '

'; echo '
'; /* get theme options data */ $data = get_option( 'option_tree' ); $data = ! empty( $data ) ? ot_encode( serialize( $data ) ) : ''; echo '
'; echo ''; echo '
'; echo '
'; } } /** * Export Layouts option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_export_layouts' ) ) { function ot_type_export_layouts() { /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'Export your Layouts by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the OptionTree->Settings->Import Layouts textarea on another web site.', 'option-tree' ) . '

'; echo '
'; /* get layout data */ $layouts = get_option( 'option_tree_layouts' ); $layouts = ! empty( $layouts ) ? ot_encode( serialize( $layouts ) ) : ''; echo '
'; echo ''; echo '
'; echo '
'; } } /** * Modify Layouts option type. * * @return string * * @access public * @since 2.0 */ if ( ! function_exists( 'ot_type_modify_layouts' ) ) { function ot_type_modify_layouts() { echo '
'; /* form nonce */ wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' ); /* format setting outer wrapper */ echo '
'; /* description */ echo '
'; echo '

' . __( 'To add a new layout enter a unique lower case alphanumeric string (dashes allowed) in the text field and click "Save Layouts".', 'option-tree' ) . '

'; echo '

' . __( 'As well, you can activate, remove, and drag & drop the order; all situations require you to click "Save Layouts" for the changes to be applied.', 'option-tree' ) . '

'; echo '

' . __( 'When you create a new layout it will become active and any changes made to the Theme Options will be applied to it. If you switch back to a different layout immediately after creating a new layout that new layout will have a snapshot of the current Theme Options data attached to it.', 'option-tree' ) . '

'; if ( OT_SHOW_DOCS ) echo '

' . __( 'Visit OptionTree->Documentation->Layouts Overview to see a more in-depth description of what layouts are and how to use them.', 'option-tree' ) . '

'; echo '
'; echo '
'; /* get the saved layouts */ $layouts = get_option( 'option_tree_layouts' ); /* set active layout */ $active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : ''; echo ''; /* add new layout */ echo ''; /* loop through each layout */ echo '
    '; if ( is_array( $layouts ) && ! empty( $layouts ) ) { foreach( $layouts as $key => $data ) { /* skip active layout array */ if ( $key == 'active_layout' ) continue; /* content */ echo '
  • ' . ot_layout_view( $key, $data, $active_layout ) . '
  • '; } } echo '
'; echo ''; echo '
'; echo '
'; echo '
'; } } /* End of file ot-functions-settings-page.php */ /* Location: ./includes/ot-functions-settings-page.php */