<?php

function lcp_getCategories($all_categories = null){
	$items = array();
	if( !empty( $all_categories ) ){
		$allCategories = array('name'=> 'ALL CATEGORIES', 'value' => 'all');
		$items[] = $allCategories;
	}

	$args = array( 'hide_empty' => false );

	$pads = array( 0=>'' );

	$categories = get_categories( $args );

	foreach ($categories as $category) {

		if( 0 != $category->category_parent ){
			$act_pads = $pads[ $category->category_parent ] . ' - ';
		}else{
			$act_pads = '';
		}

		$items[] = array(
				'name' => $act_pads . $category->name.' ('.$category->category_count.')',
				'value' => $category->term_id
		);

		$pads[ $category->term_id ] = $act_pads;
	}

	return $items;
}

function foptions_get_data_object() {
	$tos = new fThemeOptionsStore();
	$sliders = fOpt::GetNamespace('slidermanager_sliders');
	$sliders_keys = array_keys( $sliders );
	$sliderList = array();
	foreach( $sliders_keys as $oneKey ) {
		$oneSlider = array('name'=> $oneKey, 'value'=> $oneKey );
		$sliderList[] = $oneSlider;
	}
////////////////////////////////////////////////////////////////////////////////
// HOMEPAGE
////////////////////////////////////////////////////////////////////////////////
	$tos->startNamespace('homepage', 'homepage', __('Home Page', 'lcp-lang'));
		$tos->startOption(__('Slider Area', 'lcp-lang'), '');
			$tos->addParameterNL('check', 'slider-show', 1, __('Show Slider on the Home Page', 'lcp-lang'));
			
			
			
			$tos->addParameterNL('select', 'homepage-slider', '', __(' Select your Slider', 'lcp-lang'), $sliderList );

		
		$tos->startOption(__('Message Buttons', 'lcp-lang'), __('', 'lcp-lang'));
			$tos->addParameterNL('check', 'message-show', 1 , __('Show Message Buttons on the homepage', 'lcp-lang'));
			$tos->addParameter('text-regular','message-a-text', 'Are you ready to meet the creatives ?', __('Message Button A text', 'lcp-lang')); $tos->nextLine();			
			$tos->addParameter('text-regular','message-a-link', 'http://www.google.com', __('Message Button A link', 'lcp-lang')); $tos->nextLine();
			
			$tos->addParameter('text-regular','message-b-text', 'See complete portfolio', __('Message Button B text', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','message-b-link', 'http://www.google.com', __('Message Button B link', 'lcp-lang')); $tos->nextLine();

		$tos->startOption(__('Category Area', 'lcp-lang'), __('', 'lcp-lang'));
			$tos->addParameterNL('check', 'category-show', 1 , __('Enable category area at the homepage', 'lcp-lang'));
			$tos->addParameterNL('select', 'category-id', '', __(' Which category you want to show on homepage?', 'lcp-lang'), lcp_getCategories(true) );
////////////////////////////////////////////////////////////////////////////////
// HEADER
////////////////////////////////////////////////////////////////////////////////	
	$tos->startNamespace('header', 'header',__('Header', 'lcp-lang') );			
		$tos->startOption(__('Logo', 'lcp-lang'), '');
			$tos->addParameterNL('check', 'logo-show', 1, __('Show Logo', 'lcp-lang'));			
			$tos->addParameter('text-img','logo-url', '', __(' Logo Image URL', 'lcp-lang')); $tos->nextLine();	

		$tos->startOption(__('Header Right Text', 'lcp-lang'), '');
			$tos->addParameter('text-area','text-right', "phone: +420 776 223 443 <br /> e-mail: support@londoncreative.co.uk", __(' Right text, each line divided by enter', 'lcp-lang')); $tos->nextLine();
			
			

	$tos->startNamespace('footer', 'footer',__('Footer', 'lcp-lang'));			
		$tos->startOption(__('Footer', 'lcp-lang'), '');
			$tos->addParameter('check','footer-show', 1, __('Show Footer', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text','footer-left-text', '&copy; Copyright 2010 by LondonCreative+', __('Left footer text', 'lcp-lang')); $tos->nextLine();
			
			$tos->addParameter('check','footer-logo-show', 1, __('Show Footer Logo', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-img','footer-logo-url', '', __(' Logo Image URL', 'lcp-lang')); $tos->nextLine();

			
////////////////////////////////////////////////////////////////////////////////
// Translation
////////////////////////////////////////////////////////////////////////////////			
	$tos->startNamespace('translation', 'translation',__('Translation', 'lcp-lang'));
		$tos->startOption(__('Header search', 'lcp-lang'), '');
			$tos->addParameter('text-regular','header-search-input', __('Enter keywords...', 'lcp-lang'), __(' Placeholder of the header input search', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','header-search-button', __('Search', 'lcp-lang'), __(' Search button description', 'lcp-lang')); $tos->nextLine();
		//	$tos->addParameter('text-regular','navigation-responsive-title', 'Navigation', ' Title of navigation when responsive mode is active'); $tos->nextLine();
		
	
			
			
		$tos->startOption('Post Meta', '');
			
			$tos->addParameter('text-regular','post-posted-in', __('Posted in', 'lcp-lang'), __('Posted in (e.g.) Blog, Uncategorized', 'lcp-lang')); $tos->nextLine();
			
			
		$tos->startOption(__('Post Buttons', 'lcp-lang'), '');
			$tos->addParameter('text-regular','post-button-readmore', __('[..]', 'lcp-lang'), __(' Read more button', 'lcp-lang')); $tos->nextLine();
			

			
		$tos->startOption(__('Search', 'lcp-lang'), '');
			$tos->addParameter('text-regular','search-nothingfound', __('Nothing Found', 'lcp-lang'), __(' Nothing Found', 'lcp-lang')); $tos->nextLine();
			//$tos->addParameter('text-regular','post-comment-count-more', '% comments', ' %(=number of comments) comments'); $tos->nextLine();
				
			
			
			//$tos->addParameter('text-regular','post-read-more', 'Read More', ' Read More'); $tos->nextLine();
			//$tos->addParameter('text-regular','post-posted-by', 'Written by', ' Written by'); $tos->nextLine();
			//
			//$tos->addParameter('text-regular','post-tags', 'tagged by', ' Tagged By'); $tos->nextLine();
			//$tos->addParameter('text-regular','post-date', 'M j', ' Post Date Format'); $tos->nextLine();
			
		$tos->startOption(__('Comments', 'lcp-lang'), '');
			
			
			$tos->addParameter('text-regular','comment-count-zero', __('No comments yet', 'lcp-lang'), __(' No comments yet', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','comment-count-one', __('1 comment', 'lcp-lang'), __(' 1 comment', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','comment-count-more', __('% comments', 'lcp-lang'), __(' %(=number of comments) comments', 'lcp-lang')); $tos->nextLine();
			
			$tos->addParameter('text-regular','comment-enter-discussion', __('Leave a Comment', 'lcp-lang'), __(' Comment Form Title', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','comment-name', __('Name (required)', 'lcp-lang'), ' Author Name'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-email', __('Email (will not be published) (required)', 'lcp-lang'), ' Author Email'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-website', __('Website', 'lcp-lang'), ' Author Website'); $tos->nextLine();
			
			
			//$tos->addParameter('text-regular','comment-notify', __('Notify me of followup comments via e-mail', 'lcp-lang'), ' New Comment Notification'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-submit', __('Submit Comment', 'lcp-lang'), ' Submit Comment Button'); $tos->nextLine();
			
			$tos->addParameter('text-regular','comment-reply', __('Reply', 'lcp-lang'), ' Reply Button'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-log-in', __('Logged in as ', 'lcp-lang'), ' Appears when someone logged in wordpress check the comment form'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-log-out', __('Log out &raquo; ', 'lcp-lang'), ' Appears when someone logged in wordpress check the comment form'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-cancel', __('Click here to cancel reply', 'lcp-lang'), ' Cancel Comment Reply link'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-approval', __(' Comment is awaiting for approval', 'lcp-lang'), ' Comment awaiting for approval text'); $tos->nextLine();
			$tos->addParameter('text-regular','comment-log-in-to-reply', __(' You must be <a href="%s">logged in</a> to post a comment.', 'lcp-lang'), __(' Log in to reply', 'lcp-lang')); $tos->nextLine();
			
			$tos->addParameter('text-regular','comment-closed', __('Comments are closed', 'lcp-lang'), ' Appears when comments are closed'); $tos->nextLine();
			
			$tos->addParameter('text-regular','comment-time-format', 'F j, Y, \a\t g:i A', __(' Time format of comments', 'lcp-lang')); $tos->nextLine();
			
			$tos->addParameter('text-regular','comment-login-before', __('You must be ', 'lcp-lang'), __(' You must be', 'lcp-lang')); 
			$tos->addParameter('text-regular','comment-login-middle', __('Logged In ', 'lcp-lang'), __(' Logged In', 'lcp-lang'));
			$tos->addParameter('text-regular','comment-login-after', __('to post a comment', 'lcp-lang'), __(' to post a comment', 'lcp-lang')); 
					
		$tos->startOption('404 Page', '');
			$tos->addParameter('text-regular','404-heading', __('Not Found', 'lcp-lang'), __(' Search Not Found Title', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-area','404-content', __('Sorry, but you are looking for something that isn\'t here.', 'lcp-lang'), __(' Search Not Found Message', 'lcp-lang')); $tos->nextLine();
			
	
			
			
			$pagesWp = get_pages();
			$pages = array();
			foreach( $pagesWp as $onePage ) {
				$newPage = array();
				$newPage['name'] = $onePage->post_title;
				$newPage['value'] = $onePage->ID;
				$pages[] = $newPage;
			}	
		$tos->startOption('Pagination', '');
			$tos->addParameter('text-regular','pagination-next', __('next', 'lcp-lang'), __(' Next button', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','pagination-prev', __('previous', 'lcp-lang'), __(' Previous button', 'lcp-lang')); $tos->nextLine();
			$tos->addParameter('text-regular','pagination-page-of', 'Page % of %', __(' Page 1 of 4', 'lcp-lang')); $tos->nextLine();	
				
		
			
			
			
			
			
			
	
			$themeColorSkins = array(
						array('name'=> __('Yellow', 'lcp-lang'), 'value'=> 'yellow'),
						array('name'=> __('Red', 'lcp-lang'), 'value'=> 'red'),
						array('name'=> __('Blue', 'lcp-lang'), 'value'=> 'blue'),
						
					
						
					  );
			
			
			$themeLayoutSkins = array(
					array('name'=> __('Fullwidth', 'lcp-lang'), 'value'=> 'fullwidth'),
					array('name'=> __('Boxed', 'lcp-lang'), 'value'=> 'boxed'),
			);
			
			$themeBackgroundType = array(
					array('name'=> __('Image', 'lcp-lang'), 'value'=> 'image'),
					array('name'=> __('Pattern', 'lcp-lang'), 'value'=> 'pattern'),
					array('name'=> __('Color', 'lcp-lang'), 'value'=> 'color'),
			);
							
	$tos->startNamespace('skins', 'skins',__('Skins', 'lcp-lang'));			
		$tos->startOption(__('Skins & Colors', 'lcp-lang'), '');			
			$tos->addParameterNL('select', 'theme-color-skin', 'orange', __(' Theme Skin', 'lcp-lang'), $themeColorSkins );	
			

	$tos->startNamespace('customcode', 'customcode',__('Custom Code', 'lcp-lang'));
			
		$tos->startOption(__('Custom CSS', 'lcp-lang'), '');				
			$tos->addParameter('text-area','custom-css', '', '');$tos->nextLine();
			
		$tos->startOption(__('Custom JavaScript', 'lcp-lang'), '');				
			$tos->addParameter('text-area','custom-javascript', '', '');$tos->nextLine();
			
		$tos->startOption(__('Custom Tracking/Analytics', 'lcp-lang'), '');				
			$tos->addParameter('text-area','custom-tracking', '', '');$tos->nextLine();									



  // THERE IS A LOT OF CUSTOM stuff

	$tos->startNamespace('install', 'install',__('Installation', ffgtd()));

		$tos->startOption(__('Basic Installation', ffgtd()), '');

    	$tos->addParameter('info','x1', '', '
          <style type="text/css">
              .not_ready{ background: url(./images/marker.png) no-repeat left center; color: #AAA; }
              .ready{ background: url(./images/yes.png) no-repeat left center; }
              p.not_ready, p.ready{ padding: 0 0 0 30px; margin: 0 0 12px 0;}
              #foptions-install-basic-install { margin: 0 0 8px 0;}
          </style>');

      $plugin_is_active = array(
          'Contact Form 7' =>         1*is_plugin_active('contact-form-7/wp-contact-form-7.php'),
          'Really Simple CAPTCHA' =>  1*is_plugin_active('really-simple-captcha/really-simple-captcha.php'),
      );

      $all_plugins_active = 1;
      foreach ($plugin_is_active as $name=>$active) {
        	$all_plugins_active = $all_plugins_active * $active;
      }

      if( 'aborted' == fOpt::Get('basicinstall', 'plugins' ) ){
          if($all_plugins_active){
              fOpt::Set('basicinstall', 'plugins', 'finished' );
          }
      }

      if( 'finished' == fOpt::Get('basicinstall', 'plugins' ) ){
          if( ! $all_plugins_active){
              fOpt::Set('basicinstall', 'plugins', 'aborted' );
          }
      }

      if( 'aborted' == fOpt::Get('basicinstall', 'plugins' ) ){
          $tos->addParameter('button','basic-install', './admin.php?page=foptions&run_basic_install=1&install_action=1', 'Run the basic installation'); $tos->nextLine();
      }else{
          $tos->addParameter('button','basic-install', './admin.php?page=foptions&run_basic_install=1&install_action=1', 'Re-install the Basic Installation'); $tos->nextLine();
      }

    	$tos->addParameter('info','x2', '', '<p class="'.( $all_plugins_active?'ready':'not_ready' ).'">All plugins installed</p>');

      foreach ($plugin_is_active as $name=>$active) {
        	$tos->addParameter('info','x'.MD5($name), '', '<p class="'.( $active?'ready':'not_ready' ).'">Plugin '.$name.'</p>');
      }

    	$tos->addParameter('info','x3', '', '<p class="ready">Template settings</p>');

      if( $all_plugins_active ){
      		$tos->startOption(__('Full Demo Installation', ffgtd()),'');
    			$tos->addParameter('info','demo-install', 'x', '<iframe src="'.get_template_directory_uri().'/install/to/themeInstall.php" style="height:660px;width:100%"></iframe>'); $tos->nextLine();

      }


	return $tos;
}

?>