Skip to content

Commit

Permalink
Replace rand with wp_rand
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Nov 9, 2023
1 parent 422d411 commit 57f225a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/my-calendar-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
/**
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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' ) );
Expand Down
2 changes: 1 addition & 1 deletion src/my-calendar-help.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) {
Expand Down
2 changes: 1 addition & 1 deletion src/my-calendar-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
/**
Expand Down

0 comments on commit 57f225a

Please sign in to comment.