<?php
/**
 * A unique identifier is defined to store the options in the database and reference them from the theme.
 * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
 * If the identifier changes, it'll appear as if the options have been reset.
 *
 */

function optionsframework_option_name() {
   // Change this to use your theme slug
   return 'ample';
}

/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the 'id' fields, make sure to use all lowercase and no spaces.
 *
 */

function optionsframework_options() {

   $options = array();

   // Pull all the categories into an array
   $options_categories = array();
   $options_categories_obj = get_categories();
   foreach ($options_categories_obj as $category) {
      $options_categories[$category->cat_ID] = $category->cat_name;
   }

   // Header Options Area
   $options[] = array(
      'name' => __( 'Header', 'ample' ),
      'type' => 'heading'
   );
   // Header Logo upload option
   $options[] = array(
      'name'   => __( 'Header Logo', 'ample' ),
      'desc'   => __( 'Upload logo for your header.', 'ample' ),
      'id'     => 'ample_header_logo_image',
      'type'   => 'upload'
   );
   // Header logo and text display type option
   $header_display_array = array(
      'logo_only'    => __( 'Header Logo Only', 'ample' ),
      'text_only'    => __( 'Header Text Only', 'ample' ),
      'both'   => __( 'Show Both', 'ample' ),
      'none'         => __( 'Disable', 'ample' )
   );
   $options[] = array(
      'name'      => __( 'Show', 'ample' ),
      'desc'      => __( 'Choose the option that you want.', 'ample' ),
      'id'        => 'ample_show_header_logo_text',
      'std'       => 'text_only',
      'type'      => 'radio',
      'options'   => $header_display_array
   );
   // Header Title Background Image upload option
   $options[] = array(
      'name'   => __( 'Header Title Background Image', 'ample' ),
      'desc'   => __( 'Upload Background Image for Header Title.', 'ample' ),
      'id'     => 'ample_header_title_background_image',
      'type'   => 'upload'
   );
   // Header Title color option
   $options[] = array(
      'name'      => __( 'Header Title color option', 'ample' ),
      'desc'      => __( 'Choose Color for Header Title', 'ample' ),
      'id'        => 'ample_header_title_color',
      'std'       => '#666666',
      'type'      => 'color'
   );
   // Header image position option
   $options[] = array(
      'name'      => __( 'Header Image Position', 'ample' ),
      'desc'      => __( 'Choose top header image display position.', 'ample' ),
      'id'        => 'ample_header_image_position',
      'std'       => 'above',
      'type'      => 'radio',
      'options'   => array(
                     'above' => __( 'Position Above (Default): Display the Header image just above the site title and main menu part.', 'ample' ),
                     'below' => __( 'Position Below: Display the Header image just below the site title and main menu part.', 'ample' )
                  )
   );

   /*************************************************************************/

   $options[] = array(
      'name' => __( 'Design', 'ample' ),
      'type' => 'heading'
   );
   $options[] = array(
      'name'      => __( 'Custom CSS', 'ample' ),
      'desc'      => __( 'Write your custom css.', 'ample' ),
      'id'        => 'ample_custom_css',
      'std'       => '',
      'type'      => 'textarea'
   );

   /*************************************************************************/

   $options[] = array(
      'name' => __( 'Slider', 'ample' ),
      'type' => 'heading'
   );
   // Slider activate option
   $options[] = array(
      'name'      => __( 'Activate slider', 'ample' ),
      'desc'      => __( 'Check to activate slider.', 'ample' ),
      'id'        => 'ample_activate_slider',
      'std'       => '0',
      'type'      => 'checkbox'
   );
   // Slide options
   for($i=1; $i<=4; $i++) {
      $options[] = array(
         'name'   => sprintf( __( 'Slider #%1$s', 'ample' ), $i ),
         'desc'   => __( 'Upload image', 'ample' ),
         'id'     => 'ample_slider_image'. $i,
         'type'   => 'upload'
      );
      $options[] = array(
         'desc'   => __( 'Enter title for this slide', 'ample' ),
         'id'     => 'ample_slider_title'. $i,
         'std'    => '',
         'type'   => 'text'
      );
      $options[] = array(
         'desc'   => __( 'Enter button text', 'ample' ),
         'id'     => 'ample_slider_button_text'. $i,
         'std'    => '',
         'type'   => 'text'
      );
      $options[] = array(
         'desc'   => __( 'Enter link to redirect', 'ample' ),
         'id'     => 'ample_slider_link'. $i,
         'std'    => '',
         'type'   => 'text'
      );
   }

   /*************************************************************************/

   $options[] = array(
      'name' => __( 'Additional', 'ample' ),
      'type' => 'heading'
   );
   // Select category to hide from Post Page
   if ( $options_categories ) {
      $options[] = array(
         'name' => __( 'Category to hide from Blog', 'ample' ),
         'desc' => __( 'Select Category.', 'ample' ),
         'id' => 'ample_hide_category',
         'std' => '',
         'type' => 'select',
         'options' => $options_categories
      );
   }
   // Hide category from Post Page
   $options[] = array(
      'desc'      => __( 'Check to hide above selected Category.', 'ample' ),
      'id'        => 'ample_hide_category_activate',
      'std'       => '0',
      'type'      => 'checkbox'
   );

   return $options;
}