| @@ -4,8 +4,13 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package MainWP\Dashboard |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +// Exit. | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit; | |
| 11 | +} | |
| 12 | + | |
| 8 | 13 | /** |
| 9 | 14 | * Filters a variable with a specified filter. |
| 10 | 15 | * |
| 11 | 16 | * This is a polyfill function intended to be used in place of PHP's |
| @@ -31,9 +36,9 @@ | ||
| 31 | 36 | * @return string an ISO 8601 extended formatted time |
| 32 | 37 | */ |
| 33 | 38 | function mainwp_module_log_get_iso_8601_extended_date( $time = false, $offset = 0 ) { |
| 34 | 39 | if ( $time ) { |
| 35 | - $microtime = (float) $time . '.0000'; | |
| 40 | + $microtime = (float) ( $time . '.0000' ); | |
| 36 | 41 | } else { |
| 37 | 42 | $microtime = microtime( true ); |
| 38 | 43 | } |
| 39 | 44 | |
| @@ -40,8 +45,8 @@ | ||
| 40 | 45 | $micro_seconds = sprintf( '%06d', ( $microtime - floor( $microtime ) ) * 1000000 ); |
| 41 | 46 | $offset_string = sprintf( 'Etc/GMT%s%d', $offset < 0 ? '+' : '-', abs( $offset ) ); |
| 42 | 47 | |
| 43 | 48 | $timezone = new DateTimeZone( $offset_string ); |
| 44 | - $date = new DateTime( gmdate( 'Y-m-d H:i:s.' . $micro_seconds, $microtime ), $timezone ); | |
| 49 | + $date = new DateTime( gmdate( 'Y-m-d H:i:s.' . $micro_seconds, (int) $microtime ), $timezone ); | |
| 45 | 50 | |
| 46 | 51 | return $date->format( 'Y-m-d\TH:i:sO' ); |
| 47 | 52 | } |