<?php







class Bunch_Post_types



{



	



	function __construct()



	{



		// Hook into the 'init' action



		//add_action( 'init', array( $this, 'bistro_slider' ), 0 );

		$this->bistro_slider();

		



	}



	



	function labels( $names = '', $labels = array() )



	{



		$default =  array(



			'name'                => _x( 'Slides', 'Slides', BUNCH_NAME ),



			'singular_name'       => _x( 'Slide', 'Slide', BUNCH_NAME ),



			'menu_name'           => __( 'Slidr', BUNCH_NAME ),



			'parent_item_colon'   => __( 'Parent Slide:', BUNCH_NAME ),



			'all_items'           => __( 'All Slides', BUNCH_NAME ),



			'view_item'           => __( 'View Slide', BUNCH_NAME ),



			'add_new_item'        => __( 'Add New Slide', BUNCH_NAME ),



			'add_new'             => __( 'New Slide', BUNCH_NAME ),



			'edit_item'           => __( 'Edit Slide', BUNCH_NAME ),



			'update_item'         => __( 'Update Slide', BUNCH_NAME ),



			'search_items'        => __( 'Search Slides', BUNCH_NAME ),



			'not_found'           => __( 'No Slides found', BUNCH_NAME ),



			'not_found_in_trash'  => __( 'No Slides found in Trash', BUNCH_NAME ),



		);



		



		foreach( $default as $k => $v ){



			$default[$k] = str_replace( array('Slide', 'Slides'), $names, $v);



		}



		$labels = wp_parse_args( $labels, $default );



		



		return $labels;



	}



	



	function args( $args = array() )



	{



		$default = array(



			'label'               => __( 'bistro_slider', BUNCH_NAME ),



			'labels'              => array(),



			'supports'            => array( 'title', 'editor', 'thumbnail', 'custom-fields'),



			'hierarchical'        => false,



			'public'              => true,



			'show_ui'             => true,



			'show_in_menu'        => true,



			'show_in_nav_menus'   => true,



			'show_in_admin_bar'   => true,



			'menu_position'       => 5,



			'menu_icon'           => '',



			'can_export'          => true,



			'has_archive'         => false,



			'exclude_from_search' => false,



			'publicly_queryable'  => true,



			'rewrite'             => array(),



			'capability_type'     => 'post',



		);



		$args = wp_parse_args( $args, $default );



		return $args;



	}



	



	// Register Custom Post Type



	function bistro_slider() {







		



		$settings = include( BUNCH_TH_ROOT.'includes/resource/post_types.php');



		



		foreach( $options as $k => $v )



		{



			$labels = $this->labels(bunch_set( $v, 'labels'), bunch_set( $v, 'label_args' ) );	



	



			$rewrite = array(



				'slug'                => bunch_set( $v, 'slug' ),



				'with_front'          => true,



				'pages'               => true,



				'feeds'               => false,



			);



		



			$args = $this->args( array('labels'=>$labels, 'supports'=>bunch_set( $v, 'supports'), 'rewrite'=>$rewrite) );



			$args = wp_parse_args( bunch_set( $v, 'args' ), $args );



			register_post_type( $k, $args );



		}







	}







}