/** * Checks if login is required on this site. is_required for public access * * @since 0.1.0 * * @return boolean Enabled or disabled */ protected function get_required_option_bool() { $setting = $this->get_option('require'); if ('enabled' === $setting) { return true; } if ('disabled' === $setting) { return false; } if ($this->network_admin) { return (bool) $this->network_admin->get_option('enable_network_wide'); } return false; }
/** * Add hooks and filters * * @since 0.1.0 * @return null */ public function hooks() { add_action('init', array($this, 'init')); add_action('get_header', array($this, 'maybe_auth_redirect')); add_filter('rest_authentication_errors', array($this, 'rest_maybe_auth_redirect'), 50); if (is_multisite()) { $this->network_admin->hooks(); } $this->admin->hooks(); }