-
diff --git a/src/wp-admin/admin-header.php b/src/wp-admin/admin-header.php
index 35b1686b51..952e51a345 100644
a
|
b
|
|
170 | 170 | $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; |
171 | 171 | } |
172 | 172 | |
173 | | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) ); |
| 173 | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' )); |
174 | 174 | $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
175 | 175 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
176 | 176 | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
-
diff --git a/src/wp-admin/async-upload.php b/src/wp-admin/async-upload.php
index 39f28a6237..d1c9b6e1b2 100644
a
|
b
|
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // Just fetch the detail form for that attachment. |
42 | | if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) { |
43 | | $id = intval( $_REQUEST['attachment_id'] ); |
| 42 | if ( isset( $_REQUEST['attachment_id'] ) && (int) $_REQUEST['attachment_id'] && $_REQUEST['fetch'] ) { |
| 43 | $id = (int) $_REQUEST['attachment_id']; |
44 | 44 | $post = get_post( $id ); |
45 | 45 | if ( 'attachment' !== $post->post_type ) { |
46 | 46 | wp_die( __( 'Invalid post type.' ) ); |
-
diff --git a/src/wp-admin/edit-comments.php b/src/wp-admin/edit-comments.php
index 2ced05ab2d..06b228644c 100644
a
|
b
|
|
329 | 329 | <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
330 | 330 | |
331 | 331 | <?php if ( $post_id ) : ?> |
332 | | <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
| 332 | <input type="hidden" name="p" value="<?php echo esc_attr((int) $post_id); ?>" /> |
333 | 333 | <?php endif; ?> |
334 | 334 | <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" /> |
335 | 335 | <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" /> |
-
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 09fa49cb94..c031e2e78b 100644
a
|
b
|
function wp_ajax_wp_compression_test() { |
227 | 227 | * @since 3.1.0 |
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 ); |
233 | 233 | } |
… |
… |
function wp_ajax_menu_quick_search() { |
1954 | 1954 | */ |
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 | } |
1960 | 1960 | |
… |
… |
function wp_ajax_get_permalink() { |
1965 | 1965 | */ |
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; |
1971 | 1971 | wp_die( get_sample_permalink_html( $post_id, $title, $slug ) ); |
… |
… |
function wp_ajax_upload_attachment() { |
2594 | 2594 | * @since 3.1.0 |
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 ) ) { |
2600 | 2600 | wp_die( -1 ); |
… |
… |
function wp_ajax_image_editor() { |
2651 | 2651 | function wp_ajax_set_post_thumbnail() { |
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 ) { |
2662 | 2662 | check_ajax_referer( "update-post_$post_ID" ); |
… |
… |
function wp_ajax_set_post_thumbnail() { |
2687 | 2687 | * @since 4.6.0 |
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" ); |
2693 | 2693 | |
… |
… |
function wp_ajax_get_post_thumbnail_html() { |
2695 | 2695 | wp_die( -1 ); |
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. |
2701 | 2701 | if ( -1 === $thumbnail_id ) { |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
3208 | 3208 | |
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 ); |
3214 | 3214 | if ( ! $post ) { |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
3221 | 3221 | |
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 ) { |
3227 | 3227 | wp_update_post( |
… |
… |
function wp_ajax_parse_embed() { |
3622 | 3622 | wp_send_json_error(); |
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 ) { |
3628 | 3628 | $post = get_post( $post_id ); |
… |
… |
function wp_ajax_parse_embed() { |
3674 | 3674 | // Set $content_width so any embeds fit in the destination iframe. |
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 | } |
3682 | 3682 | |
-
diff --git a/src/wp-admin/includes/class-walker-nav-menu-checklist.php b/src/wp-admin/includes/class-walker-nav-menu-checklist.php
index 11e78dd529..3f4d6c1574 100644
a
|
b
|
public function end_lvl( &$output, $depth = 0, $args = null ) { |
74 | 74 | public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { |
75 | 75 | global $_nav_menu_placeholder, $nav_menu_selected_id; |
76 | 76 | |
77 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 77 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
78 | 78 | $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
79 | 79 | $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; |
80 | 80 | |
-
diff --git a/src/wp-admin/includes/class-wp-importer.php b/src/wp-admin/includes/class-wp-importer.php
index e677074a94..b60c783c90 100644
a
|
b
|
public function get_imported_posts( $importer_name, $bid ) { |
37 | 37 | if ( ! empty( $results ) ) { |
38 | 38 | foreach ( $results as $r ) { |
39 | 39 | // Set permalinks into array. |
40 | | $hashtable[ $r->meta_value ] = intval( $r->post_id ); |
| 40 | $hashtable[ $r->meta_value ] = (int) $r->post_id; |
41 | 41 | } |
42 | 42 | } |
43 | 43 | } while ( count( $results ) == $limit ); |
… |
… |
public function count_imported_posts( $importer_name, $bid ) { |
69 | 69 | $result = $wpdb->get_results( $sql ); |
70 | 70 | |
71 | 71 | if ( ! empty( $result ) ) { |
72 | | $count = intval( $result[0]->cnt ); |
| 72 | $count = (int) $result[0]->cnt; |
73 | 73 | } |
74 | 74 | |
75 | 75 | // Unset to save memory. |
… |
… |
public function get_imported_comments( $bid ) { |
106 | 106 | foreach ( $results as $r ) { |
107 | 107 | // Explode comment_agent key. |
108 | 108 | list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent ); |
109 | | $source_comment_id = intval( $source_comment_id ); |
| 109 | $source_comment_id = (int) $source_comment_id; |
110 | 110 | |
111 | 111 | // Check if this comment came from this blog. |
112 | 112 | if ( $bid == $ca_bid ) { |
113 | | $hashtable[ $source_comment_id ] = intval( $r->comment_ID ); |
| 113 | $hashtable[ $source_comment_id ] = (int) $r->comment_ID; |
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
-
diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
index 7f72767693..0a05b8e19e 100644
a
|
b
|
protected function get_items_per_page( $option, $default = 20 ) { |
816 | 816 | * |
817 | 817 | * @param int $per_page Number of items to be displayed. Default 20. |
818 | 818 | */ |
819 | | return (int) apply_filters( "{$option}", $per_page ); |
| 819 | return (int) apply_filters( (string) ( $option ), $per_page ); |
820 | 820 | } |
821 | 821 | |
822 | 822 | /** |
-
diff --git a/src/wp-admin/includes/class-wp-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php
index e1d15d6337..ea7325d43b 100644
a
|
b
|
public function prepare_items() { |
103 | 103 | } |
104 | 104 | |
105 | 105 | $args = array( |
106 | | 'number' => intval( $per_page ), |
107 | | 'offset' => intval( ( $pagenum - 1 ) * $per_page ), |
| 106 | 'number' => (int) $per_page, |
| 107 | 'offset' => (int) (($pagenum - 1 ) * $per_page), |
108 | 108 | 'network_id' => get_current_network_id(), |
109 | 109 | ); |
110 | 110 | |
… |
… |
protected function site_states( $site ) { |
620 | 620 | |
621 | 621 | $site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; |
622 | 622 | foreach ( $this->status_list as $status => $col ) { |
623 | | if ( ( 1 === intval( $_site->{$status} ) ) && ( $site_status !== $status ) ) { |
| 623 | if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) { |
624 | 624 | $site_states[ $col[0] ] = $col[1]; |
625 | 625 | } |
626 | 626 | } |
-
diff --git a/src/wp-admin/includes/class-wp-ms-themes-list-table.php b/src/wp-admin/includes/class-wp-ms-themes-list-table.php
index de1b741234..113fad5c43 100644
a
|
b
|
public function __construct( $args = array() ) { |
63 | 63 | $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false; |
64 | 64 | |
65 | 65 | if ( $this->is_site_themes ) { |
66 | | $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 66 | $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) && |
-
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index a7d4748840..b2e29f210f 100644
a
|
b
|
public function __construct( $args = array() ) { |
89 | 89 | 'show_in_admin_all_list' => false, |
90 | 90 | ) |
91 | 91 | ); |
92 | | $this->user_posts_count = intval( |
93 | | $wpdb->get_var( |
| 92 | $this->user_posts_count = (int) $wpdb->get_var( |
94 | 93 | $wpdb->prepare( |
95 | | " |
| 94 | " |
96 | 95 | SELECT COUNT( 1 ) |
97 | 96 | FROM $wpdb->posts |
98 | 97 | WHERE post_type = %s |
99 | 98 | AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
100 | 99 | AND post_author = %d |
101 | 100 | ", |
102 | | $post_type, |
103 | | get_current_user_id() |
| 101 | $post_type, |
| 102 | get_current_user_id() |
104 | 103 | ) |
105 | | ) |
106 | 104 | ); |
107 | 105 | |
108 | 106 | if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) { |
-
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
index 440527f249..a4d9966c74 100644
a
|
b
|
public function render_per_page_options() { |
1254 | 1254 | $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
1255 | 1255 | } else { |
1256 | 1256 | /** This filter is documented in wp-admin/includes/class-wp-list-table.php */ |
1257 | | $per_page = apply_filters( "{$option}", $per_page ); |
| 1257 | $per_page = apply_filters( (string) ( $option ), $per_page ); |
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | // Back compat. |
-
diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php
index 018654bdd2..ae52238844 100644
a
|
b
|
public function __construct( $args = array() ) { |
54 | 54 | $this->is_site_users = 'site-users-network' === $this->screen->id; |
55 | 55 | |
56 | 56 | if ( $this->is_site_users ) { |
57 | | $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 57 | $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
-
diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
index 6b49163092..12a069eef6 100644
a
|
b
|
function wp_dashboard_recent_drafts( $drafts = false ) { |
606 | 606 | echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>"; |
607 | 607 | |
608 | 608 | /* translators: Maximum number of words used in a preview of a draft on the dashboard. */ |
609 | | $draft_length = intval( _x( '10', 'draft_length' ) ); |
| 609 | $draft_length = (int) _x( '10', 'draft_length' ); |
610 | 610 | |
611 | 611 | $drafts = array_slice( $drafts, 0, 3 ); |
612 | 612 | foreach ( $drafts as $draft ) { |
… |
… |
function wp_dashboard_recent_posts( $args ) { |
928 | 928 | 'post_status' => $args['status'], |
929 | 929 | 'orderby' => 'date', |
930 | 930 | 'order' => $args['order'], |
931 | | 'posts_per_page' => intval( $args['max'] ), |
| 931 | 'posts_per_page' => (int) $args['max'], |
932 | 932 | 'no_found_rows' => true, |
933 | 933 | 'cache_results' => false, |
934 | 934 | 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable', |
-
diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php
index 7b1b797eb4..92d84baa46 100644
a
|
b
|
function wxr_authors_list( array $post_ids = null ) { |
372 | 372 | |
373 | 373 | foreach ( $authors as $author ) { |
374 | 374 | echo "\t<wp:author>"; |
375 | | echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>'; |
| 375 | echo '<wp:author_id>' . (int) $author->ID . '</wp:author_id>'; |
376 | 376 | echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>'; |
377 | 377 | echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>'; |
378 | 378 | echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; |
… |
… |
function wxr_nav_menu_terms() { |
395 | 395 | |
396 | 396 | foreach ( $nav_menus as $menu ) { |
397 | 397 | echo "\t<wp:term>"; |
398 | | echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>'; |
| 398 | echo '<wp:term_id>' . (int) $menu->term_id . '</wp:term_id>'; |
399 | 399 | echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>'; |
400 | 400 | echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>'; |
401 | 401 | wxr_term_name( $menu ); |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
478 | 478 | |
479 | 479 | <?php foreach ( $cats as $c ) : ?> |
480 | 480 | <wp:category> |
481 | | <wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id> |
| 481 | <wp:term_id><?php echo (int) $c->term_id; ?></wp:term_id> |
482 | 482 | <wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename> |
483 | 483 | <wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[ $c->parent ]->slug : '' ); ?></wp:category_parent> |
484 | 484 | <?php |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
490 | 490 | <?php endforeach; ?> |
491 | 491 | <?php foreach ( $tags as $t ) : ?> |
492 | 492 | <wp:tag> |
493 | | <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> |
| 493 | <wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id> |
494 | 494 | <wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug> |
495 | 495 | <?php |
496 | 496 | wxr_tag_name( $t ); |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
501 | 501 | <?php endforeach; ?> |
502 | 502 | <?php foreach ( $terms as $t ) : ?> |
503 | 503 | <wp:term> |
504 | | <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> |
| 504 | <wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id> |
505 | 505 | <wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy> |
506 | 506 | <wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug> |
507 | 507 | <wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[ $t->parent ]->slug : '' ); ?></wp:term_parent> |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
573 | 573 | <description></description> |
574 | 574 | <content:encoded><?php echo $content; ?></content:encoded> |
575 | 575 | <excerpt:encoded><?php echo $excerpt; ?></excerpt:encoded> |
576 | | <wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id> |
| 576 | <wp:post_id><?php echo (int) $post->ID; ?></wp:post_id> |
577 | 577 | <wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date> |
578 | 578 | <wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt> |
579 | 579 | <wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status> |
580 | 580 | <wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status> |
581 | 581 | <wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name> |
582 | 582 | <wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status> |
583 | | <wp:post_parent><?php echo intval( $post->post_parent ); ?></wp:post_parent> |
584 | | <wp:menu_order><?php echo intval( $post->menu_order ); ?></wp:menu_order> |
| 583 | <wp:post_parent><?php echo (int) $post->post_parent; ?></wp:post_parent> |
| 584 | <wp:menu_order><?php echo (int) $post->menu_order; ?></wp:menu_order> |
585 | 585 | <wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type> |
586 | 586 | <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password> |
587 | | <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky> |
| 587 | <wp:is_sticky><?php echo (int) $is_sticky; ?></wp:is_sticky> |
588 | 588 | <?php if ( 'attachment' === $post->post_type ) : ?> |
589 | 589 | <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url> |
590 | 590 | <?php endif; ?> |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
620 | 620 | foreach ( $comments as $c ) : |
621 | 621 | ?> |
622 | 622 | <wp:comment> |
623 | | <wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id> |
| 623 | <wp:comment_id><?php echo (int) $c->comment_ID; ?></wp:comment_id> |
624 | 624 | <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author> |
625 | 625 | <wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email> |
626 | 626 | <wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url> |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
630 | 630 | <wp:comment_content><?php echo wxr_cdata( $c->comment_content ); ?></wp:comment_content> |
631 | 631 | <wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved> |
632 | 632 | <wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type> |
633 | | <wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent> |
634 | | <wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id> |
| 633 | <wp:comment_parent><?php echo (int) $c->comment_parent; ?></wp:comment_parent> |
| 634 | <wp:comment_user_id><?php echo (int) $c->user_id; ?></wp:comment_user_id> |
635 | 635 | <?php |
636 | 636 | $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); |
637 | 637 | foreach ( $c_meta as $meta ) : |
-
diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
index 0625bec9e2..88ac0cae2f 100644
a
|
b
|
function wp_edit_theme_plugin_file( $args ) { |
510 | 510 | |
511 | 511 | $scrape_key = md5( rand() ); |
512 | 512 | $transient = 'scrape_key_' . $scrape_key; |
513 | | $scrape_nonce = strval( rand() ); |
| 513 | $scrape_nonce = (string) rand(); |
514 | 514 | // It shouldn't take more than 60 seconds to make the two loopback requests. |
515 | 515 | set_transient( $transient, $scrape_nonce, 60 ); |
516 | 516 | |
-
diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php
index c3bd58613c..0d23c18318 100644
a
|
b
|
function wp_save_image( $post_id ) { |
786 | 786 | return $return; |
787 | 787 | } |
788 | 788 | |
789 | | $fwidth = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0; |
790 | | $fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0; |
| 789 | $fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0; |
| 790 | $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0; |
791 | 791 | $target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : ''; |
792 | 792 | $scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do']; |
793 | 793 | |
… |
… |
function wp_save_image( $post_id ) { |
944 | 944 | } |
945 | 945 | |
946 | 946 | if ( isset( $_wp_additional_image_sizes[ $size ] ) ) { |
947 | | $width = intval( $_wp_additional_image_sizes[ $size ]['width'] ); |
948 | | $height = intval( $_wp_additional_image_sizes[ $size ]['height'] ); |
| 947 | $width = (int) $_wp_additional_image_sizes[ $size ]['width']; |
| 948 | $height = (int) $_wp_additional_image_sizes[ $size ]['height']; |
949 | 949 | $crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop']; |
950 | 950 | } else { |
951 | 951 | $height = get_option( "{$size}_size_h" ); |
-
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index d206aa163c..490d603f31 100644
a
|
b
|
function update_gallery_tab( $tabs ) { |
49 | 49 | return $tabs; |
50 | 50 | } |
51 | 51 | |
52 | | $post_id = intval( $_REQUEST['post_id'] ); |
| 52 | $post_id = (int) $_REQUEST['post_id']; |
53 | 53 | |
54 | 54 | if ( $post_id ) { |
55 | | $attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) ); |
| 55 | $attachments = (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ); |
56 | 56 | } |
57 | 57 | |
58 | 58 | if ( empty( $attachments ) ) { |
… |
… |
function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $re |
138 | 138 | if ( is_string( $rel ) ) { |
139 | 139 | $rel = ' rel="' . esc_attr( $rel ) . '"'; |
140 | 140 | } else { |
141 | | $rel = ' rel="attachment wp-att-' . intval( $id ) . '"'; |
| 141 | $rel = ' rel="attachment wp-att-' . (int) $id . '"'; |
142 | 142 | } |
143 | 143 | } else { |
144 | 144 | $rel = ''; |
… |
… |
function get_media_item( $attachment_id, $args = null ) { |
1549 | 1549 | global $redir_tab; |
1550 | 1550 | |
1551 | 1551 | $thumb_url = false; |
1552 | | $attachment_id = intval( $attachment_id ); |
| 1552 | $attachment_id = (int) $attachment_id; |
1553 | 1553 | |
1554 | 1554 | if ( $attachment_id ) { |
1555 | 1555 | $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ); |
… |
… |
function get_compat_media_markup( $attachment_id, $args = null ) { |
2035 | 2035 | * @since 2.5.0 |
2036 | 2036 | */ |
2037 | 2037 | function media_upload_header() { |
2038 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2038 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2039 | 2039 | |
2040 | 2040 | echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>'; |
2041 | 2041 | |
… |
… |
function media_upload_form( $errors = null ) { |
2071 | 2071 | } |
2072 | 2072 | |
2073 | 2073 | $upload_action_url = admin_url( 'async-upload.php' ); |
2074 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2074 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2075 | 2075 | $_type = isset( $type ) ? $type : ''; |
2076 | 2076 | $_tab = isset( $tab ) ? $tab : ''; |
2077 | 2077 | |
… |
… |
function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { |
2281 | 2281 | |
2282 | 2282 | media_upload_header(); |
2283 | 2283 | |
2284 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2284 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2285 | 2285 | |
2286 | 2286 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2287 | 2287 | |
… |
… |
function media_upload_type_url_form( $type = null, $errors = null, $id = null ) |
2358 | 2358 | |
2359 | 2359 | media_upload_header(); |
2360 | 2360 | |
2361 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2361 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2362 | 2362 | |
2363 | 2363 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2364 | 2364 | /** This filter is documented in wp-admin/includes/media.php */ |
… |
… |
function media_upload_gallery_form( $errors ) { |
2506 | 2506 | $redir_tab = 'gallery'; |
2507 | 2507 | media_upload_header(); |
2508 | 2508 | |
2509 | | $post_id = intval( $_REQUEST['post_id'] ); |
| 2509 | $post_id = (int) $_REQUEST['post_id']; |
2510 | 2510 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" ); |
2511 | 2511 | /** This filter is documented in wp-admin/includes/media.php */ |
2512 | 2512 | $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
… |
… |
function media_upload_library_form( $errors ) { |
2669 | 2669 | |
2670 | 2670 | media_upload_header(); |
2671 | 2671 | |
2672 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2672 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2673 | 2673 | |
2674 | 2674 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" ); |
2675 | 2675 | /** This filter is documented in wp-admin/includes/media.php */ |
… |
… |
function media_upload_library_form( $errors ) { |
2682 | 2682 | |
2683 | 2683 | $q = $_GET; |
2684 | 2684 | $q['posts_per_page'] = 10; |
2685 | | $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0; |
| 2685 | $q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0; |
2686 | 2686 | if ( $q['paged'] < 1 ) { |
2687 | 2687 | $q['paged'] = 1; |
2688 | 2688 | } |
… |
… |
function media_upload_flash_bypass() { |
2984 | 2984 | |
2985 | 2985 | $post = get_post(); |
2986 | 2986 | if ( $post ) { |
2987 | | $browser_uploader .= '&post_id=' . intval( $post->ID ); |
| 2987 | $browser_uploader .= '&post_id=' . (int) $post->ID; |
2988 | 2988 | } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { |
2989 | | $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); |
| 2989 | $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID']; |
2990 | 2990 | } |
2991 | 2991 | |
2992 | 2992 | ?> |
… |
… |
function edit_form_image_editor( $post ) { |
3078 | 3078 | } |
3079 | 3079 | |
3080 | 3080 | $thumb_url = false; |
3081 | | $attachment_id = intval( $post->ID ); |
| 3081 | $attachment_id = (int) $post->ID; |
3082 | 3082 | |
3083 | 3083 | if ( $attachment_id ) { |
3084 | 3084 | $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); |
-
diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index 42d3607d23..90ab82ce5f 100644
a
|
b
|
function wp_nav_menu_item_post_type_meta_box( $object, $box ) { |
382 | 382 | $important_pages[] = $front_page_obj; |
383 | 383 | $suppress_page_ids[] = $front_page_obj->ID; |
384 | 384 | } else { |
385 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 385 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
386 | 386 | $front_page_obj = (object) array( |
387 | 387 | 'front_or_home' => true, |
388 | 388 | 'ID' => 0, |
… |
… |
function wp_nav_menu_item_post_type_meta_box( $object, $box ) { |
609 | 609 | $args['walker'] = $walker; |
610 | 610 | |
611 | 611 | if ( $post_type->has_archive ) { |
612 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 612 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
613 | 613 | array_unshift( |
614 | 614 | $posts, |
615 | 615 | (object) array( |
-
diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index e201d90da6..263fc98cce 100644
a
|
b
|
function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func |
1347 | 1347 | |
1348 | 1348 | if ( null === $position ) { |
1349 | 1349 | $menu[] = $new_menu; |
1350 | | } elseif ( isset( $menu[ "$position" ] ) ) { |
1351 | | $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ), -5 ) * 0.00001; |
1352 | | $menu[ "$position" ] = $new_menu; |
| 1350 | } elseif ( isset( $menu[ (string) $position ] ) ) { |
| 1351 | $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ), -5 ) * 0.00001; |
| 1352 | $menu[ (string) $position ] = $new_menu; |
1353 | 1353 | } else { |
1354 | 1354 | $menu[ $position ] = $new_menu; |
1355 | 1355 | } |
-
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 398add09ea..1397040928 100644
a
|
b
|
function post_preview() { |
1926 | 1926 | } |
1927 | 1927 | |
1928 | 1928 | if ( isset( $_POST['_thumbnail_id'] ) ) { |
1929 | | $query_args['_thumbnail_id'] = ( intval( $_POST['_thumbnail_id'] ) <= 0 ) ? '-1' : intval( $_POST['_thumbnail_id'] ); |
| 1929 | $query_args['_thumbnail_id'] = ((int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; |
1930 | 1930 | } |
1931 | 1931 | } |
1932 | 1932 | |
… |
… |
function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { |
2088 | 2088 | ); |
2089 | 2089 | |
2090 | 2090 | if ( ! empty( $_term ) ) { |
2091 | | $clean_terms[] = intval( $_term[0] ); |
| 2091 | $clean_terms[] = (int) $_term[0]; |
2092 | 2092 | } else { |
2093 | 2093 | // No existing term was found, so pass the string. A new term will be created. |
2094 | 2094 | $clean_terms[] = $term; |
-
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index e759042627..d9d87da2f4 100644
a
|
b
|
function do_meta_boxes( $screen, $context, $object ) { |
1321 | 1321 | echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>'; |
1322 | 1322 | echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>'; |
1323 | 1323 | } |
1324 | | echo "{$box['title']}"; |
| 1324 | echo (string) ( $box['title'] ); |
1325 | 1325 | echo "</h2>\n"; |
1326 | 1326 | |
1327 | 1327 | if ( 'dashboard_browser_nag' !== $box['id'] ) { |
… |
… |
function get_post_states( $post ) { |
2205 | 2205 | } |
2206 | 2206 | |
2207 | 2207 | if ( 'page' === get_option( 'show_on_front' ) ) { |
2208 | | if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) { |
| 2208 | if ( (int) get_option( 'page_on_front' ) === $post->ID ) { |
2209 | 2209 | $post_states['page_on_front'] = _x( 'Front Page', 'page label' ); |
2210 | 2210 | } |
2211 | 2211 | |
2212 | | if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) { |
| 2212 | if ( (int) get_option( 'page_for_posts' ) === $post->ID ) { |
2213 | 2213 | $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' ); |
2214 | 2214 | } |
2215 | 2215 | } |
2216 | 2216 | |
2217 | | if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) { |
| 2217 | if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { |
2218 | 2218 | $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' ); |
2219 | 2219 | } |
2220 | 2220 | |
-
diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
index e7ebabb8f7..8bc61fd0b3 100644
a
|
b
|
function wp_get_auto_update_message() { |
1059 | 1059 | if ( false === $next_update_time ) { |
1060 | 1060 | $message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' ); |
1061 | 1061 | } else { |
1062 | | $time_to_next_update = human_time_diff( intval( $next_update_time ) ); |
| 1062 | $time_to_next_update = human_time_diff( (int) $next_update_time ); |
1063 | 1063 | |
1064 | 1064 | // See if cron is overdue. |
1065 | 1065 | $overdue = ( time() - $next_update_time ) > 0; |
-
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index e0170f2705..ee9b3cdd25 100644
a
|
b
|
function upgrade_110() { |
988 | 988 | if ( ! $got_gmt_fields ) { |
989 | 989 | |
990 | 990 | // Add or subtract time to all dates, to get GMT dates. |
991 | | $add_hours = intval( $diff_gmt_weblogger ); |
992 | | $add_minutes = intval( 60 * ( $diff_gmt_weblogger - $add_hours ) ); |
| 991 | $add_hours = (int) $diff_gmt_weblogger; |
| 992 | $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) ); |
993 | 993 | $wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); |
994 | 994 | $wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" ); |
995 | 995 | $wpdb->query( "UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'" ); |
… |
… |
function upgrade_430_fix_comments() { |
2014 | 2014 | return; |
2015 | 2015 | } |
2016 | 2016 | |
2017 | | $allowed_length = intval( $content_length['length'] ) - 10; |
| 2017 | $allowed_length = (int) $content_length['length'] - 10; |
2018 | 2018 | |
2019 | 2019 | $comments = $wpdb->get_results( |
2020 | 2020 | "SELECT `comment_ID` FROM `{$wpdb->comments}` |
-
diff --git a/src/wp-admin/media-upload.php b/src/wp-admin/media-upload.php
index 64c524ec66..4099cde84c 100644
a
|
b
|
|
51 | 51 | |
52 | 52 | // Upload type: image, video, file, ...? |
53 | 53 | if ( isset( $_GET['type'] ) ) { |
54 | | $type = strval( $_GET['type'] ); |
| 54 | $type = (string) $_GET['type']; |
55 | 55 | } else { |
56 | 56 | /** |
57 | 57 | * Filters the default media upload type in the legacy (pre-3.5.0) media popup. |
… |
… |
|
66 | 66 | |
67 | 67 | // Tab: gallery, library, or type-specific. |
68 | 68 | if ( isset( $_GET['tab'] ) ) { |
69 | | $tab = strval( $_GET['tab'] ); |
| 69 | $tab = (string) $_GET['tab']; |
70 | 70 | } else { |
71 | 71 | /** |
72 | 72 | * Filters the default tab in the legacy (pre-3.5.0) media popup. |
-
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index a4ef4d5c36..0715c854b5 100644
a
|
b
|
|
424 | 424 | |
425 | 425 | // If the menu ID changed, redirect to the new URL. |
426 | 426 | if ( $nav_menu_selected_id !== $_nav_menu_selected_id ) { |
427 | | wp_redirect( admin_url( 'nav-menus.php?menu=' . intval( $_nav_menu_selected_id ) ) ); |
| 427 | wp_redirect( admin_url( 'nav-menus.php?menu=' . (int) $_nav_menu_selected_id ) ); |
428 | 428 | exit; |
429 | 429 | } |
430 | 430 | } |
-
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php
index dddb0bb962..a8294c1e49 100644
a
|
b
|
|
17 | 17 | get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); |
18 | 18 | get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); |
19 | 19 | |
20 | | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 20 | $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
21 | 21 | |
22 | 22 | if ( ! $id ) { |
23 | 23 | wp_die( __( 'Invalid site ID.' ) ); |
-
diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php
index 44c417f0d9..ca1ed3fbd6 100644
a
|
b
|
|
17 | 17 | get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); |
18 | 18 | get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); |
19 | 19 | |
20 | | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 20 | $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
21 | 21 | |
22 | 22 | if ( ! $id ) { |
23 | 23 | wp_die( __( 'Invalid site ID.' ) ); |
-
diff --git a/src/wp-admin/network/site-themes.php b/src/wp-admin/network/site-themes.php
index 9e1d136980..14807b54f5 100644
a
|
b
|
|
40 | 40 | $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
41 | 41 | } |
42 | 42 | |
43 | | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 43 | $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
44 | 44 | |
45 | 45 | if ( ! $id ) { |
46 | 46 | wp_die( __( 'Invalid site ID.' ) ); |
-
diff --git a/src/wp-admin/network/site-users.php b/src/wp-admin/network/site-users.php
index 23c748eeed..319051f89d 100644
a
|
b
|
|
35 | 35 | $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
36 | 36 | } |
37 | 37 | |
38 | | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 38 | $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
39 | 39 | |
40 | 40 | if ( ! $id ) { |
41 | 41 | wp_die( __( 'Invalid site ID.' ) ); |
-
diff --git a/src/wp-admin/network/sites.php b/src/wp-admin/network/sites.php
index 16873452d2..5b081c2833 100644
a
|
b
|
|
53 | 53 | ) |
54 | 54 | ); |
55 | 55 | |
56 | | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
| 56 | $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
57 | 57 | |
58 | 58 | if ( isset( $_GET['action'] ) ) { |
59 | 59 | /** This action is documented in wp-admin/network/edit.php */ |
-
diff --git a/src/wp-admin/network/upgrade.php b/src/wp-admin/network/upgrade.php
index 98e3a8b41f..8b0194e6ce 100644
a
|
b
|
|
45 | 45 | |
46 | 46 | switch ( $action ) { |
47 | 47 | case 'upgrade': |
48 | | $n = ( isset( $_GET['n'] ) ) ? intval( $_GET['n'] ) : 0; |
| 48 | $n = ( isset( $_GET['n'] ) ) ? (int) $_GET['n'] : 0; |
49 | 49 | |
50 | 50 | if ( $n < 5 ) { |
51 | 51 | /** |
-
diff --git a/src/wp-admin/network/users.php b/src/wp-admin/network/users.php
index c2e6ee5d6b..4b103fc0bc 100644
a
|
b
|
|
26 | 26 | |
27 | 27 | check_admin_referer( 'deleteuser' ); |
28 | 28 | |
29 | | $id = intval( $_GET['id'] ); |
| 29 | $id = (int) $_GET['id']; |
30 | 30 | if ( $id > 1 ) { |
31 | 31 | $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays. |
32 | 32 | $title = __( 'Users' ); |
-
diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php
index 2319253104..70b9d79a18 100644
a
|
b
|
|
230 | 230 | } |
231 | 231 | |
232 | 232 | if ( empty( $_REQUEST['users'] ) ) { |
233 | | $userids = array( intval( $_REQUEST['user'] ) ); |
| 233 | $userids = array((int) $_REQUEST['user']); |
234 | 234 | } else { |
235 | 235 | $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
236 | 236 | } |
… |
… |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | if ( empty( $_REQUEST['users'] ) ) { |
404 | | $userids = array( intval( $_REQUEST['user'] ) ); |
| 404 | $userids = array((int) $_REQUEST['user']); |
405 | 405 | } else { |
406 | 406 | $userids = $_REQUEST['users']; |
407 | 407 | } |
-
diff --git a/src/wp-comments-post.php b/src/wp-comments-post.php
index bc66862a7b..06cbd460f4 100644
a
|
b
|
|
24 | 24 | |
25 | 25 | $comment = wp_handle_comment_submission( wp_unslash( $_POST ) ); |
26 | 26 | if ( is_wp_error( $comment ) ) { |
27 | | $data = intval( $comment->get_error_data() ); |
| 27 | $data = (int) $comment->get_error_data(); |
28 | 28 | if ( ! empty( $data ) ) { |
29 | 29 | wp_die( |
30 | 30 | '<p>' . $comment->get_error_message() . '</p>', |
-
diff --git a/src/wp-content/themes/twentyfourteen/inc/template-tags.php b/src/wp-content/themes/twentyfourteen/inc/template-tags.php
index 69ef45e736..413457f87d 100644
a
|
b
|
function twentyfourteen_paging_nav() { |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | | $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
| 27 | $paged = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
28 | 28 | $pagenum_link = html_entity_decode( get_pagenum_link() ); |
29 | 29 | $query_args = array(); |
30 | 30 | $url_parts = explode( '?', $pagenum_link ); |
-
diff --git a/src/wp-includes/bookmark.php b/src/wp-includes/bookmark.php
index b9cfc63765..e4d3d3571a 100644
a
|
b
|
function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { |
436 | 436 | $value = apply_filters( "pre_{$field}", $value ); |
437 | 437 | } else { |
438 | 438 | /** This filter is documented in wp-includes/post.php */ |
439 | | $value = apply_filters( "{$field}", $value, $bookmark_id, $context ); |
| 439 | $value = apply_filters( (string) ( $field ), $value, $bookmark_id, $context ); |
440 | 440 | |
441 | 441 | if ( 'attribute' === $context ) { |
442 | 442 | $value = esc_attr( $value ); |
-
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index bfb23264d1..24505af4ed 100644
a
|
b
|
function wp_dropdown_categories( $args = '' ) { |
433 | 433 | |
434 | 434 | /** This filter is documented in wp-includes/category-template.php */ |
435 | 435 | $show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null ); |
436 | | $selected = ( '0' === strval( $parsed_args['selected'] ) ) ? " selected='selected'" : ''; |
| 436 | $selected = ( '0' === (string) $parsed_args['selected'] ) ? " selected='selected'" : ''; |
437 | 437 | $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; |
438 | 438 | } |
439 | 439 | |
… |
… |
function wp_tag_cloud( $args = '' ) { |
736 | 736 | if ( 'edit' === $args['link'] ) { |
737 | 737 | $link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] ); |
738 | 738 | } else { |
739 | | $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy ); |
| 739 | $link = get_term_link( (int) $tag->term_id, $tag->taxonomy ); |
740 | 740 | } |
741 | 741 | |
742 | 742 | if ( is_wp_error( $link ) ) { |
-
diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
index aee80a8886..8211408101 100644
a
|
b
|
public static function processHeaders( $headers, $url = '' ) { // phpcs:ignore W |
752 | 752 | } |
753 | 753 | |
754 | 754 | // Cast the Response Code to an int. |
755 | | $response['code'] = intval( $response['code'] ); |
| 755 | $response['code'] = (int) $response['code']; |
756 | 756 | |
757 | 757 | return array( |
758 | 758 | 'response' => $response, |
-
diff --git a/src/wp-includes/class-json.php b/src/wp-includes/class-json.php
index 7df464c374..66443e1068 100644
a
|
b
|
function name_value($name, $value) |
579 | 579 | return $encoded_value; |
580 | 580 | } |
581 | 581 | |
582 | | return $this->_encode(strval($name)) . ':' . $encoded_value; |
| 582 | return $this->_encode((string) $name) . ':' . $encoded_value; |
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
-
diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
index bbc6fe2d66..d78efa5d70 100644
a
|
b
|
public function get_comments() { |
439 | 439 | // If querying for a count only, there's nothing more to do. |
440 | 440 | if ( $this->query_vars['count'] ) { |
441 | 441 | // $comment_ids is actually a count in this case. |
442 | | return intval( $comment_ids ); |
| 442 | return (int) $comment_ids; |
443 | 443 | } |
444 | 444 | |
445 | 445 | $comment_ids = array_map( 'intval', $comment_ids ); |
… |
… |
protected function get_comment_ids() { |
925 | 925 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
926 | 926 | |
927 | 927 | if ( $this->query_vars['count'] ) { |
928 | | return intval( $wpdb->get_var( $this->request ) ); |
| 928 | return (int) $wpdb->get_var( $this->request ); |
929 | 929 | } else { |
930 | 930 | $comment_ids = $wpdb->get_col( $this->request ); |
931 | 931 | return array_map( 'intval', $comment_ids ); |
-
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index 79f2b3eab3..6be63d474a 100644
a
|
b
|
function import_theme_starter_content( $starter_content = array() ) { |
1461 | 1461 | preg_match( '#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches ) |
1462 | 1462 | ); |
1463 | 1463 | if ( $can_reuse ) { |
1464 | | $nav_menu_term_id = intval( $matches['nav_menu_id'] ); |
| 1464 | $nav_menu_term_id = (int) $matches['nav_menu_id']; |
1465 | 1465 | $nav_menu_setting_id = $setting_id; |
1466 | 1466 | $reused_nav_menu_setting_ids[] = $setting_id; |
1467 | 1467 | break; |
… |
… |
public function refresh_changeset_lock( $changeset_post_id ) { |
3266 | 3266 | $lock = explode( ':', $lock ); |
3267 | 3267 | |
3268 | 3268 | if ( $lock && ! empty( $lock[1] ) ) { |
3269 | | $user_id = intval( $lock[1] ); |
| 3269 | $user_id = (int) $lock[1]; |
3270 | 3270 | $current_user_id = get_current_user_id(); |
3271 | 3271 | if ( $user_id === $current_user_id ) { |
3272 | 3272 | $lock = sprintf( '%s:%s', time(), $user_id ); |
-
diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php
index 48104112e0..f8c122a318 100644
a
|
b
|
public function load_available_items_query( $type = 'post_type', $object = 'page |
249 | 249 | 'type' => 'post_type', |
250 | 250 | 'type_label' => $post_type_label, |
251 | 251 | 'object' => $post->post_type, |
252 | | 'object_id' => intval( $post->ID ), |
253 | | 'url' => get_permalink( intval( $post->ID ) ), |
| 252 | 'object_id' => (int) $post->ID, |
| 253 | 'url' => get_permalink((int) $post->ID), |
254 | 254 | ); |
255 | 255 | } |
256 | 256 | } elseif ( 'taxonomy' === $type ) { |
… |
… |
public function load_available_items_query( $type = 'post_type', $object = 'page |
281 | 281 | 'type' => 'taxonomy', |
282 | 282 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
283 | 283 | 'object' => $term->taxonomy, |
284 | | 'object_id' => intval( $term->term_id ), |
285 | | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 284 | 'object_id' => (int) $term->term_id, |
| 285 | 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ), |
286 | 286 | ); |
287 | 287 | } |
288 | 288 | } |
… |
… |
public function search_available_items_query( $args = array() ) { |
410 | 410 | 'type' => 'post_type', |
411 | 411 | 'type_label' => $post_type_label, |
412 | 412 | 'object' => $post->post_type, |
413 | | 'object_id' => intval( $post->ID ), |
414 | | 'url' => get_permalink( intval( $post->ID ) ), |
| 413 | 'object_id' => (int) $post->ID, |
| 414 | 'url' => get_permalink((int) $post->ID), |
415 | 415 | ); |
416 | 416 | } |
417 | 417 | |
… |
… |
public function search_available_items_query( $args = array() ) { |
436 | 436 | 'type' => 'taxonomy', |
437 | 437 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
438 | 438 | 'object' => $term->taxonomy, |
439 | | 'object_id' => intval( $term->term_id ), |
440 | | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 439 | 'object_id' => (int) $term->term_id, |
| 440 | 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ), |
441 | 441 | ); |
442 | 442 | } |
443 | 443 | } |
-
diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php
index be137eafee..0269680d64 100644
a
|
b
|
public function parse_widget_id( $widget_id ) { |
605 | 605 | |
606 | 606 | if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) { |
607 | 607 | $parsed['id_base'] = $matches[1]; |
608 | | $parsed['number'] = intval( $matches[2] ); |
| 608 | $parsed['number'] = (int) $matches[2]; |
609 | 609 | } else { |
610 | 610 | // Likely an old single widget. |
611 | 611 | $parsed['id_base'] = $widget_id; |
… |
… |
public function parse_widget_setting_id( $setting_id ) { |
628 | 628 | } |
629 | 629 | |
630 | 630 | $id_base = $matches[2]; |
631 | | $number = isset( $matches[3] ) ? intval( $matches[3] ) : null; |
| 631 | $number = isset( $matches[3] ) ? (int) $matches[3] : null; |
632 | 632 | |
633 | 633 | return compact( 'id_base', 'number' ); |
634 | 634 | } |
… |
… |
public function start_dynamic_sidebar( $index ) { |
1772 | 1772 | } |
1773 | 1773 | $this->sidebar_instance_count[ $index ] += 1; |
1774 | 1774 | if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { |
1775 | | printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) ); |
| 1775 | printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ]); |
1776 | 1776 | } |
1777 | 1777 | } |
1778 | 1778 | |
… |
… |
public function start_dynamic_sidebar( $index ) { |
1788 | 1788 | public function end_dynamic_sidebar( $index ) { |
1789 | 1789 | array_shift( $this->current_dynamic_sidebar_id_stack ); |
1790 | 1790 | if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { |
1791 | | printf( "\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) ); |
| 1791 | printf( "\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ]); |
1792 | 1792 | } |
1793 | 1793 | } |
1794 | 1794 | |
… |
… |
public function render_widget_partial( $partial, $context ) { |
1851 | 1851 | $this->rendering_sidebar_id = $context['sidebar_id']; |
1852 | 1852 | |
1853 | 1853 | if ( isset( $context['sidebar_instance_number'] ) ) { |
1854 | | $this->context_sidebar_instance_number = intval( $context['sidebar_instance_number'] ); |
| 1854 | $this->context_sidebar_instance_number = (int) $context['sidebar_instance_number']; |
1855 | 1855 | } |
1856 | 1856 | |
1857 | 1857 | // Filter sidebars_widgets so that only the queried widget is in the sidebar. |
-
diff --git a/src/wp-includes/class-wp-date-query.php b/src/wp-includes/class-wp-date-query.php
index 6fe305fffe..1bab5ef2c8 100644
a
|
b
|
public function build_mysql_datetime( $datetime, $default_to_max = false ) { |
874 | 874 | if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { |
875 | 875 | // Y |
876 | 876 | $datetime = array( |
877 | | 'year' => intval( $matches[1] ), |
| 877 | 'year' => (int) $matches[1], |
878 | 878 | ); |
879 | 879 | |
880 | 880 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { |
881 | 881 | // Y-m |
882 | 882 | $datetime = array( |
883 | | 'year' => intval( $matches[1] ), |
884 | | 'month' => intval( $matches[2] ), |
| 883 | 'year' => (int) $matches[1], |
| 884 | 'month' => (int) $matches[2], |
885 | 885 | ); |
886 | 886 | |
887 | 887 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { |
888 | 888 | // Y-m-d |
889 | 889 | $datetime = array( |
890 | | 'year' => intval( $matches[1] ), |
891 | | 'month' => intval( $matches[2] ), |
892 | | 'day' => intval( $matches[3] ), |
| 890 | 'year' => (int) $matches[1], |
| 891 | 'month' => (int) $matches[2], |
| 892 | 'day' => (int) $matches[3], |
893 | 893 | ); |
894 | 894 | |
895 | 895 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { |
896 | 896 | // Y-m-d H:i |
897 | 897 | $datetime = array( |
898 | | 'year' => intval( $matches[1] ), |
899 | | 'month' => intval( $matches[2] ), |
900 | | 'day' => intval( $matches[3] ), |
901 | | 'hour' => intval( $matches[4] ), |
902 | | 'minute' => intval( $matches[5] ), |
| 898 | 'year' => (int) $matches[1], |
| 899 | 'month' => (int) $matches[2], |
| 900 | 'day' => (int) $matches[3], |
| 901 | 'hour' => (int) $matches[4], |
| 902 | 'minute' => (int) $matches[5], |
903 | 903 | ); |
904 | 904 | } |
905 | 905 | |
-
diff --git a/src/wp-includes/class-wp-http-curl.php b/src/wp-includes/class-wp-http-curl.php
index dd4cab9229..9b6e0eb10b 100644
a
|
b
|
public function request( $url, $args = array() ) { |
173 | 173 | curl_setopt( $handle, CURLOPT_HEADER, false ); |
174 | 174 | |
175 | 175 | if ( isset( $parsed_args['limit_response_size'] ) ) { |
176 | | $this->max_body_length = intval( $parsed_args['limit_response_size'] ); |
| 176 | $this->max_body_length = (int) $parsed_args['limit_response_size']; |
177 | 177 | } else { |
178 | 178 | $this->max_body_length = false; |
179 | 179 | } |
-
diff --git a/src/wp-includes/class-wp-matchesmapregex.php b/src/wp-includes/class-wp-matchesmapregex.php
index 334026f86e..cdb39077e2 100644
a
|
b
|
private function _map() { |
83 | 83 | * @return string |
84 | 84 | */ |
85 | 85 | public function callback( $matches ) { |
86 | | $index = intval( substr( $matches[0], 9, -1 ) ); |
| 86 | $index = (int) substr( $matches[0], 9, -1 ); |
87 | 87 | return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); |
88 | 88 | } |
89 | 89 | } |
-
diff --git a/src/wp-includes/class-wp-network-query.php b/src/wp-includes/class-wp-network-query.php
index c3d3fa1284..06d784db01 100644
a
|
b
|
public function get_networks() { |
257 | 257 | // If querying for a count only, there's nothing more to do. |
258 | 258 | if ( $this->query_vars['count'] ) { |
259 | 259 | // $network_ids is actually a count in this case. |
260 | | return intval( $network_ids ); |
| 260 | return (int) $network_ids; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $network_ids = array_map( 'intval', $network_ids ); |
… |
… |
protected function get_network_ids() { |
466 | 466 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
467 | 467 | |
468 | 468 | if ( $this->query_vars['count'] ) { |
469 | | return intval( $wpdb->get_var( $this->request ) ); |
| 469 | return (int) $wpdb->get_var( $this->request ); |
470 | 470 | } |
471 | 471 | |
472 | 472 | $network_ids = $wpdb->get_col( $this->request ); |
-
diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index a2451bcd01..a90989c8f4 100644
a
|
b
|
public function parse_query( $query = '' ) { |
763 | 763 | $qv['p'] = 0; |
764 | 764 | $qv['error'] = '404'; |
765 | 765 | } else { |
766 | | $qv['p'] = intval( $qv['p'] ); |
| 766 | $qv['p'] = (int) $qv['p']; |
767 | 767 | } |
768 | 768 | |
769 | 769 | $qv['page_id'] = absint( $qv['page_id'] ); |
… |
… |
public function parse_query( $query = '' ) { |
942 | 942 | $this->is_trackback = true; |
943 | 943 | } |
944 | 944 | |
945 | | if ( '' != $qv['paged'] && ( intval( $qv['paged'] ) > 1 ) ) { |
| 945 | if ( '' != $qv['paged'] && ((int) $qv['paged'] > 1 ) ) { |
946 | 946 | $this->is_paged = true; |
947 | 947 | } |
948 | 948 | |
… |
… |
protected function parse_orderby( $orderby ) { |
1604 | 1604 | // If RAND() contains a seed value, sanitize and add to allowed keys. |
1605 | 1605 | $rand_with_seed = false; |
1606 | 1606 | if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) { |
1607 | | $orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) ); |
| 1607 | $orderby = sprintf( 'RAND(%s)', (int) $matches[1]); |
1608 | 1608 | $allowed_keys[] = $orderby; |
1609 | 1609 | $rand_with_seed = true; |
1610 | 1610 | } |
… |
… |
public function get_posts() { |
2263 | 2263 | // Numeric comment count is converted to array format. |
2264 | 2264 | if ( is_numeric( $q['comment_count'] ) ) { |
2265 | 2265 | $q['comment_count'] = array( |
2266 | | 'value' => intval( $q['comment_count'] ), |
| 2266 | 'value' => (int) $q['comment_count'], |
2267 | 2267 | ); |
2268 | 2268 | } |
2269 | 2269 | |
-
diff --git a/src/wp-includes/class-wp-site-query.php b/src/wp-includes/class-wp-site-query.php
index 702488fc06..f87fd35d9e 100644
a
|
b
|
public function get_sites() { |
348 | 348 | // If querying for a count only, there's nothing more to do. |
349 | 349 | if ( $this->query_vars['count'] ) { |
350 | 350 | // $site_ids is actually a count in this case. |
351 | | return intval( $site_ids ); |
| 351 | return (int) $site_ids; |
352 | 352 | } |
353 | 353 | |
354 | 354 | $site_ids = array_map( 'intval', $site_ids ); |
… |
… |
protected function get_site_ids() { |
657 | 657 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
658 | 658 | |
659 | 659 | if ( $this->query_vars['count'] ) { |
660 | | return intval( $wpdb->get_var( $this->request ) ); |
| 660 | return (int) $wpdb->get_var( $this->request ); |
661 | 661 | } |
662 | 662 | |
663 | 663 | $site_ids = $wpdb->get_col( $this->request ); |
-
diff --git a/src/wp-includes/class-wp-term-query.php b/src/wp-includes/class-wp-term-query.php
index 4009e100d3..1c5190f432 100644
a
|
b
|
public function parse_query( $query = '' ) { |
258 | 258 | $query['offset'] = absint( $query['offset'] ); |
259 | 259 | |
260 | 260 | // 'parent' overrides 'child_of'. |
261 | | if ( 0 < intval( $query['parent'] ) ) { |
| 261 | if (0 < (int) $query['parent']) { |
262 | 262 | $query['child_of'] = false; |
263 | 263 | } |
264 | 264 | |
… |
… |
public function get_terms() { |
346 | 346 | } |
347 | 347 | |
348 | 348 | // 'parent' overrides 'child_of'. |
349 | | if ( 0 < intval( $args['parent'] ) ) { |
| 349 | if (0 < (int) $args['parent']) { |
350 | 350 | $args['child_of'] = false; |
351 | 351 | } |
352 | 352 | |
… |
… |
public function get_terms() { |
443 | 443 | (array) get_terms( |
444 | 444 | array( |
445 | 445 | 'taxonomy' => reset( $taxonomies ), |
446 | | 'child_of' => intval( $extrunk ), |
| 446 | 'child_of' => (int) $extrunk, |
447 | 447 | 'fields' => 'ids', |
448 | 448 | 'hide_empty' => 0, |
449 | 449 | ) |
-
diff --git a/src/wp-includes/class-wp-user.php b/src/wp-includes/class-wp-user.php
index f9582df7c6..16f4a52c7f 100644
a
|
b
|
public static function get_data_by( $field, $value ) { |
199 | 199 | if ( ! is_numeric( $value ) ) { |
200 | 200 | return false; |
201 | 201 | } |
202 | | $value = intval( $value ); |
| 202 | $value = (int) $value; |
203 | 203 | if ( $value < 1 ) { |
204 | 204 | return false; |
205 | 205 | } |
… |
… |
public function set_role( $role ) { |
645 | 645 | */ |
646 | 646 | public function level_reduction( $max, $item ) { |
647 | 647 | if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) { |
648 | | $level = intval( $matches[1] ); |
| 648 | $level = (int) $matches[1]; |
649 | 649 | return max( $max, $level ); |
650 | 650 | } else { |
651 | 651 | return $max; |
-
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index d89701cc21..5606a5b954 100644
a
|
b
|
protected function _prepare_term( $term ) { |
798 | 798 | } |
799 | 799 | |
800 | 800 | // For integers which may be larger than XML-RPC supports ensure we return strings. |
801 | | $_term['term_id'] = strval( $_term['term_id'] ); |
802 | | $_term['term_group'] = strval( $_term['term_group'] ); |
803 | | $_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] ); |
804 | | $_term['parent'] = strval( $_term['parent'] ); |
| 801 | $_term['term_id'] = (string) $_term['term_id']; |
| 802 | $_term['term_group'] = (string) $_term['term_group']; |
| 803 | $_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id']; |
| 804 | $_term['parent'] = (string) $_term['parent']; |
805 | 805 | |
806 | 806 | // Count we are happy to return as an integer because people really shouldn't use terms that much. |
807 | | $_term['count'] = intval( $_term['count'] ); |
| 807 | $_term['count'] = (int) $_term['count']; |
808 | 808 | |
809 | 809 | // Get term meta. |
810 | 810 | $_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] ); |
… |
… |
protected function _convert_date_gmt( $date_gmt, $date ) { |
856 | 856 | */ |
857 | 857 | protected function _prepare_post( $post, $fields ) { |
858 | 858 | // Holds the data for this post. built up based on $fields. |
859 | | $_post = array( 'post_id' => strval( $post['ID'] ) ); |
| 859 | $_post = array( 'post_id' => (string) $post['ID']); |
860 | 860 | |
861 | 861 | // Prepare common post fields. |
862 | 862 | $post_fields = array( |
… |
… |
protected function _prepare_post( $post, $fields ) { |
872 | 872 | 'post_password' => $post['post_password'], |
873 | 873 | 'post_excerpt' => $post['post_excerpt'], |
874 | 874 | 'post_content' => $post['post_content'], |
875 | | 'post_parent' => strval( $post['post_parent'] ), |
| 875 | 'post_parent' => (string) $post['post_parent'], |
876 | 876 | 'post_mime_type' => $post['post_mime_type'], |
877 | 877 | 'link' => get_permalink( $post['ID'] ), |
878 | 878 | 'guid' => $post['guid'], |
879 | | 'menu_order' => intval( $post['menu_order'] ), |
| 879 | 'menu_order' => (int) $post['menu_order'], |
880 | 880 | 'comment_status' => $post['comment_status'], |
881 | 881 | 'ping_status' => $post['ping_status'], |
882 | 882 | 'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ), |
… |
… |
protected function _prepare_post_type( $post_type, $fields ) { |
1009 | 1009 | */ |
1010 | 1010 | protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) { |
1011 | 1011 | $_media_item = array( |
1012 | | 'attachment_id' => strval( $media_item->ID ), |
| 1012 | 'attachment_id' => (string) $media_item->ID, |
1013 | 1013 | 'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ), |
1014 | 1014 | 'parent' => $media_item->post_parent, |
1015 | 1015 | 'link' => wp_get_attachment_url( $media_item->ID ), |
… |
… |
protected function _prepare_comment( $comment ) { |
1174 | 1174 | * @return array The prepared user data. |
1175 | 1175 | */ |
1176 | 1176 | protected function _prepare_user( $user, $fields ) { |
1177 | | $_user = array( 'user_id' => strval( $user->ID ) ); |
| 1177 | $_user = array( 'user_id' => (string) $user->ID); |
1178 | 1178 | |
1179 | 1179 | $user_fields = array( |
1180 | 1180 | 'username' => $user->user_login, |
… |
… |
protected function _insert_post( $user, $content_struct ) { |
1646 | 1646 | } |
1647 | 1647 | } |
1648 | 1648 | |
1649 | | return strval( $post_ID ); |
| 1649 | return (string) $post_ID; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | /** |
… |
… |
public function wp_newTerm( $args ) { |
2093 | 2093 | $this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] ); |
2094 | 2094 | } |
2095 | 2095 | |
2096 | | return strval( $term['term_id'] ); |
| 2096 | return (string) $term['term_id']; |
2097 | 2097 | } |
2098 | 2098 | |
2099 | 2099 | /** |
… |
… |
public function mw_newPost( $args ) { |
5565 | 5565 | */ |
5566 | 5566 | do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase |
5567 | 5567 | |
5568 | | return strval( $post_ID ); |
| 5568 | return (string) $post_ID; |
5569 | 5569 | } |
5570 | 5570 | |
5571 | 5571 | /** |
… |
… |
public function mt_getPostCategories( $args ) { |
6554 | 6554 | do_action( 'xmlrpc_call', 'mt.getPostCategories' ); |
6555 | 6555 | |
6556 | 6556 | $categories = array(); |
6557 | | $catids = wp_get_post_categories( intval( $post_ID ) ); |
| 6557 | $catids = wp_get_post_categories( (int) $post_ID ); |
6558 | 6558 | // First listed category will be the primary category. |
6559 | 6559 | $isPrimary = true; |
6560 | 6560 | foreach ( $catids as $catid ) { |
… |
… |
public function pingback_ping( $args ) { |
6811 | 6811 | $post_ID = (int) $blah[1]; |
6812 | 6812 | } elseif ( isset( $urltest['fragment'] ) ) { |
6813 | 6813 | // An #anchor is there, it's either... |
6814 | | if ( intval( $urltest['fragment'] ) ) { |
| 6814 | if ( (int) $urltest['fragment'] ) { |
6815 | 6815 | // ...an integer #XXXX (simplest case), |
6816 | 6816 | $post_ID = (int) $urltest['fragment']; |
6817 | 6817 | } elseif ( preg_match( '/post-[0-9]+/', $urltest['fragment'] ) ) { |
-
diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index d3417db02b..89be475034 100644
a
|
b
|
function get_comment_excerpt( $comment_ID = 0 ) { |
604 | 604 | } |
605 | 605 | |
606 | 606 | /* translators: Maximum number of words used in a comment excerpt. */ |
607 | | $comment_excerpt_length = intval( _x( '20', 'comment_excerpt_length' ) ); |
| 607 | $comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' ); |
608 | 608 | |
609 | 609 | /** |
610 | 610 | * Filters the maximum number of words used in the comment excerpt. |
… |
… |
function wp_list_comments( $args = array(), $comments = null ) { |
2205 | 2205 | } |
2206 | 2206 | } |
2207 | 2207 | // Validation check. |
2208 | | $parsed_args['page'] = intval( $parsed_args['page'] ); |
| 2208 | $parsed_args['page'] = (int) $parsed_args['page']; |
2209 | 2209 | if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) { |
2210 | 2210 | $parsed_args['page'] = 1; |
2211 | 2211 | } |
-
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index 10e9d864ad..6b722529fc 100644
a
|
b
|
function wp_get_comment_fields_max_lengths() { |
1254 | 1254 | |
1255 | 1255 | if ( ! is_array( $col_length ) && (int) $col_length > 0 ) { |
1256 | 1256 | $max_length = (int) $col_length; |
1257 | | } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && intval( $col_length['length'] ) > 0 ) { |
| 1257 | } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) { |
1258 | 1258 | $max_length = (int) $col_length['length']; |
1259 | 1259 | |
1260 | 1260 | if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) { |
-
diff --git a/src/wp-includes/customize/class-wp-customize-date-time-control.php b/src/wp-includes/customize/class-wp-customize-date-time-control.php
index 0d88b378bc..54671896fa 100644
a
|
b
|
public function render_content() {} |
81 | 81 | public function json() { |
82 | 82 | $data = parent::json(); |
83 | 83 | |
84 | | $data['maxYear'] = intval( $this->max_year ); |
85 | | $data['minYear'] = intval( $this->min_year ); |
| 84 | $data['maxYear'] = (int) $this->max_year; |
| 85 | $data['minYear'] = (int) $this->min_year; |
86 | 86 | $data['allowPastDate'] = (bool) $this->allow_past_date; |
87 | 87 | $data['twelveHourFormat'] = (bool) $this->twelve_hour_format; |
88 | 88 | $data['includeTime'] = (bool) $this->include_time; |
… |
… |
public function get_timezone_info() { |
245 | 245 | $timezone_info['description'] = ''; |
246 | 246 | } |
247 | 247 | } else { |
248 | | $formatted_gmt_offset = $this->format_gmt_offset( intval( get_option( 'gmt_offset', 0 ) ) ); |
| 248 | $formatted_gmt_offset = $this->format_gmt_offset( (int) get_option( 'gmt_offset', 0 ) ); |
249 | 249 | |
250 | 250 | $timezone_info['description'] = sprintf( |
251 | 251 | /* translators: 1: UTC abbreviation and offset, 2: UTC offset. */ |
-
diff --git a/src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php b/src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
index 46601a9e18..5da6515f5f 100644
a
|
b
|
public function __construct( WP_Customize_Manager $manager, $id, array $args = a |
171 | 171 | throw new Exception( "Illegal widget setting ID: $id" ); |
172 | 172 | } |
173 | 173 | |
174 | | $this->post_id = intval( $matches['id'] ); |
| 174 | $this->post_id = (int) $matches['id']; |
175 | 175 | add_action( 'wp_update_nav_menu_item', array( $this, 'flush_cached_value' ), 10, 2 ); |
176 | 176 | |
177 | 177 | parent::__construct( $manager, $id, $args ); |
… |
… |
protected function populate_value() { |
368 | 368 | |
369 | 369 | foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) { |
370 | 370 | if ( ! is_int( $this->value[ $key ] ) ) { |
371 | | $this->value[ $key ] = intval( $this->value[ $key ] ); |
| 371 | $this->value[ $key ] = (int) $this->value[ $key ]; |
372 | 372 | } |
373 | 373 | } |
374 | 374 | foreach ( array( 'classes', 'xfn' ) as $key ) { |
… |
… |
public function sanitize( $menu_item_value ) { |
684 | 684 | ); |
685 | 685 | $menu_item_value = array_merge( $default, $menu_item_value ); |
686 | 686 | $menu_item_value = wp_array_slice_assoc( $menu_item_value, array_keys( $default ) ); |
687 | | $menu_item_value['position'] = intval( $menu_item_value['position'] ); |
| 687 | $menu_item_value['position'] = (int) $menu_item_value['position']; |
688 | 688 | |
689 | 689 | foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) { |
690 | 690 | // Note we need to allow negative-integer IDs for previewed objects not inserted yet. |
691 | | $menu_item_value[ $key ] = intval( $menu_item_value[ $key ] ); |
| 691 | $menu_item_value[ $key ] = (int) $menu_item_value[ $key ]; |
692 | 692 | } |
693 | 693 | |
694 | 694 | foreach ( array( 'type', 'object', 'target' ) as $key ) { |
… |
… |
protected function update( $value ) { |
798 | 798 | return; |
799 | 799 | } |
800 | 800 | |
801 | | if ( intval( $value['nav_menu_term_id'] ) !== $nav_menu_setting->previous_term_id ) { |
| 801 | if ( (int) $value['nav_menu_term_id'] !== $nav_menu_setting->previous_term_id ) { |
802 | 802 | $this->update_status = 'error'; |
803 | 803 | $this->update_error = new WP_Error( 'unexpected_previous_term_id' ); |
804 | 804 | return; |
… |
… |
protected function update( $value ) { |
824 | 824 | return; |
825 | 825 | } |
826 | 826 | |
827 | | if ( intval( $value['menu_item_parent'] ) !== $parent_nav_menu_item_setting->previous_post_id ) { |
| 827 | if ( (int) $value['menu_item_parent'] !== $parent_nav_menu_item_setting->previous_post_id ) { |
828 | 828 | $this->update_status = 'error'; |
829 | 829 | $this->update_error = new WP_Error( 'unexpected_previous_post_id' ); |
830 | 830 | return; |
-
diff --git a/src/wp-includes/customize/class-wp-customize-nav-menu-section.php b/src/wp-includes/customize/class-wp-customize-nav-menu-section.php
index bbb5f95e7d..225d035eef 100644
a
|
b
|
class WP_Customize_Nav_Menu_Section extends WP_Customize_Section { |
34 | 34 | */ |
35 | 35 | public function json() { |
36 | 36 | $exported = parent::json(); |
37 | | $exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ) ); |
| 37 | $exported['menu_id'] = (int) preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ); |
38 | 38 | |
39 | 39 | return $exported; |
40 | 40 | } |
-
diff --git a/src/wp-includes/customize/class-wp-customize-nav-menu-setting.php b/src/wp-includes/customize/class-wp-customize-nav-menu-setting.php
index 1b0de422ab..4ff3d84a31 100644
a
|
b
|
public function __construct( WP_Customize_Manager $manager, $id, array $args = a |
141 | 141 | throw new Exception( "Illegal widget setting ID: $id" ); |
142 | 142 | } |
143 | 143 | |
144 | | $this->term_id = intval( $matches['id'] ); |
| 144 | $this->term_id = (int) $matches['id']; |
145 | 145 | |
146 | 146 | parent::__construct( $manager, $id, $args ); |
147 | 147 | } |
… |
… |
public function sanitize( $value ) { |
433 | 433 | |
434 | 434 | $value['name'] = trim( esc_html( $value['name'] ) ); // This sanitization code is used in wp-admin/nav-menus.php. |
435 | 435 | $value['description'] = sanitize_text_field( $value['description'] ); |
436 | | $value['parent'] = max( 0, intval( $value['parent'] ) ); |
| 436 | $value['parent'] = max( 0, (int) $value['parent']); |
437 | 437 | $value['auto_add'] = ! empty( $value['auto_add'] ); |
438 | 438 | |
439 | 439 | if ( '' === $value['name'] ) { |
… |
… |
protected function update( $value ) { |
556 | 556 | } |
557 | 557 | |
558 | 558 | $post_value = $setting->post_value( null ); |
559 | | if ( ! is_null( $post_value ) && intval( $post_value ) === $this->previous_term_id ) { |
| 559 | if ( ! is_null( $post_value ) && (int) $post_value === $this->previous_term_id ) { |
560 | 560 | $this->manager->set_post_value( $setting->id, $this->term_id ); |
561 | 561 | $setting->save(); |
562 | 562 | } |
… |
… |
protected function update( $value ) { |
570 | 570 | } |
571 | 571 | |
572 | 572 | $widget_instance = $nav_menu_widget_setting->post_value(); // Note that this calls WP_Customize_Widgets::sanitize_widget_instance(). |
573 | | if ( empty( $widget_instance['nav_menu'] ) || intval( $widget_instance['nav_menu'] ) !== $this->previous_term_id ) { |
| 573 | if (empty( $widget_instance['nav_menu'] ) || (int) $widget_instance['nav_menu'] !== $this->previous_term_id ) { |
574 | 574 | continue; |
575 | 575 | } |
576 | 576 | |
-
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index 45922d6f65..b54524ee07 100644
a
|
b
|
function iso8601_timezone_to_offset( $timezone ) { |
3568 | 3568 | $offset = 0; |
3569 | 3569 | } else { |
3570 | 3570 | $sign = ( '+' === substr( $timezone, 0, 1 ) ) ? 1 : -1; |
3571 | | $hours = intval( substr( $timezone, 1, 2 ) ); |
3572 | | $minutes = intval( substr( $timezone, 3, 4 ) ) / 60; |
| 3571 | $hours = (int) substr( $timezone, 1, 2 ); |
| 3572 | $minutes = (int) substr( $timezone, 3, 4 ) / 60; |
3573 | 3573 | $offset = $sign * HOUR_IN_SECONDS * ( $hours + $minutes ); |
3574 | 3574 | } |
3575 | 3575 | return $offset; |
… |
… |
function wp_trim_excerpt( $text = '', $post = null ) { |
3820 | 3820 | $text = str_replace( ']]>', ']]>', $text ); |
3821 | 3821 | |
3822 | 3822 | /* translators: Maximum number of words used in a post excerpt. */ |
3823 | | $excerpt_length = intval( _x( '55', 'excerpt_length' ) ); |
| 3823 | $excerpt_length = (int) _x( '55', 'excerpt_length' ); |
3824 | 3824 | |
3825 | 3825 | /** |
3826 | 3826 | * Filters the maximum number of words in a post excerpt. |
… |
… |
function sanitize_option( $option, $value ) { |
4725 | 4725 | if ( null === $value ) { |
4726 | 4726 | $value = 1; |
4727 | 4727 | } else { |
4728 | | $value = intval( $value ); |
| 4728 | $value = (int) $value; |
4729 | 4729 | } |
4730 | 4730 | break; |
4731 | 4731 | |
… |
… |
function wp_sprintf( $pattern, ...$args ) { |
5067 | 5067 | if ( $_fragment != $fragment ) { |
5068 | 5068 | $fragment = $_fragment; |
5069 | 5069 | } else { |
5070 | | $fragment = sprintf( $fragment, strval( $arg ) ); |
| 5070 | $fragment = sprintf( $fragment, (string) $arg); |
5071 | 5071 | } |
5072 | 5072 | } |
5073 | 5073 | |
-
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 8d8e5001e2..59aed87aa4 100644
a
|
b
|
function dead_db() { |
4719 | 4719 | * @return int A non-negative integer. |
4720 | 4720 | */ |
4721 | 4721 | function absint( $maybeint ) { |
4722 | | return abs( intval( $maybeint ) ); |
| 4722 | return abs((int) $maybeint); |
4723 | 4723 | } |
4724 | 4724 | |
4725 | 4725 | /** |
-
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 01e7fa72d1..464436760f 100644
a
|
b
|
function wp_title( $sep = '»', $display = true, $seplocation = '' ) { |
1339 | 1339 | if ( is_archive() && ! empty( $m ) ) { |
1340 | 1340 | $my_year = substr( $m, 0, 4 ); |
1341 | 1341 | $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); |
1342 | | $my_day = intval( substr( $m, 6, 2 ) ); |
| 1342 | $my_day = (int) substr( $m, 6, 2 ); |
1343 | 1343 | $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
1344 | 1344 | } |
1345 | 1345 | |
… |
… |
function get_calendar( $initial = true, $echo = true ) { |
2223 | 2223 | |
2224 | 2224 | // Let's figure out when we are. |
2225 | 2225 | if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
2226 | | $thismonth = zeroise( intval( $monthnum ), 2 ); |
| 2226 | $thismonth = zeroise( (int) $monthnum, 2 ); |
2227 | 2227 | $thisyear = (int) $year; |
2228 | 2228 | } elseif ( ! empty( $w ) ) { |
2229 | 2229 | // We need to get the month from MySQL. |
… |
… |
function feed_links_extra( $args = array() ) { |
3149 | 3149 | $href = get_term_feed_link( $term->term_id, $term->taxonomy ); |
3150 | 3150 | } |
3151 | 3151 | } elseif ( is_author() ) { |
3152 | | $author_id = intval( get_query_var( 'author' ) ); |
| 3152 | $author_id = (int) get_query_var( 'author' ); |
3153 | 3153 | |
3154 | 3154 | $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
3155 | 3155 | $href = get_author_feed_link( $author_id ); |
… |
… |
function user_can_richedit() { |
3459 | 3459 | |
3460 | 3460 | if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users. |
3461 | 3461 | if ( $is_safari ) { |
3462 | | $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
| 3462 | $wp_rich_edit = ! wp_is_mobile() || (preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 ); |
3463 | 3463 | } elseif ( $is_IE ) { |
3464 | 3464 | $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false ); |
3465 | 3465 | } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { |
… |
… |
function paginate_links( $args = '' ) { |
4195 | 4195 | |
4196 | 4196 | // Get max pages and current page out of the current query, if available. |
4197 | 4197 | $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
4198 | | $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
| 4198 | $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
4199 | 4199 | |
4200 | 4200 | // Append the format placeholder to the base URL. |
4201 | 4201 | $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
-
diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
index d4acb41330..fba9dd3bba 100644
a
|
b
|
function ms_allowed_http_request_hosts( $is_external, $host ) { |
668 | 668 | */ |
669 | 669 | function wp_parse_url( $url, $component = -1 ) { |
670 | 670 | $to_unset = array(); |
671 | | $url = strval( $url ); |
| 671 | $url = (string) $url; |
672 | 672 | |
673 | 673 | if ( '//' === substr( $url, 0, 2 ) ) { |
674 | 674 | $to_unset[] = 'scheme'; |
-
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 58366208b1..0f4323f1bf 100644
a
|
b
|
function get_month_link( $year, $month ) { |
515 | 515 | $monthlink = $wp_rewrite->get_month_permastruct(); |
516 | 516 | if ( ! empty( $monthlink ) ) { |
517 | 517 | $monthlink = str_replace( '%year%', $year, $monthlink ); |
518 | | $monthlink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $monthlink ); |
| 518 | $monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink ); |
519 | 519 | $monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) ); |
520 | 520 | } else { |
521 | 521 | $monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) ); |
… |
… |
function get_day_link( $year, $month, $day ) { |
560 | 560 | $daylink = $wp_rewrite->get_day_permastruct(); |
561 | 561 | if ( ! empty( $daylink ) ) { |
562 | 562 | $daylink = str_replace( '%year%', $year, $daylink ); |
563 | | $daylink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $daylink ); |
564 | | $daylink = str_replace( '%day%', zeroise( intval( $day ), 2 ), $daylink ); |
| 563 | $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink ); |
| 564 | $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink ); |
565 | 565 | $daylink = home_url( user_trailingslashit( $daylink, 'day' ) ); |
566 | 566 | } else { |
567 | 567 | $daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) ); |
… |
… |
function get_next_posts_page_link( $max_page = 0 ) { |
2317 | 2317 | if ( ! $paged ) { |
2318 | 2318 | $paged = 1; |
2319 | 2319 | } |
2320 | | $nextpage = intval( $paged ) + 1; |
| 2320 | $nextpage = (int) $paged + 1; |
2321 | 2321 | if ( ! $max_page || $max_page >= $nextpage ) { |
2322 | 2322 | return get_pagenum_link( $nextpage ); |
2323 | 2323 | } |
… |
… |
function get_next_posts_link( $label = null, $max_page = 0 ) { |
2366 | 2366 | $paged = 1; |
2367 | 2367 | } |
2368 | 2368 | |
2369 | | $nextpage = intval( $paged ) + 1; |
| 2369 | $nextpage = (int) $paged + 1; |
2370 | 2370 | |
2371 | 2371 | if ( null === $label ) { |
2372 | 2372 | $label = __( 'Next Page »' ); |
… |
… |
function get_previous_posts_page_link() { |
2415 | 2415 | global $paged; |
2416 | 2416 | |
2417 | 2417 | if ( ! is_single() ) { |
2418 | | $nextpage = intval( $paged ) - 1; |
| 2418 | $nextpage = (int) $paged - 1; |
2419 | 2419 | if ( $nextpage < 1 ) { |
2420 | 2420 | $nextpage = 1; |
2421 | 2421 | } |
… |
… |
function get_next_comments_link( $label = '', $max_page = 0 ) { |
2888 | 2888 | $page = 1; |
2889 | 2889 | } |
2890 | 2890 | |
2891 | | $nextpage = intval( $page ) + 1; |
| 2891 | $nextpage = (int) $page + 1; |
2892 | 2892 | |
2893 | 2893 | if ( empty( $max_page ) ) { |
2894 | 2894 | $max_page = $wp_query->max_num_comment_pages; |
… |
… |
function get_previous_comments_link( $label = '' ) { |
2943 | 2943 | |
2944 | 2944 | $page = get_query_var( 'cpage' ); |
2945 | 2945 | |
2946 | | if ( intval( $page ) <= 1 ) { |
| 2946 | if ((int) $page <= 1 ) { |
2947 | 2947 | return; |
2948 | 2948 | } |
2949 | 2949 | |
2950 | | $prevpage = intval( $page ) - 1; |
| 2950 | $prevpage = (int) $page - 1; |
2951 | 2951 | |
2952 | 2952 | if ( empty( $label ) ) { |
2953 | 2953 | $label = __( '« Older Comments' ); |
-
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index e1091b9d8e..ef2423edfe 100644
a
|
b
|
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co |
71 | 71 | $max_width = $size[0]; |
72 | 72 | $max_height = $size[1]; |
73 | 73 | } elseif ( 'thumb' === $size || 'thumbnail' === $size ) { |
74 | | $max_width = intval( get_option( 'thumbnail_size_w' ) ); |
75 | | $max_height = intval( get_option( 'thumbnail_size_h' ) ); |
| 74 | $max_width = (int) get_option( 'thumbnail_size_w' ); |
| 75 | $max_height = (int) get_option( 'thumbnail_size_h' ); |
76 | 76 | // Last chance thumbnail size defaults. |
77 | 77 | if ( ! $max_width && ! $max_height ) { |
78 | 78 | $max_width = 128; |
79 | 79 | $max_height = 96; |
80 | 80 | } |
81 | 81 | } elseif ( 'medium' === $size ) { |
82 | | $max_width = intval( get_option( 'medium_size_w' ) ); |
83 | | $max_height = intval( get_option( 'medium_size_h' ) ); |
| 82 | $max_width = (int) get_option( 'medium_size_w' ); |
| 83 | $max_height = (int) get_option( 'medium_size_h' ); |
84 | 84 | |
85 | 85 | } elseif ( 'medium_large' === $size ) { |
86 | | $max_width = intval( get_option( 'medium_large_size_w' ) ); |
87 | | $max_height = intval( get_option( 'medium_large_size_h' ) ); |
| 86 | $max_width = (int) get_option( 'medium_large_size_w' ); |
| 87 | $max_height = (int) get_option( 'medium_large_size_h' ); |
88 | 88 | |
89 | | if ( intval( $content_width ) > 0 ) { |
90 | | $max_width = min( intval( $content_width ), $max_width ); |
| 89 | if ( (int) $content_width > 0 ) { |
| 90 | $max_width = min( (int) $content_width, $max_width ); |
91 | 91 | } |
92 | 92 | } elseif ( 'large' === $size ) { |
93 | 93 | /* |
… |
… |
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co |
96 | 96 | * itself, and within the theme's content width if it's known. The user |
97 | 97 | * can resize it in the editor if they wish. |
98 | 98 | */ |
99 | | $max_width = intval( get_option( 'large_size_w' ) ); |
100 | | $max_height = intval( get_option( 'large_size_h' ) ); |
| 99 | $max_width = (int) get_option( 'large_size_w' ); |
| 100 | $max_height = (int) get_option( 'large_size_h' ); |
101 | 101 | |
102 | | if ( intval( $content_width ) > 0 ) { |
103 | | $max_width = min( intval( $content_width ), $max_width ); |
| 102 | if ( (int) $content_width > 0 ) { |
| 103 | $max_width = min( (int) $content_width, $max_width ); |
104 | 104 | } |
105 | 105 | } elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) { |
106 | | $max_width = intval( $_wp_additional_image_sizes[ $size ]['width'] ); |
107 | | $max_height = intval( $_wp_additional_image_sizes[ $size ]['height'] ); |
| 106 | $max_width = (int) $_wp_additional_image_sizes[ $size ]['width']; |
| 107 | $max_height = (int) $_wp_additional_image_sizes[ $size ]['height']; |
108 | 108 | // Only in admin. Assume that theme authors know what they're doing. |
109 | | if ( intval( $content_width ) > 0 && 'edit' === $context ) { |
110 | | $max_width = min( intval( $content_width ), $max_width ); |
| 109 | if ( (int) $content_width > 0 && 'edit' === $context ) { |
| 110 | $max_width = min( (int) $content_width, $max_width ); |
111 | 111 | } |
112 | 112 | } else { // $size === 'full' has no constraint. |
113 | 113 | $max_width = $width; |
… |
… |
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co |
155 | 155 | function image_hwstring( $width, $height ) { |
156 | 156 | $out = ''; |
157 | 157 | if ( $width ) { |
158 | | $out .= 'width="' . intval( $width ) . '" '; |
| 158 | $out .= 'width="' . (int) $width . '" '; |
159 | 159 | } |
160 | 160 | if ( $height ) { |
161 | | $out .= 'height="' . intval( $height ) . '" '; |
| 161 | $out .= 'height="' . (int) $height . '" '; |
162 | 162 | } |
163 | 163 | return $out; |
164 | 164 | } |
… |
… |
function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { |
778 | 778 | |
779 | 779 | foreach ( $imagedata['sizes'] as $_size => $data ) { |
780 | 780 | // If there's an exact match to an existing image size, short circuit. |
781 | | if ( intval( $data['width'] ) === intval( $size[0] ) && intval( $data['height'] ) === intval( $size[1] ) ) { |
| 781 | if ( (int) $data['width'] === (int) $size[0] && (int) $data['height'] === (int) $size[1] ) { |
782 | 782 | $candidates[ $data['width'] * $data['height'] ] = $data; |
783 | 783 | break; |
784 | 784 | } |
… |
… |
function wp_get_registered_image_subsizes() { |
899 | 899 | |
900 | 900 | if ( isset( $additional_sizes[ $size_name ]['width'] ) ) { |
901 | 901 | // For sizes added by plugins and themes. |
902 | | $size_data['width'] = intval( $additional_sizes[ $size_name ]['width'] ); |
| 902 | $size_data['width'] = (int) $additional_sizes[ $size_name ]['width']; |
903 | 903 | } else { |
904 | 904 | // For default sizes set in options. |
905 | | $size_data['width'] = intval( get_option( "{$size_name}_size_w" ) ); |
| 905 | $size_data['width'] = (int) get_option( "{$size_name}_size_w" ); |
906 | 906 | } |
907 | 907 | |
908 | 908 | if ( isset( $additional_sizes[ $size_name ]['height'] ) ) { |
909 | | $size_data['height'] = intval( $additional_sizes[ $size_name ]['height'] ); |
| 909 | $size_data['height'] = (int) $additional_sizes[ $size_name ]['height']; |
910 | 910 | } else { |
911 | | $size_data['height'] = intval( get_option( "{$size_name}_size_h" ) ); |
| 911 | $size_data['height'] = (int) get_option( "{$size_name}_size_h" ); |
912 | 912 | } |
913 | 913 | |
914 | 914 | if ( empty( $size_data['width'] ) && empty( $size_data['height'] ) ) { |
… |
… |
function gallery_shortcode( $attr ) { |
2213 | 2213 | 'gallery' |
2214 | 2214 | ); |
2215 | 2215 | |
2216 | | $id = intval( $atts['id'] ); |
| 2216 | $id = (int) $atts['id']; |
2217 | 2217 | |
2218 | 2218 | if ( ! empty( $atts['include'] ) ) { |
2219 | 2219 | $_attachments = get_posts( |
… |
… |
function gallery_shortcode( $attr ) { |
2291 | 2291 | $icontag = 'dt'; |
2292 | 2292 | } |
2293 | 2293 | |
2294 | | $columns = intval( $atts['columns'] ); |
| 2294 | $columns = (int) $atts['columns']; |
2295 | 2295 | $itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100; |
2296 | 2296 | $float = is_rtl() ? 'right' : 'left'; |
2297 | 2297 | |
… |
… |
function wp_playlist_shortcode( $attr ) { |
2551 | 2551 | 'playlist' |
2552 | 2552 | ); |
2553 | 2553 | |
2554 | | $id = intval( $atts['id'] ); |
| 2554 | $id = (int) $atts['id']; |
2555 | 2555 | |
2556 | 2556 | if ( 'audio' !== $atts['type'] ) { |
2557 | 2557 | $atts['type'] = 'video'; |
… |
… |
function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) |
3330 | 3330 | ); |
3331 | 3331 | |
3332 | 3332 | foreach ( $attachments as $k => $attachment ) { |
3333 | | if ( intval( $attachment->ID ) === intval( $post->ID ) ) { |
| 3333 | if ( (int) $attachment->ID === (int) $post->ID ) { |
3334 | 3334 | break; |
3335 | 3335 | } |
3336 | 3336 | } |
… |
… |
function get_post_galleries( $post, $html = true ) { |
4515 | 4515 | |
4516 | 4516 | // Specify the post ID of the gallery we're viewing if the shortcode doesn't reference another post already. |
4517 | 4517 | if ( ! isset( $shortcode_attrs['id'] ) ) { |
4518 | | $shortcode[3] .= ' id="' . intval( $post->ID ) . '"'; |
| 4518 | $shortcode[3] .= ' id="' . (int) $post->ID . '"'; |
4519 | 4519 | } |
4520 | 4520 | |
4521 | 4521 | $gallery = do_shortcode_tag( $shortcode ); |
-
diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php
index 96ce28dee9..3cef8c1363 100644
a
|
b
|
function get_metadata_by_mid( $meta_type, $meta_id ) { |
722 | 722 | return false; |
723 | 723 | } |
724 | 724 | |
725 | | $meta_id = intval( $meta_id ); |
| 725 | $meta_id = (int) $meta_id; |
726 | 726 | if ( $meta_id <= 0 ) { |
727 | 727 | return false; |
728 | 728 | } |
… |
… |
function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = |
786 | 786 | return false; |
787 | 787 | } |
788 | 788 | |
789 | | $meta_id = intval( $meta_id ); |
| 789 | $meta_id = (int) $meta_id; |
790 | 790 | if ( $meta_id <= 0 ) { |
791 | 791 | return false; |
792 | 792 | } |
… |
… |
function delete_metadata_by_mid( $meta_type, $meta_id ) { |
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | |
904 | | $meta_id = intval( $meta_id ); |
| 904 | $meta_id = (int) $meta_id; |
905 | 905 | if ( $meta_id <= 0 ) { |
906 | 906 | return false; |
907 | 907 | } |
… |
… |
function update_meta_cache( $meta_type, $object_ids ) { |
1062 | 1062 | |
1063 | 1063 | if ( ! empty( $meta_list ) ) { |
1064 | 1064 | foreach ( $meta_list as $metarow ) { |
1065 | | $mpid = intval( $metarow[ $column ] ); |
| 1065 | $mpid = (int) $metarow[ $column ]; |
1066 | 1066 | $mkey = $metarow['meta_key']; |
1067 | 1067 | $mval = $metarow['meta_value']; |
1068 | 1068 | |
-
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index bfb2b157e1..7d777b1fb0 100644
a
|
b
|
function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) { |
708 | 708 | $mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain ); |
709 | 709 | $path = $base; |
710 | 710 | } else { |
711 | | $mydomain = "$domain"; |
| 711 | $mydomain = (string) $domain; |
712 | 712 | $path = $base . $blogname . '/'; |
713 | 713 | } |
714 | 714 | if ( domain_exists( $mydomain, $path, $current_network->id ) ) { |
… |
… |
function global_terms( $term_id, $deprecated = '' ) { |
1970 | 1970 | return $term_id; |
1971 | 1971 | } |
1972 | 1972 | |
1973 | | $term_id = intval( $term_id ); |
| 1973 | $term_id = (int) $term_id; |
1974 | 1974 | $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) ); |
1975 | 1975 | |
1976 | 1976 | $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) ); |
-
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index f7ceb7cf2b..162d584260 100644
a
|
b
|
function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item |
552 | 552 | $menu_item_db_id = (int) $menu_item_db_id; |
553 | 553 | |
554 | 554 | update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) ); |
555 | | update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', strval( (int) $args['menu-item-parent-id'] ) ); |
556 | | update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (int) $args['menu-item-object-id'] ) ); |
| 555 | update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ((int) $args['menu-item-parent-id'])); |
| 556 | update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ((int) $args['menu-item-object-id'])); |
557 | 557 | update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) ); |
558 | 558 | update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) ); |
559 | 559 | |
-
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index b2ed4642c5..e205a9b0f5 100644
a
|
b
|
function wp_rand( $min = 0, $max = 0 ) { |
2540 | 2540 | $value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 ); |
2541 | 2541 | } |
2542 | 2542 | |
2543 | | return abs( intval( $value ) ); |
| 2543 | return abs((int) $value); |
2544 | 2544 | } |
2545 | 2545 | endif; |
2546 | 2546 | |
-
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index c0e5e1fc70..974707355b 100644
a
|
b
|
function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { |
2499 | 2499 | * values include 'edit', 'display', |
2500 | 2500 | * 'attribute' and 'js'. |
2501 | 2501 | */ |
2502 | | $value = apply_filters( "{$field}", $value, $post_id, $context ); |
| 2502 | $value = apply_filters( (string) ( $field ), $value, $post_id, $context ); |
2503 | 2503 | } else { |
2504 | 2504 | $value = apply_filters( "post_{$field}", $value, $post_id, $context ); |
2505 | 2505 | } |
… |
… |
function wp_insert_post( $postarr, $wp_error = false ) { |
4128 | 4128 | } |
4129 | 4129 | |
4130 | 4130 | if ( $thumbnail_support ) { |
4131 | | $thumbnail_id = intval( $postarr['_thumbnail_id'] ); |
| 4131 | $thumbnail_id = (int) $postarr['_thumbnail_id']; |
4132 | 4132 | if ( -1 === $thumbnail_id ) { |
4133 | 4133 | delete_post_thumbnail( $post_ID ); |
4134 | 4134 | } else { |
… |
… |
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
4558 | 4558 | // Prevent new post slugs that could result in URLs that conflict with date archives. |
4559 | 4559 | $conflicts_with_date_archive = false; |
4560 | 4560 | if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) { |
4561 | | $slug_num = intval( $slug ); |
| 4561 | $slug_num = (int) $slug; |
4562 | 4562 | |
4563 | 4563 | if ( $slug_num ) { |
4564 | 4564 | $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); |
… |
… |
function get_page_children( $page_id, $pages ) { |
5229 | 5229 | // Build a hash of ID -> children. |
5230 | 5230 | $children = array(); |
5231 | 5231 | foreach ( (array) $pages as $page ) { |
5232 | | $children[ intval( $page->post_parent ) ][] = $page; |
| 5232 | $children[(int) $page->post_parent][] = $page; |
5233 | 5233 | } |
5234 | 5234 | |
5235 | 5235 | $page_list = array(); |
… |
… |
function get_page_hierarchy( &$pages, $page_id = 0 ) { |
5273 | 5273 | |
5274 | 5274 | $children = array(); |
5275 | 5275 | foreach ( (array) $pages as $p ) { |
5276 | | $parent_id = intval( $p->post_parent ); |
| 5276 | $parent_id = (int) $p->post_parent; |
5277 | 5277 | $children[ $parent_id ][] = $p; |
5278 | 5278 | } |
5279 | 5279 | |
… |
… |
function get_pages( $args = array() ) { |
5482 | 5482 | if ( ! empty( $post_authors ) ) { |
5483 | 5483 | foreach ( $post_authors as $post_author ) { |
5484 | 5484 | // Do we have an author id or an author login? |
5485 | | if ( 0 == intval( $post_author ) ) { |
| 5485 | if ( 0 == (int) $post_author ) { |
5486 | 5486 | $post_author = get_user_by( 'login', $post_author ); |
5487 | 5487 | if ( empty( $post_author ) ) { |
5488 | 5488 | continue; |
-
diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index cbad102bbe..d4a3147394 100644
a
|
b
|
function rest_is_boolean( $maybe_bool ) { |
1315 | 1315 | * @return bool True if an integer, otherwise false. |
1316 | 1316 | */ |
1317 | 1317 | function rest_is_integer( $maybe_integer ) { |
1318 | | return is_numeric( $maybe_integer ) && round( floatval( $maybe_integer ) ) === floatval( $maybe_integer ); |
| 1318 | return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer; |
1319 | 1319 | } |
1320 | 1320 | |
1321 | 1321 | /** |
… |
… |
function rest_sanitize_value_from_schema( $value, $args, $param = '' ) { |
1933 | 1933 | } |
1934 | 1934 | |
1935 | 1935 | if ( 'string' === $args['type'] ) { |
1936 | | return strval( $value ); |
| 1936 | return (string) $value; |
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | return $value; |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index 5b2abc794a..58aaa37a81 100644
a
|
b
|
public function edit_media_item( $request ) { |
499 | 499 | if ( $crop ) { |
500 | 500 | $size = $image_editor->get_size(); |
501 | 501 | |
502 | | $crop_x = round( ( $size['width'] * floatval( $request['x'] ) ) / 100.0 ); |
503 | | $crop_y = round( ( $size['height'] * floatval( $request['y'] ) ) / 100.0 ); |
504 | | $width = round( ( $size['width'] * floatval( $request['width'] ) ) / 100.0 ); |
505 | | $height = round( ( $size['height'] * floatval( $request['height'] ) ) / 100.0 ); |
| 502 | $crop_x = round( ( $size['width'] * (float) $request['x'] ) / 100.0 ); |
| 503 | $crop_y = round( ( $size['height'] * (float) $request['y'] ) / 100.0 ); |
| 504 | $width = round( ( $size['width'] * (float) $request['width'] ) / 100.0 ); |
| 505 | $height = round( ( $size['height'] * (float) $request['height'] ) / 100.0 ); |
506 | 506 | |
507 | 507 | $result = $image_editor->crop( $crop_x, $crop_y, $width, $height ); |
508 | 508 | |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
index 089a5215ba..e76940f7b7 100644
a
|
b
|
public function prepare_item_for_response( $plugin, $request ) { |
128 | 128 | 'description' => wp_trim_words( $plugin['description'], 30, '...' ), |
129 | 129 | 'id' => $plugin['slug'], |
130 | 130 | 'rating' => $plugin['rating'] / 20, |
131 | | 'rating_count' => intval( $plugin['num_ratings'] ), |
132 | | 'active_installs' => intval( $plugin['active_installs'] ), |
| 131 | 'rating_count' => (int) $plugin['num_ratings'], |
| 132 | 'active_installs' => (int) $plugin['active_installs'], |
133 | 133 | 'author_block_rating' => $plugin['author_block_rating'] / 20, |
134 | | 'author_block_count' => intval( $plugin['author_block_count'] ), |
| 134 | 'author_block_count' => (int) $plugin['author_block_count'], |
135 | 135 | 'author' => wp_strip_all_tags( $plugin['author'] ), |
136 | 136 | 'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ), |
137 | 137 | 'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ), |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
index 07a389e794..030f050f32 100644
a
|
b
|
public function register_routes() { |
109 | 109 | public function get_item_permissions_check( $request ) { |
110 | 110 | global $post; |
111 | 111 | |
112 | | $post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0; |
| 112 | $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0; |
113 | 113 | |
114 | 114 | if ( 0 < $post_id ) { |
115 | 115 | $post = get_post( $post_id ); |
… |
… |
public function get_item_permissions_check( $request ) { |
149 | 149 | public function get_item( $request ) { |
150 | 150 | global $post; |
151 | 151 | |
152 | | $post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0; |
| 152 | $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0; |
153 | 153 | |
154 | 154 | if ( 0 < $post_id ) { |
155 | 155 | $post = get_post( $post_id ); |
-
diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php
index 7bb7be1cb2..d7678bf74c 100644
a
|
b
|
function wp_revisions_to_keep( $post ) { |
545 | 545 | if ( true === $num ) { |
546 | 546 | $num = -1; |
547 | 547 | } else { |
548 | | $num = intval( $num ); |
| 548 | $num = (int) $num; |
549 | 549 | } |
550 | 550 | |
551 | 551 | if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { |
… |
… |
function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { |
676 | 676 | return $value; |
677 | 677 | } |
678 | 678 | |
679 | | $thumbnail_id = intval( $_REQUEST['_thumbnail_id'] ); |
| 679 | $thumbnail_id = (int) $_REQUEST['_thumbnail_id']; |
680 | 680 | if ( $thumbnail_id <= 0 ) { |
681 | 681 | return ''; |
682 | 682 | } |
683 | 683 | |
684 | | return strval( $thumbnail_id ); |
| 684 | return (string) $thumbnail_id; |
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
-
diff --git a/src/wp-includes/rewrite.php b/src/wp-includes/rewrite.php
index 3c7db94a65..078884e664 100644
a
|
b
|
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { |
400 | 400 | // If the date of the post doesn't match the date specified in the URL, resolve to the date archive. |
401 | 401 | if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) { |
402 | 402 | // $matches[1] is the year the post was published. |
403 | | if ( intval( $query_vars['year'] ) !== intval( $matches[1] ) ) { |
| 403 | if ((int) $query_vars['year'] !== (int) $matches[1]) { |
404 | 404 | return $query_vars; |
405 | 405 | } |
406 | 406 | |
407 | 407 | // $matches[2] is the month the post was published. |
408 | | if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && intval( $query_vars['monthnum'] ) !== intval( $matches[2] ) ) { |
| 408 | if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2]) { |
409 | 409 | return $query_vars; |
410 | 410 | } |
411 | 411 | } |
… |
… |
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { |
437 | 437 | |
438 | 438 | // If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage. |
439 | 439 | if ( '' !== $maybe_page ) { |
440 | | $query_vars['page'] = intval( $maybe_page ); |
| 440 | $query_vars['page'] = (int) $maybe_page; |
441 | 441 | } |
442 | 442 | |
443 | 443 | // Next, unset autodetected date-related query vars. |
-
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index cc491a87dd..db923f9371 100644
a
|
b
|
function get_term_children( $term_id, $taxonomy ) { |
1048 | 1048 | return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); |
1049 | 1049 | } |
1050 | 1050 | |
1051 | | $term_id = intval( $term_id ); |
| 1051 | $term_id = (int) $term_id; |
1052 | 1052 | |
1053 | 1053 | $terms = _get_term_hierarchy( $taxonomy ); |
1054 | 1054 | |
… |
… |
function get_object_term_cache( $id, $taxonomy ) { |
3490 | 3490 | $term_ids = array(); |
3491 | 3491 | foreach ( $_term_ids as $term_id ) { |
3492 | 3492 | if ( is_numeric( $term_id ) ) { |
3493 | | $term_ids[] = intval( $term_id ); |
| 3493 | $term_ids[] = (int) $term_id; |
3494 | 3494 | } elseif ( isset( $term_id->term_id ) ) { |
3495 | | $term_ids[] = intval( $term_id->term_id ); |
| 3495 | $term_ids[] = (int) $term_id->term_id; |
3496 | 3496 | } |
3497 | 3497 | } |
3498 | 3498 | |
… |
… |
function _split_shared_term( $term_id, $term_taxonomy_id, $record = true ) { |
3948 | 3948 | |
3949 | 3949 | if ( is_object( $term_id ) ) { |
3950 | 3950 | $shared_term = $term_id; |
3951 | | $term_id = intval( $shared_term->term_id ); |
| 3951 | $term_id = (int) $shared_term->term_id; |
3952 | 3952 | } |
3953 | 3953 | |
3954 | 3954 | if ( is_object( $term_taxonomy_id ) ) { |
3955 | 3955 | $term_taxonomy = $term_taxonomy_id; |
3956 | | $term_taxonomy_id = intval( $term_taxonomy->term_taxonomy_id ); |
| 3956 | $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id; |
3957 | 3957 | } |
3958 | 3958 | |
3959 | 3959 | // If there are no shared term_taxonomy rows, there's nothing to do here. |
… |
… |
function _wp_batch_split_terms() { |
4120 | 4120 | // Rekey shared term array for faster lookups. |
4121 | 4121 | $_shared_terms = array(); |
4122 | 4122 | foreach ( $shared_terms as $shared_term ) { |
4123 | | $term_id = intval( $shared_term->term_id ); |
| 4123 | $term_id = (int) $shared_term->term_id; |
4124 | 4124 | $_shared_terms[ $term_id ] = $shared_term; |
4125 | 4125 | } |
4126 | 4126 | $shared_terms = $_shared_terms; |
… |
… |
function _wp_batch_split_terms() { |
4134 | 4134 | $skipped_first_term = array(); |
4135 | 4135 | $taxonomies = array(); |
4136 | 4136 | foreach ( $shared_tts as $shared_tt ) { |
4137 | | $term_id = intval( $shared_tt->term_id ); |
| 4137 | $term_id = (int) $shared_tt->term_id; |
4138 | 4138 | |
4139 | 4139 | // Don't split the first tt belonging to a given term_id. |
4140 | 4140 | if ( ! isset( $skipped_first_term[ $term_id ] ) ) { |
-
diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index a5df68a40f..846b13d0fc 100644
a
|
b
|
function wp_update_plugins( $extra_stats = array() ) { |
322 | 322 | foreach ( $plugins as $file => $p ) { |
323 | 323 | $new_option->checked[ $file ] = $p['Version']; |
324 | 324 | |
325 | | if ( ! isset( $current->checked[ $file ] ) || strval( $current->checked[ $file ] ) !== strval( $p['Version'] ) ) { |
| 325 | if (! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version']) { |
326 | 326 | $plugin_changed = true; |
327 | 327 | } |
328 | 328 | } |
… |
… |
function wp_update_themes( $extra_stats = array() ) { |
527 | 527 | $theme_changed = false; |
528 | 528 | |
529 | 529 | foreach ( $checked as $slug => $v ) { |
530 | | if ( ! isset( $last_update->checked[ $slug ] ) || strval( $last_update->checked[ $slug ] ) !== strval( $v ) ) { |
| 530 | if (! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v) { |
531 | 531 | $theme_changed = true; |
532 | 532 | } |
533 | 533 | } |
-
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 22a9639033..41343f358f 100644
a
|
b
|
function sanitize_user_field( $field, $value, $user_id, $context ) { |
1316 | 1316 | if ( $prefixed ) { |
1317 | 1317 | |
1318 | 1318 | /** This filter is documented in wp-includes/post.php */ |
1319 | | $value = apply_filters( "{$field}", $value, $user_id, $context ); |
| 1319 | $value = apply_filters( (string) ( $field ), $value, $user_id, $context ); |
1320 | 1320 | } else { |
1321 | 1321 | |
1322 | 1322 | /** |
-
diff --git a/src/wp-includes/vars.php b/src/wp-includes/vars.php
index 72259b2652..6aa98d53aa 100644
a
|
b
|
|
134 | 134 | * |
135 | 135 | * @global bool $is_iis7 |
136 | 136 | */ |
137 | | $is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7; |
| 137 | $is_iis7 = $is_IIS && (int) substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) >= 7; |
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
-
diff --git a/src/wp-includes/widgets/class-wp-widget-links.php b/src/wp-includes/widgets/class-wp-widget-links.php
index 92b2f5dd00..e90b558ade 100644
a
|
b
|
public function update( $new_instance, $old_instance ) { |
109 | 109 | $instance['orderby'] = $new_instance['orderby']; |
110 | 110 | } |
111 | 111 | |
112 | | $instance['category'] = intval( $new_instance['category'] ); |
113 | | $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1; |
| 112 | $instance['category'] = (int) $new_instance['category']; |
| 113 | $instance['limit'] = ! empty( $new_instance['limit'] ) ? (int) $new_instance['limit'] : -1; |
114 | 114 | |
115 | 115 | return $instance; |
116 | 116 | } |
… |
… |
public function form( $instance ) { |
138 | 138 | ) |
139 | 139 | ); |
140 | 140 | $link_cats = get_terms( array( 'taxonomy' => 'link_category' ) ); |
141 | | $limit = intval( $instance['limit'] ); |
| 141 | $limit = (int) $instance['limit']; |
142 | 142 | if ( ! $limit ) { |
143 | 143 | $limit = -1; |
144 | 144 | } |
… |
… |
public function form( $instance ) { |
148 | 148 | <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> |
149 | 149 | <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option> |
150 | 150 | <?php foreach ( $link_cats as $link_cat ) : ?> |
151 | | <option value="<?php echo intval( $link_cat->term_id ); ?>" <?php selected( $instance['category'], $link_cat->term_id ); ?>> |
| 151 | <option value="<?php echo (int) $link_cat->term_id; ?>" <?php selected( $instance['category'], $link_cat->term_id ); ?>> |
152 | 152 | <?php echo esc_html( $link_cat->name ); ?> |
153 | 153 | </option> |
154 | 154 | <?php endforeach; ?> |
… |
… |
public function form( $instance ) { |
181 | 181 | |
182 | 182 | <p> |
183 | 183 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label> |
184 | | <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? intval( $limit ) : ''; ?>" size="3" /> |
| 184 | <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? (int) $limit : ''; ?>" size="3" /> |
185 | 185 | </p> |
186 | 186 | <?php |
187 | 187 | } |
-
diff --git a/src/wp-includes/widgets/class-wp-widget-media.php b/src/wp-includes/widgets/class-wp-widget-media.php
index bb8976a4ea..51915965e1 100644
a
|
b
|
public function update( $new_instance, $instance ) { |
343 | 343 | class="media-widget-instance-property" |
344 | 344 | name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" |
345 | 345 | id="<?php echo esc_attr( $this->get_field_id( $name ) ); // Needed specifically by wpWidgets.appendTitle(). ?>" |
346 | | value="<?php echo esc_attr( is_array( $value ) ? join( ',', $value ) : strval( $value ) ); ?>" |
| 346 | value="<?php echo esc_attr( is_array( $value ) ? join( ',', $value ) : (string) $value); ?>" |
347 | 347 | /> |
348 | 348 | <?php |
349 | 349 | endforeach; |
-
diff --git a/src/wp-trackback.php b/src/wp-trackback.php
index 9d798b7167..bab7e5f7f5 100644
a
|
b
|
function trackback_response( $error = 0, $error_message = '' ) { |
46 | 46 | |
47 | 47 | if ( ! isset( $_GET['tb_id'] ) || ! $_GET['tb_id'] ) { |
48 | 48 | $tb_id = explode( '/', $_SERVER['REQUEST_URI'] ); |
49 | | $tb_id = intval( $tb_id[ count( $tb_id ) - 1 ] ); |
| 49 | $tb_id = (int) $tb_id[count( $tb_id ) - 1 ]; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $tb_url = isset( $_POST['url'] ) ? $_POST['url'] : ''; |
… |
… |
function trackback_response( $error = 0, $error_message = '' ) { |
84 | 84 | $tb_id = $posts[0]->ID; |
85 | 85 | } |
86 | 86 | |
87 | | if ( ! isset( $tb_id ) || ! intval( $tb_id ) ) { |
| 87 | if ( ! isset( $tb_id ) || !(int) $tb_id) { |
88 | 88 | trackback_response( 1, __( 'I really need an ID for this to work.' ) ); |
89 | 89 | } |
90 | 90 | |
-
diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php
index 285c2d23c3..08b7c0f5d9 100644
a
|
b
|
function xml_array_dumbdown( &$data ) { |
299 | 299 | |
300 | 300 | function dmp( ...$args ) { |
301 | 301 | foreach ( $args as $thing ) { |
302 | | echo ( is_scalar( $thing ) ? strval( $thing ) : var_export( $thing, true ) ), "\n"; |
| 302 | echo ( is_scalar( $thing ) ? (string) $thing : var_export( $thing, true ) ), "\n"; |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
… |
… |
function gen_tests_array( $name, $array ) { |
319 | 319 | $out = array(); |
320 | 320 | foreach ( $array as $k => $v ) { |
321 | 321 | if ( is_numeric( $k ) ) { |
322 | | $index = strval( $k ); |
| 322 | $index = (string) $k; |
323 | 323 | } else { |
324 | 324 | $index = "'" . addcslashes( $k, "\n\r\t'\\" ) . "'"; |
325 | 325 | } |
-
diff --git a/tests/phpunit/tests/comment-submission.php b/tests/phpunit/tests/comment-submission.php
index 88d5a1eae9..715783a3c1 100644
a
|
b
|
public function test_submitting_valid_comment_as_logged_in_user_succeeds() { |
250 | 250 | $this->assertSame( $user->display_name, $comment->comment_author ); |
251 | 251 | $this->assertSame( $user->user_email, $comment->comment_author_email ); |
252 | 252 | $this->assertSame( $user->user_url, $comment->comment_author_url ); |
253 | | $this->assertSame( $user->ID, intval( $comment->user_id ) ); |
| 253 | $this->assertSame( $user->ID, (int) $comment->user_id ); |
254 | 254 | |
255 | 255 | } |
256 | 256 | |
-
diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php
index 89ef378436..e7c57ddfa8 100644
a
|
b
|
function test_set_post_value() { |
2767 | 2767 | * @return int Value. |
2768 | 2768 | */ |
2769 | 2769 | function sanitize_foo_for_test_set_post_value( $value ) { |
2770 | | return intval( $value ); |
| 2770 | return (int) $value; |
2771 | 2771 | } |
2772 | 2772 | |
2773 | 2773 | /** |
-
diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index 282988c081..0790b9b3cf 100644
a
|
b
|
function test_load_available_items_query_returns_post_item_with_page_number() { |
173 | 173 | 'type' => 'post_type', |
174 | 174 | 'type_label' => 'Post', |
175 | 175 | 'object' => 'post', |
176 | | 'object_id' => intval( $post_id ), |
177 | | 'url' => get_permalink( intval( $post_id ) ), |
| 176 | 'object_id' => (int) $post_id, |
| 177 | 'url' => get_permalink( (int) $post_id ), |
178 | 178 | ); |
179 | 179 | |
180 | 180 | // Offset the query and get the second page of menu items. |
… |
… |
function test_load_available_items_query_returns_page_item() { |
205 | 205 | 'type' => 'post_type', |
206 | 206 | 'type_label' => 'Page', |
207 | 207 | 'object' => 'page', |
208 | | 'object_id' => intval( $page_id ), |
209 | | 'url' => get_permalink( intval( $page_id ) ), |
| 208 | 'object_id' => (int) $page_id, |
| 209 | 'url' => get_permalink( (int) $page_id ), |
210 | 210 | ); |
211 | 211 | |
212 | 212 | $items = $menus->load_available_items_query( 'post_type', 'page', 0 ); |
… |
… |
function test_load_available_items_query_returns_post_item() { |
231 | 231 | 'type' => 'post_type', |
232 | 232 | 'type_label' => 'Post', |
233 | 233 | 'object' => 'post', |
234 | | 'object_id' => intval( $post_id ), |
235 | | 'url' => get_permalink( intval( $post_id ) ), |
| 234 | 'object_id' => (int) $post_id, |
| 235 | 'url' => get_permalink( (int) $post_id ), |
236 | 236 | ); |
237 | 237 | |
238 | 238 | $items = $menus->load_available_items_query( 'post_type', 'post', 0 ); |
… |
… |
function test_load_available_items_query_returns_term_item() { |
257 | 257 | 'type' => 'taxonomy', |
258 | 258 | 'type_label' => 'Category', |
259 | 259 | 'object' => 'category', |
260 | | 'object_id' => intval( $term_id ), |
261 | | 'url' => get_term_link( intval( $term_id ), 'category' ), |
| 260 | 'object_id' => (int) $term_id, |
| 261 | 'url' => get_term_link( (int) $term_id, 'category' ), |
262 | 262 | ); |
263 | 263 | |
264 | 264 | $items = $menus->load_available_items_query( 'taxonomy', 'category', 0 ); |
… |
… |
function test_search_available_items_query() { |
327 | 327 | 'type' => 'post_type', |
328 | 328 | 'type_label' => get_post_type_object( 'post' )->labels->singular_name, |
329 | 329 | 'object' => 'post', |
330 | | 'object_id' => intval( $post_id ), |
331 | | 'url' => get_permalink( intval( $post_id ) ), |
| 330 | 'object_id' => (int) $post_id, |
| 331 | 'url' => get_permalink( (int) $post_id ), |
332 | 332 | ); |
333 | 333 | wp_set_object_terms( $post_id, $term_ids, 'category' ); |
334 | 334 | $search = $post_id === $post_ids[0] ? 'test & search' : 'other title'; |
… |
… |
function test_search_available_items_query() { |
351 | 351 | 'type' => 'taxonomy', |
352 | 352 | 'type_label' => get_taxonomy( 'category' )->labels->singular_name, |
353 | 353 | 'object' => 'category', |
354 | | 'object_id' => intval( $term_id ), |
355 | | 'url' => get_term_link( intval( $term_id ), 'category' ), |
| 354 | 'object_id' => (int) $term_id, |
| 355 | 'url' => get_term_link( (int) $term_id, 'category' ), |
356 | 356 | ); |
357 | 357 | $s = sanitize_text_field( wp_unslash( $term->name ) ); |
358 | 358 | $results = $menus->search_available_items_query( |
… |
… |
public function test_search_available_items_query_should_return_unassigned_term_ |
431 | 431 | 'type' => 'taxonomy', |
432 | 432 | 'type_label' => 'Tests Taxonomy', |
433 | 433 | 'object' => 'wptests_tax', |
434 | | 'object_id' => intval( $term_id ), |
435 | | 'url' => get_term_link( intval( $term_id ), '' ), |
| 434 | 'object_id' => (int) $term_id, |
| 435 | 'url' => get_term_link( (int) $term_id, '' ), |
436 | 436 | ); |
437 | 437 | |
438 | 438 | $results = $menus->search_available_items_query( |
-
diff --git a/tests/phpunit/tests/customize/partial.php b/tests/phpunit/tests/customize/partial.php
index e73ac56f0b..c7e6126c40 100644
a
|
b
|
function test_construct_default_args() { |
66 | 66 | */ |
67 | 67 | function render_post_content_partial( $partial ) { |
68 | 68 | $id_data = $partial->id_data(); |
69 | | $post_id = intval( $id_data['keys'][0] ); |
| 69 | $post_id = (int) $id_data['keys'][0]; |
70 | 70 | if ( empty( $post_id ) ) { |
71 | 71 | return false; |
72 | 72 | } |
-
diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php
index 5abaa0f45b..46ab3f81b5 100644
a
|
b
|
function test_call_widget_update() { |
482 | 482 | 'id_base' => 'search', |
483 | 483 | 'widget-width' => '250', |
484 | 484 | 'widget-height' => '200', |
485 | | 'widget_number' => strval( $widget_number ), |
| 485 | 'widget_number' => (string) $widget_number, |
486 | 486 | 'multi_number' => '', |
487 | 487 | 'add_new' => '', |
488 | 488 | ) |
-
diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php
index a358c654af..5c56aa6011 100644
a
|
b
|
public function test_remove_orientation_data_on_rotate() { |
558 | 558 | $data = wp_read_image_metadata( $file ); |
559 | 559 | |
560 | 560 | // The orientation value 3 is equivalent to rotated upside down (180 degrees). |
561 | | $this->assertSame( 3, intval( $data['orientation'] ), 'Orientation value read from does not match image file Exif data: ' . $file ); |
| 561 | $this->assertSame( 3, (int) $data['orientation'], 'Orientation value read from does not match image file Exif data: ' . $file ); |
562 | 562 | |
563 | 563 | $temp_file = wp_tempnam( $file ); |
564 | 564 | $image = wp_get_image_editor( $file ); |
… |
… |
public function test_remove_orientation_data_on_rotate() { |
570 | 570 | $data = wp_read_image_metadata( $ret['path'] ); |
571 | 571 | |
572 | 572 | // Make sure the image is no longer in The Upside Down Exif orientation. |
573 | | $this->assertSame( 1, intval( $data['orientation'] ), 'Orientation Exif data was not updated after rotating image: ' . $file ); |
| 573 | $this->assertSame( 1, (int) $data['orientation'], 'Orientation Exif data was not updated after rotating image: ' . $file ); |
574 | 574 | |
575 | 575 | // Remove both the generated file ending in .tmp and tmp.jpg due to wp_tempnam(). |
576 | 576 | unlink( $temp_file ); |
-
diff --git a/tests/phpunit/tests/option/multisite.php b/tests/phpunit/tests/option/multisite.php
index 49c7197431..f5e0174ca5 100644
a
|
b
|
function test_with_another_site() { |
120 | 120 | $this->assertTrue( add_blog_option( $blog_id, $key, $value ) ); |
121 | 121 | // Assert all values of $blog_id that means the current or main blog (the same here). |
122 | 122 | $this->assertSame( $value, get_blog_option( $blog_id, $key ) ); |
123 | | $this->assertSame( $value, get_blog_option( "$blog_id", $key ) ); |
| 123 | $this->assertSame( $value, get_blog_option( (string) $blog_id, $key ) ); |
124 | 124 | // $this->assertSame( $value, get_option( $key ) ); // Check get_option(). |
125 | 125 | |
126 | 126 | $this->assertFalse( add_blog_option( $blog_id, $key, $value ) ); // Already exists. |
-
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index bacf9b23c5..7fc4313163 100644
a
|
b
|
function setUp() { |
43 | 43 | * Helper function: return the timestamp(s) of cron jobs for the specified hook and post. |
44 | 44 | */ |
45 | 45 | function _next_schedule_for_post( $hook, $id ) { |
46 | | return wp_next_scheduled( 'publish_future_post', array( 0 => intval( $id ) ) ); |
| 46 | return wp_next_scheduled( 'publish_future_post', array( 0 => (int) $id ) ); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
-
diff --git a/tests/phpunit/tests/query/results.php b/tests/phpunit/tests/query/results.php
index eb801249ab..e19353a457 100644
a
|
b
|
function test_query_author_vars() { |
905 | 905 | |
906 | 906 | $posts = $this->q->query( |
907 | 907 | array( |
908 | | 'author' => "$author_1", |
| 908 | 'author' => (string) $author_1, |
909 | 909 | 'post__in' => array( $post_1, $post_2, $post_3, $post_4 ), |
910 | 910 | ) |
911 | 911 | ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index 9831bb0aab..8ce34d4992 100644
a
|
b
|
public function test_get_items_exclude_query() { |
483 | 483 | $this->assertTrue( in_array( $id1, $ids, true ) ); |
484 | 484 | $this->assertFalse( in_array( $id2, $ids, true ) ); |
485 | 485 | |
486 | | $request->set_param( 'exclude', "$id2" ); |
| 486 | $request->set_param( 'exclude', (string) $id2 ); |
487 | 487 | $response = rest_get_server()->dispatch( $request ); |
488 | 488 | $data = $response->get_data(); |
489 | 489 | $ids = wp_list_pluck( $data, 'id' ); |
-
diff --git a/tests/phpunit/tests/term/getTermLink.php b/tests/phpunit/tests/term/getTermLink.php
index 492a980756..c9e6e2c5a8 100644
a
|
b
|
public function test_integer_should_be_interpreted_as_term_id() { |
25 | 25 | ) |
26 | 26 | ); |
27 | 27 | |
28 | | $term = intval( $t1 ); |
| 28 | $term = (int) $t1; |
29 | 29 | |
30 | 30 | $actual = get_term_link( $term, 'wptests_tax' ); |
31 | 31 | $this->assertContains( 'wptests_tax=foo', $actual ); |
-
diff --git a/tests/phpunit/tests/term/termExists.php b/tests/phpunit/tests/term/termExists.php
index 0cf7d79250..8f39385e40 100644
a
|
b
|
public function test_term_exists_term_int_taxonomy_nonempty_term_exists() { |
15 | 15 | ) |
16 | 16 | ); |
17 | 17 | |
18 | | $found = term_exists( intval( $t ), 'post_tag' ); |
| 18 | $found = term_exists( (int) $t, 'post_tag' ); |
19 | 19 | $this->assertEquals( $t, $found['term_id'] ); |
20 | 20 | } |
21 | 21 | |
… |
… |
public function test_term_exists_term_int_taxonomy_nonempty_wrong_taxonomy() { |
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | |
33 | | $this->assertNull( term_exists( intval( $t ), 'foo' ) ); |
| 33 | $this->assertNull( term_exists( (int) $t, 'foo' ) ); |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function test_term_exists_term_int_taxonomy_empty_term_exists() { |
… |
… |
public function test_term_exists_term_int_taxonomy_empty_term_exists() { |
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | |
43 | | $found = term_exists( intval( $t ), 'post_tag' ); |
| 43 | $found = term_exists( (int) $t, 'post_tag' ); |
44 | 44 | $this->assertEquals( $t, $found['term_id'] ); |
45 | 45 | } |
46 | 46 | |
-
diff --git a/tests/phpunit/tests/term/wpDeleteTerm.php b/tests/phpunit/tests/term/wpDeleteTerm.php
index 83855e17cd..92fc2f0ed9 100644
a
|
b
|
public function test_count_property_passed_to_filters_should_reflect_pre_deleted |
29 | 29 | |
30 | 30 | wp_delete_term( $terms[0], 'wptests_tax' ); |
31 | 31 | $this->assertSame( 1, $this->deleted_term->count ); |
32 | | $this->assertSame( $this->object_ids, array( "$post_id" ) ); |
| 32 | $this->assertSame( $this->object_ids, array( (string) $post_id ) ); |
33 | 33 | |
34 | 34 | wp_delete_term( $terms[1], 'wptests_tax' ); |
35 | 35 | $this->assertSame( 0, $this->deleted_term->count ); |
-
diff --git a/tests/phpunit/tests/term/wpSetObjectTerms.php b/tests/phpunit/tests/term/wpSetObjectTerms.php
index 8984dc940d..774842f1c3 100644
a
|
b
|
function test_set_object_terms_by_name() { |
145 | 145 | // Remember which term has which term_id. |
146 | 146 | for ( $i = 0; $i < 3; $i++ ) { |
147 | 147 | $term = get_term_by( 'name', $terms[ $i ], $this->taxonomy ); |
148 | | $term_id[ $terms[ $i ] ] = intval( $term->term_id ); |
| 148 | $term_id[ $terms[ $i ] ] = (int) $term->term_id; |
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
-
diff --git a/tests/phpunit/tests/user/wpGetUsersWithNoRole.php b/tests/phpunit/tests/user/wpGetUsersWithNoRole.php
index 46b8bafbdb..69892e0550 100644
a
|
b
|
public function test_get_users_with_no_role_multisite_is_accurate() { |
83 | 83 | $users = wp_get_users_with_no_role(); |
84 | 84 | $this->assertSame( |
85 | 85 | array( |
86 | | "{$nobody}", |
| 86 | (string) ( $nobody ), |
87 | 87 | ), |
88 | 88 | $users |
89 | 89 | ); |
… |
… |
public function test_get_users_with_no_role_multisite_is_accurate() { |
99 | 99 | $users = wp_get_users_with_no_role( $blog_1 ); |
100 | 100 | $this->assertSame( |
101 | 101 | array( |
102 | | "{$admin}", |
| 102 | (string) ( $admin ), |
103 | 103 | ), |
104 | 104 | $users |
105 | 105 | ); |
-
diff --git a/tests/phpunit/tests/xmlrpc/wp/getPosts.php b/tests/phpunit/tests/xmlrpc/wp/getPosts.php
index 8571969f13..92b54e7870 100644
a
|
b
|
function test_filters() { |
102 | 102 | $this->assertNotIXRError( $results2 ); |
103 | 103 | $last_comment_count = 100; |
104 | 104 | foreach ( $results2 as $post ) { |
105 | | $comment_count = intval( get_comments_number( $post['post_id'] ) ); |
| 105 | $comment_count = (int) get_comments_number( $post['post_id'] ); |
106 | 106 | $this->assertLessThanOrEqual( $last_comment_count, $comment_count ); |
107 | 107 | $last_comment_count = $comment_count; |
108 | 108 | } |