Changeset 55365
- Timestamp:
- 02/19/2023 03:03:50 PM (22 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r55258 r55365 2035 2035 } 2036 2036 2037 $post_ ID= (int) $_POST['post_ID'];2037 $post_id = (int) $_POST['post_ID']; 2038 2038 2039 2039 if ( 'page' === $_POST['post_type'] ) { 2040 if ( ! current_user_can( 'edit_page', $post_ ID) ) {2040 if ( ! current_user_can( 'edit_page', $post_id ) ) { 2041 2041 wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); 2042 2042 } 2043 2043 } else { 2044 if ( ! current_user_can( 'edit_post', $post_ ID) ) {2044 if ( ! current_user_can( 'edit_post', $post_id ) ) { 2045 2045 wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); 2046 2046 } 2047 2047 } 2048 2048 2049 $last = wp_check_post_lock( $post_ ID);2049 $last = wp_check_post_lock( $post_id ); 2050 2050 if ( $last ) { 2051 2051 $last_user = get_userdata( $last ); … … 2066 2066 $data = &$_POST; 2067 2067 2068 $post = get_post( $post_ ID, ARRAY_A );2068 $post = get_post( $post_id, ARRAY_A ); 2069 2069 2070 2070 // Since it's coming from the database. … … 2700 2700 $json = ! empty( $_REQUEST['json'] ); // New-style request. 2701 2701 2702 $post_ ID= (int) $_POST['post_id'];2703 if ( ! current_user_can( 'edit_post', $post_ ID) ) {2702 $post_id = (int) $_POST['post_id']; 2703 if ( ! current_user_can( 'edit_post', $post_id ) ) { 2704 2704 wp_die( -1 ); 2705 2705 } … … 2708 2708 2709 2709 if ( $json ) { 2710 check_ajax_referer( "update-post_$post_ ID" );2710 check_ajax_referer( "update-post_$post_id" ); 2711 2711 } else { 2712 check_ajax_referer( "set_post_thumbnail-$post_ ID" );2712 check_ajax_referer( "set_post_thumbnail-$post_id" ); 2713 2713 } 2714 2714 2715 2715 if ( '-1' == $thumbnail_id ) { 2716 if ( delete_post_thumbnail( $post_ ID) ) {2717 $return = _wp_post_thumbnail_html( null, $post_ ID);2716 if ( delete_post_thumbnail( $post_id ) ) { 2717 $return = _wp_post_thumbnail_html( null, $post_id ); 2718 2718 $json ? wp_send_json_success( $return ) : wp_die( $return ); 2719 2719 } else { … … 2722 2722 } 2723 2723 2724 if ( set_post_thumbnail( $post_ ID, $thumbnail_id ) ) {2725 $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ ID);2724 if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) { 2725 $return = _wp_post_thumbnail_html( $thumbnail_id, $post_id ); 2726 2726 $json ? wp_send_json_success( $return ) : wp_die( $return ); 2727 2727 } … … 2736 2736 */ 2737 2737 function wp_ajax_get_post_thumbnail_html() { 2738 $post_ ID= (int) $_POST['post_id'];2739 2740 check_ajax_referer( "update-post_$post_ ID" );2741 2742 if ( ! current_user_can( 'edit_post', $post_ ID) ) {2738 $post_id = (int) $_POST['post_id']; 2739 2740 check_ajax_referer( "update-post_$post_id" ); 2741 2742 if ( ! current_user_can( 'edit_post', $post_id ) ) { 2743 2743 wp_die( -1 ); 2744 2744 } … … 2751 2751 } 2752 2752 2753 $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ ID);2753 $return = _wp_post_thumbnail_html( $thumbnail_id, $post_id ); 2754 2754 wp_send_json_success( $return ); 2755 2755 } -
trunk/src/wp-admin/includes/post.php
r55265 r55365 253 253 unset( $post_data['filter'] ); 254 254 255 $post_ ID= (int) $post_data['post_ID'];256 $post = get_post( $post_ ID);255 $post_id = (int) $post_data['post_ID']; 256 $post = get_post( $post_id ); 257 257 258 258 $post_data['post_type'] = $post->post_type; … … 268 268 269 269 $ptype = get_post_type_object( $post_data['post_type'] ); 270 if ( ! current_user_can( 'edit_post', $post_ ID) ) {270 if ( ! current_user_can( 'edit_post', $post_id ) ) { 271 271 if ( 'page' === $post_data['post_type'] ) { 272 272 wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); … … 278 278 if ( post_type_supports( $ptype->name, 'revisions' ) ) { 279 279 $revisions = wp_get_post_revisions( 280 $post_ ID,280 $post_id, 281 281 array( 282 282 'order' => 'ASC', … … 288 288 // Check if the revisions have been upgraded. 289 289 if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 ) { 290 _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ ID) );290 _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_id ) ); 291 291 } 292 292 } … … 316 316 // Post formats. 317 317 if ( isset( $post_data['post_format'] ) ) { 318 set_post_format( $post_ ID, $post_data['post_format'] );318 set_post_format( $post_id, $post_data['post_format'] ); 319 319 } 320 320 … … 323 323 $keyed = '_format_' . $format_meta_url; 324 324 if ( isset( $post_data[ $keyed ] ) ) { 325 update_post_meta( $post_ ID, $keyed, wp_slash( sanitize_url( wp_unslash( $post_data[ $keyed ] ) ) ) );325 update_post_meta( $post_id, $keyed, wp_slash( sanitize_url( wp_unslash( $post_data[ $keyed ] ) ) ) ); 326 326 } 327 327 } … … 333 333 if ( isset( $post_data[ $keyed ] ) ) { 334 334 if ( current_user_can( 'unfiltered_html' ) ) { 335 update_post_meta( $post_ ID, $keyed, $post_data[ $keyed ] );335 update_post_meta( $post_id, $keyed, $post_data[ $keyed ] ); 336 336 } else { 337 update_post_meta( $post_ ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) );337 update_post_meta( $post_id, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) ); 338 338 } 339 339 } … … 341 341 342 342 if ( 'attachment' === $post_data['post_type'] && preg_match( '#^(audio|video)/#', $post_data['post_mime_type'] ) ) { 343 $id3data = wp_get_attachment_metadata( $post_ ID);343 $id3data = wp_get_attachment_metadata( $post_id ); 344 344 if ( ! is_array( $id3data ) ) { 345 345 $id3data = array(); … … 351 351 } 352 352 } 353 wp_update_attachment_metadata( $post_ ID, $id3data );353 wp_update_attachment_metadata( $post_id, $id3data ); 354 354 } 355 355 … … 361 361 continue; 362 362 } 363 if ( $meta->post_id != $post_ID ) { 363 364 if ( $meta->post_id != $post_id ) { 364 365 continue; 365 366 } 366 if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $meta->meta_key ) ) { 367 368 if ( is_protected_meta( $meta->meta_key, 'post' ) 369 || ! current_user_can( 'edit_post_meta', $post_id, $meta->meta_key ) 370 ) { 367 371 continue; 368 372 } 369 if ( is_protected_meta( $value['key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $value['key'] ) ) { 373 374 if ( is_protected_meta( $value['key'], 'post' ) 375 || ! current_user_can( 'edit_post_meta', $post_id, $value['key'] ) 376 ) { 370 377 continue; 371 378 } 379 372 380 update_meta( $key, $value['key'], $value['value'] ); 373 381 } … … 380 388 continue; 381 389 } 382 if ( $meta->post_id != $post_ID ) { 390 391 if ( $meta->post_id != $post_id ) { 383 392 continue; 384 393 } 385 if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $post_ID, $meta->meta_key ) ) { 394 395 if ( is_protected_meta( $meta->meta_key, 'post' ) 396 || ! current_user_can( 'delete_post_meta', $post_id, $meta->meta_key ) 397 ) { 386 398 continue; 387 399 } 400 388 401 delete_meta( $key ); 389 402 } … … 395 408 $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); 396 409 397 if ( get_post_meta( $post_ ID, '_wp_attachment_image_alt', true ) !== $image_alt ) {410 if ( get_post_meta( $post_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { 398 411 $image_alt = wp_strip_all_tags( $image_alt, true ); 399 412 400 413 // update_post_meta() expects slashed. 401 update_post_meta( $post_ ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );402 } 403 } 404 405 $attachment_data = isset( $post_data['attachments'][ $post_ ID ] ) ? $post_data['attachments'][ $post_ID] : array();414 update_post_meta( $post_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); 415 } 416 } 417 418 $attachment_data = isset( $post_data['attachments'][ $post_id ] ) ? $post_data['attachments'][ $post_id ] : array(); 406 419 407 420 /** This filter is documented in wp-admin/includes/media.php */ … … 420 433 } 421 434 422 add_meta( $post_ ID);423 424 update_post_meta( $post_ ID, '_edit_last', get_current_user_id() );435 add_meta( $post_id ); 436 437 update_post_meta( $post_id, '_edit_last', get_current_user_id() ); 425 438 426 439 $success = wp_update_post( $translated ); … … 440 453 441 454 // Now that we have an ID we can fix any attachment anchor hrefs. 442 _fix_attachment_links( $post_ ID);443 444 wp_set_post_lock( $post_ ID);455 _fix_attachment_links( $post_id ); 456 457 wp_set_post_lock( $post_id ); 445 458 446 459 if ( current_user_can( $ptype->cap->edit_others_posts ) && current_user_can( $ptype->cap->publish_posts ) ) { 447 460 if ( ! empty( $post_data['sticky'] ) ) { 448 stick_post( $post_ ID);461 stick_post( $post_id ); 449 462 } else { 450 unstick_post( $post_ ID);451 } 452 } 453 454 return $post_ ID;463 unstick_post( $post_id ); 464 } 465 } 466 467 return $post_id; 455 468 } 456 469 … … 506 519 } 507 520 508 $post_ IDs = array_map( 'intval', (array) $post_data['post'] );521 $post_ids = array_map( 'intval', (array) $post_data['post'] ); 509 522 510 523 $reset = array( … … 543 556 continue; 544 557 } 558 545 559 if ( is_taxonomy_hierarchical( $tax_name ) ) { 546 560 $tax_input[ $tax_name ] = array_map( 'absint', $terms ); … … 577 591 $shared_post_data = $post_data; 578 592 579 foreach ( $post_ IDs as $post_ID) {593 foreach ( $post_ids as $post_id ) { 580 594 // Start with fresh post data with each iteration. 581 595 $post_data = $shared_post_data; 582 596 583 $post_type_object = get_post_type_object( get_post_type( $post_ ID) );597 $post_type_object = get_post_type_object( get_post_type( $post_id ) ); 584 598 585 599 if ( ! isset( $post_type_object ) 586 || ( isset( $children ) && in_array( $post_ ID, $children, true ) )587 || ! current_user_can( 'edit_post', $post_ ID)600 || ( isset( $children ) && in_array( $post_id, $children, true ) ) 601 || ! current_user_can( 'edit_post', $post_id ) 588 602 ) { 589 $skipped[] = $post_ ID;603 $skipped[] = $post_id; 590 604 continue; 591 605 } 592 606 593 if ( wp_check_post_lock( $post_ ID) ) {594 $locked[] = $post_ ID;607 if ( wp_check_post_lock( $post_id ) ) { 608 $locked[] = $post_id; 595 609 continue; 596 610 } 597 611 598 $post = get_post( $post_ ID);612 $post = get_post( $post_id ); 599 613 $tax_names = get_object_taxonomies( $post ); 600 614 … … 613 627 614 628 if ( $taxonomy_obj->hierarchical ) { 615 $current_terms = (array) wp_get_object_terms( $post_ ID, $tax_name, array( 'fields' => 'ids' ) );629 $current_terms = (array) wp_get_object_terms( $post_id, $tax_name, array( 'fields' => 'ids' ) ); 616 630 } else { 617 $current_terms = (array) wp_get_object_terms( $post_ ID, $tax_name, array( 'fields' => 'names' ) );631 $current_terms = (array) wp_get_object_terms( $post_id, $tax_name, array( 'fields' => 'names' ) ); 618 632 } 619 633 … … 622 636 623 637 if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) { 624 $cats = (array) wp_get_post_categories( $post_ ID);638 $cats = (array) wp_get_post_categories( $post_id ); 625 639 $post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) ); 626 640 unset( $post_data['tax_input']['category'] ); 627 641 } 628 642 629 $post_data['post_ID'] = $post_ ID;643 $post_data['post_ID'] = $post_id; 630 644 $post_data['post_type'] = $post->post_type; 631 645 $post_data['post_mime_type'] = $post->post_mime_type; … … 639 653 $post_data = _wp_translate_postdata( true, $post_data ); 640 654 if ( is_wp_error( $post_data ) ) { 641 $skipped[] = $post_ ID;655 $skipped[] = $post_id; 642 656 continue; 643 657 } … … 645 659 646 660 if ( isset( $shared_post_data['post_format'] ) ) { 647 set_post_format( $post_ ID, $shared_post_data['post_format'] );661 set_post_format( $post_id, $shared_post_data['post_format'] ); 648 662 } 649 663 … … 657 671 if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { 658 672 if ( 'sticky' === $post_data['sticky'] ) { 659 stick_post( $post_ ID);673 stick_post( $post_id ); 660 674 } else { 661 unstick_post( $post_ ID);675 unstick_post( $post_id ); 662 676 } 663 677 } … … 888 902 889 903 // Create the post. 890 $post_ ID= wp_insert_post( $translated );891 if ( is_wp_error( $post_ ID) ) {892 return $post_ ID;893 } 894 895 if ( empty( $post_ ID) ) {904 $post_id = wp_insert_post( $translated ); 905 if ( is_wp_error( $post_id ) ) { 906 return $post_id; 907 } 908 909 if ( empty( $post_id ) ) { 896 910 return 0; 897 911 } 898 912 899 add_meta( $post_ ID);900 901 add_post_meta( $post_ ID, '_edit_last', $GLOBALS['current_user']->ID );913 add_meta( $post_id ); 914 915 add_post_meta( $post_id, '_edit_last', $GLOBALS['current_user']->ID ); 902 916 903 917 // Now that we have an ID we can fix any attachment anchor hrefs. 904 _fix_attachment_links( $post_ ID);905 906 wp_set_post_lock( $post_ ID);907 908 return $post_ ID;918 _fix_attachment_links( $post_id ); 919 920 wp_set_post_lock( $post_id ); 921 922 return $post_id; 909 923 } 910 924 … … 934 948 * @since 1.2.0 935 949 * 936 * @param int $post_ ID950 * @param int $post_id 937 951 * @return int|bool 938 952 */ 939 function add_meta( $post_ ID) {940 $post_ ID = (int) $post_ID;953 function add_meta( $post_id ) { 954 $post_id = (int) $post_id; 941 955 942 956 $metakeyselect = isset( $_POST['metakeyselect'] ) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : ''; … … 960 974 } 961 975 962 if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ ID, $metakey ) ) {976 if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_id, $metakey ) ) { 963 977 return false; 964 978 } … … 966 980 $metakey = wp_slash( $metakey ); 967 981 968 return add_post_meta( $post_ ID, $metakey, $metavalue );982 return add_post_meta( $post_id, $metakey, $metavalue ); 969 983 } 970 984 … … 1942 1956 function post_preview() { 1943 1957 1944 $post_ ID= (int) $_POST['post_ID'];1945 $_POST['ID'] = $post_ ID;1946 1947 $post = get_post( $post_ ID);1958 $post_id = (int) $_POST['post_ID']; 1959 $_POST['ID'] = $post_id; 1960 1961 $post = get_post( $post_id ); 1948 1962 1949 1963 if ( ! $post ) { -
trunk/src/wp-includes/class-wp-embed.php
r54319 r55365 223 223 } 224 224 225 $post_ ID= ( ! empty( $post->ID ) ) ? $post->ID : null;225 $post_id = ( ! empty( $post->ID ) ) ? $post->ID : null; 226 226 227 227 // Potentially set by WP_Embed::cache_oembed(). 228 228 if ( ! empty( $this->post_ID ) ) { 229 $post_ ID= $this->post_ID;229 $post_id = $this->post_ID; 230 230 } 231 231 … … 243 243 * @param string $url The attempted embed URL. 244 244 * @param array $attr An array of shortcode attributes. 245 * @param int $post_ IDPost ID.245 * @param int $post_id Post ID. 246 246 */ 247 $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ ID);247 $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_id ); 248 248 249 249 $cache = ''; … … 252 252 $cached_post_id = $this->find_oembed_post_id( $key_suffix ); 253 253 254 if ( $post_ ID) {255 $cache = get_post_meta( $post_ ID, $cachekey, true );256 $cache_time = get_post_meta( $post_ ID, $cachekey_time, true );254 if ( $post_id ) { 255 $cache = get_post_meta( $post_id, $cachekey, true ); 256 $cache_time = get_post_meta( $post_id, $cachekey_time, true ); 257 257 258 258 if ( ! $cache_time ) { … … 285 285 * @param string $url The attempted embed URL. 286 286 * @param array $attr An array of shortcode attributes. 287 * @param int $post_ IDPost ID.287 * @param int $post_id Post ID. 288 288 */ 289 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ ID);289 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_id ); 290 290 } 291 291 } … … 306 306 $html = wp_oembed_get( $url, $attr ); 307 307 308 if ( $post_ ID) {308 if ( $post_id ) { 309 309 if ( $html ) { 310 update_post_meta( $post_ ID, $cachekey, $html );311 update_post_meta( $post_ ID, $cachekey_time, time() );310 update_post_meta( $post_id, $cachekey, $html ); 311 update_post_meta( $post_id, $cachekey_time, time() ); 312 312 } elseif ( ! $cache ) { 313 update_post_meta( $post_ ID, $cachekey, '{{unknown}}' );313 update_post_meta( $post_id, $cachekey, '{{unknown}}' ); 314 314 } 315 315 } else { … … 370 370 if ( $html ) { 371 371 /** This filter is documented in wp-includes/class-wp-embed.php */ 372 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ ID);372 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_id ); 373 373 } 374 374 … … 380 380 * Deletes all oEmbed caches. Unused by core as of 4.0.0. 381 381 * 382 * @param int $post_ IDPost ID to delete the caches for.383 */ 384 public function delete_oembed_caches( $post_ ID) {385 $post_metas = get_post_custom_keys( $post_ ID);382 * @param int $post_id Post ID to delete the caches for. 383 */ 384 public function delete_oembed_caches( $post_id ) { 385 $post_metas = get_post_custom_keys( $post_id ); 386 386 if ( empty( $post_metas ) ) { 387 387 return; … … 390 390 foreach ( $post_metas as $post_meta_key ) { 391 391 if ( '_oembed_' === substr( $post_meta_key, 0, 8 ) ) { 392 delete_post_meta( $post_ ID, $post_meta_key );392 delete_post_meta( $post_id, $post_meta_key ); 393 393 } 394 394 } … … 398 398 * Triggers a caching of all oEmbed results. 399 399 * 400 * @param int $post_ IDPost ID to do the caching for.401 */ 402 public function cache_oembed( $post_ ID) {403 $post = get_post( $post_ ID);400 * @param int $post_id Post ID to do the caching for. 401 */ 402 public function cache_oembed( $post_id ) { 403 $post = get_post( $post_id ); 404 404 405 405 $post_types = get_post_types( array( 'show_ui' => true ) ); -
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r55316 r55365 1530 1530 $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID; 1531 1531 } 1532 $post_ ID= $post_data['ID'];1532 $post_id = $post_data['ID']; 1533 1533 1534 1534 if ( 'post' === $post_data['post_type'] ) { … … 1542 1542 // Empty value deletes, non-empty value adds/updates. 1543 1543 if ( ! $post_data['post_thumbnail'] ) { 1544 delete_post_thumbnail( $post_ ID);1544 delete_post_thumbnail( $post_id ); 1545 1545 } elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) { 1546 1546 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 1547 1547 } 1548 set_post_thumbnail( $post_ ID, $post_data['post_thumbnail'] );1548 set_post_thumbnail( $post_id, $post_data['post_thumbnail'] ); 1549 1549 unset( $content_struct['post_thumbnail'] ); 1550 1550 } 1551 1551 1552 1552 if ( isset( $post_data['custom_fields'] ) ) { 1553 $this->set_custom_fields( $post_ ID, $post_data['custom_fields'] );1553 $this->set_custom_fields( $post_id, $post_data['custom_fields'] ); 1554 1554 } 1555 1555 … … 1657 1657 1658 1658 if ( isset( $post_data['post_format'] ) ) { 1659 $format = set_post_format( $post_ ID, $post_data['post_format'] );1659 $format = set_post_format( $post_id, $post_data['post_format'] ); 1660 1660 1661 1661 if ( is_wp_error( $format ) ) { … … 1668 1668 // Handle enclosures. 1669 1669 $enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null; 1670 $this->add_enclosure_if_new( $post_ ID, $enclosure );1671 1672 $this->attach_uploads( $post_ ID, $post_data['post_content'] );1670 $this->add_enclosure_if_new( $post_id, $enclosure ); 1671 1672 $this->attach_uploads( $post_id, $post_data['post_content'] ); 1673 1673 1674 1674 /** … … 1690 1690 ); 1691 1691 1692 $post_ ID= $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );1693 if ( is_wp_error( $post_ ID) ) {1694 return new IXR_Error( 500, $post_ ID->get_error_message() );1695 } 1696 1697 if ( ! $post_ ID) {1692 $post_id = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true ); 1693 if ( is_wp_error( $post_id ) ) { 1694 return new IXR_Error( 500, $post_id->get_error_message() ); 1695 } 1696 1697 if ( ! $post_id ) { 1698 1698 if ( $update ) { 1699 1699 return new IXR_Error( 401, __( 'Sorry, the post could not be updated.' ) ); … … 1703 1703 } 1704 1704 1705 return (string) $post_ ID;1705 return (string) $post_id; 1706 1706 } 1707 1707 … … 4943 4943 $this->escape( $args ); 4944 4944 4945 $post_ ID= (int) $args[1];4945 $post_id = (int) $args[1]; 4946 4946 $username = $args[2]; 4947 4947 $password = $args[3]; … … 4952 4952 } 4953 4953 4954 $post_data = get_post( $post_ ID, ARRAY_A );4954 $post_data = get_post( $post_id, ARRAY_A ); 4955 4955 if ( ! $post_data ) { 4956 4956 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4957 4957 } 4958 4958 4959 if ( ! current_user_can( 'edit_post', $post_ ID) ) {4959 if ( ! current_user_can( 'edit_post', $post_id ) ) { 4960 4960 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 4961 4961 } … … 4964 4964 do_action( 'xmlrpc_call', 'blogger.getPost', $args, $this ); 4965 4965 4966 $categories = implode( ',', wp_get_post_categories( $post_ ID) );4966 $categories = implode( ',', wp_get_post_categories( $post_id ) ); 4967 4967 4968 4968 $content = '<title>' . wp_unslash( $post_data['post_title'] ) . '</title>'; … … 5129 5129 $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' ); 5130 5130 5131 $post_ ID= wp_insert_post( $post_data );5132 if ( is_wp_error( $post_ ID) ) {5133 return new IXR_Error( 500, $post_ ID->get_error_message() );5134 } 5135 5136 if ( ! $post_ ID) {5131 $post_id = wp_insert_post( $post_data ); 5132 if ( is_wp_error( $post_id ) ) { 5133 return new IXR_Error( 500, $post_id->get_error_message() ); 5134 } 5135 5136 if ( ! $post_id ) { 5137 5137 return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); 5138 5138 } 5139 5139 5140 $this->attach_uploads( $post_ ID, $post_content );5140 $this->attach_uploads( $post_id, $post_content ); 5141 5141 5142 5142 /** … … 5145 5145 * @since 3.4.0 5146 5146 * 5147 * @param int $post_ IDID of the new post.5147 * @param int $post_id ID of the new post. 5148 5148 * @param array $args An array of new post arguments. 5149 5149 */ 5150 do_action( 'xmlrpc_call_success_blogger_newPost', $post_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase5151 5152 return $post_ ID;5150 do_action( 'xmlrpc_call_success_blogger_newPost', $post_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 5151 5152 return $post_id; 5153 5153 } 5154 5154 … … 5174 5174 $this->escape( $args ); 5175 5175 5176 $post_ ID= (int) $args[1];5176 $post_id = (int) $args[1]; 5177 5177 $username = $args[2]; 5178 5178 $password = $args[3]; … … 5188 5188 do_action( 'xmlrpc_call', 'blogger.editPost', $args, $this ); 5189 5189 5190 $actual_post = get_post( $post_ ID, ARRAY_A );5190 $actual_post = get_post( $post_id, ARRAY_A ); 5191 5191 5192 5192 if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { … … 5196 5196 $this->escape( $actual_post ); 5197 5197 5198 if ( ! current_user_can( 'edit_post', $post_ ID) ) {5198 if ( ! current_user_can( 'edit_post', $post_id ) ) { 5199 5199 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 5200 5200 } … … 5224 5224 * @since 3.4.0 5225 5225 * 5226 * @param int $post_ IDID of the updated post.5226 * @param int $post_id ID of the updated post. 5227 5227 * @param array $args An array of arguments for the post to edit. 5228 5228 */ 5229 do_action( 'xmlrpc_call_success_blogger_editPost', $post_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase5229 do_action( 'xmlrpc_call_success_blogger_editPost', $post_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 5230 5230 5231 5231 return true; … … 5250 5250 $this->escape( $args ); 5251 5251 5252 $post_ ID= (int) $args[1];5252 $post_id = (int) $args[1]; 5253 5253 $username = $args[2]; 5254 5254 $password = $args[3]; … … 5262 5262 do_action( 'xmlrpc_call', 'blogger.deletePost', $args, $this ); 5263 5263 5264 $actual_post = get_post( $post_ ID, ARRAY_A );5264 $actual_post = get_post( $post_id, ARRAY_A ); 5265 5265 5266 5266 if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { … … 5268 5268 } 5269 5269 5270 if ( ! current_user_can( 'delete_post', $post_ ID) ) {5270 if ( ! current_user_can( 'delete_post', $post_id ) ) { 5271 5271 return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); 5272 5272 } 5273 5273 5274 $result = wp_delete_post( $post_ ID);5274 $result = wp_delete_post( $post_id ); 5275 5275 5276 5276 if ( ! $result ) { … … 5283 5283 * @since 3.4.0 5284 5284 * 5285 * @param int $post_ IDID of the deleted post.5285 * @param int $post_id ID of the deleted post. 5286 5286 * @param array $args An array of arguments to delete the post. 5287 5287 */ 5288 do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase5288 do_action( 'xmlrpc_call_success_blogger_deletePost', $post_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 5289 5289 5290 5290 return true; … … 5581 5581 $postdata = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template' ); 5582 5582 5583 $post_ ID= get_default_post_to_edit( $post_type, true )->ID;5584 $postdata['ID'] = $post_ ID;5583 $post_id = get_default_post_to_edit( $post_type, true )->ID; 5584 $postdata['ID'] = $post_id; 5585 5585 5586 5586 // Only posts can be sticky. … … 5595 5595 5596 5596 if ( isset( $content_struct['custom_fields'] ) ) { 5597 $this->set_custom_fields( $post_ ID, $content_struct['custom_fields'] );5597 $this->set_custom_fields( $post_id, $content_struct['custom_fields'] ); 5598 5598 } 5599 5599 5600 5600 if ( isset( $content_struct['wp_post_thumbnail'] ) ) { 5601 if ( set_post_thumbnail( $post_ ID, $content_struct['wp_post_thumbnail'] ) === false ) {5601 if ( set_post_thumbnail( $post_id, $content_struct['wp_post_thumbnail'] ) === false ) { 5602 5602 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 5603 5603 } … … 5608 5608 // Handle enclosures. 5609 5609 $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; 5610 $this->add_enclosure_if_new( $post_ ID, $thisEnclosure );5611 5612 $this->attach_uploads( $post_ ID, $post_content );5610 $this->add_enclosure_if_new( $post_id, $thisEnclosure ); 5611 5612 $this->attach_uploads( $post_id, $post_content ); 5613 5613 5614 5614 // Handle post formats if assigned, value is validated earlier 5615 5615 // in this function. 5616 5616 if ( isset( $content_struct['wp_post_format'] ) ) { 5617 set_post_format( $post_ ID, $content_struct['wp_post_format'] );5618 } 5619 5620 $post_ ID= wp_insert_post( $postdata, true );5621 if ( is_wp_error( $post_ ID) ) {5622 return new IXR_Error( 500, $post_ ID->get_error_message() );5623 } 5624 5625 if ( ! $post_ ID) {5617 set_post_format( $post_id, $content_struct['wp_post_format'] ); 5618 } 5619 5620 $post_id = wp_insert_post( $postdata, true ); 5621 if ( is_wp_error( $post_id ) ) { 5622 return new IXR_Error( 500, $post_id->get_error_message() ); 5623 } 5624 5625 if ( ! $post_id ) { 5626 5626 return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); 5627 5627 } … … 5632 5632 * @since 3.4.0 5633 5633 * 5634 * @param int $post_ IDID of the new post.5634 * @param int $post_id ID of the new post. 5635 5635 * @param array $args An array of arguments to create the new post. 5636 5636 */ 5637 do_action( 'xmlrpc_call_success_mw_newPost', $post_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase5638 5639 return (string) $post_ ID;5637 do_action( 'xmlrpc_call_success_mw_newPost', $post_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 5638 5639 return (string) $post_id; 5640 5640 } 5641 5641 … … 5645 5645 * @since 2.8.0 5646 5646 * 5647 * @param int $post_ IDPost ID.5647 * @param int $post_id Post ID. 5648 5648 * @param array $enclosure Enclosure data. 5649 5649 */ 5650 public function add_enclosure_if_new( $post_ ID, $enclosure ) {5650 public function add_enclosure_if_new( $post_id, $enclosure ) { 5651 5651 if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 5652 5652 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; 5653 5653 $found = false; 5654 $enclosures = get_post_meta( $post_ ID, 'enclosure' );5654 $enclosures = get_post_meta( $post_id, 'enclosure' ); 5655 5655 if ( $enclosures ) { 5656 5656 foreach ( $enclosures as $enc ) { … … 5663 5663 } 5664 5664 if ( ! $found ) { 5665 add_post_meta( $post_ ID, 'enclosure', $encstring );5665 add_post_meta( $post_id, 'enclosure', $encstring ); 5666 5666 } 5667 5667 } … … 5675 5675 * @global wpdb $wpdb WordPress database abstraction object. 5676 5676 * 5677 * @param int $post_ IDPost ID.5677 * @param int $post_id Post ID. 5678 5678 * @param string $post_content Post Content for attachment. 5679 5679 */ 5680 public function attach_uploads( $post_ ID, $post_content ) {5680 public function attach_uploads( $post_id, $post_content ) { 5681 5681 global $wpdb; 5682 5682 … … 5686 5686 foreach ( $attachments as $file ) { 5687 5687 if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false ) { 5688 $wpdb->update( $wpdb->posts, array( 'post_parent' => $post_ ID), array( 'ID' => $file->ID ) );5688 $wpdb->update( $wpdb->posts, array( 'post_parent' => $post_id ), array( 'ID' => $file->ID ) ); 5689 5689 } 5690 5690 } … … 5711 5711 $this->escape( $args ); 5712 5712 5713 $post_ ID= (int) $args[0];5713 $post_id = (int) $args[0]; 5714 5714 $username = $args[1]; 5715 5715 $password = $args[2]; … … 5725 5725 do_action( 'xmlrpc_call', 'metaWeblog.editPost', $args, $this ); 5726 5726 5727 $postdata = get_post( $post_ ID, ARRAY_A );5727 $postdata = get_post( $post_id, ARRAY_A ); 5728 5728 5729 5729 /* … … 5735 5735 } 5736 5736 5737 if ( ! current_user_can( 'edit_post', $post_ ID) ) {5737 if ( ! current_user_can( 'edit_post', $post_id ) ) { 5738 5738 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 5739 5739 } … … 5984 5984 5985 5985 if ( isset( $content_struct['custom_fields'] ) ) { 5986 $this->set_custom_fields( $post_ ID, $content_struct['custom_fields'] );5986 $this->set_custom_fields( $post_id, $content_struct['custom_fields'] ); 5987 5987 } 5988 5988 … … 5991 5991 // Empty value deletes, non-empty value adds/updates. 5992 5992 if ( empty( $content_struct['wp_post_thumbnail'] ) ) { 5993 delete_post_thumbnail( $post_ ID);5993 delete_post_thumbnail( $post_id ); 5994 5994 } else { 5995 if ( set_post_thumbnail( $post_ ID, $content_struct['wp_post_thumbnail'] ) === false ) {5995 if ( set_post_thumbnail( $post_id, $content_struct['wp_post_thumbnail'] ) === false ) { 5996 5996 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 5997 5997 } … … 6002 6002 // Handle enclosures. 6003 6003 $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; 6004 $this->add_enclosure_if_new( $post_ ID, $thisEnclosure );6004 $this->add_enclosure_if_new( $post_id, $thisEnclosure ); 6005 6005 6006 6006 $this->attach_uploads( $ID, $post_content ); … … 6008 6008 // Handle post formats if assigned, validation is handled earlier in this function. 6009 6009 if ( isset( $content_struct['wp_post_format'] ) ) { 6010 set_post_format( $post_ ID, $content_struct['wp_post_format'] );6010 set_post_format( $post_id, $content_struct['wp_post_format'] ); 6011 6011 } 6012 6012 … … 6016 6016 * @since 3.4.0 6017 6017 * 6018 * @param int $post_ IDID of the updated post.6018 * @param int $post_id ID of the updated post. 6019 6019 * @param array $args An array of arguments to update the post. 6020 6020 */ 6021 do_action( 'xmlrpc_call_success_mw_editPost', $post_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase6021 do_action( 'xmlrpc_call_success_mw_editPost', $post_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 6022 6022 6023 6023 return true; … … 6041 6041 $this->escape( $args ); 6042 6042 6043 $post_ ID= (int) $args[0];6043 $post_id = (int) $args[0]; 6044 6044 $username = $args[1]; 6045 6045 $password = $args[2]; … … 6050 6050 } 6051 6051 6052 $postdata = get_post( $post_ ID, ARRAY_A );6052 $postdata = get_post( $post_id, ARRAY_A ); 6053 6053 if ( ! $postdata ) { 6054 6054 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 6055 6055 } 6056 6056 6057 if ( ! current_user_can( 'edit_post', $post_ ID) ) {6057 if ( ! current_user_can( 'edit_post', $post_id ) ) { 6058 6058 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 6059 6059 } … … 6069 6069 6070 6070 $categories = array(); 6071 $catids = wp_get_post_categories( $post_ ID);6071 $catids = wp_get_post_categories( $post_id ); 6072 6072 foreach ( $catids as $catid ) { 6073 6073 $categories[] = get_cat_name( $catid ); … … 6075 6075 6076 6076 $tagnames = array(); 6077 $tags = wp_get_post_tags( $post_ ID);6077 $tags = wp_get_post_tags( $post_id ); 6078 6078 if ( ! empty( $tags ) ) { 6079 6079 foreach ( $tags as $tag ) { … … 6100 6100 6101 6101 // Get post format. 6102 $post_format = get_post_format( $post_ ID);6102 $post_format = get_post_format( $post_id ); 6103 6103 if ( empty( $post_format ) ) { 6104 6104 $post_format = 'standard'; … … 6106 6106 6107 6107 $sticky = false; 6108 if ( is_sticky( $post_ ID) ) {6108 if ( is_sticky( $post_id ) ) { 6109 6109 $sticky = true; 6110 6110 } 6111 6111 6112 6112 $enclosure = array(); 6113 foreach ( (array) get_post_custom( $post_ ID) as $key => $val ) {6113 foreach ( (array) get_post_custom( $post_id ) as $key => $val ) { 6114 6114 if ( 'enclosure' === $key ) { 6115 6115 foreach ( (array) $val as $enc ) { … … 6146 6146 'date_created_gmt' => $post_date_gmt, 6147 6147 'post_status' => $postdata['post_status'], 6148 'custom_fields' => $this->get_custom_fields( $post_ ID),6148 'custom_fields' => $this->get_custom_fields( $post_id ), 6149 6149 'wp_post_format' => $post_format, 6150 6150 'sticky' => $sticky, … … 6604 6604 $this->escape( $args ); 6605 6605 6606 $post_ ID= (int) $args[0];6606 $post_id = (int) $args[0]; 6607 6607 $username = $args[1]; 6608 6608 $password = $args[2]; … … 6613 6613 } 6614 6614 6615 if ( ! get_post( $post_ ID) ) {6615 if ( ! get_post( $post_id ) ) { 6616 6616 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 6617 6617 } 6618 6618 6619 if ( ! current_user_can( 'edit_post', $post_ ID) ) {6619 if ( ! current_user_can( 'edit_post', $post_id ) ) { 6620 6620 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 6621 6621 } … … 6625 6625 6626 6626 $categories = array(); 6627 $catids = wp_get_post_categories( (int) $post_ ID);6627 $catids = wp_get_post_categories( (int) $post_id ); 6628 6628 // First listed category will be the primary category. 6629 6629 $isPrimary = true; … … 6658 6658 $this->escape( $args ); 6659 6659 6660 $post_ ID= (int) $args[0];6660 $post_id = (int) $args[0]; 6661 6661 $username = $args[1]; 6662 6662 $password = $args[2]; … … 6671 6671 do_action( 'xmlrpc_call', 'mt.setPostCategories', $args, $this ); 6672 6672 6673 if ( ! get_post( $post_ ID) ) {6673 if ( ! get_post( $post_id ) ) { 6674 6674 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 6675 6675 } 6676 6676 6677 if ( ! current_user_can( 'edit_post', $post_ ID) ) {6677 if ( ! current_user_can( 'edit_post', $post_id ) ) { 6678 6678 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 6679 6679 } … … 6684 6684 } 6685 6685 6686 wp_set_post_categories( $post_ ID, $catids );6686 wp_set_post_categories( $post_id, $catids ); 6687 6687 6688 6688 return true; … … 6729 6729 * @global wpdb $wpdb WordPress database abstraction object. 6730 6730 * 6731 * @param int $post_ ID6731 * @param int $post_id 6732 6732 * @return array|IXR_Error 6733 6733 */ 6734 public function mt_getTrackbackPings( $post_ ID) {6734 public function mt_getTrackbackPings( $post_id ) { 6735 6735 global $wpdb; 6736 6736 6737 6737 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 6738 do_action( 'xmlrpc_call', 'mt.getTrackbackPings', $post_ ID, $this );6739 6740 $actual_post = get_post( $post_ ID, ARRAY_A );6738 do_action( 'xmlrpc_call', 'mt.getTrackbackPings', $post_id, $this ); 6739 6740 $actual_post = get_post( $post_id, ARRAY_A ); 6741 6741 6742 6742 if ( ! $actual_post ) { … … 6744 6744 } 6745 6745 6746 $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ ID) );6746 $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ) ); 6747 6747 6748 6748 if ( ! $comments ) { … … 6783 6783 $this->escape( $args ); 6784 6784 6785 $post_ ID= (int) $args[0];6785 $post_id = (int) $args[0]; 6786 6786 $username = $args[1]; 6787 6787 $password = $args[2]; … … 6795 6795 do_action( 'xmlrpc_call', 'mt.publishPost', $args, $this ); 6796 6796 6797 $postdata = get_post( $post_ ID, ARRAY_A );6797 $postdata = get_post( $post_id, ARRAY_A ); 6798 6798 if ( ! $postdata ) { 6799 6799 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 6800 6800 } 6801 6801 6802 if ( ! current_user_can( 'publish_posts' ) || ! current_user_can( 'edit_post', $post_ ID) ) {6802 if ( ! current_user_can( 'publish_posts' ) || ! current_user_can( 'edit_post', $post_id ) ) { 6803 6803 return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); 6804 6804 } … … 6807 6807 6808 6808 // Retain old categories. 6809 $postdata['post_category'] = wp_get_post_categories( $post_ ID);6809 $postdata['post_category'] = wp_get_post_categories( $post_id ); 6810 6810 $this->escape( $postdata ); 6811 6811 … … 6871 6871 */ 6872 6872 $urltest = parse_url( $pagelinkedto ); 6873 $post_ ID= url_to_postid( $pagelinkedto );6874 if ( $post_ ID) {6873 $post_id = url_to_postid( $pagelinkedto ); 6874 if ( $post_id ) { 6875 6875 // $way 6876 6876 } elseif ( isset( $urltest['path'] ) && preg_match( '#p/[0-9]{1,}#', $urltest['path'], $match ) ) { 6877 6877 // The path defines the post_ID (archives/p/XXXX). 6878 6878 $blah = explode( '/', $match[0] ); 6879 $post_ ID= (int) $blah[1];6879 $post_id = (int) $blah[1]; 6880 6880 } elseif ( isset( $urltest['query'] ) && preg_match( '#p=[0-9]{1,}#', $urltest['query'], $match ) ) { 6881 6881 // The query string defines the post_ID (?p=XXXX). 6882 6882 $blah = explode( '=', $match[0] ); 6883 $post_ ID= (int) $blah[1];6883 $post_id = (int) $blah[1]; 6884 6884 } elseif ( isset( $urltest['fragment'] ) ) { 6885 6885 // An #anchor is there, it's either... 6886 6886 if ( (int) $urltest['fragment'] ) { 6887 6887 // ...an integer #XXXX (simplest case), 6888 $post_ ID= (int) $urltest['fragment'];6888 $post_id = (int) $urltest['fragment']; 6889 6889 } elseif ( preg_match( '/post-[0-9]+/', $urltest['fragment'] ) ) { 6890 6890 // ...a post ID in the form 'post-###', 6891 $post_ ID= preg_replace( '/[^0-9]+/', '', $urltest['fragment'] );6891 $post_id = preg_replace( '/[^0-9]+/', '', $urltest['fragment'] ); 6892 6892 } elseif ( is_string( $urltest['fragment'] ) ) { 6893 6893 // ...or a string #title, a little more complicated. 6894 6894 $title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] ); 6895 6895 $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title ); 6896 $post_ ID= $wpdb->get_var( $sql );6897 if ( ! $post_ ID) {6896 $post_id = $wpdb->get_var( $sql ); 6897 if ( ! $post_id ) { 6898 6898 // Returning unknown error '0' is better than die()'ing. 6899 6899 return $this->pingback_error( 0, '' ); … … 6904 6904 return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); 6905 6905 } 6906 $post_ ID = (int) $post_ID;6907 6908 $post = get_post( $post_ ID);6906 $post_id = (int) $post_id; 6907 6908 $post = get_post( $post_id ); 6909 6909 6910 6910 if ( ! $post ) { // Post not found. … … 6912 6912 } 6913 6913 6914 if ( url_to_postid( $pagelinkedfrom ) == $post_ ID) {6914 if ( url_to_postid( $pagelinkedfrom ) == $post_id ) { 6915 6915 return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); 6916 6916 } … … 6922 6922 6923 6923 // Let's check that the remote site didn't already pingback this entry. 6924 if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ ID, $pagelinkedfrom ) ) ) {6924 if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_id, $pagelinkedfrom ) ) ) { 6925 6925 return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) ); 6926 6926 } … … 7021 7021 $pagelinkedfrom = $this->escape( $pagelinkedfrom ); 7022 7022 7023 $comment_post_id = (int) $post_ ID;7023 $comment_post_id = (int) $post_id; 7024 7024 $comment_author = $title; 7025 7025 $comment_author_email = ''; … … 7083 7083 $url = $this->escape( $url ); 7084 7084 7085 $post_ ID= url_to_postid( $url );7086 if ( ! $post_ ID) {7085 $post_id = url_to_postid( $url ); 7086 if ( ! $post_id ) { 7087 7087 // We aren't sure that the resource is available and/or pingback enabled. 7088 7088 return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); 7089 7089 } 7090 7090 7091 $actual_post = get_post( $post_ ID, ARRAY_A );7091 $actual_post = get_post( $post_id, ARRAY_A ); 7092 7092 7093 7093 if ( ! $actual_post ) { … … 7096 7096 } 7097 7097 7098 $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ ID) );7098 $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ) ); 7099 7099 7100 7100 if ( ! $comments ) { -
trunk/src/wp-includes/deprecated.php
r55334 r55365 742 742 * 743 743 * @param int $blogid Not Used 744 * @param int $post_ ID744 * @param int $post_id 745 745 * @return array 746 746 */ 747 function wp_get_post_cats($blogid = '1', $post_ ID= 0) {747 function wp_get_post_cats($blogid = '1', $post_id = 0) { 748 748 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); 749 return wp_get_post_categories($post_ ID);749 return wp_get_post_categories($post_id); 750 750 } 751 751 … … 759 759 * 760 760 * @param int $blogid Not used 761 * @param int $post_ ID761 * @param int $post_id 762 762 * @param array $post_categories 763 763 * @return bool|mixed 764 764 */ 765 function wp_set_post_cats($blogid = '1', $post_ ID= 0, $post_categories = array()) {765 function wp_set_post_cats($blogid = '1', $post_id = 0, $post_categories = array()) { 766 766 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); 767 return wp_set_post_categories($post_ ID, $post_categories);767 return wp_set_post_categories($post_id, $post_categories); 768 768 } 769 769 -
trunk/src/wp-includes/post.php
r55252 r55365 4094 4094 4095 4095 // Are we updating or creating? 4096 $post_ ID= 0;4096 $post_id = 0; 4097 4097 $update = false; 4098 4098 $guid = $postarr['guid']; … … 4102 4102 4103 4103 // Get the post ID and GUID. 4104 $post_ ID= $postarr['ID'];4105 $post_before = get_post( $post_ ID);4104 $post_id = $postarr['ID']; 4105 $post_before = get_post( $post_id ); 4106 4106 4107 4107 if ( is_null( $post_before ) ) { … … 4112 4112 } 4113 4113 4114 $guid = get_post_field( 'guid', $post_ ID);4115 $previous_status = get_post_field( 'post_status', $post_ ID);4114 $guid = get_post_field( 'guid', $post_id ); 4115 $previous_status = get_post_field( 'post_status', $post_id ); 4116 4116 } else { 4117 4117 $previous_status = 'new'; … … 4195 4195 if ( ! $update && $post_type_object && ! current_user_can( $post_type_object->cap->publish_posts ) ) { 4196 4196 $post_name = ''; 4197 } elseif ( $update && ! current_user_can( 'publish_post', $post_ ID) ) {4197 } elseif ( $update && ! current_user_can( 'publish_post', $post_id ) ) { 4198 4198 $post_name = ''; 4199 4199 } … … 4214 4214 $check_name = sanitize_title( $post_name, '', 'old-save' ); 4215 4215 4216 if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ ID) == $check_name ) {4216 if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_id ) == $check_name ) { 4217 4217 $post_name = $check_name; 4218 4218 } else { // New post, or slug has changed. … … 4309 4309 $new_postarr = array_merge( 4310 4310 array( 4311 'ID' => $post_ ID,4311 'ID' => $post_id, 4312 4312 ), 4313 4313 compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) ) … … 4320 4320 * 4321 4321 * @param int $post_parent Post parent ID. 4322 * @param int $post_ IDPost ID.4322 * @param int $post_id Post ID. 4323 4323 * @param array $new_postarr Array of parsed post data. 4324 4324 * @param array $postarr Array of sanitized, but otherwise unmodified post data. 4325 4325 */ 4326 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ ID, $new_postarr, $postarr );4326 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_id, $new_postarr, $postarr ); 4327 4327 4328 4328 /* … … 4331 4331 */ 4332 4332 if ( 'trash' === $previous_status && 'trash' !== $post_status ) { 4333 $desired_post_slug = get_post_meta( $post_ ID, '_wp_desired_post_slug', true );4333 $desired_post_slug = get_post_meta( $post_id, '_wp_desired_post_slug', true ); 4334 4334 4335 4335 if ( $desired_post_slug ) { 4336 delete_post_meta( $post_ ID, '_wp_desired_post_slug' );4336 delete_post_meta( $post_id, '_wp_desired_post_slug' ); 4337 4337 $post_name = $desired_post_slug; 4338 4338 } … … 4348 4348 * @param bool $add_trashed_suffix Whether to attempt to add the suffix. 4349 4349 * @param string $post_name The name of the post being updated. 4350 * @param int $post_ IDPost ID.4350 * @param int $post_id Post ID. 4351 4351 */ 4352 $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ ID);4352 $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_id ); 4353 4353 4354 4354 if ( $add_trashed_suffix ) { 4355 wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ ID);4355 wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id ); 4356 4356 } 4357 4357 } … … 4359 4359 // When trashing an existing post, change its slug to allow non-trashed posts to use it. 4360 4360 if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) { 4361 $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ ID);4362 } 4363 4364 $post_name = wp_unique_post_slug( $post_name, $post_ ID, $post_status, $post_type, $post_parent );4361 $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_id ); 4362 } 4363 4364 $post_name = wp_unique_post_slug( $post_name, $post_id, $post_status, $post_type, $post_parent ); 4365 4365 4366 4366 // Don't unslash. … … 4437 4437 4438 4438 $data = wp_unslash( $data ); 4439 $where = array( 'ID' => $post_ ID);4439 $where = array( 'ID' => $post_id ); 4440 4440 4441 4441 if ( $update ) { … … 4445 4445 * @since 2.5.0 4446 4446 * 4447 * @param int $post_ IDPost ID.4447 * @param int $post_id Post ID. 4448 4448 * @param array $data Array of unslashed post data. 4449 4449 */ 4450 do_action( 'pre_post_update', $post_ ID, $data );4450 do_action( 'pre_post_update', $post_id, $data ); 4451 4451 4452 4452 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { … … 4487 4487 } 4488 4488 4489 $post_ ID= (int) $wpdb->insert_id;4490 4491 // Use the newly generated $post_ ID.4492 $where = array( 'ID' => $post_ ID);4489 $post_id = (int) $wpdb->insert_id; 4490 4491 // Use the newly generated $post_id. 4492 $where = array( 'ID' => $post_id ); 4493 4493 } 4494 4494 4495 4495 if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) { 4496 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ ID ), $post_ID, $data['post_status'], $post_type, $post_parent );4496 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_id ), $post_id, $data['post_status'], $post_type, $post_parent ); 4497 4497 4498 4498 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 4499 clean_post_cache( $post_ ID);4499 clean_post_cache( $post_id ); 4500 4500 } 4501 4501 4502 4502 if ( is_object_in_taxonomy( $post_type, 'category' ) ) { 4503 wp_set_post_categories( $post_ ID, $post_category );4503 wp_set_post_categories( $post_id, $post_category ); 4504 4504 } 4505 4505 4506 4506 if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) { 4507 wp_set_post_tags( $post_ ID, $postarr['tags_input'] );4507 wp_set_post_tags( $post_id, $postarr['tags_input'] ); 4508 4508 } 4509 4509 … … 4520 4520 4521 4521 // Passed custom taxonomy list overwrites the existing list if not empty. 4522 $terms = wp_get_object_terms( $post_ ID, $taxonomy, array( 'fields' => 'ids' ) );4522 $terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'ids' ) ); 4523 4523 if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { 4524 4524 $postarr['tax_input'][ $taxonomy ] = $terms; … … 4552 4552 4553 4553 if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) { 4554 wp_set_post_terms( $post_ ID, $tags, $taxonomy );4554 wp_set_post_terms( $post_id, $tags, $taxonomy ); 4555 4555 } 4556 4556 } … … 4559 4559 if ( ! empty( $postarr['meta_input'] ) ) { 4560 4560 foreach ( $postarr['meta_input'] as $field => $value ) { 4561 update_post_meta( $post_ ID, $field, $value );4562 } 4563 } 4564 4565 $current_guid = get_post_field( 'guid', $post_ ID);4561 update_post_meta( $post_id, $field, $value ); 4562 } 4563 } 4564 4565 $current_guid = get_post_field( 'guid', $post_id ); 4566 4566 4567 4567 // Set GUID. 4568 4568 if ( ! $update && '' === $current_guid ) { 4569 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ ID) ), $where );4569 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_id ) ), $where ); 4570 4570 } 4571 4571 4572 4572 if ( 'attachment' === $postarr['post_type'] ) { 4573 4573 if ( ! empty( $postarr['file'] ) ) { 4574 update_attached_file( $post_ ID, $postarr['file'] );4574 update_attached_file( $post_id, $postarr['file'] ); 4575 4575 } 4576 4576 4577 4577 if ( ! empty( $postarr['context'] ) ) { 4578 add_post_meta( $post_ ID, '_wp_attachment_context', $postarr['context'], true );4578 add_post_meta( $post_id, '_wp_attachment_context', $postarr['context'], true ); 4579 4579 } 4580 4580 } … … 4585 4585 4586 4586 if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { 4587 if ( wp_attachment_is( 'audio', $post_ ID) ) {4587 if ( wp_attachment_is( 'audio', $post_id ) ) { 4588 4588 $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); 4589 } elseif ( wp_attachment_is( 'video', $post_ ID) ) {4589 } elseif ( wp_attachment_is( 'video', $post_id ) ) { 4590 4590 $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); 4591 4591 } … … 4595 4595 $thumbnail_id = (int) $postarr['_thumbnail_id']; 4596 4596 if ( -1 === $thumbnail_id ) { 4597 delete_post_thumbnail( $post_ ID);4597 delete_post_thumbnail( $post_id ); 4598 4598 } else { 4599 set_post_thumbnail( $post_ ID, $thumbnail_id );4599 set_post_thumbnail( $post_id, $thumbnail_id ); 4600 4600 } 4601 4601 } 4602 4602 } 4603 4603 4604 clean_post_cache( $post_ ID);4605 4606 $post = get_post( $post_ ID);4604 clean_post_cache( $post_id ); 4605 4606 $post = get_post( $post_id ); 4607 4607 4608 4608 if ( ! empty( $postarr['page_template'] ) ) { … … 4615 4615 } 4616 4616 4617 update_post_meta( $post_ ID, '_wp_page_template', 'default' );4617 update_post_meta( $post_id, '_wp_page_template', 'default' ); 4618 4618 } else { 4619 update_post_meta( $post_ ID, '_wp_page_template', $postarr['page_template'] );4619 update_post_meta( $post_id, '_wp_page_template', $postarr['page_template'] ); 4620 4620 } 4621 4621 } … … 4630 4630 * @since 2.0.0 4631 4631 * 4632 * @param int $post_ IDAttachment ID.4632 * @param int $post_id Attachment ID. 4633 4633 */ 4634 do_action( 'edit_attachment', $post_ ID);4635 4636 $post_after = get_post( $post_ ID);4634 do_action( 'edit_attachment', $post_id ); 4635 4636 $post_after = get_post( $post_id ); 4637 4637 4638 4638 /** … … 4641 4641 * @since 4.4.0 4642 4642 * 4643 * @param int $post_ IDPost ID.4643 * @param int $post_id Post ID. 4644 4644 * @param WP_Post $post_after Post object following the update. 4645 4645 * @param WP_Post $post_before Post object before the update. 4646 4646 */ 4647 do_action( 'attachment_updated', $post_ ID, $post_after, $post_before );4647 do_action( 'attachment_updated', $post_id, $post_after, $post_before ); 4648 4648 } else { 4649 4649 … … 4653 4653 * @since 2.0.0 4654 4654 * 4655 * @param int $post_ IDAttachment ID.4655 * @param int $post_id Attachment ID. 4656 4656 */ 4657 do_action( 'add_attachment', $post_ ID);4658 } 4659 4660 return $post_ ID;4657 do_action( 'add_attachment', $post_id ); 4658 } 4659 4660 return $post_id; 4661 4661 } 4662 4662 … … 4675 4675 * @since 5.1.0 4676 4676 * 4677 * @param int $post_ IDPost ID.4677 * @param int $post_id Post ID. 4678 4678 * @param WP_Post $post Post object. 4679 4679 */ 4680 do_action( "edit_post_{$post->post_type}", $post_ ID, $post );4680 do_action( "edit_post_{$post->post_type}", $post_id, $post ); 4681 4681 4682 4682 /** … … 4685 4685 * @since 1.2.0 4686 4686 * 4687 * @param int $post_ IDPost ID.4687 * @param int $post_id Post ID. 4688 4688 * @param WP_Post $post Post object. 4689 4689 */ 4690 do_action( 'edit_post', $post_ ID, $post );4691 4692 $post_after = get_post( $post_ ID);4690 do_action( 'edit_post', $post_id, $post ); 4691 4692 $post_after = get_post( $post_id ); 4693 4693 4694 4694 /** … … 4697 4697 * @since 3.0.0 4698 4698 * 4699 * @param int $post_ IDPost ID.4699 * @param int $post_id Post ID. 4700 4700 * @param WP_Post $post_after Post object following the update. 4701 4701 * @param WP_Post $post_before Post object before the update. 4702 4702 */ 4703 do_action( 'post_updated', $post_ ID, $post_after, $post_before );4703 do_action( 'post_updated', $post_id, $post_after, $post_before ); 4704 4704 } 4705 4705 … … 4717 4717 * @since 3.7.0 4718 4718 * 4719 * @param int $post_ IDPost ID.4719 * @param int $post_id Post ID. 4720 4720 * @param WP_Post $post Post object. 4721 4721 * @param bool $update Whether this is an existing post being updated. 4722 4722 */ 4723 do_action( "save_post_{$post->post_type}", $post_ ID, $post, $update );4723 do_action( "save_post_{$post->post_type}", $post_id, $post, $update ); 4724 4724 4725 4725 /** … … 4728 4728 * @since 1.5.0 4729 4729 * 4730 * @param int $post_ IDPost ID.4730 * @param int $post_id Post ID. 4731 4731 * @param WP_Post $post Post object. 4732 4732 * @param bool $update Whether this is an existing post being updated. 4733 4733 */ 4734 do_action( 'save_post', $post_ ID, $post, $update );4734 do_action( 'save_post', $post_id, $post, $update ); 4735 4735 4736 4736 /** … … 4739 4739 * @since 2.0.0 4740 4740 * 4741 * @param int $post_ IDPost ID.4741 * @param int $post_id Post ID. 4742 4742 * @param WP_Post $post Post object. 4743 4743 * @param bool $update Whether this is an existing post being updated. 4744 4744 */ 4745 do_action( 'wp_insert_post', $post_ ID, $post, $update );4745 do_action( 'wp_insert_post', $post_id, $post, $update ); 4746 4746 4747 4747 if ( $fire_after_hooks ) { … … 4749 4749 } 4750 4750 4751 return $post_ ID;4751 return $post_id; 4752 4752 } 4753 4753 … … 4994 4994 * 4995 4995 * @param string $slug The desired slug (post_name). 4996 * @param int $post_ IDPost ID.4996 * @param int $post_id Post ID. 4997 4997 * @param string $post_status No uniqueness checks are made if the post is still draft or pending. 4998 4998 * @param string $post_type Post type. … … 5000 5000 * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) 5001 5001 */ 5002 function wp_unique_post_slug( $slug, $post_ ID, $post_status, $post_type, $post_parent ) {5002 function wp_unique_post_slug( $slug, $post_id, $post_status, $post_type, $post_parent ) { 5003 5003 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) 5004 5004 || ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type … … 5017 5017 * @param string|null $override_slug Short-circuit return value. 5018 5018 * @param string $slug The desired slug (post_name). 5019 * @param int $post_ IDPost ID.5019 * @param int $post_id Post ID. 5020 5020 * @param string $post_status The post status. 5021 5021 * @param string $post_type Post type. 5022 5022 * @param int $post_parent Post parent ID. 5023 5023 */ 5024 $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ ID, $post_status, $post_type, $post_parent );5024 $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_id, $post_status, $post_type, $post_parent ); 5025 5025 if ( null !== $override_slug ) { 5026 5026 return $override_slug; … … 5039 5039 // Attachment slugs must be unique across all types. 5040 5040 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; 5041 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ ID) );5041 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_id ) ); 5042 5042 5043 5043 /** … … 5058 5058 do { 5059 5059 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5060 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ ID) );5060 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_id ) ); 5061 5061 $suffix++; 5062 5062 } while ( $post_name_check ); … … 5073 5073 */ 5074 5074 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1"; 5075 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ ID, $post_parent ) );5075 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_id, $post_parent ) ); 5076 5076 5077 5077 /** … … 5095 5095 do { 5096 5096 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5097 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ ID, $post_parent ) );5097 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_id, $post_parent ) ); 5098 5098 $suffix++; 5099 5099 } while ( $post_name_check ); … … 5103 5103 // Post slugs must be unique across all posts. 5104 5104 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 5105 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ ID) );5106 5107 $post = get_post( $post_ ID);5105 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_id ) ); 5106 5107 $post = get_post( $post_id ); 5108 5108 5109 5109 // Prevent new post slugs that could result in URLs that conflict with date archives. … … 5151 5151 do { 5152 5152 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5153 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ ID) );5153 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_id ) ); 5154 5154 $suffix++; 5155 5155 } while ( $post_name_check ); … … 5164 5164 * 5165 5165 * @param string $slug The post slug. 5166 * @param int $post_ IDPost ID.5166 * @param int $post_id Post ID. 5167 5167 * @param string $post_status The post status. 5168 5168 * @param string $post_type Post type. … … 5170 5170 * @param string $original_slug The original post slug. 5171 5171 */ 5172 return apply_filters( 'wp_unique_post_slug', $slug, $post_ ID, $post_status, $post_type, $post_parent, $original_slug );5172 return apply_filters( 'wp_unique_post_slug', $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug ); 5173 5173 } 5174 5174 … … 5286 5286 * @since 2.1.0 5287 5287 * 5288 * @param int $post_ IDOptional. The Post ID. Does not default to the ID5288 * @param int $post_id Optional. The Post ID. Does not default to the ID 5289 5289 * of the global $post. Default 0. 5290 5290 * @param int[]|int $post_categories Optional. List of category IDs, or the ID of a single category. … … 5294 5294 * @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure. 5295 5295 */ 5296 function wp_set_post_categories( $post_ ID= 0, $post_categories = array(), $append = false ) {5297 $post_ ID = (int) $post_ID;5298 $post_type = get_post_type( $post_ ID);5299 $post_status = get_post_status( $post_ ID);5296 function wp_set_post_categories( $post_id = 0, $post_categories = array(), $append = false ) { 5297 $post_id = (int) $post_id; 5298 $post_type = get_post_type( $post_id ); 5299 $post_status = get_post_status( $post_id ); 5300 5300 5301 5301 // If $post_categories isn't already an array, make it one. … … 5328 5328 } 5329 5329 5330 return wp_set_post_terms( $post_ ID, $post_categories, 'category', $append );5330 return wp_set_post_terms( $post_id, $post_categories, 'category', $append ); 5331 5331 } 5332 5332 … … 7672 7672 * 7673 7673 * @param int $post_parent ID of the parent for the post we're checking. 7674 * @param int $post_ IDID of the post we're checking.7674 * @param int $post_id ID of the post we're checking. 7675 7675 * @return int The new post_parent for the post, 0 otherwise. 7676 7676 */ 7677 function wp_check_post_hierarchy_for_loops( $post_parent, $post_ ID) {7677 function wp_check_post_hierarchy_for_loops( $post_parent, $post_id ) { 7678 7678 // Nothing fancy here - bail. 7679 7679 if ( ! $post_parent ) { … … 7682 7682 7683 7683 // New post can't cause a loop. 7684 if ( ! $post_ ID) {7684 if ( ! $post_id ) { 7685 7685 return $post_parent; 7686 7686 } 7687 7687 7688 7688 // Can't be its own parent. 7689 if ( $post_parent == $post_ ID) {7689 if ( $post_parent == $post_id ) { 7690 7690 return 0; 7691 7691 } 7692 7692 7693 7693 // Now look for larger loops. 7694 $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ ID, $post_parent );7694 $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_id, $post_parent ); 7695 7695 if ( ! $loop ) { 7696 7696 return $post_parent; // No loop. … … 7698 7698 7699 7699 // Setting $post_parent to the given value causes a loop. 7700 if ( isset( $loop[ $post_ ID] ) ) {7700 if ( isset( $loop[ $post_id ] ) ) { 7701 7701 return 0; 7702 7702 } 7703 7703 7704 // There's a loop, but it doesn't contain $post_ ID. Break the loop.7704 // There's a loop, but it doesn't contain $post_id. Break the loop. 7705 7705 foreach ( array_keys( $loop ) as $loop_member ) { 7706 7706 wp_update_post( … … 7918 7918 * 7919 7919 * @param string $post_name Post slug. 7920 * @param int $post_ IDOptional. Post ID that should be ignored. Default 0.7921 */ 7922 function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ ID= 0 ) {7920 * @param int $post_id Optional. Post ID that should be ignored. Default 0. 7921 */ 7922 function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id = 0 ) { 7923 7923 $trashed_posts_with_desired_slug = get_posts( 7924 7924 array( … … 7927 7927 'post_type' => 'any', 7928 7928 'nopaging' => true, 7929 'post__not_in' => array( $post_ ID),7929 'post__not_in' => array( $post_id ), 7930 7930 ) 7931 7931 ); -
trunk/src/wp-includes/theme-templates.php
r55276 r55365 40 40 * @param string $override_slug The filtered value of the slug (starts as `null` from apply_filter). 41 41 * @param string $slug The original/un-filtered slug (post_name). 42 * @param int $post_ IDPost ID.42 * @param int $post_id Post ID. 43 43 * @param string $post_status No uniqueness checks are made if the post is still draft or pending. 44 44 * @param string $post_type Post type. 45 45 * @return string The original, desired slug. 46 46 */ 47 function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ ID, $post_status, $post_type ) {47 function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_id, $post_status, $post_type ) { 48 48 if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) { 49 49 return $override_slug; … … 62 62 */ 63 63 $theme = get_stylesheet(); 64 $terms = get_the_terms( $post_ ID, 'wp_theme' );64 $terms = get_the_terms( $post_id, 'wp_theme' ); 65 65 if ( $terms && ! is_wp_error( $terms ) ) { 66 66 $theme = $terms[0]->name; … … 72 72 'posts_per_page' => 1, 73 73 'no_found_rows' => true, 74 'post__not_in' => array( $post_ ID),74 'post__not_in' => array( $post_id ), 75 75 'tax_query' => array( 76 76 array( -
trunk/tests/phpunit/tests/post.php
r55115 r55365 468 468 } 469 469 470 public function filter_pre_wp_unique_post_slug( $override_slug, $slug, $post_ ID, $post_status, $post_type, $post_parent ) {470 public function filter_pre_wp_unique_post_slug( $override_slug, $slug, $post_id, $post_status, $post_type, $post_parent ) { 471 471 return 'override-slug-' . $post_type; 472 472 } -
trunk/tests/phpunit/tests/term/isObjectInTerm.php
r52836 r55365 120 120 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 121 121 122 $post_ ID= self::factory()->post->create();123 wp_set_object_terms( $post_ ID, $t, 'wptests_tax' );122 $post_id = self::factory()->post->create(); 123 wp_set_object_terms( $post_id, $t, 'wptests_tax' ); 124 124 125 125 $int_tax_name = $t . '_term_name'; 126 126 127 $this->assertFalse( is_object_in_term( $post_ ID, 'wptests_tax', $int_tax_name ) );127 $this->assertFalse( is_object_in_term( $post_id, 'wptests_tax', $int_tax_name ) ); 128 128 129 129 // Verify it works properly when the post is actually in the term. 130 wp_set_object_terms( $post_ ID, array( $int_tax_name ), 'wptests_tax' );131 $this->assertTrue( is_object_in_term( $post_ ID, 'wptests_tax', $int_tax_name ) );130 wp_set_object_terms( $post_id, array( $int_tax_name ), 'wptests_tax' ); 131 $this->assertTrue( is_object_in_term( $post_id, 'wptests_tax', $int_tax_name ) ); 132 132 } 133 133
Note: See TracChangeset
for help on using the changeset viewer.