<?php
/**
 * Tattoopress metaboxes
 *
 * @package WordPress
 * @subpackage Tattoopress
 * @version 3.3.4
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/**
 * Register metaboxes
 *
 * Pass a metabox array to generate metabox with the  Wolf Metaboxes plugin
 */
function tattoopress_register_metabox() {

	$body_metaboxes = array(
		'site_settings' => array(
			'title' => esc_html__( 'Layout', 'tattoopress' ),
			'page' => apply_filters( 'tattoopress_site_settings_post_types', array( 'post', 'page', 'plugin', 'video', 'product', 'gallery', 'theme', 'work', 'show', 'release', 'wpm_playlist', 'event', 'artist', 'mp-event' ) ),

			'metafields' => array(

				array(
					'label'	=> '',
					'id'	=> '_post_subheading',
					'type'	=> 'text',
				),

				array(
					'label'	=> esc_html__( 'Content Background Color', 'tattoopress' ),
					'id'	=> '_post_content_inner_bg_color',
					'type'	=> 'colorpicker',
					'desc' => esc_html__( 'If you use the page builder and set your row background setting to "no background", you may want to change the overall content background color.', 'tattoopress' ),
				),

				array(
					'label' => esc_html__( 'Loading Animation Type', 'tattoopress' ),
					'id' => '_post_loading_animation_type',
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
			 			'none' => esc_html__( 'None', 'tattoopress' ),
			 			'overlay' => esc_html__( 'Simple Overlay', 'tattoopress' ),
			 			'logo' => esc_html__( 'Overlay with Logo', 'tattoopress' ),
			 			'spinner-loader1' => esc_html__( 'Rotating plane', 'tattoopress' ),
						'spinner-loader2' => esc_html__( 'Double Pulse', 'tattoopress' ),
						'spinner-loader3' => esc_html__( 'Wave', 'tattoopress' ),
						'spinner-loader4' => esc_html__( 'Wandering cubes', 'tattoopress' ),
						'spinner-loader5' => esc_html__( 'Pulse', 'tattoopress' ),
						'spinner-loader6' => esc_html__( 'Chasing dots', 'tattoopress' ),
						'spinner-loader7' => esc_html__( 'Three bounce', 'tattoopress' ),
						'spinner-loader8' => esc_html__( 'Circle', 'tattoopress' ),
						'spinner-loader9' => esc_html__( 'Cube grid', 'tattoopress' ),
						'spinner-loader10' => esc_html__( 'Classic Loader', 'tattoopress' ),
						'spinner-loader11' => esc_html__( 'Folding cube', 'tattoopress' ),
						'spinner-loader12' => esc_html__( 'Ball Pulse', 'tattoopress' ),
						'spinner-loader13' => esc_html__( 'Ball Grid Pulse', 'tattoopress' ),
						'spinner-loader15' => esc_html__( 'Ball Clip Rotate Pulse', 'tattoopress' ),
						'spinner-loader16' => esc_html__( 'Ball Clip Rotate Pulse Multiple', 'tattoopress' ),
						'spinner-loader17' => esc_html__( 'Ball Pulse Rise', 'tattoopress' ),
						'spinner-loader19' => esc_html__( 'Ball Zigzag', 'tattoopress' ),
						'spinner-loader20' => esc_html__( 'Ball Zigzag Deflect', 'tattoopress' ),
						'spinner-loader21' => esc_html__( 'Ball Triangle Path', 'tattoopress' ),
						'spinner-loader22' => esc_html__( 'Ball Scale', 'tattoopress' ),
						'spinner-loader23' => esc_html__( 'Ball Line Scale', 'tattoopress' ),
						'spinner-loader24' => esc_html__( 'Ball Line Scale Party', 'tattoopress' ),
						'spinner-loader25' => esc_html__( 'Ball Scale Multiple', 'tattoopress' ),
						'spinner-loader26' => esc_html__( 'Ball Pulse Sync', 'tattoopress' ),
						'spinner-loader27' => esc_html__( 'Ball Beat', 'tattoopress' ),
						'spinner-loader28' => esc_html__( 'Ball Scale Ripple Multiple', 'tattoopress' ),
						'spinner-loader29' => esc_html__( 'Ball Spin Fade Loader', 'tattoopress' ),
						'spinner-loader30' => esc_html__( 'Line Spin Fade Loader', 'tattoopress' ),
						'spinner-loader31' => esc_html__( 'Pacman', 'tattoopress' ),
						'spinner-loader32' => esc_html__( 'Ball Grid Beat ', 'tattoopress' ),
					),
				),

				// array(
				// 	'label'	=> esc_html__( 'Body Background', 'tattoopress' ),
				// 	'id'	=> '_post_body_background_img',
				// 	'type'	=> 'image',
				// ),

				// array(
				// 	'label'	=> esc_html__( 'Body Background Position', 'tattoopress' ),
				// 	'id'	=> '_post_body_background_img_position',
				// 	'type' => 'select',
				// 	'choices' => array(
				// 		'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
				// 		'center top' => esc_html__( 'center top', 'tattoopress' ),
				// 		'center center' => esc_html__( 'center center', 'tattoopress' ),
				// 		'left top'  => esc_html__( 'left top', 'tattoopress' ),
				// 		'right top'  => esc_html__( 'right top', 'tattoopress' ),
				// 		'center bottom' => esc_html__( 'center bottom', 'tattoopress' ),
				// 		'left bottom'  => esc_html__( 'left bottom', 'tattoopress' ),
				// 		'right bottom'  => esc_html__( 'right bottom', 'tattoopress' ),
				// 		'left center'  => esc_html__( 'left center', 'tattoopress' ),
				// 		'right center' => esc_html__( 'right center', 'tattoopress' ),
				// 	),
				// ),
				// array(
				// 	'label'	=> esc_html__( 'Body Background Attachment', 'tattoopress' ),
				// 	'id'	=> '_post_body_background_img_attachment',
				// 	'type' => 'select',
				// 	'choices' => array(
				// 		'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
				// 		'scroll' => esc_html__( 'Scroll', 'tattoopress' ),
				// 		'fixed' => esc_html__( 'Fixed', 'tattoopress' ),
				// 	),
				// ),

				array(
					'label'	=> esc_html__( 'Accent Color', 'tattoopress' ),
					'id'	=> '_post_accent_color',
					'type'	=> 'colorpicker',
				),
			),
		),
	);

	$content_blocks = array(
			'' => '&mdash; ' . esc_html__( 'None', 'tattoopress' ) . ' &mdash;',
	);

	if ( class_exists( 'Wolf_Visual_Composer' ) && class_exists( 'Wolf_Vc_Content_Block' ) && defined( 'WPB_VC_VERSION' ) ) {
		// Content block option
		$content_block_posts = get_posts( 'post_type="wvc_content_block"&numberposts=-1' );

		$content_blocks = array(
			'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
			'none' => esc_html__( 'None', 'tattoopress' ),
		);
		if ( $content_block_posts ) {
			foreach ( $content_block_posts as $content_block_options ) {
				$content_blocks[ $content_block_options->ID ] = $content_block_options->post_title;
			}
		} else {
			$content_blocks[0] = esc_html__( 'No Content Block Yet', 'tattoopress' );
		}

		$body_metaboxes['site_settings']['metafields'][] = array(
			'label'	=> esc_html__( 'Post-header Block', 'tattoopress' ),
			'id'	=> '_post_after_header_block',
			'type'	=> 'select',
			'choices' => $content_blocks,
		);

		$body_metaboxes['site_settings']['metafields'][] = array(
			'label'	=> esc_html__( 'Pre-footer Block', 'tattoopress' ),
			'id'	=> '_post_before_footer_block',
			'type'	=> 'select',
			'choices' => $content_blocks,
		);

	}

	$header_metaboxes = array(
		'header_settings' => array(
			'title' => esc_html__( 'Header', 'tattoopress' ),
			'page' => apply_filters( 'tattoopress_header_settings_post_types', array( 'post', 'page', 'plugin', 'video', 'gallery', 'theme', 'work', 'show', 'release', 'wpm_playlist', 'event', 'artist', 'mp-event' ) ),

			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Header Layout', 'tattoopress' ),
					'id'	=> '_post_hero_layout',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'standard' => esc_html__( 'Standard', 'tattoopress' ),
						'big' => esc_html__( 'Big', 'tattoopress' ),
						'small' => esc_html__( 'Small', 'tattoopress' ),
						'fullheight' => esc_html__( 'Full Height', 'tattoopress' ),
						'none' => esc_html__( 'No Header', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Title Font Family', 'tattoopress' ),
					'id'	=> '_post_hero_title_font_family',
					'type'	=> 'font_family',
				),

				array(
					'label'	=> esc_html__( 'Font Transform', 'tattoopress' ),
					'id'	=> '_post_hero_title_font_transform',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'uppercase' => esc_html__( 'Uppercase', 'tattoopress' ),
						'none' => esc_html__( 'None', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Big Text', 'tattoopress' ),
					'id'	=> '_post_hero_title_bigtext',
					'type'	=> 'checkbox',
					'desc' => esc_html__( 'Enable "Big Text" for the title?', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Font Tone', 'tattoopress' ),
					'id'	=> '_post_hero_font_tone',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Light', 'tattoopress' ),
						'dark' => esc_html__( 'Dark', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Background Type', 'tattoopress' ),
					'id'	=> '_post_hero_background_type',
					'type'	=> 'select',
					'choices' => array(
						'featured-image' => esc_html__( 'Featured Image', 'tattoopress' ),
						'image' => esc_html__( 'Image', 'tattoopress' ),
						'video' => esc_html__( 'Video', 'tattoopress' ),
						'slideshow' => esc_html__( 'Slideshow', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Slideshow Images', 'tattoopress' ),
					'id'	=> '_post_hero_slideshow_ids',
					'type'	=> 'multiple_images',
					'dependency' => array( 'element' => '_post_hero_background_type', 'value' => array( 'slideshow' ) ),
				),

				array(
					'label'	=> esc_html__( 'Background', 'tattoopress' ),
					'id'	=> '_post_hero_background',
					'type'	=> 'background',
					'dependency' => array( 'element' => '_post_hero_background_type', 'value' => array( 'image' ) ),
				),

				array(
					'label'	=> esc_html__( 'Background Effect', 'tattoopress' ),
					'id'	=> '_post_hero_background_effect',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'zoomin' => esc_html__( 'Zoom', 'tattoopress' ),
						'parallax' => esc_html__( 'Parallax', 'tattoopress' ),
						'none' => esc_html__( 'None', 'tattoopress' ),
					),
					'dependency' => array( 'element' => '_post_hero_background_type', 'value' => array( 'image' ) ),
				),

				array(
					'label'	=> esc_html__( 'Video URL', 'tattoopress' ),
					'id'	=> '_post_hero_background_video_url',
					'type'	=> 'video',
					'dependency' => array( 'element' => '_post_hero_background_type', 'value' => array( 'video' ) ),
					'desc' => esc_html__( 'A mp4 or YouTube URL. The featured image will be used as image fallback when the video cannot be displayed.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Overlay', 'tattoopress' ),
					'id'	=> '_post_hero_overlay',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'custom' => esc_html__( 'Custom', 'tattoopress' ),
						'none' => esc_html__( 'None', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Overlay Color', 'tattoopress' ),
					'id'	=> '_post_hero_overlay_color',
					'type'	=> 'colorpicker',
					//'value' 	=> '#000000',
					'dependency' => array( 'element' => '_post_hero_overlay', 'value' => array( 'custom' ) ),
				),

				array(
					'label'	=> esc_html__( 'Overlay Opacity (in percent)', 'tattoopress' ),
					'id'	=> '_post_hero_overlay_opacity',
					'desc'	=> esc_html__( 'Adapt the header overlay opacity if needed', 'tattoopress' ),
					'type'	=> 'int',
					'placeholder'	=> 40,
					'dependency' => array( 'element' => '_post_hero_overlay', 'value' => array( 'custom' ) ),
				),

			),
		),
	);

	$menu_metaboxes = array(
			'menu_settings' => array(
				'title' => esc_html__( 'Menu', 'tattoopress' ),
				'page' => apply_filters( 'tattoopress_menu_settings_post_types', array( 'post', 'page', 'plugin', 'video', 'product', 'gallery', 'theme', 'work', 'show', 'release', 'wpm_playlist', 'event', 'artist', 'mp-event' ) ),

			'metafields' => array(
				array(
					'label'	=> esc_html__( 'Menu Layout', 'tattoopress' ),
					'id'	=> '_post_menu_layout',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						//'top-logo' => esc_html__( 'Top Logo', 'tattoopress' ),
						'top-right' => esc_html__( 'Top Right', 'tattoopress' ),
						'top-justify' => esc_html__( 'Top Justify', 'tattoopress' ),
						'top-justify-left' => esc_html__( 'Top Justify Left', 'tattoopress' ),
						'centered-logo' => esc_html__( 'Centered', 'tattoopress' ),
						'top-left' => esc_html__( 'Top Left', 'tattoopress' ),
						//'offcanvas' => esc_html__( 'Off Canvas', 'tattoopress' ),
						'overlay' => esc_html__( 'Overlay', 'tattoopress' ),
						'lateral' => esc_html__( 'Lateral', 'tattoopress' ),
						'none' => esc_html__( 'No Menu', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Menu Width', 'tattoopress' ),
					'id'	=> '_post_menu_width',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'wide' => esc_html__( 'Wide', 'tattoopress' ),
						'boxed' => esc_html__( 'Boxed', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Megamenu Width', 'tattoopress' ),
					'id'	=> '_post_mega_menu_width',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'boxed' => esc_html__( 'Boxed', 'tattoopress' ),
						'wide' => esc_html__( 'Wide', 'tattoopress' ),
						'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Menu Style', 'tattoopress' ),
					'id'	=> '_post_menu_style',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'solid' => esc_html__( 'Solid', 'tattoopress' ),
						'semi-transparent-white' => esc_html__( 'Semi-transparent White', 'tattoopress' ),
						'semi-transparent-black' => esc_html__( 'Semi-transparent Black', 'tattoopress' ),
						'transparent' => esc_html__( 'Transparent', 'tattoopress' ),
						//'none' => esc_html__( 'No Menu', 'tattoopress' ),
					),
				),

				/*array(
					'label'	=> esc_html__( 'Menu Skin', 'tattoopress' ),
					'id'	=> '_post_menu_skin',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Light', 'tattoopress' ),
						'dark' => esc_html__( 'Dark', 'tattoopress' ),
						//'none' => esc_html__( 'No Menu', 'tattoopress' ),
					),
				),*/

				'menu_sticky_type' => array(
					'id' =>'_post_menu_sticky_type',
					'label' => esc_html__( 'Sticky Menu', 'tattoopress' ),
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'none' => esc_html__( 'Disabled', 'tattoopress' ),
						'soft' => esc_html__( 'Sticky on scroll up', 'tattoopress' ),
						'hard' => esc_html__( 'Always sticky', 'tattoopress' ),
					),
				),

				'sticky_menu_transparent' => array(
					'id' => '_post_sticky_menu_transparent',
					'label' => esc_html__( 'Transparent Sticky Menu', 'tattoopress' ),
					'type' => 'checkbox',
				),

				// array(
				// 	'label'	=> esc_html__( 'Sticky Menu Skin', 'tattoopress' ),
				// 	'id'	=> '_post_menu_skin',
				// 	'type'	=> 'select',
				// 	'choices' => array(
				// 		'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
				// 		'light' => esc_html__( 'Light', 'tattoopress' ),
				// 		'dark' => esc_html__( 'Dark', 'tattoopress' ),
				// 		//'none' => esc_html__( 'No Menu', 'tattoopress' ),
				// 	),
				// ),

				array(
					'id' => '_post_menu_cta_content_type',
					'label' => esc_html__( 'Additional Content', 'tattoopress' ),
					'type' => 'select',
					'default' => 'icons',
					'choices' => array_merge(
						array(
							'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						),
						apply_filters( 'tattoopress_menu_cta_content_type_options', array(
							'search_icon' => esc_html__( 'Search Icon', 'tattoopress' ),
							'secondary-menu' => esc_html__( 'Secondary Menu', 'tattoopress' ),
						) ),
						array( 'none' => esc_html__( 'None', 'tattoopress' ) )
					),
				),

				array(
					'id' => '_post_menu_socials',
					'label' => esc_html__( 'Menu Socials', 'tattoopress' ),
					'type' => 'text',
					'dependency' => array( 'element' => '_post_menu_cta_content_type', 'value' => array( 'socials' ) ),
					'desc' => esc_html__( 'The list of social services to display in the menu. (eg: facebook,twitter,instagram).', 'tattoopress' ),
				),

				array(
					'id' => '_post_side_panel_position',
					'label' => esc_html__( 'Side Panel', 'tattoopress' ),
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'none' => esc_html__( 'None', 'tattoopress' ),
						'right' => esc_html__( 'At Right', 'tattoopress' ),
						'left' => esc_html__( 'At Left', 'tattoopress' ),
					),
					'desc' => esc_html__( 'Note that it will be disable with a vertical menu layout (overlay, offcanvas etc...).', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Side Panel Background', 'tattoopress' ),
					'id'	=> '_post_side_panel_bg_img',
					'type'	=> 'image',
				),

				array(
					'id' => '_post_logo_visibility',
					'label' => esc_html__( 'Logo Visibility', 'tattoopress' ),
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'always' => esc_html__( 'Always', 'tattoopress' ),
						'sticky_menu' => esc_html__( 'When menu is sticky only', 'tattoopress' ),
						'hidden' => esc_html__( 'Hidden', 'tattoopress' ),
					),
				),

				array(
					'id' => '_post_menu_items_visibility',
					'label' => esc_html__( 'Menu Items Visibility', 'tattoopress' ),
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'show' => esc_html__( 'Visible', 'tattoopress' ),
						'hidden' => esc_html__( 'Hidden', 'tattoopress' ),
					),
					'desc' => esc_html__( 'If, for some reason, you need to hide the menu items but leave the logo, additional content and side panel.', 'tattoopress' ),
				),

				'menu_breakpoint' => array(
					'id' =>'_post_menu_breakpoint',
					'label' => esc_html__( 'Mobile Menu Breakpoint', 'tattoopress' ),
					'type' => 'text',
					'desc' => esc_html__( 'Use this field if you want to overwrite the mobile menu breakpoint.', 'tattoopress' ),
				),
			),
		)
	);

	$footer_metaboxes = array(
		'footer_settings' => array(
				'title' => esc_html__( 'Footer', 'tattoopress' ),
				'page' => apply_filters( 'tattoopress_menu_settings_post_types', array( 'post', 'page', 'plugin', 'video', 'product', 'gallery', 'theme', 'work', 'show', 'release', 'wpm_playlist', 'event' ) ),

			'metafields' => array(
				array(
					'label'	=> esc_html__( 'Page Footer', 'tattoopress' ),
					'id'	=> '_post_footer_type',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'hidden' => esc_html__( 'No Footer', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Hide Bottom Bar', 'tattoopress' ),
					'id'	=> '_post_bottom_bar_hidden',
					'type'	=> 'select',
					'choices' => array(
						'' => esc_html__( 'No', 'tattoopress' ),
						'yes' => esc_html__( 'Yes', 'tattoopress' ),
					),
				),
			),
		)
	);

	/************** Post options ******************/

	$product_options = array();
	$product_options[] = esc_html__( 'WooCommerce not installed', 'tattoopress' );

	if ( class_exists( 'WooCommerce' ) ) {
		$product_posts = get_posts( 'post_type="product"&numberposts=-1' );

		$product_options = array();
		if ( $product_posts ) {

			$product_options[] = esc_html__( 'Not linked', 'tattoopress' );

			foreach ( $product_posts as $product ) {
				$product_options[ $product->ID ] = $product->post_title;
			}
		} else {
			$product_options[ esc_html__( 'No product yet', 'tattoopress' ) ] = 0;
		}
	}

	$post_metaboxes = array(
		'post_settings' => array(
			'title' => esc_html__( 'Post', 'tattoopress' ),
			'page' => array( 'post' ),
			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Font Color Tone', 'tattoopress' ),
					'id'	=> '_post_post_skin',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Dark', 'tattoopress' ),
						'dark' => esc_html__( 'Light', 'tattoopress' ),
					),
					'desc'	=> esc_html__( 'The font color tone of the post in the loop.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Post Layout', 'tattoopress' ),
					'id'	=> '_post_layout',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'sidebar-right' => esc_html__( 'Sidebar Right', 'tattoopress' ),
						'sidebar-left' => esc_html__( 'Sidebar Left', 'tattoopress' ),
						'no-sidebar' => esc_html__( 'No Sidebar', 'tattoopress' ),
						'fullwidth' => esc_html__( 'Full width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Feature a Product', 'tattoopress' ),
					'id'	=> '_post_wc_product_id',
					'type'	=> 'select',
					'choices' => $product_options,
					'desc'	=> esc_html__( 'A "Shop Now" buton will be displayed in the metro layout.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Hide Featured Image in Post', 'tattoopress' ),
					'id'	=> '_post_hide_single_post_featured_image',
					'type'	=> 'checkbox',
				),
			),
		),
	);

	/************** Product options ******************/
	$product_metaboxes = array(

		'product_options' => array(
			'title' => esc_html__( 'Product', 'tattoopress' ),
			'page' => array( 'product' ),
			'metafields' => array(

				/*array(
					'label'	=> esc_html__( 'Font Color Tone', 'tattoopress' ),
					'id'	=> '_post_product_skin',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Dark', 'tattoopress' ),
						'dark' => esc_html__( 'Light', 'tattoopress' ),
					),
					'desc'	=> esc_html__( 'The font color tone of the post in the loop.', 'tattoopress' ),
				),*/

				array(
					'label'	=> esc_html__( 'Background Color', 'tattoopress' ),
					'id'	=> '_post_product_bg_color',
					'type'	=> 'colorpicker',
					'desc'	=> esc_html__( 'Background color of the post in the loop. You can use this option if your product image is a image in PNG format with a transparent background.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Label', 'tattoopress' ),
					'id'	=> '_post_product_label',
					'type'	=> 'text',
					'placeholder' => esc_html__( '-30%', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Layout', 'tattoopress' ),
					'id'	=> '_post_product_single_layout',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'standard' => esc_html__( 'Standard', 'tattoopress' ),
						'sidebar-right' => esc_html__( 'Sidebar Right', 'tattoopress' ),
						'sidebar-left' => esc_html__( 'Sidebar Left', 'tattoopress' ),
						'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'MP3 Label', 'tattoopress' ),
					'id'	=> '_post_product_mp3_label',
					'type'	=> 'text',
					'desc' => esc_html__( 'An optional label to describe the song.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Size Chart Image', 'tattoopress' ),
					'id'	=> '_post_wc_product_size_chart_img',
					'type'	=> 'image',
					'desc' => esc_html__( 'You can set a size chart image in the product category options. You can overwrite the category size chart for this product by uploading another image here.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Hide Size Chart Image', 'tattoopress' ),
					'id'	=> '_post_wc_product_hide_size_chart_img',
					'type'	=> 'checkbox',
				),

				array(
					'label'	=> esc_html__( 'Menu Font Tone', 'tattoopress' ),
					'id'	=> '_post_hero_font_tone',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Light', 'tattoopress' ),
						'dark' => esc_html__( 'Dark', 'tattoopress' ),
					),
					'desc' => esc_html__( 'By default the menu style is set to "solid" on single product page. If you change the menu style, you may need to adujst the menu color tone here.', 'tattoopress' ),
				),

				'menu_sticky_type' => array(
					'id' =>'_post_product_sticky',
					'label' => esc_html__( 'Stacked Images', 'tattoopress' ),
					'type' => 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'yes' => esc_html__( 'Yes', 'tattoopress' ),
						'no' => esc_html__( 'No', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Disable Image Zoom', 'tattoopress' ),
					'id'	=> '_post_product_disable_easyzoom',
					'type'	=> 'checkbox',
					'desc' => esc_html__( 'Disable image zoom on this product if it\'s enabled in the customizer.', 'tattoopress' ),
				),
			),
		),
	);

	/************** Product options ******************/

	$product_options = array();
	$product_options[] = esc_html__( 'WooCommerce not installed', 'tattoopress' );

	if ( class_exists( 'WooCommerce' ) ) {
		$product_posts = get_posts( 'post_type="product"&numberposts=-1' );

		$product_options = array();
		if ( $product_posts ) {

			$product_options[] = esc_html__( 'Not linked', 'tattoopress' );

			foreach ( $product_posts as $product ) {
				$product_options[ $product->ID ] = $product->post_title;
			}
		} else {
			$product_options[ esc_html__( 'No product yet', 'tattoopress' ) ] = 0;
		}
	}

	// if ( class_exists( 'Wolf_Playlist_Manager' ) ) {
	// 	// Player option
	// 	$playlist_posts = get_posts( 'post_type="wpm_playlist"&numberposts=-1' );

	// 	$playlist = array( '' => esc_html__( 'None', 'tattoopress' ) );
	// 	if ( $playlist_posts ) {
	// 		foreach ( $playlist_posts as $playlist_options ) {
	// 			$playlist[ $playlist_options->ID ] = $playlist_options->post_title;
	// 		}
	// 	} else {
	// 		$playlist[0] = esc_html__( 'No Playlist Yet', 'tattoopress' );
	// 	}

	// 	$product_metaboxes['product_options']['metafields'][] = array(
	// 		'label'	=> esc_html__( 'Playlist', 'tattoopress' ),
	// 		'id'	=> '_post_product_playlist_id',
	// 		'type'	=> 'select',
	// 		'choices' => $playlist,
	// 		'desc' => esc_html__( 'It will overwrite the single player.', 'tattoopress' ),
	// 	);

	// 	$product_metaboxes['product_options']['metafields'][] = array(
	// 		'label'	=> esc_html__( 'Playlist Skin', 'tattoopress' ),
	// 		'id'	=> '_post_product_playlist_skin',
	// 		'type'	=> 'select',
	// 		'choices' => array(
	// 			'dark' => esc_html__( 'Dark', 'tattoopress' ),
	// 			'light' => esc_html__( 'Light', 'tattoopress' ),
	// 		),
	// 	);
	// }

	/************** Portfolio options ******************/
	$work_metaboxes = array(

		'work_options' => array(
			'title' => esc_html__( 'Work', 'tattoopress' ),
			'page' => array( 'work' ),
			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Font Color Tone', 'tattoopress' ),
					'id'	=> '_post_work_skin',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Dark', 'tattoopress' ),
						'dark' => esc_html__( 'Light', 'tattoopress' ),
					),
					'desc'	=> esc_html__( 'The font color tone of the post in the loop.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Client', 'tattoopress' ),
					'id'	=> '_work_client',
					'type'	=> 'text',
				),

				array(
					'label'	=> esc_html__( 'Link', 'tattoopress' ),
					'id'		=> '_work_link',
					'type'	=> 'text',
				),

				array(
					'label'	=> esc_html__( 'Width', 'tattoopress' ),
					'id'	=> '_post_width',
					'type'	=> 'select',
					'choices' => array(
						'standard' => esc_html__( 'Standard', 'tattoopress' ),
						'wide' => esc_html__( 'Wide', 'tattoopress' ),
						'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Layout', 'tattoopress' ),
					'id'	=> '_post_layout',
					'type'	=> 'select',
					'choices' => array(
						'centered' => esc_html__( 'Centered', 'tattoopress' ),
						'sidebar-right' => esc_html__( 'Excerpt & Info at Right', 'tattoopress' ),
						'sidebar-left' => esc_html__( 'Excerpt & Info at Left', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Excerpt & Info Position', 'tattoopress' ),
					'id'	=> '_post_work_info_position',
					'type'	=> 'select',
					'choices' => array(
						'after' => esc_html__( 'After Content', 'tattoopress' ),
						'before' => esc_html__( 'Before Content', 'tattoopress' ),
						'none' => esc_html__( 'Hidden', 'tattoopress' ),
					),
					'dependency' => array( 'element' => '_post_layout', 'value' => array( 'centered' ) ),
				),

				// array(
				// 	'label'	=> esc_html__( 'Featured', 'tattoopress' ),
				// 	'id'	=> '_post_featured',
				// 	'type'	=> 'checkbox',
				// 	'desc'	=> esc_html__( 'The featured image will be display bigger in the "metro" layout.', 'tattoopress' ),
				// ),
			),
		),
	);

	/************** Video options ******************/
	$video_metaboxes = array(
		'video_settings' => array(
			'title' => esc_html__( 'Video', 'tattoopress' ),
			'page' => array( 'video' ),
			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Layout', 'tattoopress' ),
					'id'	=> '_post_layout',
					'type'	=> 'select',
					'choices' => array(
						'' => esc_html__( 'Default', 'tattoopress' ),
						'standard' => esc_html__( 'Standard', 'tattoopress' ),
						'sidebar-right' => esc_html__( 'Sidebar Right', 'tattoopress' ),
						'sidebar-left' => esc_html__( 'Sidebar Left', 'tattoopress' ),
						'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),
			),
		),
	);

	/************** Events options ******************/

	$event_metaboxes = array(
		'event_options' => array(
			'title' => esc_html__( 'Event', 'tattoopress' ),
			'page' => array( 'event' ),
			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Font Color Tone', 'tattoopress' ),
					'id'	=> '_post_event_skin',
					'type'	=> 'select',
					'choices' => array(
						'' => '&mdash; ' . esc_html__( 'Default', 'tattoopress' ) . ' &mdash;',
						'light' => esc_html__( 'Dark', 'tattoopress' ),
						'dark' => esc_html__( 'Light', 'tattoopress' ),
					),
					'desc'	=> esc_html__( 'The font color tone of the post in the loop.', 'tattoopress' ),
				),
			),
		),
	);

	$release_metaboxes = array(
		'release_options' => array(
			'title' => esc_html__( 'Release', 'tattoopress' ),
			'page' => array( 'release' ),
			'metafields' => array(

				array(
					'label'	=> esc_html__( 'Secondary Feature image', 'tattoopress' ),
					'id'	=> '_release_secondary_featured_image',
					'type'	=> 'image',

				),

				array(
					'label'	=> esc_html__( 'Cover Type', 'tattoopress' ),
					'id'	=> '_release_cover_type',
					'type'	=> 'select',
					'choices' => array(
						'cd' => esc_html__( 'CD', 'tattoopress' ),
						'vinyl' => esc_html__( 'Vinyl', 'tattoopress' ),
						//'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Release Width', 'tattoopress' ),
					'id'	=> '_post_width',
					'type'	=> 'select',
					'choices' => array(
						'standard' => esc_html__( 'Standard', 'tattoopress' ),
						'wide' => esc_html__( 'Wide', 'tattoopress' ),
						//'fullwidth' => esc_html__( 'Full Width', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'Release Layout', 'tattoopress' ),
					'id'	=> '_post_layout',
					'type'	=> 'select',
					'choices' => array(
						'sidebar-left' => esc_html__( 'Content Right', 'tattoopress' ),
						'sidebar-right' => esc_html__( 'Content Left', 'tattoopress' ),
						//'centered' => esc_html__( 'Centered', 'tattoopress' ),
					),
				),

				array(
					'label'	=> esc_html__( 'WooCommerce Product ID', 'tattoopress' ),
					'id'	=> '_post_wc_product_id',
					'type'	=> 'select',
					'choices' => $product_options,
					'desc'	=> esc_html__( 'You can link this release to a WooCommerce product to add an "Add to cart" button.', 'tattoopress' ),
				),

				array(
					'label'	=> esc_html__( 'Featured', 'tattoopress' ),
					'id'	=> '_post_featured',
					'type'	=> 'checkbox',
					'desc'	=> esc_html__( 'May be used depending on layout option.', 'tattoopress' ),
				),
			),
		),
	);

	/************** One pager options ******************/
	$one_page_metaboxes = array(
		'one_page_settings' => array(
			'title' => esc_html__( 'One-Page', 'tattoopress' ),
			'page' => array( 'post', 'page', 'work', 'product', 'release' ),
			'metafields' => array(
				array(
					'label'	=> esc_html__( 'One-Page Navigation', 'tattoopress' ),
					'id'	=> '_post_one_page_menu',
					'type'	=> 'select',
					'choices' => array(
						'' => esc_html__( 'No', 'tattoopress' ),
						'replace_main_nav' => esc_html__( 'Yes', 'tattoopress' ),
					),
					'desc'	=> tattoopress_kses( __( 'Activate to replace the main menu by a one-page scroll navigation. <strong>NB: Every row must have a unique name set in the row settings "Advanced" tab.</strong>', 'tattoopress' ) ),
				),
				array(
					'label'	=> esc_html__( 'One-Page Bullet Navigation', 'tattoopress' ),
					'id'	=> '_post_scroller',
					'type'	=> 'checkbox',
					'desc'	=> tattoopress_kses( __( 'Activate to create a section scroller navigation. <strong>NB: Every row must have a unique name set in the row settings "Advanced" tab.</strong>', 'tattoopress' ) ),
				),
				array(
					'label'	=> sprintf( esc_html__( 'Enable %s animations', 'tattoopress' ), 'fullPage' ),
					'id'	=> '_post_fullpage',
					'type'	=> 'select',
					'choices' => array(
						'' => esc_html__( 'No', 'tattoopress' ),
						'yes' => esc_html__( 'Yes', 'tattoopress' ),
					),
					'desc' => esc_html__( 'Activate to enable advanced scroll animations between sections. Some of your row setting may be disabled to suit the global page design.', 'tattoopress' ),
				),

				array(
					'label'	=> sprintf( esc_html__( '%s animation transition', 'tattoopress' ), 'fullPage' ),
					'id'	=> '_post_fullpage_transition',
					'type'	=> 'select',
					'choices' => array(
						'mix' => esc_html__( 'Special', 'tattoopress' ),
						'parallax' => esc_html__( 'Parallax', 'tattoopress' ),
						'fade' => esc_html__( 'Fade', 'tattoopress' ),
						'zoom' => esc_html__( 'Zoom', 'tattoopress' ),
						'curtain' => esc_html__( 'Curtain', 'tattoopress' ),
						'slide' => esc_html__( 'Slide', 'tattoopress' ),
					),
					'dependency' => array( 'element' => '_post_fullpage', 'value' => array( 'yes' ) ),
				),

				array(
					'label'	=> sprintf( esc_html__( '%s animation duration', 'tattoopress' ), 'fullPage' ),
					'id'	=> '_post_fullpage_animtime',
					'type'	=> 'text',
					'placeholder' => 1000,
					'dependency' => array( 'element' => '_post_fullpage', 'value' => array( 'yes' ) ),
				),
			),
		),
	);

	$all_metaboxes = array_merge(
		apply_filters( 'tattoopress_body_metaboxes', $body_metaboxes ),
		apply_filters( 'tattoopress_post_metaboxes', $post_metaboxes ),
		apply_filters( 'tattoopress_product_metaboxes', $product_metaboxes ),
		apply_filters( 'tattoopress_release_metaboxes', $release_metaboxes ),
		apply_filters( 'tattoopress_event_metaboxes', $event_metaboxes ),
		apply_filters( 'tattoopress_work_metaboxes', $work_metaboxes ),
		apply_filters( 'tattoopress_video_metaboxes',  $video_metaboxes ),
		apply_filters( 'tattoopress_header_metaboxes', $header_metaboxes ),
		apply_filters( 'tattoopress_menu_metaboxes', $menu_metaboxes ),
		apply_filters( 'tattoopress_footer_metaboxes', $footer_metaboxes )
	);

	if ( class_exists( 'Wolf_Visual_Composer' ) && defined( 'WPB_VC_VERSION' ) ) {
		$all_metaboxes = $all_metaboxes + apply_filters( 'tattoopress_one_page_metaboxes', $one_page_metaboxes );
	}

	if ( class_exists( 'Wolf_Metaboxes' ) ) {
		new Wolf_Metaboxes( apply_filters( 'tattoopress_metaboxes', $all_metaboxes ) );
	}
}
tattoopress_register_metabox();
