| 1 |
<?php |
| 2 |
/** |
| 3 |
* All of our package actions to register. |
| 4 |
* |
| 5 |
* @package ForceRefresh |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace JordanLeven\Plugins\ForceRefresh; |
| 9 |
|
| 10 |
define( 'DEBUG_MODE_ACTIVE_IN_HOURS', 48 ); |
| 11 |
|
| 12 |
/** |
| 13 |
* Function to get whether or not debug mode is currently enabled. |
| 14 |
* |
| 15 |
* @return bool True if debug mode is enabled |
| 16 |
*/ |
| 17 |
function get_option_debug_mode(): bool { |
| 18 |
$debug_active_date = (string) get_option( |
| 19 |
WP_FORCE_REFRESH_OPTION_DEBUG_ACTIVE_DATE, |
| 20 |
'' |
| 21 |
); |
| 22 |
|
| 23 |
if ( ! $debug_active_date ) { |
| 24 |
return false; |
| 25 |
} |
| 26 |
|
| 27 |
$time_current = strtotime( current_time( 'mysql' ) ); |
| 28 |
$time_debug = strtotime( $debug_active_date ); |
| 29 |
|
| 30 |
$difference_in_hours = abs( $time_current - $time_debug ) / 3600; |
| 31 |
return $difference_in_hours < DEBUG_MODE_ACTIVE_IN_HOURS; |
| 32 |
} |
| 33 |
|