X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/03f2fa83c13c1b532284205fa7efcab9b8b2c41f..784f914b1e4b1c62d6657e86397c2e83bcee4295:/wp-admin/includes/post.php diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index fa3e400e..8be61474 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -687,7 +687,7 @@ function post_exists($title, $content = '', $date = '') { } if ( !empty ( $content ) ) { - $query .= 'AND post_content = %s'; + $query .= ' AND post_content = %s'; $args[] = $post_content; } @@ -1294,15 +1294,14 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { if ( current_user_can( 'read_post', $post->ID ) ) { if ( 'draft' === $post->post_status ) { - $draft_link = set_url_scheme( get_permalink( $post->ID ) ); - $view_link = get_preview_post_link( $post, array(), $draft_link ); + $view_link = get_preview_post_link( $post ); $preview_target = " target='wp-preview-{$post->ID}'"; } else { if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) { $view_link = get_permalink( $post ); } else { // Allow non-published (private, future) to be viewed at a pretty permalink. - $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ) ); + $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink ); } } } @@ -1312,7 +1311,8 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { $return = '' . __( 'Permalink:' ) . "\n"; if ( false !== $view_link ) { - $return .= '' . $view_link . "\n"; + $display_link = urldecode( $view_link ); + $return .= '' . $display_link . "\n"; } else { $return .= '' . $permalink . "\n"; } @@ -1380,12 +1380,12 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { $post = get_post( $post ); $post_type_object = get_post_type_object( $post->post_type ); - $set_thumbnail_link = '

%s

'; + $set_thumbnail_link = '

%s

'; $upload_iframe_src = get_upload_iframe_src( 'image', $post->ID ); $content = sprintf( $set_thumbnail_link, - esc_attr( $post_type_object->labels->set_featured_image ), esc_url( $upload_iframe_src ), + '', // Empty when there's no featured image set, `aria-describedby` attribute otherwise. esc_html( $post_type_object->labels->set_featured_image ) ); @@ -1416,10 +1416,11 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { if ( !empty( $thumbnail_html ) ) { $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID ); $content = sprintf( $set_thumbnail_link, - esc_attr( $post_type_object->labels->set_featured_image ), esc_url( $upload_iframe_src ), + ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html ); + $content .= '

' . __( 'Click the image to edit or update' ) . '

'; $content .= '

' . esc_html( $post_type_object->labels->remove_featured_image ) . '

'; } } @@ -1648,7 +1649,7 @@ function _admin_notice_post_locked() { function wp_create_post_autosave( $post_data ) { if ( is_numeric( $post_data ) ) { $post_id = $post_data; - $post_data = &$_POST; + $post_data = $_POST; } else { $post_id = (int) $post_data['post_ID']; } @@ -1661,14 +1662,14 @@ function wp_create_post_autosave( $post_data ) { // Store one autosave per author. If there is already an autosave, overwrite it. if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) { - $new_autosave = _wp_post_revision_fields( $post_data, true ); + $new_autosave = _wp_post_revision_data( $post_data, true ); $new_autosave['ID'] = $old_autosave->ID; $new_autosave['post_author'] = $post_author; // If the new autosave has the same content as the post, delete the autosave. $post = get_post( $post_id ); $autosave_is_different = false; - foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields() ) ) as $field ) { + foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) { $autosave_is_different = true; break; @@ -1758,7 +1759,7 @@ function post_preview() { * * @param array $post_data Associative array of the submitted post data. * @return mixed The value 0 or WP_Error on failure. The saved post ID on success. - * Te ID can be the draft post_id or the autosave revision post_id. + * The ID can be the draft post_id or the autosave revision post_id. */ function wp_autosave( $post_data ) { // Back-compat @@ -1840,4 +1841,4 @@ function redirect_post($post_id = '') { */ wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ); exit; -} \ No newline at end of file +}