$controller = new $controller(); $this->$controller->register_routes(); } } /** * Adds data stores. * * @param array $data_stores List of data stores. * @return array */ public static function add_data_stores( $data_stores ) { return array_merge( $data_stores, array( 'report-revenue-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore', 'report-orders' => 'Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore', 'report-orders-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore', 'report-products' => 'Automattic\WooCommerce\Admin\API\Reports\Products\DataStore', 'report-variations' => 'Automattic\WooCommerce\Admin\API\Reports\Variations\DataStore', 'report-products-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Products\Stats\DataStore', 'report-variations-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Variations\Stats\DataStore', 'report-categories' => 'Automattic\WooCommerce\Admin\API\Reports\Categories\DataStore', 'report-taxes' => 'Automattic\WooCommerce\Admin\API\Reports\Taxes\DataStore', 'report-taxes-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats\DataStore', 'report-coupons' => 'Automattic\WooCommerce\Admin\API\Reports\Coupons\DataStore', 'report-coupons-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\DataStore', 'report-downloads' => 'Automattic\WooCommerce\Admin\API\Reports\Downloads\DataStore', 'report-downloads-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Downloads\Stats\DataStore', 'admin-note' => 'Automattic\WooCommerce\Admin\Notes\DataStore', 'report-customers' => 'Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore', 'report-customers-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Customers\Stats\DataStore', 'report-stock-stats' => 'Automattic\WooCommerce\Admin\API\Reports\Stock\Stats\DataStore', ) ); } /** * Add the currency symbol (in addition to currency code) to each Order * object in REST API responses. For use in formatAmount(). * * @param {WP_REST_Response} $response REST response object. * @returns {WP_REST_Response} */ public static function add_currency_symbol_to_order_response( $response ) { $response_data = $response->get_data(); $currency_code = $response_data['currency']; $currency_symbol = get_woocommerce_currency_symbol( $currency_code ); $response_data['currency_symbol'] = html_entity_decode( $currency_symbol ); $response->set_data( $response_data ); return $response; } }