plugin_includes(); } /** * Register the hooks. */ public function plugin_includes() { add_action( 'template_redirect', array( &$this, 'aitasi_redirect_mm' ) ); } /** * Whether the current page is the login or register page. * * @return bool */ public function is_valid_page() { return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ), true ); } /** * Show the maintenance page to visitors who are not logged in. */ public function aitasi_redirect_mm() { // Logged in users never see the maintenance page. if ( ! is_user_logged_in() && ! is_admin() && ! $this->is_valid_page() ) { // Show maintenance page. $this->load_sm_page(); } } /** * Output the coming soon page and stop. */ public function load_sm_page() { header( 'HTTP/1.0 503 Service Unavailable' ); include_once 'template/comingsoon.php'; exit(); } } $GLOBALS['aitasi_coming_soon'] = new AITASI_COMING_SOON(); } } if ( is_admin() ) : // Load only if we are viewing an admin page. /** * Register settings and call sanitation functions. */ function shaped_plugin_aitasi_register_settings() { register_setting( 'aitasi_p_options', 'aitasi_options', 'aitasi_validate_options' ); } add_action( 'admin_init', 'shaped_plugin_aitasi_register_settings' ); endif; // End of the admin-only code.