diff --git src/wp-admin/edit.php src/wp-admin/edit.php
index cba36d5..8715373 100644
|
|
if ( $doaction ) { |
62 | 62 | $sendback = admin_url($post_new_file); |
63 | 63 | |
64 | 64 | if ( 'delete_all' == $doaction ) { |
| 65 | // Prepare for deletion of all posts with a specified post status (i.e. Empty trash). |
65 | 66 | $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) ) { |
67 | 69 | $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 | } |
68 | 71 | $doaction = 'delete'; |
69 | 72 | } elseif ( isset( $_REQUEST['media'] ) ) { |
70 | 73 | $post_ids = $_REQUEST['media']; |
diff --git src/wp-admin/export.php src/wp-admin/export.php
index b066dc2..78ccf13 100644
|
|
get_current_screen()->set_help_sidebar( |
56 | 56 | '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
57 | 57 | ); |
58 | 58 | |
| 59 | // If the 'download' URL parameter is set, a WXR export file is baked and returned. |
59 | 60 | if ( isset( $_GET['download'] ) ) { |
60 | 61 | $args = array(); |
61 | 62 | |
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() { |
1142 | 1142 | wp_die( -1 ); |
1143 | 1143 | if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) ) |
1144 | 1144 | wp_die( 1 ); |
| 1145 | // If the post is an autodraft, save the post as a draft and then |
| 1146 | // attempt to save the meta. |
1145 | 1147 | if ( $post->post_status == 'auto-draft' ) { |
1146 | 1148 | $save_POST = $_POST; // Backup $_POST |
1147 | 1149 | $_POST = array(); // Make it empty for edit_post() |
… |
… |
function wp_ajax_sample_permalink() { |
1486 | 1488 | } |
1487 | 1489 | |
1488 | 1490 | /** |
1489 | | * Ajax handler for quick edit saving for a post. |
| 1491 | * Ajax handler for Quick Edit saving a post from a list table. |
1490 | 1492 | * |
1491 | 1493 | * @since 3.1.0 |
1492 | 1494 | */ |
… |
… |
function wp_ajax_inline_save_tax() { |
1617 | 1619 | } |
1618 | 1620 | |
1619 | 1621 | /** |
1620 | | * Ajax handler for finding posts. |
| 1622 | * Ajax handler for querying posts for the Find Posts modal. |
| 1623 | * |
| 1624 | * @see window.findPosts |
1621 | 1625 | * |
1622 | 1626 | * @since 3.1.0 |
1623 | 1627 | */ |
… |
… |
function wp_ajax_get_attachment() { |
2147 | 2151 | } |
2148 | 2152 | |
2149 | 2153 | /** |
2150 | | * Ajax handler for querying for attachments. |
| 2154 | * Ajax handler for querying attachments. |
2151 | 2155 | * |
2152 | 2156 | * @since 3.5.0 |
2153 | 2157 | */ |
… |
… |
function wp_ajax_query_attachments() { |
2193 | 2197 | } |
2194 | 2198 | |
2195 | 2199 | /** |
2196 | | * Ajax handler for saving attachment attributes. |
| 2200 | * Ajax handler for updating attachment attributes. |
2197 | 2201 | * |
2198 | 2202 | * @since 3.5.0 |
2199 | 2203 | */ |
diff --git src/wp-admin/includes/export.php src/wp-admin/includes/export.php
index 397e9e7..f5823d9 100644
|
|
|
16 | 16 | define( 'WXR_VERSION', '1.2' ); |
17 | 17 | |
18 | 18 | /** |
19 | | * Generates the WXR export file for download |
| 19 | * Generates the WXR export file for download. |
20 | 20 | * |
21 | 21 | * @since 2.1.0 |
22 | 22 | * |
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. |
24 | 24 | */ |
25 | 25 | function export_wp( $args = array() ) { |
26 | 26 | global $wpdb, $post; |
diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
index e4feb4f..dc0c8f8 100644
|
|
add_action( 'init', 'smilies_init', |
250 | 250 | add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); |
251 | 251 | add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); |
252 | 252 | add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); |
| 253 | // Create a revision whenever a post is updated. |
253 | 254 | add_action( 'post_updated', 'wp_save_post_revision', 10, 1 ); |
254 | 255 | add_action( 'publish_post', '_publish_post_hook', 5, 1 ); |
255 | 256 | add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); |
diff --git src/wp-includes/post.php src/wp-includes/post.php
index 7e6f662..31bf142 100644
|
|
function get_post_status_object( $post_status ) { |
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | /** |
1063 | | * Get a list of all registered post status objects. |
| 1063 | * Get a list of post statuses. |
1064 | 1064 | * |
1065 | 1065 | * @since 3.0.0 |
1066 | 1066 | * |
… |
… |
function get_post_status_object( $post_status ) { |
1068 | 1068 | * |
1069 | 1069 | * @see register_post_status() |
1070 | 1070 | * |
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'. |
1074 | 1074 | * @param string $operator Optional. The logical operation to perform. 'or' means only one element |
1075 | 1075 | * from the array needs to match; 'and' means all elements must match. |
1076 | 1076 | * Default 'and'. |
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 ) { |
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | | * Saves an already existing post as a post revision. |
| 73 | * Creates a revision for the current version of a post. |
74 | 74 | * |
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. |
77 | 77 | * |
78 | 78 | * @since 2.6.0 |
79 | 79 | * |
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. |
81 | 81 | * @return mixed Null or 0 if error, new revision ID, if success. |
82 | 82 | */ |
83 | 83 | function wp_save_post_revision( $post_id ) { |
… |
… |
function wp_save_post_revision( $post_id ) { |
156 | 156 | |
157 | 157 | $return = _wp_put_post_revision( $post ); |
158 | 158 | |
| 159 | // If a limit for the number of revisions to keep has been set, |
| 160 | // delete the oldest ones. |
159 | 161 | $revisions_to_keep = wp_revisions_to_keep( $post ); |
160 | 162 | |
161 | 163 | if ( $revisions_to_keep < 0 ) |
162 | 164 | return $return; |
163 | 165 | |
164 | | // all revisions and autosaves |
165 | 166 | $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); |
166 | 167 | |
167 | 168 | $delete = count($revisions) - $revisions_to_keep; |
… |
… |
function wp_revisions_enabled( $post ) { |
446 | 447 | |
447 | 448 | /** |
448 | 449 | * 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. |
450 | 455 | * |
451 | 456 | * @since 3.6.0 |
452 | 457 | * |
453 | | * @param object $post The post object. |
| 458 | * @param object $post The post object. |
454 | 459 | * @return int The number of revisions to keep. |
455 | 460 | */ |
456 | 461 | function wp_revisions_to_keep( $post ) { |