-
diff --git a/src/wp-admin/admin-header.php b/src/wp-admin/admin-header.php
index ed9c0399f9..7776b6474a 100644
a
|
b
|
|
167 | 167 | $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; |
168 | 168 | } |
169 | 169 | |
170 | | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) ); |
| 170 | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) ); |
171 | 171 | $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
172 | 172 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
173 | 173 | $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 ffdfda097e..6b3aa3ba87 100644
a
|
b
|
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // just fetch the detail form for that attachment |
42 | | if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachment_id'] ) ) && $_REQUEST['fetch'] ) { |
| 42 | if ( isset( $_REQUEST['attachment_id'] ) && ( $id = (int) $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) { |
43 | 43 | $post = get_post( $id ); |
44 | 44 | if ( 'attachment' != $post->post_type ) { |
45 | 45 | wp_die( __( 'Invalid post type.' ) ); |
-
diff --git a/src/wp-admin/edit-comments.php b/src/wp-admin/edit-comments.php
index 85c04ead57..dcd0509008 100644
a
|
b
|
|
333 | 333 | <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
334 | 334 | |
335 | 335 | <?php if ( $post_id ) : ?> |
336 | | <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
| 336 | <input type="hidden" name="p" value="<?php echo esc_attr( (int) $post_id ); ?>" /> |
337 | 337 | <?php endif; ?> |
338 | 338 | <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" /> |
339 | 339 | <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 8ced5d335a..ca302a17a8 100644
a
|
b
|
function wp_ajax_wp_compression_test() { |
221 | 221 | * @since 3.1.0 |
222 | 222 | */ |
223 | 223 | function wp_ajax_imgedit_preview() { |
224 | | $post_id = intval( $_GET['postid'] ); |
| 224 | $post_id = (int) $_GET['postid']; |
225 | 225 | if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { |
226 | 226 | wp_die( -1 ); |
227 | 227 | } |
… |
… |
function wp_ajax_menu_quick_search() { |
1824 | 1824 | */ |
1825 | 1825 | function wp_ajax_get_permalink() { |
1826 | 1826 | check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); |
1827 | | $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0; |
| 1827 | $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; |
1828 | 1828 | wp_die( get_preview_post_link( $post_id ) ); |
1829 | 1829 | } |
1830 | 1830 | |
… |
… |
function wp_ajax_get_permalink() { |
1835 | 1835 | */ |
1836 | 1836 | function wp_ajax_sample_permalink() { |
1837 | 1837 | check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); |
1838 | | $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0; |
| 1838 | $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; |
1839 | 1839 | $title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : ''; |
1840 | 1840 | $slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null; |
1841 | 1841 | wp_die( get_sample_permalink_html( $post_id, $title, $slug ) ); |
… |
… |
function wp_ajax_upload_attachment() { |
2374 | 2374 | * @since 3.1.0 |
2375 | 2375 | */ |
2376 | 2376 | function wp_ajax_image_editor() { |
2377 | | $attachment_id = intval( $_POST['postid'] ); |
| 2377 | $attachment_id = (int) $_POST['postid']; |
2378 | 2378 | if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { |
2379 | 2379 | wp_die( -1 ); |
2380 | 2380 | } |
… |
… |
function wp_ajax_image_editor() { |
2409 | 2409 | function wp_ajax_set_post_thumbnail() { |
2410 | 2410 | $json = ! empty( $_REQUEST['json'] ); // New-style request |
2411 | 2411 | |
2412 | | $post_ID = intval( $_POST['post_id'] ); |
| 2412 | $post_ID = (int) $_POST['post_id']; |
2413 | 2413 | if ( ! current_user_can( 'edit_post', $post_ID ) ) { |
2414 | 2414 | wp_die( -1 ); |
2415 | 2415 | } |
2416 | 2416 | |
2417 | | $thumbnail_id = intval( $_POST['thumbnail_id'] ); |
| 2417 | $thumbnail_id = (int) $_POST['thumbnail_id']; |
2418 | 2418 | |
2419 | 2419 | if ( $json ) { |
2420 | 2420 | check_ajax_referer( "update-post_$post_ID" ); |
… |
… |
function wp_ajax_set_post_thumbnail() { |
2445 | 2445 | * @since 4.6.0 |
2446 | 2446 | */ |
2447 | 2447 | function wp_ajax_get_post_thumbnail_html() { |
2448 | | $post_ID = intval( $_POST['post_id'] ); |
| 2448 | $post_ID = (int) $_POST['post_id']; |
2449 | 2449 | |
2450 | 2450 | check_ajax_referer( "update-post_$post_ID" ); |
2451 | 2451 | |
… |
… |
function wp_ajax_get_post_thumbnail_html() { |
2453 | 2453 | wp_die( -1 ); |
2454 | 2454 | } |
2455 | 2455 | |
2456 | | $thumbnail_id = intval( $_POST['thumbnail_id'] ); |
| 2456 | $thumbnail_id = (int) $_POST['thumbnail_id']; |
2457 | 2457 | |
2458 | 2458 | // For backward compatibility, -1 refers to no featured image. |
2459 | 2459 | if ( -1 === $thumbnail_id ) { |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
2938 | 2938 | |
2939 | 2939 | $attachment = wp_unslash( $_POST['attachment'] ); |
2940 | 2940 | |
2941 | | $id = intval( $attachment['id'] ); |
| 2941 | $id = (int) $attachment['id']; |
2942 | 2942 | |
2943 | 2943 | if ( ! $post = get_post( $id ) ) { |
2944 | 2944 | wp_send_json_error(); |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
2950 | 2950 | |
2951 | 2951 | if ( current_user_can( 'edit_post', $id ) ) { |
2952 | 2952 | // If this attachment is unattached, attach it. Primarily a back compat thing. |
2953 | | if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) { |
| 2953 | if ( 0 == $post->post_parent && $insert_into_post_id = (int) $_POST['post_id'] ) { |
2954 | 2954 | wp_update_post( |
2955 | 2955 | array( |
2956 | 2956 | 'ID' => $id, |
… |
… |
function wp_ajax_parse_embed() { |
3315 | 3315 | if ( empty( $_POST['shortcode'] ) ) { |
3316 | 3316 | wp_send_json_error(); |
3317 | 3317 | } |
3318 | | $post_id = isset( $_POST['post_ID'] ) ? intval( $_POST['post_ID'] ) : 0; |
| 3318 | $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; |
3319 | 3319 | if ( $post_id > 0 ) { |
3320 | 3320 | $post = get_post( $post_id ); |
3321 | 3321 | if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { |
… |
… |
function wp_ajax_parse_embed() { |
3364 | 3364 | // Set $content_width so any embeds fit in the destination iframe. |
3365 | 3365 | if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { |
3366 | 3366 | if ( ! isset( $content_width ) ) { |
3367 | | $content_width = intval( $_POST['maxwidth'] ); |
| 3367 | $content_width = (int) $_POST['maxwidth']; |
3368 | 3368 | } else { |
3369 | | $content_width = min( $content_width, intval( $_POST['maxwidth'] ) ); |
| 3369 | $content_width = min( $content_width, (int) $_POST['maxwidth'] ); |
3370 | 3370 | } |
3371 | 3371 | } |
3372 | 3372 | |
-
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 881e9e7192..ec7f855f45 100644
a
|
b
|
public function end_lvl( &$output, $depth = 0, $args = array() ) { |
73 | 73 | public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
74 | 74 | global $_nav_menu_placeholder; |
75 | 75 | |
76 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 76 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
77 | 77 | $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
78 | 78 | $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; |
79 | 79 | |
-
diff --git a/src/wp-admin/includes/class-wp-importer.php b/src/wp-admin/includes/class-wp-importer.php
index e9dc496536..a2e706cb07 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-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php
index 1741d515f8..2770853639 100644
a
|
b
|
public function prepare_items() { |
101 | 101 | } |
102 | 102 | |
103 | 103 | $args = array( |
104 | | 'number' => intval( $per_page ), |
105 | | 'offset' => intval( ( $pagenum - 1 ) * $per_page ), |
| 104 | 'number' => (int) $per_page, |
| 105 | 'offset' => (int) ( $pagenum - 1 ) * $per_page, |
106 | 106 | 'network_id' => get_current_network_id(), |
107 | 107 | ); |
108 | 108 | |
-
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 ea6969f51c..99f974ff65 100644
a
|
b
|
public function __construct( $args = array() ) { |
54 | 54 | $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false; |
55 | 55 | |
56 | 56 | if ( $this->is_site_themes ) { |
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/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index f642efad1c..3c86e01932 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( |
94 | | $wpdb->prepare( |
95 | | " |
96 | | SELECT COUNT( 1 ) |
97 | | FROM $wpdb->posts |
98 | | WHERE post_type = %s |
99 | | AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
100 | | AND post_author = %d |
101 | | ", $post_type, get_current_user_id() |
102 | | ) |
| 92 | $this->user_posts_count = (int) $wpdb->get_var( |
| 93 | $wpdb->prepare( |
| 94 | " |
| 95 | SELECT COUNT( 1 ) |
| 96 | FROM $wpdb->posts |
| 97 | WHERE post_type = %s |
| 98 | AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
| 99 | AND post_author = %d |
| 100 | ", $post_type, get_current_user_id() |
103 | 101 | ) |
104 | 102 | ); |
105 | 103 | |
-
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 90e244208c..a98d13d977 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 0da446d491..71bdde9d0f 100644
a
|
b
|
function wp_dashboard_recent_posts( $args ) { |
827 | 827 | 'post_status' => $args['status'], |
828 | 828 | 'orderby' => 'date', |
829 | 829 | 'order' => $args['order'], |
830 | | 'posts_per_page' => intval( $args['max'] ), |
| 830 | 'posts_per_page' => (int) $args['max'], |
831 | 831 | 'no_found_rows' => true, |
832 | 832 | 'cache_results' => false, |
833 | 833 | 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable', |
-
diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php
index e60eed04ea..084468e3fe 100644
a
|
b
|
function wxr_authors_list( array $post_ids = null ) { |
362 | 362 | |
363 | 363 | foreach ( $authors as $author ) { |
364 | 364 | echo "\t<wp:author>"; |
365 | | echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>'; |
| 365 | echo '<wp:author_id>' . (int) $author->ID . '</wp:author_id>'; |
366 | 366 | echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>'; |
367 | 367 | echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>'; |
368 | 368 | echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; |
… |
… |
function wxr_nav_menu_terms() { |
385 | 385 | |
386 | 386 | foreach ( $nav_menus as $menu ) { |
387 | 387 | echo "\t<wp:term>"; |
388 | | echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>'; |
| 388 | echo '<wp:term_id>' . (int) $menu->term_id . '</wp:term_id>'; |
389 | 389 | echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>'; |
390 | 390 | echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>'; |
391 | 391 | wxr_term_name( $menu ); |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
468 | 468 | |
469 | 469 | <?php foreach ( $cats as $c ) : ?> |
470 | 470 | <wp:category> |
471 | | <wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id> |
| 471 | <wp:term_id><?php echo (int) $c->term_id; ?></wp:term_id> |
472 | 472 | <wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename> |
473 | 473 | <wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[ $c->parent ]->slug : '' ); ?></wp:category_parent> |
474 | 474 | <?php |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
480 | 480 | <?php endforeach; ?> |
481 | 481 | <?php foreach ( $tags as $t ) : ?> |
482 | 482 | <wp:tag> |
483 | | <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> |
| 483 | <wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id> |
484 | 484 | <wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug> |
485 | 485 | <?php |
486 | 486 | wxr_tag_name( $t ); |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
568 | 568 | echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); |
569 | 569 | ?> |
570 | 570 | </excerpt:encoded> |
571 | | <wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id> |
| 571 | <wp:post_id><?php echo (int) $post->ID; ?></wp:post_id> |
572 | 572 | <wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date> |
573 | 573 | <wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt> |
574 | 574 | <wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status> |
575 | 575 | <wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status> |
576 | 576 | <wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name> |
577 | 577 | <wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status> |
578 | | <wp:post_parent><?php echo intval( $post->post_parent ); ?></wp:post_parent> |
579 | | <wp:menu_order><?php echo intval( $post->menu_order ); ?></wp:menu_order> |
| 578 | <wp:post_parent><?php echo (int) $post->post_parent; ?></wp:post_parent> |
| 579 | <wp:menu_order><?php echo (int) $post->menu_order; ?></wp:menu_order> |
580 | 580 | <wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type> |
581 | 581 | <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password> |
582 | | <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky> |
| 582 | <wp:is_sticky><?php echo (int) $is_sticky; ?></wp:is_sticky> |
583 | 583 | <?php if ( $post->post_type == 'attachment' ) : ?> |
584 | 584 | <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url> |
585 | 585 | <?php endif; ?> |
… |
… |
function wxr_filter_postmeta( $return_me, $meta_key ) { |
615 | 615 | foreach ( $comments as $c ) : |
616 | 616 | ?> |
617 | 617 | <wp:comment> |
618 | | <wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id> |
| 618 | <wp:comment_id><?php echo (int) $c->comment_ID; ?></wp:comment_id> |
619 | 619 | <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author> |
620 | 620 | <wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email> |
621 | 621 | <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 ) { |
625 | 625 | <wp:comment_content><?php echo wxr_cdata( $c->comment_content ); ?></wp:comment_content> |
626 | 626 | <wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved> |
627 | 627 | <wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type> |
628 | | <wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent> |
629 | | <wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id> |
| 628 | <wp:comment_parent><?php echo (int) $c->comment_parent; ?></wp:comment_parent> |
| 629 | <wp:comment_user_id><?php echo (int) $c->user_id; ?></wp:comment_user_id> |
630 | 630 | <?php |
631 | 631 | $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); |
632 | 632 | foreach ( $c_meta as $meta ) : |
-
diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
index 4c42c5be3e..41e0701dff 100644
a
|
b
|
function wp_edit_theme_plugin_file( $args ) { |
495 | 495 | |
496 | 496 | $scrape_key = md5( rand() ); |
497 | 497 | $transient = 'scrape_key_' . $scrape_key; |
498 | | $scrape_nonce = strval( rand() ); |
| 498 | $scrape_nonce = (string) rand(); |
499 | 499 | set_transient( $transient, $scrape_nonce, 60 ); // It shouldn't take more than 60 seconds to make the two loopback requests. |
500 | 500 | |
501 | 501 | $cookies = wp_unslash( $_COOKIE ); |
-
diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php
index 4be465d3db..8fb65d10d4 100644
a
|
b
|
function wp_save_image( $post_id ) { |
749 | 749 | return $return; |
750 | 750 | } |
751 | 751 | |
752 | | $fwidth = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0; |
753 | | $fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0; |
| 752 | $fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0; |
| 753 | $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0; |
754 | 754 | $target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : ''; |
755 | 755 | $scale = ! empty( $_REQUEST['do'] ) && 'scale' == $_REQUEST['do']; |
756 | 756 | |
… |
… |
function wp_save_image( $post_id ) { |
905 | 905 | } |
906 | 906 | |
907 | 907 | if ( isset( $_wp_additional_image_sizes[ $size ] ) ) { |
908 | | $width = intval( $_wp_additional_image_sizes[ $size ]['width'] ); |
909 | | $height = intval( $_wp_additional_image_sizes[ $size ]['height'] ); |
| 908 | $width = (int) $_wp_additional_image_sizes[ $size ]['width']; |
| 909 | $height = (int) $_wp_additional_image_sizes[ $size ]['height']; |
910 | 910 | $crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop']; |
911 | 911 | } else { |
912 | 912 | $height = get_option( "{$size}_size_h" ); |
-
diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php
index 4b66a5d36f..d75b3e9848 100644
a
|
b
|
function wp_generate_attachment_metadata( $attachment_id, $file ) { |
102 | 102 | ); |
103 | 103 | if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) { |
104 | 104 | // For theme-added sizes |
105 | | $sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] ); |
| 105 | $sizes[ $s ]['width'] = (int) $_wp_additional_image_sizes[ $s ]['width']; |
106 | 106 | } else { |
107 | 107 | // For default sizes set in options |
108 | 108 | $sizes[ $s ]['width'] = get_option( "{$s}_size_w" ); |
… |
… |
function wp_generate_attachment_metadata( $attachment_id, $file ) { |
110 | 110 | |
111 | 111 | if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) { |
112 | 112 | // For theme-added sizes |
113 | | $sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] ); |
| 113 | $sizes[ $s ]['height'] = (int) $_wp_additional_image_sizes[ $s ]['height']; |
114 | 114 | } else { |
115 | 115 | // For default sizes set in options |
116 | 116 | $sizes[ $s ]['height'] = get_option( "{$s}_size_h" ); |
… |
… |
function wp_generate_attachment_metadata( $attachment_id, $file ) { |
238 | 238 | |
239 | 239 | foreach ( $fallback_sizes as $s ) { |
240 | 240 | if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) { |
241 | | $sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] ); |
| 241 | $sizes[ $s ]['width'] = (int) $_wp_additional_image_sizes[ $s ]['width']; |
242 | 242 | } else { |
243 | 243 | $sizes[ $s ]['width'] = get_option( "{$s}_size_w" ); |
244 | 244 | } |
245 | 245 | |
246 | 246 | if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) { |
247 | | $sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] ); |
| 247 | $sizes[ $s ]['height'] = (int) $_wp_additional_image_sizes[ $s ]['height']; |
248 | 248 | } else { |
249 | 249 | $sizes[ $s ]['height'] = get_option( "{$s}_size_h" ); |
250 | 250 | } |
-
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 03e949f16f..28418f5615 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 |
135 | 135 | if ( is_string( $rel ) ) { |
136 | 136 | $rel = ' rel="' . esc_attr( $rel ) . '"'; |
137 | 137 | } else { |
138 | | $rel = ' rel="attachment wp-att-' . intval( $id ) . '"'; |
| 138 | $rel = ' rel="attachment wp-att-' . (int) $id . '"'; |
139 | 139 | } |
140 | 140 | } else { |
141 | 141 | $rel = ''; |
… |
… |
function get_media_items( $post_id, $errors ) { |
1458 | 1458 | function get_media_item( $attachment_id, $args = null ) { |
1459 | 1459 | global $redir_tab; |
1460 | 1460 | |
1461 | | if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) { |
| 1461 | if ( ( $attachment_id = (int) $attachment_id ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) { |
1462 | 1462 | $thumb_url = $thumb_url[0]; |
1463 | 1463 | } else { |
1464 | 1464 | $thumb_url = false; |
… |
… |
function get_compat_media_markup( $attachment_id, $args = null ) { |
1906 | 1906 | * @since 2.5.0 |
1907 | 1907 | */ |
1908 | 1908 | function media_upload_header() { |
1909 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 1909 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
1910 | 1910 | |
1911 | 1911 | echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>'; |
1912 | 1912 | if ( empty( $_GET['chromeless'] ) ) { |
… |
… |
function media_upload_form( $errors = null ) { |
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | $upload_action_url = admin_url( 'async-upload.php' ); |
1940 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 1940 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
1941 | 1941 | $_type = isset( $type ) ? $type : ''; |
1942 | 1942 | $_tab = isset( $tab ) ? $tab : ''; |
1943 | 1943 | |
… |
… |
function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { |
2132 | 2132 | |
2133 | 2133 | media_upload_header(); |
2134 | 2134 | |
2135 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2135 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2136 | 2136 | |
2137 | 2137 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2138 | 2138 | |
… |
… |
function media_upload_type_url_form( $type = null, $errors = null, $id = null ) |
2208 | 2208 | |
2209 | 2209 | media_upload_header(); |
2210 | 2210 | |
2211 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2211 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2212 | 2212 | |
2213 | 2213 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2214 | 2214 | /** This filter is documented in wp-admin/includes/media.php */ |
… |
… |
function media_upload_gallery_form( $errors ) { |
2353 | 2353 | $redir_tab = 'gallery'; |
2354 | 2354 | media_upload_header(); |
2355 | 2355 | |
2356 | | $post_id = intval( $_REQUEST['post_id'] ); |
| 2356 | $post_id = (int) $_REQUEST['post_id']; |
2357 | 2357 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" ); |
2358 | 2358 | /** This filter is documented in wp-admin/includes/media.php */ |
2359 | 2359 | $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
… |
… |
function media_upload_library_form( $errors ) { |
2512 | 2512 | |
2513 | 2513 | media_upload_header(); |
2514 | 2514 | |
2515 | | $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
| 2515 | $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2516 | 2516 | |
2517 | 2517 | $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" ); |
2518 | 2518 | /** This filter is documented in wp-admin/includes/media.php */ |
… |
… |
function media_upload_library_form( $errors ) { |
2525 | 2525 | |
2526 | 2526 | $q = $_GET; |
2527 | 2527 | $q['posts_per_page'] = 10; |
2528 | | $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0; |
| 2528 | $q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0; |
2529 | 2529 | if ( $q['paged'] < 1 ) { |
2530 | 2530 | $q['paged'] = 1; |
2531 | 2531 | } |
… |
… |
function media_upload_flash_bypass() { |
2825 | 2825 | $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); |
2826 | 2826 | |
2827 | 2827 | if ( $post = get_post() ) { |
2828 | | $browser_uploader .= '&post_id=' . intval( $post->ID ); |
| 2828 | $browser_uploader .= '&post_id=' . (int) $post->ID; |
2829 | 2829 | } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { |
2830 | | $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); |
| 2830 | $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID']; |
2831 | 2831 | } |
2832 | 2832 | |
2833 | 2833 | ?> |
… |
… |
function edit_form_image_editor( $post ) { |
2904 | 2904 | } |
2905 | 2905 | |
2906 | 2906 | $thumb_url = false; |
2907 | | if ( $attachment_id = intval( $post->ID ) ) { |
| 2907 | if ( $attachment_id = (int) $post->ID ) { |
2908 | 2908 | $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); |
2909 | 2909 | } |
2910 | 2910 | |
-
diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index 74209af075..0ac66f7913 100644
a
|
b
|
function wp_nav_menu_item_post_type_meta_box( $object, $box ) { |
540 | 540 | $front_page_obj->front_or_home = true; |
541 | 541 | array_unshift( $posts, $front_page_obj ); |
542 | 542 | } else { |
543 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 543 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
544 | 544 | array_unshift( |
545 | 545 | $posts, (object) array( |
546 | 546 | 'front_or_home' => true, |
… |
… |
function wp_nav_menu_item_post_type_meta_box( $object, $box ) { |
561 | 561 | $post_type = get_post_type_object( $post_type_name ); |
562 | 562 | |
563 | 563 | if ( $post_type->has_archive ) { |
564 | | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; |
| 564 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; |
565 | 565 | array_unshift( |
566 | 566 | $posts, (object) array( |
567 | 567 | 'ID' => 0, |
-
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 727269e51e..3408686f4d 100644
a
|
b
|
function post_preview() { |
1848 | 1848 | } |
1849 | 1849 | |
1850 | 1850 | if ( isset( $_POST['_thumbnail_id'] ) ) { |
1851 | | $query_args['_thumbnail_id'] = ( intval( $_POST['_thumbnail_id'] ) <= 0 ) ? '-1' : intval( $_POST['_thumbnail_id'] ); |
| 1851 | $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; |
1852 | 1852 | } |
1853 | 1853 | } |
1854 | 1854 | |
… |
… |
function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { |
2001 | 2001 | ); |
2002 | 2002 | |
2003 | 2003 | if ( ! empty( $_term ) ) { |
2004 | | $clean_terms[] = intval( $_term[0] ); |
| 2004 | $clean_terms[] = (int) $_term[0]; |
2005 | 2005 | } else { |
2006 | 2006 | // No existing term was found, so pass the string. A new term will be created. |
2007 | 2007 | $clean_terms[] = $term; |
-
diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
index edba6973a0..ee2813f1c4 100644
a
|
b
|
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
1118 | 1118 | 'siteurl' => get_option( 'siteurl' ) . '/', |
1119 | 1119 | 'add_new_users' => '0', |
1120 | 1120 | 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
1121 | | 'subdomain_install' => intval( $subdomain_install ), |
| 1121 | 'subdomain_install' => (int) $subdomain_install, |
1122 | 1122 | 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
1123 | 1123 | 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
1124 | 1124 | 'initial_db_version' => get_option( 'initial_db_version' ), |
-
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index 9078a224fd..9861ce288a 100644
a
|
b
|
function _post_states( $post ) { |
1870 | 1870 | } |
1871 | 1871 | |
1872 | 1872 | if ( 'page' === get_option( 'show_on_front' ) ) { |
1873 | | if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) { |
| 1873 | if ( (int) get_option( 'page_on_front' ) === $post->ID ) { |
1874 | 1874 | $post_states['page_on_front'] = __( 'Front Page' ); |
1875 | 1875 | } |
1876 | 1876 | |
1877 | | if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) { |
| 1877 | if ( (int) get_option( 'page_for_posts' ) === $post->ID ) { |
1878 | 1878 | $post_states['page_for_posts'] = __( 'Posts Page' ); |
1879 | 1879 | } |
1880 | 1880 | } |
-
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index 7ab369dc7b..bbdbc7d709 100644
a
|
b
|
function upgrade_110() { |
869 | 869 | if ( ! $got_gmt_fields ) { |
870 | 870 | |
871 | 871 | // Add or subtract time to all dates, to get GMT dates |
872 | | $add_hours = intval( $diff_gmt_weblogger ); |
873 | | $add_minutes = intval( 60 * ( $diff_gmt_weblogger - $add_hours ) ); |
| 872 | $add_hours = (int) $diff_gmt_weblogger; |
| 873 | $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) ); |
874 | 874 | $wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); |
875 | 875 | $wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" ); |
876 | 876 | $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() { |
1879 | 1879 | return; |
1880 | 1880 | } |
1881 | 1881 | |
1882 | | $allowed_length = intval( $content_length['length'] ) - 10; |
| 1882 | $allowed_length = (int) $content_length['length'] - 10; |
1883 | 1883 | |
1884 | 1884 | $comments = $wpdb->get_results( |
1885 | 1885 | "SELECT `comment_ID` FROM `{$wpdb->comments}` |
-
diff --git a/src/wp-admin/media-upload.php b/src/wp-admin/media-upload.php
index 7b0bd53806..bd7165ad78 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 c73a05878a..53573e1e12 100644
a
|
b
|
|
380 | 380 | |
381 | 381 | // If the menu ID changed, redirect to the new URL. |
382 | 382 | if ( $nav_menu_selected_id != $_nav_menu_selected_id ) { |
383 | | wp_redirect( admin_url( 'nav-menus.php?menu=' . intval( $_nav_menu_selected_id ) ) ); |
| 383 | wp_redirect( admin_url( 'nav-menus.php?menu=' . (int) $_nav_menu_selected_id ) ); |
384 | 384 | exit(); |
385 | 385 | } |
386 | 386 | } |
-
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php
index 83e05ae867..d636f696c6 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 488a541abc..cc7ad1134c 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 497de2aa98..d4d7ce9e3f 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 d1a125b844..72f7370da1 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 b5b55bded5..20575824d7 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 3cc16a1721..c826c3748d 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 3ae8f6f1b6..c27dd15d60 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 != '0' && $id != '1' ) { |
31 | 31 | $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays |
32 | 32 | $title = __( 'Users' ); |
-
diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php
index ac47c392c4..66873ff0a7 100644
a
|
b
|
|
228 | 228 | } |
229 | 229 | |
230 | 230 | if ( empty( $_REQUEST['users'] ) ) { |
231 | | $userids = array( intval( $_REQUEST['user'] ) ); |
| 231 | $userids = array( (int) $_REQUEST['user'] ); |
232 | 232 | } else { |
233 | 233 | $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
234 | 234 | } |
… |
… |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | if ( empty( $_REQUEST['users'] ) ) { |
384 | | $userids = array( intval( $_REQUEST['user'] ) ); |
| 384 | $userids = array( (int) $_REQUEST['user'] ); |
385 | 385 | } else { |
386 | 386 | $userids = $_REQUEST['users']; |
387 | 387 | } |
-
diff --git a/src/wp-comments-post.php b/src/wp-comments-post.php
index 39bc5a81cf..14a70023d4 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>', __( 'Comment Submission Failure' ), array( |
-
diff --git a/src/wp-content/themes/twentyfourteen/inc/template-tags.php b/src/wp-content/themes/twentyfourteen/inc/template-tags.php
index 893933164f..448ae22d23 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 b0de276df4..d229a02428 100644
a
|
b
|
function get_bookmarks( $args = '' ) { |
175 | 175 | if ( count( $inclinks ) ) { |
176 | 176 | foreach ( $inclinks as $inclink ) { |
177 | 177 | if ( empty( $inclusions ) ) { |
178 | | $inclusions = ' AND ( link_id = ' . intval( $inclink ) . ' '; |
| 178 | $inclusions = ' AND ( link_id = ' . (int) $inclink . ' '; |
179 | 179 | } else { |
180 | | $inclusions .= ' OR link_id = ' . intval( $inclink ) . ' '; |
| 180 | $inclusions .= ' OR link_id = ' . (int) $inclink . ' '; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
… |
… |
function get_bookmarks( $args = '' ) { |
192 | 192 | if ( count( $exlinks ) ) { |
193 | 193 | foreach ( $exlinks as $exlink ) { |
194 | 194 | if ( empty( $exclusions ) ) { |
195 | | $exclusions = ' AND ( link_id <> ' . intval( $exlink ) . ' '; |
| 195 | $exclusions = ' AND ( link_id <> ' . (int) $exlink . ' '; |
196 | 196 | } else { |
197 | | $exclusions .= ' AND link_id <> ' . intval( $exlink ) . ' '; |
| 197 | $exclusions .= ' AND link_id <> ' . (int) $exlink . ' '; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
… |
… |
function get_bookmarks( $args = '' ) { |
227 | 227 | if ( count( $incategories ) ) { |
228 | 228 | foreach ( $incategories as $incat ) { |
229 | 229 | if ( empty( $category_query ) ) { |
230 | | $category_query = ' AND ( tt.term_id = ' . intval( $incat ) . ' '; |
| 230 | $category_query = ' AND ( tt.term_id = ' . (int) $incat . ' '; |
231 | 231 | } else { |
232 | | $category_query .= ' OR tt.term_id = ' . intval( $incat ) . ' '; |
| 232 | $category_query .= ' OR tt.term_id = ' . (int) $incat . ' '; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | } |
-
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index 671d9bfeae..ce5b2cf9fc 100644
a
|
b
|
function wp_dropdown_categories( $args = '' ) { |
416 | 416 | |
417 | 417 | /** This filter is documented in wp-includes/category-template.php */ |
418 | 418 | $show_option_all = apply_filters( 'list_cats', $r['show_option_all'], null ); |
419 | | $selected = ( '0' === strval( $r['selected'] ) ) ? " selected='selected'" : ''; |
| 419 | $selected = ( '0' === (string) $r['selected'] ) ? " selected='selected'" : ''; |
420 | 420 | $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; |
421 | 421 | } |
422 | 422 | |
… |
… |
function wp_tag_cloud( $args = '' ) { |
723 | 723 | if ( 'edit' == $args['link'] ) { |
724 | 724 | $link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] ); |
725 | 725 | } else { |
726 | | $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy ); |
| 726 | $link = get_term_link( (int) $tag->term_id, $tag->taxonomy ); |
727 | 727 | } |
728 | 728 | if ( is_wp_error( $link ) ) { |
729 | 729 | return; |
-
diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
index bead194a4a..ceaee1f1a5 100644
a
|
b
|
public static function processHeaders( $headers, $url = '' ) { |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Cast the Response Code to an int |
728 | | $response['code'] = intval( $response['code'] ); |
| 728 | $response['code'] = (int) $response['code']; |
729 | 729 | |
730 | 730 | return array( |
731 | 731 | 'response' => $response, |
-
diff --git a/src/wp-includes/class-json.php b/src/wp-includes/class-json.php
index 7f34d3fcab..3d28777f2d 100644
a
|
b
|
function name_value($name, $value) |
545 | 545 | return $encoded_value; |
546 | 546 | } |
547 | 547 | |
548 | | return $this->_encode(strval($name)) . ':' . $encoded_value; |
| 548 | return $this->_encode( (string) $name ) . ':' . $encoded_value; |
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
-
diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
index 34255953f5..e2dbb268f7 100644
a
|
b
|
public function get_comments() { |
414 | 414 | // If querying for a count only, there's nothing more to do. |
415 | 415 | if ( $this->query_vars['count'] ) { |
416 | 416 | // $comment_ids is actually a count in this case. |
417 | | return intval( $comment_ids ); |
| 417 | return (int) $comment_ids; |
418 | 418 | } |
419 | 419 | |
420 | 420 | $comment_ids = array_map( 'intval', $comment_ids ); |
… |
… |
protected function get_comment_ids() { |
889 | 889 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
890 | 890 | |
891 | 891 | if ( $this->query_vars['count'] ) { |
892 | | return intval( $wpdb->get_var( $this->request ) ); |
| 892 | return (int) $wpdb->get_var( $this->request ); |
893 | 893 | } else { |
894 | 894 | $comment_ids = $wpdb->get_col( $this->request ); |
895 | 895 | 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 fe22d87a06..378adf67ed 100644
a
|
b
|
function import_theme_starter_content( $starter_content = array() ) { |
1457 | 1457 | preg_match( '#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches ) |
1458 | 1458 | ); |
1459 | 1459 | if ( $can_reuse ) { |
1460 | | $nav_menu_term_id = intval( $matches['nav_menu_id'] ); |
| 1460 | $nav_menu_term_id = (int) $matches['nav_menu_id']; |
1461 | 1461 | $nav_menu_setting_id = $setting_id; |
1462 | 1462 | $reused_nav_menu_setting_ids[] = $setting_id; |
1463 | 1463 | break; |
… |
… |
public function refresh_changeset_lock( $changeset_post_id ) { |
3141 | 3141 | $lock = explode( ':', $lock ); |
3142 | 3142 | |
3143 | 3143 | if ( $lock && ! empty( $lock[1] ) ) { |
3144 | | $user_id = intval( $lock[1] ); |
| 3144 | $user_id = (int) $lock[1]; |
3145 | 3145 | $current_user_id = get_current_user_id(); |
3146 | 3146 | if ( $user_id === $current_user_id ) { |
3147 | 3147 | $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 9529ce78a3..fcdf0791c6 100644
a
|
b
|
public function load_available_items_query( $type = 'post_type', $object = 'page |
203 | 203 | 'type' => 'post_type', |
204 | 204 | 'type_label' => get_post_type_object( $post->post_type )->labels->singular_name, |
205 | 205 | 'object' => $post->post_type, |
206 | | 'object_id' => intval( $post->ID ), |
207 | | 'url' => get_permalink( intval( $post->ID ) ), |
| 206 | 'object_id' => (int) $post->ID, |
| 207 | 'url' => get_permalink( (int) $post->ID ), |
208 | 208 | ); |
209 | 209 | } |
210 | 210 | } elseif ( 'taxonomy' === $type ) { |
… |
… |
public function load_available_items_query( $type = 'post_type', $object = 'page |
233 | 233 | 'type' => 'taxonomy', |
234 | 234 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
235 | 235 | 'object' => $term->taxonomy, |
236 | | 'object_id' => intval( $term->term_id ), |
237 | | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 236 | 'object_id' => (int) $term->term_id, |
| 237 | 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ), |
238 | 238 | ); |
239 | 239 | } |
240 | 240 | } |
… |
… |
public function search_available_items_query( $args = array() ) { |
355 | 355 | 'type' => 'post_type', |
356 | 356 | 'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name, |
357 | 357 | 'object' => $post->post_type, |
358 | | 'object_id' => intval( $post->ID ), |
359 | | 'url' => get_permalink( intval( $post->ID ) ), |
| 358 | 'object_id' => (int) $post->ID, |
| 359 | 'url' => get_permalink( (int) $post->ID ), |
360 | 360 | ); |
361 | 361 | } |
362 | 362 | |
… |
… |
public function search_available_items_query( $args = array() ) { |
379 | 379 | 'type' => 'taxonomy', |
380 | 380 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
381 | 381 | 'object' => $term->taxonomy, |
382 | | 'object_id' => intval( $term->term_id ), |
383 | | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 382 | 'object_id' => (int) $term->term_id, |
| 383 | 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ), |
384 | 384 | ); |
385 | 385 | } |
386 | 386 | } |
-
diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php
index 5b2b04c78e..ea88c3627e 100644
a
|
b
|
public function parse_widget_id( $widget_id ) { |
601 | 601 | |
602 | 602 | if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) { |
603 | 603 | $parsed['id_base'] = $matches[1]; |
604 | | $parsed['number'] = intval( $matches[2] ); |
| 604 | $parsed['number'] = (int) $matches[2]; |
605 | 605 | } else { |
606 | 606 | // likely an old single widget |
607 | 607 | $parsed['id_base'] = $widget_id; |
… |
… |
public function parse_widget_setting_id( $setting_id ) { |
624 | 624 | } |
625 | 625 | |
626 | 626 | $id_base = $matches[2]; |
627 | | $number = isset( $matches[3] ) ? intval( $matches[3] ) : null; |
| 627 | $number = isset( $matches[3] ) ? (int) $matches[3] : null; |
628 | 628 | |
629 | 629 | return compact( 'id_base', 'number' ); |
630 | 630 | } |
… |
… |
public function start_dynamic_sidebar( $index ) { |
1752 | 1752 | } |
1753 | 1753 | $this->sidebar_instance_count[ $index ] += 1; |
1754 | 1754 | if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { |
1755 | | printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) ); |
| 1755 | printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] ); |
1756 | 1756 | } |
1757 | 1757 | } |
1758 | 1758 | |
… |
… |
public function start_dynamic_sidebar( $index ) { |
1768 | 1768 | public function end_dynamic_sidebar( $index ) { |
1769 | 1769 | array_shift( $this->current_dynamic_sidebar_id_stack ); |
1770 | 1770 | if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { |
1771 | | printf( "\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) ); |
| 1771 | printf( "\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] ); |
1772 | 1772 | } |
1773 | 1773 | } |
1774 | 1774 | |
… |
… |
public function render_widget_partial( $partial, $context ) { |
1831 | 1831 | $this->rendering_sidebar_id = $context['sidebar_id']; |
1832 | 1832 | |
1833 | 1833 | if ( isset( $context['sidebar_instance_number'] ) ) { |
1834 | | $this->context_sidebar_instance_number = intval( $context['sidebar_instance_number'] ); |
| 1834 | $this->context_sidebar_instance_number = (int) $context['sidebar_instance_number']; |
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | // Filter sidebars_widgets so that only the queried widget is in the sidebar. |
-
diff --git a/src/wp-includes/class-wp-http-curl.php b/src/wp-includes/class-wp-http-curl.php
index 2704735414..246543e3d7 100644
a
|
b
|
public function request( $url, $args = array() ) { |
175 | 175 | curl_setopt( $handle, CURLOPT_HEADER, false ); |
176 | 176 | |
177 | 177 | if ( isset( $r['limit_response_size'] ) ) { |
178 | | $this->max_body_length = intval( $r['limit_response_size'] ); |
| 178 | $this->max_body_length = (int) $r['limit_response_size']; |
179 | 179 | } else { |
180 | 180 | $this->max_body_length = false; |
181 | 181 | } |
-
diff --git a/src/wp-includes/class-wp-matchesmapregex.php b/src/wp-includes/class-wp-matchesmapregex.php
index 935fb6c77d..1536975ee1 100644
a
|
b
|
private function _map() { |
85 | 85 | * @return string |
86 | 86 | */ |
87 | 87 | public function callback( $matches ) { |
88 | | $index = intval( substr( $matches[0], 9, -1 ) ); |
| 88 | $index = (int) substr( $matches[0], 9, -1 ); |
89 | 89 | return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); |
90 | 90 | } |
91 | 91 | } |
-
diff --git a/src/wp-includes/class-wp-network-query.php b/src/wp-includes/class-wp-network-query.php
index a11d6a6c6a..733c8bd5de 100644
a
|
b
|
public function get_networks() { |
232 | 232 | // If querying for a count only, there's nothing more to do. |
233 | 233 | if ( $this->query_vars['count'] ) { |
234 | 234 | // $network_ids is actually a count in this case. |
235 | | return intval( $network_ids ); |
| 235 | return (int) $network_ids; |
236 | 236 | } |
237 | 237 | |
238 | 238 | $network_ids = array_map( 'intval', $network_ids ); |
… |
… |
protected function get_network_ids() { |
437 | 437 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
438 | 438 | |
439 | 439 | if ( $this->query_vars['count'] ) { |
440 | | return intval( $wpdb->get_var( $this->request ) ); |
| 440 | return (int) $wpdb->get_var( $this->request ); |
441 | 441 | } |
442 | 442 | |
443 | 443 | $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 f70c4aee1a..de0e3e07f0 100644
a
|
b
|
public function parse_query( $query = '' ) { |
737 | 737 | $qv['p'] = 0; |
738 | 738 | $qv['error'] = '404'; |
739 | 739 | } else { |
740 | | $qv['p'] = intval( $qv['p'] ); |
| 740 | $qv['p'] = (int) $qv['p']; |
741 | 741 | } |
742 | 742 | |
743 | 743 | $qv['page_id'] = absint( $qv['page_id'] ); |
… |
… |
public function parse_query( $query = '' ) { |
920 | 920 | $this->is_trackback = true; |
921 | 921 | } |
922 | 922 | |
923 | | if ( '' != $qv['paged'] && ( intval( $qv['paged'] ) > 1 ) ) { |
| 923 | if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) { |
924 | 924 | $this->is_paged = true; |
925 | 925 | } |
926 | 926 | |
… |
… |
protected function parse_orderby( $orderby ) { |
1562 | 1562 | // If RAND() contains a seed value, sanitize and add to allowed keys. |
1563 | 1563 | $rand_with_seed = false; |
1564 | 1564 | if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) { |
1565 | | $orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) ); |
| 1565 | $orderby = sprintf( 'RAND(%s)', (int) $matches[1] ); |
1566 | 1566 | $allowed_keys[] = $orderby; |
1567 | 1567 | $rand_with_seed = true; |
1568 | 1568 | } |
… |
… |
public function get_posts() { |
2191 | 2191 | // Numeric comment count is converted to array format. |
2192 | 2192 | if ( is_numeric( $q['comment_count'] ) ) { |
2193 | 2193 | $q['comment_count'] = array( |
2194 | | 'value' => intval( $q['comment_count'] ), |
| 2194 | 'value' => (int) $q['comment_count'], |
2195 | 2195 | ); |
2196 | 2196 | } |
2197 | 2197 | |
-
diff --git a/src/wp-includes/class-wp-site-query.php b/src/wp-includes/class-wp-site-query.php
index 7f347a0b61..4ee44a38d2 100644
a
|
b
|
public function get_sites() { |
275 | 275 | // If querying for a count only, there's nothing more to do. |
276 | 276 | if ( $this->query_vars['count'] ) { |
277 | 277 | // $site_ids is actually a count in this case. |
278 | | return intval( $site_ids ); |
| 278 | return (int) $site_ids; |
279 | 279 | } |
280 | 280 | |
281 | 281 | $site_ids = array_map( 'intval', $site_ids ); |
… |
… |
protected function get_site_ids() { |
570 | 570 | $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}"; |
571 | 571 | |
572 | 572 | if ( $this->query_vars['count'] ) { |
573 | | return intval( $wpdb->get_var( $this->request ) ); |
| 573 | return (int) $wpdb->get_var( $this->request ); |
574 | 574 | } |
575 | 575 | |
576 | 576 | $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 7bd537cef4..899a643ecb 100644
a
|
b
|
public function parse_query( $query = '' ) { |
249 | 249 | $query['offset'] = absint( $query['offset'] ); |
250 | 250 | |
251 | 251 | // 'parent' overrides 'child_of'. |
252 | | if ( 0 < intval( $query['parent'] ) ) { |
| 252 | if ( 0 < (int) $query['parent'] ) { |
253 | 253 | $query['child_of'] = false; |
254 | 254 | } |
255 | 255 | |
… |
… |
public function get_terms() { |
334 | 334 | } |
335 | 335 | |
336 | 336 | // 'parent' overrides 'child_of'. |
337 | | if ( 0 < intval( $args['parent'] ) ) { |
| 337 | if ( 0 < (int) $args['parent'] ) { |
338 | 338 | $args['child_of'] = false; |
339 | 339 | } |
340 | 340 | |
… |
… |
public function get_terms() { |
429 | 429 | $excluded_children, |
430 | 430 | (array) get_terms( |
431 | 431 | reset( $taxonomies ), array( |
432 | | 'child_of' => intval( $extrunk ), |
| 432 | 'child_of' => (int) $extrunk, |
433 | 433 | 'fields' => 'ids', |
434 | 434 | 'hide_empty' => 0, |
435 | 435 | ) |
-
diff --git a/src/wp-includes/class-wp-user.php b/src/wp-includes/class-wp-user.php
index f67780f1f4..9f059bff0b 100644
a
|
b
|
public static function get_data_by( $field, $value ) { |
202 | 202 | if ( ! is_numeric( $value ) ) { |
203 | 203 | return false; |
204 | 204 | } |
205 | | $value = intval( $value ); |
| 205 | $value = (int) $value; |
206 | 206 | if ( $value < 1 ) { |
207 | 207 | return false; |
208 | 208 | } |
… |
… |
public function set_role( $role ) { |
640 | 640 | */ |
641 | 641 | public function level_reduction( $max, $item ) { |
642 | 642 | if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) { |
643 | | $level = intval( $matches[1] ); |
| 643 | $level = (int) $matches[1]; |
644 | 644 | return max( $max, $level ); |
645 | 645 | } else { |
646 | 646 | return $max; |
-
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index c6e6cd8002..e98ecaba1f 100644
a
|
b
|
protected function _prepare_term( $term ) { |
797 | 797 | } |
798 | 798 | |
799 | 799 | // For integers which may be larger than XML-RPC supports ensure we return strings. |
800 | | $_term['term_id'] = strval( $_term['term_id'] ); |
801 | | $_term['term_group'] = strval( $_term['term_group'] ); |
802 | | $_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] ); |
803 | | $_term['parent'] = strval( $_term['parent'] ); |
| 800 | $_term['term_id'] = (string) $_term['term_id']; |
| 801 | $_term['term_group'] = (string) $_term['term_group']; |
| 802 | $_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id']; |
| 803 | $_term['parent'] = (string) $_term['parent']; |
804 | 804 | |
805 | 805 | // Count we are happy to return as an integer because people really shouldn't use terms that much. |
806 | | $_term['count'] = intval( $_term['count'] ); |
| 806 | $_term['count'] = (int) $_term['count']; |
807 | 807 | |
808 | 808 | // Get term meta. |
809 | 809 | $_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] ); |
… |
… |
protected function _convert_date_gmt( $date_gmt, $date ) { |
855 | 855 | */ |
856 | 856 | protected function _prepare_post( $post, $fields ) { |
857 | 857 | // Holds the data for this post. built up based on $fields. |
858 | | $_post = array( 'post_id' => strval( $post['ID'] ) ); |
| 858 | $_post = array( 'post_id' => (string) $post['ID'] ); |
859 | 859 | |
860 | 860 | // Prepare common post fields. |
861 | 861 | $post_fields = array( |
… |
… |
protected function _prepare_post( $post, $fields ) { |
871 | 871 | 'post_password' => $post['post_password'], |
872 | 872 | 'post_excerpt' => $post['post_excerpt'], |
873 | 873 | 'post_content' => $post['post_content'], |
874 | | 'post_parent' => strval( $post['post_parent'] ), |
| 874 | 'post_parent' => (string) $post['post_parent'], |
875 | 875 | 'post_mime_type' => $post['post_mime_type'], |
876 | 876 | 'link' => get_permalink( $post['ID'] ), |
877 | 877 | 'guid' => $post['guid'], |
878 | | 'menu_order' => intval( $post['menu_order'] ), |
| 878 | 'menu_order' => (int) $post['menu_order'], |
879 | 879 | 'comment_status' => $post['comment_status'], |
880 | 880 | 'ping_status' => $post['ping_status'], |
881 | 881 | 'sticky' => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ), |
… |
… |
protected function _prepare_post_type( $post_type, $fields ) { |
1008 | 1008 | */ |
1009 | 1009 | protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) { |
1010 | 1010 | $_media_item = array( |
1011 | | 'attachment_id' => strval( $media_item->ID ), |
| 1011 | 'attachment_id' => (string) $media_item->ID, |
1012 | 1012 | 'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ), |
1013 | 1013 | 'parent' => $media_item->post_parent, |
1014 | 1014 | 'link' => wp_get_attachment_url( $media_item->ID ), |
… |
… |
protected function _prepare_comment( $comment ) { |
1173 | 1173 | * @return array The prepared user data. |
1174 | 1174 | */ |
1175 | 1175 | protected function _prepare_user( $user, $fields ) { |
1176 | | $_user = array( 'user_id' => strval( $user->ID ) ); |
| 1176 | $_user = array( 'user_id' => (string) $user->ID ); |
1177 | 1177 | |
1178 | 1178 | $user_fields = array( |
1179 | 1179 | 'username' => $user->user_login, |
… |
… |
protected function _insert_post( $user, $content_struct ) { |
1637 | 1637 | return new IXR_Error( 401, __( 'Sorry, your entry could not be posted.' ) ); |
1638 | 1638 | } |
1639 | 1639 | |
1640 | | return strval( $post_ID ); |
| 1640 | return (string) $post_ID; |
1641 | 1641 | } |
1642 | 1642 | |
1643 | 1643 | /** |
… |
… |
public function wp_newTerm( $args ) { |
2069 | 2069 | $this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] ); |
2070 | 2070 | } |
2071 | 2071 | |
2072 | | return strval( $term['term_id'] ); |
| 2072 | return (string) $term['term_id']; |
2073 | 2073 | } |
2074 | 2074 | |
2075 | 2075 | /** |
… |
… |
public function mw_newPost( $args ) { |
5478 | 5478 | */ |
5479 | 5479 | do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); |
5480 | 5480 | |
5481 | | return strval( $post_ID ); |
| 5481 | return (string) $post_ID; |
5482 | 5482 | } |
5483 | 5483 | |
5484 | 5484 | /** |
… |
… |
public function mt_getPostCategories( $args ) { |
6445 | 6445 | do_action( 'xmlrpc_call', 'mt.getPostCategories' ); |
6446 | 6446 | |
6447 | 6447 | $categories = array(); |
6448 | | $catids = wp_get_post_categories( intval( $post_ID ) ); |
| 6448 | $catids = wp_get_post_categories( (int) $post_ID ); |
6449 | 6449 | // first listed category will be the primary category |
6450 | 6450 | $isPrimary = true; |
6451 | 6451 | foreach ( $catids as $catid ) { |
… |
… |
public function pingback_ping( $args ) { |
6697 | 6697 | $post_ID = (int) $blah[1]; |
6698 | 6698 | } elseif ( isset( $urltest['fragment'] ) ) { |
6699 | 6699 | // an #anchor is there, it's either... |
6700 | | if ( intval( $urltest['fragment'] ) ) { |
| 6700 | if ( (int) $urltest['fragment'] ) { |
6701 | 6701 | // ...an integer #XXXX (simplest case) |
6702 | 6702 | $post_ID = (int) $urltest['fragment']; |
6703 | 6703 | } 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 3b7a46c8cb..73e7682a5f 100644
a
|
b
|
function wp_list_comments( $args = array(), $comments = null ) { |
2133 | 2133 | } |
2134 | 2134 | } |
2135 | 2135 | // Validation check |
2136 | | $r['page'] = intval( $r['page'] ); |
| 2136 | $r['page'] = (int) $r['page']; |
2137 | 2137 | if ( 0 == $r['page'] && 0 != $r['per_page'] ) { |
2138 | 2138 | $r['page'] = 1; |
2139 | 2139 | } |
-
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index c134aadcd0..186f659292 100644
a
|
b
|
function wp_get_comment_fields_max_lengths() { |
1149 | 1149 | |
1150 | 1150 | if ( ! is_array( $col_length ) && (int) $col_length > 0 ) { |
1151 | 1151 | $max_length = (int) $col_length; |
1152 | | } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && intval( $col_length['length'] ) > 0 ) { |
| 1152 | } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) { |
1153 | 1153 | $max_length = (int) $col_length['length']; |
1154 | 1154 | |
1155 | 1155 | 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 11c5b67cb9..a58cded5ec 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() { |
236 | 236 | $timezone_info['description'] = ''; |
237 | 237 | } |
238 | 238 | } else { |
239 | | $formatted_gmt_offset = $this->format_gmt_offset( intval( get_option( 'gmt_offset', 0 ) ) ); |
| 239 | $formatted_gmt_offset = $this->format_gmt_offset( (int) get_option( 'gmt_offset', 0 ) ); |
240 | 240 | $timezone_info['abbr'] = sprintf( 'UTC%s', $formatted_gmt_offset ); |
241 | 241 | |
242 | 242 | /* translators: %s: 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 545c2f6ba0..72ba648a21 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() { |
366 | 366 | |
367 | 367 | foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) { |
368 | 368 | if ( ! is_int( $this->value[ $key ] ) ) { |
369 | | $this->value[ $key ] = intval( $this->value[ $key ] ); |
| 369 | $this->value[ $key ] = (int) $this->value[ $key ]; |
370 | 370 | } |
371 | 371 | } |
372 | 372 | foreach ( array( 'classes', 'xfn' ) as $key ) { |
… |
… |
public function sanitize( $menu_item_value ) { |
679 | 679 | ); |
680 | 680 | $menu_item_value = array_merge( $default, $menu_item_value ); |
681 | 681 | $menu_item_value = wp_array_slice_assoc( $menu_item_value, array_keys( $default ) ); |
682 | | $menu_item_value['position'] = intval( $menu_item_value['position'] ); |
| 682 | $menu_item_value['position'] = (int) $menu_item_value['position']; |
683 | 683 | |
684 | 684 | foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) { |
685 | 685 | // Note we need to allow negative-integer IDs for previewed objects not inserted yet. |
686 | | $menu_item_value[ $key ] = intval( $menu_item_value[ $key ] ); |
| 686 | $menu_item_value[ $key ] = (int) $menu_item_value[ $key ]; |
687 | 687 | } |
688 | 688 | |
689 | 689 | foreach ( array( 'type', 'object', 'target' ) as $key ) { |
… |
… |
protected function update( $value ) { |
793 | 793 | return; |
794 | 794 | } |
795 | 795 | |
796 | | if ( $nav_menu_setting->previous_term_id !== intval( $value['nav_menu_term_id'] ) ) { |
| 796 | if ( $nav_menu_setting->previous_term_id !== (int) $value['nav_menu_term_id'] ) { |
797 | 797 | $this->update_status = 'error'; |
798 | 798 | $this->update_error = new WP_Error( 'unexpected_previous_term_id' ); |
799 | 799 | return; |
… |
… |
protected function update( $value ) { |
819 | 819 | return; |
820 | 820 | } |
821 | 821 | |
822 | | if ( $parent_nav_menu_item_setting->previous_post_id !== intval( $value['menu_item_parent'] ) ) { |
| 822 | if ( $parent_nav_menu_item_setting->previous_post_id !== (int) $value['menu_item_parent'] ) { |
823 | 823 | $this->update_status = 'error'; |
824 | 824 | $this->update_error = new WP_Error( 'unexpected_previous_post_id' ); |
825 | 825 | 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 44c99bacfd..0a60ad3e04 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 ) { |
429 | 429 | |
430 | 430 | $value['name'] = trim( esc_html( $value['name'] ) ); // This sanitization code is used in wp-admin/nav-menus.php. |
431 | 431 | $value['description'] = sanitize_text_field( $value['description'] ); |
432 | | $value['parent'] = max( 0, intval( $value['parent'] ) ); |
| 432 | $value['parent'] = max( 0, (int) $value['parent'] ); |
433 | 433 | $value['auto_add'] = ! empty( $value['auto_add'] ); |
434 | 434 | |
435 | 435 | if ( '' === $value['name'] ) { |
… |
… |
protected function update( $value ) { |
552 | 552 | } |
553 | 553 | |
554 | 554 | $post_value = $setting->post_value( null ); |
555 | | if ( ! is_null( $post_value ) && $this->previous_term_id === intval( $post_value ) ) { |
| 555 | if ( ! is_null( $post_value ) && $this->previous_term_id === (int) $post_value ) { |
556 | 556 | $this->manager->set_post_value( $setting->id, $this->term_id ); |
557 | 557 | $setting->save(); |
558 | 558 | } |
… |
… |
protected function update( $value ) { |
566 | 566 | } |
567 | 567 | |
568 | 568 | $widget_instance = $nav_menu_widget_setting->post_value(); // Note that this calls WP_Customize_Widgets::sanitize_widget_instance(). |
569 | | if ( empty( $widget_instance['nav_menu'] ) || intval( $widget_instance['nav_menu'] ) !== $this->previous_term_id ) { |
| 569 | if ( empty( $widget_instance['nav_menu'] ) || (int) $widget_instance['nav_menu'] !== $this->previous_term_id ) { |
570 | 570 | continue; |
571 | 571 | } |
572 | 572 | |
-
diff --git a/src/wp-includes/date.php b/src/wp-includes/date.php
index ef7cb2e214..b70e06ac23 100644
a
|
b
|
public function build_mysql_datetime( $datetime, $default_to_max = false ) { |
876 | 876 | if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { |
877 | 877 | // Y |
878 | 878 | $datetime = array( |
879 | | 'year' => intval( $matches[1] ), |
| 879 | 'year' => (int) $matches[1], |
880 | 880 | ); |
881 | 881 | |
882 | 882 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { |
883 | 883 | // Y-m |
884 | 884 | $datetime = array( |
885 | | 'year' => intval( $matches[1] ), |
886 | | 'month' => intval( $matches[2] ), |
| 885 | 'year' => (int) $matches[1], |
| 886 | 'month' => (int) $matches[2], |
887 | 887 | ); |
888 | 888 | |
889 | 889 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { |
890 | 890 | // Y-m-d |
891 | 891 | $datetime = array( |
892 | | 'year' => intval( $matches[1] ), |
893 | | 'month' => intval( $matches[2] ), |
894 | | 'day' => intval( $matches[3] ), |
| 892 | 'year' => (int) $matches[1], |
| 893 | 'month' => (int) $matches[2], |
| 894 | 'day' => (int) $matches[3], |
895 | 895 | ); |
896 | 896 | |
897 | 897 | } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { |
898 | 898 | // Y-m-d H:i |
899 | 899 | $datetime = array( |
900 | | 'year' => intval( $matches[1] ), |
901 | | 'month' => intval( $matches[2] ), |
902 | | 'day' => intval( $matches[3] ), |
903 | | 'hour' => intval( $matches[4] ), |
904 | | 'minute' => intval( $matches[5] ), |
| 900 | 'year' => (int) $matches[1], |
| 901 | 'month' => (int) $matches[2], |
| 902 | 'day' => (int) $matches[3], |
| 903 | 'hour' => (int) $matches[4], |
| 904 | 'minute' => (int) $matches[5], |
905 | 905 | ); |
906 | 906 | } |
907 | 907 | |
-
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index ce2c851bc5..9d60625da1 100644
a
|
b
|
function iso8601_timezone_to_offset( $timezone ) { |
3330 | 3330 | $offset = 0; |
3331 | 3331 | } else { |
3332 | 3332 | $sign = ( substr( $timezone, 0, 1 ) == '+' ) ? 1 : -1; |
3333 | | $hours = intval( substr( $timezone, 1, 2 ) ); |
3334 | | $minutes = intval( substr( $timezone, 3, 4 ) ) / 60; |
| 3333 | $hours = (int) substr( $timezone, 1, 2 ); |
| 3334 | $minutes = (int) substr( $timezone, 3, 4 ) / 60; |
3335 | 3335 | $offset = $sign * HOUR_IN_SECONDS * ( $hours + $minutes ); |
3336 | 3336 | } |
3337 | 3337 | return $offset; |
… |
… |
function sanitize_option( $option, $value ) { |
4414 | 4414 | if ( null === $value ) { |
4415 | 4415 | $value = 1; |
4416 | 4416 | } else { |
4417 | | $value = intval( $value ); |
| 4417 | $value = (int) $value; |
4418 | 4418 | } |
4419 | 4419 | break; |
4420 | 4420 | |
… |
… |
function wp_sprintf( $pattern ) { |
4733 | 4733 | if ( $_fragment != $fragment ) { |
4734 | 4734 | $fragment = $_fragment; |
4735 | 4735 | } else { |
4736 | | $fragment = sprintf( $fragment, strval( $arg ) ); |
| 4736 | $fragment = sprintf( $fragment, (string) $arg ); |
4737 | 4737 | } |
4738 | 4738 | } |
4739 | 4739 | |
-
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 9b5f292eec..733d444fb6 100644
a
|
b
|
function dead_db() { |
3938 | 3938 | * @return int A non-negative integer. |
3939 | 3939 | */ |
3940 | 3940 | function absint( $maybeint ) { |
3941 | | return abs( intval( $maybeint ) ); |
| 3941 | return abs( (int) $maybeint ); |
3942 | 3942 | } |
3943 | 3943 | |
3944 | 3944 | /** |
-
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index ca2dbc02ec..1d4f85d010 100644
a
|
b
|
function wp_title( $sep = '»', $display = true, $seplocation = '' ) { |
1177 | 1177 | if ( is_archive() && ! empty( $m ) ) { |
1178 | 1178 | $my_year = substr( $m, 0, 4 ); |
1179 | 1179 | $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); |
1180 | | $my_day = intval( substr( $m, 6, 2 ) ); |
| 1180 | $my_day = (int) substr( $m, 6, 2 ); |
1181 | 1181 | $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
1182 | 1182 | } |
1183 | 1183 | |
… |
… |
function get_calendar( $initial = true, $echo = true ) { |
2003 | 2003 | |
2004 | 2004 | // Let's figure out when we are |
2005 | 2005 | if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
2006 | | $thismonth = zeroise( intval( $monthnum ), 2 ); |
| 2006 | $thismonth = zeroise( (int) $monthnum, 2 ); |
2007 | 2007 | $thisyear = (int) $year; |
2008 | 2008 | } elseif ( ! empty( $w ) ) { |
2009 | 2009 | // We need to get the month from MySQL |
… |
… |
function feed_links_extra( $args = array() ) { |
2789 | 2789 | $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); |
2790 | 2790 | $href = get_term_feed_link( $term->term_id, $term->taxonomy ); |
2791 | 2791 | } elseif ( is_author() ) { |
2792 | | $author_id = intval( get_query_var( 'author' ) ); |
| 2792 | $author_id = (int) get_query_var( 'author' ); |
2793 | 2793 | |
2794 | 2794 | $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
2795 | 2795 | $href = get_author_feed_link( $author_id ); |
… |
… |
function user_can_richedit() { |
3079 | 3079 | |
3080 | 3080 | if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users |
3081 | 3081 | if ( $is_safari ) { |
3082 | | $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
| 3082 | $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 ); |
3083 | 3083 | } elseif ( $is_IE ) { |
3084 | 3084 | $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE ' ) === false ); |
3085 | 3085 | } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { |
… |
… |
function paginate_links( $args = '' ) { |
3777 | 3777 | |
3778 | 3778 | // Get max pages and current page out of the current query, if available. |
3779 | 3779 | $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
3780 | | $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
| 3780 | $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
3781 | 3781 | |
3782 | 3782 | // Append the format placeholder to the base URL. |
3783 | 3783 | $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
-
diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
index e73f1e686e..28e0d42346 100644
a
|
b
|
function ms_allowed_http_request_hosts( $is_external, $host ) { |
678 | 678 | */ |
679 | 679 | function wp_parse_url( $url, $component = -1 ) { |
680 | 680 | $to_unset = array(); |
681 | | $url = strval( $url ); |
| 681 | $url = (string) $url; |
682 | 682 | |
683 | 683 | if ( '//' === substr( $url, 0, 2 ) ) { |
684 | 684 | $to_unset[] = 'scheme'; |
-
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 2772c0537f..0246ad7a3b 100644
a
|
b
|
function get_month_link( $year, $month ) { |
511 | 511 | $monthlink = $wp_rewrite->get_month_permastruct(); |
512 | 512 | if ( ! empty( $monthlink ) ) { |
513 | 513 | $monthlink = str_replace( '%year%', $year, $monthlink ); |
514 | | $monthlink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $monthlink ); |
| 514 | $monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink ); |
515 | 515 | $monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) ); |
516 | 516 | } else { |
517 | 517 | $monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) ); |
… |
… |
function get_day_link( $year, $month, $day ) { |
556 | 556 | $daylink = $wp_rewrite->get_day_permastruct(); |
557 | 557 | if ( ! empty( $daylink ) ) { |
558 | 558 | $daylink = str_replace( '%year%', $year, $daylink ); |
559 | | $daylink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $daylink ); |
560 | | $daylink = str_replace( '%day%', zeroise( intval( $day ), 2 ), $daylink ); |
| 559 | $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink ); |
| 560 | $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink ); |
561 | 561 | $daylink = home_url( user_trailingslashit( $daylink, 'day' ) ); |
562 | 562 | } else { |
563 | 563 | $daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) ); |
… |
… |
function get_next_posts_page_link( $max_page = 0 ) { |
2274 | 2274 | if ( ! $paged ) { |
2275 | 2275 | $paged = 1; |
2276 | 2276 | } |
2277 | | $nextpage = intval( $paged ) + 1; |
| 2277 | $nextpage = (int) $paged + 1; |
2278 | 2278 | if ( ! $max_page || $max_page >= $nextpage ) { |
2279 | 2279 | return get_pagenum_link( $nextpage ); |
2280 | 2280 | } |
… |
… |
function get_next_posts_link( $label = null, $max_page = 0 ) { |
2323 | 2323 | $paged = 1; |
2324 | 2324 | } |
2325 | 2325 | |
2326 | | $nextpage = intval( $paged ) + 1; |
| 2326 | $nextpage = (int) $paged + 1; |
2327 | 2327 | |
2328 | 2328 | if ( null === $label ) { |
2329 | 2329 | $label = __( 'Next Page »' ); |
… |
… |
function get_previous_posts_page_link() { |
2372 | 2372 | global $paged; |
2373 | 2373 | |
2374 | 2374 | if ( ! is_single() ) { |
2375 | | $nextpage = intval( $paged ) - 1; |
| 2375 | $nextpage = (int) $paged - 1; |
2376 | 2376 | if ( $nextpage < 1 ) { |
2377 | 2377 | $nextpage = 1; |
2378 | 2378 | } |
… |
… |
function get_next_comments_link( $label = '', $max_page = 0 ) { |
2801 | 2801 | $page = 1; |
2802 | 2802 | } |
2803 | 2803 | |
2804 | | $nextpage = intval( $page ) + 1; |
| 2804 | $nextpage = (int) $page + 1; |
2805 | 2805 | |
2806 | 2806 | if ( empty( $max_page ) ) { |
2807 | 2807 | $max_page = $wp_query->max_num_comment_pages; |
… |
… |
function get_previous_comments_link( $label = '' ) { |
2856 | 2856 | |
2857 | 2857 | $page = get_query_var( 'cpage' ); |
2858 | 2858 | |
2859 | | if ( intval( $page ) <= 1 ) { |
| 2859 | if ( (int) $page <= 1 ) { |
2860 | 2860 | return; |
2861 | 2861 | } |
2862 | 2862 | |
2863 | | $prevpage = intval( $page ) - 1; |
| 2863 | $prevpage = (int) $page - 1; |
2864 | 2864 | |
2865 | 2865 | if ( empty( $label ) ) { |
2866 | 2866 | $label = __( '« Older Comments' ); |
-
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 393c889ad0..c8bafe76cd 100644
a
|
b
|
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co |
67 | 67 | $max_width = $size[0]; |
68 | 68 | $max_height = $size[1]; |
69 | 69 | } elseif ( $size == 'thumb' || $size == 'thumbnail' ) { |
70 | | $max_width = intval( get_option( 'thumbnail_size_w' ) ); |
71 | | $max_height = intval( get_option( 'thumbnail_size_h' ) ); |
| 70 | $max_width = (int) get_option( 'thumbnail_size_w' ); |
| 71 | $max_height = (int) get_option( 'thumbnail_size_h' ); |
72 | 72 | // last chance thumbnail size defaults |
73 | 73 | if ( ! $max_width && ! $max_height ) { |
74 | 74 | $max_width = 128; |
-
diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php
index 010822fdc8..746d3c82d7 100644
a
|
b
|
function get_metadata_by_mid( $meta_type, $meta_id ) { |
594 | 594 | return false; |
595 | 595 | } |
596 | 596 | |
597 | | $meta_id = intval( $meta_id ); |
| 597 | $meta_id = (int) $meta_id; |
598 | 598 | if ( $meta_id <= 0 ) { |
599 | 599 | return false; |
600 | 600 | } |
… |
… |
function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = |
640 | 640 | return false; |
641 | 641 | } |
642 | 642 | |
643 | | $meta_id = intval( $meta_id ); |
| 643 | $meta_id = (int) $meta_id; |
644 | 644 | if ( $meta_id <= 0 ) { |
645 | 645 | return false; |
646 | 646 | } |
… |
… |
function delete_metadata_by_mid( $meta_type, $meta_id ) { |
732 | 732 | return false; |
733 | 733 | } |
734 | 734 | |
735 | | $meta_id = intval( $meta_id ); |
| 735 | $meta_id = (int) $meta_id; |
736 | 736 | if ( $meta_id <= 0 ) { |
737 | 737 | return false; |
738 | 738 | } |
… |
… |
function update_meta_cache( $meta_type, $object_ids ) { |
855 | 855 | |
856 | 856 | if ( ! empty( $meta_list ) ) { |
857 | 857 | foreach ( $meta_list as $metarow ) { |
858 | | $mpid = intval( $metarow[ $column ] ); |
| 858 | $mpid = (int) $metarow[ $column ]; |
859 | 859 | $mkey = $metarow['meta_key']; |
860 | 860 | $mval = $metarow['meta_value']; |
861 | 861 | |
-
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index 984a69ce6f..9ebe068266 100644
a
|
b
|
function global_terms( $term_id, $deprecated = '' ) { |
2073 | 2073 | return $term_id; |
2074 | 2074 | } |
2075 | 2075 | |
2076 | | $term_id = intval( $term_id ); |
| 2076 | $term_id = (int) $term_id; |
2077 | 2077 | $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) ); |
2078 | 2078 | |
2079 | 2079 | $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-template.php b/src/wp-includes/nav-menu-template.php
index 25b320e564..b880a1cded 100644
a
|
b
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
520 | 520 | $classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor'; |
521 | 521 | } |
522 | 522 | |
523 | | if ( in_array( intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) { |
| 523 | if ( in_array( (int) $parent_item->db_id, $active_ancestor_item_ids ) ) { |
524 | 524 | $classes[] = 'current-menu-ancestor'; |
525 | 525 | $menu_items[ $key ]->current_item_ancestor = true; |
526 | 526 | } |
-
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index 1e42e38ecc..6d76132349 100644
a
|
b
|
function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item |
540 | 540 | $menu_item_db_id = (int) $menu_item_db_id; |
541 | 541 | |
542 | 542 | update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) ); |
543 | | update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', strval( (int) $args['menu-item-parent-id'] ) ); |
544 | | update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (int) $args['menu-item-object-id'] ) ); |
| 543 | update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ( (int) $args['menu-item-parent-id'] ) ); |
| 544 | update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ( (int) $args['menu-item-object-id'] ) ); |
545 | 545 | update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) ); |
546 | 546 | update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) ); |
547 | 547 | |
-
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index b50772b99c..9427c59f1e 100644
a
|
b
|
function wp_rand( $min = 0, $max = 0 ) { |
2425 | 2425 | $value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 ); |
2426 | 2426 | } |
2427 | 2427 | |
2428 | | return abs( intval( $value ) ); |
| 2428 | return abs( (int) $value ); |
2429 | 2429 | } |
2430 | 2430 | endif; |
2431 | 2431 | |
-
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 1796ddeded..6869e30604 100644
a
|
b
|
function wp_insert_post( $postarr, $wp_error = false ) { |
3620 | 3620 | } |
3621 | 3621 | |
3622 | 3622 | if ( $thumbnail_support ) { |
3623 | | $thumbnail_id = intval( $postarr['_thumbnail_id'] ); |
| 3623 | $thumbnail_id = (int) $postarr['_thumbnail_id']; |
3624 | 3624 | if ( -1 === $thumbnail_id ) { |
3625 | 3625 | delete_post_thumbnail( $post_ID ); |
3626 | 3626 | } else { |
… |
… |
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p |
3977 | 3977 | // Prevent new post slugs that could result in URLs that conflict with date archives. |
3978 | 3978 | $post = get_post( $post_ID ); |
3979 | 3979 | $conflicts_with_date_archive = false; |
3980 | | if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = intval( $slug ) ) { |
| 3980 | if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = (int) $slug ) { |
3981 | 3981 | $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); |
3982 | 3982 | $postname_index = array_search( '%postname%', $permastructs ); |
3983 | 3983 | |
… |
… |
function get_page_children( $page_id, $pages ) { |
4607 | 4607 | // Build a hash of ID -> children. |
4608 | 4608 | $children = array(); |
4609 | 4609 | foreach ( (array) $pages as $page ) { |
4610 | | $children[ intval( $page->post_parent ) ][] = $page; |
| 4610 | $children[ (int) $page->post_parent ][] = $page; |
4611 | 4611 | } |
4612 | 4612 | |
4613 | 4613 | $page_list = array(); |
… |
… |
function get_page_hierarchy( &$pages, $page_id = 0 ) { |
4651 | 4651 | |
4652 | 4652 | $children = array(); |
4653 | 4653 | foreach ( (array) $pages as $p ) { |
4654 | | $parent_id = intval( $p->post_parent ); |
| 4654 | $parent_id = (int) $p->post_parent; |
4655 | 4655 | $children[ $parent_id ][] = $p; |
4656 | 4656 | } |
4657 | 4657 | |
… |
… |
function get_pages( $args = array() ) { |
4858 | 4858 | if ( ! empty( $post_authors ) ) { |
4859 | 4859 | foreach ( $post_authors as $post_author ) { |
4860 | 4860 | //Do we have an author id or an author login? |
4861 | | if ( 0 == intval( $post_author ) ) { |
| 4861 | if ( 0 == (int) $post_author ) { |
4862 | 4862 | $post_author = get_user_by( 'login', $post_author ); |
4863 | 4863 | if ( empty( $post_author ) ) { |
4864 | 4864 | continue; |
-
diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index 0cce9fa62f..36051e4e48 100644
a
|
b
|
function rest_validate_value_from_schema( $value, $args, $param = '' ) { |
1129 | 1129 | return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) ); |
1130 | 1130 | } |
1131 | 1131 | |
1132 | | if ( 'integer' === $args['type'] && round( floatval( $value ) ) !== floatval( $value ) ) { |
| 1132 | if ( 'integer' === $args['type'] && round( (float) $value ) !== (float) $value ) { |
1133 | 1133 | /* translators: 1: parameter, 2: type name */ |
1134 | 1134 | return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ) ); |
1135 | 1135 | } |
… |
… |
function rest_sanitize_value_from_schema( $value, $args ) { |
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | if ( 'string' === $args['type'] ) { |
1291 | | return strval( $value ); |
| 1291 | return (string) $value; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | return $value; |
-
diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php
index bc95631fb6..b3d9219543 100644
a
|
b
|
function wp_revisions_to_keep( $post ) { |
519 | 519 | if ( true === $num ) { |
520 | 520 | $num = -1; |
521 | 521 | } else { |
522 | | $num = intval( $num ); |
| 522 | $num = (int) $num; |
523 | 523 | } |
524 | 524 | |
525 | 525 | if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { |
… |
… |
function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { |
643 | 643 | return $value; |
644 | 644 | } |
645 | 645 | |
646 | | $thumbnail_id = intval( $_REQUEST['_thumbnail_id'] ); |
| 646 | $thumbnail_id = (int) $_REQUEST['_thumbnail_id']; |
647 | 647 | if ( $thumbnail_id <= 0 ) { |
648 | 648 | return ''; |
649 | 649 | } |
650 | 650 | |
651 | | return strval( $thumbnail_id ); |
| 651 | return (string) $thumbnail_id; |
652 | 652 | } |
653 | 653 | |
654 | 654 | /** |
-
diff --git a/src/wp-includes/rewrite.php b/src/wp-includes/rewrite.php
index 71a83ac3e9..e2c2aebcea 100644
a
|
b
|
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { |
397 | 397 | // If the date of the post doesn't match the date specified in the URL, resolve to the date archive. |
398 | 398 | if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) { |
399 | 399 | // $matches[1] is the year the post was published. |
400 | | if ( intval( $query_vars['year'] ) !== intval( $matches[1] ) ) { |
| 400 | if ( (int) $query_vars['year'] !== (int) $matches[1] ) { |
401 | 401 | return $query_vars; |
402 | 402 | } |
403 | 403 | |
404 | 404 | // $matches[2] is the month the post was published. |
405 | | if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && intval( $query_vars['monthnum'] ) !== intval( $matches[2] ) ) { |
| 405 | if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) { |
406 | 406 | return $query_vars; |
407 | 407 | } |
408 | 408 | } |
… |
… |
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { |
434 | 434 | |
435 | 435 | // If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage. |
436 | 436 | if ( '' !== $maybe_page ) { |
437 | | $query_vars['page'] = intval( $maybe_page ); |
| 437 | $query_vars['page'] = (int) $maybe_page; |
438 | 438 | } |
439 | 439 | |
440 | 440 | // Next, unset autodetected date-related query vars. |
-
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 293b18b8b6..37c0274f96 100644
a
|
b
|
function get_term_children( $term_id, $taxonomy ) { |
961 | 961 | return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); |
962 | 962 | } |
963 | 963 | |
964 | | $term_id = intval( $term_id ); |
| 964 | $term_id = (int) $term_id; |
965 | 965 | |
966 | 966 | $terms = _get_term_hierarchy( $taxonomy ); |
967 | 967 | |
… |
… |
function get_object_term_cache( $id, $taxonomy ) { |
3241 | 3241 | $term_ids = array(); |
3242 | 3242 | foreach ( $_term_ids as $term_id ) { |
3243 | 3243 | if ( is_numeric( $term_id ) ) { |
3244 | | $term_ids[] = intval( $term_id ); |
| 3244 | $term_ids[] = (int) $term_id; |
3245 | 3245 | } elseif ( isset( $term_id->term_id ) ) { |
3246 | | $term_ids[] = intval( $term_id->term_id ); |
| 3246 | $term_ids[] = (int) $term_id->term_id; |
3247 | 3247 | } |
3248 | 3248 | } |
3249 | 3249 | |
… |
… |
function _split_shared_term( $term_id, $term_taxonomy_id, $record = true ) { |
3684 | 3684 | |
3685 | 3685 | if ( is_object( $term_id ) ) { |
3686 | 3686 | $shared_term = $term_id; |
3687 | | $term_id = intval( $shared_term->term_id ); |
| 3687 | $term_id = (int) $shared_term->term_id; |
3688 | 3688 | } |
3689 | 3689 | |
3690 | 3690 | if ( is_object( $term_taxonomy_id ) ) { |
3691 | 3691 | $term_taxonomy = $term_taxonomy_id; |
3692 | | $term_taxonomy_id = intval( $term_taxonomy->term_taxonomy_id ); |
| 3692 | $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id; |
3693 | 3693 | } |
3694 | 3694 | |
3695 | 3695 | // If there are no shared term_taxonomy rows, there's nothing to do here. |
… |
… |
function _wp_batch_split_terms() { |
3856 | 3856 | // Rekey shared term array for faster lookups. |
3857 | 3857 | $_shared_terms = array(); |
3858 | 3858 | foreach ( $shared_terms as $shared_term ) { |
3859 | | $term_id = intval( $shared_term->term_id ); |
| 3859 | $term_id = (int) $shared_term->term_id; |
3860 | 3860 | $_shared_terms[ $term_id ] = $shared_term; |
3861 | 3861 | } |
3862 | 3862 | $shared_terms = $_shared_terms; |
… |
… |
function _wp_batch_split_terms() { |
3869 | 3869 | $split_term_data = get_option( '_split_terms', array() ); |
3870 | 3870 | $skipped_first_term = $taxonomies = array(); |
3871 | 3871 | foreach ( $shared_tts as $shared_tt ) { |
3872 | | $term_id = intval( $shared_tt->term_id ); |
| 3872 | $term_id = (int) $shared_tt->term_id; |
3873 | 3873 | |
3874 | 3874 | // Don't split the first tt belonging to a given term_id. |
3875 | 3875 | if ( ! isset( $skipped_first_term[ $term_id ] ) ) { |
-
diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index 412b826057..97e0963449 100644
a
|
b
|
function wp_update_plugins( $extra_stats = array() ) { |
300 | 300 | foreach ( $plugins as $file => $p ) { |
301 | 301 | $new_option->checked[ $file ] = $p['Version']; |
302 | 302 | |
303 | | if ( ! isset( $current->checked[ $file ] ) || strval( $current->checked[ $file ] ) !== strval( $p['Version'] ) ) { |
| 303 | if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) { |
304 | 304 | $plugin_changed = true; |
305 | 305 | } |
306 | 306 | } |
… |
… |
function wp_update_themes( $extra_stats = array() ) { |
482 | 482 | if ( $time_not_changed && ! $extra_stats ) { |
483 | 483 | $theme_changed = false; |
484 | 484 | foreach ( $checked as $slug => $v ) { |
485 | | if ( ! isset( $last_update->checked[ $slug ] ) || strval( $last_update->checked[ $slug ] ) !== strval( $v ) ) { |
| 485 | if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) { |
486 | 486 | $theme_changed = true; |
487 | 487 | } |
488 | 488 | } |
-
diff --git a/src/wp-includes/vars.php b/src/wp-includes/vars.php
index b398c56eab..6996fe6d1b 100644
a
|
b
|
|
124 | 124 | * |
125 | 125 | * @global bool $is_iis7 |
126 | 126 | */ |
127 | | $is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7; |
| 127 | $is_iis7 = $is_IIS && (int) substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) >= 7; |
128 | 128 | |
129 | 129 | /** |
130 | 130 | * 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 344bdc5f97..7b00f0f1e5 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 ) { |
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | $link_cats = get_terms( 'link_category' ); |
140 | | if ( ! $limit = intval( $instance['limit'] ) ) { |
| 140 | if ( ! $limit = (int) $instance['limit'] ) { |
141 | 141 | $limit = -1; |
142 | 142 | } |
143 | 143 | ?> |
… |
… |
public function form( $instance ) { |
147 | 147 | <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option> |
148 | 148 | <?php |
149 | 149 | foreach ( $link_cats as $link_cat ) { |
150 | | echo '<option value="' . intval( $link_cat->term_id ) . '"' |
| 150 | echo '<option value="' . (int) $link_cat->term_id . '"' |
151 | 151 | . selected( $instance['category'], $link_cat->term_id, false ) |
152 | 152 | . '>' . $link_cat->name . "</option>\n"; |
153 | 153 | } |
… |
… |
public function form( $instance ) { |
173 | 173 | </p> |
174 | 174 | <p> |
175 | 175 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label> |
176 | | <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" /> |
| 176 | <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit == -1 ? '' : (int) $limit; ?>" size="3" /> |
177 | 177 | </p> |
178 | 178 | <?php |
179 | 179 | } |
-
diff --git a/src/wp-includes/widgets/class-wp-widget-media.php b/src/wp-includes/widgets/class-wp-widget-media.php
index b4d3631b93..076e4bd38b 100644
a
|
b
|
public function update( $new_instance, $instance ) { |
336 | 336 | class="media-widget-instance-property" |
337 | 337 | name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" |
338 | 338 | id="<?php echo esc_attr( $this->get_field_id( $name ) ); // Needed specifically by wpWidgets.appendTitle(). ?>" |
339 | | value="<?php echo esc_attr( is_array( $value ) ? join( ',', $value ) : strval( $value ) ); ?>" |
| 339 | value="<?php echo esc_attr( is_array( $value ) ? join( ',', $value ) : (string) $value ); ?>" |
340 | 340 | /> |
341 | 341 | <?php |
342 | 342 | endforeach; |
-
diff --git a/src/wp-trackback.php b/src/wp-trackback.php
index 6bc8495a9f..154ab2ce98 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 | |