]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/post.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-admin / includes / post.php
index 3885c2e1319ade52325a06fc6a0c31fd52df7cc2..5fcceec0014decdfcf3bbaffa3f29287bf1ff45d 100644 (file)
@@ -173,6 +173,8 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
  *
  * @since 1.5.0
  *
  *
  * @since 1.5.0
  *
+ * @global wpdb $wpdb
+ *
  * @param array $post_data Optional.
  * @return int Post ID.
  */
  * @param array $post_data Optional.
  * @return int Post ID.
  */
@@ -383,7 +385,7 @@ function edit_post( $post_data = null ) {
 
        wp_set_post_lock( $post_ID );
 
 
        wp_set_post_lock( $post_ID );
 
-       if ( current_user_can( $ptype->cap->edit_others_posts ) ) {
+       if ( current_user_can( $ptype->cap->edit_others_posts ) && current_user_can( $ptype->cap->publish_posts ) ) {
                if ( ! empty( $post_data['sticky'] ) )
                        stick_post( $post_ID );
                else
                if ( ! empty( $post_data['sticky'] ) )
                        stick_post( $post_ID );
                else
@@ -401,6 +403,8 @@ function edit_post( $post_data = null ) {
  *
  * @since 2.7.0
  *
  *
  * @since 2.7.0
  *
+ * @global wpdb $wpdb
+ *
  * @param array $post_data Optional, the array of post data to process if not provided will use $_POST superglobal.
  * @return array
  */
  * @param array $post_data Optional, the array of post data to process if not provided will use $_POST superglobal.
  * @return array
  */
@@ -606,8 +610,8 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
                $post->post_status = 'draft';
                $post->to_ping = '';
                $post->pinged = '';
                $post->post_status = 'draft';
                $post->to_ping = '';
                $post->pinged = '';
-               $post->comment_status = get_option( 'default_comment_status' );
-               $post->ping_status = get_option( 'default_ping_status' );
+               $post->comment_status = get_default_comment_status( $post_type );
+               $post->ping_status = get_default_comment_status( $post_type, 'pingback' );
                $post->post_pingback = get_option( 'default_pingback_flag' );
                $post->post_category = get_option( 'default_category' );
                $post->page_template = 'default';
                $post->post_pingback = get_option( 'default_pingback_flag' );
                $post->post_category = get_option( 'default_category' );
                $post->page_template = 'default';
@@ -654,6 +658,8 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
  *
  * @since 2.0.0
  *
  *
  * @since 2.0.0
  *
+ * @global wpdb $wpdb
+ *
  * @param string $title Post title
  * @param string $content Optional post content
  * @param string $date Optional post date
  * @param string $title Post title
  * @param string $content Optional post content
  * @param string $date Optional post date
@@ -695,6 +701,8 @@ function post_exists($title, $content = '', $date = '') {
  *
  * @since 2.1.0
  *
  *
  * @since 2.1.0
  *
+ * @global WP_User $current_user
+ *
  * @return int|WP_Error
  */
 function wp_write_post() {
  * @return int|WP_Error
  */
 function wp_write_post() {
@@ -834,6 +842,8 @@ function delete_meta( $mid ) {
  *
  * @since 1.2.0
  *
  *
  * @since 1.2.0
  *
+ * @global wpdb $wpdb
+ *
  * @return mixed
  */
 function get_meta_keys() {
  * @return mixed
  */
 function get_meta_keys() {
@@ -865,6 +875,8 @@ function get_post_meta_by_id( $mid ) {
  *
  * @since 1.2.0
  *
  *
  * @since 1.2.0
  *
+ * @global wpdb $wpdb
+ *
  * @param int $postid
  * @return mixed
  */
  * @param int $postid
  * @return mixed
  */
@@ -1055,6 +1067,8 @@ function wp_edit_posts_query( $q = false ) {
  *
  * @since 2.5.0
  *
  *
  * @since 2.5.0
  *
+ * @global wpdb $wpdb
+ *
  * @param string $type
  * @return mixed
  */
  * @param string $type
  * @return mixed
  */
@@ -1304,7 +1318,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
        }
 
        if ( isset( $view_post ) ) {
        }
 
        if ( isset( $view_post ) ) {
-               if( 'draft' == $post->post_status ) {
+               if ( 'draft' == $post->post_status ) {
                        $preview_link = set_url_scheme( get_permalink( $post->ID ) );
                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
                        $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
                        $preview_link = set_url_scheme( get_permalink( $post->ID ) );
                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
                        $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
@@ -1338,6 +1352,9 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
  *
  * @since 2.9.0
  *
  *
  * @since 2.9.0
  *
+ * @global int   $content_width
+ * @global array $_wp_additional_image_sizes
+ *
  * @param int $thumbnail_id ID of the attachment used for thumbnail
  * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
  * @return string html
  * @param int $thumbnail_id ID of the attachment used for thumbnail
  * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
  * @return string html
@@ -1345,11 +1362,16 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
 function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
        global $content_width, $_wp_additional_image_sizes;
 
 function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
        global $content_width, $_wp_additional_image_sizes;
 
-       $post = get_post( $post );
+       $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>';
+       $upload_iframe_src  = get_upload_iframe_src( 'image', $post->ID );
 
 
-       $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
-       $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
-       $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
+       $content = sprintf( $set_thumbnail_link,
+               esc_attr( $post_type_object->labels->set_featured_image ),
+               esc_url( $upload_iframe_src ),
+               esc_html( $post_type_object->labels->set_featured_image )
+       );
 
        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
                $old_content_width = $content_width;
 
        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
                $old_content_width = $content_width;
@@ -1360,8 +1382,12 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
                if ( !empty( $thumbnail_html ) ) {
                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
                if ( !empty( $thumbnail_html ) ) {
                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
-                       $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
-                       $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
+                       $content = sprintf( $set_thumbnail_link,
+                               esc_attr( $post_type_object->labels->set_featured_image ),
+                               esc_url( $upload_iframe_src ),
+                               $thumbnail_html
+                       );
+                       $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>';
                }
                $content_width = $old_content_width;
        }
                }
                $content_width = $old_content_width;
        }