Changeset 49108 for trunk/src/wp-admin/includes/ajax-actions.php
- Timestamp:
- 10/08/2020 09:13:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r49071 r49108 228 228 */ 229 229 function wp_ajax_imgedit_preview() { 230 $post_id = intval( $_GET['postid'] );230 $post_id = (int) $_GET['postid']; 231 231 if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { 232 232 wp_die( -1 ); … … 1955 1955 function wp_ajax_get_permalink() { 1956 1956 check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); 1957 $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ): 0;1957 $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; 1958 1958 wp_die( get_preview_post_link( $post_id ) ); 1959 1959 } … … 1966 1966 function wp_ajax_sample_permalink() { 1967 1967 check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); 1968 $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ): 0;1968 $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; 1969 1969 $title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : ''; 1970 1970 $slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null; … … 2595 2595 */ 2596 2596 function wp_ajax_image_editor() { 2597 $attachment_id = intval( $_POST['postid'] );2597 $attachment_id = (int) $_POST['postid']; 2598 2598 2599 2599 if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { … … 2652 2652 $json = ! empty( $_REQUEST['json'] ); // New-style request. 2653 2653 2654 $post_ID = intval( $_POST['post_id'] );2654 $post_ID = (int) $_POST['post_id']; 2655 2655 if ( ! current_user_can( 'edit_post', $post_ID ) ) { 2656 2656 wp_die( -1 ); 2657 2657 } 2658 2658 2659 $thumbnail_id = intval( $_POST['thumbnail_id'] );2659 $thumbnail_id = (int) $_POST['thumbnail_id']; 2660 2660 2661 2661 if ( $json ) { … … 2688 2688 */ 2689 2689 function wp_ajax_get_post_thumbnail_html() { 2690 $post_ID = intval( $_POST['post_id'] );2690 $post_ID = (int) $_POST['post_id']; 2691 2691 2692 2692 check_ajax_referer( "update-post_$post_ID" ); … … 2696 2696 } 2697 2697 2698 $thumbnail_id = intval( $_POST['thumbnail_id'] );2698 $thumbnail_id = (int) $_POST['thumbnail_id']; 2699 2699 2700 2700 // For backward compatibility, -1 refers to no featured image. … … 3209 3209 $attachment = wp_unslash( $_POST['attachment'] ); 3210 3210 3211 $id = intval( $attachment['id'] );3211 $id = (int) $attachment['id']; 3212 3212 3213 3213 $post = get_post( $id ); … … 3222 3222 if ( current_user_can( 'edit_post', $id ) ) { 3223 3223 // If this attachment is unattached, attach it. Primarily a back compat thing. 3224 $insert_into_post_id = intval( $_POST['post_id'] );3224 $insert_into_post_id = (int) $_POST['post_id']; 3225 3225 3226 3226 if ( 0 == $post->post_parent && $insert_into_post_id ) { … … 3623 3623 } 3624 3624 3625 $post_id = isset( $_POST['post_ID'] ) ? intval( $_POST['post_ID'] ): 0;3625 $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; 3626 3626 3627 3627 if ( $post_id > 0 ) { … … 3675 3675 if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { 3676 3676 if ( ! isset( $content_width ) ) { 3677 $content_width = intval( $_POST['maxwidth'] );3677 $content_width = (int) $_POST['maxwidth']; 3678 3678 } else { 3679 $content_width = min( $content_width, intval( $_POST['maxwidth'] ));3679 $content_width = min( $content_width, (int) $_POST['maxwidth'] ); 3680 3680 } 3681 3681 }
Note: See TracChangeset
for help on using the changeset viewer.