<?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() {

	// This gets the theme name from the stylesheet (lowercase and without spaces)
	$themename = get_theme_data(STYLESHEETPATH . '/style.css');
	$themename = $themename['Name'];
	$themename = preg_replace("/\W/", "", strtolower($themename) );

	$optionsframework_settings = get_option('optionsframework');
	$optionsframework_settings['id'] = $themename;
	update_option('optionsframework', $optionsframework_settings);

	// echo $themename;
}

/**
 * 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() {

	// Test data
	$test_array = array("one" => __("One", 'organicthemes'),"two" => __("Two", 'organicthemes'),"three" => __("Three", 'organicthemes'),"four" => __("Four", 'organicthemes'),"five" => __("Five", 'organicthemes'));

	// Multicheck Array
	$multicheck_array = array("one" => __("French Toast", 'organicthemes'), "two" => __("Pancake", 'organicthemes'), "three" => __("Omelette", 'organicthemes'), "four" => __("Crepe", 'organicthemes'), "five" => __("Waffle", 'organicthemes'));

	// Multicheck Defaults
	$multicheck_defaults = array("one" => "true","five" => "true");

	// Background Defaults
	$background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat','position' => 'top center','attachment'=>'scroll');
	
	// Slider Transition Array
	$transition_array = array("1000" => __("1 Second", 'organicthemes'), "2000" => __("2 Seconds", 'organicthemes'), "4000" => __("4 Seconds", 'organicthemes'), "6000" => __("6 Seconds", 'organicthemes'), "8000" => __("8 Seconds", 'organicthemes'), "10000" => __("10 Seconds", 'organicthemes'), "12000" => __("12 Seconds", 'organicthemes'), "14000" => __("14 Seconds", 'organicthemes'), "16000" => __("16 Seconds", 'organicthemes'), "18000" => __("18 Seconds", 'organicthemes'), "20000" => __("20 Seconds", 'organicthemes'), "30000" => __("30 Seconds", 'organicthemes'), "60000" => __("1 Minute", 'organicthemes'), "999999999" => __("Hold Frame", 'organicthemes'));
	
	// Yes or No Array
	$yesno_array = array("true" => __("Yes", 'organicthemes'), "false" => __("No", 'organicthemes'));
	
	// Portfolio Array
	$portfolio_array = array("one" => __("One Column", 'organicthemes'), "two" => __("Two Column", 'organicthemes'), "three" => __("Three Column", 'organicthemes'));

	// 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;
	}
	
	// Add all categories option
	$options_categories[0] = __("All Categories", 'organicthemes');

	// Pull all the pages into an array
	$options_pages = array();  
	$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
	$options_pages['false'] = __("Select a page:", 'organicthemes');
	foreach ($options_pages_obj as $page) {
    	$options_pages[$page->ID] = $page->post_title;
	}

	// If using image radio buttons, define a directory path
	$imagepath =  get_bloginfo('stylesheet_directory') . '/images/';

	$options = array();
						
	$options[] = array( "name" => __("Home", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Display Slideshow?", 'organicthemes'),
							"desc" => __("Select whether or not you would like to display the featured slideshow on the homepage.", 'organicthemes'),
							"id" => "display_home_slideshow",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Display Slideshow Text?", 'organicthemes'),
							"desc" => __("Select whether or not you would like to display the post title and text in the featured slideshow on the homepage.", 'organicthemes'),
							"id" => "display_home_slide_info",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Slideshow Category", 'organicthemes'),
							"desc" => __("Choose the post category you wish to display in the featured slideshow.", 'organicthemes'),
							"id" => "category_home_slideshow",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
							
		$options[] = array( "name" => __("Slideshow Posts To Display", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display in the featured slideshow.", 'organicthemes'),
							"id" => "postnumber_home_slideshow",
							"std" => "10",
							"type" => "text");
							
		$options[] = array( "name" => __("Slideshow Transition Interval", 'organicthemes'),
							"desc" => __("Choose the transition time for the slideshow. This is the time the frame is held before transitioning to the next slide.", 'organicthemes'),
							"id" => "transition_interval",
							"std" => "10000",
							"type" => "select",
							"options" => $transition_array);
							
		$options[] = array( "name" => __("Display Featured Posts?", 'organicthemes'),
							"desc" => __("Select whether or not you would like to display the featured posts beaneath the slideshow on the homepage.", 'organicthemes'),
							"id" => "display_home_posts",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Display Featured Post Text?", 'organicthemes'),
							"desc" => __("Select whether or not you would like to display the post title and text in the featured posts on the homepage.", 'organicthemes'),
							"id" => "display_home_info",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Homepage Posts Category", 'organicthemes'),
							"desc" => __("Choose the category you wish to display in the homepage posts beneath the slider.", 'organicthemes'),
							"id" => "category_home",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
							
		$options[] = array( "name" => __("Homepage Posts Displayed", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display on the homepage.", 'organicthemes'),
							"id" => "postnumber_home",
							"std" => "4",
							"type" => "text");
						
	$options[] = array( "name" => __("Display Settings", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Enable Responsive Layout?", 'organicthemes'),
							"desc" => __("This option enables the responsive site layout for the iPhone, iPad and mobile devices.", 'organicthemes'),
							"id" => "enable_responsive",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Display Post Sidebar?", 'organicthemes'),
							"desc" => __("Selecting this option will display the sidebar on individual posts.", 'organicthemes'),
							"id" => "display_post_side",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Display Post Featured Image?", 'organicthemes'),
							"desc" => __("Selecting this option will display the featured image on individual posts.", 'organicthemes'),
							"id" => "display_feature_post",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Display Blog Featured Image?", 'organicthemes'),
							"desc" => __("Selecting this option will display the featured images on the blog page template.", 'organicthemes'),
							"id" => "display_feature_blog",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Enable PressTrends?", 'organicthemes'),
							"desc" => __("This option enables the PressTrends code in the theme functions.", 'organicthemes'),
							"id" => "enable_presstrends",
							"std" => "1",
							"type" => "checkbox");
						
	$options[] = array( "name" => __("Portfolios", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Display Page Portfolio Text?", 'organicthemes'),
							"desc" => __("Selecting this option will display the post title and excerpt in the portfolio page template posts.", 'organicthemes'),
							"id" => "display_portfolio_page_info",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("One Column Portfolio Template Category", 'organicthemes'),
							"desc" => __("Choose the category you wish to display on the 1 column portfolio page template.", 'organicthemes'),
							"id" => "categories_portfolio_one",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
									
		$options[] = array( "name" => __("One Column Portfolio Posts To Display", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display on the 1 column portfolio page template.", 'organicthemes'),
							"id" => "postnumber_portfolio_one",
							"std" => "12",
							"type" => "text");
							
		$options[] = array( "name" => __("Two Column Portfolio Template Category", 'organicthemes'),
							"desc" => __("Choose the category you wish to display on the 2 column portfolio page template.", 'organicthemes'),
							"id" => "categories_portfolio_two",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
									
		$options[] = array( "name" => __("Two Column Portfolio Posts To Display", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display on the 2 column portfolio page template.", 'organicthemes'),
							"id" => "postnumber_portfolio_two",
							"std" => "12",
							"type" => "text");
							
		$options[] = array( "name" => __("Three Column Portfolio Template Category", 'organicthemes'),
							"desc" => __("Choose the category you wish to display on the 3 column portfolio page template.", 'organicthemes'),
							"id" => "categories_portfolio_three",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
									
		$options[] = array( "name" => __("Three Column Portfolio Posts To Display", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display on the 3 column portfolio page template.", 'organicthemes'),
							"id" => "postnumber_portfolio_three",
							"std" => "12",
							"type" => "text");
							
		$options[] = array( "name" => __("Display Category Portfolio Text?", 'organicthemes'),
							"desc" => __("Selecting this option will display the post title and excerpt in the category portfolio posts.", 'organicthemes'),
							"id" => "display_portfolio_cat_info",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Category Portfolio", 'organicthemes'),
							"desc" => __("Choose the number of columns you wish to display on the category portfolio.", 'organicthemes'),
							"id" => "category_portfolio",
							"std" => __("One Column", 'organicthemes'),
							"type" => "select",
							"options" => $portfolio_array);
						
	$options[] = array( "name" => __("Blog", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Blog Template Category", 'organicthemes'),
							"desc" => __("Choose the category you wish to display on the blog page template.", 'organicthemes'),
							"id" => "categories_blog",
							"std" => __("Select a category:", 'organicthemes'),
							"type" => "select",
							"options" => $options_categories);
									
		$options[] = array( "name" => __("Blog Posts To Display", 'organicthemes'),
							"desc" => __("Enter the number of posts you would like to display on the blog page template.", 'organicthemes'),
							"id" => "postnumber_blog",
							"std" => "5",
							"type" => "text");
						
	$options[] = array( "name" => __("Social", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Twitter Name", 'organicthemes'),
							"desc" => __("Please enter your Twitter username.", 'organicthemes'),
							"id" => "twitter_user",
							"std" => __("organicthemes", 'organicthemes'),
							"type" => "text");
							
		$options[] = array( "name" => __("Blog Social Links", 'organicthemes'),
							"desc" => __("Selecting this option will display the social links on the blog page template. Disabling this feature will increase the blog load time considerably.", 'organicthemes'),
							"id" => "display_social_blog",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Page Social Links", 'organicthemes'),
							"desc" => __("Selecting this option will display the social links on pages.", 'organicthemes'),
							"id" => "display_social_page",
							"std" => "1",
							"type" => "checkbox");
							
		$options[] = array( "name" => __("Post Social Links", 'organicthemes'),
							"desc" => __("Selecting this option will display the social links on individual posts.", 'organicthemes'),
							"id" => "display_social_post",
							"std" => "1",
							"type" => "checkbox");
						
	$options[] = array( "name" => __("Colors", 'organicthemes'),
						"type" => "heading");
						
		$options[] = array( "name" => __("Menu Hover Color", 'organicthemes'),
							"desc" => __("Select the color you wish to use for the menu hover colors.", 'organicthemes'),
							"id" => "menu_color",
							"std" => "#111111",
							"type" => "color");
							
		$options[] = array( "name" => __("Link Color", 'organicthemes'),
							"desc" => __("Select the color you wish to use for the link colors.", 'organicthemes'),
							"id" => "link_color",
							"std" => "#000000",
							"type" => "color");
							
		$options[] = array( "name" => __("Link Hover Color", 'organicthemes'),
							"desc" => __("Select the color you wish to use for the link hover colors.", 'organicthemes'),
							"id" => "link_hover_color",
							"std" => "#33CCFF",
							"type" => "color");
							
		$options[] = array( "name" => __("Highlight Color", 'organicthemes'),
							"desc" => __("Select the color you wish to use for the highlight color. This refers to colors throughout the theme that are not links.", 'organicthemes'),
							"id" => "highlight_color",
							"std" => "#33CCFF",
							"type" => "color");	

	return $options;
}