芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/wp-statistics/src/Abstracts/BasePage.php
pageSlug)) { $this->init(); } } protected function init() { } protected function disableScreenOption() { add_filter('screen_options_show_screen', '__return_false'); } public function render() { } /** * Validates the given date range. * * @throws Exception */ public function validateDateRange() { $from = Request::get('from'); $to = Request::get('to'); // If date range is empty no validation is needed if (empty($from) && empty($to)) return; // Check if `from` or `to` is empty, throw error if (empty($from) || empty($to)) { throw new Exception(esc_html__('Invalid date: provided date range is not valid.', 'wp-statistics')); } // Check if `from` and `to` are not valid dates, throw error if (!DateTime::isValidDate($from) || !DateTime::isValidDate($to)) { throw new Exception(esc_html__('Invalid date: provided date range is not in the right format.', 'wp-statistics')); } // If starting date is greater than ending date, throw error if (strtotime($from) > strtotime($to)) { throw new Exception(esc_html__('Invalid date: starting date is greater than ending date.', 'wp-statistics')); } } public function view() { try { $this->validateDateRange(); $this->render(); } catch (Exception $e) { Notice::renderNotice($e->getMessage(), $e->getCode(), 'error'); } } }