Automattic\WooCommerce\Admin\API

Init::rest_api_init()publicWC 1.0

Init REST API.

Метод класса: Init{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$Init = new Init();
$Init->rest_api_init();

Код Init::rest_api_init() WC 9.0.2

public function rest_api_init() {
	$controllers = array(
		'Automattic\WooCommerce\Admin\API\Features',
		'Automattic\WooCommerce\Admin\API\Notes',
		'Automattic\WooCommerce\Admin\API\NoteActions',
		'Automattic\WooCommerce\Admin\API\Coupons',
		'Automattic\WooCommerce\Admin\API\Data',
		'Automattic\WooCommerce\Admin\API\DataCountries',
		'Automattic\WooCommerce\Admin\API\DataDownloadIPs',
		'Automattic\WooCommerce\Admin\API\Experiments',
		'Automattic\WooCommerce\Admin\API\Marketing',
		'Automattic\WooCommerce\Admin\API\MarketingOverview',
		'Automattic\WooCommerce\Admin\API\MarketingRecommendations',
		'Automattic\WooCommerce\Admin\API\MarketingChannels',
		'Automattic\WooCommerce\Admin\API\MarketingCampaigns',
		'Automattic\WooCommerce\Admin\API\MarketingCampaignTypes',
		'Automattic\WooCommerce\Admin\API\Notice',
		'Automattic\WooCommerce\Admin\API\Options',
		'Automattic\WooCommerce\Admin\API\Orders',
		'Automattic\WooCommerce\Admin\API\PaymentGatewaySuggestions',
		'Automattic\WooCommerce\Admin\API\Products',
		'Automattic\WooCommerce\Admin\API\ProductAttributes',
		'Automattic\WooCommerce\Admin\API\ProductAttributeTerms',
		'Automattic\WooCommerce\Admin\API\ProductCategories',
		'Automattic\WooCommerce\Admin\API\ProductVariations',
		'Automattic\WooCommerce\Admin\API\ProductReviews',
		'Automattic\WooCommerce\Admin\API\ProductVariations',
		'Automattic\WooCommerce\Admin\API\ProductsLowInStock',
		'Automattic\WooCommerce\Admin\API\SettingOptions',
		'Automattic\WooCommerce\Admin\API\Themes',
		'Automattic\WooCommerce\Admin\API\Plugins',
		'Automattic\WooCommerce\Admin\API\OnboardingFreeExtensions',
		'Automattic\WooCommerce\Admin\API\OnboardingProductTypes',
		'Automattic\WooCommerce\Admin\API\OnboardingProfile',
		'Automattic\WooCommerce\Admin\API\OnboardingTasks',
		'Automattic\WooCommerce\Admin\API\OnboardingThemes',
		'Automattic\WooCommerce\Admin\API\OnboardingPlugins',
		'Automattic\WooCommerce\Admin\API\OnboardingProducts',
		'Automattic\WooCommerce\Admin\API\NavigationFavorites',
		'Automattic\WooCommerce\Admin\API\Taxes',
		'Automattic\WooCommerce\Admin\API\MobileAppMagicLink',
		'Automattic\WooCommerce\Admin\API\ShippingPartnerSuggestions',
	);

	$product_form_controllers = array();
	if ( Features::is_enabled( 'new-product-management-experience' ) ) {
		$product_form_controllers[] = 'Automattic\WooCommerce\Admin\API\ProductForm';
	}

	if ( Features::is_enabled( 'launch-your-store' ) ) {
		$controllers[] = 'Automattic\WooCommerce\Admin\API\LaunchYourStore';
	}

	if ( Features::is_enabled( 'analytics' ) ) {
		$analytics_controllers = array(
			'Automattic\WooCommerce\Admin\API\Customers',
			'Automattic\WooCommerce\Admin\API\Leaderboards',
			'Automattic\WooCommerce\Admin\API\Reports\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Import\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Export\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Products\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Variations\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Products\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Variations\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Revenue\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Orders\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Categories\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Taxes\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Coupons\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Stock\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Stock\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Downloads\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Downloads\Stats\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Customers\Controller',
			'Automattic\WooCommerce\Admin\API\Reports\Customers\Stats\Controller',
		);

		// The performance indicators controller must be registered last, after other /stats endpoints have been registered.
		$analytics_controllers[] = 'Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller';
		$controllers             = array_merge( $controllers, $analytics_controllers, $product_form_controllers );
	}

	/**
	 * Filter for the WooCommerce Admin REST controllers.
	 *
	 * @since 3.5.0
	 * @param array $controllers List of rest API controllers.
	 */
	$controllers = apply_filters( 'woocommerce_admin_rest_controllers', $controllers );

	foreach ( $controllers as $controller ) {
		$this->$controller = new $controller();
		$this->$controller->register_routes();
	}
}