WordPress.org

Make WordPress Core

Ticket #24265: 24265.diff

File 24265.diff, 5.5 KB (added by DrewAPicture, 8 years ago)
  • wp-includes/revision.php

     
    1313 * to be inserted into the posts table as a post revision. Otherwise, returns
    1414 * an array whose keys are the post fields to be saved for post revisions.
    1515 *
    16  * @package WordPress
    17  * @subpackage Post_Revisions
    1816 * @since 2.6.0
    1917 * @access private
     18 *
    2019 * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields.
    2120 *
    2221 * @param array $post Optional a post array to be processed for insertion as a post revision.
     
    6463 *
    6564 * @since 3.6
    6665 * @access private
     66 *
    6767 * @return array An array of meta keys that should be revisioned.
    6868 */
    6969function _wp_post_revision_meta_keys() {
     
    8585 * Typically used immediately after post updates.
    8686 * Adds a copy of the current post as a revision, so latest revision always matches current post
    8787 *
    88  * @package WordPress
    89  * @subpackage Post_Revisions
    9088 * @since 2.6.0
    9189 *
    9290 * @uses _wp_put_post_revision()
     
    184182 * specified post. If the optional $user_id is passed, returns the autosave for that user
    185183 * otherwise returns the latest autosave.
    186184 *
    187  * @package WordPress
    188  * @subpackage Post_Revisions
    189185 * @since 2.6.0
     186 *
    190187 * @uses wp_get_post_revisions()
    191188 *
    192189 * @param int $post_id The post ID.
     
    212209/**
    213210 * Determines if the specified post is a revision.
    214211 *
    215  * @package WordPress
    216  * @subpackage Post_Revisions
    217212 * @since 2.6.0
    218213 *
    219214 * @param int|object $post Post ID or post object.
     
    229224/**
    230225 * Determines if the specified post is an autosave.
    231226 *
    232  * @package WordPress
    233  * @subpackage Post_Revisions
    234227 * @since 2.6.0
    235228 *
    236229 * @param int|object $post Post ID or post object.
     
    249242/**
    250243 * Inserts post data into the posts table as a post revision.
    251244 *
    252  * @package WordPress
    253  * @subpackage Post_Revisions
    254245 * @since 2.6.0
     246 * @access private
    255247 *
    256248 * @uses wp_insert_post()
    257249 *
     
    303295/**
    304296 * Gets a post revision.
    305297 *
    306  * @package WordPress
    307  * @subpackage Post_Revisions
    308298 * @since 2.6.0
    309299 *
    310300 * @uses get_post()
    311301 *
    312  * @param int|object $post Post ID or post object
     302 * @param int|object $post The post ID or object.
    313303 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N.
    314  * @param string $filter Optional sanitation filter. @see sanitize_post()
    315  * @return mixed Null if error or post object if success
     304 * @param string $filter Optional sanitation filter. @see sanitize_post().
     305 * @return mixed Null if error or post object if success.
    316306 */
    317307function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
    318308        $null = null;
     
    339329 *
    340330 * Can restore a past revision using all fields of the post revision, or only selected fields.
    341331 *
    342  * @package WordPress
    343  * @subpackage Post_Revisions
    344332 * @since 2.6.0
    345333 *
    346334 * @uses wp_get_post_revision()
     
    405393 *
    406394 * Deletes the row from the posts table corresponding to the specified revision.
    407395 *
    408  * @package WordPress
    409  * @subpackage Post_Revisions
    410396 * @since 2.6.0
    411397 *
    412398 * @uses wp_get_post_revision()
     
    432418/**
    433419 * Returns all revisions of specified post.
    434420 *
    435  * @package WordPress
    436  * @subpackage Post_Revisions
    437421 * @since 2.6.0
    438422 *
    439423 * @uses get_children()
    440424 *
    441425 * @param int|object $post_id Post ID or post object
    442  * @return array empty if no revisions
     426 * @return array An array of revisions, or an empty array if none.
    443427 */
    444428function wp_get_post_revisions( $post_id = 0, $args = null ) {
    445429        $post = get_post( $post_id );
     
    463447 *
    464448 * @uses wp_revisions_to_keep()
    465449 *
    466  * @param object $post
    467  * @return bool
     450 * @param object $post The post object.
     451 * @return bool True if number of revisions to keep isn't zero, false otherwise.
    468452 */
    469453function wp_revisions_enabled( $post ) {
    470454        return wp_revisions_to_keep( $post ) != 0;
     
    479463 * @uses post_type_supports()
    480464 * @uses apply_filters() Calls 'wp_revisions_to_keep' hook on the number of revisions.
    481465 *
    482  * @param object $post
    483  * @return int
     466 * @param object $post The post object.
     467 * @return int The number of revisions to keep.
    484468 */
    485469function wp_revisions_to_keep( $post ) {
    486470        $num = WP_POST_REVISIONS;
     
    496480        return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
    497481}
    498482
     483/**
     484 * Sets up the post object for preview based on the post autosave.
     485 *
     486 * @since 2.7.0
     487 * @access private
     488 */
    499489function _set_preview($post) {
    500490
    501491        if ( ! is_object($post) )
     
    518508        return $post;
    519509}
    520510
     511/**
     512 * Filters the latest content for preview from the post autosave.
     513 *
     514 * @since 2.7.0
     515 * @access private
     516 */
    521517function _show_post_preview() {
    522518
    523519        if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
     
    573569        return $terms;
    574570}
    575571
     572/**
     573 * Gets the post revision version.
     574 *
     575 * @since 3.6.0
     576 * @access private
     577*/
    576578function _wp_get_post_revision_version( $revision ) {
    577579        if ( is_object( $revision ) )
    578580                $revision = get_object_vars( $revision );
     
    588590/**
    589591 * Upgrade the revisions author, add the current post as a revision and set the revisions version to 1
    590592 *
    591  * @package WordPress
    592  * @subpackage Post_Revisions
    593593 * @since 3.6.0
     594 * @access private
    594595 *
    595596 * @uses wp_get_post_revisions()
    596597 *
     
    683684 * similar to wp_text_diff, but tracks and returns could of lines added and removed
    684685 *
    685686 * @since 3.6.0
     687 *
    686688 * @see wp_parse_args() Used to change defaults to user defined settings.
    687689 * @uses Text_Diff
    688690 * @uses WP_Text_Diff_Renderer_Table