ntf( /* translators: 1: source value, 2: forbidden key */ __( 'A speculation rule of source "%1$s" must not include a "%2$s" key.' ), 'document', 'urls' ), '6.8.0' ); return false; } } // If there is an 'eagerness' key specified, make sure it's valid. if ( isset( $rule['eagerness'] ) ) { if ( ! self::is_valid_eagerness( $rule['eagerness'] ) ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: invalid eagerness value */ __( 'The value "%s" is not a valid eagerness for a speculation rule.' ), esc_html( $rule['eagerness'] ) ), '6.8.0' ); return false; } if ( isset( $rule['where'] ) && 'immediate' === $rule['eagerness'] ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: forbidden eagerness value */ __( 'The eagerness value "%s" is forbidden for document-level speculation rules.' ), 'immediate' ), '6.8.0' ); return false; } } if ( ! isset( $this->rules_by_mode[ $mode ] ) ) { $this->rules_by_mode[ $mode ] = array(); } $this->rules_by_mode[ $mode ][ $id ] = $rule; return true; } /** * Checks whether a speculation rule for the given mode and ID already exists. * * @since 6.8.0 * * @param string $mode Speculative loading mode. Either 'prefetch' or 'prerender'. * @param string $id Unique string identifier for the speculation rule. * @return bool True if the rule already exists, false otherwise. */ public function has_rule( string $mode, string $id ): bool { return isset( $this->rules_by_mode[ $mode ][ $id ] ); } /** * Returns the speculation rules data ready to be JSON-encoded. * * @since 6.8.0 * * @return array> Speculation rules data. */ #[ReturnTypeWillChange] public function jsonSerialize() { // Strip the IDs for JSON output, since they are not relevant for the Speculation Rules API. return array_map( static function ( array $rules ) { return array_values( $rules ); }, array_filter( $this->rules_by_mode ) ); } /** * Checks whether the given ID is valid. * * @since 6.8.0 * * @param string $id Unique string identifier for the speculation rule. * @return bool True if the ID is valid, false otherwise. */ private function is_valid_id( string $id ): bool { return (bool) preg_match( '/^[a-z][a-z0-9_-]+$/', $id ); } /** * Checks whether the given speculation rules mode is valid. * * @since 6.8.0 * * @param string $mode Speculation rules mode. * @return bool True if valid, false otherwise. */ public static function is_valid_mode( string $mode ): bool { return isset( self::$mode_allowlist[ $mode ] ); } /** * Checks whether the given speculation rules eagerness is valid. * * @since 6.8.0 * * @param string $eagerness Speculation rules eagerness. * @return bool True if valid, false otherwise. */ public static function is_valid_eagerness( string $eagerness ): bool { return isset( self::$eagerness_allowlist[ $eagerness ] ); } /** * Checks whether the given speculation rules source is valid. * * @since 6.8.0 * * @param string $source Speculation rules source. * @return bool True if valid, false otherwise. */ public static function is_valid_source( string $source ): bool { return isset( self::$source_allowlist[ $source ] ); } } } /** * This method is used to add middleware to the callback function. The * middleware should be a callable function that takes a request as an * argument and returns a response. The default middleware is to switch * the user locale to the current user locale. */ public function callbackMiddleware(?callable $callback, ?callable $middleware): callable { return function ($request) use ($callback, $middleware) { if (is_callable($middleware)) { $middleware($request); } else { $this->defaultMiddlewareCallback(); } return $callback($request); }; } /** * This method is used to switch the user locale to the current user locale. * This is important because we will otherwise show the default site * language to the user for the Tasks and Notifications. Those * translations are created in PHP and not in JS. */ private function defaultMiddlewareCallback(): void { switch_to_user_locale(get_current_user_id()); } /** * The default permission callback, will check if the nonce is valid and if * the user has the required permissions to do a request. * @return bool|\WP_Error */ public function defaultPermissionCallback(\WP_REST_Request $request) { $method = $request->get_method(); $nonce = $request->get_param('nonce'); if (($method === 'POST') && ($this->verifyNonce($nonce) === false)) { return new \WP_Error( 'rest_forbidden', esc_html__('Forbidden.', 'really-simple-ssl'), ['status' => 403] ); } return true; } /** * Process the given methods and compare them to the allowed * {@see \WP_REST_Server::ALLMETHODS} methods. Remove unwanted entries and * cleanup method usage from, for example, "get " to "GET". * * @return string From "get, POSt, fake" to "GET,POST" */ private function normalizeMethods(string $methods): string { // Split into array, trim whitespace and uppercase entries $methodsArray = array_map('trim', explode(',', $methods)); $methodsArray = array_map('strtoupper', $methodsArray); // Split allowed entries into array and trim whitespaces $allowedMethodsArray = array_map('trim', explode(',', \WP_REST_Server::ALLMETHODS)); // Keep only allowed methods $methodsArray = array_intersect($methodsArray, $allowedMethodsArray); $methodsArray = array_values(array_unique($methodsArray)); // Convert back to CSV format for register_rest_route usage return implode(',', $methodsArray); } }
Fatal error: Uncaught ReflectionException: Class "ReallySimplePlugins\RSS\Core\Managers\EndpointManager" does not exist in /htdocs/wp-content/plugins/really-simple-ssl/core/bootstrap/App.php:137 Stack trace: #0 /htdocs/wp-content/plugins/really-simple-ssl/core/bootstrap/App.php(137): ReflectionClass->__construct('ReallySimplePlu...') #1 /htdocs/wp-content/plugins/really-simple-ssl/core/bootstrap/Plugin.php(35): ReallySimplePlugins\RSS\Core\Bootstrap\App->make('ReallySimplePlu...') #2 /htdocs/wp-content/plugins/really-simple-ssl/core/really-simple-security-core.php(27): ReallySimplePlugins\RSS\Core\Bootstrap\Plugin->__construct() #3 /htdocs/wp-content/plugins/really-simple-ssl/rlrsssl-really-simple-ssl.php(238): require_once('/htdocs/wp-cont...') #4 /htdocs/wp-settings.php(560): include_once('/htdocs/wp-cont...') #5 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-content/plugins/really-simple-ssl/core/bootstrap/App.php on line 137