本文整理匯總了PHP中ITSEC_Core::is_interactive方法的典型用法代碼示例。如果您正苦於以下問題:PHP ITSEC_Core::is_interactive方法的具體用法?PHP ITSEC_Core::is_interactive怎麽用?PHP ITSEC_Core::is_interactive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ITSEC_Core
的用法示例。
在下文中一共展示了ITSEC_Core::is_interactive方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validate_settings
protected function validate_settings()
{
// Only validate settings if the data was successfully sanitized.
if (!$this->can_save()) {
return;
}
require_once dirname(__FILE__) . '/utilities.php';
$id = $this->get_id();
if ('one-time' === $this->settings['type']) {
if ($this->settings['start'] >= $this->settings['end']) {
/* translators: 1: "Start Date", 2: "Start Time", 3: "End Date", 4: "End Time" */
$this->add_error(new WP_Error("itsec-validator-{$id}-start-after-end", sprintf(__('The %1$s and %2$s must be before the %3$s and %4$s.', 'better-wp-security'), __('Start Date', 'better-wp-security'), __('Start Time', 'better-wp-security'), __('End Date', 'better-wp-security'), __('End Time', 'better-wp-security'))));
$this->set_can_save(false);
} else {
if (false === ITSEC_Away_Mode_Utilities::is_current_timestamp_active($this->settings['start'], $this->settings['end'], true)) {
/* translators: 1: "End Date", 2: "End Time" */
$this->add_error(new WP_Error("itsec-validator-{$id}-end-already-ended", sprintf(__('The selected restriction date and time has already ended. Please select an %1$s and %2$s that has not already ended.', 'better-wp-security'), __('End Date', 'better-wp-security'), __('End Time', 'better-wp-security'))));
$this->set_can_save(false);
} else {
if (ITSEC_Core::is_interactive() && ITSEC_Away_Mode_Utilities::is_current_timestamp_active($this->settings['start'], $this->settings['end'])) {
/* translators: 1: "Start Date", 2: "Start Time" */
$this->add_error(new WP_Error("itsec-validator-{$id}-start-already-started", sprintf(__('The selected restriction date and time has already started and would result in locking you out immediately. Please select a %1$s and %2$s that has not already started.', 'better-wp-security'), __('Start Date', 'better-wp-security'), __('Start Time', 'better-wp-security'))));
$this->set_can_save(false);
}
}
}
} else {
if ($this->settings['start_time'] === $this->settings['end_time']) {
/* translators: 1: "Start Time", 2: "End Time" */
$this->add_error(new WP_Error("itsec-validator-{$id}-start-equals-end", sprintf(__('The %1$s and %2$s cannot be the same.', 'better-wp-security'), __('Start Time', 'better-wp-security'), __('End Time', 'better-wp-security'))));
$this->set_can_save(false);
} else {
if (ITSEC_Core::is_interactive() && ITSEC_Away_Mode_Utilities::is_current_time_active($this->settings['start_time'], $this->settings['end_time'])) {
/* translators: 1: "Start Time", 2: "End Time" */
$this->add_error(new WP_Error("itsec-validator-{$id}-settings-result-in-current-lockout", sprintf(__('The %1$s and %2$s settings restrict the current time and would result in locking you out immediately. Please select a %1$s and %2$s that does not restrict the current time.', 'better-wp-security'), __('Start Time', 'better-wp-security'), __('End Time', 'better-wp-security'))));
$this->set_can_save(false);
}
}
}
}