$settings['override_end'] ) ) { $details['override_active'] = false; } else { $details['override_active'] = true; if ( 'activate' === $details['override_type'] ) { $details['active'] = true; } else { $details['active'] = false; } } // If the active file does not exist, completely disable the away mode feature to allow an administrator // to regain access to their site. if ( ! $details['has_active_file'] ) { $details['active'] = false; $details['remaining'] = false; $details['next'] = false; $details['length'] = false; } if ( ! isset( $details['error'] ) ) { $details['error'] = false; } if ( $get_details ) { return $details; } return $details['active']; } /** * Execute away mode functionality * * @return void */ public function run_active_check() { if ( wp_doing_ajax() ) { return; } $away_mode_details = self::is_active( true ); if ( $away_mode_details['active'] ) { ITSEC_Log::add_notice( 'away_mode', 'away-mode-active', array( 'login_details' => ITSEC_Lib::get_login_details(), 'away_mode_details' => $away_mode_details ) ); wp_redirect( get_option( 'siteurl' ) ); wp_clear_auth_cookie(); die(); } } /** * Register the away mode file as a managed file. * * @param array $files * * @return array */ public function register_managed_file( $files ) { require_once( dirname( __FILE__ ) . '/utilities.php' ); $files[] = ITSEC_Away_Mode_Utilities::get_active_file_name(); return $files; } /** * Register verbs for Sync. * * @since 3.6.0 * * @param Ithemes_Sync_API $api API object. */ public function register_sync_verbs( $api ) { $api->register( 'itsec-get-away-mode', 'Ithemes_Sync_Verb_ITSEC_Get_Away_Mode', dirname( __FILE__ ) . '/sync-verbs/itsec-get-away-mode.php' ); $api->register( 'itsec-override-away-mode', 'Ithemes_Sync_Verb_ITSEC_Override_Away_Mode', dirname( __FILE__ ) . '/sync-verbs/itsec-override-away-mode.php' ); } /** * Filter to add verbs to the response for the itsec-get-everything verb. * * @since 3.6.0 * * @param array Array of verbs. * * @return array Array of verbs. */ public function register_sync_get_everything_verbs( $verbs ) { $verbs['away_mode'][] = 'itsec-get-away-mode'; return $verbs; } }