| @@ -5,8 +5,10 @@ | ||
| 5 | 5 | * @package Timetics |
| 6 | 6 | */ |
| 7 | 7 | namespace Timetics\Core\DummyData\Provider; |
| 8 | 8 | |
| 9 | +defined( 'ABSPATH' ) || exit; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * Date time faker class |
| 11 | 13 | */ |
| 12 | 14 | class DateTime { |
| @@ -15,9 +17,9 @@ | ||
| 15 | 17 | * |
| 16 | 18 | * @return string |
| 17 | 19 | */ |
| 18 | 20 | public static function date( $format = 'Y-m-d' ) { |
| 19 | - return date( $format, self::timestamp() ); | |
| 21 | + return gmdate( $format, self::timestamp() ); | |
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * Get generated time |
| @@ -24,9 +26,9 @@ | ||
| 24 | 26 | * |
| 25 | 27 | * @return string |
| 26 | 28 | */ |
| 27 | 29 | public static function time( $format = 'h:i a' ) { |
| 28 | - return date( $format, self::timestamp() ); | |
| 30 | + return gmdate( $format, self::timestamp() ); | |
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | /** |
| 32 | 34 | * Get generated timestamp |
| @@ -37,9 +39,9 @@ | ||
| 37 | 39 | $start_timestamp = strtotime( '1970-01-01' ); |
| 38 | 40 | $end_timestamp = strtotime( '2030-12-31' ); |
| 39 | 41 | |
| 40 | 42 | // Generate a random timestamp within the valid range |
| 41 | - $random_timestamp = mt_rand( $start_timestamp, $end_timestamp ); | |
| 43 | + $random_timestamp = wp_rand( $start_timestamp, $end_timestamp ); | |
| 42 | 44 | |
| 43 | 45 | // Format the timestamp into a valid date format |
| 44 | 46 | return $random_timestamp; |
| 45 | 47 | } |