AI
1 year ago
RateLimits
4 weeks ago
Reports
4 weeks ago
Templates
3 years ago
views
4 weeks ago
AnalyticsImports.php
5 months ago
Coupons.php
4 years ago
CustomAttributeTraits.php
4 years ago
Customers.php
4 years ago
Data.php
4 years ago
DataCountries.php
4 years ago
DataDownloadIPs.php
4 years ago
Experiments.php
4 years ago
Features.php
4 years ago
Init.php
4 weeks ago
LaunchYourStore.php
1 year ago
Leaderboards.php
1 year ago
Marketing.php
2 months ago
MarketingCampaignTypes.php
3 years ago
MarketingCampaigns.php
2 years ago
MarketingChannels.php
3 years ago
MarketingOverview.php
2 months ago
MarketingRecommendations.php
2 years ago
MobileAppMagicLink.php
3 years ago
MobileAppQRLogin.php
4 weeks ago
NoteActions.php
4 weeks ago
Notes.php
4 weeks ago
Notice.php
1 year ago
OnboardingFreeExtensions.php
1 year ago
OnboardingPlugins.php
4 weeks ago
OnboardingProductTypes.php
4 years ago
OnboardingProducts.php
2 years ago
OnboardingProfile.php
1 year ago
OnboardingTasks.php
9 months ago
OnboardingThemes.php
9 months ago
Options.php
4 weeks ago
Orders.php
1 year ago
PaymentGatewaySuggestions.php
2 months ago
Plugins.php
2 months ago
ProductAttributeTerms.php
4 years ago
ProductAttributes.php
4 years ago
ProductCategories.php
4 years ago
ProductForm.php
3 years ago
ProductReviews.php
4 years ago
ProductVariations.php
1 year ago
Products.php
1 year ago
ProductsLowInStock.php
4 months ago
SettingOptions.php
3 years ago
ShippingPartnerSuggestions.php
1 month ago
Taxes.php
4 years ago
Themes.php
2 years ago
DataCountries.php
59 lines
| 1 | <?php |
| 2 | /** |
| 3 | * REST API Data countries controller. |
| 4 | * |
| 5 | * Handles requests to the /data/countries endpoint. |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\WooCommerce\Admin\API; |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | /** |
| 13 | * REST API Data countries controller class. |
| 14 | * |
| 15 | * @internal |
| 16 | * @extends WC_REST_Data_Countries_Controller |
| 17 | */ |
| 18 | class DataCountries extends \WC_REST_Data_Countries_Controller { |
| 19 | |
| 20 | /** |
| 21 | * Endpoint namespace. |
| 22 | * |
| 23 | * @var string |
| 24 | */ |
| 25 | protected $namespace = 'wc-analytics'; |
| 26 | |
| 27 | /** |
| 28 | * Register routes. |
| 29 | * |
| 30 | * @since 3.5.0 |
| 31 | */ |
| 32 | public function register_routes() { |
| 33 | register_rest_route( |
| 34 | $this->namespace, |
| 35 | '/' . $this->rest_base . '/locales', |
| 36 | array( |
| 37 | array( |
| 38 | 'methods' => \WP_REST_Server::READABLE, |
| 39 | 'callback' => array( $this, 'get_locales' ), |
| 40 | 'permission_callback' => array( $this, 'get_items_permissions_check' ), |
| 41 | ), |
| 42 | 'schema' => array( $this, 'get_public_item_schema' ), |
| 43 | ) |
| 44 | ); |
| 45 | |
| 46 | parent::register_routes(); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get country fields. |
| 51 | * |
| 52 | * @return array |
| 53 | */ |
| 54 | public function get_locales() { |
| 55 | $locales = WC()->countries->get_country_locale(); |
| 56 | return rest_ensure_response( $locales ); |
| 57 | } |
| 58 | } |
| 59 |