diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
index 35b1686b51..8eddb2b892 100644
--- a/wp-admin/admin-header.php
+++ b/wp-admin/admin-header.php
@@ -170,7 +170,7 @@ if ( $current_screen->taxonomy ) {
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
}
-$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) );
+$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php
index 39f28a6237..d1c9b6e1b2 100644
--- a/wp-admin/async-upload.php
+++ b/wp-admin/async-upload.php
@@ -39,8 +39,8 @@ if ( ! current_user_can( 'upload_files' ) ) {
}
// Just fetch the detail form for that attachment.
-if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) {
- $id = intval( $_REQUEST['attachment_id'] );
+if ( isset( $_REQUEST['attachment_id'] ) && (int) $_REQUEST['attachment_id'] && $_REQUEST['fetch'] ) {
+ $id = (int) $_REQUEST['attachment_id'];
$post = get_post( $id );
if ( 'attachment' !== $post->post_type ) {
wp_die( __( 'Invalid post type.' ) );
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 2ced05ab2d..c2a16eef0b 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -329,7 +329,7 @@ if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $
search_box( __( 'Search Comments' ), 'comment' ); ?>
-
+
diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index ea8502ce98..cd43df1436 100644
--- a/wp-admin/includes/ajax-actions.php
+++ b/wp-admin/includes/ajax-actions.php
@@ -227,7 +227,7 @@ function wp_ajax_wp_compression_test() {
* @since 3.1.0
*/
function wp_ajax_imgedit_preview() {
- $post_id = intval( $_GET['postid'] );
+ $post_id = (int) $_GET['postid'];
if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( -1 );
}
@@ -1954,7 +1954,7 @@ function wp_ajax_menu_quick_search() {
*/
function wp_ajax_get_permalink() {
check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
- $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
wp_die( get_preview_post_link( $post_id ) );
}
@@ -1965,7 +1965,7 @@ function wp_ajax_get_permalink() {
*/
function wp_ajax_sample_permalink() {
check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
- $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
$title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : '';
$slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null;
wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
@@ -2594,7 +2594,7 @@ function wp_ajax_upload_attachment() {
* @since 3.1.0
*/
function wp_ajax_image_editor() {
- $attachment_id = intval( $_POST['postid'] );
+ $attachment_id = (int) $_POST['postid'];
if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) {
wp_die( -1 );
@@ -2651,12 +2651,12 @@ function wp_ajax_image_editor() {
function wp_ajax_set_post_thumbnail() {
$json = ! empty( $_REQUEST['json'] ); // New-style request.
- $post_ID = intval( $_POST['post_id'] );
+ $post_ID = (int) $_POST['post_id'];
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
wp_die( -1 );
}
- $thumbnail_id = intval( $_POST['thumbnail_id'] );
+ $thumbnail_id = (int) $_POST['thumbnail_id'];
if ( $json ) {
check_ajax_referer( "update-post_$post_ID" );
@@ -2687,7 +2687,7 @@ function wp_ajax_set_post_thumbnail() {
* @since 4.6.0
*/
function wp_ajax_get_post_thumbnail_html() {
- $post_ID = intval( $_POST['post_id'] );
+ $post_ID = (int) $_POST['post_id'];
check_ajax_referer( "update-post_$post_ID" );
@@ -2695,7 +2695,7 @@ function wp_ajax_get_post_thumbnail_html() {
wp_die( -1 );
}
- $thumbnail_id = intval( $_POST['thumbnail_id'] );
+ $thumbnail_id = (int) $_POST['thumbnail_id'];
// For backward compatibility, -1 refers to no featured image.
if ( -1 === $thumbnail_id ) {
@@ -3208,7 +3208,7 @@ function wp_ajax_send_attachment_to_editor() {
$attachment = wp_unslash( $_POST['attachment'] );
- $id = intval( $attachment['id'] );
+ $id = (int) $attachment['id'];
$post = get_post( $id );
if ( ! $post ) {
@@ -3221,7 +3221,7 @@ function wp_ajax_send_attachment_to_editor() {
if ( current_user_can( 'edit_post', $id ) ) {
// If this attachment is unattached, attach it. Primarily a back compat thing.
- $insert_into_post_id = intval( $_POST['post_id'] );
+ $insert_into_post_id = (int) $_POST['post_id'];
if ( 0 == $post->post_parent && $insert_into_post_id ) {
wp_update_post(
@@ -3622,7 +3622,7 @@ function wp_ajax_parse_embed() {
wp_send_json_error();
}
- $post_id = isset( $_POST['post_ID'] ) ? intval( $_POST['post_ID'] ) : 0;
+ $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
if ( $post_id > 0 ) {
$post = get_post( $post_id );
@@ -3674,9 +3674,9 @@ function wp_ajax_parse_embed() {
// Set $content_width so any embeds fit in the destination iframe.
if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) {
if ( ! isset( $content_width ) ) {
- $content_width = intval( $_POST['maxwidth'] );
+ $content_width = (int) $_POST['maxwidth'];
} else {
- $content_width = min( $content_width, intval( $_POST['maxwidth'] ) );
+ $content_width = min( $content_width, (int) $_POST['maxwidth'] );
}
}
diff --git a/wp-admin/includes/class-walker-nav-menu-checklist.php b/wp-admin/includes/class-walker-nav-menu-checklist.php
index 11e78dd529..3f4d6c1574 100644
--- a/wp-admin/includes/class-walker-nav-menu-checklist.php
+++ b/wp-admin/includes/class-walker-nav-menu-checklist.php
@@ -74,7 +74,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) {
global $_nav_menu_placeholder, $nav_menu_selected_id;
- $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
+ $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1;
$possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder;
$possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php
index e677074a94..b60c783c90 100644
--- a/wp-admin/includes/class-wp-importer.php
+++ b/wp-admin/includes/class-wp-importer.php
@@ -37,7 +37,7 @@ class WP_Importer {
if ( ! empty( $results ) ) {
foreach ( $results as $r ) {
// Set permalinks into array.
- $hashtable[ $r->meta_value ] = intval( $r->post_id );
+ $hashtable[ $r->meta_value ] = (int) $r->post_id;
}
}
} while ( count( $results ) == $limit );
@@ -69,7 +69,7 @@ class WP_Importer {
$result = $wpdb->get_results( $sql );
if ( ! empty( $result ) ) {
- $count = intval( $result[0]->cnt );
+ $count = (int) $result[0]->cnt;
}
// Unset to save memory.
@@ -106,11 +106,11 @@ class WP_Importer {
foreach ( $results as $r ) {
// Explode comment_agent key.
list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
- $source_comment_id = intval( $source_comment_id );
+ $source_comment_id = (int) $source_comment_id;
// Check if this comment came from this blog.
if ( $bid == $ca_bid ) {
- $hashtable[ $source_comment_id ] = intval( $r->comment_ID );
+ $hashtable[ $source_comment_id ] = (int) $r->comment_ID;
}
}
}
diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php
index e1d15d6337..846ad07489 100644
--- a/wp-admin/includes/class-wp-ms-sites-list-table.php
+++ b/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -103,8 +103,8 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
$args = array(
- 'number' => intval( $per_page ),
- 'offset' => intval( ( $pagenum - 1 ) * $per_page ),
+ 'number' => (int) $per_page,
+ 'offset' => (int) ( ( $pagenum - 1 ) * $per_page ),
'network_id' => get_current_network_id(),
);
@@ -620,7 +620,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
foreach ( $this->status_list as $status => $col ) {
- if ( ( 1 === intval( $_site->{$status} ) ) && ( $site_status !== $status ) ) {
+ if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) {
$site_states[ $col[0] ] = $col[1];
}
}
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php
index de1b741234..113fad5c43 100644
--- a/wp-admin/includes/class-wp-ms-themes-list-table.php
+++ b/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -63,7 +63,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false;
if ( $this->is_site_themes ) {
- $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+ $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
}
$this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) &&
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index 01d881cb2e..8ebdcda031 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -89,19 +89,17 @@ class WP_Posts_List_Table extends WP_List_Table {
'show_in_admin_all_list' => false,
)
);
- $this->user_posts_count = intval(
- $wpdb->get_var(
- $wpdb->prepare(
- "
+ $this->user_posts_count = (int) $wpdb->get_var(
+ $wpdb->prepare(
+ "
SELECT COUNT( 1 )
FROM $wpdb->posts
WHERE post_type = %s
AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
AND post_author = %d
",
- $post_type,
- get_current_user_id()
- )
+ $post_type,
+ get_current_user_id()
)
);
diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php
index 018654bdd2..ae52238844 100644
--- a/wp-admin/includes/class-wp-users-list-table.php
+++ b/wp-admin/includes/class-wp-users-list-table.php
@@ -54,7 +54,7 @@ class WP_Users_List_Table extends WP_List_Table {
$this->is_site_users = 'site-users-network' === $this->screen->id;
if ( $this->is_site_users ) {
- $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+ $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
}
}
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index edc30cda2c..c9caa0892f 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -606,7 +606,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
echo '
' . __( 'Your Recent Drafts' ) . "
\n";
/* translators: Maximum number of words used in a preview of a draft on the dashboard. */
- $draft_length = intval( _x( '10', 'draft_length' ) );
+ $draft_length = (int) _x( '10', 'draft_length' );
$drafts = array_slice( $drafts, 0, 3 );
foreach ( $drafts as $draft ) {
@@ -928,7 +928,7 @@ function wp_dashboard_recent_posts( $args ) {
'post_status' => $args['status'],
'orderby' => 'date',
'order' => $args['order'],
- 'posts_per_page' => intval( $args['max'] ),
+ 'posts_per_page' => (int) $args['max'],
'no_found_rows' => true,
'cache_results' => false,
'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index 7b1b797eb4..92d84baa46 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -372,7 +372,7 @@ function export_wp( $args = array() ) {
foreach ( $authors as $author ) {
echo "\t";
- echo '' . intval( $author->ID ) . '';
+ echo '' . (int) $author->ID . '';
echo '' . wxr_cdata( $author->user_login ) . '';
echo '' . wxr_cdata( $author->user_email ) . '';
echo '' . wxr_cdata( $author->display_name ) . '';
@@ -395,7 +395,7 @@ function export_wp( $args = array() ) {
foreach ( $nav_menus as $menu ) {
echo "\t";
- echo '' . intval( $menu->term_id ) . '';
+ echo '' . (int) $menu->term_id . '';
echo 'nav_menu';
echo '' . wxr_cdata( $menu->slug ) . '';
wxr_term_name( $menu );
@@ -478,7 +478,7 @@ function export_wp( $args = array() ) {
- term_id ); ?>
+ term_id; ?>
slug ); ?>
parent ? $cats[ $c->parent ]->slug : '' ); ?>
- term_id ); ?>
+ term_id; ?>
slug ); ?>
- term_id ); ?>
+ term_id; ?>
taxonomy ); ?>
slug ); ?>
parent ? $terms[ $t->parent ]->slug : '' ); ?>
@@ -573,18 +573,18 @@ function export_wp( $args = array() ) {
- ID ); ?>
+ ID; ?>
post_date ); ?>
post_date_gmt ); ?>
comment_status ); ?>
ping_status ); ?>
post_name ); ?>
post_status ); ?>
- post_parent ); ?>
- menu_order ); ?>
+ post_parent; ?>
+ menu_order; ?>
post_type ); ?>
post_password ); ?>
-
+
post_type ) : ?>
ID ) ); ?>
@@ -620,7 +620,7 @@ function export_wp( $args = array() ) {
foreach ( $comments as $c ) :
?>
- comment_ID ); ?>
+ comment_ID; ?>
comment_author ); ?>
comment_author_email ); ?>
comment_author_url ); ?>
@@ -630,8 +630,8 @@ function export_wp( $args = array() ) {
comment_content ); ?>
comment_approved ); ?>
comment_type ); ?>
- comment_parent ); ?>
- user_id ); ?>
+ comment_parent; ?>
+ user_id; ?>
get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
foreach ( $c_meta as $meta ) :
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 0625bec9e2..88ac0cae2f 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -510,7 +510,7 @@ function wp_edit_theme_plugin_file( $args ) {
$scrape_key = md5( rand() );
$transient = 'scrape_key_' . $scrape_key;
- $scrape_nonce = strval( rand() );
+ $scrape_nonce = (string) rand();
// It shouldn't take more than 60 seconds to make the two loopback requests.
set_transient( $transient, $scrape_nonce, 60 );
diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php
index c3bd58613c..0d23c18318 100644
--- a/wp-admin/includes/image-edit.php
+++ b/wp-admin/includes/image-edit.php
@@ -786,8 +786,8 @@ function wp_save_image( $post_id ) {
return $return;
}
- $fwidth = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0;
- $fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0;
+ $fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0;
+ $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0;
$target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
$scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do'];
@@ -944,8 +944,8 @@ function wp_save_image( $post_id ) {
}
if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
- $width = intval( $_wp_additional_image_sizes[ $size ]['width'] );
- $height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
+ $width = (int) $_wp_additional_image_sizes[ $size ]['width'];
+ $height = (int) $_wp_additional_image_sizes[ $size ]['height'];
$crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
} else {
$height = get_option( "{$size}_size_h" );
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 94cc216df5..aab55386f5 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -49,10 +49,10 @@ function update_gallery_tab( $tabs ) {
return $tabs;
}
- $post_id = intval( $_REQUEST['post_id'] );
+ $post_id = (int) $_REQUEST['post_id'];
if ( $post_id ) {
- $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 ) ) );
+ $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 ) );
}
if ( empty( $attachments ) ) {
@@ -138,7 +138,7 @@ function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $re
if ( is_string( $rel ) ) {
$rel = ' rel="' . esc_attr( $rel ) . '"';
} else {
- $rel = ' rel="attachment wp-att-' . intval( $id ) . '"';
+ $rel = ' rel="attachment wp-att-' . (int) $id . '"';
}
} else {
$rel = '';
@@ -1549,7 +1549,7 @@ function get_media_item( $attachment_id, $args = null ) {
global $redir_tab;
$thumb_url = false;
- $attachment_id = intval( $attachment_id );
+ $attachment_id = (int) $attachment_id;
if ( $attachment_id ) {
$thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true );
@@ -2035,7 +2035,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
* @since 2.5.0
*/
function media_upload_header() {
- $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+ $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
echo '';
@@ -2071,7 +2071,7 @@ function media_upload_form( $errors = null ) {
}
$upload_action_url = admin_url( 'async-upload.php' );
- $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+ $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$_type = isset( $type ) ? $type : '';
$_tab = isset( $tab ) ? $tab : '';
@@ -2281,7 +2281,7 @@ function media_upload_type_form( $type = 'file', $errors = null, $id = null ) {
media_upload_header();
- $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+ $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
@@ -2358,7 +2358,7 @@ function media_upload_type_url_form( $type = null, $errors = null, $id = null )
media_upload_header();
- $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+ $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
/** This filter is documented in wp-admin/includes/media.php */
@@ -2506,7 +2506,7 @@ function media_upload_gallery_form( $errors ) {
$redir_tab = 'gallery';
media_upload_header();
- $post_id = intval( $_REQUEST['post_id'] );
+ $post_id = (int) $_REQUEST['post_id'];
$form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
/** This filter is documented in wp-admin/includes/media.php */
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
@@ -2669,7 +2669,7 @@ function media_upload_library_form( $errors ) {
media_upload_header();
- $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+ $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
/** This filter is documented in wp-admin/includes/media.php */
@@ -2682,7 +2682,7 @@ function media_upload_library_form( $errors ) {
$q = $_GET;
$q['posts_per_page'] = 10;
- $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
+ $q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0;
if ( $q['paged'] < 1 ) {
$q['paged'] = 1;
}
@@ -2984,9 +2984,9 @@ function media_upload_flash_bypass() {
$post = get_post();
if ( $post ) {
- $browser_uploader .= '&post_id=' . intval( $post->ID );
+ $browser_uploader .= '&post_id=' . (int) $post->ID;
} elseif ( ! empty( $GLOBALS['post_ID'] ) ) {
- $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] );
+ $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID'];
}
?>
@@ -3078,7 +3078,7 @@ function edit_form_image_editor( $post ) {
}
$thumb_url = false;
- $attachment_id = intval( $post->ID );
+ $attachment_id = (int) $post->ID;
if ( $attachment_id ) {
$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index 42d3607d23..90ab82ce5f 100644
--- a/wp-admin/includes/nav-menu.php
+++ b/wp-admin/includes/nav-menu.php
@@ -382,7 +382,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
$important_pages[] = $front_page_obj;
$suppress_page_ids[] = $front_page_obj->ID;
} else {
- $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
+ $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1;
$front_page_obj = (object) array(
'front_or_home' => true,
'ID' => 0,
@@ -609,7 +609,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
$args['walker'] = $walker;
if ( $post_type->has_archive ) {
- $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
+ $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1;
array_unshift(
$posts,
(object) array(
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index ec791a3782..29ecc3b402 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -1347,10 +1347,11 @@ function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func
if ( null === $position ) {
$menu[] = $new_menu;
- } elseif ( isset( $menu[ "$position" ] ) ) {
- $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ), -5 ) * 0.00001;
- $menu[ "$position" ] = $new_menu;
} else {
+ if ( isset( $menu[ $position ] ) ) {
+ $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ), -5 ) * 0.00001;
+ }
+
$menu[ $position ] = $new_menu;
}
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 5f55e538ad..0faf51d412 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -1923,7 +1923,7 @@ function post_preview() {
}
if ( isset( $_POST['_thumbnail_id'] ) ) {
- $query_args['_thumbnail_id'] = ( intval( $_POST['_thumbnail_id'] ) <= 0 ) ? '-1' : intval( $_POST['_thumbnail_id'] );
+ $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id'];
}
}
@@ -2085,7 +2085,7 @@ function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) {
);
if ( ! empty( $_term ) ) {
- $clean_terms[] = intval( $_term[0] );
+ $clean_terms[] = (int) $_term[0];
} else {
// No existing term was found, so pass the string. A new term will be created.
$clean_terms[] = $term;
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index e759042627..d27a7d6f79 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1321,7 +1321,7 @@ function do_meta_boxes( $screen, $context, $object ) {
echo '';
echo '' . __( 'Warning:' ) . ' ';
}
- echo "{$box['title']}";
+ echo $box['title'];
echo "\n";
if ( 'dashboard_browser_nag' !== $box['id'] ) {
@@ -2205,16 +2205,16 @@ function get_post_states( $post ) {
}
if ( 'page' === get_option( 'show_on_front' ) ) {
- if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
+ if ( (int) get_option( 'page_on_front' ) === $post->ID ) {
$post_states['page_on_front'] = _x( 'Front Page', 'page label' );
}
- if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
+ if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
$post_states['page_for_posts'] = _x( 'Posts Page', 'page label' );
}
}
- if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) {
+ if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
$post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' );
}
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index e7ebabb8f7..8bc61fd0b3 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -1059,7 +1059,7 @@ function wp_get_auto_update_message() {
if ( false === $next_update_time ) {
$message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' );
} else {
- $time_to_next_update = human_time_diff( intval( $next_update_time ) );
+ $time_to_next_update = human_time_diff( (int) $next_update_time );
// See if cron is overdue.
$overdue = ( time() - $next_update_time ) > 0;
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index bb6ea18bc5..0a65659492 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -1022,8 +1022,8 @@ function upgrade_110() {
if ( ! $got_gmt_fields ) {
// Add or subtract time to all dates, to get GMT dates.
- $add_hours = intval( $diff_gmt_weblogger );
- $add_minutes = intval( 60 * ( $diff_gmt_weblogger - $add_hours ) );
+ $add_hours = (int) $diff_gmt_weblogger;
+ $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) );
$wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" );
$wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" );
$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'" );
@@ -2048,7 +2048,7 @@ function upgrade_430_fix_comments() {
return;
}
- $allowed_length = intval( $content_length['length'] ) - 10;
+ $allowed_length = (int) $content_length['length'] - 10;
$comments = $wpdb->get_results(
"SELECT `comment_ID` FROM `{$wpdb->comments}`
diff --git a/wp-admin/media-upload.php b/wp-admin/media-upload.php
index 64c524ec66..4099cde84c 100644
--- a/wp-admin/media-upload.php
+++ b/wp-admin/media-upload.php
@@ -51,7 +51,7 @@ if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post', $_REQUE
// Upload type: image, video, file, ...?
if ( isset( $_GET['type'] ) ) {
- $type = strval( $_GET['type'] );
+ $type = (string) $_GET['type'];
} else {
/**
* Filters the default media upload type in the legacy (pre-3.5.0) media popup.
@@ -66,7 +66,7 @@ if ( isset( $_GET['type'] ) ) {
// Tab: gallery, library, or type-specific.
if ( isset( $_GET['tab'] ) ) {
- $tab = strval( $_GET['tab'] );
+ $tab = (string) $_GET['tab'];
} else {
/**
* Filters the default tab in the legacy (pre-3.5.0) media popup.
diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php
index a4ef4d5c36..0715c854b5 100644
--- a/wp-admin/nav-menus.php
+++ b/wp-admin/nav-menus.php
@@ -424,7 +424,7 @@ switch ( $action ) {
// If the menu ID changed, redirect to the new URL.
if ( $nav_menu_selected_id !== $_nav_menu_selected_id ) {
- wp_redirect( admin_url( 'nav-menus.php?menu=' . intval( $_nav_menu_selected_id ) ) );
+ wp_redirect( admin_url( 'nav-menus.php?menu=' . (int) $_nav_menu_selected_id ) );
exit;
}
}
diff --git a/wp-admin/network/site-info.php b/wp-admin/network/site-info.php
index dddb0bb962..a8294c1e49 100644
--- a/wp-admin/network/site-info.php
+++ b/wp-admin/network/site-info.php
@@ -17,7 +17,7 @@ if ( ! current_user_can( 'manage_sites' ) ) {
get_current_screen()->add_help_tab( get_site_screen_help_tab_args() );
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() );
-$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
if ( ! $id ) {
wp_die( __( 'Invalid site ID.' ) );
diff --git a/wp-admin/network/site-settings.php b/wp-admin/network/site-settings.php
index 44c417f0d9..ca1ed3fbd6 100644
--- a/wp-admin/network/site-settings.php
+++ b/wp-admin/network/site-settings.php
@@ -17,7 +17,7 @@ if ( ! current_user_can( 'manage_sites' ) ) {
get_current_screen()->add_help_tab( get_site_screen_help_tab_args() );
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() );
-$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
if ( ! $id ) {
wp_die( __( 'Invalid site ID.' ) );
diff --git a/wp-admin/network/site-themes.php b/wp-admin/network/site-themes.php
index 9e1d136980..14807b54f5 100644
--- a/wp-admin/network/site-themes.php
+++ b/wp-admin/network/site-themes.php
@@ -40,7 +40,7 @@ if ( ! empty( $_REQUEST['paged'] ) ) {
$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer );
}
-$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
if ( ! $id ) {
wp_die( __( 'Invalid site ID.' ) );
diff --git a/wp-admin/network/site-users.php b/wp-admin/network/site-users.php
index 23c748eeed..319051f89d 100644
--- a/wp-admin/network/site-users.php
+++ b/wp-admin/network/site-users.php
@@ -35,7 +35,7 @@ if ( ! empty( $_REQUEST['paged'] ) ) {
$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer );
}
-$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
if ( ! $id ) {
wp_die( __( 'Invalid site ID.' ) );
diff --git a/wp-admin/network/sites.php b/wp-admin/network/sites.php
index 16873452d2..5b081c2833 100644
--- a/wp-admin/network/sites.php
+++ b/wp-admin/network/sites.php
@@ -53,7 +53,7 @@ get_current_screen()->set_screen_reader_content(
)
);
-$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
if ( isset( $_GET['action'] ) ) {
/** This action is documented in wp-admin/network/edit.php */
diff --git a/wp-admin/network/upgrade.php b/wp-admin/network/upgrade.php
index 98e3a8b41f..8b0194e6ce 100644
--- a/wp-admin/network/upgrade.php
+++ b/wp-admin/network/upgrade.php
@@ -45,7 +45,7 @@ $action = isset( $_GET['action'] ) ? $_GET['action'] : 'show';
switch ( $action ) {
case 'upgrade':
- $n = ( isset( $_GET['n'] ) ) ? intval( $_GET['n'] ) : 0;
+ $n = ( isset( $_GET['n'] ) ) ? (int) $_GET['n'] : 0;
if ( $n < 5 ) {
/**
diff --git a/wp-admin/network/users.php b/wp-admin/network/users.php
index c2e6ee5d6b..4b103fc0bc 100644
--- a/wp-admin/network/users.php
+++ b/wp-admin/network/users.php
@@ -26,7 +26,7 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'deleteuser' );
- $id = intval( $_GET['id'] );
+ $id = (int) $_GET['id'];
if ( $id > 1 ) {
$_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays.
$title = __( 'Users' );
diff --git a/wp-admin/users.php b/wp-admin/users.php
index 2319253104..af213dc5b8 100644
--- a/wp-admin/users.php
+++ b/wp-admin/users.php
@@ -230,7 +230,7 @@ switch ( $wp_list_table->current_action() ) {
}
if ( empty( $_REQUEST['users'] ) ) {
- $userids = array( intval( $_REQUEST['user'] ) );
+ $userids = array( (int) $_REQUEST['user'] );
} else {
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
}
@@ -401,7 +401,7 @@ switch ( $wp_list_table->current_action() ) {
}
if ( empty( $_REQUEST['users'] ) ) {
- $userids = array( intval( $_REQUEST['user'] ) );
+ $userids = array( (int) $_REQUEST['user'] );
} else {
$userids = $_REQUEST['users'];
}
diff --git a/wp-comments-post.php b/wp-comments-post.php
index bc66862a7b..06cbd460f4 100644
--- a/wp-comments-post.php
+++ b/wp-comments-post.php
@@ -24,7 +24,7 @@ nocache_headers();
$comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
if ( is_wp_error( $comment ) ) {
- $data = intval( $comment->get_error_data() );
+ $data = (int) $comment->get_error_data();
if ( ! empty( $data ) ) {
wp_die(
'' . $comment->get_error_message() . '
',
diff --git a/wp-content/themes/twentyfourteen/inc/template-tags.php b/wp-content/themes/twentyfourteen/inc/template-tags.php
index 69ef45e736..413457f87d 100644
--- a/wp-content/themes/twentyfourteen/inc/template-tags.php
+++ b/wp-content/themes/twentyfourteen/inc/template-tags.php
@@ -24,7 +24,7 @@ if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) :
return;
}
- $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
+ $paged = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index c4740f4fbd..df4ee350a9 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -433,7 +433,7 @@ function wp_dropdown_categories( $args = '' ) {
/** This filter is documented in wp-includes/category-template.php */
$show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
- $selected = ( '0' === strval( $parsed_args['selected'] ) ) ? " selected='selected'" : '';
+ $selected = ( '0' === (string) $parsed_args['selected'] ) ? " selected='selected'" : '';
$output .= "\t\n";
}
@@ -737,7 +737,7 @@ function wp_tag_cloud( $args = '' ) {
if ( 'edit' === $args['link'] ) {
$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
} else {
- $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );
+ $link = get_term_link( (int) $tag->term_id, $tag->taxonomy );
}
if ( is_wp_error( $link ) ) {
diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php
index aee80a8886..8211408101 100644
--- a/wp-includes/class-http.php
+++ b/wp-includes/class-http.php
@@ -752,7 +752,7 @@ class WP_Http {
}
// Cast the Response Code to an int.
- $response['code'] = intval( $response['code'] );
+ $response['code'] = (int) $response['code'];
return array(
'response' => $response,
diff --git a/wp-includes/class-json.php b/wp-includes/class-json.php
index 7df464c374..66443e1068 100644
--- a/wp-includes/class-json.php
+++ b/wp-includes/class-json.php
@@ -579,7 +579,7 @@ class Services_JSON
return $encoded_value;
}
- return $this->_encode(strval($name)) . ':' . $encoded_value;
+ return $this->_encode((string) $name) . ':' . $encoded_value;
}
/**
diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php
index f8836ca80a..04294fb148 100644
--- a/wp-includes/class-wp-comment-query.php
+++ b/wp-includes/class-wp-comment-query.php
@@ -456,7 +456,7 @@ class WP_Comment_Query {
// If querying for a count only, there's nothing more to do.
if ( $this->query_vars['count'] ) {
// $comment_ids is actually a count in this case.
- return intval( $comment_ids );
+ return (int) $comment_ids;
}
$comment_ids = array_map( 'intval', $comment_ids );
@@ -942,7 +942,7 @@ class WP_Comment_Query {
$this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
if ( $this->query_vars['count'] ) {
- return intval( $wpdb->get_var( $this->request ) );
+ return (int) $wpdb->get_var( $this->request );
} else {
$comment_ids = $wpdb->get_col( $this->request );
return array_map( 'intval', $comment_ids );
diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php
index 58905d6822..832cf2f6fd 100644
--- a/wp-includes/class-wp-customize-manager.php
+++ b/wp-includes/class-wp-customize-manager.php
@@ -1463,7 +1463,7 @@ final class WP_Customize_Manager {
preg_match( '#^nav_menu\[(?P-?\d+)\]$#', $setting_id, $matches )
);
if ( $can_reuse ) {
- $nav_menu_term_id = intval( $matches['nav_menu_id'] );
+ $nav_menu_term_id = (int) $matches['nav_menu_id'];
$nav_menu_setting_id = $setting_id;
$reused_nav_menu_setting_ids[] = $setting_id;
break;
@@ -3268,7 +3268,7 @@ final class WP_Customize_Manager {
$lock = explode( ':', $lock );
if ( $lock && ! empty( $lock[1] ) ) {
- $user_id = intval( $lock[1] );
+ $user_id = (int) $lock[1];
$current_user_id = get_current_user_id();
if ( $user_id === $current_user_id ) {
$lock = sprintf( '%s:%s', time(), $user_id );
diff --git a/wp-includes/class-wp-customize-nav-menus.php b/wp-includes/class-wp-customize-nav-menus.php
index 48104112e0..145ded9d7c 100644
--- a/wp-includes/class-wp-customize-nav-menus.php
+++ b/wp-includes/class-wp-customize-nav-menus.php
@@ -249,8 +249,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'post_type',
'type_label' => $post_type_label,
'object' => $post->post_type,
- 'object_id' => intval( $post->ID ),
- 'url' => get_permalink( intval( $post->ID ) ),
+ 'object_id' => (int) $post->ID,
+ 'url' => get_permalink( (int) $post->ID ),
);
}
} elseif ( 'taxonomy' === $type ) {
@@ -281,8 +281,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'taxonomy',
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy,
- 'object_id' => intval( $term->term_id ),
- 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ),
+ 'object_id' => (int) $term->term_id,
+ 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ),
);
}
}
@@ -410,8 +410,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'post_type',
'type_label' => $post_type_label,
'object' => $post->post_type,
- 'object_id' => intval( $post->ID ),
- 'url' => get_permalink( intval( $post->ID ) ),
+ 'object_id' => (int) $post->ID,
+ 'url' => get_permalink( (int) $post->ID ),
);
}
@@ -436,8 +436,8 @@ final class WP_Customize_Nav_Menus {
'type' => 'taxonomy',
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy,
- 'object_id' => intval( $term->term_id ),
- 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ),
+ 'object_id' => (int) $term->term_id,
+ 'url' => get_term_link( (int) $term->term_id, $term->taxonomy ),
);
}
}
diff --git a/wp-includes/class-wp-customize-widgets.php b/wp-includes/class-wp-customize-widgets.php
index be137eafee..ed9bbe3dfd 100644
--- a/wp-includes/class-wp-customize-widgets.php
+++ b/wp-includes/class-wp-customize-widgets.php
@@ -605,7 +605,7 @@ final class WP_Customize_Widgets {
if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) {
$parsed['id_base'] = $matches[1];
- $parsed['number'] = intval( $matches[2] );
+ $parsed['number'] = (int) $matches[2];
} else {
// Likely an old single widget.
$parsed['id_base'] = $widget_id;
@@ -628,7 +628,7 @@ final class WP_Customize_Widgets {
}
$id_base = $matches[2];
- $number = isset( $matches[3] ) ? intval( $matches[3] ) : null;
+ $number = isset( $matches[3] ) ? (int) $matches[3] : null;
return compact( 'id_base', 'number' );
}
@@ -1772,7 +1772,7 @@ final class WP_Customize_Widgets {
}
$this->sidebar_instance_count[ $index ] += 1;
if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
- printf( "\n\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) );
+ printf( "\n\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] );
}
}
@@ -1788,7 +1788,7 @@ final class WP_Customize_Widgets {
public function end_dynamic_sidebar( $index ) {
array_shift( $this->current_dynamic_sidebar_id_stack );
if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
- printf( "\n\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) );
+ printf( "\n\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] );
}
}
@@ -1851,7 +1851,7 @@ final class WP_Customize_Widgets {
$this->rendering_sidebar_id = $context['sidebar_id'];
if ( isset( $context['sidebar_instance_number'] ) ) {
- $this->context_sidebar_instance_number = intval( $context['sidebar_instance_number'] );
+ $this->context_sidebar_instance_number = (int) $context['sidebar_instance_number'];
}
// Filter sidebars_widgets so that only the queried widget is in the sidebar.
diff --git a/wp-includes/class-wp-date-query.php b/wp-includes/class-wp-date-query.php
index 6fe305fffe..1bab5ef2c8 100644
--- a/wp-includes/class-wp-date-query.php
+++ b/wp-includes/class-wp-date-query.php
@@ -874,32 +874,32 @@ class WP_Date_Query {
if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) {
// Y
$datetime = array(
- 'year' => intval( $matches[1] ),
+ 'year' => (int) $matches[1],
);
} elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) {
// Y-m
$datetime = array(
- 'year' => intval( $matches[1] ),
- 'month' => intval( $matches[2] ),
+ 'year' => (int) $matches[1],
+ 'month' => (int) $matches[2],
);
} elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) {
// Y-m-d
$datetime = array(
- 'year' => intval( $matches[1] ),
- 'month' => intval( $matches[2] ),
- 'day' => intval( $matches[3] ),
+ 'year' => (int) $matches[1],
+ 'month' => (int) $matches[2],
+ 'day' => (int) $matches[3],
);
} elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) {
// Y-m-d H:i
$datetime = array(
- 'year' => intval( $matches[1] ),
- 'month' => intval( $matches[2] ),
- 'day' => intval( $matches[3] ),
- 'hour' => intval( $matches[4] ),
- 'minute' => intval( $matches[5] ),
+ 'year' => (int) $matches[1],
+ 'month' => (int) $matches[2],
+ 'day' => (int) $matches[3],
+ 'hour' => (int) $matches[4],
+ 'minute' => (int) $matches[5],
);
}
diff --git a/wp-includes/class-wp-http-curl.php b/wp-includes/class-wp-http-curl.php
index dd4cab9229..9b6e0eb10b 100644
--- a/wp-includes/class-wp-http-curl.php
+++ b/wp-includes/class-wp-http-curl.php
@@ -173,7 +173,7 @@ class WP_Http_Curl {
curl_setopt( $handle, CURLOPT_HEADER, false );
if ( isset( $parsed_args['limit_response_size'] ) ) {
- $this->max_body_length = intval( $parsed_args['limit_response_size'] );
+ $this->max_body_length = (int) $parsed_args['limit_response_size'];
} else {
$this->max_body_length = false;
}
diff --git a/wp-includes/class-wp-matchesmapregex.php b/wp-includes/class-wp-matchesmapregex.php
index 334026f86e..cdb39077e2 100644
--- a/wp-includes/class-wp-matchesmapregex.php
+++ b/wp-includes/class-wp-matchesmapregex.php
@@ -83,7 +83,7 @@ class WP_MatchesMapRegex {
* @return string
*/
public function callback( $matches ) {
- $index = intval( substr( $matches[0], 9, -1 ) );
+ $index = (int) substr( $matches[0], 9, -1 );
return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' );
}
}
diff --git a/wp-includes/class-wp-network-query.php b/wp-includes/class-wp-network-query.php
index bc5a2d6b3a..1e0cb54733 100644
--- a/wp-includes/class-wp-network-query.php
+++ b/wp-includes/class-wp-network-query.php
@@ -260,7 +260,7 @@ class WP_Network_Query {
// If querying for a count only, there's nothing more to do.
if ( $this->query_vars['count'] ) {
// $network_ids is actually a count in this case.
- return intval( $network_ids );
+ return (int) $network_ids;
}
$network_ids = array_map( 'intval', $network_ids );
@@ -469,7 +469,7 @@ class WP_Network_Query {
$this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
if ( $this->query_vars['count'] ) {
- return intval( $wpdb->get_var( $this->request ) );
+ return (int) $wpdb->get_var( $this->request );
}
$network_ids = $wpdb->get_col( $this->request );
diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php
index ece28bf4fb..9048ca53b6 100644
--- a/wp-includes/class-wp-query.php
+++ b/wp-includes/class-wp-query.php
@@ -763,7 +763,7 @@ class WP_Query {
$qv['p'] = 0;
$qv['error'] = '404';
} else {
- $qv['p'] = intval( $qv['p'] );
+ $qv['p'] = (int) $qv['p'];
}
$qv['page_id'] = absint( $qv['page_id'] );
@@ -942,7 +942,7 @@ class WP_Query {
$this->is_trackback = true;
}
- if ( '' != $qv['paged'] && ( intval( $qv['paged'] ) > 1 ) ) {
+ if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) {
$this->is_paged = true;
}
@@ -1604,7 +1604,7 @@ class WP_Query {
// If RAND() contains a seed value, sanitize and add to allowed keys.
$rand_with_seed = false;
if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) {
- $orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) );
+ $orderby = sprintf( 'RAND(%s)', (int) $matches[1] );
$allowed_keys[] = $orderby;
$rand_with_seed = true;
}
@@ -2263,7 +2263,7 @@ class WP_Query {
// Numeric comment count is converted to array format.
if ( is_numeric( $q['comment_count'] ) ) {
$q['comment_count'] = array(
- 'value' => intval( $q['comment_count'] ),
+ 'value' => (int) $q['comment_count'],
);
}
diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php
index 39c82d2b67..e19a84c749 100644
--- a/wp-includes/class-wp-site-query.php
+++ b/wp-includes/class-wp-site-query.php
@@ -351,7 +351,7 @@ class WP_Site_Query {
// If querying for a count only, there's nothing more to do.
if ( $this->query_vars['count'] ) {
// $site_ids is actually a count in this case.
- return intval( $site_ids );
+ return (int) $site_ids;
}
$site_ids = array_map( 'intval', $site_ids );
@@ -660,7 +660,7 @@ class WP_Site_Query {
$this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
if ( $this->query_vars['count'] ) {
- return intval( $wpdb->get_var( $this->request ) );
+ return (int) $wpdb->get_var( $this->request );
}
$site_ids = $wpdb->get_col( $this->request );
diff --git a/wp-includes/class-wp-term-query.php b/wp-includes/class-wp-term-query.php
index f69ec639e3..d1bb3f2b4a 100644
--- a/wp-includes/class-wp-term-query.php
+++ b/wp-includes/class-wp-term-query.php
@@ -258,7 +258,7 @@ class WP_Term_Query {
$query['offset'] = absint( $query['offset'] );
// 'parent' overrides 'child_of'.
- if ( 0 < intval( $query['parent'] ) ) {
+ if ( 0 < (int) $query['parent'] ) {
$query['child_of'] = false;
}
@@ -346,7 +346,7 @@ class WP_Term_Query {
}
// 'parent' overrides 'child_of'.
- if ( 0 < intval( $args['parent'] ) ) {
+ if ( 0 < (int) $args['parent'] ) {
$args['child_of'] = false;
}
@@ -443,7 +443,7 @@ class WP_Term_Query {
(array) get_terms(
array(
'taxonomy' => reset( $taxonomies ),
- 'child_of' => intval( $extrunk ),
+ 'child_of' => (int) $extrunk,
'fields' => 'ids',
'hide_empty' => 0,
)
diff --git a/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php
index f9582df7c6..16f4a52c7f 100644
--- a/wp-includes/class-wp-user.php
+++ b/wp-includes/class-wp-user.php
@@ -199,7 +199,7 @@ class WP_User {
if ( ! is_numeric( $value ) ) {
return false;
}
- $value = intval( $value );
+ $value = (int) $value;
if ( $value < 1 ) {
return false;
}
@@ -645,7 +645,7 @@ class WP_User {
*/
public function level_reduction( $max, $item ) {
if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) {
- $level = intval( $matches[1] );
+ $level = (int) $matches[1];
return max( $max, $level );
} else {
return $max;
diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php
index 42de304df4..c653151437 100644
--- a/wp-includes/class-wp-xmlrpc-server.php
+++ b/wp-includes/class-wp-xmlrpc-server.php
@@ -798,13 +798,13 @@ class wp_xmlrpc_server extends IXR_Server {
}
// For integers which may be larger than XML-RPC supports ensure we return strings.
- $_term['term_id'] = strval( $_term['term_id'] );
- $_term['term_group'] = strval( $_term['term_group'] );
- $_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] );
- $_term['parent'] = strval( $_term['parent'] );
+ $_term['term_id'] = (string) $_term['term_id'];
+ $_term['term_group'] = (string) $_term['term_group'];
+ $_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id'];
+ $_term['parent'] = (string) $_term['parent'];
// Count we are happy to return as an integer because people really shouldn't use terms that much.
- $_term['count'] = intval( $_term['count'] );
+ $_term['count'] = (int) $_term['count'];
// Get term meta.
$_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] );
@@ -856,7 +856,7 @@ class wp_xmlrpc_server extends IXR_Server {
*/
protected function _prepare_post( $post, $fields ) {
// Holds the data for this post. built up based on $fields.
- $_post = array( 'post_id' => strval( $post['ID'] ) );
+ $_post = array( 'post_id' => (string) $post['ID'] );
// Prepare common post fields.
$post_fields = array(
@@ -872,11 +872,11 @@ class wp_xmlrpc_server extends IXR_Server {
'post_password' => $post['post_password'],
'post_excerpt' => $post['post_excerpt'],
'post_content' => $post['post_content'],
- 'post_parent' => strval( $post['post_parent'] ),
+ 'post_parent' => (string) $post['post_parent'],
'post_mime_type' => $post['post_mime_type'],
'link' => get_permalink( $post['ID'] ),
'guid' => $post['guid'],
- 'menu_order' => intval( $post['menu_order'] ),
+ 'menu_order' => (int) $post['menu_order'],
'comment_status' => $post['comment_status'],
'ping_status' => $post['ping_status'],
'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ),
@@ -1009,7 +1009,7 @@ class wp_xmlrpc_server extends IXR_Server {
*/
protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) {
$_media_item = array(
- 'attachment_id' => strval( $media_item->ID ),
+ 'attachment_id' => (string) $media_item->ID,
'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
'parent' => $media_item->post_parent,
'link' => wp_get_attachment_url( $media_item->ID ),
@@ -1174,7 +1174,7 @@ class wp_xmlrpc_server extends IXR_Server {
* @return array The prepared user data.
*/
protected function _prepare_user( $user, $fields ) {
- $_user = array( 'user_id' => strval( $user->ID ) );
+ $_user = array( 'user_id' => (string) $user->ID );
$user_fields = array(
'username' => $user->user_login,
@@ -1647,7 +1647,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
}
- return strval( $post_ID );
+ return (string) $post_ID;
}
/**
@@ -2094,7 +2094,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] );
}
- return strval( $term['term_id'] );
+ return (string) $term['term_id'];
}
/**
@@ -5566,7 +5566,7 @@ class wp_xmlrpc_server extends IXR_Server {
*/
do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
- return strval( $post_ID );
+ return (string) $post_ID;
}
/**
@@ -6555,7 +6555,7 @@ class wp_xmlrpc_server extends IXR_Server {
do_action( 'xmlrpc_call', 'mt.getPostCategories' );
$categories = array();
- $catids = wp_get_post_categories( intval( $post_ID ) );
+ $catids = wp_get_post_categories( (int) $post_ID );
// First listed category will be the primary category.
$isPrimary = true;
foreach ( $catids as $catid ) {
@@ -6812,7 +6812,7 @@ class wp_xmlrpc_server extends IXR_Server {
$post_ID = (int) $blah[1];
} elseif ( isset( $urltest['fragment'] ) ) {
// An #anchor is there, it's either...
- if ( intval( $urltest['fragment'] ) ) {
+ if ( (int) $urltest['fragment'] ) {
// ...an integer #XXXX (simplest case),
$post_ID = (int) $urltest['fragment'];
} elseif ( preg_match( '/post-[0-9]+/', $urltest['fragment'] ) ) {
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index d3417db02b..89be475034 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -604,7 +604,7 @@ function get_comment_excerpt( $comment_ID = 0 ) {
}
/* translators: Maximum number of words used in a comment excerpt. */
- $comment_excerpt_length = intval( _x( '20', 'comment_excerpt_length' ) );
+ $comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' );
/**
* Filters the maximum number of words used in the comment excerpt.
@@ -2205,7 +2205,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
}
}
// Validation check.
- $parsed_args['page'] = intval( $parsed_args['page'] );
+ $parsed_args['page'] = (int) $parsed_args['page'];
if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
$parsed_args['page'] = 1;
}
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 10e9d864ad..6b722529fc 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -1254,7 +1254,7 @@ function wp_get_comment_fields_max_lengths() {
if ( ! is_array( $col_length ) && (int) $col_length > 0 ) {
$max_length = (int) $col_length;
- } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && intval( $col_length['length'] ) > 0 ) {
+ } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) {
$max_length = (int) $col_length['length'];
if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) {
diff --git a/wp-includes/customize/class-wp-customize-date-time-control.php b/wp-includes/customize/class-wp-customize-date-time-control.php
index 0d88b378bc..54671896fa 100644
--- a/wp-includes/customize/class-wp-customize-date-time-control.php
+++ b/wp-includes/customize/class-wp-customize-date-time-control.php
@@ -81,8 +81,8 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
public function json() {
$data = parent::json();
- $data['maxYear'] = intval( $this->max_year );
- $data['minYear'] = intval( $this->min_year );
+ $data['maxYear'] = (int) $this->max_year;
+ $data['minYear'] = (int) $this->min_year;
$data['allowPastDate'] = (bool) $this->allow_past_date;
$data['twelveHourFormat'] = (bool) $this->twelve_hour_format;
$data['includeTime'] = (bool) $this->include_time;
@@ -245,7 +245,7 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
$timezone_info['description'] = '';
}
} else {
- $formatted_gmt_offset = $this->format_gmt_offset( intval( get_option( 'gmt_offset', 0 ) ) );
+ $formatted_gmt_offset = $this->format_gmt_offset( (int) get_option( 'gmt_offset', 0 ) );
$timezone_info['description'] = sprintf(
/* translators: 1: UTC abbreviation and offset, 2: UTC offset. */
diff --git a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
index 46601a9e18..5da6515f5f 100644
--- a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
+++ b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
@@ -171,7 +171,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
throw new Exception( "Illegal widget setting ID: $id" );
}
- $this->post_id = intval( $matches['id'] );
+ $this->post_id = (int) $matches['id'];
add_action( 'wp_update_nav_menu_item', array( $this, 'flush_cached_value' ), 10, 2 );
parent::__construct( $manager, $id, $args );
@@ -368,7 +368,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) {
if ( ! is_int( $this->value[ $key ] ) ) {
- $this->value[ $key ] = intval( $this->value[ $key ] );
+ $this->value[ $key ] = (int) $this->value[ $key ];
}
}
foreach ( array( 'classes', 'xfn' ) as $key ) {
@@ -684,11 +684,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
);
$menu_item_value = array_merge( $default, $menu_item_value );
$menu_item_value = wp_array_slice_assoc( $menu_item_value, array_keys( $default ) );
- $menu_item_value['position'] = intval( $menu_item_value['position'] );
+ $menu_item_value['position'] = (int) $menu_item_value['position'];
foreach ( array( 'object_id', 'menu_item_parent', 'nav_menu_term_id' ) as $key ) {
// Note we need to allow negative-integer IDs for previewed objects not inserted yet.
- $menu_item_value[ $key ] = intval( $menu_item_value[ $key ] );
+ $menu_item_value[ $key ] = (int) $menu_item_value[ $key ];
}
foreach ( array( 'type', 'object', 'target' ) as $key ) {
@@ -798,7 +798,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
return;
}
- if ( intval( $value['nav_menu_term_id'] ) !== $nav_menu_setting->previous_term_id ) {
+ if ( (int) $value['nav_menu_term_id'] !== $nav_menu_setting->previous_term_id ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_term_id' );
return;
@@ -824,7 +824,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
return;
}
- if ( intval( $value['menu_item_parent'] ) !== $parent_nav_menu_item_setting->previous_post_id ) {
+ if ( (int) $value['menu_item_parent'] !== $parent_nav_menu_item_setting->previous_post_id ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_post_id' );
return;
diff --git a/wp-includes/customize/class-wp-customize-nav-menu-section.php b/wp-includes/customize/class-wp-customize-nav-menu-section.php
index bbb5f95e7d..225d035eef 100644
--- a/wp-includes/customize/class-wp-customize-nav-menu-section.php
+++ b/wp-includes/customize/class-wp-customize-nav-menu-section.php
@@ -34,7 +34,7 @@ class WP_Customize_Nav_Menu_Section extends WP_Customize_Section {
*/
public function json() {
$exported = parent::json();
- $exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ) );
+ $exported['menu_id'] = (int) preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id );
return $exported;
}
diff --git a/wp-includes/customize/class-wp-customize-nav-menu-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-setting.php
index 1b0de422ab..8962606e5c 100644
--- a/wp-includes/customize/class-wp-customize-nav-menu-setting.php
+++ b/wp-includes/customize/class-wp-customize-nav-menu-setting.php
@@ -141,7 +141,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
throw new Exception( "Illegal widget setting ID: $id" );
}
- $this->term_id = intval( $matches['id'] );
+ $this->term_id = (int) $matches['id'];
parent::__construct( $manager, $id, $args );
}
@@ -433,7 +433,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
$value['name'] = trim( esc_html( $value['name'] ) ); // This sanitization code is used in wp-admin/nav-menus.php.
$value['description'] = sanitize_text_field( $value['description'] );
- $value['parent'] = max( 0, intval( $value['parent'] ) );
+ $value['parent'] = max( 0, (int) $value['parent'] );
$value['auto_add'] = ! empty( $value['auto_add'] );
if ( '' === $value['name'] ) {
@@ -556,7 +556,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
}
$post_value = $setting->post_value( null );
- if ( ! is_null( $post_value ) && intval( $post_value ) === $this->previous_term_id ) {
+ if ( ! is_null( $post_value ) && (int) $post_value === $this->previous_term_id ) {
$this->manager->set_post_value( $setting->id, $this->term_id );
$setting->save();
}
@@ -570,7 +570,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
}
$widget_instance = $nav_menu_widget_setting->post_value(); // Note that this calls WP_Customize_Widgets::sanitize_widget_instance().
- if ( empty( $widget_instance['nav_menu'] ) || intval( $widget_instance['nav_menu'] ) !== $this->previous_term_id ) {
+ if ( empty( $widget_instance['nav_menu'] ) || (int) $widget_instance['nav_menu'] !== $this->previous_term_id ) {
continue;
}
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 063e02115e..5bd8d5934a 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -3568,8 +3568,8 @@ function iso8601_timezone_to_offset( $timezone ) {
$offset = 0;
} else {
$sign = ( '+' === substr( $timezone, 0, 1 ) ) ? 1 : -1;
- $hours = intval( substr( $timezone, 1, 2 ) );
- $minutes = intval( substr( $timezone, 3, 4 ) ) / 60;
+ $hours = (int) substr( $timezone, 1, 2 );
+ $minutes = (int) substr( $timezone, 3, 4 ) / 60;
$offset = $sign * HOUR_IN_SECONDS * ( $hours + $minutes );
}
return $offset;
@@ -3820,7 +3820,7 @@ function wp_trim_excerpt( $text = '', $post = null ) {
$text = str_replace( ']]>', ']]>', $text );
/* translators: Maximum number of words used in a post excerpt. */
- $excerpt_length = intval( _x( '55', 'excerpt_length' ) );
+ $excerpt_length = (int) _x( '55', 'excerpt_length' );
/**
* Filters the maximum number of words in a post excerpt.
@@ -4725,7 +4725,7 @@ function sanitize_option( $option, $value ) {
if ( null === $value ) {
$value = 1;
} else {
- $value = intval( $value );
+ $value = (int) $value;
}
break;
@@ -5067,7 +5067,7 @@ function wp_sprintf( $pattern, ...$args ) {
if ( $_fragment != $fragment ) {
$fragment = $_fragment;
} else {
- $fragment = sprintf( $fragment, strval( $arg ) );
+ $fragment = sprintf( $fragment, (string) $arg );
}
}
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index fe68d7f760..3f6864368c 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -4735,7 +4735,7 @@ function dead_db() {
* @return int A non-negative integer.
*/
function absint( $maybeint ) {
- return abs( intval( $maybeint ) );
+ return abs( (int) $maybeint );
}
/**
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index b2bf8304af..dc5b374121 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -1339,7 +1339,7 @@ function wp_title( $sep = '»', $display = true, $seplocation = '' ) {
if ( is_archive() && ! empty( $m ) ) {
$my_year = substr( $m, 0, 4 );
$my_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
- $my_day = intval( substr( $m, 6, 2 ) );
+ $my_day = (int) substr( $m, 6, 2 );
$title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
}
@@ -2223,7 +2223,7 @@ function get_calendar( $initial = true, $echo = true ) {
// Let's figure out when we are.
if ( ! empty( $monthnum ) && ! empty( $year ) ) {
- $thismonth = zeroise( intval( $monthnum ), 2 );
+ $thismonth = zeroise( (int) $monthnum, 2 );
$thisyear = (int) $year;
} elseif ( ! empty( $w ) ) {
// We need to get the month from MySQL.
@@ -3149,7 +3149,7 @@ function feed_links_extra( $args = array() ) {
$href = get_term_feed_link( $term->term_id, $term->taxonomy );
}
} elseif ( is_author() ) {
- $author_id = intval( get_query_var( 'author' ) );
+ $author_id = (int) get_query_var( 'author' );
$title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) );
$href = get_author_feed_link( $author_id );
@@ -3459,7 +3459,7 @@ function user_can_richedit() {
if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users.
if ( $is_safari ) {
- $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
+ $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
} elseif ( $is_IE ) {
$wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false );
} elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
@@ -4195,7 +4195,7 @@ function paginate_links( $args = '' ) {
// Get max pages and current page out of the current query, if available.
$total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
- $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
+ $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
// Append the format placeholder to the base URL.
$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
diff --git a/wp-includes/http.php b/wp-includes/http.php
index d4acb41330..fba9dd3bba 100644
--- a/wp-includes/http.php
+++ b/wp-includes/http.php
@@ -668,7 +668,7 @@ function ms_allowed_http_request_hosts( $is_external, $host ) {
*/
function wp_parse_url( $url, $component = -1 ) {
$to_unset = array();
- $url = strval( $url );
+ $url = (string) $url;
if ( '//' === substr( $url, 0, 2 ) ) {
$to_unset[] = 'scheme';
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index b1294db5be..9e654aaaeb 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -515,7 +515,7 @@ function get_month_link( $year, $month ) {
$monthlink = $wp_rewrite->get_month_permastruct();
if ( ! empty( $monthlink ) ) {
$monthlink = str_replace( '%year%', $year, $monthlink );
- $monthlink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $monthlink );
+ $monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink );
$monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) );
} else {
$monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) );
@@ -560,8 +560,8 @@ function get_day_link( $year, $month, $day ) {
$daylink = $wp_rewrite->get_day_permastruct();
if ( ! empty( $daylink ) ) {
$daylink = str_replace( '%year%', $year, $daylink );
- $daylink = str_replace( '%monthnum%', zeroise( intval( $month ), 2 ), $daylink );
- $daylink = str_replace( '%day%', zeroise( intval( $day ), 2 ), $daylink );
+ $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink );
+ $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink );
$daylink = home_url( user_trailingslashit( $daylink, 'day' ) );
} else {
$daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) );
@@ -2320,7 +2320,7 @@ function get_next_posts_page_link( $max_page = 0 ) {
if ( ! $paged ) {
$paged = 1;
}
- $nextpage = intval( $paged ) + 1;
+ $nextpage = (int) $paged + 1;
if ( ! $max_page || $max_page >= $nextpage ) {
return get_pagenum_link( $nextpage );
}
@@ -2369,7 +2369,7 @@ function get_next_posts_link( $label = null, $max_page = 0 ) {
$paged = 1;
}
- $nextpage = intval( $paged ) + 1;
+ $nextpage = (int) $paged + 1;
if ( null === $label ) {
$label = __( 'Next Page »' );
@@ -2418,7 +2418,7 @@ function get_previous_posts_page_link() {
global $paged;
if ( ! is_single() ) {
- $nextpage = intval( $paged ) - 1;
+ $nextpage = (int) $paged - 1;
if ( $nextpage < 1 ) {
$nextpage = 1;
}
@@ -2891,7 +2891,7 @@ function get_next_comments_link( $label = '', $max_page = 0 ) {
$page = 1;
}
- $nextpage = intval( $page ) + 1;
+ $nextpage = (int) $page + 1;
if ( empty( $max_page ) ) {
$max_page = $wp_query->max_num_comment_pages;
@@ -2946,11 +2946,11 @@ function get_previous_comments_link( $label = '' ) {
$page = get_query_var( 'cpage' );
- if ( intval( $page ) <= 1 ) {
+ if ( (int) $page <= 1 ) {
return;
}
- $prevpage = intval( $page ) - 1;
+ $prevpage = (int) $page - 1;
if ( empty( $label ) ) {
$label = __( '« Older Comments' );
diff --git a/wp-includes/media.php b/wp-includes/media.php
index ece84326f7..f30b7e14fc 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -70,23 +70,23 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
$max_width = $size[0];
$max_height = $size[1];
} elseif ( 'thumb' === $size || 'thumbnail' === $size ) {
- $max_width = intval( get_option( 'thumbnail_size_w' ) );
- $max_height = intval( get_option( 'thumbnail_size_h' ) );
+ $max_width = (int) get_option( 'thumbnail_size_w' );
+ $max_height = (int) get_option( 'thumbnail_size_h' );
// Last chance thumbnail size defaults.
if ( ! $max_width && ! $max_height ) {
$max_width = 128;
$max_height = 96;
}
} elseif ( 'medium' === $size ) {
- $max_width = intval( get_option( 'medium_size_w' ) );
- $max_height = intval( get_option( 'medium_size_h' ) );
+ $max_width = (int) get_option( 'medium_size_w' );
+ $max_height = (int) get_option( 'medium_size_h' );
} elseif ( 'medium_large' === $size ) {
- $max_width = intval( get_option( 'medium_large_size_w' ) );
- $max_height = intval( get_option( 'medium_large_size_h' ) );
+ $max_width = (int) get_option( 'medium_large_size_w' );
+ $max_height = (int) get_option( 'medium_large_size_h' );
- if ( intval( $content_width ) > 0 ) {
- $max_width = min( intval( $content_width ), $max_width );
+ if ( (int) $content_width > 0 ) {
+ $max_width = min( (int) $content_width, $max_width );
}
} elseif ( 'large' === $size ) {
/*
@@ -95,18 +95,18 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
* itself, and within the theme's content width if it's known. The user
* can resize it in the editor if they wish.
*/
- $max_width = intval( get_option( 'large_size_w' ) );
- $max_height = intval( get_option( 'large_size_h' ) );
+ $max_width = (int) get_option( 'large_size_w' );
+ $max_height = (int) get_option( 'large_size_h' );
- if ( intval( $content_width ) > 0 ) {
- $max_width = min( intval( $content_width ), $max_width );
+ if ( (int) $content_width > 0 ) {
+ $max_width = min( (int) $content_width, $max_width );
}
} elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) {
- $max_width = intval( $_wp_additional_image_sizes[ $size ]['width'] );
- $max_height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
+ $max_width = (int) $_wp_additional_image_sizes[ $size ]['width'];
+ $max_height = (int) $_wp_additional_image_sizes[ $size ]['height'];
// Only in admin. Assume that theme authors know what they're doing.
- if ( intval( $content_width ) > 0 && 'edit' === $context ) {
- $max_width = min( intval( $content_width ), $max_width );
+ if ( (int) $content_width > 0 && 'edit' === $context ) {
+ $max_width = min( (int) $content_width, $max_width );
}
} else { // $size === 'full' has no constraint.
$max_width = $width;
@@ -155,10 +155,10 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
function image_hwstring( $width, $height ) {
$out = '';
if ( $width ) {
- $out .= 'width="' . intval( $width ) . '" ';
+ $out .= 'width="' . (int) $width . '" ';
}
if ( $height ) {
- $out .= 'height="' . intval( $height ) . '" ';
+ $out .= 'height="' . (int) $height . '" ';
}
return $out;
}
@@ -775,7 +775,7 @@ function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
foreach ( $imagedata['sizes'] as $_size => $data ) {
// If there's an exact match to an existing image size, short circuit.
- if ( intval( $data['width'] ) === intval( $size[0] ) && intval( $data['height'] ) === intval( $size[1] ) ) {
+ if ( (int) $data['width'] === (int) $size[0] && (int) $data['height'] === (int) $size[1] ) {
$candidates[ $data['width'] * $data['height'] ] = $data;
break;
}
@@ -896,16 +896,16 @@ function wp_get_registered_image_subsizes() {
if ( isset( $additional_sizes[ $size_name ]['width'] ) ) {
// For sizes added by plugins and themes.
- $size_data['width'] = intval( $additional_sizes[ $size_name ]['width'] );
+ $size_data['width'] = (int) $additional_sizes[ $size_name ]['width'];
} else {
// For default sizes set in options.
- $size_data['width'] = intval( get_option( "{$size_name}_size_w" ) );
+ $size_data['width'] = (int) get_option( "{$size_name}_size_w" );
}
if ( isset( $additional_sizes[ $size_name ]['height'] ) ) {
- $size_data['height'] = intval( $additional_sizes[ $size_name ]['height'] );
+ $size_data['height'] = (int) $additional_sizes[ $size_name ]['height'];
} else {
- $size_data['height'] = intval( get_option( "{$size_name}_size_h" ) );
+ $size_data['height'] = (int) get_option( "{$size_name}_size_h" );
}
if ( empty( $size_data['width'] ) && empty( $size_data['height'] ) ) {
@@ -2215,7 +2215,7 @@ function gallery_shortcode( $attr ) {
'gallery'
);
- $id = intval( $atts['id'] );
+ $id = (int) $atts['id'];
if ( ! empty( $atts['include'] ) ) {
$_attachments = get_posts(
@@ -2293,7 +2293,7 @@ function gallery_shortcode( $attr ) {
$icontag = 'dt';
}
- $columns = intval( $atts['columns'] );
+ $columns = (int) $atts['columns'];
$itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100;
$float = is_rtl() ? 'right' : 'left';
@@ -2553,7 +2553,7 @@ function wp_playlist_shortcode( $attr ) {
'playlist'
);
- $id = intval( $atts['id'] );
+ $id = (int) $atts['id'];
if ( 'audio' !== $atts['type'] ) {
$atts['type'] = 'video';
@@ -3330,7 +3330,7 @@ function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )
);
foreach ( $attachments as $k => $attachment ) {
- if ( intval( $attachment->ID ) === intval( $post->ID ) ) {
+ if ( (int) $attachment->ID === (int) $post->ID ) {
break;
}
}
@@ -4516,7 +4516,7 @@ function get_post_galleries( $post, $html = true ) {
// Specify the post ID of the gallery we're viewing if the shortcode doesn't reference another post already.
if ( ! isset( $shortcode_attrs['id'] ) ) {
- $shortcode[3] .= ' id="' . intval( $post->ID ) . '"';
+ $shortcode[3] .= ' id="' . (int) $post->ID . '"';
}
$gallery = do_shortcode_tag( $shortcode );
diff --git a/wp-includes/meta.php b/wp-includes/meta.php
index 96ce28dee9..3cef8c1363 100644
--- a/wp-includes/meta.php
+++ b/wp-includes/meta.php
@@ -722,7 +722,7 @@ function get_metadata_by_mid( $meta_type, $meta_id ) {
return false;
}
- $meta_id = intval( $meta_id );
+ $meta_id = (int) $meta_id;
if ( $meta_id <= 0 ) {
return false;
}
@@ -786,7 +786,7 @@ function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key =
return false;
}
- $meta_id = intval( $meta_id );
+ $meta_id = (int) $meta_id;
if ( $meta_id <= 0 ) {
return false;
}
@@ -901,7 +901,7 @@ function delete_metadata_by_mid( $meta_type, $meta_id ) {
return false;
}
- $meta_id = intval( $meta_id );
+ $meta_id = (int) $meta_id;
if ( $meta_id <= 0 ) {
return false;
}
@@ -1062,7 +1062,7 @@ function update_meta_cache( $meta_type, $object_ids ) {
if ( ! empty( $meta_list ) ) {
foreach ( $meta_list as $metarow ) {
- $mpid = intval( $metarow[ $column ] );
+ $mpid = (int) $metarow[ $column ];
$mkey = $metarow['meta_key'];
$mval = $metarow['meta_value'];
diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php
index 0f8fafaa13..9740a50483 100644
--- a/wp-includes/ms-functions.php
+++ b/wp-includes/ms-functions.php
@@ -708,7 +708,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
$mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain );
$path = $base;
} else {
- $mydomain = "$domain";
+ $mydomain = $domain;
$path = $base . $blogname . '/';
}
if ( domain_exists( $mydomain, $path, $current_network->id ) ) {
@@ -1970,7 +1970,7 @@ function global_terms( $term_id, $deprecated = '' ) {
return $term_id;
}
- $term_id = intval( $term_id );
+ $term_id = (int) $term_id;
$c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
$global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
index f7ceb7cf2b..10f2e77931 100644
--- a/wp-includes/nav-menu.php
+++ b/wp-includes/nav-menu.php
@@ -552,8 +552,8 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
$menu_item_db_id = (int) $menu_item_db_id;
update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) );
- update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', strval( (int) $args['menu-item-parent-id'] ) );
- update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (int) $args['menu-item-object-id'] ) );
+ update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ( (int) $args['menu-item-parent-id'] ) );
+ update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ( (int) $args['menu-item-object-id'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) );
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index b2ed4642c5..a822ff3bea 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -2540,7 +2540,7 @@ if ( ! function_exists( 'wp_rand' ) ) :
$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
}
- return abs( intval( $value ) );
+ return abs( (int) $value );
}
endif;
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 24b95313b6..293461e9ed 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -4135,7 +4135,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
}
if ( $thumbnail_support ) {
- $thumbnail_id = intval( $postarr['_thumbnail_id'] );
+ $thumbnail_id = (int) $postarr['_thumbnail_id'];
if ( -1 === $thumbnail_id ) {
delete_post_thumbnail( $post_ID );
} else {
@@ -4593,7 +4593,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p
// Prevent new post slugs that could result in URLs that conflict with date archives.
$conflicts_with_date_archive = false;
if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) {
- $slug_num = intval( $slug );
+ $slug_num = (int) $slug;
if ( $slug_num ) {
$permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
@@ -5266,7 +5266,7 @@ function get_page_children( $page_id, $pages ) {
// Build a hash of ID -> children.
$children = array();
foreach ( (array) $pages as $page ) {
- $children[ intval( $page->post_parent ) ][] = $page;
+ $children[ (int) $page->post_parent ][] = $page;
}
$page_list = array();
@@ -5310,7 +5310,7 @@ function get_page_hierarchy( &$pages, $page_id = 0 ) {
$children = array();
foreach ( (array) $pages as $p ) {
- $parent_id = intval( $p->post_parent );
+ $parent_id = (int) $p->post_parent;
$children[ $parent_id ][] = $p;
}
@@ -5519,7 +5519,7 @@ function get_pages( $args = array() ) {
if ( ! empty( $post_authors ) ) {
foreach ( $post_authors as $post_author ) {
// Do we have an author id or an author login?
- if ( 0 == intval( $post_author ) ) {
+ if ( 0 == (int) $post_author ) {
$post_author = get_user_by( 'login', $post_author );
if ( empty( $post_author ) ) {
continue;
diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php
index 33d8535533..aed8a10491 100644
--- a/wp-includes/rest-api.php
+++ b/wp-includes/rest-api.php
@@ -1320,7 +1320,7 @@ function rest_is_boolean( $maybe_bool ) {
* @return bool True if an integer, otherwise false.
*/
function rest_is_integer( $maybe_integer ) {
- return is_numeric( $maybe_integer ) && round( floatval( $maybe_integer ) ) === floatval( $maybe_integer );
+ return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer;
}
/**
@@ -2012,7 +2012,7 @@ function rest_sanitize_value_from_schema( $value, $args, $param = '' ) {
}
if ( 'string' === $args['type'] ) {
- return strval( $value );
+ return (string) $value;
}
return $value;
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index 5b2abc794a..58aaa37a81 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
@@ -499,10 +499,10 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
if ( $crop ) {
$size = $image_editor->get_size();
- $crop_x = round( ( $size['width'] * floatval( $request['x'] ) ) / 100.0 );
- $crop_y = round( ( $size['height'] * floatval( $request['y'] ) ) / 100.0 );
- $width = round( ( $size['width'] * floatval( $request['width'] ) ) / 100.0 );
- $height = round( ( $size['height'] * floatval( $request['height'] ) ) / 100.0 );
+ $crop_x = round( ( $size['width'] * (float) $request['x'] ) / 100.0 );
+ $crop_y = round( ( $size['height'] * (float) $request['y'] ) / 100.0 );
+ $width = round( ( $size['width'] * (float) $request['width'] ) / 100.0 );
+ $height = round( ( $size['height'] * (float) $request['height'] ) / 100.0 );
$result = $image_editor->crop( $crop_x, $crop_y, $width, $height );
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
index 089a5215ba..e76940f7b7 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
@@ -128,10 +128,10 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
'description' => wp_trim_words( $plugin['description'], 30, '...' ),
'id' => $plugin['slug'],
'rating' => $plugin['rating'] / 20,
- 'rating_count' => intval( $plugin['num_ratings'] ),
- 'active_installs' => intval( $plugin['active_installs'] ),
+ 'rating_count' => (int) $plugin['num_ratings'],
+ 'active_installs' => (int) $plugin['active_installs'],
'author_block_rating' => $plugin['author_block_rating'] / 20,
- 'author_block_count' => intval( $plugin['author_block_count'] ),
+ 'author_block_count' => (int) $plugin['author_block_count'],
'author' => wp_strip_all_tags( $plugin['author'] ),
'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ),
'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ),
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
index ecb2ec7e44..69a45dce88 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
@@ -109,7 +109,7 @@ class WP_REST_Block_Renderer_Controller extends WP_REST_Controller {
public function get_item_permissions_check( $request ) {
global $post;
- $post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0;
+ $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0;
if ( 0 < $post_id ) {
$post = get_post( $post_id );
@@ -149,7 +149,7 @@ class WP_REST_Block_Renderer_Controller extends WP_REST_Controller {
public function get_item( $request ) {
global $post;
- $post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0;
+ $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0;
if ( 0 < $post_id ) {
$post = get_post( $post_id );
diff --git a/wp-includes/revision.php b/wp-includes/revision.php
index e99139df60..6fc288888d 100644
--- a/wp-includes/revision.php
+++ b/wp-includes/revision.php
@@ -547,7 +547,7 @@ function wp_revisions_to_keep( $post ) {
if ( true === $num ) {
$num = -1;
} else {
- $num = intval( $num );
+ $num = (int) $num;
}
if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
@@ -678,12 +678,12 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
return $value;
}
- $thumbnail_id = intval( $_REQUEST['_thumbnail_id'] );
+ $thumbnail_id = (int) $_REQUEST['_thumbnail_id'];
if ( $thumbnail_id <= 0 ) {
return '';
}
- return strval( $thumbnail_id );
+ return (string) $thumbnail_id;
}
/**
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php
index 3c7db94a65..1e239b0a1a 100644
--- a/wp-includes/rewrite.php
+++ b/wp-includes/rewrite.php
@@ -400,12 +400,12 @@ function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) {
// If the date of the post doesn't match the date specified in the URL, resolve to the date archive.
if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) {
// $matches[1] is the year the post was published.
- if ( intval( $query_vars['year'] ) !== intval( $matches[1] ) ) {
+ if ( (int) $query_vars['year'] !== (int) $matches[1] ) {
return $query_vars;
}
// $matches[2] is the month the post was published.
- if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && intval( $query_vars['monthnum'] ) !== intval( $matches[2] ) ) {
+ if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) {
return $query_vars;
}
}
@@ -437,7 +437,7 @@ function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) {
// If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage.
if ( '' !== $maybe_page ) {
- $query_vars['page'] = intval( $maybe_page );
+ $query_vars['page'] = (int) $maybe_page;
}
// Next, unset autodetected date-related query vars.
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index ea40f9e454..08ac3c9a0c 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -1048,7 +1048,7 @@ function get_term_children( $term_id, $taxonomy ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
- $term_id = intval( $term_id );
+ $term_id = (int) $term_id;
$terms = _get_term_hierarchy( $taxonomy );
@@ -3490,9 +3490,9 @@ function get_object_term_cache( $id, $taxonomy ) {
$term_ids = array();
foreach ( $_term_ids as $term_id ) {
if ( is_numeric( $term_id ) ) {
- $term_ids[] = intval( $term_id );
+ $term_ids[] = (int) $term_id;
} elseif ( isset( $term_id->term_id ) ) {
- $term_ids[] = intval( $term_id->term_id );
+ $term_ids[] = (int) $term_id->term_id;
}
}
@@ -3948,12 +3948,12 @@ function _split_shared_term( $term_id, $term_taxonomy_id, $record = true ) {
if ( is_object( $term_id ) ) {
$shared_term = $term_id;
- $term_id = intval( $shared_term->term_id );
+ $term_id = (int) $shared_term->term_id;
}
if ( is_object( $term_taxonomy_id ) ) {
$term_taxonomy = $term_taxonomy_id;
- $term_taxonomy_id = intval( $term_taxonomy->term_taxonomy_id );
+ $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id;
}
// If there are no shared term_taxonomy rows, there's nothing to do here.
@@ -4120,7 +4120,7 @@ function _wp_batch_split_terms() {
// Rekey shared term array for faster lookups.
$_shared_terms = array();
foreach ( $shared_terms as $shared_term ) {
- $term_id = intval( $shared_term->term_id );
+ $term_id = (int) $shared_term->term_id;
$_shared_terms[ $term_id ] = $shared_term;
}
$shared_terms = $_shared_terms;
@@ -4134,7 +4134,7 @@ function _wp_batch_split_terms() {
$skipped_first_term = array();
$taxonomies = array();
foreach ( $shared_tts as $shared_tt ) {
- $term_id = intval( $shared_tt->term_id );
+ $term_id = (int) $shared_tt->term_id;
// Don't split the first tt belonging to a given term_id.
if ( ! isset( $skipped_first_term[ $term_id ] ) ) {
diff --git a/wp-includes/update.php b/wp-includes/update.php
index a5df68a40f..a946523d03 100644
--- a/wp-includes/update.php
+++ b/wp-includes/update.php
@@ -322,7 +322,7 @@ function wp_update_plugins( $extra_stats = array() ) {
foreach ( $plugins as $file => $p ) {
$new_option->checked[ $file ] = $p['Version'];
- if ( ! isset( $current->checked[ $file ] ) || strval( $current->checked[ $file ] ) !== strval( $p['Version'] ) ) {
+ if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) {
$plugin_changed = true;
}
}
@@ -527,7 +527,7 @@ function wp_update_themes( $extra_stats = array() ) {
$theme_changed = false;
foreach ( $checked as $slug => $v ) {
- if ( ! isset( $last_update->checked[ $slug ] ) || strval( $last_update->checked[ $slug ] ) !== strval( $v ) ) {
+ if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) {
$theme_changed = true;
}
}
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index 72259b2652..6aa98d53aa 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -134,7 +134,7 @@ $is_IIS = ! $is_apache && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS'
*
* @global bool $is_iis7
*/
-$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7;
+$is_iis7 = $is_IIS && (int) substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) >= 7;
/**
* Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e45e752c97..6e5209875c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.6-alpha-49107';
+$wp_version = '5.6-alpha-49108';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-includes/widgets/class-wp-widget-links.php b/wp-includes/widgets/class-wp-widget-links.php
index 92b2f5dd00..e90b558ade 100644
--- a/wp-includes/widgets/class-wp-widget-links.php
+++ b/wp-includes/widgets/class-wp-widget-links.php
@@ -109,8 +109,8 @@ class WP_Widget_Links extends WP_Widget {
$instance['orderby'] = $new_instance['orderby'];
}
- $instance['category'] = intval( $new_instance['category'] );
- $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
+ $instance['category'] = (int) $new_instance['category'];
+ $instance['limit'] = ! empty( $new_instance['limit'] ) ? (int) $new_instance['limit'] : -1;
return $instance;
}
@@ -138,7 +138,7 @@ class WP_Widget_Links extends WP_Widget {
)
);
$link_cats = get_terms( array( 'taxonomy' => 'link_category' ) );
- $limit = intval( $instance['limit'] );
+ $limit = (int) $instance['limit'];
if ( ! $limit ) {
$limit = -1;
}
@@ -148,7 +148,7 @@ class WP_Widget_Links extends WP_Widget {