/** * Checks if REST API bypass is allowed on this network. * * @since 0.1.0 * @return boolean Enabled or disabled */ public function is_required_for_rest() { $setting = wds_nrl()->network_admin->get_option('allow_rest_api_network_wide'); if ('bypass' === $setting) { return false; } if ('require' === $setting) { return true; } return (bool) wds_nrl()->network_admin->get_option('enable_network_wide'); }
/** * Get an option value * * @since 0.1.0 * @param string $key Options array key * @return mixed Option value */ public function get_option($key) { return wds_nrl()->admin->get_option($key); }
{ switch ($field) { case 'version': return self::VERSION; case 'basename': case 'url': case 'path': case 'current_url': case 'requested_path': case 'network_admin': case 'admin': return $this->{$field}; default: throw new Exception('Invalid ' . __CLASS__ . ' property: ' . $field); } } } /** * Grab the WDS_Network_Require_Login object and return it. * Wrapper for WDS_Network_Require_Login::get_instance() * * @since 0.1.0 * @return WDS_Network_Require_Login Singleton instance of plugin class. */ function wds_nrl() { return WDS_Network_Require_Login::get_instance(); } // Kick it off wds_nrl();
/** * Field show_on callback which allows field to show if * it's determined that auth for REST API is required * * @since 0.1.1 * * @return bool Whether field should show */ public function any_required() { return $this->is_required_for_rest(wds_nrl()->admin->is_required()); }