<?php
/**
 * Object Type functions
 *
 * @package WordPress
 * @subpackage Object
 * @since 3.3
 */

/**
 * Creates the list of object types when the 'init' action is fired.
 *
 * @since 3.3
 */
function create_object_types() {
	global $wp_object_types;
	$wp_object_types = array(
		'post' => array( 'name' => __( 'Post' ) ),   // General case of a post type
		'page' => array( 'name' => __( 'Page' ) ),   // Special case of $post->post_type == 'page'
		'user' => array( 'name' => __( 'User' ) ),
		'term' => array( 'name' => __( 'Term' ) ),
		'term_taxonomy' => array( 'name' => __( 'Taxonomy Term' ) ),
		'term_relationship' => array( 'name' => __( 'Taxonomy Term Object' ) ),
		'link' => array( 'name' => __( 'Link' ) ),
		'comment' => array( 'name' => __( 'Comment' ) ),
		'option' => array( 'name' => __( 'Option' ) ),
		'postmeta' => array( 'name' => __( 'Post Metadata' ) ),
		'usermeta' => array( 'name' => __( 'User Metadata' ) ),
		'commentmeta' => array( 'name' => __( 'Comment Metadata' ) ),
		'site' => array( 'name' => __( 'Multisite Network' ) ),
		'blog' => array( 'name' => __( 'Multisite Site/Blog' ) ),
	);
	return $wp_object_types;
}
add_action( 'init', 'create_object_types', 0 );  // 0 is highest priority

/**
 * Return the list of object types
 *
 * @since 3.3
 */
function get_object_types() {
	global $wp_object_types;
	return apply_filters( 'get_object_types', $wp_object_types );
}

/**
 * Adds an object type.
 *
 * @since 3.3
 */
function add_object_type( $object_type, $args = array() ) {
	global $wp_object_types;
	$wp_object_types[ $object_type ] = $args;
	return $wp_object_types;
}

/**
 * Removes an object type.
 *
 * @since 3.3
 */
function remove_object_type( $object_type ) {
	global $wp_object_types;
	unset( $wp_object_types[ $object_type ] );
}
