]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/post.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-admin / includes / post.php
index fa3e400e3c174949763b7a974d191b4837c318f1..8be61474bcf7e08d81c8e72faa4650d42b2cfe70 100644 (file)
@@ -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 = '<strong>' . __( 'Permalink:' ) . "</strong>\n";
 
                if ( false !== $view_link ) {
-                       $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $view_link . "</a>\n";
+                       $display_link = urldecode( $view_link );
+                       $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $display_link . "</a>\n";
                } else {
                        $return .= '<span id="sample-permalink">' . $permalink . "</span>\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 = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
+       $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
        $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 .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __( 'Click the image to edit or update' ) . '</p>';
                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>';
                }
        }
@@ -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
+}