Changeset 47550 for trunk/src/wp-admin/includes/post.php
- Timestamp:
- 04/05/2020 03:00:44 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r47410 r47550 135 135 // Posts 'submitted for approval' are submitted to $_POST the same as if they were being published. 136 136 // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 137 if ( isset( $post_data['post_status'] ) && ( in_array( $post_data['post_status'], $published_statuses ) && ! current_user_can( $ptype->cap->publish_posts ) ) ) { 138 if ( ! in_array( $previous_status, $published_statuses ) || ! current_user_can( 'edit_post', $post_id ) ) { 137 if ( isset( $post_data['post_status'] ) 138 && ( in_array( $post_data['post_status'], $published_statuses, true ) 139 && ! current_user_can( $ptype->cap->publish_posts ) ) 140 ) { 141 if ( ! in_array( $previous_status, $published_statuses, true ) || ! current_user_can( 'edit_post', $post_id ) ) { 139 142 $post_data['post_status'] = 'pending'; 140 143 } … … 565 568 $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); 566 569 567 if ( ! isset( $post_type_object ) || ( isset( $children ) && in_array( $post_ID, $children ) ) || ! current_user_can( 'edit_post', $post_ID ) ) { 570 if ( ! isset( $post_type_object ) 571 || ( isset( $children ) && in_array( $post_ID, $children ) ) 572 || ! current_user_can( 'edit_post', $post_ID ) 573 ) { 568 574 $skipped[] = $post_ID; 569 575 continue; … … 594 600 } 595 601 596 if ( isset( $new_cats ) && in_array( 'category', $tax_names ) ) {602 if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) { 597 603 $cats = (array) wp_get_post_categories( $post_ID ); 598 604 $post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) ); … … 1038 1044 1039 1045 // Don't run if no pretty permalinks or post is not published, scheduled, or privately published. 1040 if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ) ) ) {1046 if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ), true ) ) { 1041 1047 return; 1042 1048 } … … 1111 1117 $post_stati = get_post_stati(); 1112 1118 1113 if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types() ) ) {1119 if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) { 1114 1120 $post_type = $q['post_type']; 1115 1121 } else { … … 1121 1127 $perm = ''; 1122 1128 1123 if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati ) ) {1129 if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) { 1124 1130 $post_status = $q['post_status']; 1125 1131 $perm = 'readable'; … … 1130 1136 if ( isset( $q['orderby'] ) ) { 1131 1137 $orderby = $q['orderby']; 1132 } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {1138 } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ), true ) ) { 1133 1139 $orderby = 'modified'; 1134 1140 } … … 1295 1301 $classes = array( '' ); 1296 1302 } else { 1297 $classes = in_array( $box_id, $closed ) ? array( 'closed' ) : array( '' );1303 $classes = in_array( $box_id, $closed, true ) ? array( 'closed' ) : array( '' ); 1298 1304 } 1299 1305 } else { … … 1343 1349 1344 1350 // Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published. 1345 if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) {1351 if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) { 1346 1352 $post->post_status = 'publish'; 1347 1353 $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
Note: See TracChangeset
for help on using the changeset viewer.