its main Schema Type. * * @throws \Exception If the schema does not exist. * @param string $name Name of schema. * @param string $version API Version being requested. * @return AbstractRoute */ public function get( $name, $version = 'v1' ) { $route = $this->routes[ $version ][ $name ] ?? false; if ( ! $route ) { throw new \Exception( "{$name} {$version} route does not exist" ); } return new $route( $this->schema_controller, $this->schema_controller->get( $route::SCHEMA_TYPE, $route::SCHEMA_VERSION ) ); } /** * Get a route path without instantiating the corresponding RoutesController object. * * @throws \Exception If the schema does not exist. * * @param string $version API Version being requested. * @param string $controller Whether to return controller name. If false, returns empty array. Note: * When $controller param is true, the output should not be used directly in front-end code, to prevent class names from leaking. It's not a security issue necessarily, but it's not a good practice. * When $controller param is false, it currently returns and empty array. But it can be modified in future to return include more details about the route info that can be used in frontend. * * @return string[] List of route paths. */ public function get_all_routes( $version = 'v1', $controller = false ) { $routes = array(); foreach ( $this->routes[ $version ] as $key => $route_class ) { if ( ! method_exists( $route_class, 'get_path_regex' ) ) { throw new \Exception( esc_html( "{$route_class} route does not have a get_path_regex method" ) ); } $route_path = '/' . trailingslashit( self::$api_namespace ) . $version . $route_class::get_path_regex(); $routes[ $route_path ] = $controller ? $route_class : array(); } return $routes; } /** * Register defined list of routes with WordPress. * * @param string $version API Version being registered.. * @param string $namespace Overrides the default route namespace. */ protected function register_routes( $version = 'v1', $namespace = 'wc/store/v1' ) { if ( ! isset( $this->routes[ $version ] ) ) { return; } $route_identifiers = array_keys( $this->routes[ $version ] ); foreach ( $route_identifiers as $route ) { $route_instance = $this->get( $route, $version ); $route_instance->set_namespace( $namespace ); register_rest_route( $route_instance->get_namespace(), $route_instance->get_path(), $route_instance->get_args() ); } } }
Warning: Class "Automattic\WooCommerce\StoreApi\RoutesController" not found in /home/valigeria/public_html/wp-content/plugins/woocommerce/src/StoreApi/deprecated.php on line 73

Warning: Class "Automattic\WooCommerce\StoreApi\Formatters" not found in /home/valigeria/public_html/wp-content/plugins/woocommerce/src/StoreApi/deprecated.php on line 73

Fatal error: Uncaught Error: Failed opening required '/home/valigeria/public_html/wp-content/plugins/woocommerce/src/StoreApi/Formatters.php' (include_path='.:/opt/alt/php81/usr/share/pear:/opt/alt/php81/usr/share/php:/usr/share/pear:/usr/share/php') in /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-php-autoloader.php:90 Stack trace: #0 [internal function]: Automattic\Jetpack\Autoloader\jp12ea33bcea6a641c43d24712adc9f0b6\PHP_Autoloader::load_class('Automattic\\WooC...') #1 /home/valigeria/public_html/wp-content/plugins/woocommerce/src/StoreApi/deprecated.php(73): class_alias('Automattic\\WooC...', 'Automattic\\WooC...') #2 /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-version-loader.php(89): require_once('/home/valigeria...') #3 /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-autoloader-handler.php(124): Automattic\Jetpack\Autoloader\jp12ea33bcea6a641c43d24712adc9f0b6\Version_Loader->load_filemap() #4 /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-autoloader.php(80): Automattic\Jetpack\Autoloader\jp12ea33bcea6a641c43d24712adc9f0b6\Autoloader_Handler->activate_autoloader(Array) #5 /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/autoload_packages.php(13): Automattic\Jetpack\Autoloader\jp12ea33bcea6a641c43d24712adc9f0b6\Autoloader::init() #6 /home/valigeria/public_html/wp-content/plugins/woocommerce/src/Autoloader.php(37): require('/home/valigeria...') #7 /home/valigeria/public_html/wp-content/plugins/woocommerce/woocommerce.php(31): Automattic\WooCommerce\Autoloader::init() #8 /home/valigeria/public_html/wp-settings.php(517): include_once('/home/valigeria...') #9 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...') #10 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...') #11 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...') #12 /home/valigeria/public_html/index.php(17): require('/home/valigeria...') #13 {main} thrown in /home/valigeria/public_html/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-php-autoloader.php on line 90