Changeset 45583 for trunk/src/wp-admin/includes/post.php
- Timestamp:
- 07/01/2019 12:50:14 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r45424 r45583 340 340 if ( isset( $post_data['meta'] ) && $post_data['meta'] ) { 341 341 foreach ( $post_data['meta'] as $key => $value ) { 342 if ( ! $meta = get_post_meta_by_id( $key ) ) { 342 $meta = get_post_meta_by_id( $key ); 343 if ( ! $meta ) { 343 344 continue; 344 345 } … … 358 359 if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) { 359 360 foreach ( $post_data['deletemeta'] as $key => $value ) { 360 if ( ! $meta = get_post_meta_by_id( $key ) ) { 361 $meta = get_post_meta_by_id( $key ); 362 if ( ! $meta ) { 361 363 continue; 362 364 } … … 532 534 } 533 535 534 if ( isset( $post_data['post_parent'] ) && ( $parent = (int) $post_data['post_parent'] ) ) { 536 if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) { 537 $parent = (int) $post_data['post_parent']; 535 538 $pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" ); 536 539 $children = array(); … … 548 551 } 549 552 550 $updated = $skipped = $locked = array(); 553 $updated = array(); 554 $skipped = array(); 555 $locked = array(); 551 556 $shared_post_data = $post_data; 552 557 … … 1282 1287 if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) { 1283 1288 $classes = array( '' ); 1284 } elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) { 1289 } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) { 1290 $closed = get_user_option( 'closedpostboxes_' . $screen_id ); 1285 1291 if ( ! is_array( $closed ) ) { 1286 1292 $classes = array( '' ); … … 1557 1563 */ 1558 1564 function wp_check_post_lock( $post_id ) { 1559 if ( ! $post = get_post( $post_id ) ) { 1565 $post = get_post( $post_id ); 1566 if ( ! $post ) { 1560 1567 return false; 1561 1568 } 1562 1569 1563 if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) { 1570 $lock = get_post_meta( $post->ID, '_edit_lock', true ); 1571 if ( ! $lock ) { 1564 1572 return false; 1565 1573 } … … 1593 1601 */ 1594 1602 function wp_set_post_lock( $post_id ) { 1595 if ( ! $post = get_post( $post_id ) ) { 1603 $post = get_post( $post_id ); 1604 if ( ! $post ) { 1596 1605 return false; 1597 1606 } 1598 1607 1599 if ( 0 == ( $user_id = get_current_user_id() ) ) { 1608 $user_id = get_current_user_id(); 1609 if ( 0 == $user_id ) { 1600 1610 return false; 1601 1611 } … … 1616 1626 */ 1617 1627 function _admin_notice_post_locked() { 1618 if ( ! $post = get_post() ) { 1628 $post = get_post(); 1629 if ( ! $post ) { 1619 1630 return; 1620 1631 } 1621 1632 1622 $user = null; 1623 if ( $user_id = wp_check_post_lock( $post->ID ) ) { 1633 $user = null; 1634 $user_id = wp_check_post_lock( $post->ID ); 1635 if ( $user_id ) { 1624 1636 $user = get_userdata( $user_id ); 1625 1637 } … … 1647 1659 } 1648 1660 1649 if ( $locked && ( $sendback = wp_get_referer() ) &&1650 1661 $sendback = wp_get_referer(); 1662 if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { 1651 1663 1652 1664 $sendback_text = __( 'Go back' ); … … 1794 1806 1795 1807 // Store one autosave per author. If there is already an autosave, overwrite it. 1796 if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) { 1808 $old_autosave = wp_get_post_autosave( $post_id, $post_author ); 1809 if ( $old_autosave ) { 1797 1810 $new_autosave = _wp_post_revision_data( $post_data, true ); 1798 1811 $new_autosave['ID'] = $old_autosave->ID; … … 1845 1858 $_POST['ID'] = $post_ID; 1846 1859 1847 if ( ! $post = get_post( $post_ID ) ) { 1860 $post = get_post( $post_ID ); 1861 if ( ! $post ) { 1848 1862 wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); 1849 1863 } … … 1906 1920 } 1907 1921 1908 $post_id = (int) $post_data['post_id']; 1909 $post_data['ID'] = $post_data['post_ID'] = $post_id; 1922 $post_id = (int) $post_data['post_id']; 1923 $post_data['ID'] = $post_id; 1924 $post_data['post_ID'] = $post_id; 1910 1925 1911 1926 if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
Note: See TracChangeset
for help on using the changeset viewer.