| @@ -6,8 +6,13 @@ | ||
| 6 | 6 | * |
| 7 | 7 | * @package MainWP/Dashboard |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +// Exit if accessed directly. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 10 | 15 | if ( ! defined( 'FILTER_SANITIZE_STRING_COMPATIBLE' ) ) { // to compatible. |
| 11 | 16 | define( 'FILTER_SANITIZE_STRING_COMPATIBLE', 513 ); |
| 12 | 17 | } |
| 13 | 18 | |
| @@ -33,8 +38,9 @@ | ||
| 33 | 38 | * @param bool $echo_out Defines weather or not to echo error message. |
| 34 | 39 | * @return string|bool $msg|false |
| 35 | 40 | */ |
| 36 | 41 | function mainwp_do_not_have_permissions( $where = '', $echo_out = true ) { |
| 42 | + /* translators: %s: Page or section name where access was denied */ | |
| 37 | 43 | $msg = sprintf( esc_html__( 'You do not have sufficient permissions to access this page (%s).', 'mainwp' ), ucwords( $where ) ); |
| 38 | 44 | if ( $echo_out ) { |
| 39 | 45 | echo '<div class="mainwp-permission-error"><p>' . esc_html( $msg ) . '</p>If you need access to this page please contact the dashboard administrator.</div>'; |
| 40 | 46 | } else { |
| @@ -84,9 +90,9 @@ | ||
| 84 | 90 | * @param array $output Array output. |
| 85 | 91 | */ |
| 86 | 92 | function mainwp_send_json_output( $output ) { |
| 87 | 93 | if ( is_array( $output ) ) { |
| 88 | - $output['execute_time'] = \MainWP\Dashboard\MainWP_Execution_Helper::instance()->get_exec_time(); | |
| 94 | + $output['execute_time'] = \MainWP\Dashboard\MainWP_Execution_Helper::get_run_time(); | |
| 89 | 95 | } |
| 90 | 96 | wp_send_json( $output ); |
| 91 | 97 | } |
| 92 | 98 | } |
| @@ -129,13 +135,15 @@ | ||
| 129 | 135 | if ( ! function_exists( 'mainwp_get_current_utc_datetime_db' ) ) { |
| 130 | 136 | /** |
| 131 | 137 | * Function mainwp_get_current_utc_datetime_db. |
| 132 | 138 | * |
| 139 | + * @param bool $get_db_datetime To get db datetime. | |
| 140 | + * | |
| 133 | 141 | * @return int |
| 134 | 142 | */ |
| 135 | - function mainwp_get_current_utc_datetime_db() { | |
| 143 | + function mainwp_get_current_utc_datetime_db( $get_db_datetime = true ) { | |
| 136 | 144 | $utcTime = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) ); |
| 137 | - return $utcTime->format( 'Y-m-d H:i:s' ); // Outputs: YYYY-MM-DD HH:MM:SS. | |
| 145 | + return $get_db_datetime ? $utcTime->format( 'Y-m-d H:i:s' ) : $utcTime->getTimestamp(); // Outputs: YYYY-MM-DD HH:MM:SS. | |
| 138 | 146 | } |
| 139 | 147 | } |
| 140 | 148 | |
| 141 | 149 | if ( ! function_exists( 'mainwp_secure_request' ) ) { |