/wp-includes/post.php
PHP | 5631 lines | 2469 code | 716 blank | 2446 comment | 681 complexity | 657ca22ac722bd54d20ad760d6a3a3a9 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- /**
- * Post functions and post utility function.
- *
- * @package WordPress
- * @subpackage Post
- * @since 1.5.0
- */
- //
- // Post Type Registration
- //
- /**
- * Creates the initial post types when 'init' action is fired.
- *
- * @since 2.9.0
- */
- function create_initial_post_types() {
- register_post_type( 'post', array(
- 'labels' => array(
- 'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
- ),
- 'public' => true,
- '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
- '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
- 'capability_type' => 'post',
- 'map_meta_cap' => true,
- 'hierarchical' => false,
- 'rewrite' => false,
- 'query_var' => false,
- 'delete_with_user' => true,
- 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
- ) );
- register_post_type( 'page', array(
- 'labels' => array(
- 'name_admin_bar' => _x( 'Page', 'add new on admin bar' ),
- ),
- 'public' => true,
- 'publicly_queryable' => false,
- '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
- '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
- 'capability_type' => 'page',
- 'map_meta_cap' => true,
- 'hierarchical' => true,
- 'rewrite' => false,
- 'query_var' => false,
- 'delete_with_user' => true,
- 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
- ) );
- register_post_type( 'attachment', array(
- 'labels' => array(
- 'name' => _x('Media', 'post type general name'),
- 'name_admin_bar' => _x( 'Media', 'add new from admin bar' ),
- 'add_new' => _x( 'Add New', 'add new media' ),
- 'edit_item' => __( 'Edit Media' ),
- 'view_item' => __( 'View Attachment Page' ),
- ),
- 'public' => true,
- 'show_ui' => true,
- '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
- '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
- 'capability_type' => 'post',
- 'capabilities' => array(
- 'create_posts' => 'upload_files',
- ),
- 'map_meta_cap' => true,
- 'hierarchical' => false,
- 'rewrite' => false,
- 'query_var' => false,
- 'show_in_nav_menus' => false,
- 'delete_with_user' => true,
- 'supports' => array( 'title', 'author', 'comments' ),
- ) );
- add_post_type_support( 'attachment:audio', 'thumbnail' );
- add_post_type_support( 'attachment:video', 'thumbnail' );
- register_post_type( 'revision', array(
- 'labels' => array(
- 'name' => __( 'Revisions' ),
- 'singular_name' => __( 'Revision' ),
- ),
- 'public' => false,
- '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
- '_edit_link' => 'revision.php?revision=%d', /* internal use only. don't use this when registering your own post type. */
- 'capability_type' => 'post',
- 'map_meta_cap' => true,
- 'hierarchical' => false,
- 'rewrite' => false,
- 'query_var' => false,
- 'can_export' => false,
- 'delete_with_user' => true,
- 'supports' => array( 'author' ),
- ) );
- register_post_type( 'nav_menu_item', array(
- 'labels' => array(
- 'name' => __( 'Navigation Menu Items' ),
- 'singular_name' => __( 'Navigation Menu Item' ),
- ),
- 'public' => false,
- '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
- 'hierarchical' => false,
- 'rewrite' => false,
- 'delete_with_user' => false,
- 'query_var' => false,
- ) );
- register_post_status( 'publish', array(
- 'label' => _x( 'Published', 'post' ),
- 'public' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop( 'Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ),
- ) );
- register_post_status( 'future', array(
- 'label' => _x( 'Scheduled', 'post' ),
- 'protected' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
- ) );
- register_post_status( 'draft', array(
- 'label' => _x( 'Draft', 'post' ),
- 'protected' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ),
- ) );
- register_post_status( 'pending', array(
- 'label' => _x( 'Pending', 'post' ),
- 'protected' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
- ) );
- register_post_status( 'private', array(
- 'label' => _x( 'Private', 'post' ),
- 'private' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ),
- ) );
- register_post_status( 'trash', array(
- 'label' => _x( 'Trash', 'post' ),
- 'internal' => true,
- '_builtin' => true, /* internal use only. */
- 'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
- 'show_in_admin_status_list' => true,
- ) );
- register_post_status( 'auto-draft', array(
- 'label' => 'auto-draft',
- 'internal' => true,
- '_builtin' => true, /* internal use only. */
- ) );
- register_post_status( 'inherit', array(
- 'label' => 'inherit',
- 'internal' => true,
- '_builtin' => true, /* internal use only. */
- 'exclude_from_search' => false,
- ) );
- }
- add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
- /**
- * Retrieve attached file path based on attachment ID.
- *
- * By default the path will go through the 'get_attached_file' filter, but
- * passing a true to the $unfiltered argument of get_attached_file() will
- * return the file path unfiltered.
- *
- * The function works by getting the single post meta name, named
- * '_wp_attached_file' and returning it. This is a convenience function to
- * prevent looking up the meta name and provide a mechanism for sending the
- * attached filename through a filter.
- *
- * @since 2.0.0
- *
- * @param int $attachment_id Attachment ID.
- * @param bool $unfiltered Whether to apply filters.
- * @return string|bool The file path to where the attached file should be, false otherwise.
- */
- function get_attached_file( $attachment_id, $unfiltered = false ) {
- $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
- // If the file is relative, prepend upload dir
- if ( $file && 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
- $file = $uploads['basedir'] . "/$file";
- if ( $unfiltered )
- return $file;
- /**
- * Filter the attached file based on the given ID.
- *
- * @since 2.1.0
- *
- * @param string $file Path to attached file.
- * @param int $attachment_id Attachment ID.
- */
- return apply_filters( 'get_attached_file', $file, $attachment_id );
- }
- /**
- * Update attachment file path based on attachment ID.
- *
- * Used to update the file path of the attachment, which uses post meta name
- * '_wp_attached_file' to store the path of the attachment.
- *
- * @since 2.1.0
- *
- * @param int $attachment_id Attachment ID
- * @param string $file File path for the attachment
- * @return bool True on success, false on failure.
- */
- function update_attached_file( $attachment_id, $file ) {
- if ( !get_post( $attachment_id ) )
- return false;
- /**
- * Filter the path to the attached file to update.
- *
- * @since 2.1.0
- *
- * @param string $file Path to the attached file to update.
- * @param int $attachment_id Attachment ID.
- */
- $file = apply_filters( 'update_attached_file', $file, $attachment_id );
- if ( $file = _wp_relative_upload_path( $file ) )
- return update_post_meta( $attachment_id, '_wp_attached_file', $file );
- else
- return delete_post_meta( $attachment_id, '_wp_attached_file' );
- }
- /**
- * Return relative path to an uploaded file.
- *
- * The path is relative to the current upload dir.
- *
- * @since 2.9.0
- *
- * @param string $path Full path to the file
- * @return string relative path on success, unchanged path on failure.
- */
- function _wp_relative_upload_path( $path ) {
- $new_path = $path;
- $uploads = wp_upload_dir();
- if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) {
- $new_path = str_replace( $uploads['basedir'], '', $new_path );
- $new_path = ltrim( $new_path, '/' );
- }
- /**
- * Filter the relative path to an uploaded file.
- *
- * @since 2.9.0
- *
- * @param string $new_path Relative path to the file.
- * @param string $path Full path to the file.
- */
- return apply_filters( '_wp_relative_upload_path', $new_path, $path );
- }
- /**
- * Retrieve all children of the post parent ID.
- *
- * Normally, without any enhancements, the children would apply to pages. In the
- * context of the inner workings of WordPress, pages, posts, and attachments
- * share the same table, so therefore the functionality could apply to any one
- * of them. It is then noted that while this function does not work on posts, it
- * does not mean that it won't work on posts. It is recommended that you know
- * what context you wish to retrieve the children of.
- *
- * Attachments may also be made the child of a post, so if that is an accurate
- * statement (which needs to be verified), it would then be possible to get
- * all of the attachments for a post. Attachments have since changed since
- * version 2.5, so this is most likely unaccurate, but serves generally as an
- * example of what is possible.
- *
- * The arguments listed as defaults are for this function and also of the
- * {@link get_posts()} function. The arguments are combined with the
- * get_children defaults and are then passed to the {@link get_posts()}
- * function, which accepts additional arguments. You can replace the defaults in
- * this function, listed below and the additional arguments listed in the
- * {@link get_posts()} function.
- *
- * The 'post_parent' is the most important argument and important attention
- * needs to be paid to the $args parameter. If you pass either an object or an
- * integer (number), then just the 'post_parent' is grabbed and everything else
- * is lost. If you don't specify any arguments, then it is assumed that you are
- * in The Loop and the post parent will be grabbed for from the current post.
- *
- * The 'post_parent' argument is the ID to get the children. The 'numberposts'
- * is the amount of posts to retrieve that has a default of '-1', which is
- * used to get all of the posts. Giving a number higher than 0 will only
- * retrieve that amount of posts.
- *
- * The 'post_type' and 'post_status' arguments can be used to choose what
- * criteria of posts to retrieve. The 'post_type' can be anything, but WordPress
- * post types are 'post', 'pages', and 'attachments'. The 'post_status'
- * argument will accept any post status within the write administration panels.
- *
- * @see get_posts() Has additional arguments that can be replaced.
- * @internal Claims made in the long description might be inaccurate.
- *
- * @since 2.0.0
- *
- * @param mixed $args Optional. User defined arguments for replacing the defaults.
- * @param string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N.
- * @return array Array of children, where the type of each element is determined by $output parameter.
- * Empty array on failure.
- */
- function get_children($args = '', $output = OBJECT) {
- $kids = array();
- if ( empty( $args ) ) {
- if ( isset( $GLOBALS['post'] ) ) {
- $args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
- } else {
- return $kids;
- }
- } elseif ( is_object( $args ) ) {
- $args = array('post_parent' => (int) $args->post_parent );
- } elseif ( is_numeric( $args ) ) {
- $args = array('post_parent' => (int) $args);
- }
- $defaults = array(
- 'numberposts' => -1, 'post_type' => 'any',
- 'post_status' => 'any', 'post_parent' => 0,
- );
- $r = wp_parse_args( $args, $defaults );
- $children = get_posts( $r );
- if ( ! $children )
- return $kids;
- if ( ! empty( $r['fields'] ) )
- return $children;
- update_post_cache($children);
- foreach ( $children as $key => $child )
- $kids[$child->ID] = $children[$key];
- if ( $output == OBJECT ) {
- return $kids;
- } elseif ( $output == ARRAY_A ) {
- foreach ( (array) $kids as $kid )
- $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);
- return $weeuns;
- } elseif ( $output == ARRAY_N ) {
- foreach ( (array) $kids as $kid )
- $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));
- return $babes;
- } else {
- return $kids;
- }
- }
- /**
- * Get extended entry info (<!--more-->).
- *
- * There should not be any space after the second dash and before the word
- * 'more'. There can be text or space(s) after the word 'more', but won't be
- * referenced.
- *
- * The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before
- * the <code><!--more--></code>. The 'extended' key has the content after the
- * <code><!--more--></code> comment. The 'more_text' key has the custom "Read More" text.
- *
- * @since 1.0.0
- *
- * @param string $post Post content.
- * @return array Post before ('main'), after ('extended'), and custom readmore ('more_text').
- */
- function get_extended($post) {
- //Match the new style more links
- if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
- list($main, $extended) = explode($matches[0], $post, 2);
- $more_text = $matches[1];
- } else {
- $main = $post;
- $extended = '';
- $more_text = '';
- }
- // ` leading and trailing whitespace
- $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
- $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
- $more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
- return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
- }
- /**
- * Retrieves post data given a post ID or post object.
- *
- * See {@link sanitize_post()} for optional $filter values. Also, the parameter
- * $post, must be given as a variable, since it is passed by reference.
- *
- * @since 1.5.1
- * @link http://codex.wordpress.org/Function_Reference/get_post
- *
- * @param int|WP_Post $post Optional. Post ID or post object.
- * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
- * @param string $filter Optional, default is raw.
- * @return WP_Post|null WP_Post on success or null on failure
- */
- function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
- if ( empty( $post ) && isset( $GLOBALS['post'] ) )
- $post = $GLOBALS['post'];
- if ( is_a( $post, 'WP_Post' ) ) {
- $_post = $post;
- } elseif ( is_object( $post ) ) {
- if ( empty( $post->filter ) ) {
- $_post = sanitize_post( $post, 'raw' );
- $_post = new WP_Post( $_post );
- } elseif ( 'raw' == $post->filter ) {
- $_post = new WP_Post( $post );
- } else {
- $_post = WP_Post::get_instance( $post->ID );
- }
- } else {
- $_post = WP_Post::get_instance( $post );
- }
- if ( ! $_post )
- return null;
- $_post = $_post->filter( $filter );
- if ( $output == ARRAY_A )
- return $_post->to_array();
- elseif ( $output == ARRAY_N )
- return array_values( $_post->to_array() );
- return $_post;
- }
- /**
- * WordPress Post class.
- *
- * @since 3.5.0
- *
- */
- final class WP_Post {
- /**
- * Post ID.
- *
- * @var int
- */
- public $ID;
- /**
- * ID of post author.
- *
- * A numeric string, for compatibility reasons.
- *
- * @var string
- */
- public $post_author = 0;
- /**
- * The post's local publication time.
- *
- * @var string
- */
- public $post_date = '0000-00-00 00:00:00';
- /**
- * The post's GMT publication time.
- *
- * @var string
- */
- public $post_date_gmt = '0000-00-00 00:00:00';
- /**
- * The post's content.
- *
- * @var string
- */
- public $post_content = '';
- /**
- * The post's title.
- *
- * @var string
- */
- public $post_title = '';
- /**
- * The post's excerpt.
- *
- * @var string
- */
- public $post_excerpt = '';
- /**
- * The post's status.
- *
- * @var string
- */
- public $post_status = 'publish';
- /**
- * Whether comments are allowed.
- *
- * @var string
- */
- public $comment_status = 'open';
- /**
- * Whether pings are allowed.
- *
- * @var string
- */
- public $ping_status = 'open';
- /**
- * The post's password in plain text.
- *
- * @var string
- */
- public $post_password = '';
- /**
- * The post's slug.
- *
- * @var string
- */
- public $post_name = '';
- /**
- * URLs queued to be pinged.
- *
- * @var string
- */
- public $to_ping = '';
- /**
- * URLs that have been pinged.
- *
- * @var string
- */
- public $pinged = '';
- /**
- * The post's local modified time.
- *
- * @var string
- */
- public $post_modified = '0000-00-00 00:00:00';
- /**
- * The post's GMT modified time.
- *
- * @var string
- */
- public $post_modified_gmt = '0000-00-00 00:00:00';
- /**
- * A utility DB field for post content.
- *
- *
- * @var string
- */
- public $post_content_filtered = '';
- /**
- * ID of a post's parent post.
- *
- * @var int
- */
- public $post_parent = 0;
- /**
- * The unique identifier for a post, not necessarily a URL, used as the feed GUID.
- *
- * @var string
- */
- public $guid = '';
- /**
- * A field used for ordering posts.
- *
- * @var int
- */
- public $menu_order = 0;
- /**
- * The post's type, like post or page.
- *
- * @var string
- */
- public $post_type = 'post';
- /**
- * An attachment's mime type.
- *
- * @var string
- */
- public $post_mime_type = '';
- /**
- * Cached comment count.
- *
- * A numeric string, for compatibility reasons.
- *
- * @var string
- */
- public $comment_count = 0;
- /**
- * Stores the post object's sanitization level.
- *
- * Does not correspond to a DB field.
- *
- * @var string
- */
- public $filter;
- public static function get_instance( $post_id ) {
- global $wpdb;
- $post_id = (int) $post_id;
- if ( ! $post_id )
- return false;
- $_post = wp_cache_get( $post_id, 'posts' );
- if ( ! $_post ) {
- $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
- if ( ! $_post )
- return false;
- $_post = sanitize_post( $_post, 'raw' );
- wp_cache_add( $_post->ID, $_post, 'posts' );
- } elseif ( empty( $_post->filter ) ) {
- $_post = sanitize_post( $_post, 'raw' );
- }
- return new WP_Post( $_post );
- }
- public function __construct( $post ) {
- foreach ( get_object_vars( $post ) as $key => $value )
- $this->$key = $value;
- }
- public function __isset( $key ) {
- if ( 'ancestors' == $key )
- return true;
- if ( 'page_template' == $key )
- return ( 'page' == $this->post_type );
- if ( 'post_category' == $key )
- return true;
- if ( 'tags_input' == $key )
- return true;
- return metadata_exists( 'post', $this->ID, $key );
- }
- public function __get( $key ) {
- if ( 'page_template' == $key && $this->__isset( $key ) ) {
- return get_post_meta( $this->ID, '_wp_page_template', true );
- }
- if ( 'post_category' == $key ) {
- if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
- $terms = get_the_terms( $this, 'category' );
- if ( empty( $terms ) )
- return array();
- return wp_list_pluck( $terms, 'term_id' );
- }
- if ( 'tags_input' == $key ) {
- if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
- $terms = get_the_terms( $this, 'post_tag' );
- if ( empty( $terms ) )
- return array();
- return wp_list_pluck( $terms, 'name' );
- }
- // Rest of the values need filtering
- if ( 'ancestors' == $key )
- $value = get_post_ancestors( $this );
- else
- $value = get_post_meta( $this->ID, $key, true );
- if ( $this->filter )
- $value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
- return $value;
- }
- public function filter( $filter ) {
- if ( $this->filter == $filter )
- return $this;
- if ( $filter == 'raw' )
- return self::get_instance( $this->ID );
- return sanitize_post( $this, $filter );
- }
- public function to_array() {
- $post = get_object_vars( $this );
- foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
- if ( $this->__isset( $key ) )
- $post[ $key ] = $this->__get( $key );
- }
- return $post;
- }
- }
- /**
- * Retrieve ancestors of a post.
- *
- * @since 2.5.0
- *
- * @param int|WP_Post $post Post ID or post object.
- * @return array Ancestor IDs or empty array if none are found.
- */
- function get_post_ancestors( $post ) {
- $post = get_post( $post );
- if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID )
- return array();
- $ancestors = array();
- $id = $ancestors[] = $post->post_parent;
- while ( $ancestor = get_post( $id ) ) {
- // Loop detection: If the ancestor has been seen before, break.
- if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
- break;
- $id = $ancestors[] = $ancestor->post_parent;
- }
- return $ancestors;
- }
- /**
- * Retrieve data from a post field based on Post ID.
- *
- * Examples of the post field will be, 'post_type', 'post_status', 'post_content',
- * etc and based off of the post object property or key names.
- *
- * The context values are based off of the taxonomy filter functions and
- * supported values are found within those functions.
- *
- * @since 2.3.0
- * @uses sanitize_post_field() See for possible $context values.
- *
- * @param string $field Post field name.
- * @param int|WP_Post $post Post ID or post object.
- * @param string $context Optional. How to filter the field. Default is 'display'.
- * @return string The value of the post field on success, empty string on failure.
- */
- function get_post_field( $field, $post, $context = 'display' ) {
- $post = get_post( $post );
- if ( !$post )
- return '';
- if ( !isset($post->$field) )
- return '';
- return sanitize_post_field($field, $post->$field, $post->ID, $context);
- }
- /**
- * Retrieve the mime type of an attachment based on the ID.
- *
- * This function can be used with any post type, but it makes more sense with
- * attachments.
- *
- * @since 2.0.0
- *
- * @param int|WP_Post $ID Optional. Post ID or post object.
- * @return string|bool The mime type on success, false on failure.
- */
- function get_post_mime_type($ID = '') {
- $post = get_post($ID);
- if ( is_object($post) )
- return $post->post_mime_type;
- return false;
- }
- /**
- * Retrieve the post status based on the Post ID.
- *
- * If the post ID is of an attachment, then the parent post status will be given
- * instead.
- *
- * @since 2.0.0
- *
- * @param int|WP_Post $ID Optional. Post ID or post object.
- * @return string|bool Post status on success, false on failure.
- */
- function get_post_status($ID = '') {
- $post = get_post($ID);
- if ( !is_object($post) )
- return false;
- if ( 'attachment' == $post->post_type ) {
- if ( 'private' == $post->post_status )
- return 'private';
- // Unattached attachments are assumed to be published
- if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
- return 'publish';
- // Inherit status from the parent
- if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
- $parent_post_status = get_post_status( $post->post_parent );
- if ( 'trash' == $parent_post_status ) {
- return get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
- } else {
- return $parent_post_status;
- }
- }
- }
- return $post->post_status;
- }
- /**
- * Retrieve all of the WordPress supported post statuses.
- *
- * Posts have a limited set of valid status values, this provides the
- * post_status values and descriptions.
- *
- * @since 2.5.0
- *
- * @return array List of post statuses.
- */
- function get_post_statuses() {
- $status = array(
- 'draft' => __('Draft'),
- 'pending' => __('Pending Review'),
- 'private' => __('Private'),
- 'publish' => __('Published')
- );
- return $status;
- }
- /**
- * Retrieve all of the WordPress support page statuses.
- *
- * Pages have a limited set of valid status values, this provides the
- * post_status values and descriptions.
- *
- * @since 2.5.0
- *
- * @return array List of page statuses.
- */
- function get_page_statuses() {
- $status = array(
- 'draft' => __('Draft'),
- 'private' => __('Private'),
- 'publish' => __('Published')
- );
- return $status;
- }
- /**
- * Register a post status. Do not use before init.
- *
- * A simple function for creating or modifying a post status based on the
- * parameters given. The function will accept an array (second optional
- * parameter), along with a string for the post status name.
- *
- *
- * Optional $args contents:
- *
- * label - A descriptive name for the post status marked for translation. Defaults to $post_status.
- * public - Whether posts of this status should be shown in the front end of the site. Defaults to true.
- * exclude_from_search - Whether to exclude posts with this post status from search results. Defaults to false.
- * show_in_admin_all_list - Whether to include posts in the edit listing for their post type
- * show_in_admin_status_list - Show in the list of statuses with post counts at the top of the edit
- * listings, e.g. All (12) | Published (9) | My Custom Status (2) ...
- *
- * Arguments prefixed with an _underscore shouldn't be used by plugins and themes.
- *
- * @since 3.0.0
- * @uses $wp_post_statuses Inserts new post status object into the list
- *
- * @param string $post_status Name of the post status.
- * @param array|string $args See above description.
- */
- function register_post_status($post_status, $args = array()) {
- global $wp_post_statuses;
- if (!is_array($wp_post_statuses))
- $wp_post_statuses = array();
- // Args prefixed with an underscore are reserved for internal use.
- $defaults = array(
- 'label' => false,
- 'label_count' => false,
- 'exclude_from_search' => null,
- '_builtin' => false,
- 'public' => null,
- 'internal' => null,
- 'protected' => null,
- 'private' => null,
- 'publicly_queryable' => null,
- 'show_in_admin_status_list' => null,
- 'show_in_admin_all_list' => null,
- );
- $args = wp_parse_args($args, $defaults);
- $args = (object) $args;
- $post_status = sanitize_key($post_status);
- $args->name = $post_status;
- if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
- $args->internal = true;
- if ( null === $args->public )
- $args->public = false;
- if ( null === $args->private )
- $args->private = false;
- if ( null === $args->protected )
- $args->protected = false;
- if ( null === $args->internal )
- $args->internal = false;
- if ( null === $args->publicly_queryable )
- $args->publicly_queryable = $args->public;
- if ( null === $args->exclude_from_search )
- $args->exclude_from_search = $args->internal;
- if ( null === $args->show_in_admin_all_list )
- $args->show_in_admin_all_list = !$args->internal;
- if ( null === $args->show_in_admin_status_list )
- $args->show_in_admin_status_list = !$args->internal;
- if ( false === $args->label )
- $args->label = $post_status;
- if ( false === $args->label_count )
- $args->label_count = array( $args->label, $args->label );
- $wp_post_statuses[$post_status] = $args;
- return $args;
- }
- /**
- * Retrieve a post status object by name
- *
- * @since 3.0.0
- * @uses $wp_post_statuses
- * @see register_post_status
- * @see get_post_statuses
- *
- * @param string $post_status The name of a registered post status
- * @return object A post status object
- */
- function get_post_status_object( $post_status ) {
- global $wp_post_statuses;
- if ( empty($wp_post_statuses[$post_status]) )
- return null;
- return $wp_post_statuses[$post_status];
- }
- /**
- * Get a list of all registered post status objects.
- *
- * @since 3.0.0
- * @uses $wp_post_statuses
- * @see register_post_status
- * @see get_post_status_object
- *
- * @param array|string $args An array of key => value arguments to match against the post status objects.
- * @param string $output The type of output to return, either post status 'names' or 'objects'. 'names' is the default.
- * @param string $operator The logical operation to perform. 'or' means only one element
- * from the array needs to match; 'and' means all elements must match. The default is 'and'.
- * @return array A list of post status names or objects
- */
- function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
- global $wp_post_statuses;
- $field = ('names' == $output) ? 'name' : false;
- return wp_filter_object_list($wp_post_statuses, $args, $operator, $field);
- }
- /**
- * Whether the post type is hierarchical.
- *
- * A false return value might also mean that the post type does not exist.
- *
- * @since 3.0.0
- * @see get_post_type_object
- *
- * @param string $post_type Post type name
- * @return bool Whether post type is hierarchical.
- */
- function is_post_type_hierarchical( $post_type ) {
- if ( ! post_type_exists( $post_type ) )
- return false;
- $post_type = get_post_type_object( $post_type );
- return $post_type->hierarchical;
- }
- /**
- * Checks if a post type is registered.
- *
- * @since 3.0.0
- * @uses get_post_type_object()
- *
- * @param string $post_type Post type name
- * @return bool Whether post type is registered.
- */
- function post_type_exists( $post_type ) {
- return (bool) get_post_type_object( $post_type );
- }
- /**
- * Retrieve the post type of the current post or of a given post.
- *
- * @since 2.1.0
- *
- * @param int|WP_Post $post Optional. Post ID or post object.
- * @return string|bool Post type on success, false on failure.
- */
- function get_post_type( $post = null ) {
- if ( $post = get_post( $post ) )
- return $post->post_type;
- return false;
- }
- /**
- * Retrieve a post type object by name
- *
- * @since 3.0.0
- * @uses $wp_post_types
- * @see register_post_type
- * @see get_post_types
- *
- * @param string $post_type The name of a registered post type
- * @return object A post type object
- */
- function get_post_type_object( $post_type ) {
- global $wp_post_types;
- if ( empty($wp_post_types[$post_type]) )
- return null;
- return $wp_post_types[$post_type];
- }
- /**
- * Get a list of all registered post type objects.
- *
- * @since 2.9.0
- * @uses $wp_post_types
- * @see register_post_type
- *
- * @param array|string $args An array of key => value arguments to match against the post type objects.
- * @param string $output The type of output to return, either post type 'names' or 'objects'. 'names' is the default.
- * @param string $operator The logical operation to perform. 'or' means only one element
- * from the array needs to match; 'and' means all elements must match. The default is 'and'.
- * @return array A list of post type names or objects
- */
- function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) {
- global $wp_post_types;
- $field = ('names' == $output) ? 'name' : false;
- return wp_filter_object_list($wp_post_types, $args, $operator, $field);
- }
- /**
- * Register a post type. Do not use before init.
- *
- * A function for creating or modifying a post type based on the
- * parameters given. The function will accept an array (second optional
- * parameter), along with a string for the post type name.
- *
- * Optional $args contents:
- *
- * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used.
- * - labels - An array of labels for this post type.
- * * If not set, post labels are inherited for non-hierarchical types and page labels for hierarchical ones.
- * * You can see accepted values in {@link get_post_type_labels()}.
- * - description - A short descriptive summary of what the post type is. Defaults to blank.
- * - public - Whether a post type is intended for use publicly either via the admin interface or by front-end users.
- * * Defaults to false.
- * * While the default settings of exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus are
- * inherited from public, each does not rely on this relationship and controls a very specific intention.
- * - hierarchical - Whether the post type is hierarchical (e.g. page). Defaults to false.
- * - exclude_from_search - Whether to exclude posts with this post type from front end search results.
- * * If not set, the opposite of public's current value is used.
- * - publicly_queryable - Whether queries can be performed on the front end for the post type as part of parse_request().
- * * ?post_type={post_type_key}
- * * ?{post_type_key}={single_post_slug}
- * * ?{post_type_query_var}={single_post_slug}
- * * If not set, the default is inherited from public.
- * - show_ui - Whether to generate a default UI for managing this post type in the admin.
- * * If not set, the default is inherited from public.
- * - show_in_menu - Where to show the post type in the admin menu.
- * * If true, the post type is shown in its own top level menu.
- * * If false, no menu is shown
- * * If a string of an existing top level menu (eg. 'tools.php' or 'edit.php?post_type=page'), the post type will
- * be placed as a sub menu of that.
- * * show_ui must be true.
- * * If not set, the default is inherited from show_ui
- * - show_in_nav_menus - Makes this post type available for selection in navigation menus.
- * * If not set, the default is inherited from public.
- * - show_in_admin_bar - Makes this post type available via the admin bar.
- * * If not set, the default is inherited from show_in_menu
- * - menu_position - The position in the menu order the post type should appear.
- * * show_in_menu must be true
- * * Defaults to null, which places it at the bottom of its area.
- * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon.
- * * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme.
- * This should begin with 'data:image/svg+xml;base64,'.
- * * Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-chart-pie'.
- * * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
- * - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'.
- * * May be passed as an array to allow for alternative plurals when using this argument as a base to construct the
- * capabilities, e.g. array('story', 'stories').
- * - capabilities - Array of capabilities for this post type.
- * * By default the capability_type is used as a base to construct capabilities.
- * * You can see accepted values in {@link get_post_type_capabilities()}.
- * - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false.
- * - supports - An alias for calling add_post_type_support() directly. Defaults to title and editor.
- * * See {@link add_post_type_support()} for documentation.
- * - register_meta_box_cb - Provide a callback function that sets up the meta boxes
- * for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback.
- * - taxonomies - An array of taxonomy identifiers that will be registered for the post type.
- * * Default is no taxonomies.
- * * Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type().
- * - has_archive - True to enable post type archives. Default is false.
- * * Will generate the proper rewrite rules if rewrite is enabled.
- * - rewrite - Triggers the handling of rewrites for this post type. Defaults to true, using $post_type as slug.
- * * To prevent rewrite, set to false.
- * * To specify rewrite rules, an array can be passed with any of these keys
- * * 'slug' => string Customize the permastruct slug. Defaults to $post_type key
- * * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.
- * * 'feeds' => bool Should a feed permastruct be built for this post type. Inherits default from has_archive.
- * * 'pages' => bool Should the permastruct provide for pagination. Defaults to true.
- * * 'ep_mask' => const Assign an endpoint mask.
- * * If not specified and permalink_epmask is set, inherits from permalink_epmask.
- * * If not specified and permalink_epmask is not set, defaults to EP_PERMALINK
- * - query_var - Sets the query_var key for this post type. Defaults to $post_type key
- * * If false, a post type cannot be loaded at ?{query_var}={post_slug}
- * * If specified as a string, the query ?{query_var_string}={post_slug} will be valid.
- * - can_export - Allows this post type to be exported. Defaults to true.
- * - delete_with_user - Whether to delete posts of this type when deleting a user.
- * * If true, posts of this type belonging to the user will be moved to trash when then user is deleted.
- * * If false, posts of this type belonging to the user will *not* be trashed or deleted.
- * * If not set (the default), posts are trashed if post_type_supports('author'). Otherwise posts are not trashed or deleted.
- * - _builtin - true if this post type is a native or "built-in" post_type. THIS IS FOR INTERNAL USE ONLY!
- * - _edit_link - URL segement to use for edit link of this post type. THIS IS FOR INTERNAL USE ONLY!
- *
- * @since 2.9.0
- * @uses $wp_post_types Inserts new post type object into the list
- * @uses $wp_rewrite Gets default feeds
- * @uses $wp Adds query vars
- *
- * @param string $post_type Post type key, must not exceed 20 characters.
- * @param array|string $args See optional args description above.
- * @return object|WP_Error the registered post type object, or an error object.
- */
- function register_post_type( $post_type, $args = array() ) {
- global $wp_post_types, $wp_rewrite, $wp;
- if ( ! is_array( $wp_post_types ) )
- $wp_post_types = array();
- // Args prefixed with an underscore are reserved for internal use.
- $defaults = array(
- 'labels' => array(),
- 'description' => '',
- 'public' => false,
- 'hierarchical' => false,
- 'exclude_from_search' => null,
- 'publicly_queryable' => null,
- 'show_ui' => null,
- 'show_in_menu' => null,
- 'show_in_nav_menus' => null,
- 'show_in_admin_bar' => null,
- 'menu_position' => null,
- 'menu_icon' => null,
- 'capability_type' => 'post',
- 'capabilities' => array(),
- 'map_meta_cap' => null,
- 'supports' => array(),
- 'register_meta_box_cb' => null,
- 'taxonomies' => array(),
- 'has_archive' => false,
- 'rewrite' => true,
- 'query_var' => true,
- 'can_export' => true,
- 'delete_with_user' => null,
- '_builtin' => false,
- '_edit_link' => 'post.php?post=%d',
- );
- $args = wp_parse_args( $args, $defaults );
- $args = (object) $args;
- $post_type = sanitize_key( $post_type );
- $args->name = $post_type;
- if ( strlen( $post_type ) > 20 )
- return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
- // If not set, default to the setting for public.
- if ( null === $args->publicly_queryable )
- $args->publicly_queryable = $args->public;
- // If not set, default to the setting for public.
- if ( null === $args->show_ui )
- $args->show_ui = $args->public;
- // If not set, default to the setting for show_ui.
- if ( null === $args->show_in_menu || ! $args->show_ui )
- $args->show_in_menu = $args->show_ui;
- // If not set, default to the whether the full UI is shown.
- if ( null === $args->show_in_admin_bar )
- $args->show_in_admin_bar = true === $args->show_in_menu;
- // If not set, default to the setting for public.
- if ( null === $args->show_in_nav_menus )
- $args->show_in_nav_menus = $args->public;
- // If not set, default to true if not public, false if public.
- if ( null === $args->exclude_from_search )
- $args->exclude_from_search = !$args->public;
- // Back compat with quirky handling in version 3.0. #14122
- if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) )
- $args->map_meta_cap = true;
- // If not set, default to false.
- if ( null === $args->map_meta_cap )
- $args->map_meta_cap = false;
- $args->cap = get_post_type_capabilities( $args );
- unset( $args->capabilities );
- if ( is_array( $args->capability_type ) )
- $args->capability_type = $args->capability_type[0];
- if ( ! empty( $args->supports ) ) {
- add_post_type_support( $post_type, $args->supports );
- unset( $args->supports );
- } elseif ( false !== $args->supports ) {
- // Add default features
- add_post_type_support( $post_type, array( 'title', 'editor' ) );
- }
- if ( false !== $args->query_var && ! empty( $wp ) ) {
- if ( true === $args->query_var )
- $args->query_var = $post_type;
- else
- $args->query_var = sanitize_title_with_dashes( $args->query_var );
- $wp->add_query_var( $args->query_var );
- }
- if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
- if ( ! is_array( $args->rewrite ) )
- $args->rewrite = array();
- if ( empty( $args->rewrite['slug'] ) )
- $args->rewrite['slug'] = $post_type;
- if ( ! isset( $args->rewrite['with_front'] ) )
- $args->rewrite['with_front'] = true;
- if ( ! isset( $args->rewrite['pages'] ) )
- $args->rewrite['pages'] = true;
- if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
- $args->rewrite['feeds'] = (bool) $args->has_archive;
- if ( ! isset( $args->rewrite['ep_mask'] ) ) {
- if ( isset( $args->permalink_epmask ) )
- $args->rewrite['ep_mask'] = $args->permalink_epmask;
- else
- $args->rewrite['ep_mask'] = EP_PERMALINK;
- }
- if ( $args->hierarchical )
- add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" );
- else
- add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
- if ( $args->has_archive ) {
- $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
- if ( $args->rewrite['with_front'] )
- $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
- else
- $archive_slug = $wp_rewrite->root . $archive_slug;
- add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
- if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
- $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
- add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
- add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
- }
- if ( $args->rewrite['pages'] )
- add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
- }
- $permastruct_args = $args->rewrite;
- $permastruct_args['feed'] = $permastruct_args['feeds'];
- add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $permastruct_args );
- }
- if ( $args->register_meta_box_cb )
- add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 );
- $args->labels = get_post_type_labels( $args );
- $args->label = $args->labels->name;
- $wp_post_types[ $post_type ] = $args;
- add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 );
- foreach ( $args->taxonomies as $taxonomy ) {
- register_taxonomy_for_object_type( $taxonomy, $post_type );
- }
- /**
- * Fires after a post type is registered.
- *
- * @since 3.3.0
- *
- * @param string $post_type Post type.
- * @param array $args Arguments used to register the post type.
- */
- do_action( 'registered_post_type', $post_type, $args );
- return $args;
- }
- /**
- * Builds an object with all post type capabilities out of a post type object
- *
- * Post type capabilities use the 'capability_type' argument as a base, if the
- * capability is not set in the 'capabilities' argument array or if the
- * 'capabilities' argument is not supplied.
- *
- * The capability_type argument can optionally be registered as an array, with
- * the first value being singular and the second plural, e.g. array('story, 'stories')
- * Otherwise, an 's' will be added to the value for the plural form. After
- * registration, capability_type will always be a string of the singular value.
- *
- * By default, seven keys are accepted as part of the capabilities array:
- *
- * - edit_post, read_post, and delete_post are meta capabilities, which are then
- * generally mapped to corresponding primitive capabilities depending on the
- * context, which would be the post being edited/read/deleted and the user or
- * role being checked. Thus these capabilities would generally not be granted
- * directly to users or roles.
- *
- * - edit_posts - Controls whether objects of this post type can be edited.
- * - edit_others_posts - Controls whether objects of this type owned by other users
- * can be edited. If the post type does not support an author, then this will
- * behave like edit_posts.
- * - publish_posts - Controls publishing objects of this post type.
- * - read_private_posts - Controls whether private objects can be read.
- *
- * These four primitive capabilities are checked in core in various locations.
- * There are also seven other primitive capabilities which are not referenced
- * directly in core, except in map_meta_cap(), which takes the three aforementioned
- * meta capabilities and translates them into one or more primitive capabilities
- * that must then be checked against the user or role, depending on the context.
- *
- * - read - Controls whether objects of this post type can be read.
- * - delete_posts - Controls whether objects of this post type can be deleted.
- * - delete_private_posts - Controls whether private objects can be deleted.
- * - delete_published_posts - Controls whether published objects can be deleted.
- * - delete_others_posts - Controls whether objects owned by other users can be
- * can be deleted. If the post type does not support an author, then this will
- * behave like delete_posts.
- * - edit_private_posts - Controls whether private objects can be edited.
- * - edit_published_posts - Controls whether published objects can be edited.
- *
- * These additional capabilities are only used in map_meta_cap(). Thus, they are
- * only assigned by default if the post type is registered with the 'map_meta_cap'
- * argument set to true (default is false).
- *
- * @see map_meta_cap()
- * @since 3.0.0
- *
- * @param object $args Post type registration arguments
- * @return object object with all the capabilities as member variables
- */
- function get_post_type_capabilities( $args ) {
- if ( ! is_array( $args->capability_type ) )
- $args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
- // Singular base for meta capabilities, plural base for primitive capabilities.
- list( $singular_base, $plural_base ) = $args->capability_type;
- $default_capabilities = array(
- // Meta capabilities
- 'edit_post' => 'edit_' . $singular_base,
- 'read_post' => 'read_' . $singular_base,
- 'delete_post' => 'delete_' . $singular_base,
- // Primitive capabilities used outside of map_meta_cap():
- 'edit_posts' => 'edit_' . $plural_base,
- 'edit_others_posts' => 'edit_others_' . $plural_base,
- 'publish_posts' => 'publish_' . $plural_base,
- 'read_private_posts' => 'read_private_' . $plural_base,
- );
- // Primitive capabilities used within map_meta_cap():
- if ( $args->map_meta_cap ) {
- $default_capabilities_for_mapping = array(
- 'read' => 'read',
- 'delete_posts' => 'delete_' . $plural_base,
- 'delete_private_posts' => 'delete_private_' . $plural_base,
- 'delete_published_posts' => 'delete_published_' . $plural_base,
- 'delete_others_posts' => 'delete_others_' . $plural_base,
- 'edit_private_posts' => 'edit_private_' . $plural_base,
- 'edit_published_posts' => 'edit_published_' . $plural_base,
- );
- $default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping );
- }
- $capabilities = array_merge( $default_capabilities, $args->capabilities );
- // Post creation capability simply maps to edit_posts by default:
- if ( ! isset( $capabilities['create_posts'] ) )
- $capabilities['create_posts'] = $capabilities['edit_posts'];
- // Remember meta capabilities for future reference.
- if ( $args->map_meta_cap )
- _post_type_meta_capabilities( $capabilities );
- return (object) $capabilities;
- }
- /**
- * Stores or returns a list of post type meta caps for map_meta_cap().
- *
- * @since 3.1.0
- * @access private
- */
- function _post_type_meta_capabilities( $capabilities = null ) {
- static $meta_caps = array();
- if ( null === $capabilities )
- return $meta_caps;
- foreach ( $capabilities as $core => $custom ) {
- if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) )
- $meta_caps[ $custom ] = $core;
- }
- }
- /**
- * Builds an object with all post type labels out of a post type object
- *
- * Accepted keys of the label array in the post type object:
- * - name - general name for the post type, usually plural. The same and overridden by $post_type_object->label. Default is Posts/Pages
- * - singular_name - name for one object of this post type. Default is Post/Page
- * - add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example: <code>_x('Add New', 'product');</code>
- * - add_new_item - Default is Add New Post/Add New Page
- * - edit_item - Default is Edit Post/Edit Page
- * - new_item - Default is New Post/New Page
- * - view_item - Default is View Post/View Page
- * - search_items - Default is Search Posts/Search Pages
- * - not_found - Def…
Large files files are truncated, but you can click here to view the full file