<?php

// common field for article boxes
global $FlatNews_Article_Common_Fields;
$FlatNews_Article_Common_Fields = array(
	'title' => array(
		'label' => esc_html__('Title', 'flatnews'),
		'description' => esc_html__('Title of Block', 'flatnews'),
	),
	'title_url' => array(
		'label' => esc_html__('Title URL', 'flatnews'), 
		'description' => esc_html__('URL for Title of Block. Leave blank to use default', 'flatnews'),
		'type' => 'url'
	),
	'title_icon' => array(
		'label' => esc_html__('Title FontAwesome Icon Code', 'flatnews'), 
		'description' => wp_kses(
			sprintf(__('Example: fa-home. <a href="%s" target="_blank">Check Full List of Icon Codes Here</a>', 'flatnews'), esc_url('https://fortawesome.github.io/Font-Awesome/icons/')),
			array(
				'a' => array(
					'href' => array(),
					'target' => array()
				),					
			)
		)
	),
	'title_bg_color' => array(
		'label' => esc_html__('Title Background Color', 'flatnews'), 
		'description' => esc_html__('Leave blank to use transparent', 'flatnews'),
		'type' => 'color'
	),
	'title_text_color' => array(
		'label' => esc_html__('Title Text Color', 'flatnews'), 
		'description' => esc_html__('Leave blank to use default color', 'flatnews'),		
		'type' => 'color'
	),
	'title_border_bottom_color' => array(
		'label' => esc_html__('Title Border Bottom Color', 'flatnews'), 
		'description' => esc_html__('Leave blank to to hide', 'flatnews'),		
		'type' => 'color'
	),
	'main_color' => array(
		'label' => esc_html__('Main Color', 'flatnews'), 
		'description' => esc_html__('Select the main color of box', 'flatnews'),
		'type' => 'color', 
		'default' => ''
	),
	'thumb_bg_color' => array(
		'label' => esc_html__('Thumbnail Background Color', 'flatnews'), 
		'description' => esc_html__('Thumbnail background color', 'flatnews'),
		'type' => 'color', 
		'default' => ''
	),
	'enable_tab' => array(
		'label' => esc_html__('Connect as Tabs', 'flatnews'), 
		'description' => esc_html__('All consecutive blocks which were enabled this option will be grouped into a tab', 'flatnews'),
		'type' => 'checkbox', 
		'default' => false
	),
	'count' => array(
		'label' => esc_html__('Count', 'flatnews'), 
		'description' => esc_html__('Number of posts will be loaded', 'flatnews'),
		'type' => 'number', 
		'default' => 6
	),	
	'orderby' => array(
		'label' => esc_html__('Content Orderby', 'flatnews'), 		
		'type' => 'select', 
		'choices' => array(
			'latest' => esc_html__('Latest', 'flatnews'), 
			'random' => esc_html__('Random', 'flatnews'),			
			'comment' => esc_html__('Most Commented', 'flatnews'),
			'popular' => esc_html__('Popular (Most Viewed)', 'flatnews'),	
			'latest-review' => esc_html__('Latest Reviews', 'flatnews'),	
			'random-review' => esc_html__('Random Reviews', 'flatnews'),	
			'popular-review' => esc_html__('Popular (Highest) Reviews', 'flatnews'),			
		),
		'default' => 'latest'
	),
	'duration' => array(
		'label' => esc_html__('Date Range', 'flatnews'), 		
		'description' => esc_html__('Date range limit to load post from base on publish date', 'flatnews'),
		'type' => 'select', 
		'choices' => array(
			'all' => esc_html__('All Time', 'flatnews'),
			'year' => esc_html__('Last 365 days', 'flatnews'), 
			'month' => esc_html__('Last 30 days', 'flatnews'),			
			'week' => esc_html__('Last 7 days', 'flatnews'),						
		),
		'default' => 'all'
	),
	'show_view_all' => array(
		'label' => esc_html__('Show View All', 'flatnews'), 
		'description' => esc_html__('Show View All button. Uncheck to hide', 'flatnews'),
		'type' => 'checkbox', 
		'default' => true
	),
	'item_title' => array(
		'label' => esc_html__('Item Title', 'flatnews'), 
		'type' => 'select',
		'choices' => array(
			'in' => esc_html__('In Thumbnail', 'flatnews'), 
			'out' => esc_html__('Out of Thumbnail', 'flatnews'),			
			'none' => esc_html__('Not Display', 'flatnews'),			
		),
		'default' => 'in'
	),
	'cates' => array(
		'label' => esc_html__('Load from Categories', 'flatnews'),
		'description' => esc_html__('The categories that will be loaded posts from. Leave blank to load from all', 'flatnews'),
		'type' => 'categories'
	),
	'cate_scenario' => array(
		'label' => esc_html__('Category Scenario', 'flatnews'), 
		'description' => esc_html__('If you choose many categories to load, what relation between them?', 'flatnews'),
		'type' => 'select', 
		'default' => 'combination',
		'choices' => array(
//			'separate' => esc_html__('Separate (will display category list to switch)', 'flatnews'), 			
			'combination' => esc_html__('Combination (posts has one OR more above categories)', 'flatnews'), 			
			'intersection' => esc_html__('Intersection (posts has ALL above categories)', 'flatnews'), 
		),
	),	
	'authors' => array(
		'label' => esc_html__('Load from Authors', 'flatnews'),
		'description' => esc_html__('The authors that will be loaded posts from. Leave blank to load from all', 'flatnews'),
		'type' => 'users'
	),
	'exclude_authors' => array(
		'label' => esc_html__('Exclude Authors', 'flatnews'),
		'description' => esc_html__('The authors that will not be loaded posts from. Leave blank to load from all', 'flatnews'),
		'type' => 'users'
	),
	'tags' => array(
		'label' => esc_html__('Load from Tags', 'flatnews'),
		'description' => esc_html__('The tags that will be loaded posts from. Leave blank to load from all', 'flatnews'),
		'type' => 'tags'
	),
	'ignore_sticky_posts' => array(
		'label' => esc_html__('Ignore Sticky Posts', 'flatnews'), 
		'description' => esc_html__('Do not move sticky posts to the start of the set', 'flatnews'),
		'type' => 'checkbox', 
		'default' => true
	),
	'exclude_loaded_posts' => array(
		'label' => esc_html__('Exclude Loaded Posts', 'flatnews'), 
		'description' => esc_html__('Do not get the loaded posts from previous blocks', 'flatnews'),
		'type' => 'checkbox', 
		'default' => false
	),	
	'show_comment' => array(
		'label' => esc_html__('Show Comment', 'flatnews'), 
		'description' => esc_html__('Show comment number. Uncheck to hide', 'flatnews'),
		'type' => 'checkbox', 
		'default' => true
	),
	'show_readmore' => array(
		'label' => esc_html__('Show Read More', 'flatnews'), 
		'description' => esc_html__('Show readmore link. Uncheck to hide', 'flatnews'),
		'type' => 'checkbox', 
		'default' => true
	),
	'show_author' => array(
		'label' => esc_html__('Show Author', 'flatnews'), 
		'description' => esc_html__('Show / hide author name in item detail', 'flatnews'),
		'type' => 'select', 
		'default' => 'icon',
		'choices' => array(
			'none' => esc_html__('Not show', 'flatnews'), 
			'name' => esc_html__('Show name only', 'flatnews'), 
			'icon' => esc_html__('Show name with icon', 'flatnews'), 
			'avatar' => esc_html__('Show name with avatar', 'flatnews')
		),
	),
	'show_date' => array(
		'label' => esc_html__('Show Date', 'flatnews'), 
		'description' => esc_html__('Show / hide date / time in item detail. The format will follow the site date time format', 'flatnews'),
		'type' => 'select', 
		'default' => 'date',
		'choices' => array(
			'none' => esc_html__('Not Show', 'flatnews'), 
			'full' => esc_html__('Date and Time', 'flatnews'), 
			'date' => esc_html__('Only Date', 'flatnews'), 
			'time' => esc_html__('Only Time', 'flatnews'), 
			'short' => esc_html__('Short Date Time', 'flatnews'), 
			'pretty' => esc_html__('Pretty Date Time', 'flatnews')
		)
	),
	'meta_item_order' => array(
		'label' => esc_html__('Meta Item Order', 'flatnews'), 
		'description' => esc_html__('Pick order for meta items: comment, date, author', 'flatnews'),
		'type' => 'select', 
		'default' => 'a_c_d',
		'choices' => array(
			'c_d_a' => esc_html__('Comment - Date - Author', 'flatnews'), 
			'c_a_d' => esc_html__('Comment - Author - Date', 'flatnews'), 
			'a_c_d' => esc_html__('Author - Comment - Date', 'flatnews'), 
			'a_d_c' => esc_html__('Author - Date - Comment', 'flatnews'), 
			'd_a_c' => esc_html__('Date - Author - Comment', 'flatnews'), 
			'd_c_a' => esc_html__('Date - Comment - Author', 'flatnews'), 					
		)
	),
	
	'show_format_icon' => array(
		'label' => esc_html__('Show Format Icon', 'flatnews'), 
		'description' => esc_html__('Show format icon when mouse hover an item of box', 'flatnews'),
		'type' => 'checkbox', 
		'default' => false
	),
	'show_review_score' => array(
		'label' => esc_html__('Show Review Score', 'flatnews'), 
		'description' => esc_html__('Show review score if have', 'flatnews'),
		'type' => 'checkbox', 
		'default' => false
	),
	'number_cates' => array(
		'label' => esc_html__('Number Categories', 'flatnews'), 
		'description' => esc_html__('Number categories name will be displayed in each item. Set to 0 to hide', 'flatnews'),
		'type' => 'range', 
		'max' => 4,
		'default' => 1
	),
	'snippet_length' => array(
		'label' => esc_html__('Snippet Length', 'flatnews'), 
		'description' => esc_html__('Snippet / excerpt length. Input 0 to hide', 'flatnews'),
		'type' => 'range', 
		'max' => 500,
		'default' => 150
	),
	'thumb_height' => array(
		'label' => esc_html__('Thumbnail Height', 'flatnews'), 
		'description' => esc_html__('Thumbnail image height. Set to 0 and the box will show image as natural height without cropping', 'flatnews'),
		'type' => 'range', 
		'max' => 800,
		'default' => 150
	),
	'pagination' => array(
		'label' => esc_html__('Pagination', 'flatnews'), 		
		'type' => 'select', 
		'choices' => array(
			'' => esc_html__('None', 'flatnews'), 
			'number' => esc_html__('Number', 'flatnews'), 
			'loadmore' => esc_html__('Loadmore', 'flatnews'), 
			'nextprev' => esc_html__('Next / Previous', 'flatnews')
		),
		'default' => ''
	),
	
	
	'rainbow_thumb_bg' => array(
		'label' => esc_html__('Show Rainbow Thumbnail Background Color', 'flatnews'), 
		'description' => esc_html__('Regardless the Thumbnail Background Color option, just using random colors instead', 'flatnews'),
		'type' => 'checkbox', 
		'default' => false
	),
);

global $FlatNews_Article_Fields;
$FlatNews_Article_Fields = array();

// slider
$FlatNews_Article_Fields['slider'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['slider']['number_cates']['default'] = 0;
$FlatNews_Article_Fields['slider']['snippet_length']['default'] = 0;
$FlatNews_Article_Fields['slider']['show_nav'] = array(
	'label' => esc_html__('Show Navigate Buttons', 'flatnews'), 
	'description' => esc_html__('The arrow buttons which allow user navigate slides', 'flatnews'), 
	'type' => 'checkbox', 
	'default' => true
);
$FlatNews_Article_Fields['slider']['show_dots'] = array(
	'label' => esc_html__('Show Dot Buttons', 'flatnews'), 
	'description' => esc_html__('The dot buttons which allow user navigate slides', 'flatnews'), 
	'type' => 'checkbox', 
	'default' => true
);
$FlatNews_Article_Fields['slider']['speed'] = array(
	'label' => esc_html__('Speed', 'flatnews'), 
	'description' => esc_html__('The animate speed in miliseconds', 'flatnews'), 
	'type' => 'number',
	'default' => 5000
);
unset($FlatNews_Article_Fields['slider']['rainbow_thumb_bg']);
unset($FlatNews_Article_Fields['slider']['pagination']);
unset($FlatNews_Article_Fields['slider']['item_title']);


$FlatNews_Article_Fields['slider']['thumb_height']['default'] = 400;
$FlatNews_Article_Fields['slider']['thumb_height']['min'] = 50;
$FlatNews_Article_Fields['slider']['thumb_height']['description'] = esc_html__('Thumbnail Image Height. If the image not fit in thumbnail window, it will be cropped', 'flatnews');

// carousel
$FlatNews_Article_Fields['carousel'] = $FlatNews_Article_Fields['slider'];
$FlatNews_Article_Fields['carousel']['column'] = array(
	'label' => esc_html__('Number Column', 'flatnews'), 
	'description' => esc_html__('Number column of carousel', 'flatnews'),
	'type' => 'range', 
	'min' => 1,
	'max' => 10,
	'default' => 2
);
$FlatNews_Article_Fields['carousel']['thumb_height']['default'] = 215;
unset($FlatNews_Article_Fields['carousel']['snippet_length']);
unset($FlatNews_Article_Fields['carousel']['item_title']);

// ticker
$FlatNews_Article_Fields['ticker'] = $FlatNews_Article_Fields['carousel'];
$FlatNews_Article_Fields['ticker']['thumb_height']['default'] = 50;
$FlatNews_Article_Fields['ticker']['column']['default'] = 4;
unset($FlatNews_Article_Fields['ticker']['show_dots']);
unset($FlatNews_Article_Fields['ticker']['item_title']);
unset($FlatNews_Article_Fields['ticker']['meta_item_order']);

// sticky
$FlatNews_Article_Fields['sticky'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['sticky']['thumb_height']['default'] = 310;
$FlatNews_Article_Fields['sticky']['count']['default'] = 4;
unset($FlatNews_Article_Fields['sticky']['pagination']);

// complex
$FlatNews_Article_Fields['complex'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['complex']['thumb_height']['default'] = 189;
$FlatNews_Article_Fields['complex']['count']['default'] = 4;
unset($FlatNews_Article_Fields['complex']['pagination']);

// one
$FlatNews_Article_Fields['one'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['one']['thumb_height']['default'] = 370;

// two
$FlatNews_Article_Fields['two'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['two']['thumb_height']['default'] = 300;
$FlatNews_Article_Fields['two']['no_spacing'] = array(
	'label' => esc_html__('No Spacing', 'flatnews'), 
	'description' => esc_html__('Disable Spacing Between Items', 'flatnews'),
	'type' => 'checkbox', 
	'default' => false
);

// three
$FlatNews_Article_Fields['three'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['three']['no_spacing'] = array(
	'label' => esc_html__('No Spacing', 'flatnews'), 
	'description' => esc_html__('Disable Spacing Between Items', 'flatnews'),
	'type' => 'checkbox', 
	'default' => false
);
// blogging
$FlatNews_Article_Fields['blogging'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['blogging']['thumb_height']['default'] = 180;
unset($FlatNews_Article_Fields['blogging']['item_title']);

// simple-one
$FlatNews_Article_Fields['simple-one'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['simple-one']['thumb_height']['default'] = 200;
unset($FlatNews_Article_Fields['simple-one']['pagination']);

// list
$FlatNews_Article_Fields['list'] = $FlatNews_Article_Common_Fields;
unset($FlatNews_Article_Fields['list']['thumb_height']);
unset($FlatNews_Article_Fields['list']['snippet_length']);
unset($FlatNews_Article_Fields['list']['number_cates']);
unset($FlatNews_Article_Fields['list']['thumb_bg_color']);
unset($FlatNews_Article_Fields['list']['rainbow_thumb_bg']);
unset($FlatNews_Article_Fields['list']['show_format_icon']);
unset($FlatNews_Article_Fields['list']['item_title']);

$FlatNews_Article_Fields['list']['show_index'] = array(
	'label' => esc_html__('Show Index', 'flatnews'), 
	'description' => esc_html__('Show index number before each item', 'flatnews'),
	'type' => 'checkbox', 
	'default' => false
);

// grid
$FlatNews_Article_Fields['grid'] = $FlatNews_Article_Common_Fields;
$FlatNews_Article_Fields['grid']['count']['default'] = 4;
$FlatNews_Article_Fields['grid']['thumb_height']['default'] = 400;
$FlatNews_Article_Fields['grid']['number_cates']['default'] = 0;
$FlatNews_Article_Fields['grid']['show_author']['default'] = '';
$FlatNews_Article_Fields['grid']['show_comment']['default'] = '';
$FlatNews_Article_Fields['grid']['show_date']['default'] = '';
$FlatNews_Article_Fields['grid']['snippet_length']['default'] = 0;
$FlatNews_Article_Fields['grid']['show_readmore']['default'] = '';
unset($FlatNews_Article_Fields['grid']['item_title']);

