Make WordPress Core

Ticket #30230: 30230.diff

File 30230.diff, 7.4 KB (added by ericlewis, 10 years ago)
  • src/wp-admin/edit.php

    diff --git src/wp-admin/edit.php src/wp-admin/edit.php
    index cba36d5..8715373 100644
    if ( $doaction ) { 
    6262                $sendback = admin_url($post_new_file);
    6363
    6464        if ( 'delete_all' == $doaction ) {
     65                // Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
    6566                $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
    66                 if ( get_post_status_object($post_status) ) // Check the post status exists first
     67                // Validate the post status exists.
     68                if ( get_post_status_object($post_status) ) {
    6769                        $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
     70                }
    6871                $doaction = 'delete';
    6972        } elseif ( isset( $_REQUEST['media'] ) ) {
    7073                $post_ids = $_REQUEST['media'];
  • src/wp-admin/export.php

    diff --git src/wp-admin/export.php src/wp-admin/export.php
    index b066dc2..78ccf13 100644
    get_current_screen()->set_help_sidebar( 
    5656        '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    5757);
    5858
     59// If the 'download' URL parameter is set, a WXR export file is baked and returned.
    5960if ( isset( $_GET['download'] ) ) {
    6061        $args = array();
    6162
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index c9b4563..26b055f 100644
    function wp_ajax_add_meta() { 
    11421142                        wp_die( -1 );
    11431143                if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
    11441144                        wp_die( 1 );
     1145                // If the post is an autodraft, save the post as a draft and then
     1146                // attempt to save the meta.
    11451147                if ( $post->post_status == 'auto-draft' ) {
    11461148                        $save_POST = $_POST; // Backup $_POST
    11471149                        $_POST = array(); // Make it empty for edit_post()
    function wp_ajax_sample_permalink() { 
    14861488}
    14871489
    14881490/**
    1489  * Ajax handler for quick edit saving for a post.
     1491 * Ajax handler for Quick Edit saving a post from a list table.
    14901492 *
    14911493 * @since 3.1.0
    14921494 */
    function wp_ajax_inline_save_tax() { 
    16171619}
    16181620
    16191621/**
    1620  * Ajax handler for finding posts.
     1622 * Ajax handler for querying posts for the Find Posts modal.
     1623 *
     1624 * @see window.findPosts
    16211625 *
    16221626 * @since 3.1.0
    16231627 */
    function wp_ajax_get_attachment() { 
    21472151}
    21482152
    21492153/**
    2150  * Ajax handler for querying for attachments.
     2154 * Ajax handler for querying attachments.
    21512155 *
    21522156 * @since 3.5.0
    21532157 */
    function wp_ajax_query_attachments() { 
    21932197}
    21942198
    21952199/**
    2196  * Ajax handler for saving attachment attributes.
     2200 * Ajax handler for updating attachment attributes.
    21972201 *
    21982202 * @since 3.5.0
    21992203 */
  • src/wp-admin/includes/export.php

    diff --git src/wp-admin/includes/export.php src/wp-admin/includes/export.php
    index 397e9e7..f5823d9 100644
     
    1616define( 'WXR_VERSION', '1.2' );
    1717
    1818/**
    19  * Generates the WXR export file for download
     19 * Generates the WXR export file for download.
    2020 *
    2121 * @since 2.1.0
    2222 *
    23  * @param array $args Filters defining what should be included in the export
     23 * @param array $args Filters defining what should be included in the export.
    2424 */
    2525function export_wp( $args = array() ) {
    2626        global $wpdb, $post;
  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index e4feb4f..dc0c8f8 100644
    add_action( 'init', 'smilies_init', 
    250250add_action( 'plugins_loaded',             'wp_maybe_load_widgets',                    0    );
    251251add_action( 'plugins_loaded',             'wp_maybe_load_embeds',                     0    );
    252252add_action( 'shutdown',                   'wp_ob_end_flush_all',                      1    );
     253// Create a revision whenever a post is updated.
    253254add_action( 'post_updated',               'wp_save_post_revision',                   10, 1 );
    254255add_action( 'publish_post',               '_publish_post_hook',                       5, 1 );
    255256add_action( 'transition_post_status',     '_transition_post_status',                  5, 3 );
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 7e6f662..31bf142 100644
    function get_post_status_object( $post_status ) { 
    10601060}
    10611061
    10621062/**
    1063  * Get a list of all registered post status objects.
     1063 * Get a list of post statuses.
    10641064 *
    10651065 * @since 3.0.0
    10661066 *
    function get_post_status_object( $post_status ) { 
    10681068 *
    10691069 * @see register_post_status()
    10701070 *
    1071  * @param array|string $args     Optional. Array or string of post status arguments. Default array.
    1072  * @param string       $output   Optional. The type of output to return. Accepts post status 'names'
    1073  *                               or 'objects'. Default 'names'.
     1071 * @param array|string $args     Optional. Array or string of post status arguments to compare against
     1072 *                               properties of the global $wp_post_statuses objects. Default empty array.
     1073 * @param string       $output   Optional. The type of output to return, either 'names' or 'objects'. Default 'names'.
    10741074 * @param string       $operator Optional. The logical operation to perform. 'or' means only one element
    10751075 *                               from the array needs to match; 'and' means all elements must match.
    10761076 *                               Default 'and'.
  • src/wp-includes/revision.php

    diff --git src/wp-includes/revision.php src/wp-includes/revision.php
    index 62f0fbc..2661acc 100644
    function _wp_post_revision_fields( $post = null, $autosave = false ) { 
    7070}
    7171
    7272/**
    73  * Saves an already existing post as a post revision.
     73 * Creates a revision for the current version of a post.
    7474 *
    75  * Typically used immediately after post updates.
    76  * Adds a copy of the current post as a revision, so latest revision always matches current post
     75 * Typically used immediately after a post update, as every update is a revision,
     76 * and the most recent revision always matches the current post.
    7777 *
    7878 * @since 2.6.0
    7979 *
    80  * @param int $post_id The ID of the post to save as a revision.
     80 * @param  int  $post_id The ID of the post to save as a revision.
    8181 * @return mixed Null or 0 if error, new revision ID, if success.
    8282 */
    8383function wp_save_post_revision( $post_id ) {
    function wp_save_post_revision( $post_id ) { 
    156156
    157157        $return = _wp_put_post_revision( $post );
    158158
     159        // If a limit for the number of revisions to keep has been set,
     160        // delete the oldest ones.
    159161        $revisions_to_keep = wp_revisions_to_keep( $post );
    160162
    161163        if ( $revisions_to_keep < 0 )
    162164                return $return;
    163165
    164         // all revisions and autosaves
    165166        $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
    166167
    167168        $delete = count($revisions) - $revisions_to_keep;
    function wp_revisions_enabled( $post ) { 
    446447
    447448/**
    448449 * Determine how many revisions to retain for a given post.
    449  * By default, an infinite number of revisions are stored if a post type supports revisions.
     450 *
     451 * By default, an infinite number of revisions are kept.
     452 *
     453 * The constant WP_POST_REVISIONS can be set in wp-config to specify the limit
     454 * of revisions to keep.
    450455 *
    451456 * @since 3.6.0
    452457 *
    453  * @param object $post The post object.
     458 * @param  object $post The post object.
    454459 * @return int The number of revisions to keep.
    455460 */
    456461function wp_revisions_to_keep( $post ) {