From 57f225af1dd3e84b17006bf0a55adc2afb77ba33 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 9 Nov 2023 13:17:13 -0600 Subject: [PATCH] Replace rand with wp_rand --- src/my-calendar-core.php | 8 ++++---- src/my-calendar-help.php | 2 +- src/my-calendar-templates.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/my-calendar-core.php b/src/my-calendar-core.php index b8b5333cf..89f060fa8 100644 --- a/src/my-calendar-core.php +++ b/src/my-calendar-core.php @@ -184,7 +184,7 @@ function mc_register_styles() { global $wp_query; $version = mc_get_version(); if ( SCRIPT_DEBUG ) { - $version .= rand( 10000, 99999 ); + $version .= wp_rand( 10000, 99999 ); } $this_post = $wp_query->get_queried_object(); /** @@ -430,7 +430,7 @@ function mc_footer_js() { global $wp_query; $version = mc_get_version(); if ( SCRIPT_DEBUG ) { - $version = $version . '-' . mt_rand( 10000, 100000 ); + $version = $version . '-' . wp_rand( 10000, 100000 ); } /** * Disable scripting on mobile devices. @@ -577,7 +577,7 @@ function mc_admin_styles() { global $current_screen; $version = mc_get_version(); if ( SCRIPT_DEBUG ) { - $version .= rand( 10000, 100000 ); + $version .= wp_rand( 10000, 100000 ); } $id = $current_screen->id; $is_mc_page = isset( $_GET['post'] ) && (int) mc_get_option( 'uri_id' ) === (int) $_GET['post']; @@ -1556,7 +1556,7 @@ function mc_scripts() { global $current_screen; $version = mc_get_version(); if ( SCRIPT_DEBUG ) { - $version .= rand( 10000, 100000 ); + $version .= wp_rand( 10000, 100000 ); } $id = $current_screen->id; $slug = sanitize_title( __( 'My Calendar', 'my-calendar' ) ); diff --git a/src/my-calendar-help.php b/src/my-calendar-help.php index a41077993..e75b75c4e 100644 --- a/src/my-calendar-help.php +++ b/src/my-calendar-help.php @@ -196,7 +196,7 @@ function mc_help_link( $link_text, $modal_title, $query, $id, $echo = true ) { function mc_enqueue_modal_assets() { $version = mc_get_version(); if ( SCRIPT_DEBUG ) { - $version .= rand( 10000, 100000 ); + $version .= wp_rand( 10000, 100000 ); } // Load only for My Calendar admin pages. if ( false !== stripos( get_current_screen()->id, 'my-calendar' ) || 'widgets' === get_current_screen()->id || isset( $_GET['post'] ) && mc_get_option( 'uri_id' ) === $_GET['post'] ) { diff --git a/src/my-calendar-templates.php b/src/my-calendar-templates.php index 3a1796c33..e3b03b498 100644 --- a/src/my-calendar-templates.php +++ b/src/my-calendar-templates.php @@ -1179,7 +1179,7 @@ function mc_generate_map( $event, $source = 'event', $multiple = false, $geoloca if ( is_array( $locations ) ) { $multiple = ( count( $locations ) > 1 ) ? true : false; foreach ( $locations as $location ) { - $id = rand(); + $id = wp_rand(); $loc_id = $location->{$source . '_id'}; $source = ( 'event' === $source ) ? 'event' : 'location'; /**