| @@ -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 |
| @@ -17,9 +22,9 @@ | ||
| 17 | 22 | * |
| 18 | 23 | * @return Returns the filtered data, or FALSE if the filter fails. |
| 19 | 24 | */ |
| 20 | 25 | function mainwp_module_log_filter_var( $var_value, $filter = null, $options = array() ) { //phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed |
| 21 | - return call_user_func_array( array( '\MainWP\Dashboard\Module\Log\Log_Filter_Input', 'filter' ), func_get_args() ); | |
| 26 | + return call_user_func_array( array( '\MainWP\Dashboard\Module\Log\Log_Filter_Input', 'filter' ), func_get_args() ); | |
| 22 | 27 | } |
| 23 | 28 | |
| 24 | 29 | |
| 25 | 30 | /** |
| @@ -30,18 +35,18 @@ | ||
| 30 | 35 | * |
| 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 | - if ( $time ) { | |
| 35 | - $microtime = (float) $time . '.0000'; | |
| 36 | - } else { | |
| 37 | - $microtime = microtime( true ); | |
| 38 | - } | |
| 39 | + if ( $time ) { | |
| 40 | + $microtime = (float) ( $time . '.0000' ); | |
| 41 | + } else { | |
| 42 | + $microtime = microtime( true ); | |
| 43 | + } | |
| 39 | 44 | |
| 40 | - $micro_seconds = sprintf( '%06d', ( $microtime - floor( $microtime ) ) * 1000000 ); | |
| 41 | - $offset_string = sprintf( 'Etc/GMT%s%d', $offset < 0 ? '+' : '-', abs( $offset ) ); | |
| 45 | + $micro_seconds = sprintf( '%06d', ( $microtime - floor( $microtime ) ) * 1000000 ); | |
| 46 | + $offset_string = sprintf( 'Etc/GMT%s%d', $offset < 0 ? '+' : '-', abs( $offset ) ); | |
| 42 | 47 | |
| 43 | - $timezone = new DateTimeZone( $offset_string ); | |
| 44 | - $date = new DateTime( gmdate( 'Y-m-d H:i:s.' . $micro_seconds, $microtime ), $timezone ); | |
| 48 | + $timezone = new DateTimeZone( $offset_string ); | |
| 49 | + $date = new DateTime( gmdate( 'Y-m-d H:i:s.' . $micro_seconds, (int) $microtime ), $timezone ); | |
| 45 | 50 | |
| 46 | - return $date->format( 'Y-m-d\TH:i:sO' ); | |
| 51 | + return $date->format( 'Y-m-d\TH:i:sO' ); | |
| 47 | 52 | } |